Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
export default meta

const NextJSLikeLink = forwardRef(
({href, children}: {href: string; children: React.ReactNode}, ref): React.ReactElement => {
({href, children}: {href: string; children: React.ReactNode}, ref): React.ReactElement<any> => {

Check failure on line 36 in packages/react/src/ActionList/ActionList.examples.stories.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
const child = React.Children.only(children)
const childProps = {
ref,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
afterSelect?: Function
enableFocusZone?: boolean
defaultTrailingVisual?: React.ReactElement
defaultTrailingVisual?: React.ReactElement<any>

Check failure on line 17 in packages/react/src/ActionList/ActionListContainerContext.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
}

export const ActionListContainerContext = React.createContext<ContextProps>({})
2 changes: 1 addition & 1 deletion packages/react/src/ActionMenu/ActionMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
)
}

function ExampleWithTooltipV2(actionMenuTrigger: React.ReactElement): JSX.Element {
function ExampleWithTooltipV2(actionMenuTrigger: React.ReactElement<any>): JSX.Element {

Check failure on line 56 in packages/react/src/ActionMenu/ActionMenu.test.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
return (
<BaseStyles>
<ActionMenu>
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/ActionMenu/ActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/**
* Recommended: `ActionMenu.Button` or `ActionMenu.Anchor` with `ActionMenu.Overlay`
*/
children: React.ReactElement[] | React.ReactElement
children: React.ReactElement<any>[] | React.ReactElement<any>

Check failure on line 38 in packages/react/src/ActionMenu/ActionMenu.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

Check failure on line 38 in packages/react/src/ActionMenu/ActionMenu.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type

/**
* If defined, will control the open/closed state of the overlay. Must be used in conjunction with `onOpenChange`.
Expand Down Expand Up @@ -179,11 +179,11 @@
)
}

export type ActionMenuAnchorProps = {children: React.ReactElement; id?: string} & React.HTMLAttributes<HTMLElement>
export type ActionMenuAnchorProps = {children: React.ReactElement<any>; id?: string} & React.HTMLAttributes<HTMLElement>

Check failure on line 182 in packages/react/src/ActionMenu/ActionMenu.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
const Anchor: WithSlotMarker<
React.ForwardRefExoticComponent<
{
children: React.ReactElement
children: React.ReactElement<any>

Check failure on line 186 in packages/react/src/ActionMenu/ActionMenu.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
id?: string
} & React.HTMLAttributes<HTMLElement> &
React.RefAttributes<HTMLElement>
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/Autocomplete/AutocompleteMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

type OnSelectedChange<T> = (item: T | T[]) => void
export type AutocompleteMenuItem = MandateProps<ActionListItemProps, 'id'> & {
leadingVisual?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement
leadingVisual?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement<any>

Check failure on line 22 in packages/react/src/Autocomplete/AutocompleteMenu.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
text?: string
trailingVisual?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement
trailingVisual?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement<any>

Check failure on line 24 in packages/react/src/Autocomplete/AutocompleteMenu.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
}

const getDefaultSortFn = (isItemSelectedFn: (itemId: string) => boolean) => (itemIdA: string, itemIdB: string) =>
Expand Down
10 changes: 5 additions & 5 deletions packages/react/src/Breadcrumbs/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}

type BreadcrumbsMenuItemProps = {
items: React.ReactElement[]
items: React.ReactElement<any>[]

Check failure on line 44 in packages/react/src/Breadcrumbs/Breadcrumbs.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
'aria-label'?: string
}

Expand Down Expand Up @@ -141,7 +141,7 @@
BreadcrumbsMenuItem.displayName = 'Breadcrumbs.MenuItem'

const getValidChildren = (children: React.ReactNode) => {
return React.Children.toArray(children).filter(child => React.isValidElement(child)) as React.ReactElement[]
return React.Children.toArray(children).filter(child => React.isValidElement(child)) as React.ReactElement<any>[];
}

function Breadcrumbs({className, children, style, overflow = 'wrap', variant = 'normal'}: BreadcrumbsProps) {
Expand All @@ -166,10 +166,10 @@

const rootItem = childArray[0]

const [visibleItems, setVisibleItems] = useState<React.ReactElement[]>(() => childArray)
const [visibleItems, setVisibleItems] = useState<React.ReactElement<any>[]>(() => childArray)
const [childArrayWidths, setChildArrayWidths] = useState<number[]>(() => [])

const [menuItems, setMenuItems] = useState<React.ReactElement[]>([])
const [menuItems, setMenuItems] = useState<React.ReactElement<any>[]>([])
const [rootItemWidth, setRootItemWidth] = useState<number>(0)

const MENU_BUTTON_FALLBACK_WIDTH = 32 // Design system small IconButton
Expand Down Expand Up @@ -203,7 +203,7 @@

let currentVisibleItems = [...childArray]
let currentVisibleItemWidths = [...childArrayWidths]
let currentMenuItems: React.ReactElement[] = []
let currentMenuItems: React.ReactElement<any>[] = []
let currentMenuItemsWidths: number[] = []

if (availableWidth > 0 && currentVisibleItemWidths.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import userEvent from '@testing-library/user-event'
import {FeatureFlags} from '../../FeatureFlags'

// Helper function to render with theme and feature flags
const renderWithTheme = (component: React.ReactElement, flags?: Record<string, boolean>) => {
const renderWithTheme = (component: React.ReactElement<any>, flags?: Record<string, boolean>) => {
const wrappedComponent = flags ? <FeatureFlags flags={flags}>{component}</FeatureFlags> : <>{component}</>
return HTMLRender(wrappedComponent)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Button/ButtonBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import classes from './ButtonBase.module.css'
import {isElement} from 'react-is'

const renderModuleVisual = (
Visual: React.ElementType | React.ReactElement,
Visual: React.ElementType | React.ReactElement<any>,
loading: boolean,
visualName: string,
counterLabel: boolean,
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/Button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ export type ButtonProps = {
/**
* The icon for the IconButton
*/
icon?: React.FunctionComponent<IconProps> | React.ElementType | React.ReactElement | null
icon?: React.FunctionComponent<IconProps> | React.ElementType | React.ReactElement<any> | null

/**
* The leading visual which comes before the button content
*/
leadingVisual?: React.ElementType | React.ReactElement | null
leadingVisual?: React.ElementType | React.ReactElement<any> | null

/**
* The trailing visual which comes after the button content
*/
trailingVisual?: React.ElementType | React.ReactElement | null
trailingVisual?: React.ElementType | React.ReactElement<any> | null

/**
* Trailing action which comes after the trailing visual and is always the last element
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
(
{checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, ...rest},
ref,
): ReactElement => {
): ReactElement<any> => {
const checkboxRef = useProvidedRefOrCreate(ref as React.RefObject<HTMLInputElement>)
const checkboxGroupContext = useContext(CheckboxGroupContext)
const handleOnChange: ChangeEventHandler<HTMLInputElement> = e => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Details/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import classes from './Details.module.css'
import {useMergedRefs} from '../internal/hooks/useMergedRefs'

const Root = React.forwardRef<HTMLDetailsElement, DetailsProps>(
({className, children, ...rest}, forwardRef): ReactElement => {
({className, children, ...rest}, forwardRef): ReactElement<any> => {
const detailsRef = React.useRef<HTMLDetailsElement>(null)
const ref = useMergedRefs(forwardRef, detailsRef)

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/FilteredActionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {Group} from '../ActionList/Group'
import type {ActionListGroupProps} from '../deprecated'
import type {AriaRole} from '../utils/types'

export type RenderItemFn = (props: FilteredActionListItemProps) => React.ReactElement
export type RenderItemFn = (props: FilteredActionListItemProps) => React.ReactElement<any>

export type ItemInput =
| Merge<React.ComponentPropsWithoutRef<'div'>, FilteredActionListItemProps>
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/NavList/NavList.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const WithReactRouterLink = () => (
type NextJSLinkProps = {href: string; children: React.ReactNode}

const NextJSLikeLink = React.forwardRef<HTMLAnchorElement, NextJSLinkProps>(
({href, children}, ref): React.ReactElement => {
({href, children}, ref): React.ReactElement<any> => {
const child = React.Children.only(children)
const childProps = {
ref,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/NavList/NavList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
type NextJSLinkProps = {href: string; children: React.ReactNode}

const NextJSLikeLink = React.forwardRef<HTMLAnchorElement, NextJSLinkProps>(
({href, children}, ref): React.ReactElement => {
({href, children}, ref): React.ReactElement<any> => {
const child = React.Children.only(children)
const childProps = {
ref,
Expand All @@ -30,7 +30,7 @@
<NavList.Item href="/contact">Contact</NavList.Item>
</NavList>,
)
expect(container).toMatchSnapshot()

Check failure on line 33 in packages/react/src/NavList/NavList.test.tsx

View workflow job for this annotation

GitHub Actions / test (react-19)

src/NavList/NavList.test.tsx > NavList > renders a simple list

Error: Snapshot `NavList > renders a simple list 1` mismatched - Expected + Received @@ -10,15 +10,15 @@ data-active="true" data-has-description="false" > <a aria-current="page" - aria-labelledby=":r1:--label " + aria-labelledby="_r_1_--label " class="prc-ActionList-ActionListContent-Q8eQr prc-Link-Link-O33ci" data-size="medium" href="/" - id=":r1:" + id="_r_1_" style="--subitem-depth: 0;" tabindex="0" > <span class="prc-ActionList-Spacer-vgXtU" @@ -27,11 +27,11 @@ class="prc-ActionList-ActionListSubContent-Zcjdz" data-component="ActionList.Item--DividerContainer" > <span class="prc-ActionList-ItemLabel-hYyH7" - id=":r1:--label" + id="_r_1_--label" > Home </span> </span> </a> @@ -39,15 +39,15 @@ <li class="prc-ActionList-ActionListItem-jXerx" data-has-description="false" > <a - aria-labelledby=":r2:--label " + aria-labelledby="_r_2_--label " class="prc-ActionList-ActionListContent-Q8eQr prc-Link-Link-O33ci" data-size="medium" href="/about" - id=":r2:" + id="_r_2_" style="--subitem-depth: 0;" tabindex="0" > <span class="prc-ActionList-Spacer-vgXtU" @@ -56,11 +56,11 @@ class="prc-ActionList-ActionListSubContent-Zcjdz" data-component="ActionList.Item--DividerContainer" > <span class="prc-ActionList-ItemLabel-hYyH7" - id=":r2:--label" + id="_r_2_--label" > About </span> </span> </a> @@ -68,15 +68,15 @@ <li class="prc-ActionList-ActionListItem-jXerx" data-has-description="false" > <a - aria-labelledby=":r3:--label " + aria-labelledby="_r_3_--label " class="prc-ActionList-ActionListContent-Q8eQr prc-Link-Link-O33ci" data-size="medium" href="/contact" - id=":r3:" + id="_r_3_" style="--subitem-depth: 0;" tabindex="0" > <span class="prc-ActionList-Spacer-vgXtU" @@ -85,11 +85,11 @@ class="prc-ActionList-ActionListSubContent-Zcjdz" data-component="ActionList.Item--DividerContainer" > <span class="prc-ActionList-ItemLabel-hYyH7" - id=":r3:--label" + id="_r_3_--label" > Contact </span> </span> </a> ❯ toMatchSnapshot src/NavList/NavList.test.tsx:33:22
})

it('renders with groups', () => {
Expand All @@ -46,7 +46,7 @@
</NavList.Group>
</NavList>,
)
expect(container).toMatchSnapshot()

Check failure on line 49 in packages/react/src/NavList/NavList.test.tsx

View workflow job for this annotation

GitHub Actions / test (react-19)

src/NavList/NavList.test.tsx > NavList > renders with groups

Error: Snapshot `NavList > renders with groups 1` mismatched - Expected + Received @@ -19,31 +19,31 @@ data-variant="subtle" > <h3 class="prc-ActionList-GroupHeading-w2osB" data-component="ActionList.GroupHeading" - id=":r5:" + id="_r_5_" > Overview </h3> </div> <ul - aria-labelledby=":r5:" + aria-labelledby="_r_5_" class="prc-ActionList-GroupList-kpPZc" > <li class="prc-ActionList-ActionListItem-jXerx" data-active="true" data-has-description="false" > <a aria-current="page" - aria-labelledby=":r6:--label " + aria-labelledby="_r_6_--label " class="prc-ActionList-ActionListContent-Q8eQr prc-Link-Link-O33ci" data-size="medium" href="/getting-started" - id=":r6:" + id="_r_6_" style="--subitem-depth: 0;" tabindex="0" > <span class="prc-ActionList-Spacer-vgXtU" @@ -52,11 +52,11 @@ class="prc-ActionList-ActionListSubContent-Zcjdz" data-component="ActionList.Item--DividerContainer" > <span class="prc-ActionList-ItemLabel-hYyH7" - id=":r6:--label" + id="_r_6_--label" > Getting started </span> </span> </a> @@ -77,29 +77,29 @@ data-variant="subtle" > <h3 class="prc-ActionList-GroupHeading-w2osB" data-component="ActionList.GroupHeading" - id=":r7:" + id="_r_7_" > Components </h3> </div> <ul - aria-labelledby=":r7:" + aria-labelledby="_r_7_" class="prc-ActionList-GroupList-kpPZc" > <li class="prc-ActionList-ActionListItem-jXerx" data-has-description="false" > <a - aria-labelledby=":r8:--label " + aria-labelledby="_r_8_--label " class="prc-ActionList-ActionListContent-Q8eQr prc-Link-Link-O33ci" data-size="medium" href="/Avatar" - id=":r8:" + id="_r_8_" style="--subitem-depth: 0;" tabindex="0" > <span class="prc-ActionList-Spacer-vgXtU" @@ -108,11 +108,11 @@ class="prc-ActionList-ActionListSubContent-Zcjdz" data-component="ActionList.Item--DividerContainer" > <span class="prc-ActionList-ItemLabel-hYyH7" - id=":r8:--label" + id="_r_8_--label" > Avatar </span> </span> </a> ❯ toMatchSnapshot src/NavList/NavList.test.tsx:49:22
})

it('supports TrailingAction', async () => {
Expand Down Expand Up @@ -219,7 +219,7 @@
expect(queryByRole('list', {name: 'Item'})).toBeNull()

// Snapshot styles
expect(container).toMatchSnapshot()

Check failure on line 222 in packages/react/src/NavList/NavList.test.tsx

View workflow job for this annotation

GitHub Actions / test (react-19)

src/NavList/NavList.test.tsx > NavList.Item with NavList.SubNav > has active styles if SubNav contains the current item and is closed

Error: Snapshot `NavList.Item with NavList.SubNav > has active styles if SubNav contains the current item and is closed 1` mismatched - Expected + Received @@ -10,16 +10,16 @@ data-active="true" data-has-description="false" data-has-subitem="true" > <button - aria-controls=":r1u:" + aria-controls="_r_1u_" aria-expanded="false" - aria-labelledby=":r1t:--label :r1t:--trailing-visual " + aria-labelledby="_r_1t_--label _r_1t_--trailing-visual " class="prc-ActionList-ActionListContent-Q8eQr" data-size="medium" - id=":r1t:" + id="_r_1t_" style="--subitem-depth: 0;" tabindex="0" type="button" > <span @@ -29,17 +29,17 @@ class="prc-ActionList-ActionListSubContent-Zcjdz" data-component="ActionList.Item--DividerContainer" > <span class="prc-ActionList-ItemLabel-hYyH7" - id=":r1t:--label" + id="_r_1t_--label" > Item </span> <span class="prc-ActionList-TrailingVisual-8LMjP prc-ActionList-VisualWrap-MGVnU" - id=":r1t:--trailing-visual" + id="_r_1t_--trailing-visual" > <svg aria-hidden="true" class="octicon octicon-chevron-down prc-ActionList-ExpandIcon-6JuzS" display="inline-block" @@ -57,26 +57,26 @@ </svg> </span> </span> </button> <ul - aria-labelledby=":r1t:" + aria-labelledby="_r_1t_" class="prc-ActionList-SubGroup-4pVPh" - id=":r1u:" + id="_r_1u_" > <li class="prc-ActionList-ActionListItem-jXerx" data-active="true" data-has-description="false" > <a aria-current="page" - aria-labelledby=":r20:--label " + aria-labelledby="_r_20_--label " class="prc-ActionList-ActionListContent-Q8eQr prc-Link-Link-O33ci" data-size="medium" href="#" - id=":r20:" + id="_r_20_" style="--subitem-depth: 1;" tabindex="0" > <span class="prc-ActionList-Spacer-vgXtU" @@ -85,11 +85,11 @@ class="prc-ActionList-ActionListSubContent-Zcjdz" data-component="ActionList.Item--DividerContainer" > <span class="prc-ActionList-ItemLabel-hYyH7" - id=":r20:--label" + id="_r_20_--label" > Sub Item </span> </span> </a> ❯ toMatchSnapshot src/NavList/NavList.test.tsx:222:22
})

it('does not have active styles if SubNav contains the current item and is open', () => {
Expand All @@ -240,7 +240,7 @@
expect(queryByRole('list', {name: 'Item'})).toBeVisible()

// Snapshot styles
expect(container).toMatchSnapshot()

Check failure on line 243 in packages/react/src/NavList/NavList.test.tsx

View workflow job for this annotation

GitHub Actions / test (react-19)

src/NavList/NavList.test.tsx > NavList.Item with NavList.SubNav > does not have active styles if SubNav contains the current item and is open

Error: Snapshot `NavList.Item with NavList.SubNav > does not have active styles if SubNav contains the current item and is open 1` mismatched - Expected + Received @@ -9,16 +9,16 @@ class="prc-ActionList-ActionListItem-jXerx" data-has-description="false" data-has-subitem="true" > <button - aria-controls=":r23:" + aria-controls="_r_23_" aria-expanded="true" - aria-labelledby=":r22:--label :r22:--trailing-visual " + aria-labelledby="_r_22_--label _r_22_--trailing-visual " class="prc-ActionList-ActionListContent-Q8eQr" data-size="medium" - id=":r22:" + id="_r_22_" style="--subitem-depth: 0;" tabindex="0" type="button" > <span @@ -28,17 +28,17 @@ class="prc-ActionList-ActionListSubContent-Zcjdz" data-component="ActionList.Item--DividerContainer" > <span class="prc-ActionList-ItemLabel-hYyH7" - id=":r22:--label" + id="_r_22_--label" > Item </span> <span class="prc-ActionList-TrailingVisual-8LMjP prc-ActionList-VisualWrap-MGVnU" - id=":r22:--trailing-visual" + id="_r_22_--trailing-visual" > <svg aria-hidden="true" class="octicon octicon-chevron-down prc-ActionList-ExpandIcon-6JuzS" display="inline-block" @@ -56,26 +56,26 @@ </svg> </span> </span> </button> <ul - aria-labelledby=":r22:" + aria-labelledby="_r_22_" class="prc-ActionList-SubGroup-4pVPh" - id=":r23:" + id="_r_23_" > <li class="prc-ActionList-ActionListItem-jXerx" data-active="true" data-has-description="false" > <a aria-current="page" - aria-labelledby=":r25:--label " + aria-labelledby="_r_25_--label " class="prc-ActionList-ActionListContent-Q8eQr prc-Link-Link-O33ci" data-size="medium" href="#" - id=":r25:" + id="_r_25_" style="--subitem-depth: 1;" tabindex="0" > <span class="prc-ActionList-Spacer-vgXtU" @@ -84,11 +84,11 @@ class="prc-ActionList-ActionListSubContent-Zcjdz" data-component="ActionList.Item--DividerContainer" > <span class="prc-ActionList-ItemLabel-hYyH7" - id=":r25:--label" + id="_r_25_--label" > Sub Item </span> </span> </a> ❯ toMatchSnapshot src/NavList/NavList.test.tsx:243:22
})

it('prevents more than 4 levels of nested SubNavs', () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/react/src/NavList/NavList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function ItemWithSubNav({children, subNav, depth: _depth, defaultOpen, style}: I
}, [subNav, buttonId])

return (
<ItemWithSubNavContext.Provider value={{buttonId, subNavId, isOpen}}>
(<ItemWithSubNavContext.Provider value={{buttonId, subNavId, isOpen}}>
<ActionList.Item
id={buttonId}
aria-expanded={isOpen}
Expand All @@ -158,10 +158,10 @@ function ItemWithSubNav({children, subNav, depth: _depth, defaultOpen, style}: I
<ActionList.TrailingVisual>
<ChevronDownIcon className={classes.ExpandIcon} />
</ActionList.TrailingVisual>
<SubItem>{React.cloneElement(subNav as React.ReactElement, {ref: subNavRef})}</SubItem>
<SubItem>{React.cloneElement(subNav as React.ReactElement<any>, {ref: subNavRef})}</SubItem>
</ActionList.Item>
</ItemWithSubNavContext.Provider>
)
</ItemWithSubNavContext.Provider>)
);
}

// ----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/Overlay/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const BaseOverlay = React.forwardRef(
...rest
},
forwardedRef,
): ReactElement => {
): ReactElement<any> => {
return (
<Component
{...rest}
Expand Down Expand Up @@ -187,7 +187,7 @@ const Overlay = React.forwardRef<HTMLDivElement, internalOverlayProps>(
...props
},
forwardedRef,
): ReactElement => {
): ReactElement<any> => {
const overlayRef = useRef<HTMLDivElement>(null)
useRefObjectAsForwardedRef(forwardedRef, overlayRef)
const slideAnimationDistance = 8 // var(--base-size-8), hardcoded to do some math
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/Radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const Radio = React.forwardRef<HTMLInputElement, RadioProps>(
...rest
}: RadioProps,
ref,
): ReactElement => {
): ReactElement<any> => {
const radioGroupContext = useContext(RadioGroupContext)
const handleOnChange: ChangeEventHandler<HTMLInputElement> = e => {
radioGroupContext?.onChange && radioGroupContext.onChange(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ figma.connect(
},
example: ({selected, label, leadingIcon}) => (
// @ts-expect-error: leadingIcon is optional
<SegmentedControl.Button selected={selected} leadingVisual={leadingIcon.fn}>
(<SegmentedControl.Button selected={selected} leadingVisual={leadingIcon.fn}>
{label}
</SegmentedControl.Button>
</SegmentedControl.Button>)
),
},
)
Expand All @@ -44,7 +44,7 @@ figma.connect(
{
props: {
selected: figma.enum('state', {selected: true}),
icon: figma.instance('icon').getProps<{name: string; fn: React.ReactElement}>(),
icon: figma.instance('icon').getProps<{name: string; fn: React.ReactElement<any>}>(),
},
example: ({selected, icon}) => (
<SegmentedControl.IconButton aria-label="Describe action" selected={selected} icon={icon.fn} />
Expand Down
12 changes: 6 additions & 6 deletions packages/react/src/SegmentedControl/SegmentedControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const Root: React.FC<React.PropsWithChildren<SegmentedControlProps>> = ({
)
? React.Children.toArray(children)[selectedIndex]
: undefined
const getChildIcon = (childArg: React.ReactNode): React.ReactElement | null => {
const getChildIcon = (childArg: React.ReactNode): React.ReactElement<any> | null => {
if (
React.isValidElement<SegmentedControlButtonProps>(childArg) &&
(childArg.type === Button || isSlot(childArg, Button))
Expand Down Expand Up @@ -112,7 +112,7 @@ const Root: React.FC<React.PropsWithChildren<SegmentedControlProps>> = ({

return responsiveVariant === 'dropdown' ? (
// Render the 'dropdown' variant of the SegmentedControlButton or SegmentedControlIconButton
<>
(<>
<ActionMenu>
{/*
The aria-label is only provided as a backup when the designer or engineer neglects to show a label for the SegmentedControl.
Expand Down Expand Up @@ -150,10 +150,10 @@ const Root: React.FC<React.PropsWithChildren<SegmentedControlProps>> = ({
</ActionList>
</ActionMenu.Overlay>
</ActionMenu>
</>
</>)
) : (
// Render a segmented control
<ul
(<ul
aria-label={ariaLabel}
aria-labelledby={ariaLabelledby}
ref={segmentedControlContainerRef}
Expand Down Expand Up @@ -221,8 +221,8 @@ const Root: React.FC<React.PropsWithChildren<SegmentedControlProps>> = ({
// Render the children as-is and add the shared child props
return React.cloneElement(child, sharedChildProps)
})}
</ul>
)
</ul>)
);
}

Root.displayName = 'SegmentedControl'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export type SegmentedControlButtonProps = {
/** Whether the segment is selected. This is used for uncontrolled `SegmentedControls` to pick one `SegmentedControlButton` that is selected on the initial render. */
defaultSelected?: boolean
/** The leading visual comes before item label */
leadingVisual?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement
leadingVisual?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement<any>
/** @deprecated Use `leadingVisual` instead. The leading icon comes before item label */
leadingIcon?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement
leadingIcon?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement<any>
/** Optional counter to display on the right side of the button */
count?: number | string
} & ButtonHTMLAttributes<HTMLButtonElement | HTMLLIElement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {FCWithSlotMarker} from '../utils/types'
export type SegmentedControlIconButtonProps = {
'aria-label': string
/** The icon that represents the segmented control item */
icon: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement
icon: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement<any>
/** Whether the segment is selected. This is used for controlled SegmentedControls, and needs to be updated using the onChange handler on SegmentedControl. */
selected?: boolean
/** Whether the segment is selected. This is used for uncontrolled SegmentedControls to pick one SegmentedControlButton that is selected on the initial render. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const NoResultsMessage = (filter: string): {variant: 'empty'; title: string; bod
}
}

const EmptyMessage: {variant: 'empty'; title: string; body: React.ReactElement} = {
const EmptyMessage: {variant: 'empty'; title: string; body: React.ReactElement<any>} = {
variant: 'empty',
title: `You haven't created any projects yet`,
body: (
Expand Down Expand Up @@ -340,7 +340,7 @@ export const WithNotice = () => {
const [open, setOpen] = useState(false)
const [noticeVariant, setNoticeVariant] = useState(0)

const noticeVariants: Array<{text: string | React.ReactElement; variant: 'info' | 'warning' | 'error'}> = [
const noticeVariants: Array<{text: string | React.ReactElement<any>; variant: 'info' | 'warning' | 'error'}> = [
{
variant: 'info',
text: 'Try a different search term.',
Expand Down Expand Up @@ -637,7 +637,7 @@ export const CustomisedNoInitialItems = () => {
setIsError(!isError)
}, [setIsError, isError])

function getMessage(): {variant: 'empty' | 'error'; title: string; body: string | React.ReactElement} {
function getMessage(): {variant: 'empty' | 'error'; title: string; body: string | React.ReactElement<any>} {
if (isError) return ErrorMessage
else if (filter) return NoResultsMessage(filter)
else return EmptyMessage
Expand Down Expand Up @@ -901,10 +901,10 @@ export const WithMessage = () => {
| undefined
| {
title: string
body: string | React.ReactElement
body: string | React.ReactElement<any>
variant: 'empty' | 'error' | 'warning'
icon?: React.ComponentType<IconProps>
action?: React.ReactElement
action?: React.ReactElement<any>
}
> = [
undefined, // Default message
Expand Down
12 changes: 6 additions & 6 deletions packages/react/src/SelectPanel/SelectPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export type SelectPanelSecondaryAction =

interface SelectPanelBaseProps {
// TODO: Make `title` required in the next major version
title?: string | React.ReactElement
subtitle?: string | React.ReactElement
title?: string | React.ReactElement<any>
subtitle?: string | React.ReactElement<any>
onOpenChange: (
open: boolean,
gesture: 'anchor-click' | 'anchor-key-press' | 'click-outside' | 'escape' | 'selection' | 'cancel',
Expand All @@ -89,20 +89,20 @@ interface SelectPanelBaseProps {
initialLoadingType?: InitialLoadingType
className?: string
notice?: {
text: string | React.ReactElement
text: string | React.ReactElement<any>
variant: 'info' | 'warning' | 'error'
}
message?: {
title: string
body: string | React.ReactElement
body: string | React.ReactElement<any>
variant: 'empty' | 'error' | 'warning'
icon?: React.ComponentType<IconProps>
action?: React.ReactElement
action?: React.ReactElement<any>
}
/**
* @deprecated Use `secondaryAction` instead.
*/
footer?: string | React.ReactElement
footer?: string | React.ReactElement<any>
showSelectedOptionsFirst?: boolean
/**
* Whether to disable fullscreen behavior on narrow viewports.
Expand Down
Loading
Loading