Skip to content
Merged
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,8 @@ const meta: Meta = {
export default meta

const NextJSLikeLink = forwardRef(
({href, children}: {href: string; children: React.ReactNode}, ref): React.ReactElement => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
({href, children}: {href: string; children: React.ReactNode}, ref): React.ReactElement<any> => {
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,8 @@ type ContextProps = {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
afterSelect?: Function
enableFocusZone?: boolean
defaultTrailingVisual?: React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
defaultTrailingVisual?: React.ReactElement<any>
}

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

function ExampleWithTooltipV2(actionMenuTrigger: React.ReactElement): JSX.Element {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function ExampleWithTooltipV2(actionMenuTrigger: React.ReactElement<any>): JSX.Element {
return (
<BaseStyles>
<ActionMenu>
Expand Down
9 changes: 6 additions & 3 deletions packages/react/src/ActionMenu/ActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export type ActionMenuProps = {
/**
* Recommended: `ActionMenu.Button` or `ActionMenu.Anchor` with `ActionMenu.Overlay`
*/
children: React.ReactElement[] | React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
children: React.ReactElement<any>[] | React.ReactElement<any>

/**
* If defined, will control the open/closed state of the overlay. Must be used in conjunction with `onOpenChange`.
Expand Down Expand Up @@ -179,11 +180,13 @@ const Menu: FCWithSlotMarker<React.PropsWithChildren<ActionMenuProps>> = ({
)
}

export type ActionMenuAnchorProps = {children: React.ReactElement; id?: string} & React.HTMLAttributes<HTMLElement>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ActionMenuAnchorProps = {children: React.ReactElement<any>; id?: string} & React.HTMLAttributes<HTMLElement>
const Anchor: WithSlotMarker<
React.ForwardRefExoticComponent<
{
children: React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
children: React.ReactElement<any>
id?: string
} & React.HTMLAttributes<HTMLElement> &
React.RefAttributes<HTMLElement>
Expand Down
6 changes: 4 additions & 2 deletions packages/react/src/Autocomplete/AutocompleteMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import classes from './AutocompleteMenu.module.css'

type OnSelectedChange<T> = (item: T | T[]) => void
export type AutocompleteMenuItem = MandateProps<ActionListItemProps, 'id'> & {
leadingVisual?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
leadingVisual?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement<any>
text?: string
trailingVisual?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
trailingVisual?: React.FunctionComponent<React.PropsWithChildren<IconProps>> | React.ReactElement<any>
}

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

type BreadcrumbsMenuItemProps = {
items: React.ReactElement[]
// eslint-disable-next-line @typescript-eslint/no-explicit-any
items: React.ReactElement<any>[]
'aria-label'?: string
}

Expand Down Expand Up @@ -141,7 +142,8 @@ const BreadcrumbsMenuItem = React.forwardRef<HTMLDetailsElement, BreadcrumbsMenu
BreadcrumbsMenuItem.displayName = 'Breadcrumbs.MenuItem'

const getValidChildren = (children: React.ReactNode) => {
return React.Children.toArray(children).filter(child => React.isValidElement(child)) as React.ReactElement[]
// eslint-disable-next-line @typescript-eslint/no-explicit-any
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 +168,12 @@ function Breadcrumbs({className, children, style, overflow = 'wrap', variant = '

const rootItem = childArray[0]

const [visibleItems, setVisibleItems] = useState<React.ReactElement[]>(() => childArray)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const [visibleItems, setVisibleItems] = useState<React.ReactElement<any>[]>(() => childArray)
const [childArrayWidths, setChildArrayWidths] = useState<number[]>(() => [])

const [menuItems, setMenuItems] = useState<React.ReactElement[]>([])
// eslint-disable-next-line @typescript-eslint/no-explicit-any
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 +207,8 @@ function Breadcrumbs({className, children, style, overflow = 'wrap', variant = '

let currentVisibleItems = [...childArray]
let currentVisibleItemWidths = [...childArrayWidths]
let currentMenuItems: React.ReactElement[] = []
// eslint-disable-next-line @typescript-eslint/no-explicit-any
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,8 @@ 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>) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const renderWithTheme = (component: React.ReactElement<any>, flags?: Record<string, boolean>) => {
const wrappedComponent = flags ? <FeatureFlags flags={flags}>{component}</FeatureFlags> : <>{component}</>
return HTMLRender(wrappedComponent)
}
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/Button/ButtonBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import classes from './ButtonBase.module.css'
import {isElement} from 'react-is'

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

/**
* The trailing visual which comes after the button content
*/
trailingVisual?: React.ElementType | React.ReactElement | null
// eslint-disable-next-line @typescript-eslint/no-explicit-any
trailingVisual?: React.ElementType | React.ReactElement<any> | null

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

const Root = React.forwardRef<HTMLDetailsElement, DetailsProps>(
({className, children, ...rest}, forwardRef): ReactElement => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
({className, children, ...rest}, forwardRef): ReactElement<any> => {
const detailsRef = React.useRef<HTMLDetailsElement>(null)
const ref = useMergedRefs(forwardRef, detailsRef)

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

export type RenderItemFn = (props: FilteredActionListItemProps) => React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type RenderItemFn = (props: FilteredActionListItemProps) => React.ReactElement<any>

export type ItemInput =
| Merge<React.ComponentPropsWithoutRef<'div'>, FilteredActionListItemProps>
Expand Down
3 changes: 2 additions & 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,8 @@ export const WithReactRouterLink = () => (
type NextJSLinkProps = {href: string; children: React.ReactNode}

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

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

Check failure on line 34 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:34:22
})

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

Check failure on line 50 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:50:22
})

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

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

Check failure on line 223 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:223:22
})

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

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

Check failure on line 244 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:244:22
})

it('prevents more than 4 levels of nested SubNavs', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/NavList/NavList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ 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>
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
<SubItem>{React.cloneElement(subNav as React.ReactElement<any>, {ref: subNavRef})}</SubItem>
</ActionList.Item>
</ItemWithSubNavContext.Provider>
)
Expand Down
6 changes: 4 additions & 2 deletions packages/react/src/Overlay/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export const BaseOverlay = React.forwardRef(
...rest
},
forwardedRef,
): ReactElement => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): ReactElement<any> => {
return (
<Component
{...rest}
Expand Down Expand Up @@ -187,7 +188,8 @@ const Overlay = React.forwardRef<HTMLDivElement, internalOverlayProps>(
...props
},
forwardedRef,
): ReactElement => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): ReactElement<any> => {
const overlayRef = useRef<HTMLDivElement>(null)
useRefObjectAsForwardedRef(forwardedRef, overlayRef)
const slideAnimationDistance = 8 // var(--base-size-8), hardcoded to do some math
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/Radio/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const Radio = React.forwardRef<HTMLInputElement, RadioProps>(
...rest
}: RadioProps,
ref,
): ReactElement => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): 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 @@ -44,7 +44,8 @@ figma.connect(
{
props: {
selected: figma.enum('state', {selected: true}),
icon: figma.instance('icon').getProps<{name: string; fn: React.ReactElement}>(),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
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
3 changes: 2 additions & 1 deletion packages/react/src/SegmentedControl/SegmentedControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ const Root: React.FC<React.PropsWithChildren<SegmentedControlProps>> = ({
)
? React.Children.toArray(children)[selectedIndex]
: undefined
const getChildIcon = (childArg: React.ReactNode): React.ReactElement | null => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const getChildIcon = (childArg: React.ReactNode): React.ReactElement<any> | null => {
if (
React.isValidElement<SegmentedControlButtonProps>(childArg) &&
(childArg.type === Button || isSlot(childArg, Button))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ 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
// eslint-disable-next-line @typescript-eslint/no-explicit-any
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
// eslint-disable-next-line @typescript-eslint/no-explicit-any
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,8 @@ 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
// eslint-disable-next-line @typescript-eslint/no-explicit-any
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
15 changes: 10 additions & 5 deletions packages/react/src/SelectPanel/SelectPanel.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ const NoResultsMessage = (filter: string): {variant: 'empty'; title: string; bod
}
}

const EmptyMessage: {variant: 'empty'; title: string; body: React.ReactElement} = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
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 +341,8 @@ export const WithNotice = () => {
const [open, setOpen] = useState(false)
const [noticeVariant, setNoticeVariant] = useState(0)

const noticeVariants: Array<{text: string | React.ReactElement; variant: 'info' | 'warning' | 'error'}> = [
// eslint-disable-next-line @typescript-eslint/no-explicit-any
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 +639,8 @@ export const CustomisedNoInitialItems = () => {
setIsError(!isError)
}, [setIsError, isError])

function getMessage(): {variant: 'empty' | 'error'; title: string; body: string | React.ReactElement} {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
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 +904,12 @@ export const WithMessage = () => {
| undefined
| {
title: string
body: string | React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
body: string | React.ReactElement<any>
variant: 'empty' | 'error' | 'warning'
icon?: React.ComponentType<IconProps>
action?: React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
action?: React.ReactElement<any>
}
> = [
undefined, // Default message
Expand Down
18 changes: 12 additions & 6 deletions packages/react/src/SelectPanel/SelectPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ export type SelectPanelSecondaryAction =

interface SelectPanelBaseProps {
// TODO: Make `title` required in the next major version
title?: string | React.ReactElement
subtitle?: string | React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
title?: string | React.ReactElement<any>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
subtitle?: string | React.ReactElement<any>
onOpenChange: (
open: boolean,
gesture: 'anchor-click' | 'anchor-key-press' | 'click-outside' | 'escape' | 'selection' | 'cancel',
Expand All @@ -89,20 +91,24 @@ interface SelectPanelBaseProps {
initialLoadingType?: InitialLoadingType
className?: string
notice?: {
text: string | React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
text: string | React.ReactElement<any>
variant: 'info' | 'warning' | 'error'
}
message?: {
title: string
body: string | React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
body: string | React.ReactElement<any>
variant: 'empty' | 'error' | 'warning'
icon?: React.ComponentType<IconProps>
action?: React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
action?: React.ReactElement<any>
}
/**
* @deprecated Use `secondaryAction` instead.
*/
footer?: string | React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
footer?: string | React.ReactElement<any>
showSelectedOptionsFirst?: boolean
/**
* Whether to disable fullscreen behavior on narrow viewports.
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/SelectPanel/SelectPanelMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export type SelectPanelMessageProps = {
* Ensure the action element is accessible by providing appropriate ARIA attributes
* and making it keyboard-navigable.
*/
action?: React.ReactElement
// eslint-disable-next-line @typescript-eslint/no-explicit-any
action?: React.ReactElement<any>
}

export const SelectPanelMessage: React.FC<SelectPanelMessageProps> = ({
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/Textarea/Textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
...rest
}: TextareaProps,
ref,
): ReactElement => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): ReactElement<any> => {
return (
<TextInputBaseWrapper
validationStatus={validationStatus}
Expand Down
Loading
Loading