diff --git a/.changeset/moody-rabbits-shop.md b/.changeset/moody-rabbits-shop.md new file mode 100644 index 0000000000..8fec710f2e --- /dev/null +++ b/.changeset/moody-rabbits-shop.md @@ -0,0 +1,7 @@ +--- +"@nextui-org/calendar": patch +"@nextui-org/tabs": patch +"@nextui-org/shared-utils": patch +--- + +support inert value with boolean type for react 19 (#4038) diff --git a/packages/components/calendar/src/calendar-month.tsx b/packages/components/calendar/src/calendar-month.tsx index e17fca20d9..8972f10bd6 100644 --- a/packages/components/calendar/src/calendar-month.tsx +++ b/packages/components/calendar/src/calendar-month.tsx @@ -4,7 +4,7 @@ import {HTMLNextUIProps} from "@nextui-org/system"; import {useLocale} from "@react-aria/i18n"; import {useCalendarGrid} from "@react-aria/calendar"; import {m} from "framer-motion"; -import {dataAttr} from "@nextui-org/shared-utils"; +import {dataAttr, getInertValue} from "@nextui-org/shared-utils"; import {CalendarCell} from "./calendar-cell"; import {slideVariants} from "./calendar-transitions"; @@ -40,9 +40,8 @@ export function CalendarMonth(props: CalendarMonthProps) { className={slots?.gridBodyRow({class: classNames?.gridBodyRow})} data-slot="grid-body-row" // makes the browser ignore the element and its children when tabbing - // TODO: invert inert when switching to React 19 (ref: https://github.com/facebook/react/issues/17157) // @ts-ignore - inert={isHeaderExpanded ? "" : undefined} + inert={getInertValue(!!isHeaderExpanded)} > {state .getDatesInWeek(weekIndex, startDate) diff --git a/packages/components/calendar/src/calendar-picker.tsx b/packages/components/calendar/src/calendar-picker.tsx index 76e4cf07e5..c75194aa2a 100644 --- a/packages/components/calendar/src/calendar-picker.tsx +++ b/packages/components/calendar/src/calendar-picker.tsx @@ -2,6 +2,7 @@ import type {CalendarPickerProps} from "./use-calendar-picker"; import {HTMLNextUIProps} from "@nextui-org/system"; import {useCallback} from "react"; +import {getInertValue} from "@nextui-org/shared-utils"; import {CalendarPickerItem} from "./calendar-picker-item"; import {useCalendarPicker} from "./use-calendar-picker"; @@ -66,9 +67,8 @@ export function CalendarPicker(props: CalendarPickerProps) { })} data-slot="picker-wrapper" // makes the browser ignore the element and its children when tabbing - // TODO: invert inert when switching to React 19 (ref: https://github.com/facebook/react/issues/17157) // @ts-ignore - inert={isHeaderExpanded ? undefined : ""} + inert={getInertValue(!isHeaderExpanded)} >