Skip to content

Commit

Permalink
Merge pull request #699 from Atom-Learning/feat/upgrade-next-ts-react
Browse files Browse the repository at this point in the history
feat: upgrade NextJS, Typescript and React to the latest versions
  • Loading branch information
thomasdigby authored Aug 29, 2024
2 parents 67b8c8f + 9a6d3ef commit 48af37c
Show file tree
Hide file tree
Showing 31 changed files with 1,997 additions and 355 deletions.
2 changes: 1 addition & 1 deletion documentation/components/app/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const NavigationLink: React.FC<{ href: string }> = ({ href, children }) => {
if (!children) return null

return (
<NextLink href={href} passHref replace={true}>
<NextLink href={href} passHref replace={true} legacyBehavior>
<NavigationMenuVertical.Link size="md" active={isCurrentPage}>
{children}
</NavigationMenuVertical.Link>
Expand Down
2 changes: 1 addition & 1 deletion documentation/components/page/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const PaginationItem = ({ align, label, page }: TPaginationItem) => (
<Text css={{ color: '$base8' }} size="sm">
{label}
</Text>
<NextLink passHref href={`${page.href}`}>
<NextLink passHref href={`${page.href}`} legacyBehavior>
{/* @ts-ignore */}
<Link size="lg" css={{ display: 'block', py: '$2' }}>
{removeStartingNumber(page.title)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,5 @@ parent: J3bsmpB7-_uuqm05peuTA
uuid: 2Y0C1wqUjjKktp-oi7G8d
nestedSlug:
- components
- form
- primitives
- checkbox
---
11 changes: 9 additions & 2 deletions documentation/content/components.data-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,14 @@ tabs:
Expand Down Expand Up @@ -577,8 +585,7 @@ tabs:
#### Disabled rows
We can display disabled rows with different layout so users can see the difference between those rows and the enabled ones.
To achieve this you need to pass a property \`disabledRows\` that is a Record where the key is the row id (you can get this from the data table hook) and the value is a boolean that if it's true it will show the row as disabled. Note that this is just a visual change, it doesn't disable clickable elements in the table.
We can display disabled rows with different layout so users can see the difference between those rows and the enabled ones. To achieve this you need to pass a property \`disabledRows\` that is a Record where the key is the row id (you can get this from the data table hook) and the value is a boolean that if it's true it will show the row as disabled. Note that this is just a visual change, it doesn't disable clickable elements in the table.
<CodeBlock live={false} preview={false} code={`const columnHelper = createColumnHelper()
Expand Down
2 changes: 1 addition & 1 deletion documentation/content/components.empty-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ tabs:
<ComponentProps component="EmptyState" />
- title: Visual
content: >-
## Structure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ title: Tile Interactive
tabs:
- title: Code
content: >-
<CodeBlock live={true} preview={true} code={`<TileGroup gap="3" justify="center" css={{ bg: '$grey100', p: '$3', width: '100%' }}>
<CodeBlock live={true} preview={true} code={`<TileGroup gap="3"
justify="center" css={{ bg: '$grey100', p: '$3', width: '100%' }}>
<TileInteractive onClick={() => alert('onClick')} css={{size: 100 }} borderRadius="md" />
<TileInteractive href='/' css={{size: 100 }} borderRadius="md" border />
</TileGroup>`} language={"tsx"} />
Expand Down Expand Up @@ -167,7 +168,6 @@ parent: J3bsmpB7-_uuqm05peuTA
uuid: 3b9bb9a0-12e5-4fbe-bb18-9f700dc91003
nestedSlug:
- components
- surfaces
- tile-interactive
links:
showReportAnIssue: true
Expand Down
3 changes: 2 additions & 1 deletion documentation/content/components.tile-toggle-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ tabs:
- title: Code
content: >-
<CodeBlock live={true} preview={true} code={` <TileToggleGroup
type="multiple" justify="center" css={{ bg: '$grey100', p: '$3', width: '100%' }}>
type="multiple" justify="center" css={{ bg: '$grey100', p: '$3', width:
'100%' }}>
<TileToggleGroup.Item value="1" css={{size: 100 }} />
<TileToggleGroup.Item value="2" css={{size: 100 }} border />
</TileToggleGroup>`} language={"tsx"} />
Expand Down
10 changes: 5 additions & 5 deletions documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"netlify-cms-app": "^2.15.72",
"netlify-cms-lib-widgets": "^1.8.1",
"netlify-cms-ui-default": "^2.15.5",
"next": "12.2.3",
"next": "^14.2.7",
"next-mdx-remote": "^4.1.0",
"pascalcase": "^2.0.0",
"polished": "^4.2.2",
"prism-react-renderer": "^1.3.1",
"prop-types": "^15.8.1",
"randomstring": "^1.2.2",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-immutable-proptypes": "^2.2.0",
"react-live": "3.1.2",
"react-select": "^4.0.0",
Expand All @@ -47,11 +47,11 @@
"@types/react": "17.0.80",
"@types/throttle-debounce": "^5",
"eslint": "8.21.0",
"eslint-config-next": "12.2.3",
"eslint-config-next": "^14.2.7",
"gray-matter": "^4.0.3",
"node-fetch": "^2",
"prettier": "^2.2.1",
"typescript": "^4.7.4",
"typescript": "^5.5.4",
"yaml": "^2.1.1"
}
}
4 changes: 2 additions & 2 deletions documentation/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"compilerOptions": {
"target": "es5",
"target": "es2022",
"module": "esnext",
"jsx": "preserve",
"strict": false,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"lib": ["dom", "dom.iterable", "esnext"],
"lib": ["es2022", "dom", "dom.iterable"],
"allowJs": true,
"noEmit": true,
"moduleResolution": "node",
Expand Down
8 changes: 4 additions & 4 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
"npm-run-all": "^4.1.5",
"prettier": "^2.2.1",
"prompts": "^2.4.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rollup": "^2.39.0",
"rollup-plugin-esbuild": "^4.8.2",
"rollup-plugin-json": "^4.0.0",
Expand All @@ -122,8 +122,8 @@
"semantic-release-yarn": "^3.0.2",
"size-limit": "^7.0.5",
"stitches-reset": "^1.0.0",
"tsc-alias": "^1.3.5",
"typescript": "4.2.3",
"tsc-alias": "^1.8.10",
"typescript": "^5.5.4",
"vite": "^2.2.4",
"yargs": "^16.2.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,14 +434,14 @@ exports[`Accordion component renders an accordion 1`] = `
data-state="open"
>
<button
aria-controls="radix-0"
aria-controls="radix-:r1:"
aria-disabled="true"
aria-expanded="true"
class="c-cHXTzy t-dVJiaJ t-hwCMvs"
data-orientation="vertical"
data-radix-collection-item=""
data-state="open"
id="radix-1"
id="radix-:r0:"
type="button"
>
TRIGGER1
Expand All @@ -458,11 +458,11 @@ exports[`Accordion component renders an accordion 1`] = `
</svg>
</button>
<div
aria-labelledby="radix-1"
aria-labelledby="radix-:r0:"
class="c-hAleka"
data-orientation="vertical"
data-state="open"
id="radix-0"
id="radix-:r1:"
role="region"
style="--radix-accordion-content-height: var(--radix-collapsible-content-height); --radix-accordion-content-width: var(--radix-collapsible-content-width); transition-duration: 0s; animation-name: none;"
>
Expand All @@ -475,13 +475,13 @@ exports[`Accordion component renders an accordion 1`] = `
data-state="closed"
>
<button
aria-controls="radix-2"
aria-controls="radix-:r3:"
aria-expanded="false"
class="c-cHXTzy t-dVJiaJ t-hwCMvs"
data-orientation="vertical"
data-radix-collection-item=""
data-state="closed"
id="radix-3"
id="radix-:r2:"
type="button"
>
TRIGGER2
Expand All @@ -498,12 +498,12 @@ exports[`Accordion component renders an accordion 1`] = `
</svg>
</button>
<div
aria-labelledby="radix-3"
aria-labelledby="radix-:r2:"
class="c-hAleka"
data-orientation="vertical"
data-state="closed"
hidden=""
id="radix-2"
id="radix-:r3:"
role="region"
style="--radix-accordion-content-height: var(--radix-collapsible-content-height); --radix-accordion-content-width: var(--radix-collapsible-content-width);"
/>
Expand Down
11 changes: 7 additions & 4 deletions lib/src/components/action-icon/ActionIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,13 @@ export const ActionIcon: React.ForwardRefExoticComponent<ActionIconProps> =
`Children of type ${child?.type} aren't permitted. Only an ${Icon.displayName} component is allowed in ${ActionIcon.displayName}`
)

return React.cloneElement(child, {
size: ActionIconSizeMap[size as string],
css: { ...(child.props.css ? child.props.css : {}) }
})
return React.cloneElement(
child as React.ReactElement<React.ComponentProps<typeof Icon>>,
{
size: ActionIconSizeMap[size as string],
css: { ...(child.props.css ? child.props.css : {}) }
}
)
})}
</StyledButton>
</OptionalTooltipWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`AlertDialog component renders the trigger with the dialog hidden by default 1`] = `
<div>
<button
aria-controls="radix-0"
aria-controls="radix-:r0:"
aria-expanded="false"
aria-haspopup="dialog"
data-state="closed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ exports[`CheckboxTree component renders a checkbox 1`] = `
class="c-dhzjXW c-rbNxa c-dhzjXW-jroWjL-align-center c-dhzjXW-kaVYFn-gap-2 c-gsmDXe"
>
<button
aria-controls="radix-1"
aria-controls="radix-:r0:"
aria-expanded="false"
aria-label="Open: Top level trigger"
class="c-oUmPa c-oUmPa-elrktp-size-sm c-oUmPa-jCxibG-cv c-hBEOJc"
Expand Down Expand Up @@ -312,7 +312,7 @@ exports[`CheckboxTree component renders a checkbox 1`] = `
<ul
class="c-dhzjXW c-gkooaz c-dhzjXW-iTKOFX-direction-column c-rvbcR PJLV"
data-state="closed"
id="radix-1"
id="radix-:r0:"
role="group"
style="transition-duration: 0s; animation-name: none;"
>
Expand Down Expand Up @@ -382,7 +382,7 @@ exports[`CheckboxTree component renders a checkbox 1`] = `
class="c-dhzjXW c-rbNxa c-dhzjXW-jroWjL-align-center c-dhzjXW-kaVYFn-gap-2 c-gsmDXe"
>
<button
aria-controls="radix-0"
aria-controls="radix-:r1:"
aria-expanded="false"
aria-label="Open: Second level trigger"
class="c-oUmPa c-oUmPa-elrktp-size-sm c-oUmPa-jCxibG-cv c-hBEOJc"
Expand Down Expand Up @@ -422,7 +422,7 @@ exports[`CheckboxTree component renders a checkbox 1`] = `
<ul
class="c-dhzjXW c-gkooaz c-dhzjXW-iTKOFX-direction-column c-rvbcR PJLV"
data-state="closed"
id="radix-0"
id="radix-:r1:"
role="group"
style="transition-duration: 0s; animation-name: none;"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ exports[`DateField component renders a field in error state 1`] = `
/>
</div>
<button
aria-controls="radix-4"
aria-controls="radix-:r4:"
aria-expanded="false"
aria-haspopup="dialog"
aria-label="Open calendar"
Expand Down Expand Up @@ -557,7 +557,7 @@ exports[`DateField component renders a field with a text input 1`] = `
/>
</div>
<button
aria-controls="radix-0"
aria-controls="radix-:r0:"
aria-expanded="false"
aria-haspopup="dialog"
aria-label="Open calendar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ exports[`DateInput component renders 1`] = `
/>
</div>
<button
aria-controls="radix-0"
aria-controls="radix-:r0:"
aria-expanded="false"
aria-haspopup="dialog"
aria-label="Open calendar"
Expand Down Expand Up @@ -640,7 +640,7 @@ exports[`DateInput component renders lg size 1`] = `
/>
</div>
<button
aria-controls="radix-8"
aria-controls="radix-:r8:"
aria-expanded="false"
aria-haspopup="dialog"
aria-label="Open calendar"
Expand Down
20 changes: 10 additions & 10 deletions lib/src/components/dialog/__snapshots__/Dialog.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ exports[`Dialog component opens the popover once trigger is clicked 1`] = `
}
<div
aria-describedby="radix-5"
aria-describedby="radix-:r5:"
aria-label="Dialog"
aria-labelledby="radix-4"
aria-labelledby="radix-:r4:"
class="c-bnQNAg c-bnQNAg-lgqbzh-size-sm"
data-state="open"
id="radix-3"
id="radix-:r3:"
role="dialog"
style="pointer-events: auto;"
tabindex="-1"
Expand Down Expand Up @@ -221,7 +221,7 @@ exports[`Dialog component opens the popover once trigger is clicked 1`] = `
exports[`Dialog component renders the trigger with the popover hidden by default 1`] = `
<div>
<button
aria-controls="radix-0"
aria-controls="radix-:r0:"
aria-expanded="false"
aria-haspopup="dialog"
data-state="closed"
Expand Down Expand Up @@ -428,12 +428,12 @@ exports[`Dialog component with custom background renders 1`] = `
CUSTOM BACKGROUND
</div>
<div
aria-describedby="radix-20"
aria-describedby="radix-:rk:"
aria-label="Dialog"
aria-labelledby="radix-19"
aria-labelledby="radix-:rj:"
class="c-bnQNAg c-bnQNAg-lgqbzh-size-sm"
data-state="open"
id="radix-18"
id="radix-:ri:"
role="dialog"
style="pointer-events: auto;"
tabindex="-1"
Expand Down Expand Up @@ -597,12 +597,12 @@ exports[`Dialog component without close button renders 1`] = `
}
<div
aria-describedby="radix-17"
aria-describedby="radix-:rh:"
aria-label="Dialog"
aria-labelledby="radix-16"
aria-labelledby="radix-:rg:"
class="c-bnQNAg c-bnQNAg-lgqbzh-size-sm"
data-state="open"
id="radix-15"
id="radix-:rf:"
role="dialog"
style="pointer-events: auto;"
tabindex="-1"
Expand Down
Loading

0 comments on commit 48af37c

Please sign in to comment.