Skip to content

Commit 6e8ca42

Browse files
committed
upgrade docusaurus
1 parent 8708cc0 commit 6e8ca42

File tree

16 files changed

+5146
-10379
lines changed

16 files changed

+5146
-10379
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@
115115
"@testing-library/dom": "^10.4.0",
116116
"@testing-library/react": "^16.2.0",
117117
"@testing-library/user-event": "^14.6.1",
118-
"@types/react": "^19.0.8",
119-
"@types/react-dom": "^19.0.3",
118+
"@types/react": "^19.1.8",
119+
"@types/react-dom": "^19.1.6",
120120
"@types/react-transition-group": "^4.4.12",
121121
"@typescript-eslint/eslint-plugin": "^8.23.0",
122122
"@typescript-eslint/parser": "^8.23.0",

src/Waypoint.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import useCallbackRef from '@restart/hooks/useCallbackRef';
22
import * as React from 'react';
33

44
import useWaypoint, {
5+
Position,
56
type WaypointOptions,
67
type WaypointEvent,
7-
type Position,
88
} from './useWaypoint.js';
99

1010
export { Position };

www/babel.config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

www/docs/Dropdown.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const DropdownMenu = ({ role }) => {
2525
{
2626
flip: true,
2727
offset: [0, 8],
28-
}
28+
},
2929
);
3030

