Skip to content

Commit

Permalink
fix: type error
Browse files Browse the repository at this point in the history
  • Loading branch information
philibea committed Dec 19, 2024
1 parent 5d01e2d commit 59aef6f
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 24 deletions.
4 changes: 2 additions & 2 deletions packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 7 additions & 6 deletions packages/icons/src/components/Icon/legacy/index.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -62,7 +62,7 @@ const PROMINENCES = {
type ProminenceProps = keyof typeof PROMINENCES

const StyledIcon = (
component: FunctionComponent<SVGProps<SVGSVGElement>>,
component: FunctionComponent<PropsWithChildren<SVGProps<SVGSVGElement>>>,
) => styled(component, {
shouldForwardProp: prop =>
!['size', 'sentiment', 'prominence', 'disabled'].includes(prop),
Expand Down Expand Up @@ -160,13 +160,14 @@ export const Icon = forwardRef<SVGSVGElement, IconProps>(
) => {
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])

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/plus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*",
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/src/components/SelectInputV2/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type DropdownProps = {
searchable: boolean
placeholder: string
footer?: ((closeDropdown: () => void) => ReactNode) | ReactNode
refSelect: RefObject<HTMLDivElement>
refSelect: RefObject<HTMLDivElement | null>
loadMore?: ReactNode
optionalInfoPlacement: 'left' | 'right'
isLoading?: boolean
Expand Down Expand Up @@ -218,7 +218,7 @@ const handleClickOutside = (
event: MouseEvent,
ref: RefObject<HTMLDivElement | null>,
setIsDropdownVisibile: Dispatch<SetStateAction<boolean>>,
refSelect: RefObject<HTMLDivElement>,
refSelect: RefObject<HTMLDivElement | null>,
onSearch: Dispatch<SetStateAction<DataType>>,
options: DataType,
) => {
Expand All @@ -234,7 +234,7 @@ const handleClickOutside = (

const handleKeyDown = (
event: globalThis.KeyboardEvent,
ref: RefObject<HTMLDivElement>,
ref: RefObject<HTMLDivElement | null>,
options: DataType,
searchBarActive: boolean,
setSearch: Dispatch<SetStateAction<string>>,
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/components/SelectInputV2/SelectBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ type SelectBarProps = {
success?: string
error?: string
autoFocus?: boolean
innerRef: RefObject<HTMLDivElement>
innerRef: RefObject<HTMLDivElement | null>
id?: string
'data-testid': string
label?: string
tooltip?: string
}

type DisplayValuesProps = {
refTag: RefObject<HTMLDivElement>
refTag: RefObject<HTMLDivElement | null>
nonOverflowedValues: OptionType[]
disabled: boolean
readOnly: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type SelectInputProviderProps<IsMulti extends boolean> = {
selectAllGroup: boolean
numberOfOptions: number
multiselect: IsMulti
refSelect?: RefObject<HTMLDivElement>
refSelect?: RefObject<HTMLDivElement | null>
onChange?: IsMulti extends true
? (value: string[]) => void
: (value: string) => void
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/SelectInputV2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const SelectInputV2 = <IsMulti extends undefined | boolean>({
}: SelectInputV2Props<IsMulti>) => {
const localId = useId()
const finalId = id ?? localId
const ref = useRef<HTMLDivElement>(null)
const ref = useRef<HTMLDivElement | null>(null)
const numberOfOptions = Array.isArray(options)
? options.length
: Object.values(options).reduce(
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/Tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const Tabs = ({
if (isValidElement<typeof Tab>(child)) {
return cloneElement(child as ReactElement, {
...child.props,
subtitle: null,
// subtitle: null,
})
}

Expand Down
74 changes: 69 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 59aef6f

Please sign in to comment.