From 59aef6f1eea3386c830289662f2be3423fae5723 Mon Sep 17 00:00:00 2001 From: Alexandre Philibeaux Date: Mon, 16 Dec 2024 15:28:51 +0000 Subject: [PATCH] fix: type error --- packages/icons/package.json | 4 +- .../src/components/Icon/legacy/index.tsx | 13 ++-- packages/plus/package.json | 2 +- packages/ui/package.json | 4 +- .../src/components/SelectInputV2/Dropdown.tsx | 6 +- .../components/SelectInputV2/SelectBar.tsx | 4 +- .../SelectInputV2/SelectInputProvider.tsx | 2 +- .../ui/src/components/SelectInputV2/index.tsx | 2 +- packages/ui/src/components/Tabs/index.tsx | 2 +- pnpm-lock.yaml | 74 +++++++++++++++++-- 10 files changed, 89 insertions(+), 24 deletions(-) diff --git a/packages/icons/package.json b/packages/icons/package.json index 9670e83540..abeec89f98 100644 --- a/packages/icons/package.json +++ b/packages/icons/package.json @@ -120,8 +120,8 @@ "@babel/core": "7.26.0", "@emotion/react": "11.14.0", "@emotion/styled": "11.14.0", - "@types/react": "18.3.17", - "@types/react-dom": "18.3.5", + "@types/react": "19.0.0", + "@types/react-dom": "19.0.0", "@utils/test": "workspace:*", "react": "19.0.0", "react-dom": "19.0.0" diff --git a/packages/icons/src/components/Icon/legacy/index.tsx b/packages/icons/src/components/Icon/legacy/index.tsx index 30260b7c03..b5a3eb49c4 100644 --- a/packages/icons/src/components/Icon/legacy/index.tsx +++ b/packages/icons/src/components/Icon/legacy/index.tsx @@ -1,7 +1,7 @@ import { css } from '@emotion/react' import styled from '@emotion/styled' import type { consoleLightTheme as theme } from '@ultraviolet/themes' -import type { FunctionComponent, SVGProps } from 'react' +import type { FunctionComponent, PropsWithChildren, SVGProps } from 'react' import { forwardRef, useMemo } from 'react' import capitalize from '../../../utils/capitalize' import { ICONS } from './Icons' @@ -62,7 +62,7 @@ const PROMINENCES = { type ProminenceProps = keyof typeof PROMINENCES const StyledIcon = ( - component: FunctionComponent>, + component: FunctionComponent>>, ) => styled(component, { shouldForwardProp: prop => !['size', 'sentiment', 'prominence', 'disabled'].includes(prop), @@ -160,13 +160,14 @@ export const Icon = forwardRef( ) => { const computedSentiment = sentiment ?? color const SystemIcon = useMemo(() => { + const smallIcon = SMALL_ICONS[variant][name] + const defaultIcon = SMALL_ICONS.filled.alert + if (size === 'small' || size === 16) { - return StyledIcon( - SMALL_ICONS[variant][name] || SMALL_ICONS.filled.alert, - ) + return StyledIcon(smallIcon || defaultIcon) } - return StyledIcon(ICONS[variant][name] || ICONS.filled.alert) + return StyledIcon(smallIcon || defaultIcon) }, [name, size, variant]) /** diff --git a/packages/plus/package.json b/packages/plus/package.json index d0fec4b2cd..1787317693 100644 --- a/packages/plus/package.json +++ b/packages/plus/package.json @@ -73,7 +73,7 @@ "@babel/core": "7.26.0", "@emotion/react": "11.14.0", "@emotion/styled": "11.14.0", - "@types/react": "18.3.17", + "@types/react": "19.0.0", "@types/react-dom": "18.3.5", "@ultraviolet/illustrations": "workspace:*", "@utils/test": "workspace:*", diff --git a/packages/ui/package.json b/packages/ui/package.json index 698ed7c908..481017feb5 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -76,9 +76,9 @@ "@babel/core": "7.26.0", "@emotion/react": "11.14.0", "@emotion/styled": "11.14.0", - "@types/react": "18.3.17", + "@types/react": "19.0.0", "@types/react-datepicker": "6.2.0", - "@types/react-dom": "18.3.5", + "@types/react-dom": "19.0.0", "@utils/test": "workspace:*", "react": "19.0.0", "react-dom": "19.0.0" diff --git a/packages/ui/src/components/SelectInputV2/Dropdown.tsx b/packages/ui/src/components/SelectInputV2/Dropdown.tsx index b5d77e695a..3ef4e2f921 100644 --- a/packages/ui/src/components/SelectInputV2/Dropdown.tsx +++ b/packages/ui/src/components/SelectInputV2/Dropdown.tsx @@ -27,7 +27,7 @@ export type DropdownProps = { searchable: boolean placeholder: string footer?: ((closeDropdown: () => void) => ReactNode) | ReactNode - refSelect: RefObject + refSelect: RefObject loadMore?: ReactNode optionalInfoPlacement: 'left' | 'right' isLoading?: boolean @@ -218,7 +218,7 @@ const handleClickOutside = ( event: MouseEvent, ref: RefObject, setIsDropdownVisibile: Dispatch>, - refSelect: RefObject, + refSelect: RefObject, onSearch: Dispatch>, options: DataType, ) => { @@ -234,7 +234,7 @@ const handleClickOutside = ( const handleKeyDown = ( event: globalThis.KeyboardEvent, - ref: RefObject, + ref: RefObject, options: DataType, searchBarActive: boolean, setSearch: Dispatch>, diff --git a/packages/ui/src/components/SelectInputV2/SelectBar.tsx b/packages/ui/src/components/SelectInputV2/SelectBar.tsx index 31339d80f4..08e4f609d7 100644 --- a/packages/ui/src/components/SelectInputV2/SelectBar.tsx +++ b/packages/ui/src/components/SelectInputV2/SelectBar.tsx @@ -26,7 +26,7 @@ type SelectBarProps = { success?: string error?: string autoFocus?: boolean - innerRef: RefObject + innerRef: RefObject id?: string 'data-testid': string label?: string @@ -34,7 +34,7 @@ type SelectBarProps = { } type DisplayValuesProps = { - refTag: RefObject + refTag: RefObject nonOverflowedValues: OptionType[] disabled: boolean readOnly: boolean diff --git a/packages/ui/src/components/SelectInputV2/SelectInputProvider.tsx b/packages/ui/src/components/SelectInputV2/SelectInputProvider.tsx index fe659ead6b..10bd8934f6 100644 --- a/packages/ui/src/components/SelectInputV2/SelectInputProvider.tsx +++ b/packages/ui/src/components/SelectInputV2/SelectInputProvider.tsx @@ -61,7 +61,7 @@ type SelectInputProviderProps = { selectAllGroup: boolean numberOfOptions: number multiselect: IsMulti - refSelect?: RefObject + refSelect?: RefObject onChange?: IsMulti extends true ? (value: string[]) => void : (value: string) => void diff --git a/packages/ui/src/components/SelectInputV2/index.tsx b/packages/ui/src/components/SelectInputV2/index.tsx index 969da005de..3d4dc85924 100644 --- a/packages/ui/src/components/SelectInputV2/index.tsx +++ b/packages/ui/src/components/SelectInputV2/index.tsx @@ -172,7 +172,7 @@ export const SelectInputV2 = ({ }: SelectInputV2Props) => { const localId = useId() const finalId = id ?? localId - const ref = useRef(null) + const ref = useRef(null) const numberOfOptions = Array.isArray(options) ? options.length : Object.values(options).reduce( diff --git a/packages/ui/src/components/Tabs/index.tsx b/packages/ui/src/components/Tabs/index.tsx index 45e261f031..11dea82816 100644 --- a/packages/ui/src/components/Tabs/index.tsx +++ b/packages/ui/src/components/Tabs/index.tsx @@ -146,7 +146,7 @@ export const Tabs = ({ if (isValidElement(child)) { return cloneElement(child as ReactElement, { ...child.props, - subtitle: null, + // subtitle: null, }) } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2cf3b33d1a..73901aa0cf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -628,6 +628,7 @@ importers: version: 7.26.0 '@emotion/react': specifier: 11.14.0 +<<<<<<< HEAD <<<<<<< HEAD version: 11.14.0(@types/react@18.3.17)(react@18.3.1) '@emotion/styled': @@ -645,6 +646,18 @@ importers: '@types/react-dom': specifier: 18.3.5 version: 18.3.5(@types/react@18.3.17) +======= + version: 11.14.0(@types/react@19.0.0)(react@19.0.0) + '@emotion/styled': + specifier: 11.14.0 + version: 11.14.0(@emotion/react@11.14.0(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0) + '@types/react': + specifier: 19.0.0 + version: 19.0.0 + '@types/react-dom': + specifier: 19.0.0 + version: 19.0.0 +>>>>>>> 6e17823ee (fix: type error) '@utils/test': specifier: workspace:* version: link:../../utils/test @@ -721,6 +734,7 @@ importers: version: 7.26.0 '@emotion/react': specifier: 11.14.0 +<<<<<<< HEAD <<<<<<< HEAD version: 11.14.0(@types/react@18.3.17)(react@18.3.1) '@emotion/styled': @@ -738,6 +752,18 @@ importers: '@types/react-dom': specifier: 18.3.5 version: 18.3.5(@types/react@18.3.17) +======= + version: 11.14.0(@types/react@19.0.0)(react@19.0.0) + '@emotion/styled': + specifier: 11.14.0 + version: 11.14.0(@emotion/react@11.14.0(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0) + '@types/react': + specifier: 19.0.0 + version: 19.0.0 + '@types/react-dom': + specifier: 18.3.5 + version: 18.3.5(@types/react@19.0.0) +>>>>>>> 6e17823ee (fix: type error) '@ultraviolet/illustrations': specifier: workspace:* version: link:../illustrations @@ -797,11 +823,15 @@ importers: version: 6.9.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0) react-select: specifier: 5.8.3 +<<<<<<< HEAD <<<<<<< HEAD version: 5.8.3(@types/react@18.3.17)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) ======= version: 5.8.3(@types/react@18.3.16)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) >>>>>>> 9f9668398 (chore: react v19) +======= + version: 5.8.3(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) +>>>>>>> 6e17823ee (fix: type error) react-toastify: specifier: 10.0.6 version: 10.0.6(react-dom@19.0.0(react@19.0.0))(react@19.0.0) @@ -817,6 +847,7 @@ importers: version: 7.26.0 '@emotion/react': specifier: 11.14.0 +<<<<<<< HEAD <<<<<<< HEAD version: 11.14.0(@types/react@18.3.17)(react@18.3.1) '@emotion/styled': @@ -831,12 +862,26 @@ importers: '@types/react': specifier: 18.3.17 version: 18.3.17 +======= + version: 11.14.0(@types/react@19.0.0)(react@19.0.0) + '@emotion/styled': + specifier: 11.14.0 + version: 11.14.0(@emotion/react@11.14.0(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0) + '@types/react': + specifier: 19.0.0 + version: 19.0.0 +>>>>>>> 6e17823ee (fix: type error) '@types/react-datepicker': specifier: 6.2.0 version: 6.2.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@types/react-dom': +<<<<<<< HEAD specifier: 18.3.5 version: 18.3.5(@types/react@18.3.17) +======= + specifier: 19.0.0 + version: 19.0.0 +>>>>>>> 6e17823ee (fix: type error) '@utils/test': specifier: workspace:* version: link:../../utils/test @@ -3339,9 +3384,6 @@ packages: '@types/parse-json@4.0.2': resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==} - '@types/prop-types@15.7.12': - resolution: {integrity: sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==} - '@types/react-datepicker@6.2.0': resolution: {integrity: sha512-+JtO4Fm97WLkJTH8j8/v3Ldh7JCNRwjMYjRaKh4KHH0M3jJoXtwiD3JBCsdlg3tsFIw9eQSqyAPeVDN2H2oM9Q==} @@ -3359,9 +3401,12 @@ packages: '@types/react-transition-group@4.4.10': resolution: {integrity: sha512-hT/+s0VQs2ojCX823m60m5f0sL5idt9SO6Tj6Dg+rdphGPIeJbJ6CxvBYkgkGKrYeDjvIpKTR38UzmtHJOGW3Q==} +<<<<<<< HEAD '@types/react@18.3.17': resolution: {integrity: sha512-opAQ5no6LqJNo9TqnxBKsgnkIYHozW9KSTlFVoSUJYh1Fl/sswkEoqIugRSm7tbh6pABtYjGAjW+GOS23j8qbw==} +======= +>>>>>>> 6e17823ee (fix: type error) '@types/react@19.0.0': resolution: {integrity: sha512-MY3oPudxvMYyesqs/kW1Bh8y9VqSmf+tzqw3ae8a9DZW68pUe3zAdHeI1jc6iAysuRdACnVknHP8AhwD4/dxtg==} @@ -9536,6 +9581,7 @@ snapshots: '@emotion/memoize@0.9.0': {} +<<<<<<< HEAD <<<<<<< HEAD '@emotion/react@11.14.0(@types/react@18.3.17)(react@18.3.1)': ======= @@ -9556,6 +9602,8 @@ snapshots: transitivePeerDependencies: - supports-color +======= +>>>>>>> 6e17823ee (fix: type error) '@emotion/react@11.14.0(@types/react@19.0.0)(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 @@ -9582,6 +9630,7 @@ snapshots: '@emotion/sheet@1.4.0': {} +<<<<<<< HEAD <<<<<<< HEAD '@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@18.3.17)(react@18.3.1))(@types/react@18.3.17)(react@18.3.1)': ======= @@ -9605,6 +9654,8 @@ snapshots: transitivePeerDependencies: - supports-color +======= +>>>>>>> 6e17823ee (fix: type error) '@emotion/styled@11.14.0(@emotion/react@11.14.0(@types/react@19.0.0)(react@19.0.0))(@types/react@19.0.0)(react@19.0.0)': dependencies: '@babel/runtime': 7.26.0 @@ -11172,8 +11223,6 @@ snapshots: '@types/parse-json@4.0.2': {} - '@types/prop-types@15.7.12': {} - '@types/react-datepicker@6.2.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: <<<<<<< HEAD @@ -11188,9 +11237,15 @@ snapshots: - react - react-dom +<<<<<<< HEAD '@types/react-dom@18.3.5(@types/react@18.3.17)': dependencies: '@types/react': 18.3.17 +======= + '@types/react-dom@18.3.5(@types/react@19.0.0)': + dependencies: + '@types/react': 19.0.0 +>>>>>>> 6e17823ee (fix: type error) '@types/react-dom@19.0.0': dependencies: @@ -11212,11 +11267,14 @@ snapshots: '@types/react': 19.0.0 >>>>>>> 9f9668398 (chore: react v19) +<<<<<<< HEAD '@types/react@18.3.17': dependencies: '@types/prop-types': 15.7.12 csstype: 3.1.3 +======= +>>>>>>> 6e17823ee (fix: type error) '@types/react@19.0.0': dependencies: csstype: 3.1.3 @@ -15327,6 +15385,7 @@ snapshots: schema-dts: 1.1.2(typescript@5.7.2) typescript: 5.7.2 +<<<<<<< HEAD <<<<<<< HEAD react-select@5.8.3(@types/react@18.3.17)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: @@ -15359,6 +15418,8 @@ snapshots: - '@types/react' - supports-color +======= +>>>>>>> 6e17823ee (fix: type error) react-select@5.8.3(@types/react@19.0.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0): dependencies: '@babel/runtime': 7.26.0 @@ -16410,6 +16471,7 @@ snapshots: urlpattern-polyfill@10.0.0: {} +<<<<<<< HEAD <<<<<<< HEAD use-isomorphic-layout-effect@1.1.2(@types/react@18.3.17)(react@18.3.1): ======= @@ -16420,6 +16482,8 @@ snapshots: optionalDependencies: '@types/react': 18.3.17 +======= +>>>>>>> 6e17823ee (fix: type error) use-isomorphic-layout-effect@1.1.2(@types/react@19.0.0)(react@19.0.0): dependencies: react: 19.0.0