3131
useLayoutEffect(() => {
@@ -38,7 +38,7 @@ const DropdownMenu = ({ role }) => {
3838
role={role}
3939
className={clsx(
4040
show ? "flex" : "hidden",
41-
"w-48 py-2 flex-col shadow-lg border-gray-200 border bg-white z-10 rounded"
41+
"w-48 py-2 flex-col shadow-lg border-gray-200 border bg-white z-10 rounded",
4242
)}
4343
>
4444
<Dropdown.Item className="text-left hover:bg-primary-100 px-6 py-2 focus:ring-2 focus:outline-none">
@@ -307,6 +307,7 @@ your app's needs.
307307
The example here positions the `Menu` to the `document` body via a `Portal`.
308308

309309
```jsx live
310+
import { createPortal } from "react-dom";
310311
import { Dropdown } from "@restart/ui";
311312
import Button from "../src/Button";
312313

@@ -320,7 +321,7 @@ import Button from "../src/Button";
320321
</Dropdown.Toggle>
321322
<Dropdown.Menu offset={[0, 12]}>
322323
{(props, { show }) =>
323-
ReactDOM.createPortal(
324+
createPortal(
324325
<div
325326
{...props}
326327
className={`${
@@ -329,7 +330,7 @@ import Button from "../src/Button";
329330
>
330331
<p>I am rendered into the document body</p>
331332
</div>,
332-
document.body
333+
document.body,
333334
)
334335
}
335336
</Dropdown.Menu>

www/docusaurus.config.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,15 @@ module.exports = {
3030
plugins: [require.resolve('./plugins/webpack')],
3131
presets: [
3232
[
33-
'@4c/docusaurus-preset',
33+
'@docusaurus/preset-classic',
3434
{
35-
theme: [
36-
'@docusaurus/theme-classic',
37-
{
38-
customCss: [require.resolve('./src/css/tailwind.css')],
39-
},
40-
],
35+
theme: {
36+
customCss: [require.resolve('./src/css/tailwind.css')],
37+
},
4138
docs: {
4239
routeBasePath: '/',
4340
sidebarPath: require.resolve('./sidebars.js'),
4441
},
45-
reactMetadata: {
46-
src: '../src/**/*.{js,tsx,ts}',
47-
},
4842
},
4943
],
5044
],

www/package.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,27 @@
1414
"write-heading-ids": "docusaurus write-heading-ids"
1515
},
1616
"dependencies": {
17-
"@4c/docusaurus-preset": "^1.0.0",
18-
"@docusaurus/core": "2.2.0",
19-
"@docusaurus/preset-classic": "2.2.0",
17+
"@docusaurus/core": "^3.8.1",
18+
"@docusaurus/preset-classic": "^3.8.1",
19+
"@docusaurus/theme-common": "^3.8.1",
2020
"@emotion/react": "^11.10.5",
2121
"@emotion/styled": "^11.10.5",
22-
"@mdx-js/react": "^1.6.21",
23-
"@restart/hooks": "^0.4.7",
22+
"@restart/hooks": "^0.6.2",
2423
"clsx": "^1.2.1",
25-
"docusaurus-theme-tailwind": "^1.0.1-rc.0",
2624
"emotion": "^11.0.0",
27-
"react": "^17.0.1",
28-
"react-dom": "^17.0.1",
25+
"jarle": "^3.2.1",
26+
"react": "^19.0.0",
27+
"react-dom": "^19.0.0",
2928
"tailwindcss": "^2.2.4"
3029
},
3130
"devDependencies": {
31+
"@docusaurus/module-type-aliases": "^3.8.1",
32+
"@docusaurus/tsconfig": "^3.8.1",
33+
"@docusaurus/types": "^3.8.1",
34+
"@types/react": "^19.1.8",
35+
"@types/react-dom": "^19.1.6",
3236
"autoprefixer": "^10.4.13",
33-
"postcss": "^8.4.21"
37+
"postcss": "^8.4.21",
38+
"typescript": "^5.8.3"
3439
}
3540
}

www/plugins/webpack.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,6 @@ module.exports = () => ({
66
return {
77
devtool: 'inline-cheap-module-source-map',
88

9-
module: {
10-
rules: [
11-
{
12-
test: /\.(j|t)sx?$/,
13-
include: [path.resolve(__dirname, '../../src')],
14-
use: [
15-
getJSLoader(
16-
isServer,
17-
path.resolve(__dirname, '../babel.config.js'),
18-
),
19-
],
20-
},
21-
],
22-
},
239
resolve: {
2410
alias: {
2511
'@restart/ui': path.resolve(__dirname, '../../src'),

www/src/Dropdown.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import clsx from 'clsx';
2-
import {
3-
Button,
4-
useDropdownMenu,
5-
useDropdownToggle,
6-
useDropdownItem,
7-
Dropdown as BaseDropdown,
8-
DropdownProps,
9-
} from '@restart/ui';
2+
import Button from '@restart/ui/Button';
3+
import BaseDropdown, { DropdownProps } from '@restart/ui/Dropdown';
4+
import { useDropdownMenu } from '@restart/ui/DropdownMenu';
5+
import { useDropdownToggle } from '@restart/ui/DropdownToggle';
6+
import { useDropdownItem } from '@restart/ui/DropdownItem';
7+
108
import StyledButton from './Button';
119

1210
const DropdownMenu = ({ role, ...props }) => {
@@ -30,7 +28,7 @@ const DropdownMenu = ({ role, ...props }) => {
3028
};
3129

3230
const DropdownItem = ({ eventKey, ...props }) => {
33-
const [itemProps, { active }] = useDropdownItem({
31+
const [itemProps, { isActive }] = useDropdownItem({
3432
key: eventKey,
3533
...props,
3634
});
@@ -41,7 +39,7 @@ const DropdownItem = ({ eventKey, ...props }) => {
4139
{...itemProps}
4240
className={clsx(
4341
'text-left hover:bg-primary-100 px-6 py-2 focus:ring-2 focus:outline-none',
44-
active && 'bg-primary',
42+
isActive && 'bg-primary',
4543
)}
4644
/>
4745
);

www/src/LiveCodeBlock.module.css

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
.playgroundHeader {
2+
letter-spacing: 0.08rem;
3+
padding: 0.75rem;
4+
text-transform: uppercase;
5+
font-weight: bold;
6+
}
7+
8+
.playgroundEditorHeader {
9+
background: var(--ifm-color-emphasis-600);
10+
color: var(--ifm-color-content-inverse);
11+
}
12+
13+
.playgroundEditor {
14+
padding: 1rem;
15+
outline: none;
16+
padding-top: 2rem;
17+
font: var(--ifm-code-font-size) / var(--ifm-pre-line-height)
18+
var(--ifm-font-family-monospace);
19+
max-height: var(--docusaurus-jarle-editor-max-height, 400px);
20+
overflow-y: auto;
21+
}
22+
23+
.playgroundButton {
24+
padding: 0.5rem 1rem;
25+
border: none;
26+
box-shadow: none;
27+
background: none;
28+
font-size: 90%;
29+
float: right;
30+
color: var(--ifm-color-primary);
31+
font-family: var(--ifm-font-family-monospace);
32+
}
33+
34+
.playgroundButton:hover {
35+
color: var(--ifm-color-primary-dark);
36+
}
37+
38+
.playgroundButton:before {
39+
content: '<';
40+
}
41+
42+
.playgroundButton:after {
43+
content: '/>';
44+
}
45+
46+
.playgroundEditor::after {
47+
content: 'editable';
48+
49+
top: 0.2rem;
50+
left: 0;
51+
position: absolute;
52+
pointer-events: none;
53+
letter-spacing: 0.08rem;
54+
font-size: 90%;
55+
padding: 0 0.75rem;
56+
text-transform: uppercase;
57+
font-weight: bold;
58+
}
59+
.playground > *:first-child {
60+
border-top-left-radius: var(--ifm-global-radius);
61+
border-top-right-radius: var(--ifm-global-radius);
62+
}
63+
64+
.playground > *:last-child {
65+
border-bottom-left-radius: var(--ifm-global-radius);
66+
border-bottom-right-radius: var(--ifm-global-radius);
67+
}
68+
69+
.playgroundPreview {
70+
position: relative;
71+
72+
border: 1px solid var(--ifm-color-emphasis-200);
73+
position: relative;
74+
padding: 1rem;
75+
padding-top: 2rem;
76+
}
77+
78+
.infoMessage {
79+
font-size: 70%;
80+
margin-top: 0.5rem;
81+
margin-right: 0.5rem;
82+
}
83+
84+
.error {
85+
all: unset;
86+
font-size: 85% !important;
87+
font-family: var(--ifm-font-family-monospace);
88+
color: var(--ifm-color-danger-dark);
89+
}
90+
91+
.inline {
92+
display: grid;
93+
grid-template-columns: 2fr 1.5fr;
94+
}
95+
96+
.inline > * {
97+
display: flex;
98+
flex-direction: column;
99+
}
100+
101+
.inline > *:first-child {
102+
height: 100%;
103+
border-top-right-radius: 0;
104+
border-bottom-left-radius: var(--ifm-global-radius);
105+
}
106+
107+
.inline > *:last-child {
108+
height: 100%;
109+
110+
border-bottom-left-radius: 0;
111+
border-bottom-right-radius: var(--ifm-global-radius);
112+
}

0 commit comments

Comments
 (0)