@yamada-ui/react 2.2.3-dev-20260622141401 → 2.2.3-dev-20260624122859
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/accordion/use-accordion.cjs.map +1 -1
- package/dist/cjs/components/autocomplete/use-autocomplete.cjs.map +1 -1
- package/dist/cjs/components/calendar/use-calendar.cjs +1 -1
- package/dist/cjs/components/calendar/use-calendar.cjs.map +1 -1
- package/dist/cjs/components/carousel/carousel.cjs.map +1 -1
- package/dist/cjs/components/chart/chart.cjs.map +1 -1
- package/dist/cjs/components/chart/use-polar-chart.cjs.map +1 -1
- package/dist/cjs/components/checkbox/checkbox.cjs.map +1 -1
- package/dist/cjs/components/checkbox/use-checkbox-group.cjs.map +1 -1
- package/dist/cjs/components/checkbox-card/checkbox-card.cjs.map +1 -1
- package/dist/cjs/components/collapse/collapse.cjs.map +1 -1
- package/dist/cjs/components/color-picker/use-color-picker.cjs.map +1 -1
- package/dist/cjs/components/color-swatch/color-swatch-group.cjs.map +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/cjs/components/date-picker/use-date-picker.cjs +1 -1
- package/dist/cjs/components/date-picker/use-date-picker.cjs.map +1 -1
- package/dist/cjs/components/editable/use-editable.cjs.map +1 -1
- package/dist/cjs/components/field/field.cjs.map +1 -1
- package/dist/cjs/components/file-input/file-input.cjs.map +1 -1
- package/dist/cjs/components/flip/flip.cjs.map +1 -1
- package/dist/cjs/components/highlight/highlight.cjs.map +1 -1
- package/dist/cjs/components/indicator/indicator.cjs.map +1 -1
- package/dist/cjs/components/infinite-scroll-area/use-infinite-scroll.cjs.map +1 -1
- package/dist/cjs/components/input/input-group.cjs.map +1 -1
- package/dist/cjs/components/list/list.cjs.map +1 -1
- package/dist/cjs/components/menu/use-menu.cjs.map +1 -1
- package/dist/cjs/components/native-select/use-native-select.cjs.map +1 -1
- package/dist/cjs/components/native-table/native-table.cjs.map +1 -1
- package/dist/cjs/components/notice/notice.cjs.map +1 -1
- package/dist/cjs/components/number-input/use-number-input.cjs.map +1 -1
- package/dist/cjs/components/pagination/pagination.cjs.map +1 -1
- package/dist/cjs/components/pagination/use-pagination.cjs.map +1 -1
- package/dist/cjs/components/picture/picture.cjs.map +1 -1
- package/dist/cjs/components/pin-input/pin-input.cjs.map +1 -1
- package/dist/cjs/components/pin-input/use-pin-input.cjs.map +1 -1
- package/dist/cjs/components/qr-code/use-qr-code.cjs.map +1 -1
- package/dist/cjs/components/radio/use-radio-group.cjs.map +1 -1
- package/dist/cjs/components/segmented-control/segmented-control.cjs.map +1 -1
- package/dist/cjs/components/select/use-select.cjs.map +1 -1
- package/dist/cjs/components/show/show.cjs.map +1 -1
- package/dist/cjs/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/cjs/components/sidebar/use-sidebar.cjs.map +1 -1
- package/dist/cjs/components/simple-grid/simple-grid.cjs.map +1 -1
- package/dist/cjs/components/stack/z-stack.cjs.map +1 -1
- package/dist/cjs/components/steps/steps.cjs.map +1 -1
- package/dist/cjs/components/steps/use-steps.cjs.map +1 -1
- package/dist/cjs/components/table/table.cjs.map +1 -1
- package/dist/cjs/components/tabs/tabs.cjs.map +1 -1
- package/dist/cjs/components/toggle/use-toggle-group.cjs.map +1 -1
- package/dist/cjs/components/toggle/use-toggle.cjs.map +1 -1
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/components/tree/use-tree.cjs.map +1 -1
- package/dist/cjs/core/components/create-component.cjs.map +1 -1
- package/dist/cjs/core/components/props.cjs.map +1 -1
- package/dist/cjs/core/components/use-component-style.cjs.map +1 -1
- package/dist/cjs/core/css/animation.cjs.map +1 -1
- package/dist/cjs/core/css/at-rule.cjs.map +1 -1
- package/dist/cjs/core/css/calc.cjs.map +1 -1
- package/dist/cjs/core/css/color-mix.cjs.map +1 -1
- package/dist/cjs/core/css/config.cjs.map +1 -1
- package/dist/cjs/core/css/css.cjs.map +1 -1
- package/dist/cjs/core/css/gradient.cjs.map +1 -1
- package/dist/cjs/core/css/grid.cjs.map +1 -1
- package/dist/cjs/core/css/transition.cjs.map +1 -1
- package/dist/cjs/core/css/utils.cjs.map +1 -1
- package/dist/cjs/core/system/breakpoint.cjs.map +1 -1
- package/dist/cjs/core/system/color-mode-provider.cjs.map +1 -1
- package/dist/cjs/core/system/create-system.cjs.map +1 -1
- package/dist/cjs/core/system/environment-provider.cjs.map +1 -1
- package/dist/cjs/core/system/storage-manager.cjs.map +1 -1
- package/dist/cjs/core/system/storage-script.cjs.map +1 -1
- package/dist/cjs/core/system/use-system-color-mode.cjs.map +1 -1
- package/dist/cjs/core/system/var.cjs.map +1 -1
- package/dist/cjs/hooks/use-animation/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-breakpoint/use-breakpoint-value.cjs.map +1 -1
- package/dist/cjs/hooks/use-breakpoint/use-breakpoint.cjs.map +1 -1
- package/dist/cjs/hooks/use-clickable/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-clipboard/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-controllable-state/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-counter/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-descendants/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-focus/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-local-storage/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-mounted/index.cjs.map +1 -1
- package/dist/cjs/hooks/use-outside-click/index.cjs.map +1 -1
- package/dist/cjs/providers/i18n-provider/i18n-provider.cjs.map +1 -1
- package/dist/cjs/utils/children.cjs.map +1 -1
- package/dist/cjs/utils/dom.cjs.map +1 -1
- package/dist/cjs/utils/store.cjs.map +1 -1
- package/dist/esm/components/accordion/use-accordion.js.map +1 -1
- package/dist/esm/components/autocomplete/use-autocomplete.js.map +1 -1
- package/dist/esm/components/calendar/use-calendar.js +1 -1
- package/dist/esm/components/calendar/use-calendar.js.map +1 -1
- package/dist/esm/components/carousel/carousel.js.map +1 -1
- package/dist/esm/components/chart/chart.js.map +1 -1
- package/dist/esm/components/chart/use-polar-chart.js.map +1 -1
- package/dist/esm/components/checkbox/checkbox.js.map +1 -1
- package/dist/esm/components/checkbox/use-checkbox-group.js.map +1 -1
- package/dist/esm/components/checkbox-card/checkbox-card.js.map +1 -1
- package/dist/esm/components/collapse/collapse.js.map +1 -1
- package/dist/esm/components/color-picker/use-color-picker.js.map +1 -1
- package/dist/esm/components/color-swatch/color-swatch-group.js.map +1 -1
- package/dist/esm/components/date-picker/date-picker.js.map +1 -1
- package/dist/esm/components/date-picker/use-date-picker.js +1 -1
- package/dist/esm/components/date-picker/use-date-picker.js.map +1 -1
- package/dist/esm/components/editable/use-editable.js.map +1 -1
- package/dist/esm/components/field/field.js.map +1 -1
- package/dist/esm/components/file-input/file-input.js.map +1 -1
- package/dist/esm/components/flip/flip.js.map +1 -1
- package/dist/esm/components/highlight/highlight.js.map +1 -1
- package/dist/esm/components/indicator/indicator.js.map +1 -1
- package/dist/esm/components/infinite-scroll-area/use-infinite-scroll.js.map +1 -1
- package/dist/esm/components/input/input-group.js.map +1 -1
- package/dist/esm/components/list/list.js.map +1 -1
- package/dist/esm/components/menu/use-menu.js.map +1 -1
- package/dist/esm/components/native-select/use-native-select.js.map +1 -1
- package/dist/esm/components/native-table/native-table.js.map +1 -1
- package/dist/esm/components/notice/notice.js.map +1 -1
- package/dist/esm/components/number-input/use-number-input.js.map +1 -1
- package/dist/esm/components/pagination/pagination.js.map +1 -1
- package/dist/esm/components/pagination/use-pagination.js.map +1 -1
- package/dist/esm/components/picture/picture.js.map +1 -1
- package/dist/esm/components/pin-input/pin-input.js.map +1 -1
- package/dist/esm/components/pin-input/use-pin-input.js.map +1 -1
- package/dist/esm/components/qr-code/use-qr-code.js.map +1 -1
- package/dist/esm/components/radio/use-radio-group.js.map +1 -1
- package/dist/esm/components/segmented-control/segmented-control.js.map +1 -1
- package/dist/esm/components/select/use-select.js.map +1 -1
- package/dist/esm/components/show/show.js.map +1 -1
- package/dist/esm/components/sidebar/sidebar.js.map +1 -1
- package/dist/esm/components/sidebar/use-sidebar.js.map +1 -1
- package/dist/esm/components/simple-grid/simple-grid.js.map +1 -1
- package/dist/esm/components/stack/z-stack.js.map +1 -1
- package/dist/esm/components/steps/steps.js.map +1 -1
- package/dist/esm/components/steps/use-steps.js.map +1 -1
- package/dist/esm/components/table/table.js.map +1 -1
- package/dist/esm/components/tabs/tabs.js.map +1 -1
- package/dist/esm/components/toggle/use-toggle-group.js.map +1 -1
- package/dist/esm/components/toggle/use-toggle.js.map +1 -1
- package/dist/esm/components/tree/tree.js.map +1 -1
- package/dist/esm/components/tree/use-tree.js.map +1 -1
- package/dist/esm/core/components/create-component.js.map +1 -1
- package/dist/esm/core/components/props.js.map +1 -1
- package/dist/esm/core/components/use-component-style.js.map +1 -1
- package/dist/esm/core/css/animation.js.map +1 -1
- package/dist/esm/core/css/at-rule.js.map +1 -1
- package/dist/esm/core/css/calc.js.map +1 -1
- package/dist/esm/core/css/color-mix.js.map +1 -1
- package/dist/esm/core/css/config.js.map +1 -1
- package/dist/esm/core/css/css.js.map +1 -1
- package/dist/esm/core/css/gradient.js.map +1 -1
- package/dist/esm/core/css/grid.js.map +1 -1
- package/dist/esm/core/css/transition.js.map +1 -1
- package/dist/esm/core/css/utils.js.map +1 -1
- package/dist/esm/core/system/breakpoint.js.map +1 -1
- package/dist/esm/core/system/color-mode-provider.js.map +1 -1
- package/dist/esm/core/system/create-system.js.map +1 -1
- package/dist/esm/core/system/environment-provider.js.map +1 -1
- package/dist/esm/core/system/storage-manager.js.map +1 -1
- package/dist/esm/core/system/storage-script.js.map +1 -1
- package/dist/esm/core/system/use-system-color-mode.js.map +1 -1
- package/dist/esm/core/system/var.js.map +1 -1
- package/dist/esm/hooks/use-animation/index.js.map +1 -1
- package/dist/esm/hooks/use-breakpoint/use-breakpoint-value.js.map +1 -1
- package/dist/esm/hooks/use-breakpoint/use-breakpoint.js.map +1 -1
- package/dist/esm/hooks/use-clickable/index.js.map +1 -1
- package/dist/esm/hooks/use-clipboard/index.js.map +1 -1
- package/dist/esm/hooks/use-controllable-state/index.js.map +1 -1
- package/dist/esm/hooks/use-counter/index.js.map +1 -1
- package/dist/esm/hooks/use-descendants/index.js.map +1 -1
- package/dist/esm/hooks/use-focus/index.js.map +1 -1
- package/dist/esm/hooks/use-local-storage/index.js.map +1 -1
- package/dist/esm/hooks/use-mounted/index.js.map +1 -1
- package/dist/esm/hooks/use-outside-click/index.js.map +1 -1
- package/dist/esm/providers/i18n-provider/i18n-provider.js.map +1 -1
- package/dist/esm/utils/children.js.map +1 -1
- package/dist/esm/utils/dom.js.map +1 -1
- package/dist/esm/utils/store.js.map +1 -1
- package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
- package/dist/types/components/breadcrumb/breadcrumb.style.d.ts +1 -1
- package/dist/types/components/calendar/calendar.style.d.ts +2 -2
- package/dist/types/components/carousel/carousel.style.d.ts +2 -2
- package/dist/types/components/date-picker/date-picker.style.d.ts +1 -1
- package/dist/types/components/field/use-field-props.d.ts +1 -1
- package/dist/types/components/file-button/use-file-button.d.ts +2 -2
- package/dist/types/components/file-input/use-file-input.d.ts +2 -2
- package/dist/types/components/menu/menu.style.d.ts +2 -2
- package/dist/types/components/progress/use-progress.d.ts +6 -6
- package/dist/types/components/rating/rating.style.d.ts +2 -2
- package/dist/types/components/select/select.style.d.ts +1 -1
- package/dist/types/components/steps/steps.style.d.ts +1 -1
- package/dist/types/components/tabs/tabs.style.d.ts +1 -1
- package/dist/types/components/tree/tree.style.d.ts +1 -1
- package/dist/types/components/tree/use-tree.d.ts +2 -2
- package/dist/types/hooks/use-clickable/index.d.ts +2 -2
- package/dist/types/providers/i18n-provider/i18n-provider.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"z-stack.js","names":[],"sources":["../../../../src/components/stack/z-stack.tsx"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type {\n CSSObject,\n Direction,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { ZStackStyle } from \"./z-stack.style\"\nimport {\n cloneElement,\n createRef,\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport {\n createComponent,\n mergeCSS,\n styled,\n useInjectVarsIntoCss,\n useInjectVarsIntoProps,\n} from \"../../core\"\nimport { getValidChildren, mergeRefs } from \"../../utils\"\nimport { zStackStyle } from \"./z-stack.style\"\n\nexport interface ZStackProps\n extends Omit<HTMLStyledProps, \"direction\">, ThemeProps<ZStackStyle> {\n /**\n * Stack in the specified direction.\n *\n * @default 'end'\n */\n direction?: Direction\n /**\n * If `true`, calculate the `width` and `height` of the element and assign container.\n *\n * @default true\n */\n fit?: boolean\n /**\n * If `true`, reverse direction.\n *\n * @default false\n */\n reverse?: boolean\n /**\n * If set the stack will start from the given index.\n *\n * @default 0\n */\n startIndex?: number\n}\n\nconst {\n PropsContext: ZStackPropsContext,\n usePropsContext: useZStackPropsContext,\n withContext,\n} = createComponent<ZStackProps, ZStackStyle>(\"stack--depth\", zStackStyle)\n\nexport { useZStackPropsContext, ZStackPropsContext }\n\n/**\n * `ZStack` is a component that groups elements and provides space between child elements.\n *\n * @see https://yamada-ui.com/docs/components/stack\n */\nexport const ZStack = withContext<\"div\", ZStackProps>(\n ({\n css,\n children,\n direction = \"end\",\n fit = true,\n reverse = false,\n startIndex = 0,\n ...rest\n }) => {\n if (direction === \"start-center\") direction = \"start\"\n if (direction === \"end-center\") direction = \"end\"\n\n const refMap = useRef<Map<number, RefObject<HTMLDivElement | null>>>(\n new Map(),\n )\n const [rect, setRect] = useState<{ height: number; width: number }>({\n height: 0,\n width: 0,\n })\n\n const vertical = useCallback(\n (space: string) => {\n if (direction.startsWith(\"start\"))
|
|
1
|
+
{"version":3,"file":"z-stack.js","names":[],"sources":["../../../../src/components/stack/z-stack.tsx"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type {\n CSSObject,\n Direction,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { ZStackStyle } from \"./z-stack.style\"\nimport {\n cloneElement,\n createRef,\n Fragment,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport {\n createComponent,\n mergeCSS,\n styled,\n useInjectVarsIntoCss,\n useInjectVarsIntoProps,\n} from \"../../core\"\nimport { getValidChildren, mergeRefs } from \"../../utils\"\nimport { zStackStyle } from \"./z-stack.style\"\n\nexport interface ZStackProps\n extends Omit<HTMLStyledProps, \"direction\">, ThemeProps<ZStackStyle> {\n /**\n * Stack in the specified direction.\n *\n * @default 'end'\n */\n direction?: Direction\n /**\n * If `true`, calculate the `width` and `height` of the element and assign container.\n *\n * @default true\n */\n fit?: boolean\n /**\n * If `true`, reverse direction.\n *\n * @default false\n */\n reverse?: boolean\n /**\n * If set the stack will start from the given index.\n *\n * @default 0\n */\n startIndex?: number\n}\n\nconst {\n PropsContext: ZStackPropsContext,\n usePropsContext: useZStackPropsContext,\n withContext,\n} = createComponent<ZStackProps, ZStackStyle>(\"stack--depth\", zStackStyle)\n\nexport { useZStackPropsContext, ZStackPropsContext }\n\n/**\n * `ZStack` is a component that groups elements and provides space between child elements.\n *\n * @see https://yamada-ui.com/docs/components/stack\n */\nexport const ZStack = withContext<\"div\", ZStackProps>(\n ({\n css,\n children,\n direction = \"end\",\n fit = true,\n reverse = false,\n startIndex = 0,\n ...rest\n }) => {\n if (direction === \"start-center\") direction = \"start\"\n if (direction === \"end-center\") direction = \"end\"\n\n const refMap = useRef<Map<number, RefObject<HTMLDivElement | null>>>(\n new Map(),\n )\n const [rect, setRect] = useState<{ height: number; width: number }>({\n height: 0,\n width: 0,\n })\n\n const vertical = useCallback(\n (space: string) => {\n if (direction.startsWith(\"start\"))\n return { [!reverse ? \"bottom\" : \"top\"]: space }\n else if (direction.startsWith(\"end\"))\n return { [!reverse ? \"top\" : \"bottom\"]: space }\n else return { [!reverse ? \"top\" : \"bottom\"]: 0 }\n },\n [direction, reverse],\n )\n\n const horizontal = useCallback(\n (space: string) => {\n if (direction.endsWith(\"-start\"))\n return { [!reverse ? \"right\" : \"left\"]: space }\n else if (direction.endsWith(\"-end\"))\n return { [!reverse ? \"left\" : \"right\"]: space }\n else return { [!reverse ? \"left\" : \"right\"]: 0 }\n },\n [direction, reverse],\n )\n\n const cloneChildren = useMemo(() => {\n const validChildren = getValidChildren(children)\n\n const clonedChildren = validChildren.map((child, index) => {\n const ref = createRef<HTMLDivElement>()\n\n refMap.current.set(index, ref)\n\n const key = child.key ?? index\n\n const zIndex = startIndex + index\n const space = `calc({space} * ${index})`\n\n const css: CSSObject = {\n position: \"absolute\",\n zIndex,\n ...vertical(space),\n ...horizontal(space),\n }\n\n const props = {\n ...child.props,\n ref: mergeRefs(child.props.ref, ref),\n css: mergeCSS(child.props.css, css),\n }\n\n const clonedChild = cloneElement(child, props)\n\n return <Fragment key={key}>{clonedChild}</Fragment>\n })\n\n return clonedChildren\n }, [children, startIndex, vertical, horizontal])\n\n useEffect(() => {\n if (!fit) return\n\n let negativeLeft = direction.endsWith(\"-start\")\n let negativeTop = direction.startsWith(\"start\")\n let width = 0\n let height = 0\n\n if (reverse) {\n negativeLeft = !negativeLeft\n negativeTop = !negativeTop\n }\n\n for (const ref of refMap.current.values()) {\n if (!ref.current) continue\n\n let { offsetHeight, offsetLeft, offsetParent, offsetTop, offsetWidth } =\n ref.current\n\n if (!offsetParent && process.env.NODE_ENV !== \"test\") continue\n\n if (negativeLeft) {\n const offsetParentWidth =\n (offsetParent as HTMLDivElement | null)?.offsetWidth ?? 0\n\n offsetLeft = offsetParentWidth - offsetLeft - offsetWidth\n }\n\n if (negativeTop) {\n const offsetParentHeight =\n (offsetParent as HTMLDivElement | null)?.offsetHeight ?? 0\n\n offsetTop = offsetParentHeight - offsetTop - offsetHeight\n }\n\n offsetWidth += offsetLeft\n offsetHeight += offsetTop\n\n if (offsetWidth > width) width = offsetWidth\n if (offsetHeight > height) height = offsetHeight\n }\n\n setRect({ height, width })\n }, [cloneChildren, direction, reverse, fit])\n\n return (\n <styled.div\n css={css}\n minHeight={fit ? `${rect.height}px` : undefined}\n minWidth={fit ? `${rect.width}px` : undefined}\n {...rest}\n >\n {cloneChildren}\n </styled.div>\n )\n },\n)(undefined, (props) => {\n const css = useInjectVarsIntoCss(props.css, { gap: \"space\" })\n const rest = useInjectVarsIntoProps(props, { gap: \"space\" })\n\n return { ...rest, css }\n})\n"],"mappings":";;;;;;;;;;;AA0DA,MAAM,EACJ,cAAc,oBACd,iBAAiB,uBACjB,gBACE,gBAA0C,gBAAgB,WAAW;;;;;;AASzE,MAAa,SAAS,aACnB,EACC,KACA,UACA,YAAY,OACZ,MAAM,MACN,UAAU,OACV,aAAa,GACb,GAAG,WACC;CACJ,IAAI,cAAc,gBAAgB,YAAY;CAC9C,IAAI,cAAc,cAAc,YAAY;CAE5C,MAAM,SAAS,uBACb,IAAI,IAAI,CACV;CACA,MAAM,CAAC,MAAM,WAAW,SAA4C;EAClE,QAAQ;EACR,OAAO;CACT,CAAC;CAED,MAAM,WAAW,aACd,UAAkB;EACjB,IAAI,UAAU,WAAW,OAAO,GAC9B,OAAO,GAAG,CAAC,UAAU,WAAW,QAAQ,MAAM;OAC3C,IAAI,UAAU,WAAW,KAAK,GACjC,OAAO,GAAG,CAAC,UAAU,QAAQ,WAAW,MAAM;OAC3C,OAAO,GAAG,CAAC,UAAU,QAAQ,WAAW,EAAE;CACjD,GACA,CAAC,WAAW,OAAO,CACrB;CAEA,MAAM,aAAa,aAChB,UAAkB;EACjB,IAAI,UAAU,SAAS,QAAQ,GAC7B,OAAO,GAAG,CAAC,UAAU,UAAU,SAAS,MAAM;OAC3C,IAAI,UAAU,SAAS,MAAM,GAChC,OAAO,GAAG,CAAC,UAAU,SAAS,UAAU,MAAM;OAC3C,OAAO,GAAG,CAAC,UAAU,SAAS,UAAU,EAAE;CACjD,GACA,CAAC,WAAW,OA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e;EAAW;EAAS;CAAG,CAAC;CAE3C,OACE,oBAAC,OAAO,KAAR;EACO;EACL,WAAW,MAAM,GAAG,KAAK,OAAO,MAAM,KAAA;EACtC,UAAU,MAAM,GAAG,KAAK,MAAM,MAAM,KAAA;EACpC,GAAI;YAEH;CACS,CAAA;AAEhB,CACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,MAAM,qBAAqB,MAAM,KAAK,EAAE,KAAK,QAAQ,CAAC;CAG5D,OAAO;EAAE,GAFI,uBAAuB,OAAO,EAAE,KAAK,QAAQ,CAE3C;EAAG;CAAI;AACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.js","names":[],"sources":["../../../../src/components/steps/steps.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { UseLazyMountProps } from \"../../hooks/use-lazy-mount\"\nimport type { StepsStyle } from \"./steps.style\"\nimport type { UseStepsItemProps, UseStepsProps } from \"./use-steps\"\nimport { Children, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useLazyMount } from \"../../hooks/use-lazy-mount\"\nimport { useValue } from \"../../hooks/use-value\"\nimport {\n isNull,\n isUndefined,\n useFindChild,\n useValidChildren,\n} from \"../../utils\"\nimport { CheckIcon } from \"../icon\"\nimport { stepsStyle } from \"./steps.style\"\nimport {\n StepsContext,\n StepsDescendantsContext,\n StepsItemContext,\n useSteps,\n useStepsContext,\n useStepsItem,\n useStepsItemContext,\n} from \"./use-steps\"\n\ninterface ComponentContext extends Pick<\n StepsRootProps,\n \"items\" | \"lazy\" | \"lazyBehavior\"\n> {}\n\nexport interface StepsItem\n extends\n Omit<StepsItemProps, \"content\" | \"index\" | \"title\">,\n Pick<StepsIndicatorProps, \"complete\" | \"current\" | \"incomplete\"> {\n /**\n * The content for step element.\n */\n content?: ReactNode\n /**\n * The description for step element.\n */\n description?: ReactNode\n /**\n * If true, display the step separator.\n *\n * @default true\n */\n hasSeparator?: boolean\n /**\n * The title for step element.\n */\n title?: string\n /**\n * Props for step content element.\n */\n contentProps?: StepsContentProps\n /**\n * Props for step description element.\n */\n descriptionProps?: StepsDescriptionProps\n /**\n * Props for step indicator element.\n */\n indicatorProps?: StepsIndicatorProps\n /**\n * Props for step separator element.\n */\n separatorProps?: StepsSeparatorProps\n /**\n * Props for step title element.\n */\n titleProps?: StepsTitleProps\n}\n\nexport interface StepsRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n Omit<UseStepsProps, \"count\" | \"orientation\">,\n Pick<UseLazyMountProps, \"lazy\" | \"lazyBehavior\">,\n ThemeProps<StepsStyle> {\n /**\n * If provided, generate step components based on steps.\n */\n items?: StepsItem[]\n}\n\nconst {\n ComponentContext,\n PropsContext: StepsPropsContext,\n useComponentContext,\n usePropsContext: useStepsPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<StepsRootProps, StepsStyle, ComponentContext>(\n \"steps\",\n stepsStyle,\n)\n\nexport { StepsPropsContext, useStepsPropsContext }\n\n/**\n * `Steps` is a component that displays the progress of a multi-step process.\n *\n * @see https://yamada-ui.com/docs/components/steps\n */\nexport const StepsRoot = withProvider<\"div\", StepsRootProps, \"orientation\">(\n ({\n children,\n items = [],\n lazy,\n lazyBehavior,\n orientation: orientationProp,\n ...rest\n }) => {\n const computedOrientation = useValue(orientationProp)\n const validChildren = useValidChildren(children)\n const stepsList = useFindChild<StepsListProps>(validChildren, StepsList)\n const {\n id,\n count,\n descendants,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n onNext,\n onPrev,\n } = useSteps({\n count: items.length || Children.count(stepsList?.props.children),\n orientation: computedOrientation,\n ...rest,\n })\n const componentContext = useMemo(\n () => ({ items, lazy, lazyBehavior }),\n [items, lazy, lazyBehavior],\n )\n const stepsContext = useMemo(\n () => ({\n id,\n count,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n onNext,\n onPrev,\n }),\n [\n id,\n count,\n index,\n orientation,\n setIndex,\n getStatus,\n onNext,\n onPrev,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getContentProps,\n ],\n )\n\n return (\n <StepsDescendantsContext value={descendants}>\n <StepsContext value={stepsContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{children}</styled.div>\n </ComponentContext>\n </StepsContext>\n </StepsDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"orientation\"] },\n)()\n\nexport interface StepsListProps extends HTMLStyledProps<\"ol\"> {}\n\nexport const StepsList = withContext<\"ol\", StepsListProps>(\n ({ children, ...rest }) => {\n const { items } = useComponentContext()\n const { getListProps } = useStepsContext()\n const computedChildren = useMemo(() => {\n if (children) {\n return children\n } else {\n return items?.map(\n (\n {\n complete,\n content: _content,\n current,\n description,\n hasSeparator = true,\n incomplete,\n title,\n contentProps: _contentProps,\n descriptionProps,\n indicatorProps,\n separatorProps,\n titleProps,\n ...rest\n },\n index,\n ) => (\n <StepsItem key={index} index={index} title={title} {...rest}>\n <StepsIndicator\n complete={complete}\n current={current}\n incomplete={incomplete}\n {...indicatorProps}\n />\n\n <styled.div>\n {title ? (\n <StepsTitle {...titleProps}>{title}</StepsTitle>\n ) : null}\n {description ? (\n <StepsDescription {...descriptionProps}>\n {description}\n </StepsDescription>\n ) : null}\n </styled.div>\n\n {hasSeparator ? <StepsSeparator {...separatorProps} /> : null}\n </StepsItem>\n ),\n )\n }\n }, [children, items])\n\n return <styled.ol {...getListProps(rest)}>{computedChildren}</styled.ol>\n },\n \"list\",\n)()\n\nexport interface StepsItemProps\n extends HTMLStyledProps<\"li\">, UseStepsItemProps {}\n\nexport const StepsItem = withContext<\"li\", StepsItemProps>((props) => {\n const {\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getRootProps,\n getSeparatorProps,\n getTitleProps,\n } = useStepsItem(props)\n const context = useMemo(\n () => ({\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getSeparatorProps,\n getTitleProps,\n }),\n [\n first,\n index,\n last,\n status,\n getTitleProps,\n getDescriptionProps,\n getSeparatorProps,\n getIndicatorProps,\n ],\n )\n\n return (\n <StepsItemContext value={context}>\n <styled.li {...getRootProps()} />\n </StepsItemContext>\n )\n}, \"item\")()\n\nexport interface StepsIndicatorProps extends HTMLStyledProps {\n /**\n * The element for the complete indicator.\n *\n * @default <CheckIcon />\n */\n complete?: ReactNode\n /**\n * The element for the current indicator.\n *\n * @default <StepsNumber />\n */\n current?: ReactNode\n /**\n * The element for the incomplete indicator.\n *\n * @default <StepsNumber />\n */\n incomplete?: ReactNode\n}\n\nexport const StepsIndicator = withContext<\"div\", StepsIndicatorProps>(\n ({\n complete = <CheckIcon />,\n current = <StepsNumber />,\n incomplete = <StepsNumber />,\n ...rest\n }) => {\n const { status, getIndicatorProps } = useStepsItemContext()\n const components = useMemo(\n () => ({ complete, current, incomplete }),\n [complete, current, incomplete],\n )\n\n return (\n <styled.div {...getIndicatorProps(rest)}>{components[status]}</styled.div>\n )\n },\n \"indicator\",\n)()\n\nexport interface StepsNumberProps extends HTMLStyledProps<\"span\"> {}\n\nexport const StepsNumber = withContext<\"span\", StepsNumberProps>(\n \"span\",\n \"number\",\n)(undefined, ({ children, ...rest }) => {\n const { index } = useStepsItemContext()\n\n return { ...rest, children: children ?? index + 1 }\n})\n\nexport interface StepsTitleProps extends HTMLStyledProps {}\n\nexport const StepsTitle = withContext<\"h3\", StepsTitleProps>(\"h3\", \"title\")(\n undefined,\n (props) => {\n const { getTitleProps } = useStepsItemContext()\n\n return getTitleProps(props)\n },\n)\n\nexport interface StepsDescriptionProps extends HTMLStyledProps<\"p\"> {}\n\nexport const StepsDescription = withContext<\"p\", StepsDescriptionProps>(\n \"p\",\n \"description\",\n)(undefined, (props) => {\n const { getDescriptionProps } = useStepsItemContext()\n\n return getDescriptionProps(props)\n})\n\nexport interface StepsSeparatorProps extends HTMLStyledProps {}\n\nexport const StepsSeparator = withContext<\"div\", StepsSeparatorProps>(\n \"div\",\n \"separator\",\n)(undefined, (props) => {\n const { getSeparatorProps } = useStepsItemContext()\n\n return getSeparatorProps(props)\n})\n\nexport interface StepsContentsProps extends PropsWithChildren {}\n\nexport const StepsContents: FC<StepsContentsProps> = ({ children }) => {\n const { items } = useComponentContext()\n\n return useMemo(() => {\n if (children) {\n return children\n } else {\n return items?.map(({ content, contentProps }, index) =>\n isUndefined(content) || isNull(content) ? null : (\n <StepsContent key={index} index={index} {...contentProps}>\n {content}\n </StepsContent>\n ),\n )\n }\n }, [children, items])\n}\n\nexport interface StepsContentProps extends HTMLStyledProps {\n /**\n * The index of the step content.\n */\n index: number\n}\n\nexport const StepsContent = withContext<\"div\", StepsContentProps>(\n \"div\",\n \"content\",\n)(undefined, ({ index, ...rest }) => {\n const { lazy, lazyBehavior } = useComponentContext()\n const { index: selectedIndex, getContentProps } = useStepsContext()\n const mounted = index === selectedIndex\n const children = useLazyMount({\n lazy,\n lazyBehavior,\n mounted,\n ...rest,\n })\n\n return { ...getContentProps({ index, ...rest }), children }\n})\n\nexport interface StepsCompletedContentProps extends HTMLStyledProps {}\n\nexport const StepsCompletedContent = withContext<\n \"div\",\n StepsCompletedContentProps\n>(\"div\", { name: \"CompletedContent\", slot: [\"content\", \"completed\"] })(\n undefined,\n (props) => {\n const { lazy, lazyBehavior } = useComponentContext()\n const { count, index: selectedIndex, getContentProps } = useStepsContext()\n const mounted = count !== 0 && count === selectedIndex\n const children = useLazyMount({\n lazy,\n lazyBehavior,\n mounted,\n ...props,\n })\n\n return { ...getContentProps(props), children }\n },\n)\n\nexport interface StepsPrevTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const StepsPrevTrigger = withContext<\"button\", StepsPrevTriggerProps>(\n \"button\",\n { name: \"PrevTrigger\", slot: [\"trigger\", \"prev\"] },\n)((props) => {\n const { getPrevTriggerProps } = useStepsContext()\n\n return { asChild: true, ...getPrevTriggerProps(props) }\n})\n\nexport interface StepsNextTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const StepsNextTrigger = withContext<\"button\", StepsNextTriggerProps>(\n \"button\",\n { name: \"NextTrigger\", slot: [\"trigger\", \"next\"] },\n)((props) => {\n const { getNextTriggerProps } = useStepsContext()\n\n return { asChild: true, ...getNextTriggerProps(props) }\n})\n"],"mappings":";;;;;;;;;;;;;AA0FA,MAAM,EACJ,kBACA,cAAc,mBACd,qBACA,iBAAiB,sBACjB,aACA,iBACE,oBACF,SACA,UACF;;;;;;AASA,MAAa,YAAY,cACtB,EACC,UACA,QAAQ,CAAC,GACT,MACA,cACA,aAAa,iBACb,GAAG,WACC;CACJ,MAAM,sBAAsB,SAAS,eAAe;CAEpD,MAAM,YAAY,aADI,iBAAiB,QACoB,GAAG,SAAS;CACvE,MAAM,EACJ,IACA,OACA,aACA,WACA,OACA,aACA,UACA,iBACA,cACA,qBACA,qBACA,cACA,QACA,WACE,SAAS;EACX,OAAO,MAAM,UAAU,SAAS,MAAM,WAAW,MAAM,QAAQ;EAC/D,aAAa;EACb,GAAG;CACL,CAAC;CACD,MAAM,mBAAmB,eAChB;EAAE;EAAO;EAAM;CAAa,IACnC;EAAC;EAAO;EAAM;CAAY,CAC5B;CAgCA,OACE,oBAAC,yBAAD;EAAyB,OAAO;YAC9B,oBAAC,cAAD;GAAc,OAjCG,eACZ;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF,IACA;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF,CAKkC;aAC9B,oBAAC,kBAAD;IAAkB,OAAO;cACvB,oBAAC,OAAO,KAAR;KAAY,GAAI,aAAa;KAAI;IAAqB,CAAA;GACtC,CAAA;EACN,CAAA;CACS,CAAA;AAE7B,GACA,QACA,EAAE,eAA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],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { UseLazyMountProps } from \"../../hooks/use-lazy-mount\"\nimport type { StepsStyle } from \"./steps.style\"\nimport type { UseStepsItemProps, UseStepsProps } from \"./use-steps\"\nimport { Children, useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useLazyMount } from \"../../hooks/use-lazy-mount\"\nimport { useValue } from \"../../hooks/use-value\"\nimport {\n isNull,\n isUndefined,\n useFindChild,\n useValidChildren,\n} from \"../../utils\"\nimport { CheckIcon } from \"../icon\"\nimport { stepsStyle } from \"./steps.style\"\nimport {\n StepsContext,\n StepsDescendantsContext,\n StepsItemContext,\n useSteps,\n useStepsContext,\n useStepsItem,\n useStepsItemContext,\n} from \"./use-steps\"\n\ninterface ComponentContext extends Pick<\n StepsRootProps,\n \"items\" | \"lazy\" | \"lazyBehavior\"\n> {}\n\nexport interface StepsItem\n extends\n Omit<StepsItemProps, \"content\" | \"index\" | \"title\">,\n Pick<StepsIndicatorProps, \"complete\" | \"current\" | \"incomplete\"> {\n /**\n * The content for step element.\n */\n content?: ReactNode\n /**\n * The description for step element.\n */\n description?: ReactNode\n /**\n * If true, display the step separator.\n *\n * @default true\n */\n hasSeparator?: boolean\n /**\n * The title for step element.\n */\n title?: string\n /**\n * Props for step content element.\n */\n contentProps?: StepsContentProps\n /**\n * Props for step description element.\n */\n descriptionProps?: StepsDescriptionProps\n /**\n * Props for step indicator element.\n */\n indicatorProps?: StepsIndicatorProps\n /**\n * Props for step separator element.\n */\n separatorProps?: StepsSeparatorProps\n /**\n * Props for step title element.\n */\n titleProps?: StepsTitleProps\n}\n\nexport interface StepsRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n Omit<UseStepsProps, \"count\" | \"orientation\">,\n Pick<UseLazyMountProps, \"lazy\" | \"lazyBehavior\">,\n ThemeProps<StepsStyle> {\n /**\n * If provided, generate step components based on steps.\n */\n items?: StepsItem[]\n}\n\nconst {\n ComponentContext,\n PropsContext: StepsPropsContext,\n useComponentContext,\n usePropsContext: useStepsPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<StepsRootProps, StepsStyle, ComponentContext>(\n \"steps\",\n stepsStyle,\n)\n\nexport { StepsPropsContext, useStepsPropsContext }\n\n/**\n * `Steps` is a component that displays the progress of a multi-step process.\n *\n * @see https://yamada-ui.com/docs/components/steps\n */\nexport const StepsRoot = withProvider<\"div\", StepsRootProps, \"orientation\">(\n ({\n children,\n items = [],\n lazy,\n lazyBehavior,\n orientation: orientationProp,\n ...rest\n }) => {\n const computedOrientation = useValue(orientationProp)\n const validChildren = useValidChildren(children)\n const stepsList = useFindChild<StepsListProps>(validChildren, StepsList)\n const {\n id,\n count,\n descendants,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n onNext,\n onPrev,\n } = useSteps({\n count: items.length || Children.count(stepsList?.props.children),\n orientation: computedOrientation,\n ...rest,\n })\n const componentContext = useMemo(\n () => ({ items, lazy, lazyBehavior }),\n [items, lazy, lazyBehavior],\n )\n const stepsContext = useMemo(\n () => ({\n id,\n count,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n onNext,\n onPrev,\n }),\n [\n id,\n count,\n index,\n orientation,\n setIndex,\n getStatus,\n onNext,\n onPrev,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getContentProps,\n ],\n )\n\n return (\n <StepsDescendantsContext value={descendants}>\n <StepsContext value={stepsContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{children}</styled.div>\n </ComponentContext>\n </StepsContext>\n </StepsDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"orientation\"] },\n)()\n\nexport interface StepsListProps extends HTMLStyledProps<\"ol\"> {}\n\nexport const StepsList = withContext<\"ol\", StepsListProps>(\n ({ children, ...rest }) => {\n const { items } = useComponentContext()\n const { getListProps } = useStepsContext()\n const computedChildren = useMemo(() => {\n if (children) return children\n else\n return items?.map(\n (\n {\n complete,\n content: _content,\n current,\n description,\n hasSeparator = true,\n incomplete,\n title,\n contentProps: _contentProps,\n descriptionProps,\n indicatorProps,\n separatorProps,\n titleProps,\n ...rest\n },\n index,\n ) => (\n <StepsItem key={index} index={index} title={title} {...rest}>\n <StepsIndicator\n complete={complete}\n current={current}\n incomplete={incomplete}\n {...indicatorProps}\n />\n\n <styled.div>\n {title ? (\n <StepsTitle {...titleProps}>{title}</StepsTitle>\n ) : null}\n {description ? (\n <StepsDescription {...descriptionProps}>\n {description}\n </StepsDescription>\n ) : null}\n </styled.div>\n\n {hasSeparator ? <StepsSeparator {...separatorProps} /> : null}\n </StepsItem>\n ),\n )\n }, [children, items])\n\n return <styled.ol {...getListProps(rest)}>{computedChildren}</styled.ol>\n },\n \"list\",\n)()\n\nexport interface StepsItemProps\n extends HTMLStyledProps<\"li\">, UseStepsItemProps {}\n\nexport const StepsItem = withContext<\"li\", StepsItemProps>((props) => {\n const {\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getRootProps,\n getSeparatorProps,\n getTitleProps,\n } = useStepsItem(props)\n const context = useMemo(\n () => ({\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getSeparatorProps,\n getTitleProps,\n }),\n [\n first,\n index,\n last,\n status,\n getTitleProps,\n getDescriptionProps,\n getSeparatorProps,\n getIndicatorProps,\n ],\n )\n\n return (\n <StepsItemContext value={context}>\n <styled.li {...getRootProps()} />\n </StepsItemContext>\n )\n}, \"item\")()\n\nexport interface StepsIndicatorProps extends HTMLStyledProps {\n /**\n * The element for the complete indicator.\n *\n * @default <CheckIcon />\n */\n complete?: ReactNode\n /**\n * The element for the current indicator.\n *\n * @default <StepsNumber />\n */\n current?: ReactNode\n /**\n * The element for the incomplete indicator.\n *\n * @default <StepsNumber />\n */\n incomplete?: ReactNode\n}\n\nexport const StepsIndicator = withContext<\"div\", StepsIndicatorProps>(\n ({\n complete = <CheckIcon />,\n current = <StepsNumber />,\n incomplete = <StepsNumber />,\n ...rest\n }) => {\n const { status, getIndicatorProps } = useStepsItemContext()\n const components = useMemo(\n () => ({ complete, current, incomplete }),\n [complete, current, incomplete],\n )\n\n return (\n <styled.div {...getIndicatorProps(rest)}>{components[status]}</styled.div>\n )\n },\n \"indicator\",\n)()\n\nexport interface StepsNumberProps extends HTMLStyledProps<\"span\"> {}\n\nexport const StepsNumber = withContext<\"span\", StepsNumberProps>(\n \"span\",\n \"number\",\n)(undefined, ({ children, ...rest }) => {\n const { index } = useStepsItemContext()\n\n return { ...rest, children: children ?? index + 1 }\n})\n\nexport interface StepsTitleProps extends HTMLStyledProps {}\n\nexport const StepsTitle = withContext<\"h3\", StepsTitleProps>(\"h3\", \"title\")(\n undefined,\n (props) => {\n const { getTitleProps } = useStepsItemContext()\n\n return getTitleProps(props)\n },\n)\n\nexport interface StepsDescriptionProps extends HTMLStyledProps<\"p\"> {}\n\nexport const StepsDescription = withContext<\"p\", StepsDescriptionProps>(\n \"p\",\n \"description\",\n)(undefined, (props) => {\n const { getDescriptionProps } = useStepsItemContext()\n\n return getDescriptionProps(props)\n})\n\nexport interface StepsSeparatorProps extends HTMLStyledProps {}\n\nexport const StepsSeparator = withContext<\"div\", StepsSeparatorProps>(\n \"div\",\n \"separator\",\n)(undefined, (props) => {\n const { getSeparatorProps } = useStepsItemContext()\n\n return getSeparatorProps(props)\n})\n\nexport interface StepsContentsProps extends PropsWithChildren {}\n\nexport const StepsContents: FC<StepsContentsProps> = ({ children }) => {\n const { items } = useComponentContext()\n\n return useMemo(() => {\n if (children) return children\n else\n return items?.map(({ content, contentProps }, index) =>\n isUndefined(content) || isNull(content) ? null : (\n <StepsContent key={index} index={index} {...contentProps}>\n {content}\n </StepsContent>\n ),\n )\n }, [children, items])\n}\n\nexport interface StepsContentProps extends HTMLStyledProps {\n /**\n * The index of the step content.\n */\n index: number\n}\n\nexport const StepsContent = withContext<\"div\", StepsContentProps>(\n \"div\",\n \"content\",\n)(undefined, ({ index, ...rest }) => {\n const { lazy, lazyBehavior } = useComponentContext()\n const { index: selectedIndex, getContentProps } = useStepsContext()\n const mounted = index === selectedIndex\n const children = useLazyMount({\n lazy,\n lazyBehavior,\n mounted,\n ...rest,\n })\n\n return { ...getContentProps({ index, ...rest }), children }\n})\n\nexport interface StepsCompletedContentProps extends HTMLStyledProps {}\n\nexport const StepsCompletedContent = withContext<\n \"div\",\n StepsCompletedContentProps\n>(\"div\", { name: \"CompletedContent\", slot: [\"content\", \"completed\"] })(\n undefined,\n (props) => {\n const { lazy, lazyBehavior } = useComponentContext()\n const { count, index: selectedIndex, getContentProps } = useStepsContext()\n const mounted = count !== 0 && count === selectedIndex\n const children = useLazyMount({\n lazy,\n lazyBehavior,\n mounted,\n ...props,\n })\n\n return { ...getContentProps(props), children }\n },\n)\n\nexport interface StepsPrevTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const StepsPrevTrigger = withContext<\"button\", StepsPrevTriggerProps>(\n \"button\",\n { name: \"PrevTrigger\", slot: [\"trigger\", \"prev\"] },\n)((props) => {\n const { getPrevTriggerProps } = useStepsContext()\n\n return { asChild: true, ...getPrevTriggerProps(props) }\n})\n\nexport interface StepsNextTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const StepsNextTrigger = withContext<\"button\", StepsNextTriggerProps>(\n \"button\",\n { name: \"NextTrigger\", slot: [\"trigger\", \"next\"] },\n)((props) => {\n const { getNextTriggerProps } = useStepsContext()\n\n return { asChild: true, ...getNextTriggerProps(props) }\n})\n"],"mappings":";;;;;;;;;;;;;AA0FA,MAAM,EACJ,kBACA,cAAc,mBACd,qBACA,iBAAiB,sBACjB,aACA,iBACE,oBACF,SACA,UACF;;;;;;AASA,MAAa,YAAY,cACtB,EACC,UACA,QAAQ,CAAC,GACT,MACA,cACA,aAAa,i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ACpE,KAAA,IACC,UAAU;CACT,MAAM,EAAE,MAAM,iBAAiB,oBAAoB;CACnD,MAAM,EAAE,OAAO,OAAO,eAAe,oBAAoB,gBAAgB;CAEzE,MAAM,WAAW,aAAa;EAC5B;EACA;EACA,SAJc,UAAU,KAAK,UAAU;EAKvC,GAAG;CACL,CAAC;CAED,OAAO;EAAE,GAAG,gBAAgB,KAAK;EAAG;CAAS;AAC/C,CACF;AAIA,MAAa,mBAAmB,YAC9B,UACA;CAAE,MAAM;CAAe,MAAM,CAAC,WAAW,MAAM;AAAE,CACnD,CAAC,EAAE,UAAU;CACX,MAAM,EAAE,wBAAwB,gBAAgB;CAEhD,OAAO;EAAE,SAAS;EAAM,GAAG,oBAAoB,KAAK;CAAE;AACxD,CAAC;AAID,MAAa,mBAAmB,YAC9B,UACA;CAAE,MAAM;CAAe,MAAM,CAAC,WAAW,MAAM;AAAE,CACnD,CAAC,EAAE,UAAU;CACX,MAAM,EAAE,wBAAwB,gBAAgB;CAEhD,OAAO;EAAE,SAAS;EAAM,GAAG,oBAAoB,KAAK;CAAE;AACxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-steps.js","names":["createContext"],"sources":["../../../../src/components/steps/use-steps.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps, useEnvironment } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n cx,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport type StepStatusScheme = \"complete\" | \"current\" | \"incomplete\"\n\nconst {\n DescendantsContext: StepsDescendantsContext,\n useDescendant: useStepsDescendant,\n useDescendants: useStepsDescendants,\n} = createDescendants<HTMLLIElement>()\n\nexport { StepsDescendantsContext, useStepsDescendant, useStepsDescendants }\n\ninterface StepsContext extends Omit<\n UseStepsReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [StepsContext, useStepsContext] = createContext<StepsContext>({\n name: \"StepsContext\",\n})\n\nexport { StepsContext, useStepsContext }\n\ninterface StepsItemContext extends Omit<UseStepsItemReturn, \"getRootProps\"> {}\n\nconst [StepsItemContext, useStepsItemContext] = createContext<StepsItemContext>(\n {\n name: \"StepsItemContext\",\n },\n)\n\nexport { StepsItemContext, useStepsItemContext }\n\nexport interface UseStepsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The total number of steps.\n */\n count?: number\n /**\n * The initial index of the active step.\n *\n * @default 0\n */\n defaultIndex?: number\n /**\n * The index of the active step.\n */\n index?: number\n /**\n * The orientation of the steps.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback function that is called when the active step index is changed.\n */\n onChange?: (index: number) => void\n}\n\nexport const useSteps = ({\n count = 0,\n defaultIndex = 0,\n index: indexProp,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseStepsProps = {}) => {\n const descendants = useStepsDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const id = useId()\n\n const getStatus = useCallback(\n (indexProp: number): StepStatusScheme => {\n if (indexProp < index)
|
|
1
|
+
{"version":3,"file":"use-steps.js","names":["createContext"],"sources":["../../../../src/components/steps/use-steps.ts"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, Orientation, PropGetter } from \"../../core\"\nimport { useCallback, useId } from \"react\"\nimport { mergeProps, useEnvironment } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { createDescendants } from \"../../hooks/use-descendants\"\nimport {\n createContext,\n cx,\n dataAttr,\n handlerAll,\n mergeRefs,\n setAttribute,\n useSafeLayoutEffect,\n} from \"../../utils\"\n\nexport type StepStatusScheme = \"complete\" | \"current\" | \"incomplete\"\n\nconst {\n DescendantsContext: StepsDescendantsContext,\n useDescendant: useStepsDescendant,\n useDescendants: useStepsDescendants,\n} = createDescendants<HTMLLIElement>()\n\nexport { StepsDescendantsContext, useStepsDescendant, useStepsDescendants }\n\ninterface StepsContext extends Omit<\n UseStepsReturn,\n \"descendants\" | \"getRootProps\"\n> {}\n\nconst [StepsContext, useStepsContext] = createContext<StepsContext>({\n name: \"StepsContext\",\n})\n\nexport { StepsContext, useStepsContext }\n\ninterface StepsItemContext extends Omit<UseStepsItemReturn, \"getRootProps\"> {}\n\nconst [StepsItemContext, useStepsItemContext] = createContext<StepsItemContext>(\n {\n name: \"StepsItemContext\",\n },\n)\n\nexport { StepsItemContext, useStepsItemContext }\n\nexport interface UseStepsProps extends Omit<HTMLProps, \"onChange\"> {\n /**\n * The total number of steps.\n */\n count?: number\n /**\n * The initial index of the active step.\n *\n * @default 0\n */\n defaultIndex?: number\n /**\n * The index of the active step.\n */\n index?: number\n /**\n * The orientation of the steps.\n *\n * @default 'horizontal'\n */\n orientation?: Orientation\n /**\n * The callback function that is called when the active step index is changed.\n */\n onChange?: (index: number) => void\n}\n\nexport const useSteps = ({\n count = 0,\n defaultIndex = 0,\n index: indexProp,\n orientation = \"horizontal\",\n onChange,\n ...rest\n}: UseStepsProps = {}) => {\n const descendants = useStepsDescendants()\n const [index, setIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: indexProp,\n onChange,\n })\n const id = useId()\n\n const getStatus = useCallback(\n (indexProp: number): StepStatusScheme => {\n if (indexProp < index) return \"complete\"\n else if (indexProp > index) return \"incomplete\"\n else return \"current\"\n },\n [index],\n )\n\n const onPrev = useCallback(\n () => setIndex((index) => Math.max(0, index - 1)),\n [setIndex],\n )\n\n const onNext = useCallback(() => {\n setIndex((index) => Math.min(count, index + 1))\n }, [count, setIndex])\n\n const getRootProps: PropGetter = useCallback(\n (props = {}) => mergeProps(rest, props)(),\n [rest],\n )\n\n const getListProps: PropGetter<\"ol\"> = useCallback(\n (props) => {\n return {\n \"data-orientation\": orientation,\n ...props,\n }\n },\n [orientation],\n )\n\n const getContentProps: PropGetter<\"div\", { index?: number }> = useCallback(\n ({ index: indexProp = count, ...props } = {}) => ({\n id: `${id}-${indexProp}`,\n hidden: indexProp !== index,\n tabIndex: 0,\n ...props,\n }),\n [count, id, index],\n )\n\n const getPrevTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n disabled: index === 0,\n ...props,\n onClick: handlerAll(props.onClick, onPrev),\n }),\n [onPrev, index],\n )\n\n const getNextTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => {\n return {\n disabled: count <= index,\n ...props,\n onClick: handlerAll(props.onClick, onNext),\n }\n },\n [count, index, onNext],\n )\n\n return {\n id,\n count,\n descendants,\n getStatus,\n index,\n orientation,\n setIndex,\n getContentProps,\n getListProps,\n getNextTriggerProps,\n getPrevTriggerProps,\n getRootProps,\n onNext,\n onPrev,\n }\n}\n\nexport type UseStepsReturn = ReturnType<typeof useSteps>\n\nexport interface UseStepsItemProps extends HTMLProps<\"li\"> {\n /**\n * The index of the step.\n */\n index: number\n}\n\nexport const useStepsItem = ({\n \"aria-labelledby\": ariaLabelledbyProp,\n index,\n ...rest\n}: UseStepsItemProps) => {\n const { descendants, register } = useStepsDescendant()\n const { id, getStatus, orientation } = useStepsContext()\n const status = getStatus(index)\n const current = status === \"current\"\n const first = index === 0\n const last = index === descendants.lastValue()?.index\n const statusDataAttr = `data-${status}`\n const { getDocument } = useEnvironment()\n\n useSafeLayoutEffect(() => {\n const el = descendants.value(index)?.node\n const hasContent = !!getDocument()?.getElementById(`${id}-${index}`)\n\n if (el && hasContent) setAttribute(el, \"aria-labelledby\", `${id}-${index}`)\n }, [descendants, getDocument, id, index])\n\n const getRootProps: PropGetter<\"li\"> = useCallback(\n ({ ref, \"aria-labelledby\": ariaLabelledby, ...props } = {}) =>\n mergeProps(\n {\n \"aria-current\": current ? \"step\" : undefined,\n \"aria-labelledby\": cx(ariaLabelledbyProp, ariaLabelledby),\n \"data-orientation\": orientation,\n [statusDataAttr]: dataAttr(true),\n },\n rest,\n props,\n { ref: mergeRefs(ref, register) },\n )(),\n [ariaLabelledbyProp, current, orientation, statusDataAttr, rest, register],\n )\n\n const getTitleProps: PropGetter<\"h3\"> = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getDescriptionProps: PropGetter<\"p\"> = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getIndicatorProps: PropGetter = useCallback(\n (props) => ({\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [statusDataAttr],\n )\n\n const getSeparatorProps: PropGetter = useCallback(\n (props) => ({\n \"data-orientation\": orientation,\n role: \"separator\",\n [statusDataAttr]: dataAttr(true),\n ...props,\n }),\n [orientation, statusDataAttr],\n )\n\n return {\n first,\n index,\n last,\n status,\n getDescriptionProps,\n getIndicatorProps,\n getRootProps,\n getSeparatorProps,\n getTitleProps,\n }\n}\n\nexport type UseStepsItemReturn = ReturnType<typeof useStepsItem>\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,EACJ,oBAAoB,yBACpB,eAAe,oBACf,gBAAgB,wBACd,kBAAiC;AASrC,MAAM,CAAC,cAAc,mBAAmBA,gBAA4B,EAClE,MAAM,eACR,CAAC;AAMD,MAAM,CAAC,kBAAkB,uBAAuBA,gBAC9C,EACE,MAAM,mBACR,CACF;AA+BA,MAAa,YAAY,EACvB,QAAQ,GACR,eAAe,GACf,OAAO,WACP,cAAc,cACd,UACA,GAAG,SACc,CAAC,MAAM;CACxB,MAAM,cAAc,oBAAoB;CACxC,MAAM,CAAC,OAAO,YAAY,qBAAqB;EAC7C,cAAc;EACd,OAAO;EACP;CACF,CAAC;CACD,MAAM,KAAK,MAAM;CAEjB,MAAM,YAAY,aACf,cAAwC;EACvC,IAAI,YAAY,OAAO,OAAO;OACzB,IAAI,YAAY,OAAO,OAAO;OAC9B,OAAO;CACd,GACA,CAAC,KAA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kBAAA,GAAA,cAAA,SAAA,CAA0B,IAAI;GAC/B,GAAG;EACL,IACA,CAAC,aAAa,cAAc,CAWZ;EAChB;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","names":["NativeTable.Root","NativeTable.Thead","NativeTable.Tr","NativeTable.Th","NativeTable.Tbody","NativeTable.Td","NativeTable.Tfoot"],"sources":["../../../../src/components/table/table.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n AccessorFn,\n Cell,\n CellContext,\n ColumnDef,\n ColumnDefTemplate,\n ColumnFiltersColumnDef,\n ColumnFiltersState,\n ColumnMeta,\n ColumnPinningColumnDef,\n ColumnSizingColumnDef,\n GlobalFilterColumnDef,\n GroupingColumnDef,\n Header,\n HeaderContext,\n HeaderGroup,\n OnChangeFn,\n SortingState as OriginalSortingState,\n PaginationState,\n Table as ReactTable,\n Row,\n RowData,\n RowSelectionState,\n SortDirection,\n SortingColumnDef,\n TableOptions,\n VisibilityColumnDef,\n} from \"@tanstack/react-table\"\nimport type { FC, FocusEvent, KeyboardEvent, ReactElement } from \"react\"\nimport type { CSSProps, GenericsComponent, HTMLStyledProps } from \"../../core\"\nimport type { ReactNodeOrFunction, TransformProps } from \"../../utils\"\nimport type { CheckboxProps } from \"../checkbox\"\nimport {\n createColumnHelper,\n flexRender,\n getCoreRowModel,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n useReactTable,\n} from \"@tanstack/react-table\"\nimport { useMemo, useRef } from \"react\"\nimport { createComponent, focusRingStyle, mergeProps, styled } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n dataAttr,\n isFunction,\n runIfFn,\n runKeyAction,\n useUpdateEffect,\n} from \"../../utils\"\nimport { Checkbox } from \"../checkbox\"\nimport { ChevronsUpDownIcon, ChevronUpIcon } from \"../icon\"\nimport { NativeTable } from \"../native-table\"\n\ndeclare module \"@tanstack/react-table\" {\n interface ColumnDefExtensions<TData extends RowData, TValue = unknown>\n extends\n VisibilityColumnDef,\n ColumnPinningColumnDef,\n ColumnFiltersColumnDef<TData>,\n GlobalFilterColumnDef,\n SortingColumnDef<TData>,\n GroupingColumnDef<TData, TValue>,\n ColumnSizingColumnDef {}\n\n interface ColumnDefBase<TData extends RowData, TValue = unknown>\n extends\n ColumnDefExtensions<TData, TValue>,\n Pick<CSSProps, \"lineClamp\" | \"truncated\">,\n Pick<NativeTable.TdProps, \"numeric\"> {\n cell?: ColumnDefTemplate<CellContext<TData, TValue>>\n footer?: ColumnDefTemplate<HeaderContext<TData, TValue>>\n getUniqueValues?: AccessorFn<TData, unknown[]>\n meta?: ColumnMeta<TData, TValue>\n cellProps?: NativeTable.TdProps\n footerProps?: NativeTable.ThProps\n headerProps?: NativeTable.ThProps\n }\n}\n\nexport { createColumnHelper }\nexport type {\n ColumnDef,\n ColumnFiltersState,\n PaginationState,\n RowSelectionState,\n SortDirection,\n}\n\nfunction getMergeHeaderGroups(\n headerGroups: HeaderGroup<any>[],\n): HeaderGroup<any>[] {\n if (headerGroups.length <= 1) return headerGroups\n\n const columnsIds = new Set()\n\n return headerGroups.map((headerGroup, depth, { length: fullDepth }) => {\n return {\n ...headerGroup,\n headers: headerGroup.headers\n .filter((header) => !columnsIds.has(header.column.id))\n .map((header) => {\n columnsIds.add(header.column.id)\n\n return header.isPlaceholder\n ? { ...header, isPlaceholder: false, rowSpan: fullDepth - depth }\n : { ...header, rowSpan: 1 }\n }),\n }\n })\n}\n\nfunction getMergeFooterGroups(\n headerGroups: HeaderGroup<any>[],\n): HeaderGroup<any>[] {\n if (headerGroups.length <= 1) return headerGroups\n\n return headerGroups.map((headerGroup, depth) => {\n const nextHeaderGroups = headerGroups.slice(depth + 1)\n\n return {\n ...headerGroup,\n headers: headerGroup.headers\n .filter((header) => !header.isPlaceholder)\n .map((header) => {\n if (nextHeaderGroups.length === 0) return header\n\n const rowSpan = nextHeaderGroups.reduce((acc, nextHeaderGroup) => {\n const hasNextHeader = nextHeaderGroup.headers.some(\n (nextHeader) => nextHeader.column.id === header.column.id,\n )\n\n return acc + (hasNextHeader ? 1 : 0)\n }, 1)\n\n return { ...header, rowSpan }\n }),\n }\n })\n}\n\nexport interface ColumnSort<Y extends RowData> {\n desc: boolean\n id: keyof Y\n}\nexport type SortingState<Y extends RowData> = ColumnSort<Y>[]\n\ninterface ComponentContext extends Pick<\n TableProps<any>,\n | \"columnResizeMode\"\n | \"resizableTriggerProps\"\n | \"sortingIcon\"\n | \"sortingIconProps\"\n> {\n table: ReactTable<any>\n}\n\ninterface OmittedTableOptions<Y extends RowData> extends Omit<\n TableOptions<Y>,\n | \"getCoreRowModel\"\n | \"onColumnFiltersChange\"\n | \"onPaginationChange\"\n | \"onSortingChange\"\n> {}\n\ninterface PickedNativeTableProps extends Pick<\n NativeTable.RootProps,\n | \"className\"\n | \"highlightOnHover\"\n | \"highlightOnSelected\"\n | \"layout\"\n | \"scrollAreaProps\"\n | \"size\"\n | \"stickyFooter\"\n | \"stickyHeader\"\n | \"striped\"\n | \"variant\"\n | \"withBorder\"\n | \"withColumnBorders\"\n | \"withScrollArea\"\n> {}\n\nexport interface TableProps<Y extends RowData>\n extends\n OmittedTableOptions<Y>,\n PickedNativeTableProps,\n Pick<CSSProps, \"colorScheme\" | \"lineClamp\" | \"truncated\"> {\n /**\n * The column filters state of the table.\n */\n columnFilters?: ColumnFiltersState\n /**\n * The default column filters state of the table.\n */\n defaultColumnFilters?: ColumnFiltersState\n /**\n * The default pagination state of the table.\n */\n defaultPagination?: PaginationState\n /**\n * The default row selection state of the table.\n */\n defaultRowSelection?: RowSelectionState\n /**\n * The default sorting state of the table.\n */\n defaultSorting?: SortingState<Y>\n /**\n * If `true`, the table width will be automatically resized to the content.\n *\n * @default false\n */\n enableAutoResizeTableWidth?: boolean\n /**\n * If `true`, the keyboard navigation will be enabled.\n *\n * @default true\n */\n enableKeyboardNavigation?: boolean\n /**\n * If `true`, the pagination will be enabled.\n *\n * @default false\n */\n enablePagination?: boolean\n /**\n * The footer of the table.\n */\n footer?: ReactNodeOrFunction<ReactTable<Y>>\n /**\n * The header of the table.\n */\n header?: ReactNodeOrFunction<ReactTable<Y>>\n /**\n * The initial focusable cell of the table.\n *\n * @default {rowIndex: 0, colIndex: 0}\n */\n initialFocusableCell?: { colIndex: number; rowIndex: number }\n /**\n * The pagination state of the table.\n */\n pagination?: PaginationState\n /**\n * The row selection state of the table.\n */\n rowSelection?: RowSelectionState\n /**\n * If `true`, the row will be selected when the row is clicked.\n *\n * @default false\n */\n selectOnClickRow?: boolean\n /**\n * The sorting state of the table.\n */\n sorting?: SortingState<Y>\n /**\n * The sorting icon of the table.\n */\n sortingIcon?: ReactNodeOrFunction<false | SortDirection>\n /**\n * If `true`, the table will have a checkbox column.\n *\n * @default true\n */\n withCheckbox?: boolean\n /**\n * If `true`, the table will have a checkbox in the footer.\n *\n * @default false\n */\n withFooterCheckbox?: boolean\n /**\n * If `true`, the table will have footer groups.\n *\n * @default false\n */\n withFooterGroups?: boolean\n /**\n * The props for the table cell.\n */\n cellProps?: TransformProps<NativeTable.TdProps, Cell<Y, unknown>>\n /**\n * The props for the checkbox.\n */\n checkboxProps?: CheckboxProps\n /**\n * The props for the table footer group.\n */\n footerGroupProps?: TransformProps<NativeTable.TrProps, HeaderGroup<Y>>\n /**\n * The props for the table footer.\n */\n footerProps?: TransformProps<NativeTable.ThProps, Header<Y, unknown>>\n /**\n * The props for the table header checkbox.\n */\n headerCheckboxProps?: TransformProps<CheckboxProps, Header<Y, unknown>>\n /**\n * The props for the table header group.\n */\n headerGroupProps?: TransformProps<NativeTable.TrProps, HeaderGroup<Y>>\n /**\n * The props for the table header.\n */\n headerProps?: TransformProps<NativeTable.ThProps, Header<Y, unknown>>\n /**\n * The props for the resizable trigger.\n */\n resizableTriggerProps?: TransformProps<\n Omit<ResizableTriggerProps, \"resizing\">,\n Header<Y, unknown>\n >\n /**\n * The props for the table row checkbox.\n */\n rowCheckboxProps?: TransformProps<CheckboxProps, Row<Y>>\n /**\n * The props for the table row.\n */\n rowProps?: TransformProps<NativeTable.TrProps, Row<Y>>\n /**\n * The props for the sorting icon.\n */\n sortingIconProps?: TransformProps<\n Omit<SortingIconProps, \"sorted\">,\n Header<Y, unknown>\n >\n /**\n * The props for the table.\n */\n tableProps?: NativeTable.RootProps\n /**\n * The props for the table tbody.\n */\n tbodyProps?: NativeTable.TbodyProps\n /**\n * The props for the table tfoot.\n */\n tfootProps?: NativeTable.TfootProps\n /**\n * The props for the table thead.\n */\n theadProps?: NativeTable.TheadProps\n /**\n * The callback invoked when the column filters state changes.\n */\n onColumnFiltersChange?: (columnFilters: ColumnFiltersState) => void\n /**\n * The callback invoked when the pagination state changes.\n */\n onPaginationChange?: (pagination: PaginationState) => void\n /**\n * The callback invoked when the row is clicked.\n */\n onRowClick?: (row: Row<Y>) => void\n /**\n * The callback invoked when the row is double clicked.\n */\n onRowDoubleClick?: (row: Row<Y>) => void\n /**\n * The callback invoked when the sorting state changes.\n */\n onSortingChange?: (sorting: SortingState<Y>) => void\n}\n\nconst {\n ComponentContext,\n PropsContext: TablePropsContext,\n useComponentContext,\n usePropsContext: useTablePropsContext,\n withContext,\n} = createComponent<TableProps<any>, any, ComponentContext>(\"table\")\n\nexport { TablePropsContext, useTablePropsContext }\n\n/**\n * `Table` is a table component equipped with column sorting, row selection, and click event features.\n *\n * @see https://yamada-ui.com/docs/components/table\n */\nexport const Table = withContext(\n <Y extends RowData>({\n className,\n colorScheme,\n size,\n variant,\n columnFilters: columnFiltersProp,\n columnResizeMode = \"onChange\",\n columns: columnsProp,\n data,\n defaultColumnFilters,\n defaultPagination = { pageIndex: 0, pageSize: 20 },\n defaultRowSelection = {},\n defaultSorting,\n enableAutoResizeTableWidth = false,\n enableColumnResizing = false,\n enableKeyboardNavigation = true,\n enablePagination = false,\n enableRowSelection = false,\n footer,\n header,\n highlightOnHover = !!enableRowSelection,\n highlightOnSelected = !!enableRowSelection,\n initialFocusableCell = { colIndex: 0, rowIndex: 0 },\n layout,\n lineClamp,\n manualPagination,\n pagination: paginationProp,\n rowCount: totalRowCount,\n rowSelection: rowSelectionProp,\n selectOnClickRow = false,\n sortDescFirst = false,\n sorting: sortingProp,\n sortingIcon,\n state,\n stickyFooter,\n stickyHeader,\n striped,\n truncated,\n withBorder,\n withCheckbox = true,\n withColumnBorders,\n withFooterCheckbox = false,\n withFooterGroups = false,\n withScrollArea,\n cellProps,\n checkboxProps,\n footerGroupProps,\n footerProps,\n headerCheckboxProps,\n headerGroupProps,\n headerProps,\n resizableTriggerProps,\n rowCheckboxProps,\n rowProps,\n scrollAreaProps,\n sortingIconProps,\n tableProps,\n tbodyProps,\n tfootProps,\n theadProps,\n onColumnFiltersChange: onColumnFiltersChangeProp,\n onPaginationChange: onPaginationChangeProp,\n onRowClick,\n onRowDoubleClick,\n onRowSelectionChange: onRowSelectionChangeProp,\n onSortingChange: onSortingChangeProp,\n ...rest\n }: TableProps<Y>) => {\n const { t } = useI18n(\"table\")\n const initialFocus = useRef<boolean>(false)\n const ref = useRef<HTMLTableElement>(null)\n const focusedCell = useRef<null | { colIndex: number; rowIndex: number }>(\n null,\n )\n const [rowSelection, onRowSelectionChange] = useControllableState({\n defaultValue: defaultRowSelection,\n value: rowSelectionProp,\n onChange: onRowSelectionChangeProp,\n })\n const [sorting, onSortingChange] = useControllableState({\n defaultValue: defaultSorting,\n value: sortingProp,\n onChange: onSortingChangeProp,\n })\n const [pagination, onPaginationChange] = useControllableState({\n defaultValue: defaultPagination,\n value: paginationProp,\n onChange: onPaginationChangeProp,\n })\n const [columnFilters, onColumnFiltersChange] = useControllableState({\n defaultValue: defaultColumnFilters,\n value: columnFiltersProp,\n onChange: onColumnFiltersChangeProp,\n })\n const columns = useMemo(() => {\n if (!enableRowSelection || !withCheckbox) return columnsProp\n\n const clonedColumns = [...columnsProp]\n\n const header = ({ header, table }: HeaderContext<Y, any>) => {\n return (\n <Checkbox\n {...mergeProps(\n {\n checked: table.getIsAllRowsSelected(),\n indeterminate: table.getIsSomeRowsSelected(),\n indicatorProps: { outline: \"none\" },\n inputProps: {\n \"aria-label\": t(\"Select all rows\"),\n \"data-focusable\": \"\",\n tabIndex: -1,\n },\n onChange: table.getToggleAllRowsSelectedHandler(),\n },\n checkboxProps ?? {},\n runIfFn(headerCheckboxProps, header) ?? {},\n )()}\n />\n )\n }\n\n const cell = ({ row }: CellContext<Y, any>) => {\n return (\n <Checkbox\n {...mergeProps(\n {\n checked: row.getIsSelected(),\n disabled: !row.getCanSelect(),\n indeterminate: row.getIsSomeSelected(),\n indicatorProps: { outline: \"none\" },\n inputProps: {\n \"aria-label\": t(\"Select row\"),\n \"data-focusable\": \"\",\n tabIndex: -1,\n },\n onChange: row.getToggleSelectedHandler(),\n },\n checkboxProps ?? {},\n runIfFn(rowCheckboxProps, row) ?? {},\n )()}\n />\n )\n }\n\n clonedColumns.unshift({\n id: \"select\",\n cell,\n header,\n ...(withFooterCheckbox\n ? { footer: header }\n : { footerProps: { \"aria-hidden\": \"true\" } }),\n cellProps: { verticalAlign: \"middle\" },\n headerProps: { w: \"calc({spaces.4} + {space-x} * 2)\" },\n })\n\n return clonedColumns\n }, [\n checkboxProps,\n columnsProp,\n enableRowSelection,\n headerCheckboxProps,\n rowCheckboxProps,\n t,\n withCheckbox,\n withFooterCheckbox,\n ])\n const table = useReactTable<Y>({\n columnResizeMode,\n columns,\n data,\n enableColumnResizing,\n enableRowSelection,\n getCoreRowModel: getCoreRowModel(),\n getFilteredRowModel: getFilteredRowModel(),\n getSortedRowModel: getSortedRowModel(),\n manualPagination,\n rowCount: totalRowCount,\n sortDescFirst,\n state: {\n columnFilters,\n pagination: enablePagination ? pagination : undefined,\n rowSelection,\n sorting: sorting as OriginalSortingState,\n ...state,\n },\n onColumnFiltersChange,\n onPaginationChange,\n onRowSelectionChange,\n onSortingChange: onSortingChange as OnChangeFn<OriginalSortingState>,\n ...(enablePagination\n ? { getPaginationRowModel: getPaginationRowModel() }\n : {}),\n ...rest,\n })\n const headerGroups = table.getHeaderGroups()\n const mergedHeaderGroups = getMergeHeaderGroups(headerGroups)\n const rows = table.getRowModel().rows\n const footerGroups = table.getFooterGroups()\n const mergedFooterGroups = getMergeFooterGroups(\n withFooterGroups ? footerGroups : [],\n )\n const headerGroupCount = headerGroups.length\n const rowCount = rows.length\n const colCount = table.getAllLeafColumns().length\n const maxColIndex = colCount - 1\n const pageIndex = enablePagination\n ? table.getState().pagination.pageIndex\n : 0\n const cellMap = useMemo(() => {\n const cellMap = new Map<string, string>()\n\n if (!enableKeyboardNavigation) return cellMap\n\n const insertCellMap = (\n id: string,\n colSpan: number,\n rowSpan: number,\n colIndex: number,\n rowIndex: number,\n ) => {\n for (let i = 0; i < colSpan; i++) {\n cellMap.set(`${colIndex + i}-${rowIndex}`, `${colIndex}-${rowIndex}`)\n }\n\n for (let i = 1; i < rowSpan; i++) {\n cellMap.set(`${colIndex}-${rowIndex + i}`, `${colIndex}-${rowIndex}`)\n }\n }\n\n const insertCellMapByHeaderGroup = (\n headerGroup: HeaderGroup<Y>,\n rowIndex: number,\n ) => {\n let placeholderCount = 0\n\n headerGroup.headers.forEach((header) => {\n const colSpan = header.colSpan || 1\n const rowSpan = header.rowSpan || 1\n const colIndex = header.index + placeholderCount\n\n placeholderCount += colSpan - 1\n\n insertCellMap(header.id, colSpan, rowSpan, colIndex, rowIndex)\n })\n }\n\n mergedHeaderGroups.forEach((headerGroup, rowIndex) => {\n insertCellMapByHeaderGroup(headerGroup, rowIndex)\n })\n\n rows.forEach((row, rowIndex) => {\n rowIndex += headerGroupCount\n\n row.getVisibleCells().forEach((cell) => {\n const colIndex = cell.column.getIndex()\n\n insertCellMap(cell.id, 1, 1, colIndex, rowIndex)\n })\n })\n\n mergedFooterGroups.forEach((footerGroup, rowIndex) => {\n rowIndex += headerGroupCount + rowCount\n\n insertCellMapByHeaderGroup(footerGroup, rowIndex)\n })\n\n return cellMap\n }, [\n enableKeyboardNavigation,\n headerGroupCount,\n mergedFooterGroups,\n mergedHeaderGroups,\n rows,\n rowCount,\n ])\n const context = useMemo(\n () => ({\n columnResizeMode,\n sortingIcon,\n table,\n resizableTriggerProps,\n sortingIconProps,\n }),\n [\n columnResizeMode,\n sortingIcon,\n sortingIconProps,\n resizableTriggerProps,\n table,\n ],\n )\n const getCell = (\n evOrEl:\n | Element\n | FocusEvent<HTMLTableElement>\n | KeyboardEvent<HTMLTableElement>\n | null\n | undefined,\n ) => {\n if (!evOrEl) return\n\n const el =\n evOrEl instanceof HTMLElement\n ? evOrEl.closest(\"th, td\")\n : \"target\" in evOrEl && evOrEl.target instanceof HTMLElement\n ? evOrEl.target.closest(\"th, td\")\n : null\n\n if (!(el instanceof HTMLTableCellElement)) return\n\n const { colindex, rowindex } = el.dataset\n const { colSpan, rowSpan } = el\n\n if (!colindex || !rowindex) return\n\n const colIndex = parseInt(colindex)\n const rowIndex = parseInt(rowindex)\n\n return { colIndex, colSpan, el, rowIndex, rowSpan }\n }\n const getShouldFocusCell = (colIndex: number, rowIndex: number) => {\n const [trulyColIndex, trulyRowIndex] =\n cellMap.get(`${colIndex}-${rowIndex}`)?.split(\"-\") ?? []\n\n if (!trulyColIndex || !trulyRowIndex) return\n\n const targetEl = ref.current?.querySelector(\n `[data-colindex=\"${trulyColIndex}\"][data-rowindex=\"${trulyRowIndex}\"]`,\n )\n\n if (!targetEl || !(targetEl instanceof HTMLTableCellElement)) return\n\n return targetEl\n }\n const removeTabIndex = (el: Element | null | undefined) => {\n if (!el || !(el instanceof HTMLElement)) return\n\n el.tabIndex = -1\n el.querySelectorAll(\"[data-focusable]\").forEach((el) => {\n if (el instanceof HTMLElement) el.tabIndex = -1\n })\n }\n const onCellFocus = (\n el: HTMLTableCellElement | null | undefined,\n colIndex: number,\n rowIndex: number,\n ) => {\n const targetEl = getShouldFocusCell(colIndex, rowIndex)\n\n if (!targetEl) return\n\n focusedCell.current = { colIndex, rowIndex }\n\n removeTabIndex(el)\n\n const shouldFocusEl =\n targetEl.querySelector(\"[data-focusable]\") ?? targetEl\n\n if (shouldFocusEl instanceof HTMLElement) {\n shouldFocusEl.tabIndex = 0\n shouldFocusEl.focus()\n }\n }\n const onFocus = (ev: FocusEvent<HTMLTableElement>) => {\n if (initialFocus.current) return\n\n initialFocus.current = true\n\n const cell = getCell(ev)\n\n if (!cell) return\n\n onCellFocus(cell.el, cell.colIndex, cell.rowIndex)\n }\n const onKeyDown = (ev: KeyboardEvent<HTMLTableElement>) => {\n if (!enableKeyboardNavigation) return\n\n const cell = getCell(ev)\n\n if (!cell) return\n\n runKeyAction(ev, {\n ArrowDown: () =>\n onCellFocus(cell.el, cell.colIndex, cell.rowIndex + cell.rowSpan),\n ArrowLeft: () => onCellFocus(cell.el, cell.colIndex - 1, cell.rowIndex),\n ArrowRight: () =>\n onCellFocus(cell.el, cell.colIndex + cell.colSpan, cell.rowIndex),\n ArrowUp: () => onCellFocus(cell.el, cell.colIndex, cell.rowIndex - 1),\n End: () => onCellFocus(cell.el, maxColIndex, cell.rowIndex),\n Home: () => onCellFocus(cell.el, 0, cell.rowIndex),\n ...(enablePagination\n ? {\n PageDown: () => {\n if (!table.getCanNextPage()) return\n\n table.setPageIndex(pageIndex + 1)\n },\n PageUp: () => {\n if (!table.getCanPreviousPage()) return\n\n table.setPageIndex(pageIndex - 1)\n },\n }\n : {}),\n })\n }\n const getTabIndex = (colIndex: number, rowIndex: number) => {\n if (!enableKeyboardNavigation) return undefined\n\n return colIndex === initialFocusableCell.colIndex &&\n rowIndex === initialFocusableCell.rowIndex\n ? 0\n : undefined\n }\n\n useUpdateEffect(() => {\n if (!enableKeyboardNavigation) return\n\n const { colIndex, rowIndex } = focusedCell.current ?? initialFocusableCell\n const targetEl = getShouldFocusCell(colIndex, rowIndex)\n\n if (targetEl) targetEl.tabIndex = 0\n }, [pageIndex, enableKeyboardNavigation])\n\n return (\n <ComponentContext value={context}>\n {header ? runIfFn(header, table) : null}\n\n <NativeTable.Root\n {...mergeProps(\n {\n ref,\n className,\n style:\n enableColumnResizing && enableAutoResizeTableWidth\n ? { width: table.getCenterTotalSize() }\n : {},\n colorScheme,\n size,\n variant,\n \"aria-colcount\": colCount,\n \"aria-multiselectable\": enableRowSelection ? \"true\" : undefined,\n \"aria-rowcount\": totalRowCount || data.length,\n highlightOnHover,\n highlightOnSelected,\n layout,\n role: \"grid\",\n stickyFooter,\n stickyHeader,\n striped,\n withBorder,\n withColumnBorders,\n withScrollArea,\n scrollAreaProps,\n onFocus,\n onKeyDown,\n },\n tableProps ?? {},\n )()}\n >\n <NativeTable.Thead {...theadProps}>\n {mergedHeaderGroups.map((headerGroup, rowIndex) => {\n let placeholderCount = 0\n\n return (\n <NativeTable.Tr\n key={headerGroup.id}\n aria-rowindex={rowIndex + 1}\n role=\"row\"\n {...runIfFn(headerGroupProps, headerGroup)}\n >\n {headerGroup.headers.map((header) => {\n const { columnDef } = header.column\n const colIndex = header.index + placeholderCount\n const tabIndex = getTabIndex(colIndex, rowIndex)\n const canSort = header.column.getCanSort()\n const sorted = header.column.getIsSorted()\n const canResize = header.column.getCanResize()\n const resizing = header.column.getIsResizing()\n const children = header.isPlaceholder\n ? null\n : flexRender(\n header.column.columnDef.header,\n header.getContext(),\n )\n\n placeholderCount += (header.colSpan || 1) - 1\n\n return (\n <NativeTable.Th\n key={header.id}\n aria-colindex={colIndex + 1}\n aria-rowindex={rowIndex + 1}\n aria-sort={\n sorted\n ? sorted === \"asc\"\n ? \"ascending\"\n : \"descending\"\n : \"none\"\n }\n data-colindex={colIndex}\n data-rowindex={rowIndex}\n colSpan={header.colSpan || undefined}\n numeric={columnDef.numeric}\n pe={\n canSort\n ? \"calc((1rem * {lineHeights.moderate}) + {space-x})\"\n : undefined\n }\n position=\"relative\"\n role=\"columnheader\"\n rowSpan={header.rowSpan || undefined}\n tabIndex={tabIndex}\n {...mergeProps(\n {\n css: {\n \"&:has([data-focusable]:focus-visible)\":\n focusRingStyle.outline,\n },\n style: enableColumnResizing\n ? { width: header.getSize() }\n : {},\n },\n runIfFn(headerProps, header) ?? {},\n columnDef.headerProps ?? {},\n )()}\n >\n <TruncatedText\n lineClamp={columnDef.lineClamp ?? lineClamp}\n truncated={columnDef.truncated ?? truncated}\n >\n {children}\n </TruncatedText>\n\n {canSort ? (\n <SortingIcon\n sorted={sorted}\n onClick={header.column.getToggleSortingHandler()}\n />\n ) : null}\n\n {canResize ? (\n <ResizableTrigger\n resizing={resizing}\n onDoubleClick={header.column.resetSize}\n onMouseDown={header.getResizeHandler()}\n onTouchStart={header.getResizeHandler()}\n />\n ) : null}\n </NativeTable.Th>\n )\n })}\n </NativeTable.Tr>\n )\n })}\n </NativeTable.Thead>\n\n <NativeTable.Tbody {...tbodyProps}>\n {rows.map((row, rowIndex) => {\n rowIndex += headerGroupCount\n\n const selected = !!rowSelection[row.id]\n const disabled =\n isFunction(enableRowSelection) && !enableRowSelection(row)\n\n return (\n <NativeTable.Tr\n id={row.id}\n key={row.id}\n aria-disabled={ariaAttr(disabled)}\n aria-rowindex={rowIndex + 1}\n aria-selected={ariaAttr(selected)}\n data-disabled={dataAttr(disabled)}\n data-selected={dataAttr(selected)}\n role=\"row\"\n {...mergeProps(\n {\n onClick:\n !disabled && selectOnClickRow\n ? () => row.toggleSelected(!selected)\n : undefined,\n },\n {\n onClick: !disabled ? () => onRowClick?.(row) : undefined,\n onDoubleClick: !disabled\n ? () => onRowDoubleClick?.(row)\n : undefined,\n },\n runIfFn(rowProps, row) ?? {},\n )()}\n >\n {row.getVisibleCells().map((cell) => {\n const { columnDef } = cell.column\n const colIndex = cell.column.getIndex()\n const tabIndex = getTabIndex(colIndex, rowIndex)\n const children = flexRender(\n cell.column.columnDef.cell,\n cell.getContext(),\n )\n\n return (\n <NativeTable.Td\n key={cell.id}\n aria-colindex={colIndex + 1}\n aria-rowindex={rowIndex + 1}\n data-colindex={colIndex}\n data-rowindex={rowIndex}\n numeric={columnDef.numeric}\n role=\"gridcell\"\n tabIndex={tabIndex}\n {...mergeProps(\n {\n css: {\n \"&:has([data-focusable]:focus-visible)\":\n focusRingStyle.outline,\n },\n },\n runIfFn(cellProps, cell) ?? {},\n columnDef.cellProps ?? {},\n )()}\n >\n <TruncatedText\n lineClamp={columnDef.lineClamp ?? lineClamp}\n truncated={columnDef.truncated ?? truncated}\n >\n {children}\n </TruncatedText>\n </NativeTable.Td>\n )\n })}\n </NativeTable.Tr>\n )\n })}\n </NativeTable.Tbody>\n\n {withFooterGroups ? (\n <NativeTable.Tfoot {...tfootProps}>\n {mergedFooterGroups.map((footerGroup, rowIndex) => {\n rowIndex += headerGroupCount + rowCount\n\n let placeholderCount = 0\n\n return (\n <NativeTable.Tr\n key={footerGroup.id}\n aria-rowindex={rowIndex + 1}\n role=\"row\"\n {...runIfFn(footerGroupProps, footerGroup)}\n >\n {footerGroup.headers.map((header) => {\n const { columnDef } = header.column\n const colIndex = header.index + placeholderCount\n const tabIndex = getTabIndex(colIndex, rowIndex)\n const children = header.isPlaceholder\n ? null\n : flexRender(\n header.column.columnDef.footer,\n header.getContext(),\n )\n\n placeholderCount += (header.colSpan || 1) - 1\n\n return (\n <NativeTable.Td\n key={header.id}\n aria-colindex={colIndex + 1}\n aria-rowindex={rowIndex + 1}\n data-colindex={colIndex}\n data-rowindex={rowIndex}\n colSpan={header.colSpan || undefined}\n numeric={columnDef.numeric}\n role=\"gridcell\"\n rowSpan={header.rowSpan || undefined}\n tabIndex={tabIndex}\n {...mergeProps(\n {\n css: {\n \"&:has([data-focusable]:focus-visible)\":\n focusRingStyle.outline,\n },\n },\n runIfFn(footerProps, header) ?? {},\n columnDef.footerProps ?? {},\n )()}\n >\n <TruncatedText\n lineClamp={columnDef.lineClamp ?? lineClamp}\n truncated={columnDef.truncated ?? truncated}\n >\n {children}\n </TruncatedText>\n </NativeTable.Td>\n )\n })}\n </NativeTable.Tr>\n )\n })}\n </NativeTable.Tfoot>\n ) : null}\n </NativeTable.Root>\n\n {footer ? runIfFn(footer, table) : null}\n </ComponentContext>\n )\n },\n)() as GenericsComponent<{\n <Y extends RowData>(props: TableProps<Y>): ReactElement\n}>\n\ninterface SortingIconProps extends HTMLStyledProps<\"button\"> {\n sorted: false | SortDirection\n}\n\nconst SortingIcon: FC<SortingIconProps> = ({ sorted, ...rest }) => {\n const { t } = useI18n(\"table\")\n const { sortingIcon, sortingIconProps = {} } = useComponentContext()\n const Icon = sorted ? ChevronUpIcon : ChevronsUpDownIcon\n\n return (\n <styled.button\n type=\"button\"\n layerStyle=\"ghost\"\n colorScheme=\"mono\"\n aria-label={t(\n sorted\n ? sorted === \"desc\"\n ? \"Sort descending\"\n : \"Sort ascending\"\n : \"Clear sorting\",\n )}\n data-focusable\n aspectRatio=\"1\"\n cursor=\"pointer\"\n display=\"center\"\n focusVisibleRing=\"none\"\n h=\"calc(1em * {lineHeights.moderate})\"\n position=\"absolute\"\n right=\"{space-x}\"\n rounded=\"l1\"\n tabIndex={-1}\n top=\"50%\"\n transform=\"translateY(-50%)\"\n transitionDuration=\"moderate\"\n transitionProperty=\"common\"\n _hover={{ layerStyle: \"ghost.hover\" }}\n {...mergeProps(rest, sortingIconProps)()}\n >\n {runIfFn(sortingIcon, sorted) ?? (\n <Icon transform={`rotate(${sorted === \"desc\" ? 180 : 0}deg)`} />\n )}\n </styled.button>\n )\n}\n\ninterface ResizableTriggerProps extends HTMLStyledProps {\n resizing: boolean\n}\n\nconst ResizableTrigger: FC<ResizableTriggerProps> = ({ resizing, ...rest }) => {\n const {\n columnResizeMode,\n table,\n resizableTriggerProps = {},\n } = useComponentContext()\n const offset = table.getState().columnSizingInfo.deltaOffset\n\n return (\n <styled.div\n data-active={dataAttr(resizing)}\n bg=\"colorScheme.solid\"\n cursor=\"col-resize\"\n insetY=\"0\"\n opacity={{ base: \"0\", _hover: \"1\", _active: \"1\" }}\n position=\"absolute\"\n right=\"0\"\n touchAction=\"none\"\n transform={`translateX(${columnResizeMode === \"onEnd\" && resizing && offset ? `${offset}px` : \"50%\"})`}\n userSelect=\"none\"\n w=\"1\"\n {...mergeProps(rest, resizableTriggerProps)()}\n />\n )\n}\n\ninterface TruncatedTextProps extends HTMLStyledProps<\"span\"> {}\n\nconst TruncatedText: FC<TruncatedTextProps> = ({\n children,\n lineClamp,\n truncated,\n ...rest\n}) => {\n if (lineClamp || truncated) {\n return (\n <styled.span\n lineClamp={lineClamp}\n truncated={truncated}\n wordBreak=\"break-all\"\n {...rest}\n >\n {children}\n </styled.span>\n )\n } else {\n return children\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8FA,SAAS,qBACP,cACoB;CACpB,IAAI,aAAa,UAAU,GAAG,OAAO;CAErC,MAAM,6BAAa,IAAI,IAAI;CAE3B,OAAO,aAAa,KAAK,aAAa,OAAO,EAAE,QAAQ,gBAAgB;EACrE,OAAO;GACL,GAAG;GACH,SAAS,YAAY,QAClB,QAAQ,WAAW,CAAC,WAAW,IAAI,OAAO,OAAO,EAAE,CAAC,CAAC,CACrD,KAAK,WAAW;IACf,WAAW,IAAI,OAAO,OAAO,EAAE;IAE/B,OAAO,OAAO,gBACV;KAAE,GAAG;KAAQ,eAAe;KAAO,SAAS,YAAY;IAAM,IAC9D;KAAE,GAAG;KAAQ,SAAS;IAAE;GAC9B,CAAC;EACL;CACF,CAAC;AACH;AAEA,SAAS,qBACP,cACoB;CACpB,IAAI,aAAa,UAAU,GAAG,OAAO;CAErC,OAAO,aAAa,KAAK,aAAa,UAAU;EAC9C,MAAM,mBAAmB,aAAa,MAAM,QAAQ,CAAC;EAErD,OAAO;GACL,GAAG;GACH,SAAS,YAAY,QAClB,QAAQ,WAAW,CAAC,OAAO,aAAa,CAAC,CACzC,KAAK,WAAW;IACf,IAAI,iBAAiB,WAAW,GAAG,OAAO;IAE1C,MAAM,UAAU,iBAAiB,QAAQ,KAAK,oBAAoB;KAKhE,OAAO,OAJe,gBAAgB,QAAQ,MAC3C,eAAe,WAAW,OAAO,OAAO,OAAO,OAAO,EAG/B,IAAI,IAAI;IACpC,GAAG,CAAC;IAEJ,OAAO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ACA;EACX,WAAU;EACV,GAAI;EAEH;CACU,CAAA;MAGf,OAAO;AAEX"}
|
|
1
|
+
{"version":3,"file":"table.js","names":["NativeTable.Root","NativeTable.Thead","NativeTable.Tr","NativeTable.Th","NativeTable.Tbody","NativeTable.Td","NativeTable.Tfoot"],"sources":["../../../../src/components/table/table.tsx"],"sourcesContent":["\"use client\"\n\nimport type {\n AccessorFn,\n Cell,\n CellContext,\n ColumnDef,\n ColumnDefTemplate,\n ColumnFiltersColumnDef,\n ColumnFiltersState,\n ColumnMeta,\n ColumnPinningColumnDef,\n ColumnSizingColumnDef,\n GlobalFilterColumnDef,\n GroupingColumnDef,\n Header,\n HeaderContext,\n HeaderGroup,\n OnChangeFn,\n SortingState as OriginalSortingState,\n PaginationState,\n Table as ReactTable,\n Row,\n RowData,\n RowSelectionState,\n SortDirection,\n SortingColumnDef,\n TableOptions,\n VisibilityColumnDef,\n} from \"@tanstack/react-table\"\nimport type { FC, FocusEvent, KeyboardEvent, ReactElement } from \"react\"\nimport type { CSSProps, GenericsComponent, HTMLStyledProps } from \"../../core\"\nimport type { ReactNodeOrFunction, TransformProps } from \"../../utils\"\nimport type { CheckboxProps } from \"../checkbox\"\nimport {\n createColumnHelper,\n flexRender,\n getCoreRowModel,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n useReactTable,\n} from \"@tanstack/react-table\"\nimport { useMemo, useRef } from \"react\"\nimport { createComponent, focusRingStyle, mergeProps, styled } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n dataAttr,\n isFunction,\n runIfFn,\n runKeyAction,\n useUpdateEffect,\n} from \"../../utils\"\nimport { Checkbox } from \"../checkbox\"\nimport { ChevronsUpDownIcon, ChevronUpIcon } from \"../icon\"\nimport { NativeTable } from \"../native-table\"\n\ndeclare module \"@tanstack/react-table\" {\n interface ColumnDefExtensions<TData extends RowData, TValue = unknown>\n extends\n VisibilityColumnDef,\n ColumnPinningColumnDef,\n ColumnFiltersColumnDef<TData>,\n GlobalFilterColumnDef,\n SortingColumnDef<TData>,\n GroupingColumnDef<TData, TValue>,\n ColumnSizingColumnDef {}\n\n interface ColumnDefBase<TData extends RowData, TValue = unknown>\n extends\n ColumnDefExtensions<TData, TValue>,\n Pick<CSSProps, \"lineClamp\" | \"truncated\">,\n Pick<NativeTable.TdProps, \"numeric\"> {\n cell?: ColumnDefTemplate<CellContext<TData, TValue>>\n footer?: ColumnDefTemplate<HeaderContext<TData, TValue>>\n getUniqueValues?: AccessorFn<TData, unknown[]>\n meta?: ColumnMeta<TData, TValue>\n cellProps?: NativeTable.TdProps\n footerProps?: NativeTable.ThProps\n headerProps?: NativeTable.ThProps\n }\n}\n\nexport { createColumnHelper }\nexport type {\n ColumnDef,\n ColumnFiltersState,\n PaginationState,\n RowSelectionState,\n SortDirection,\n}\n\nfunction getMergeHeaderGroups(\n headerGroups: HeaderGroup<any>[],\n): HeaderGroup<any>[] {\n if (headerGroups.length <= 1) return headerGroups\n\n const columnsIds = new Set()\n\n return headerGroups.map((headerGroup, depth, { length: fullDepth }) => {\n return {\n ...headerGroup,\n headers: headerGroup.headers\n .filter((header) => !columnsIds.has(header.column.id))\n .map((header) => {\n columnsIds.add(header.column.id)\n\n return header.isPlaceholder\n ? { ...header, isPlaceholder: false, rowSpan: fullDepth - depth }\n : { ...header, rowSpan: 1 }\n }),\n }\n })\n}\n\nfunction getMergeFooterGroups(\n headerGroups: HeaderGroup<any>[],\n): HeaderGroup<any>[] {\n if (headerGroups.length <= 1) return headerGroups\n\n return headerGroups.map((headerGroup, depth) => {\n const nextHeaderGroups = headerGroups.slice(depth + 1)\n\n return {\n ...headerGroup,\n headers: headerGroup.headers\n .filter((header) => !header.isPlaceholder)\n .map((header) => {\n if (nextHeaderGroups.length === 0) return header\n\n const rowSpan = nextHeaderGroups.reduce((acc, nextHeaderGroup) => {\n const hasNextHeader = nextHeaderGroup.headers.some(\n (nextHeader) => nextHeader.column.id === header.column.id,\n )\n\n return acc + (hasNextHeader ? 1 : 0)\n }, 1)\n\n return { ...header, rowSpan }\n }),\n }\n })\n}\n\nexport interface ColumnSort<Y extends RowData> {\n desc: boolean\n id: keyof Y\n}\nexport type SortingState<Y extends RowData> = ColumnSort<Y>[]\n\ninterface ComponentContext extends Pick<\n TableProps<any>,\n | \"columnResizeMode\"\n | \"resizableTriggerProps\"\n | \"sortingIcon\"\n | \"sortingIconProps\"\n> {\n table: ReactTable<any>\n}\n\ninterface OmittedTableOptions<Y extends RowData> extends Omit<\n TableOptions<Y>,\n | \"getCoreRowModel\"\n | \"onColumnFiltersChange\"\n | \"onPaginationChange\"\n | \"onSortingChange\"\n> {}\n\ninterface PickedNativeTableProps extends Pick<\n NativeTable.RootProps,\n | \"className\"\n | \"highlightOnHover\"\n | \"highlightOnSelected\"\n | \"layout\"\n | \"scrollAreaProps\"\n | \"size\"\n | \"stickyFooter\"\n | \"stickyHeader\"\n | \"striped\"\n | \"variant\"\n | \"withBorder\"\n | \"withColumnBorders\"\n | \"withScrollArea\"\n> {}\n\nexport interface TableProps<Y extends RowData>\n extends\n OmittedTableOptions<Y>,\n PickedNativeTableProps,\n Pick<CSSProps, \"colorScheme\" | \"lineClamp\" | \"truncated\"> {\n /**\n * The column filters state of the table.\n */\n columnFilters?: ColumnFiltersState\n /**\n * The default column filters state of the table.\n */\n defaultColumnFilters?: ColumnFiltersState\n /**\n * The default pagination state of the table.\n */\n defaultPagination?: PaginationState\n /**\n * The default row selection state of the table.\n */\n defaultRowSelection?: RowSelectionState\n /**\n * The default sorting state of the table.\n */\n defaultSorting?: SortingState<Y>\n /**\n * If `true`, the table width will be automatically resized to the content.\n *\n * @default false\n */\n enableAutoResizeTableWidth?: boolean\n /**\n * If `true`, the keyboard navigation will be enabled.\n *\n * @default true\n */\n enableKeyboardNavigation?: boolean\n /**\n * If `true`, the pagination will be enabled.\n *\n * @default false\n */\n enablePagination?: boolean\n /**\n * The footer of the table.\n */\n footer?: ReactNodeOrFunction<ReactTable<Y>>\n /**\n * The header of the table.\n */\n header?: ReactNodeOrFunction<ReactTable<Y>>\n /**\n * The initial focusable cell of the table.\n *\n * @default {rowIndex: 0, colIndex: 0}\n */\n initialFocusableCell?: { colIndex: number; rowIndex: number }\n /**\n * The pagination state of the table.\n */\n pagination?: PaginationState\n /**\n * The row selection state of the table.\n */\n rowSelection?: RowSelectionState\n /**\n * If `true`, the row will be selected when the row is clicked.\n *\n * @default false\n */\n selectOnClickRow?: boolean\n /**\n * The sorting state of the table.\n */\n sorting?: SortingState<Y>\n /**\n * The sorting icon of the table.\n */\n sortingIcon?: ReactNodeOrFunction<false | SortDirection>\n /**\n * If `true`, the table will have a checkbox column.\n *\n * @default true\n */\n withCheckbox?: boolean\n /**\n * If `true`, the table will have a checkbox in the footer.\n *\n * @default false\n */\n withFooterCheckbox?: boolean\n /**\n * If `true`, the table will have footer groups.\n *\n * @default false\n */\n withFooterGroups?: boolean\n /**\n * The props for the table cell.\n */\n cellProps?: TransformProps<NativeTable.TdProps, Cell<Y, unknown>>\n /**\n * The props for the checkbox.\n */\n checkboxProps?: CheckboxProps\n /**\n * The props for the table footer group.\n */\n footerGroupProps?: TransformProps<NativeTable.TrProps, HeaderGroup<Y>>\n /**\n * The props for the table footer.\n */\n footerProps?: TransformProps<NativeTable.ThProps, Header<Y, unknown>>\n /**\n * The props for the table header checkbox.\n */\n headerCheckboxProps?: TransformProps<CheckboxProps, Header<Y, unknown>>\n /**\n * The props for the table header group.\n */\n headerGroupProps?: TransformProps<NativeTable.TrProps, HeaderGroup<Y>>\n /**\n * The props for the table header.\n */\n headerProps?: TransformProps<NativeTable.ThProps, Header<Y, unknown>>\n /**\n * The props for the resizable trigger.\n */\n resizableTriggerProps?: TransformProps<\n Omit<ResizableTriggerProps, \"resizing\">,\n Header<Y, unknown>\n >\n /**\n * The props for the table row checkbox.\n */\n rowCheckboxProps?: TransformProps<CheckboxProps, Row<Y>>\n /**\n * The props for the table row.\n */\n rowProps?: TransformProps<NativeTable.TrProps, Row<Y>>\n /**\n * The props for the sorting icon.\n */\n sortingIconProps?: TransformProps<\n Omit<SortingIconProps, \"sorted\">,\n Header<Y, unknown>\n >\n /**\n * The props for the table.\n */\n tableProps?: NativeTable.RootProps\n /**\n * The props for the table tbody.\n */\n tbodyProps?: NativeTable.TbodyProps\n /**\n * The props for the table tfoot.\n */\n tfootProps?: NativeTable.TfootProps\n /**\n * The props for the table thead.\n */\n theadProps?: NativeTable.TheadProps\n /**\n * The callback invoked when the column filters state changes.\n */\n onColumnFiltersChange?: (columnFilters: ColumnFiltersState) => void\n /**\n * The callback invoked when the pagination state changes.\n */\n onPaginationChange?: (pagination: PaginationState) => void\n /**\n * The callback invoked when the row is clicked.\n */\n onRowClick?: (row: Row<Y>) => void\n /**\n * The callback invoked when the row is double clicked.\n */\n onRowDoubleClick?: (row: Row<Y>) => void\n /**\n * The callback invoked when the sorting state changes.\n */\n onSortingChange?: (sorting: SortingState<Y>) => void\n}\n\nconst {\n ComponentContext,\n PropsContext: TablePropsContext,\n useComponentContext,\n usePropsContext: useTablePropsContext,\n withContext,\n} = createComponent<TableProps<any>, any, ComponentContext>(\"table\")\n\nexport { TablePropsContext, useTablePropsContext }\n\n/**\n * `Table` is a table component equipped with column sorting, row selection, and click event features.\n *\n * @see https://yamada-ui.com/docs/components/table\n */\nexport const Table = withContext(\n <Y extends RowData>({\n className,\n colorScheme,\n size,\n variant,\n columnFilters: columnFiltersProp,\n columnResizeMode = \"onChange\",\n columns: columnsProp,\n data,\n defaultColumnFilters,\n defaultPagination = { pageIndex: 0, pageSize: 20 },\n defaultRowSelection = {},\n defaultSorting,\n enableAutoResizeTableWidth = false,\n enableColumnResizing = false,\n enableKeyboardNavigation = true,\n enablePagination = false,\n enableRowSelection = false,\n footer,\n header,\n highlightOnHover = !!enableRowSelection,\n highlightOnSelected = !!enableRowSelection,\n initialFocusableCell = { colIndex: 0, rowIndex: 0 },\n layout,\n lineClamp,\n manualPagination,\n pagination: paginationProp,\n rowCount: totalRowCount,\n rowSelection: rowSelectionProp,\n selectOnClickRow = false,\n sortDescFirst = false,\n sorting: sortingProp,\n sortingIcon,\n state,\n stickyFooter,\n stickyHeader,\n striped,\n truncated,\n withBorder,\n withCheckbox = true,\n withColumnBorders,\n withFooterCheckbox = false,\n withFooterGroups = false,\n withScrollArea,\n cellProps,\n checkboxProps,\n footerGroupProps,\n footerProps,\n headerCheckboxProps,\n headerGroupProps,\n headerProps,\n resizableTriggerProps,\n rowCheckboxProps,\n rowProps,\n scrollAreaProps,\n sortingIconProps,\n tableProps,\n tbodyProps,\n tfootProps,\n theadProps,\n onColumnFiltersChange: onColumnFiltersChangeProp,\n onPaginationChange: onPaginationChangeProp,\n onRowClick,\n onRowDoubleClick,\n onRowSelectionChange: onRowSelectionChangeProp,\n onSortingChange: onSortingChangeProp,\n ...rest\n }: TableProps<Y>) => {\n const { t } = useI18n(\"table\")\n const initialFocus = useRef<boolean>(false)\n const ref = useRef<HTMLTableElement>(null)\n const focusedCell = useRef<null | { colIndex: number; rowIndex: number }>(\n null,\n )\n const [rowSelection, onRowSelectionChange] = useControllableState({\n defaultValue: defaultRowSelection,\n value: rowSelectionProp,\n onChange: onRowSelectionChangeProp,\n })\n const [sorting, onSortingChange] = useControllableState({\n defaultValue: defaultSorting,\n value: sortingProp,\n onChange: onSortingChangeProp,\n })\n const [pagination, onPaginationChange] = useControllableState({\n defaultValue: defaultPagination,\n value: paginationProp,\n onChange: onPaginationChangeProp,\n })\n const [columnFilters, onColumnFiltersChange] = useControllableState({\n defaultValue: defaultColumnFilters,\n value: columnFiltersProp,\n onChange: onColumnFiltersChangeProp,\n })\n const columns = useMemo(() => {\n if (!enableRowSelection || !withCheckbox) return columnsProp\n\n const clonedColumns = [...columnsProp]\n\n const header = ({ header, table }: HeaderContext<Y, any>) => {\n return (\n <Checkbox\n {...mergeProps(\n {\n checked: table.getIsAllRowsSelected(),\n indeterminate: table.getIsSomeRowsSelected(),\n indicatorProps: { outline: \"none\" },\n inputProps: {\n \"aria-label\": t(\"Select all rows\"),\n \"data-focusable\": \"\",\n tabIndex: -1,\n },\n onChange: table.getToggleAllRowsSelectedHandler(),\n },\n checkboxProps ?? {},\n runIfFn(headerCheckboxProps, header) ?? {},\n )()}\n />\n )\n }\n\n const cell = ({ row }: CellContext<Y, any>) => {\n return (\n <Checkbox\n {...mergeProps(\n {\n checked: row.getIsSelected(),\n disabled: !row.getCanSelect(),\n indeterminate: row.getIsSomeSelected(),\n indicatorProps: { outline: \"none\" },\n inputProps: {\n \"aria-label\": t(\"Select row\"),\n \"data-focusable\": \"\",\n tabIndex: -1,\n },\n onChange: row.getToggleSelectedHandler(),\n },\n checkboxProps ?? {},\n runIfFn(rowCheckboxProps, row) ?? {},\n )()}\n />\n )\n }\n\n clonedColumns.unshift({\n id: \"select\",\n cell,\n header,\n ...(withFooterCheckbox\n ? { footer: header }\n : { footerProps: { \"aria-hidden\": \"true\" } }),\n cellProps: { verticalAlign: \"middle\" },\n headerProps: { w: \"calc({spaces.4} + {space-x} * 2)\" },\n })\n\n return clonedColumns\n }, [\n checkboxProps,\n columnsProp,\n enableRowSelection,\n headerCheckboxProps,\n rowCheckboxProps,\n t,\n withCheckbox,\n withFooterCheckbox,\n ])\n const table = useReactTable<Y>({\n columnResizeMode,\n columns,\n data,\n enableColumnResizing,\n enableRowSelection,\n getCoreRowModel: getCoreRowModel(),\n getFilteredRowModel: getFilteredRowModel(),\n getSortedRowModel: getSortedRowModel(),\n manualPagination,\n rowCount: totalRowCount,\n sortDescFirst,\n state: {\n columnFilters,\n pagination: enablePagination ? pagination : undefined,\n rowSelection,\n sorting: sorting as OriginalSortingState,\n ...state,\n },\n onColumnFiltersChange,\n onPaginationChange,\n onRowSelectionChange,\n onSortingChange: onSortingChange as OnChangeFn<OriginalSortingState>,\n ...(enablePagination\n ? { getPaginationRowModel: getPaginationRowModel() }\n : {}),\n ...rest,\n })\n const headerGroups = table.getHeaderGroups()\n const mergedHeaderGroups = getMergeHeaderGroups(headerGroups)\n const rows = table.getRowModel().rows\n const footerGroups = table.getFooterGroups()\n const mergedFooterGroups = getMergeFooterGroups(\n withFooterGroups ? footerGroups : [],\n )\n const headerGroupCount = headerGroups.length\n const rowCount = rows.length\n const colCount = table.getAllLeafColumns().length\n const maxColIndex = colCount - 1\n const pageIndex = enablePagination\n ? table.getState().pagination.pageIndex\n : 0\n const cellMap = useMemo(() => {\n const cellMap = new Map<string, string>()\n\n if (!enableKeyboardNavigation) return cellMap\n\n const insertCellMap = (\n id: string,\n colSpan: number,\n rowSpan: number,\n colIndex: number,\n rowIndex: number,\n ) => {\n for (let i = 0; i < colSpan; i++)\n cellMap.set(`${colIndex + i}-${rowIndex}`, `${colIndex}-${rowIndex}`)\n\n for (let i = 1; i < rowSpan; i++)\n cellMap.set(`${colIndex}-${rowIndex + i}`, `${colIndex}-${rowIndex}`)\n }\n\n const insertCellMapByHeaderGroup = (\n headerGroup: HeaderGroup<Y>,\n rowIndex: number,\n ) => {\n let placeholderCount = 0\n\n headerGroup.headers.forEach((header) => {\n const colSpan = header.colSpan || 1\n const rowSpan = header.rowSpan || 1\n const colIndex = header.index + placeholderCount\n\n placeholderCount += colSpan - 1\n\n insertCellMap(header.id, colSpan, rowSpan, colIndex, rowIndex)\n })\n }\n\n mergedHeaderGroups.forEach((headerGroup, rowIndex) => {\n insertCellMapByHeaderGroup(headerGroup, rowIndex)\n })\n\n rows.forEach((row, rowIndex) => {\n rowIndex += headerGroupCount\n\n row.getVisibleCells().forEach((cell) => {\n const colIndex = cell.column.getIndex()\n\n insertCellMap(cell.id, 1, 1, colIndex, rowIndex)\n })\n })\n\n mergedFooterGroups.forEach((footerGroup, rowIndex) => {\n rowIndex += headerGroupCount + rowCount\n\n insertCellMapByHeaderGroup(footerGroup, rowIndex)\n })\n\n return cellMap\n }, [\n enableKeyboardNavigation,\n headerGroupCount,\n mergedFooterGroups,\n mergedHeaderGroups,\n rows,\n rowCount,\n ])\n const context = useMemo(\n () => ({\n columnResizeMode,\n sortingIcon,\n table,\n resizableTriggerProps,\n sortingIconProps,\n }),\n [\n columnResizeMode,\n sortingIcon,\n sortingIconProps,\n resizableTriggerProps,\n table,\n ],\n )\n const getCell = (\n evOrEl:\n | Element\n | FocusEvent<HTMLTableElement>\n | KeyboardEvent<HTMLTableElement>\n | null\n | undefined,\n ) => {\n if (!evOrEl) return\n\n const el =\n evOrEl instanceof HTMLElement\n ? evOrEl.closest(\"th, td\")\n : \"target\" in evOrEl && evOrEl.target instanceof HTMLElement\n ? evOrEl.target.closest(\"th, td\")\n : null\n\n if (!(el instanceof HTMLTableCellElement)) return\n\n const { colindex, rowindex } = el.dataset\n const { colSpan, rowSpan } = el\n\n if (!colindex || !rowindex) return\n\n const colIndex = parseInt(colindex)\n const rowIndex = parseInt(rowindex)\n\n return { colIndex, colSpan, el, rowIndex, rowSpan }\n }\n const getShouldFocusCell = (colIndex: number, rowIndex: number) => {\n const [trulyColIndex, trulyRowIndex] =\n cellMap.get(`${colIndex}-${rowIndex}`)?.split(\"-\") ?? []\n\n if (!trulyColIndex || !trulyRowIndex) return\n\n const targetEl = ref.current?.querySelector(\n `[data-colindex=\"${trulyColIndex}\"][data-rowindex=\"${trulyRowIndex}\"]`,\n )\n\n if (!targetEl || !(targetEl instanceof HTMLTableCellElement)) return\n\n return targetEl\n }\n const removeTabIndex = (el: Element | null | undefined) => {\n if (!el || !(el instanceof HTMLElement)) return\n\n el.tabIndex = -1\n el.querySelectorAll(\"[data-focusable]\").forEach((el) => {\n if (el instanceof HTMLElement) el.tabIndex = -1\n })\n }\n const onCellFocus = (\n el: HTMLTableCellElement | null | undefined,\n colIndex: number,\n rowIndex: number,\n ) => {\n const targetEl = getShouldFocusCell(colIndex, rowIndex)\n\n if (!targetEl) return\n\n focusedCell.current = { colIndex, rowIndex }\n\n removeTabIndex(el)\n\n const shouldFocusEl =\n targetEl.querySelector(\"[data-focusable]\") ?? targetEl\n\n if (shouldFocusEl instanceof HTMLElement) {\n shouldFocusEl.tabIndex = 0\n shouldFocusEl.focus()\n }\n }\n const onFocus = (ev: FocusEvent<HTMLTableElement>) => {\n if (initialFocus.current) return\n\n initialFocus.current = true\n\n const cell = getCell(ev)\n\n if (!cell) return\n\n onCellFocus(cell.el, cell.colIndex, cell.rowIndex)\n }\n const onKeyDown = (ev: KeyboardEvent<HTMLTableElement>) => {\n if (!enableKeyboardNavigation) return\n\n const cell = getCell(ev)\n\n if (!cell) return\n\n runKeyAction(ev, {\n ArrowDown: () =>\n onCellFocus(cell.el, cell.colIndex, cell.rowIndex + cell.rowSpan),\n ArrowLeft: () => onCellFocus(cell.el, cell.colIndex - 1, cell.rowIndex),\n ArrowRight: () =>\n onCellFocus(cell.el, cell.colIndex + cell.colSpan, cell.rowIndex),\n ArrowUp: () => onCellFocus(cell.el, cell.colIndex, cell.rowIndex - 1),\n End: () => onCellFocus(cell.el, maxColIndex, cell.rowIndex),\n Home: () => onCellFocus(cell.el, 0, cell.rowIndex),\n ...(enablePagination\n ? {\n PageDown: () => {\n if (!table.getCanNextPage()) return\n\n table.setPageIndex(pageIndex + 1)\n },\n PageUp: () => {\n if (!table.getCanPreviousPage()) return\n\n table.setPageIndex(pageIndex - 1)\n },\n }\n : {}),\n })\n }\n const getTabIndex = (colIndex: number, rowIndex: number) => {\n if (!enableKeyboardNavigation) return undefined\n\n return colIndex === initialFocusableCell.colIndex &&\n rowIndex === initialFocusableCell.rowIndex\n ? 0\n : undefined\n }\n\n useUpdateEffect(() => {\n if (!enableKeyboardNavigation) return\n\n const { colIndex, rowIndex } = focusedCell.current ?? initialFocusableCell\n const targetEl = getShouldFocusCell(colIndex, rowIndex)\n\n if (targetEl) targetEl.tabIndex = 0\n }, [pageIndex, enableKeyboardNavigation])\n\n return (\n <ComponentContext value={context}>\n {header ? runIfFn(header, table) : null}\n\n <NativeTable.Root\n {...mergeProps(\n {\n ref,\n className,\n style:\n enableColumnResizing && enableAutoResizeTableWidth\n ? { width: table.getCenterTotalSize() }\n : {},\n colorScheme,\n size,\n variant,\n \"aria-colcount\": colCount,\n \"aria-multiselectable\": enableRowSelection ? \"true\" : undefined,\n \"aria-rowcount\": totalRowCount || data.length,\n highlightOnHover,\n highlightOnSelected,\n layout,\n role: \"grid\",\n stickyFooter,\n stickyHeader,\n striped,\n withBorder,\n withColumnBorders,\n withScrollArea,\n scrollAreaProps,\n onFocus,\n onKeyDown,\n },\n tableProps ?? {},\n )()}\n >\n <NativeTable.Thead {...theadProps}>\n {mergedHeaderGroups.map((headerGroup, rowIndex) => {\n let placeholderCount = 0\n\n return (\n <NativeTable.Tr\n key={headerGroup.id}\n aria-rowindex={rowIndex + 1}\n role=\"row\"\n {...runIfFn(headerGroupProps, headerGroup)}\n >\n {headerGroup.headers.map((header) => {\n const { columnDef } = header.column\n const colIndex = header.index + placeholderCount\n const tabIndex = getTabIndex(colIndex, rowIndex)\n const canSort = header.column.getCanSort()\n const sorted = header.column.getIsSorted()\n const canResize = header.column.getCanResize()\n const resizing = header.column.getIsResizing()\n const children = header.isPlaceholder\n ? null\n : flexRender(\n header.column.columnDef.header,\n header.getContext(),\n )\n\n placeholderCount += (header.colSpan || 1) - 1\n\n return (\n <NativeTable.Th\n key={header.id}\n aria-colindex={colIndex + 1}\n aria-rowindex={rowIndex + 1}\n aria-sort={\n sorted\n ? sorted === \"asc\"\n ? \"ascending\"\n : \"descending\"\n : \"none\"\n }\n data-colindex={colIndex}\n data-rowindex={rowIndex}\n colSpan={header.colSpan || undefined}\n numeric={columnDef.numeric}\n pe={\n canSort\n ? \"calc((1rem * {lineHeights.moderate}) + {space-x})\"\n : undefined\n }\n position=\"relative\"\n role=\"columnheader\"\n rowSpan={header.rowSpan || undefined}\n tabIndex={tabIndex}\n {...mergeProps(\n {\n css: {\n \"&:has([data-focusable]:focus-visible)\":\n focusRingStyle.outline,\n },\n style: enableColumnResizing\n ? { width: header.getSize() }\n : {},\n },\n runIfFn(headerProps, header) ?? {},\n columnDef.headerProps ?? {},\n )()}\n >\n <TruncatedText\n lineClamp={columnDef.lineClamp ?? lineClamp}\n truncated={columnDef.truncated ?? truncated}\n >\n {children}\n </TruncatedText>\n\n {canSort ? (\n <SortingIcon\n sorted={sorted}\n onClick={header.column.getToggleSortingHandler()}\n />\n ) : null}\n\n {canResize ? (\n <ResizableTrigger\n resizing={resizing}\n onDoubleClick={header.column.resetSize}\n onMouseDown={header.getResizeHandler()}\n onTouchStart={header.getResizeHandler()}\n />\n ) : null}\n </NativeTable.Th>\n )\n })}\n </NativeTable.Tr>\n )\n })}\n </NativeTable.Thead>\n\n <NativeTable.Tbody {...tbodyProps}>\n {rows.map((row, rowIndex) => {\n rowIndex += headerGroupCount\n\n const selected = !!rowSelection[row.id]\n const disabled =\n isFunction(enableRowSelection) && !enableRowSelection(row)\n\n return (\n <NativeTable.Tr\n id={row.id}\n key={row.id}\n aria-disabled={ariaAttr(disabled)}\n aria-rowindex={rowIndex + 1}\n aria-selected={ariaAttr(selected)}\n data-disabled={dataAttr(disabled)}\n data-selected={dataAttr(selected)}\n role=\"row\"\n {...mergeProps(\n {\n onClick:\n !disabled && selectOnClickRow\n ? () => row.toggleSelected(!selected)\n : undefined,\n },\n {\n onClick: !disabled ? () => onRowClick?.(row) : undefined,\n onDoubleClick: !disabled\n ? () => onRowDoubleClick?.(row)\n : undefined,\n },\n runIfFn(rowProps, row) ?? {},\n )()}\n >\n {row.getVisibleCells().map((cell) => {\n const { columnDef } = cell.column\n const colIndex = cell.column.getIndex()\n const tabIndex = getTabIndex(colIndex, rowIndex)\n const children = flexRender(\n cell.column.columnDef.cell,\n cell.getContext(),\n )\n\n return (\n <NativeTable.Td\n key={cell.id}\n aria-colindex={colIndex + 1}\n aria-rowindex={rowIndex + 1}\n data-colindex={colIndex}\n data-rowindex={rowIndex}\n numeric={columnDef.numeric}\n role=\"gridcell\"\n tabIndex={tabIndex}\n {...mergeProps(\n {\n css: {\n \"&:has([data-focusable]:focus-visible)\":\n focusRingStyle.outline,\n },\n },\n runIfFn(cellProps, cell) ?? {},\n columnDef.cellProps ?? {},\n )()}\n >\n <TruncatedText\n lineClamp={columnDef.lineClamp ?? lineClamp}\n truncated={columnDef.truncated ?? truncated}\n >\n {children}\n </TruncatedText>\n </NativeTable.Td>\n )\n })}\n </NativeTable.Tr>\n )\n })}\n </NativeTable.Tbody>\n\n {withFooterGroups ? (\n <NativeTable.Tfoot {...tfootProps}>\n {mergedFooterGroups.map((footerGroup, rowIndex) => {\n rowIndex += headerGroupCount + rowCount\n\n let placeholderCount = 0\n\n return (\n <NativeTable.Tr\n key={footerGroup.id}\n aria-rowindex={rowIndex + 1}\n role=\"row\"\n {...runIfFn(footerGroupProps, footerGroup)}\n >\n {footerGroup.headers.map((header) => {\n const { columnDef } = header.column\n const colIndex = header.index + placeholderCount\n const tabIndex = getTabIndex(colIndex, rowIndex)\n const children = header.isPlaceholder\n ? null\n : flexRender(\n header.column.columnDef.footer,\n header.getContext(),\n )\n\n placeholderCount += (header.colSpan || 1) - 1\n\n return (\n <NativeTable.Td\n key={header.id}\n aria-colindex={colIndex + 1}\n aria-rowindex={rowIndex + 1}\n data-colindex={colIndex}\n data-rowindex={rowIndex}\n colSpan={header.colSpan || undefined}\n numeric={columnDef.numeric}\n role=\"gridcell\"\n rowSpan={header.rowSpan || undefined}\n tabIndex={tabIndex}\n {...mergeProps(\n {\n css: {\n \"&:has([data-focusable]:focus-visible)\":\n focusRingStyle.outline,\n },\n },\n runIfFn(footerProps, header) ?? {},\n columnDef.footerProps ?? {},\n )()}\n >\n <TruncatedText\n lineClamp={columnDef.lineClamp ?? lineClamp}\n truncated={columnDef.truncated ?? truncated}\n >\n {children}\n </TruncatedText>\n </NativeTable.Td>\n )\n })}\n </NativeTable.Tr>\n )\n })}\n </NativeTable.Tfoot>\n ) : null}\n </NativeTable.Root>\n\n {footer ? runIfFn(footer, table) : null}\n </ComponentContext>\n )\n },\n)() as GenericsComponent<{\n <Y extends RowData>(props: TableProps<Y>): ReactElement\n}>\n\ninterface SortingIconProps extends HTMLStyledProps<\"button\"> {\n sorted: false | SortDirection\n}\n\nconst SortingIcon: FC<SortingIconProps> = ({ sorted, ...rest }) => {\n const { t } = useI18n(\"table\")\n const { sortingIcon, sortingIconProps = {} } = useComponentContext()\n const Icon = sorted ? ChevronUpIcon : ChevronsUpDownIcon\n\n return (\n <styled.button\n type=\"button\"\n layerStyle=\"ghost\"\n colorScheme=\"mono\"\n aria-label={t(\n sorted\n ? sorted === \"desc\"\n ? \"Sort descending\"\n : \"Sort ascending\"\n : \"Clear sorting\",\n )}\n data-focusable\n aspectRatio=\"1\"\n cursor=\"pointer\"\n display=\"center\"\n focusVisibleRing=\"none\"\n h=\"calc(1em * {lineHeights.moderate})\"\n position=\"absolute\"\n right=\"{space-x}\"\n rounded=\"l1\"\n tabIndex={-1}\n top=\"50%\"\n transform=\"translateY(-50%)\"\n transitionDuration=\"moderate\"\n transitionProperty=\"common\"\n _hover={{ layerStyle: \"ghost.hover\" }}\n {...mergeProps(rest, sortingIconProps)()}\n >\n {runIfFn(sortingIcon, sorted) ?? (\n <Icon transform={`rotate(${sorted === \"desc\" ? 180 : 0}deg)`} />\n )}\n </styled.button>\n )\n}\n\ninterface ResizableTriggerProps extends HTMLStyledProps {\n resizing: boolean\n}\n\nconst ResizableTrigger: FC<ResizableTriggerProps> = ({ resizing, ...rest }) => {\n const {\n columnResizeMode,\n table,\n resizableTriggerProps = {},\n } = useComponentContext()\n const offset = table.getState().columnSizingInfo.deltaOffset\n\n return (\n <styled.div\n data-active={dataAttr(resizing)}\n bg=\"colorScheme.solid\"\n cursor=\"col-resize\"\n insetY=\"0\"\n opacity={{ base: \"0\", _hover: \"1\", _active: \"1\" }}\n position=\"absolute\"\n right=\"0\"\n touchAction=\"none\"\n transform={`translateX(${columnResizeMode === \"onEnd\" && resizing && offset ? `${offset}px` : \"50%\"})`}\n userSelect=\"none\"\n w=\"1\"\n {...mergeProps(rest, resizableTriggerProps)()}\n />\n )\n}\n\ninterface TruncatedTextProps extends HTMLStyledProps<\"span\"> {}\n\nconst TruncatedText: FC<TruncatedTextProps> = ({\n children,\n lineClamp,\n truncated,\n ...rest\n}) => {\n if (lineClamp || truncated)\n return (\n <styled.span\n lineClamp={lineClamp}\n truncated={truncated}\n wordBreak=\"break-all\"\n {...rest}\n >\n {children}\n </styled.span>\n )\n else return children\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8FA,SAAS,qBACP,cACoB;CACpB,IAAI,aAAa,UAAU,GAAG,OAAO;CAErC,MAAM,6BAAa,IAAI,IAAI;CAE3B,OAAO,aAAa,KAAK,aAAa,OAAO,EAAE,QAAQ,gBAAgB;EACrE,OAAO;GACL,GAAG;GACH,SAAS,YAAY,QAClB,QAAQ,WAAW,CAAC,WAAW,IAAI,OAAO,OAAO,EAAE,CAAC,CAAC,CACrD,KAAK,WAAW;IACf,WAAW,IAAI,OAAO,OAAO,EAAE;IAE/B,OAAO,OAAO,gBACV;KAAE,GAAG;KAAQ,eAAe;KAAO,SAAS,YAAY;IAAM,IAC9D;KAAE,GAAG;KAAQ,SAAS;IAAE;GAC9B,CAAC;EACL;CACF,CAAC;AACH;AAEA,SAAS,qBACP,cACoB;CACpB,IAAI,aAAa,UAAU,GAAG,OAAO;CAErC,OAAO,aAAa,KAAK,aAAa,UAAU;EAC9C,MAAM,mBAAmB,aAAa,MAAM,QAAQ,CAAC;EAErD,OAAO;GACL,GAAG;GACH,SAAS,YAAY,QAClB,QAAQ,WAAW,CAAC,OAAO,aAAa,CAAC,CACzC,KAAK,WAAW;IACf,IAAI,iBAAiB,WAAW,GAAG,OAAO;IAE1C,MAAM,UAAU,iBAAiB,QAAQ,KAAK,oBAAoB;KAKhE,OAAO,OAJe,gBAAgB,QAAQ,MAC3C,eAAe,WAAW,OAAO,OAAO,OAAO,OAAO,EAG/B,IAAI,IAAI;IACpC,GAAG,CAAC;IAEJ,OAAO;KAAE,GAAG;KAAQ;IAAQ;GAC9B,CAAC;EACL;CACF,CAAC;AACH;AAoOA,MAAM,EACJ,kB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
|
|
1
|
-
{"version":3,"file":"tabs.js","names":[],"sources":["../../../../src/components/tabs/tabs.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { UseLazyMountProps } from \"../../hooks/use-lazy-mount\"\nimport type { TabsStyle } from \"./tabs.style\"\nimport type { UseTabPanelProps, UseTabProps, UseTabsProps } from \"./use-tabs\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useLazyMount } from \"../../hooks/use-lazy-mount\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { isNull, isUndefined } from \"../../utils\"\nimport { tabsStyle } from \"./tabs.style\"\nimport {\n TabDescendantsContext,\n TabPanelDescendantsContext,\n TabsContext,\n useTab,\n useTabPanel,\n useTabs,\n useTabsContext,\n} from \"./use-tabs\"\n\ninterface ComponentContext extends Pick<\n TabsRootProps,\n \"items\" | \"lazy\" | \"lazyBehavior\"\n> {}\n\nexport interface TabsItem extends Omit<TabsTabProps, \"index\"> {\n /**\n * The content for panel element.\n */\n panel: ReactNode\n /**\n * The content for tab element.\n */\n tab: ReactNode\n /**\n * Props for panel element.\n */\n panelProps?: TabsPanelProps\n}\n\nexport interface TabsRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n Omit<UseTabsProps, \"orientation\">,\n Pick<UseLazyMountProps, \"lazy\" | \"lazyBehavior\">,\n ThemeProps<TabsStyle> {\n /**\n * If provided, generate tab and panel components based on tabs.\n */\n items?: TabsItem[]\n}\n\nconst {\n ComponentContext,\n PropsContext: TabsPropsContext,\n useComponentContext,\n usePropsContext: useTabsPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<TabsRootProps, TabsStyle, ComponentContext>(\n \"tabs\",\n tabsStyle,\n)\n\nexport { TabsPropsContext, useTabsPropsContext }\n\n/**\n * `Tabs` is a component for switching between different display areas.\n *\n * @see https://yamada-ui.com/docs/components/tabs\n */\nexport const TabsRoot = withProvider<\"div\", TabsRootProps, \"orientation\">(\n ({\n children,\n items,\n lazy,\n lazyBehavior,\n orientation: orientationProp,\n ...rest\n }) => {\n const computedOrientation = useValue(orientationProp)\n const {\n id,\n focusedIndex,\n index,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n tabDescendants,\n tabPanelDescendants,\n getListProps,\n getRootProps,\n } = useTabs({ orientation: computedOrientation, ...rest })\n const componentContext = useMemo(\n () => ({ items, lazy, lazyBehavior }),\n [items, lazy, lazyBehavior],\n )\n const tabsContext = useMemo(\n () => ({\n id,\n focusedIndex,\n index,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n getListProps,\n }),\n [\n id,\n manual,\n focusedIndex,\n index,\n orientation,\n setFocusedIndex,\n setIndex,\n getListProps,\n ],\n )\n\n return (\n <TabDescendantsContext value={tabDescendants}>\n <TabPanelDescendantsContext value={tabPanelDescendants}>\n <TabsContext value={tabsContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{children}</styled.div>\n </ComponentContext>\n </TabsContext>\n </TabPanelDescendantsContext>\n </TabDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"orientation\"] },\n)()\n\nexport interface TabsListProps extends HTMLStyledProps {}\n\nexport const TabsList = withContext<\"div\", TabsListProps>(\n ({ children, ...rest }) => {\n const { items } = useComponentContext()\n const { getListProps } = useTabsContext()\n const computedChildren = useMemo(() => {\n if (children)
|
|
1
|
+
{"version":3,"file":"tabs.js","names":[],"sources":["../../../../src/components/tabs/tabs.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { UseLazyMountProps } from \"../../hooks/use-lazy-mount\"\nimport type { TabsStyle } from \"./tabs.style\"\nimport type { UseTabPanelProps, UseTabProps, UseTabsProps } from \"./use-tabs\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useLazyMount } from \"../../hooks/use-lazy-mount\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { isNull, isUndefined } from \"../../utils\"\nimport { tabsStyle } from \"./tabs.style\"\nimport {\n TabDescendantsContext,\n TabPanelDescendantsContext,\n TabsContext,\n useTab,\n useTabPanel,\n useTabs,\n useTabsContext,\n} from \"./use-tabs\"\n\ninterface ComponentContext extends Pick<\n TabsRootProps,\n \"items\" | \"lazy\" | \"lazyBehavior\"\n> {}\n\nexport interface TabsItem extends Omit<TabsTabProps, \"index\"> {\n /**\n * The content for panel element.\n */\n panel: ReactNode\n /**\n * The content for tab element.\n */\n tab: ReactNode\n /**\n * Props for panel element.\n */\n panelProps?: TabsPanelProps\n}\n\nexport interface TabsRootProps\n extends\n Omit<HTMLStyledProps, \"onChange\">,\n Omit<UseTabsProps, \"orientation\">,\n Pick<UseLazyMountProps, \"lazy\" | \"lazyBehavior\">,\n ThemeProps<TabsStyle> {\n /**\n * If provided, generate tab and panel components based on tabs.\n */\n items?: TabsItem[]\n}\n\nconst {\n ComponentContext,\n PropsContext: TabsPropsContext,\n useComponentContext,\n usePropsContext: useTabsPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<TabsRootProps, TabsStyle, ComponentContext>(\n \"tabs\",\n tabsStyle,\n)\n\nexport { TabsPropsContext, useTabsPropsContext }\n\n/**\n * `Tabs` is a component for switching between different display areas.\n *\n * @see https://yamada-ui.com/docs/components/tabs\n */\nexport const TabsRoot = withProvider<\"div\", TabsRootProps, \"orientation\">(\n ({\n children,\n items,\n lazy,\n lazyBehavior,\n orientation: orientationProp,\n ...rest\n }) => {\n const computedOrientation = useValue(orientationProp)\n const {\n id,\n focusedIndex,\n index,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n tabDescendants,\n tabPanelDescendants,\n getListProps,\n getRootProps,\n } = useTabs({ orientation: computedOrientation, ...rest })\n const componentContext = useMemo(\n () => ({ items, lazy, lazyBehavior }),\n [items, lazy, lazyBehavior],\n )\n const tabsContext = useMemo(\n () => ({\n id,\n focusedIndex,\n index,\n manual,\n orientation,\n setFocusedIndex,\n setIndex,\n getListProps,\n }),\n [\n id,\n manual,\n focusedIndex,\n index,\n orientation,\n setFocusedIndex,\n setIndex,\n getListProps,\n ],\n )\n\n return (\n <TabDescendantsContext value={tabDescendants}>\n <TabPanelDescendantsContext value={tabPanelDescendants}>\n <TabsContext value={tabsContext}>\n <ComponentContext value={componentContext}>\n <styled.div {...getRootProps()}>{children}</styled.div>\n </ComponentContext>\n </TabsContext>\n </TabPanelDescendantsContext>\n </TabDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"orientation\"] },\n)()\n\nexport interface TabsListProps extends HTMLStyledProps {}\n\nexport const TabsList = withContext<\"div\", TabsListProps>(\n ({ children, ...rest }) => {\n const { items } = useComponentContext()\n const { getListProps } = useTabsContext()\n const computedChildren = useMemo(() => {\n if (children) return children\n else\n return items?.map(\n (\n { id, panel: _panel, tab, panelProps: _panelProps, ...rest },\n index,\n ) =>\n isUndefined(tab) || isNull(tab) ? null : (\n <TabsTab id={id} key={id ?? index} index={index} {...rest}>\n {tab}\n </TabsTab>\n ),\n )\n }, [children, items])\n\n return <styled.div {...getListProps(rest)}>{computedChildren}</styled.div>\n },\n \"list\",\n)()\n\nexport interface TabsTabProps extends HTMLStyledProps<\"button\">, UseTabProps {}\n\nexport const TabsTab = withContext<\"button\", TabsTabProps>(\"button\", \"tab\")(\n undefined,\n (props) => {\n const { getRootProps } = useTab(props)\n\n return getRootProps()\n },\n)\n\nexport interface TabsPanelsProps extends PropsWithChildren {}\n\nexport const TabsPanels: FC<TabsPanelsProps> = ({ children }) => {\n const { items } = useComponentContext()\n\n return useMemo(() => {\n if (children) return children\n else\n return items?.map(({ id, panel, panelProps }, index) =>\n isUndefined(panel) || isNull(panel) ? null : (\n <TabsPanel key={id ?? index} index={index} {...panelProps}>\n {panel}\n </TabsPanel>\n ),\n )\n }, [children, items])\n}\n\nexport interface TabsPanelProps extends HTMLStyledProps, UseTabPanelProps {}\n\nexport const TabsPanel = withContext<\"div\", TabsPanelProps>(\"div\", \"panel\")(\n undefined,\n (props) => {\n const { lazy, lazyBehavior } = useComponentContext()\n const { selected: mounted, getRootProps } = useTabPanel(props)\n const children = useLazyMount({ lazy, lazyBehavior, mounted, ...props })\n\n return { ...getRootProps(), children }\n },\n)\n"],"mappings":";;;;;;;;;;;AAuDA,MAAM,EACJ,kBACA,cAAc,kBACd,qBACA,iBAAiB,qBACjB,aACA,iBACE,oBACF,QACA,SACF;;;;;;AASA,MAAa,WAAW,cACrB,EACC,UACA,OACA,MACA,cACA,aAAa,iBACb,GAAG,WACC;CAEJ,MAAM,EACJ,IACA,cACA,OACA,QACA,aACA,iBACA,UACA,gBACA,qBACA,cACA,iBACE,QAAQ;EAAE,aAbc,SAAS,eAaQ;EAAG,GAAG;CAAK,CAAC;CACzD,MAAM,mBAAmB,eAChB;EAAE;EAAO;EAAM;CAAa,IACnC;EAAC;EAAO;EAAM;CAAY,CAC5B;CAwBA,OACE,oBAAC,uBAAD;EAAuB,OAAO;YAC5B,oBAAC,4BAAD;GAA4B,OAAO;aACjC,oBAAC,aAAD;IAAa,OA1BC,eACX;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACF,IACA;KACE;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACF,CAMkC;cAC5B,oBAAC,kBAAD;KAAkB,OAAO;eACvB,oBAAC,OAAO,KAAR;MAAY,GAAI,aAAa;MAAI;KAAqB,CAAA;IACtC,CAAA;GACP,CAAA;EACa,CAAA;CACP,CAAA;AAE3B,GACA,QACA,EAAE,eAAe,CAAC,aAAa,EAAE,CACnC,CAAC,CAAC;AAIF,MAAa,WAAW,aACrB,EAAE,UAAU,GAAG,WAAW;CACzB,MAAM,EAAE,UAAU,oBAAoB;CACtC,MAAM,EAAE,iBAAiB,eAAe;CACxC,MAAM,mBAAmB,cAAc;EACrC,IAAI,UAAU,OAAO;OAEnB,OAAO,OAAO,KAEV,EAAE,IAAI,OAAO,QAAQ,KAAK,YAAY,aAAa,GAAG,QACtD,WAAA,GAAA,cAAA,YAAA,CAEY,GAAG,MAAA,GAAA,cAAA,OAAA,CAAY,GAAG,IAAI,OAChC,oBAAC,SAAD;GAAa;GAA6B;GAAO,GAAI;aAClD;EACM,GAFa,MAAM,KAEnB,CAEf;CACJ,GAAG,CAAC,UAAU,KAAK,CAAC;CAEpB,OAAO,oBAAC,OAAO,KAAR;EAAY,GAAI,aAAa,IAAI;YAAI;CAA6B,CAAA;AAC3E,GACA,MACF,CAAC,CAAC;AAIF,MAAa,UAAU,YAAoC,UAAU,KAAK,CAAC,CACzE,KAAA,IACC,UAAU;CACT,MAAM,EAAE,iBAAiB,OAAO,KAAK;CAErC,OAAO,aAAa;AACtB,CACF;AAIA,MAAa,cAAmC,EAAE,eAAe;CAC/D,MAAM,EAAE,UAAU,oBAAoB;CAEtC,OAAO,cAAc;EACnB,IAAI,UAAU,OAAO;OAEnB,OAAO,OAAO,KAAK,EAAE,IAAI,OAAO,cAAc,WAAA,GAAA,cAAA,YAAA,CAChC,KAAK,MAAA,GAAA,cAAA,OAAA,CAAY,KAAK,IAAI,OACpC,oBAAC,WAAD;GAAoC;GAAO,GAAI;aAC5C;EACQ,GAFK,MAAM,KAEX,CAEf;CACJ,GAAG,CAAC,UAAU,KAAK,CAAC;AACtB;AAIA,MAAa,YAAY,YAAmC,OAAO,OAAO,CAAC,CACzE,KAAA,IACC,UAAU;CACT,MAAM,EAAE,MAAM,iBAAiB,oBAAoB;CACnD,MAAM,EAAE,UAAU,SAAS,iBAAiB,YAAY,KAAK;CAC7D,MAAM,WAAW,aAAa;EAAE;EAAM;EAAc;EAAS,GAAG;CAAM,CAAC;CAEvE,OAAO;EAAE,GAAG,aAAa;EAAG;CAAS;AACvC,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-toggle-group.js","names":["createContext"],"sources":["../../../../src/components/toggle/use-toggle-group.ts"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n createContext,\n dataAttr,\n isArray,\n isUndefined,\n toArray,\n useUpdateEffect,\n} from \"../../utils\"\n\ninterface ToggleGroupContext {\n onChangeMapRef: RefObject<Map<string, (value: boolean) => void>>\n disabled?: boolean\n readOnly?: boolean\n value?: string | string[]\n onChange?: <Y extends string = string>(value: undefined | Y) => void\n}\n\nconst [ToggleGroupContext, useToggleGroupContext] =\n createContext<ToggleGroupContext>({\n name: \"ToggleGroupContext\",\n strict: false,\n })\n\nexport { ToggleGroupContext, useToggleGroupContext }\n\nexport interface UseToggleGroupProps<\n Y extends string | string[] = string,\n> extends Omit<HTMLProps, \"defaultValue\" | \"onChange\" | \"value\"> {\n /**\n * The initial value of the toggle button group.\n */\n defaultValue?: Y extends any[] ? Y : undefined | Y\n /**\n * If `true`, all wrapped toggle button will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, all wrapped toggle button will be readonly.\n *\n * @default false\n */\n readOnly?: boolean\n /**\n * The value of the toggle button group.\n */\n value?: Y extends any[] ? Y : undefined | Y\n /**\n * The callback fired when any children toggle button is selected or unselected.\n */\n onChange?: (value: Y extends any[] ? Y : undefined | Y) => void\n}\n\nexport const useToggleGroup = <Y extends string | string[] = string>({\n defaultValue,\n disabled,\n readOnly,\n value: valueProp,\n onChange: onChangeProp,\n ...rest\n}: UseToggleGroupProps<Y>) => {\n type Value = Y extends any[] ? Y : undefined | Y\n\n const onChangeMapRef = useRef<Map<string, (value: boolean) => void>>(\n new Map(),\n )\n const [value, setValue] = useControllableState<Value>({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n\n const onReset = useCallback((targetValue?: string[]) => {\n onChangeMapRef.current.forEach((onChange, value) => {\n if (targetValue?.includes(value))
|
|
1
|
+
{"version":3,"file":"use-toggle-group.js","names":["createContext"],"sources":["../../../../src/components/toggle/use-toggle-group.ts"],"sourcesContent":["\"use client\"\n\nimport type { RefObject } from \"react\"\nimport type { HTMLProps, PropGetter } from \"../../core\"\nimport { useCallback, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport {\n createContext,\n dataAttr,\n isArray,\n isUndefined,\n toArray,\n useUpdateEffect,\n} from \"../../utils\"\n\ninterface ToggleGroupContext {\n onChangeMapRef: RefObject<Map<string, (value: boolean) => void>>\n disabled?: boolean\n readOnly?: boolean\n value?: string | string[]\n onChange?: <Y extends string = string>(value: undefined | Y) => void\n}\n\nconst [ToggleGroupContext, useToggleGroupContext] =\n createContext<ToggleGroupContext>({\n name: \"ToggleGroupContext\",\n strict: false,\n })\n\nexport { ToggleGroupContext, useToggleGroupContext }\n\nexport interface UseToggleGroupProps<\n Y extends string | string[] = string,\n> extends Omit<HTMLProps, \"defaultValue\" | \"onChange\" | \"value\"> {\n /**\n * The initial value of the toggle button group.\n */\n defaultValue?: Y extends any[] ? Y : undefined | Y\n /**\n * If `true`, all wrapped toggle button will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * If `true`, all wrapped toggle button will be readonly.\n *\n * @default false\n */\n readOnly?: boolean\n /**\n * The value of the toggle button group.\n */\n value?: Y extends any[] ? Y : undefined | Y\n /**\n * The callback fired when any children toggle button is selected or unselected.\n */\n onChange?: (value: Y extends any[] ? Y : undefined | Y) => void\n}\n\nexport const useToggleGroup = <Y extends string | string[] = string>({\n defaultValue,\n disabled,\n readOnly,\n value: valueProp,\n onChange: onChangeProp,\n ...rest\n}: UseToggleGroupProps<Y>) => {\n type Value = Y extends any[] ? Y : undefined | Y\n\n const onChangeMapRef = useRef<Map<string, (value: boolean) => void>>(\n new Map(),\n )\n const [value, setValue] = useControllableState<Value>({\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n\n const onReset = useCallback((targetValue?: string[]) => {\n onChangeMapRef.current.forEach((onChange, value) => {\n if (targetValue?.includes(value)) onChange(true)\n else onChange(false)\n })\n }, [])\n\n const onChange = useCallback(\n <M extends string = Y extends any[] ? Y[number] : Y>(\n value: M | undefined,\n ) => {\n if (isUndefined(value)) return\n\n setValue((prev) => {\n if (isArray(prev)) {\n const included = prev.includes(value)\n\n if (included) {\n const nextValue = prev.filter((prevValue) => prevValue !== value)\n\n onReset(nextValue)\n\n return nextValue as Value\n } else {\n const nextValue = [...prev, value]\n\n onReset(nextValue)\n\n return nextValue as Value\n }\n } else {\n if (String(value) === prev) {\n onReset()\n\n return undefined as Value\n } else {\n onReset([value])\n\n return value as unknown as Value\n }\n }\n })\n },\n [setValue, onReset],\n )\n\n useUpdateEffect(() => {\n onReset(!isUndefined(valueProp) ? toArray(valueProp) : undefined)\n\n setValue(valueProp as Value)\n }, [valueProp])\n\n const getGroupProps: PropGetter = useCallback(\n (props) =>\n mergeProps(\n {\n \"data-disabled\": dataAttr(disabled),\n \"data-readonly\": dataAttr(readOnly),\n role: \"group\",\n },\n rest,\n props,\n )(),\n [disabled, readOnly, rest],\n )\n\n return { disabled, readOnly, value, getGroupProps, onChange, onChangeMapRef }\n}\n\nexport type UseToggleGroupReturn = ReturnType<typeof useToggleGroup>\n"],"mappings":";;;;;;;;AAwBA,MAAM,CAAC,oBAAoB,yBACzBA,gBAAkC;CAChC,MAAM;CACN,QAAQ;AACV,CAAC;AAiCH,MAAa,kBAAwD,EACnE,cACA,UACA,UACA,OAAO,WACP,UAAU,cACV,GAAG,WACyB;CAG5B,MAAM,iBAAiB,uBACrB,IAAI,IAAI,CACV;CACA,MAAM,CAAC,OAAO,YAAY,qBAA4B;EACpD;EACA,OAAO;EACP,UAAU;CACZ,CAAC;CAED,MAAM,UAAU,aAAa,gBAA2B;EACtD,eAAe,QAAQ,SAAS,UAAU,UAAU;GAClD,IAAI,aAAa,SAAS,KAAK,GAAG,SAAS,IAAI;QAC1C,SAAS,KAAK;EACrB,CAAC;CACH,GAAG,CAAC,CAAC;CAEL,MAAM,WAAW,aAEb,UACG;EACH,KAAA,GAAA,cAAA,YAAA,CAAgB,KAAK,GAAG;EAExB,UAAU,SAAS;GACjB,KAAA,GAAA,cAAA,QAAA,CAAY,IAAI,GAGd,IAFiB,KAAK,SAAS,KAEpB,GAAG;IACZ,MAAM,YAAY,KAAK,QAAQ,cAAc,cAAc,KAAK;IAEhE,QAAQ,SAAS;IAEjB,OAAO;GACT,OAAO;IACL,MAAM,YAAY,CAAC,GAAG,MAAM,KAAK;IAEjC,QAAQ,SAAS;IAEjB,OAAO;GACT;QAEA,IAAI,OAAO,KAAK,MAAM,MAAM;IAC1B,QAAQ;IAER;GACF,OAAO;IACL,QAAQ,CAAC,KAAK,CAAC;IAEf,OAAO;GACT;EAEJ,CAAC;CACH,GACA,CAAC,UAAU,OAAO,CACpB;CAEA,sBAAsB;EACpB,QAAQ,EAAA,GAAA,cAAA,YAAA,CAAa,SAAS,KAAA,GAAA,cAAA,QAAA,CAAY,SAAS,IAAI,KAAA,CAAS;EAEhE,SAAS,SAAkB;CAC7B,GAAG,CAAC,SAAS,CAAC;CAgBd,OAAO;EAAE;EAAU;EAAU;EAAO,eAdF,aAC/B,UACC,WACE;GACE,kBAAA,GAAA,cAAA,SAAA,CAA0B,QAAQ;GAClC,kBAAA,GAAA,cAAA,SAAA,CAA0B,QAAQ;GAClC,MAAM;EACR,GACA,MACA,KACF,CAAC,CAAC,GACJ;GAAC;GAAU;GAAU;EAAI,CAGqB;EAAG;EAAU;CAAe;AAC9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-toggle.js","names":[],"sources":["../../../../src/components/toggle/use-toggle.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent } from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useMemo, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n dataAttr,\n handlerAll,\n isArray,\n isUndefined,\n mergeRefs,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\nimport { useToggleGroupContext } from \"./use-toggle-group\"\n\nexport interface UseToggleProps<Y extends string = string>\n extends\n FieldProps,\n HTMLRefAttributes<\"input\">,\n Omit<HTMLProps<\"button\">, \"onChange\" | \"ref\" | \"value\"> {\n /**\n * If `true`, the toggle button is represented as active.\n *\n * @default false\n */\n active?: boolean\n /**\n * If `true`, the toggle button will be checked.\n */\n checked?: boolean\n /**\n * If `true`, the toggle button will be initially checked.\n *\n * @default false\n */\n defaultChecked?: boolean\n /**\n * The value of the toggle button.\n */\n value?: Y\n /**\n * The callback invoked when checked state changes.\n */\n onChange?: (checked: boolean) => void\n}\n\nexport const useToggle = <Y extends string = string>(\n props: UseToggleProps<Y> = {},\n) => {\n const { t } = useI18n(\"toggle\")\n const {\n disabled: groupDisabled,\n readOnly: groupReadOnly,\n value: groupValue,\n onChange: onChangeGroup,\n onChangeMapRef,\n } = useToggleGroupContext() ?? {}\n const {\n props: {\n id,\n ref,\n form,\n name,\n active,\n checked: checkedProp,\n defaultChecked = false,\n disabled,\n readOnly,\n required,\n value,\n onChange: onChangeProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps<HTMLElement, UseToggleProps<Y>>({\n disabled: groupDisabled,\n readOnly: groupReadOnly,\n ...props,\n })\n const inputRef = useRef<HTMLInputElement>(null)\n const [checked, setChecked] = useControllableState({\n defaultValue: defaultChecked,\n value: checkedProp,\n onChange: onChangeProp,\n })\n const interactive = !(readOnly || disabled)\n const controlled = !isUndefined(groupValue)\n const trulyChecked = useMemo(() => {\n if (!controlled)
|
|
1
|
+
{"version":3,"file":"use-toggle.js","names":[],"sources":["../../../../src/components/toggle/use-toggle.ts"],"sourcesContent":["\"use client\"\n\nimport type { ChangeEvent } from \"react\"\nimport type { HTMLProps, HTMLRefAttributes, PropGetter } from \"../../core\"\nimport type { Merge } from \"../../utils\"\nimport type { FieldProps } from \"../field\"\nimport { useCallback, useMemo, useRef } from \"react\"\nimport { mergeProps } from \"../../core\"\nimport { useControllableState } from \"../../hooks/use-controllable-state\"\nimport { useI18n } from \"../../providers/i18n-provider\"\nimport {\n ariaAttr,\n dataAttr,\n handlerAll,\n isArray,\n isUndefined,\n mergeRefs,\n visuallyHiddenAttributes,\n} from \"../../utils\"\nimport { useFieldProps } from \"../field\"\nimport { useToggleGroupContext } from \"./use-toggle-group\"\n\nexport interface UseToggleProps<Y extends string = string>\n extends\n FieldProps,\n HTMLRefAttributes<\"input\">,\n Omit<HTMLProps<\"button\">, \"onChange\" | \"ref\" | \"value\"> {\n /**\n * If `true`, the toggle button is represented as active.\n *\n * @default false\n */\n active?: boolean\n /**\n * If `true`, the toggle button will be checked.\n */\n checked?: boolean\n /**\n * If `true`, the toggle button will be initially checked.\n *\n * @default false\n */\n defaultChecked?: boolean\n /**\n * The value of the toggle button.\n */\n value?: Y\n /**\n * The callback invoked when checked state changes.\n */\n onChange?: (checked: boolean) => void\n}\n\nexport const useToggle = <Y extends string = string>(\n props: UseToggleProps<Y> = {},\n) => {\n const { t } = useI18n(\"toggle\")\n const {\n disabled: groupDisabled,\n readOnly: groupReadOnly,\n value: groupValue,\n onChange: onChangeGroup,\n onChangeMapRef,\n } = useToggleGroupContext() ?? {}\n const {\n props: {\n id,\n ref,\n form,\n name,\n active,\n checked: checkedProp,\n defaultChecked = false,\n disabled,\n readOnly,\n required,\n value,\n onChange: onChangeProp,\n ...rest\n },\n ariaProps,\n dataProps,\n eventProps,\n } = useFieldProps<HTMLElement, UseToggleProps<Y>>({\n disabled: groupDisabled,\n readOnly: groupReadOnly,\n ...props,\n })\n const inputRef = useRef<HTMLInputElement>(null)\n const [checked, setChecked] = useControllableState({\n defaultValue: defaultChecked,\n value: checkedProp,\n onChange: onChangeProp,\n })\n const interactive = !(readOnly || disabled)\n const controlled = !isUndefined(groupValue)\n const trulyChecked = useMemo(() => {\n if (!controlled) return checked\n else\n return isArray(groupValue)\n ? groupValue.includes(value ?? \"\")\n : value === groupValue\n }, [controlled, groupValue, checked, value])\n\n if (controlled && isUndefined(value))\n console.warn(`Toggle: value is required. Please set the value.`)\n\n if (value) onChangeMapRef?.current.set(value, setChecked)\n\n const onClick = useCallback(() => {\n if (!interactive) return\n\n setChecked((prev) => !prev)\n onChangeGroup?.(value)\n }, [onChangeGroup, setChecked, value, interactive])\n\n const onChange = useCallback(\n (ev: ChangeEvent<HTMLInputElement>) => {\n setChecked(ev.target.checked)\n onChangeGroup?.(value)\n },\n [onChangeGroup, setChecked, value],\n )\n\n const getInputProps: PropGetter<\"input\"> = useCallback(\n (props = {}) => ({\n ...visuallyHiddenAttributes,\n ...ariaProps,\n ...dataProps,\n ...eventProps,\n id,\n form,\n type: \"checkbox\",\n name,\n checked,\n disabled,\n readOnly,\n required,\n value,\n ...props,\n ref: mergeRefs(inputRef, ref, props.ref),\n onChange: handlerAll(props.onChange, onChange),\n }),\n [\n ariaProps,\n checked,\n dataProps,\n disabled,\n eventProps,\n form,\n id,\n name,\n onChange,\n readOnly,\n ref,\n required,\n value,\n ],\n )\n\n const getButtonProps: PropGetter<\n \"button\",\n undefined,\n Merge<HTMLProps<\"button\">, { \"aria-label\": string }>\n > = useCallback(\n (props = {}): Merge<HTMLProps<\"button\">, { \"aria-label\": string }> => {\n const ariaLabel = value?.toString() ?? t(\"Toggle button\")\n const mergedProps = mergeProps(\n dataProps,\n {\n type: \"button\",\n \"aria-disabled\": ariaAttr(!interactive),\n \"aria-label\": ariaLabel,\n \"aria-pressed\": trulyChecked,\n \"data-active\": dataAttr(active),\n \"data-checked\": dataAttr(trulyChecked),\n disabled,\n tabIndex: interactive ? undefined : -1,\n },\n rest,\n props,\n { onClick },\n )()\n\n return {\n ...mergedProps,\n \"aria-label\": mergedProps[\"aria-label\"] ?? ariaLabel,\n }\n },\n [\n dataProps,\n value,\n trulyChecked,\n active,\n disabled,\n rest,\n onClick,\n interactive,\n t,\n ],\n )\n\n return {\n checked: trulyChecked,\n setChecked,\n getButtonProps,\n getInputProps,\n }\n}\n\nexport type UseToggleReturn = ReturnType<typeof useToggle>\n"],"mappings":";;;;;;;;;;;AAqDA,MAAa,aACX,QAA2B,CAAC,MACzB;CACH,MAAM,EAAE,MAAM,QAAQ,QAAQ;CAC9B,MAAM,EACJ,UAAU,eACV,UAAU,eACV,OAAO,YACP,UAAU,eACV,mBACE,sBAAsB,KAAK,CAAC;CAChC,MAAM,EACJ,OAAO,EACL,IACA,KACA,MACA,MACA,QACA,SAAS,aACT,iBAAiB,OACjB,UACA,UACA,UACA,OACA,UAAU,cACV,GAAG,QAEL,WACA,WACA,eACE,cAA8C;EAChD,UAAU;EACV,UAAU;EACV,GAAG;CACL,CAAC;CACD,MAAM,WAAW,OAAyB,IAAI;CAC9C,MAAM,CAAC,SAAS,cAAc,qBAAqB;EACjD,cAAc;EACd,OAAO;EACP,UAAU;CACZ,CAAC;CACD,MAAM,cAAc,EAAE,YAAY;CAClC,MAAM,aAAa,EAAA,GAAA,cAAA,YAAA,CAAa,UAAU;CAC1C,MAAM,eAAe,cAAc;EACjC,IAAI,CAAC,YAAY,OAAO;OAEtB,QAAA,GAAA,cAAA,QAAA,CAAe,UAAU,IACrB,WAAW,SAAS,SAAS,EAAE,IAC/B,UAAU;CAClB,GAAG;EAAC;EAAY;EAAY;EAAS;CAAK,CAAC;CAE3C,IAAI,eAAA,GAAA,cAAA,YAAA,CAA0B,KAAK,GACjC,QAAQ,KAAK,kDAAkD;CAEjE,IAAI,OAAO,gBAAgB,QAAQ,IAAI,OAAO,UAAU;CAExD,MAAM,UAAU,kBAAkB;EAChC,IAAI,CAAC,aAAa;EAElB,YAAY,SAAS,CAAC,IAAI;EAC1B,gBAAgB,KAAK;CACvB,GAAG;EAAC;EAAe;EAAY;EAAO;CA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