@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":"use-steps.cjs","names":["createDescendants","createContext","useControllableState","mergeProps","useEnvironment","mergeRefs"],"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.cjs","names":["createDescendants","createContext","useControllableState","mergeProps","useEnvironment","mergeRefs"],"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,oB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AgB,GAAG,UAAU,CAAC,MACvDD,cAAAA,WACE;EACE,gBAAgB,UAAU,SAAS,KAAA;EACnC,oBAAA,GAAA,oBAAA,cAAA,GAAA,CAAsB,oBAAoB,cAAc;EACxD,oBAAoB;GACnB,kBAAA,GAAA,oBAAA,cAAA,SAAA,CAA0B,IAAI;CACjC,GACA,MACA,OACA,EAAE,KAAKE,YAAAA,UAAU,KAAK,QAAQ,EAAE,CAClC,CAAC,CAAC,GACJ;EAAC;EAAoB;EAAS;EAAa;EAAgB;EAAM;CAAQ,CAC3E;CAEA,MAAM,iBAAA,GAAA,MAAA,YAAA,EACH,WAAW;GACT,kBAAA,GAAA,oBAAA,cAAA,SAAA,CAA0B,IAAI;EAC/B,GAAG;CACL,IACA,CAAC,cAAc,CACjB;CA4BA,OAAO;EACL;EACA;EACA;EACA;EACA,sBAAA,GAAA,MAAA,YAAA,EA9BC,WAAW;IACT,kBAAA,GAAA,oBAAA,cAAA,SAAA,CAA0B,IAAI;GAC/B,GAAG;EACL,IACA,CAAC,cAAc,CA0BG;EAClB,oBAAA,GAAA,MAAA,YAAA,EAvBC,WAAW;IACT,kBAAA,GAAA,oBAAA,cAAA,SAAA,CAA0B,IAAI;GAC/B,GAAG;EACL,IACA,CAAC,cAAc,CAmBC;EAChB;EACA,oBAAA,GAAA,MAAA,YAAA,EAjBC,WAAW;GACV,oBAAoB;GACpB,MAAM;IACL,kBAAA,GAAA,oBAAA,cAAA,SAAA,CAA0B,IAAI;GAC/B,GAAG;EACL,IACA,CAAC,aAAa,cAAc,CAWZ;EAChB;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.cjs","names":["createComponent","useI18n","useControllableState","Checkbox","mergeProps","focusRingStyle","ChevronUpIcon","ChevronsUpDownIcon","styled"],"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,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,GAAIJ,cAAAA,WAAW,MAAM,gBAAgB,CAAC,CAAC;2DAE9B,aAAa,MAAM,KAC1B,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAM,WAAW,UAAU,WAAW,SAAS,MAAM,EAAE,MAAQ,CAAA;CAEpD,CAAA;AAEnB;AAMA,MAAM,oBAA+C,EAAE,UAAU,GAAG,WAAW;CAC7E,MAAM,EACJ,kBACA,OACA,wBAAwB,CAAC,MACvB,oBAAoB;CACxB,MAAM,SAAS,MAAM,SAAS,CAAC,CAAC,iBAAiB;CAEjD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACI,gBAAAA,OAAO,KAAR;EACE,gBAAA,GAAA,oBAAA,cAAA,SAAA,CAAsB,QAAQ;EAC9B,IAAG;EACH,QAAO;EACP,QAAO;EACP,SAAS;GAAE,MAAM;GAAK,QAAQ;GAAK,SAAS;EAAI;EAChD,UAAS;EACT,OAAM;EACN,aAAY;EACZ,WAAW,cAAc,qBAAqB,WAAW,YAAY,SAAS,GAAG,OAAO,MAAM,MAAM;EACpG,YAAW;EACX,GAAE;EACF,GAAIJ,cAAAA,WAAW,MAAM,qBAAqB,CAAC,CAAC;CAC7C,CAAA;AAEL;AAIA,MAAM,iBAAyC,EAC7C,UACA,WACA,WACA,GAAG,WACC;CACJ,IAAI,aAAa,WACf,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACI,gBAAAA,OAAO,MAAR;EACa;EACA;EACX,WAAU;EACV,GAAI;EAEH;CACU,CAAA;MAGf,OAAO;AAEX"}
|
|
1
|
+
{"version":3,"file":"table.cjs","names":["createComponent","useI18n","useControllableState","Checkbox","mergeProps","focusRingStyle","ChevronUpIcon","ChevronsUpDownIcon","styled"],"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,a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KAC1B,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAM,WAAW,UAAU,WAAW,SAAS,MAAM,EAAE,MAAQ,CAAA;CAEpD,CAAA;AAEnB;AAMA,MAAM,oBAA+C,EAAE,UAAU,GAAG,WAAW;CAC7E,MAAM,EACJ,kBACA,OACA,wBAAwB,CAAC,MACvB,oBAAoB;CACxB,MAAM,SAAS,MAAM,SAAS,CAAC,CAAC,iBAAiB;CAEjD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACI,gBAAAA,OAAO,KAAR;EACE,gBAAA,GAAA,oBAAA,cAAA,SAAA,CAAsB,QAAQ;EAC9B,IAAG;EACH,QAAO;EACP,QAAO;EACP,SAAS;GAAE,MAAM;GAAK,QAAQ;GAAK,SAAS;EAAI;EAChD,UAAS;EACT,OAAM;EACN,aAAY;EACZ,WAAW,cAAc,qBAAqB,WAAW,YAAY,SAAS,GAAG,OAAO,MAAM,MAAM;EACpG,YAAW;EACX,GAAE;EACF,GAAIJ,cAAAA,WAAW,MAAM,qBAAqB,CAAC,CAAC;CAC7C,CAAA;AAEL;AAIA,MAAM,iBAAyC,EAC7C,UACA,WACA,WACA,GAAG,WACC;CACJ,IAAI,aAAa,WACf,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACI,gBAAAA,OAAO,MAAR;EACa;EACA;EACX,WAAU;EACV,GAAI;EAEH;CACU,CAAA;MAEZ,OAAO;AACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.cjs","names":["createSlotComponent","tabsStyle","useTabs","useValue","TabDescendantsContext","TabPanelDescendantsContext","TabsContext","styled","useTabsContext","useTab","useTabPanel","useLazyMount"],"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.cjs","names":["createSlotComponent","tabsStyle","useTabs","useValue","TabDescendantsContext","TabPanelDescendantsContext","TabsContext","styled","useTabsContext","useTab","useTabPanel","useLazyMount"],"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,iBACEA,yBAAAA,oBACF,QACAC,mBAAAA,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,iBACEC,iBAAAA,QAAQ;EAAE,aAbcC,8BAAAA,SAAS,eAaQ;EAAG,GAAG;CAAK,CAAC;CACzD,MAAM,oBAAA,GAAA,MAAA,QAAA,QACG;EAAE;EAAO;EAAM;CAAa,IACnC;EAAC;EAAO;EAAM;CAAY,CAC5B;CAwBA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,uBAAD;EAAuB,OAAO;YAC5B,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,4BAAD;GAA4B,OAAO;aACjC,iBAAA,GAAA,kBAAA,IAAA,CAACC,iBAAAA,aAAD;IAAa,QAAA,GAAA,MAAA,QAAA,QAzBV;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACF,IACA;KACE;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACF,CAMkC;cAC5B,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;KAAkB,OAAO;eACvB,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,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,iB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S,iBAAiBC,iBAAAA,YAAY,KAAK;CAC7D,MAAM,WAAWC,mCAAAA,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.cjs","names":["createContext","useControllableState","mergeProps"],"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.cjs","names":["createContext","useControllableState","mergeProps"],"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,gBAAAA,cAAkC;CAChC,MAAM;CACN,QAAQ;AACV,CAAC;AAiCH,MAAa,kBAAw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,oBAAA,cAAA,SAAA,CAA0B,QAAQ;GAClC,kBAAA,GAAA,oBAAA,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.cjs","names":["useI18n","useToggleGroupContext","useFieldProps","useControllableState","visuallyHiddenAttributes","mergeRefs","mergeProps"],"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.cjs","names":["useI18n","useToggleGroupContext","useFieldProps","useControllableState","visuallyHiddenAttributes","mergeRefs","mergeProps"],"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,MAAMA,sBAAAA,QAAQ,QAAQ;CAC9B,MAAM,EACJ,UAAU,eACV,UAAU,eACV,OAAO,YACP,UAAU,eACV,mBACEC,yBAAAA,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,eACEC,wBAAAA,cAA8C;EAChD,UAAU;EACV,UAAU;EACV,GAAG;CACL,CAAC;CACD,MAAM,YAAA,GAAA,M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A;CACF,CACF;CA4CA,OAAO;EACL,SAAS;EACT;EACA,iBAAA,GAAA,MAAA,YAAA,EAxCC,QAAQ,CAAC,MAA4D;GACpE,MAAM,YAAY,OAAO,SAAS,KAAK,EAAE,eAAe;GACxD,MAAM,cAAcC,cAAAA,WAClB,WACA;IACE,MAAM;IACN,kBAAA,GAAA,oBAAA,cAAA,SAAA,CAA0B,CAAC,WAAW;IACtC,cAAc;IACd,gBAAgB;IAChB,gBAAA,GAAA,oBAAA,cAAA,SAAA,CAAwB,MAAM;IAC9B,iBAAA,GAAA,oBAAA,cAAA,SAAA,CAAyB,YAAY;IACrC;IACA,UAAU,cAAc,KAAA,IAAY;GACtC,GACA,MACA,OACA,EAAE,QAAQ,CACZ,CAAC,CAAC;GAEF,OAAO;IACL,GAAG;IACH,cAAc,YAAY,iBAAiB;GAC7C;EACF,GACA;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAMa;EACb;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.cjs","names":["createContext","createSlotComponent","treeStyle","useTree","TreeDescendantsContext","TreeContext","styled","useTreeContext","useLoadingComponent","useTreeItem","TreeItemContext","Collapse","ChevronRightIcon","Children","mergeProps","Checkbox"],"sources":["../../../../src/components/tree/tree.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { CheckboxProps } from \"../checkbox\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { Loading } from \"../loading\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type { TreeStyle } from \"./tree.style\"\nimport type { UseTreeItemProps, UseTreeProps } from \"./use-tree\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n} from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n cast,\n createContext,\n dataAttr,\n isObject,\n isString,\n type ReactNodeOrFunction,\n runIfFn,\n} from \"../../utils\"\nimport { Checkbox } from \"../checkbox\"\nimport { Collapse } from \"../collapse\"\nimport { ChevronRightIcon } from \"../icon\"\nimport { useLoadingComponent } from \"../loading\"\nimport { treeStyle } from \"./tree.style\"\nimport {\n TreeContext,\n TreeDescendantsContext,\n TreeItemContext,\n useTree,\n useTreeContext,\n useTreeItem,\n} from \"./use-tree\"\n\ninterface TreeCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\ntype TreeItemReactNode =\n | ReactNodeOrFunction<TreeCallBackProps>\n | {\n group: ReactNodeOrFunction<TreeCallBackProps>\n item?: ReactNodeOrFunction<TreeCallBackProps>\n }\n | {\n item: ReactNodeOrFunction<TreeCallBackProps>\n group?: ReactNodeOrFunction<TreeCallBackProps>\n }\n\ninterface TreeItemWithValue extends Omit<TreeItemProps, \"children\"> {}\n\ninterface TreeItemWithChildren extends TreeItemWithValue {\n children: TreeItem[]\n}\n\nexport type TreeItem = TreeItemWithChildren | TreeItemWithValue\n\nconst recursiveTreeItem = (items?: TreeItem[]) => {\n return items?.map((props, index) => {\n const key =\n props.value || (isString(props.label) ? `${props.label}-${index}` : index)\n\n if (\"children\" in props) {\n const { children, ...rest } = props\n\n return (\n <TreeItem key={key} {...rest}>\n {recursiveTreeItem(children)}\n </TreeItem>\n )\n } else {\n return <TreeItem key={key} {...props} />\n }\n })\n}\n\nconst getReactNodeOrFunction = (\n type: \"group\" | \"item\",\n custom?: TreeItemReactNode,\n root?: TreeItemReactNode,\n): ReactNodeOrFunction<TreeCallBackProps> => {\n if (isObject(custom) && (\"group\" in custom || \"item\" in custom)) {\n return custom[type]\n } else if (custom) {\n return custom\n } else if (isObject(root) && (\"group\" in root || \"item\" in root)) {\n return root[type]\n } else {\n return root\n }\n}\n\ninterface ComponentContext extends Pick<\n TreeRootProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorHidden\"\n | \"indicatorProps\"\n | \"itemProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"size\"\n | \"startElement\"\n | \"startElementProps\"\n> {}\n\ninterface ItemComponentContext {\n checkboxProps: TreeCheckboxProps\n endElementProps: TreeEndElementProps\n indicatorProps: TreeIndicatorProps\n labelProps: TreeLabelProps\n startElementProps: TreeStartElementProps\n}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({ name: \"ItemComponentContext\" })\n\nexport interface TreeRootProps<Multiple extends boolean = false>\n extends\n HTMLStyledProps<\"ul\">,\n ThemeProps<TreeStyle>,\n UseTreeProps<Multiple>,\n Pick<\n TreeItemProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"startElement\"\n | \"startElementProps\"\n > {\n /**\n * If `true`, hide the tree indicator icon for all items.\n *\n * @default false\n */\n indicatorHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: TreeItem[]\n /**\n * Props for the item component.\n */\n itemProps?: Omit<\n TreeItemProps,\n \"children\" | \"label\" | \"open\" | \"query\" | \"value\"\n >\n}\n\nconst {\n ComponentContext,\n PropsContext: TreePropsContext,\n useComponentContext,\n usePropsContext: useTreePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<TreeRootProps, TreeStyle, ComponentContext>(\n \"tree\",\n treeStyle,\n)\n\nexport { TreePropsContext, useTreePropsContext }\n\n/**\n * `Tree` is a component used to display hierarchical data structures in an expandable tree format.\n *\n * @see https://yamada-ui.com/docs/components/tree\n */\nexport const TreeRoot = withProvider<\"ul\", TreeRootProps, \"size\">(\n <Multiple extends boolean = false>({\n size,\n animated,\n children,\n endElement,\n indicator,\n indicatorHidden,\n items,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n ...rest\n }: TreeRootProps<Multiple>) => {\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return recursiveTreeItem(items)\n }, [children, items])\n const {\n activeDescendant,\n checkable,\n checkedValue,\n descendants,\n expandedValue,\n multiple,\n selectedValue,\n getRootProps,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n } = useTree({ ...rest, children: computedChildren })\n const context = useMemo(\n () => ({\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n }),\n [\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onSearch,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSelectedChange,\n ],\n )\n const componentContext = useMemo(\n () => ({\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n }),\n [\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n startElement,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n checkboxProps,\n loadingScheme,\n ],\n )\n\n return (\n <TreeDescendantsContext value={descendants}>\n <TreeContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.ul {...getRootProps()} />\n </ComponentContext>\n </TreeContext>\n </TreeDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"size\"] },\n)() as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: TreeRootProps<Multiple>,\n ): ReactElement\n}>\n\nexport interface TreeItemProps\n extends HTMLStyledProps<\"div\">, Omit<UseTreeItemProps, \"asyncChildren\"> {\n /**\n * The label to display in the item.\n */\n label: ReactNode\n /**\n * If `true`, the tree item will be animated.\n *\n * @default false\n */\n animated?: boolean\n /**\n * The element to display at the end of the item.\n */\n endElement?: TreeItemReactNode\n /**\n * The tree indicator icon to use.\n */\n indicator?: ReactNodeOrFunction<TreeCallBackProps>\n /**\n * The loading scheme.\n *\n * @default 'oval'\n */\n loadingScheme?: Loading.Scheme\n /**\n * The element to display at the start of the item.\n */\n startElement?: TreeItemReactNode\n /**\n * Props for the checkbox component.\n */\n checkboxProps?: Omit<CheckboxProps, \"checked\" | \"defaultChecked\" | \"value\">\n /**\n * Props for the end component.\n */\n endElementProps?: TreeEndElementProps\n /**\n * Props for the group component.\n */\n groupProps?: Omit<TreeGroupProps, \"children\">\n /**\n * Props for the indicator component.\n */\n indicatorProps?: TreeIndicatorProps\n /**\n * Props for the label component.\n */\n labelProps?: TreeLabelProps\n /**\n * Props for the root element.\n */\n rootProps?: HTMLStyledProps<\"li\">\n /**\n * Props for the start component.\n */\n startElementProps?: TreeStartElementProps\n /**\n * If provided, the tree item will be rendered as an async tree item.\n */\n asyncChildren?: () => Promise<TreeItem[]>\n}\n\nexport const TreeItem = withContext<\"div\", TreeItemProps>(\n ({\n className,\n css,\n colorScheme,\n animated: animatedProp,\n asyncChildren: asyncChildrenProp,\n endElement,\n indicator: indicatorProp,\n label,\n loadingScheme,\n query,\n startElement,\n value: valueProp = isString(label) ? label : undefined,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n labelProps,\n rootProps,\n startElementProps,\n ...rest\n }) => {\n const { checkable } = useTreeContext()\n const componentContext = useComponentContext()\n const Loading = useLoadingComponent(\n loadingScheme ?? componentContext.loadingScheme ?? \"oval\",\n )\n const animated = animatedProp ?? componentContext.animated\n const indicator = indicatorProp ?? componentContext.indicator\n const groupStartElement = getReactNodeOrFunction(\n \"group\",\n startElement,\n componentContext.startElement,\n )\n const groupEndElement = getReactNodeOrFunction(\n \"group\",\n endElement,\n componentContext.endElement,\n )\n const itemStartElement = getReactNodeOrFunction(\n \"item\",\n startElement,\n componentContext.startElement,\n )\n const itemEndElement = getReactNodeOrFunction(\n \"item\",\n endElement,\n componentContext.endElement,\n )\n const asyncChildren = useCallback(async () => {\n const items = await asyncChildrenProp?.()\n\n return recursiveTreeItem(items)\n }, [asyncChildrenProp])\n const {\n branchOpen,\n children,\n disabled,\n group,\n groupLoading,\n groupOpen,\n level,\n props,\n value,\n getCheckboxProps,\n getGroupItemProps,\n getGroupProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n } = useTreeItem({\n ...componentContext.itemProps,\n ...rest,\n asyncChildren: asyncChildrenProp ? asyncChildren : undefined,\n query: query ?? (isString(label) ? label : undefined),\n value: valueProp,\n })\n const itemProps = {\n className,\n css,\n colorScheme,\n \"--level\": level.toString(),\n ...rootProps,\n }\n const callbackProps = { disabled, expanded: groupOpen }\n const context = useMemo(\n () => ({\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n }),\n [\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n ],\n )\n const itemComponentContext = useMemo(\n () => ({\n checkboxProps: {\n size: componentContext.size,\n ...getCheckboxProps({\n ...componentContext.checkboxProps,\n ...checkboxProps,\n }),\n },\n endElementProps: {\n ...componentContext.endElementProps,\n ...endElementProps,\n },\n indicatorProps: {\n ...getIndicatorProps({\n ...componentContext.indicatorProps,\n ...indicatorProps,\n }),\n },\n labelProps: {\n ...getLabelProps({\n ...componentContext.labelProps,\n ...labelProps,\n }),\n },\n startElementProps: {\n ...componentContext.startElementProps,\n ...startElementProps,\n },\n }),\n [\n checkboxProps,\n componentContext.checkboxProps,\n componentContext.endElementProps,\n componentContext.indicatorProps,\n componentContext.labelProps,\n componentContext.size,\n componentContext.startElementProps,\n endElementProps,\n getCheckboxProps,\n getIndicatorProps,\n getLabelProps,\n indicatorProps,\n labelProps,\n startElementProps,\n ],\n )\n\n return (\n <TreeItemContext value={context}>\n <ItemComponentContext value={itemComponentContext}>\n {group ? (\n <styled.li {...getGroupItemProps(itemProps)}>\n <styled.div data-content {...props}>\n <TreeIndicator data-animated={dataAttr(animated)}>\n {groupLoading ? (\n <Loading />\n ) : (\n runIfFn(indicator, callbackProps)\n )}\n </TreeIndicator>\n {checkable ? <TreeCheckbox /> : null}\n {groupStartElement ? (\n <TreeStartElement>\n {runIfFn(groupStartElement, callbackProps)}\n </TreeStartElement>\n ) : null}\n {label ? <TreeLabel>{label}</TreeLabel> : null}\n {groupEndElement ? (\n <TreeEndElement>\n {runIfFn(groupEndElement, callbackProps)}\n </TreeEndElement>\n ) : null}\n </styled.div>\n\n <TreeGroup\n duration={!animated ? 0 : undefined}\n open={groupOpen}\n {...getGroupProps({\n ...componentContext.groupProps,\n ...groupProps,\n })}\n >\n {children}\n </TreeGroup>\n </styled.li>\n ) : (\n <styled.li {...getItemProps(itemProps)}>\n <styled.div data-content {...props}>\n <TreeIndicator data-hidden />\n {checkable ? <TreeCheckbox /> : null}\n {itemStartElement ? (\n <TreeStartElement>\n {runIfFn(itemStartElement, callbackProps)}\n </TreeStartElement>\n ) : null}\n {label ? <TreeLabel>{label}</TreeLabel> : null}\n {itemEndElement ? (\n <TreeEndElement>\n {runIfFn(itemEndElement, callbackProps)}\n </TreeEndElement>\n ) : null}\n </styled.div>\n </styled.li>\n )}\n </ItemComponentContext>\n </TreeItemContext>\n )\n },\n \"item\",\n)()\n\ninterface TreeGroupProps\n extends\n Omit<HTMLStyledProps<\"ul\">, \"transition\">,\n Pick<CollapseProps, \"animationOpacity\" | keyof WithTransitionProps> {}\n\nconst TreeGroup = withContext<\"ul\", TreeGroupProps>((props) => {\n return <Collapse as=\"ul\" {...cast<CollapseProps>(props)} />\n}, \"group\")()\n\ninterface TreeIndicatorProps extends HTMLStyledProps<\"svg\"> {}\n\nconst TreeIndicator = withContext<\"svg\", TreeIndicatorProps>(\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { indicatorHidden } = useComponentContext()\n\n if (indicatorHidden) return null\n\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, { ...rest, ...children.props })\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n \"indicator\",\n)(undefined, (props) => {\n const { indicatorProps } = useItemComponentContext()\n\n return mergeProps(indicatorProps, props)()\n})\n\ninterface TreeCheckboxProps extends CheckboxProps {}\n\nconst TreeCheckbox = withContext<\"input\", TreeCheckboxProps>(\n Checkbox,\n \"checkbox\",\n)(undefined, (props) => {\n const { checkboxProps } = useItemComponentContext()\n\n return mergeProps(checkboxProps, props)()\n})\n\ninterface TreeStartElementProps extends HTMLStyledProps {}\n\nconst TreeStartElement = withContext<\"div\", TreeStartElementProps>(\"div\", {\n name: \"StartElement\",\n slot: [\"element\", \"start\"],\n})(undefined, (props) => {\n const { startElementProps } = useItemComponentContext()\n\n return mergeProps(startElementProps, props)()\n})\n\ninterface TreeEndElementProps extends HTMLStyledProps {}\n\nconst TreeEndElement = withContext<\"div\", TreeEndElementProps>(\"div\", {\n name: \"EndElement\",\n slot: [\"element\", \"end\"],\n})(undefined, (props) => {\n const { endElementProps } = useItemComponentContext()\n\n return mergeProps(endElementProps, props)()\n})\n\ninterface TreeLabelProps extends HTMLStyledProps<\"span\"> {}\n\nconst TreeLabel = withContext<\"span\", TreeLabelProps>(\"span\", \"label\")(\n undefined,\n (props) => {\n const { labelProps } = useItemComponentContext()\n\n return mergeProps(labelProps, props)()\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;AAsEA,MAAM,qBAAqB,UAAuB;CAChD,OAAO,OAAO,KAAK,OAAO,UAAU;EAClC,MAAM,MACJ,MAAM,WAAA,GAAA,oBAAA,cAAA,SAAA,CAAmB,MAAM,KAAK,IAAI,GAAG,MAAM,MAAM,GAAG,UAAU;EAEtE,IAAI,cAAc,OAAO;GACvB,MAAM,EAAE,UAAU,GAAG,SAAS;GAE9B,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;IAAoB,G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IACA;GACF,IACA;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF,CAuC4B;aACxB,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;IAAkB,QAAA,GAAA,MAAA,QAAA,QArCf;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACF,IACA;KACE;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACF,CAM4C;cACtC,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,OAAO,IAAR,EAAW,GAAI,aAAa,EAAI,CAAA;GAChB,CAAA;EACP,CAAA;CACS,CAAA;AAE5B,GACA,QACA,EAAE,eAAe,CAAC,MAAM,EAAE,CAC5B,CAAC,CAAC;AAsEF,MAAa,WAAW,aACrB,EACC,WACA,KACA,aACA,UAAU,cACV,eAAe,mBACf,YACA,WAAW,eACX,OACA,eACA,OACA,cACA,OAAO,aAAA,GAAA,oBAAA,cAAA,SAAA,CAAqB,KAAK,IAAI,QAAQ,KAAA,GAC7C,eACA,iBACA,YACA,gBACA,YACA,WACA,mBACA,GAAG,WACC;CACJ,MAAM,EAAE,cAAcC,iBAAAA,eAAe;CACrC,MAAM,mBAAmB,oBAAoB;CAC7C,MAAM,UAAUC,8BAAAA,oBACd,iBAAiB,iBAAiB,iBAAiB,MACrD;CACA,MAAM,WAAW,gBAAgB,iBAAiB;CAClD,MAAM,YAAY,iBAAiB,iBAAiB;CACpD,MAAM,oBAAoB,uBACxB,SACA,cACA,iBAAiB,YACnB;CACA,MAAM,kBAAkB,uBACtB,SACA,YACA,iBAAiB,UACnB;CACA,MAAM,mBAAmB,uBACvB,QACA,cACA,iBAAiB,YACnB;CACA,MAAM,iBAAiB,uBACrB,QACA,YACA,iBAAiB,UACnB;CACA,MAAM,iBAAA,GAAA,MAAA,YAAA,CAA4B,YAAY;EAG5C,OAAO,kBAAkB,MAFL,oB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e,YACnBC,iBAAAA,UACA,UACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,kBAAkB,wBAAwB;CAElD,OAAOD,cAAAA,WAAW,eAAe,KAAK,CAAC,CAAC;AAC1C,CAAC;AAID,MAAM,mBAAmB,YAA0C,OAAO;CACxE,MAAM;CACN,MAAM,CAAC,WAAW,OAAO;AAC3B,CAAC,CAAC,CAAC,KAAA,IAAY,UAAU;CACvB,MAAM,EAAE,sBAAsB,wBAAwB;CAEtD,OAAOA,cAAAA,WAAW,mBAAmB,KAAK,CAAC,CAAC;AAC9C,CAAC;AAID,MAAM,iBAAiB,YAAwC,OAAO;CACpE,MAAM;CACN,MAAM,CAAC,WAAW,KAAK;AACzB,CAAC,CAAC,CAAC,KAAA,IAAY,UAAU;CACvB,MAAM,EAAE,oBAAoB,wBAAwB;CAEpD,OAAOA,cAAAA,WAAW,iBAAiB,KAAK,CAAC,CAAC;AAC5C,CAAC;AAID,MAAM,YAAY,YAAoC,QAAQ,OAAO,CAAC,CACpE,KAAA,IACC,UAAU;CACT,MAAM,EAAE,eAAe,wBAAwB;CAE/C,OAAOA,cAAAA,WAAW,YAAY,KAAK,CAAC,CAAC;AACvC,CACF"}
|
|
1
|
+
{"version":3,"file":"tree.cjs","names":["createContext","createSlotComponent","treeStyle","useTree","TreeDescendantsContext","TreeContext","styled","useTreeContext","useLoadingComponent","useTreeItem","TreeItemContext","Collapse","ChevronRightIcon","Children","mergeProps","Checkbox"],"sources":["../../../../src/components/tree/tree.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n} from \"../../core\"\nimport type { CheckboxProps } from \"../checkbox\"\nimport type { CollapseProps } from \"../collapse\"\nimport type { Loading } from \"../loading\"\nimport type { WithTransitionProps } from \"../motion\"\nimport type { TreeStyle } from \"./tree.style\"\nimport type { UseTreeItemProps, UseTreeProps } from \"./use-tree\"\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useMemo,\n} from \"react\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport {\n cast,\n createContext,\n dataAttr,\n isObject,\n isString,\n type ReactNodeOrFunction,\n runIfFn,\n} from \"../../utils\"\nimport { Checkbox } from \"../checkbox\"\nimport { Collapse } from \"../collapse\"\nimport { ChevronRightIcon } from \"../icon\"\nimport { useLoadingComponent } from \"../loading\"\nimport { treeStyle } from \"./tree.style\"\nimport {\n TreeContext,\n TreeDescendantsContext,\n TreeItemContext,\n useTree,\n useTreeContext,\n useTreeItem,\n} from \"./use-tree\"\n\ninterface TreeCallBackProps {\n disabled?: boolean\n expanded?: boolean\n}\n\ntype TreeItemReactNode =\n | ReactNodeOrFunction<TreeCallBackProps>\n | {\n group: ReactNodeOrFunction<TreeCallBackProps>\n item?: ReactNodeOrFunction<TreeCallBackProps>\n }\n | {\n item: ReactNodeOrFunction<TreeCallBackProps>\n group?: ReactNodeOrFunction<TreeCallBackProps>\n }\n\ninterface TreeItemWithValue extends Omit<TreeItemProps, \"children\"> {}\n\ninterface TreeItemWithChildren extends TreeItemWithValue {\n children: TreeItem[]\n}\n\nexport type TreeItem = TreeItemWithChildren | TreeItemWithValue\n\nconst recursiveTreeItem = (items?: TreeItem[]) => {\n return items?.map((props, index) => {\n const key =\n props.value || (isString(props.label) ? `${props.label}-${index}` : index)\n\n if (\"children\" in props) {\n const { children, ...rest } = props\n\n return (\n <TreeItem key={key} {...rest}>\n {recursiveTreeItem(children)}\n </TreeItem>\n )\n } else {\n return <TreeItem key={key} {...props} />\n }\n })\n}\n\nconst getReactNodeOrFunction = (\n type: \"group\" | \"item\",\n custom?: TreeItemReactNode,\n root?: TreeItemReactNode,\n): ReactNodeOrFunction<TreeCallBackProps> => {\n if (isObject(custom) && (\"group\" in custom || \"item\" in custom))\n return custom[type]\n else if (custom) return custom\n else if (isObject(root) && (\"group\" in root || \"item\" in root))\n return root[type]\n else return root\n}\n\ninterface ComponentContext extends Pick<\n TreeRootProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorHidden\"\n | \"indicatorProps\"\n | \"itemProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"size\"\n | \"startElement\"\n | \"startElementProps\"\n> {}\n\ninterface ItemComponentContext {\n checkboxProps: TreeCheckboxProps\n endElementProps: TreeEndElementProps\n indicatorProps: TreeIndicatorProps\n labelProps: TreeLabelProps\n startElementProps: TreeStartElementProps\n}\n\nconst [ItemComponentContext, useItemComponentContext] =\n createContext<ItemComponentContext>({ name: \"ItemComponentContext\" })\n\nexport interface TreeRootProps<Multiple extends boolean = false>\n extends\n HTMLStyledProps<\"ul\">,\n ThemeProps<TreeStyle>,\n UseTreeProps<Multiple>,\n Pick<\n TreeItemProps,\n | \"animated\"\n | \"checkboxProps\"\n | \"endElement\"\n | \"endElementProps\"\n | \"groupProps\"\n | \"indicator\"\n | \"indicatorProps\"\n | \"labelProps\"\n | \"loadingScheme\"\n | \"startElement\"\n | \"startElementProps\"\n > {\n /**\n * If `true`, hide the tree indicator icon for all items.\n *\n * @default false\n */\n indicatorHidden?: boolean\n /**\n * If provided, generate elements based on items.\n */\n items?: TreeItem[]\n /**\n * Props for the item component.\n */\n itemProps?: Omit<\n TreeItemProps,\n \"children\" | \"label\" | \"open\" | \"query\" | \"value\"\n >\n}\n\nconst {\n ComponentContext,\n PropsContext: TreePropsContext,\n useComponentContext,\n usePropsContext: useTreePropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<TreeRootProps, TreeStyle, ComponentContext>(\n \"tree\",\n treeStyle,\n)\n\nexport { TreePropsContext, useTreePropsContext }\n\n/**\n * `Tree` is a component used to display hierarchical data structures in an expandable tree format.\n *\n * @see https://yamada-ui.com/docs/components/tree\n */\nexport const TreeRoot = withProvider<\"ul\", TreeRootProps, \"size\">(\n <Multiple extends boolean = false>({\n size,\n animated,\n children,\n endElement,\n indicator,\n indicatorHidden,\n items,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n ...rest\n }: TreeRootProps<Multiple>) => {\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return recursiveTreeItem(items)\n }, [children, items])\n const {\n activeDescendant,\n checkable,\n checkedValue,\n descendants,\n expandedValue,\n multiple,\n selectedValue,\n getRootProps,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n } = useTree({ ...rest, children: computedChildren })\n const context = useMemo(\n () => ({\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSearch,\n onSelectedChange,\n }),\n [\n activeDescendant,\n checkable,\n checkedValue,\n expandedValue,\n multiple,\n selectedValue,\n onActiveDescendant,\n onCheckedChange,\n onSearch,\n onCollapseAll,\n onExpandAll,\n onExpandedChange,\n onSelectedChange,\n ],\n )\n const componentContext = useMemo(\n () => ({\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n loadingScheme,\n startElement,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n }),\n [\n size,\n animated,\n endElement,\n indicator,\n indicatorHidden,\n startElement,\n endElementProps,\n groupProps,\n indicatorProps,\n itemProps,\n labelProps,\n startElementProps,\n checkboxProps,\n loadingScheme,\n ],\n )\n\n return (\n <TreeDescendantsContext value={descendants}>\n <TreeContext value={context}>\n <ComponentContext value={componentContext}>\n <styled.ul {...getRootProps()} />\n </ComponentContext>\n </TreeContext>\n </TreeDescendantsContext>\n )\n },\n \"root\",\n { transferProps: [\"size\"] },\n)() as GenericsComponent<{\n <Multiple extends boolean = false>(\n props: TreeRootProps<Multiple>,\n ): ReactElement\n}>\n\nexport interface TreeItemProps\n extends HTMLStyledProps<\"div\">, Omit<UseTreeItemProps, \"asyncChildren\"> {\n /**\n * The label to display in the item.\n */\n label: ReactNode\n /**\n * If `true`, the tree item will be animated.\n *\n * @default false\n */\n animated?: boolean\n /**\n * The element to display at the end of the item.\n */\n endElement?: TreeItemReactNode\n /**\n * The tree indicator icon to use.\n */\n indicator?: ReactNodeOrFunction<TreeCallBackProps>\n /**\n * The loading scheme.\n *\n * @default 'oval'\n */\n loadingScheme?: Loading.Scheme\n /**\n * The element to display at the start of the item.\n */\n startElement?: TreeItemReactNode\n /**\n * Props for the checkbox component.\n */\n checkboxProps?: Omit<CheckboxProps, \"checked\" | \"defaultChecked\" | \"value\">\n /**\n * Props for the end component.\n */\n endElementProps?: TreeEndElementProps\n /**\n * Props for the group component.\n */\n groupProps?: Omit<TreeGroupProps, \"children\">\n /**\n * Props for the indicator component.\n */\n indicatorProps?: TreeIndicatorProps\n /**\n * Props for the label component.\n */\n labelProps?: TreeLabelProps\n /**\n * Props for the root element.\n */\n rootProps?: HTMLStyledProps<\"li\">\n /**\n * Props for the start component.\n */\n startElementProps?: TreeStartElementProps\n /**\n * If provided, the tree item will be rendered as an async tree item.\n */\n asyncChildren?: () => Promise<TreeItem[]>\n}\n\nexport const TreeItem = withContext<\"div\", TreeItemProps>(\n ({\n className,\n css,\n colorScheme,\n animated: animatedProp,\n asyncChildren: asyncChildrenProp,\n endElement,\n indicator: indicatorProp,\n label,\n loadingScheme,\n query,\n startElement,\n value: valueProp = isString(label) ? label : undefined,\n checkboxProps,\n endElementProps,\n groupProps,\n indicatorProps,\n labelProps,\n rootProps,\n startElementProps,\n ...rest\n }) => {\n const { checkable } = useTreeContext()\n const componentContext = useComponentContext()\n const Loading = useLoadingComponent(\n loadingScheme ?? componentContext.loadingScheme ?? \"oval\",\n )\n const animated = animatedProp ?? componentContext.animated\n const indicator = indicatorProp ?? componentContext.indicator\n const groupStartElement = getReactNodeOrFunction(\n \"group\",\n startElement,\n componentContext.startElement,\n )\n const groupEndElement = getReactNodeOrFunction(\n \"group\",\n endElement,\n componentContext.endElement,\n )\n const itemStartElement = getReactNodeOrFunction(\n \"item\",\n startElement,\n componentContext.startElement,\n )\n const itemEndElement = getReactNodeOrFunction(\n \"item\",\n endElement,\n componentContext.endElement,\n )\n const asyncChildren = useCallback(async () => {\n const items = await asyncChildrenProp?.()\n\n return recursiveTreeItem(items)\n }, [asyncChildrenProp])\n const {\n branchOpen,\n children,\n disabled,\n group,\n groupLoading,\n groupOpen,\n level,\n props,\n value,\n getCheckboxProps,\n getGroupItemProps,\n getGroupProps,\n getIndicatorProps,\n getItemProps,\n getLabelProps,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n } = useTreeItem({\n ...componentContext.itemProps,\n ...rest,\n asyncChildren: asyncChildrenProp ? asyncChildren : undefined,\n query: query ?? (isString(label) ? label : undefined),\n value: valueProp,\n })\n const itemProps = {\n className,\n css,\n colorScheme,\n \"--level\": level.toString(),\n ...rootProps,\n }\n const callbackProps = { disabled, expanded: groupOpen }\n const context = useMemo(\n () => ({\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n }),\n [\n branchOpen,\n groupOpen,\n level,\n value,\n onGroupClose,\n onGroupOpen,\n onGroupToggle,\n ],\n )\n const itemComponentContext = useMemo(\n () => ({\n checkboxProps: {\n size: componentContext.size,\n ...getCheckboxProps({\n ...componentContext.checkboxProps,\n ...checkboxProps,\n }),\n },\n endElementProps: {\n ...componentContext.endElementProps,\n ...endElementProps,\n },\n indicatorProps: {\n ...getIndicatorProps({\n ...componentContext.indicatorProps,\n ...indicatorProps,\n }),\n },\n labelProps: {\n ...getLabelProps({\n ...componentContext.labelProps,\n ...labelProps,\n }),\n },\n startElementProps: {\n ...componentContext.startElementProps,\n ...startElementProps,\n },\n }),\n [\n checkboxProps,\n componentContext.checkboxProps,\n componentContext.endElementProps,\n componentContext.indicatorProps,\n componentContext.labelProps,\n componentContext.size,\n componentContext.startElementProps,\n endElementProps,\n getCheckboxProps,\n getIndicatorProps,\n getLabelProps,\n indicatorProps,\n labelProps,\n startElementProps,\n ],\n )\n\n return (\n <TreeItemContext value={context}>\n <ItemComponentContext value={itemComponentContext}>\n {group ? (\n <styled.li {...getGroupItemProps(itemProps)}>\n <styled.div data-content {...props}>\n <TreeIndicator data-animated={dataAttr(animated)}>\n {groupLoading ? (\n <Loading />\n ) : (\n runIfFn(indicator, callbackProps)\n )}\n </TreeIndicator>\n {checkable ? <TreeCheckbox /> : null}\n {groupStartElement ? (\n <TreeStartElement>\n {runIfFn(groupStartElement, callbackProps)}\n </TreeStartElement>\n ) : null}\n {label ? <TreeLabel>{label}</TreeLabel> : null}\n {groupEndElement ? (\n <TreeEndElement>\n {runIfFn(groupEndElement, callbackProps)}\n </TreeEndElement>\n ) : null}\n </styled.div>\n\n <TreeGroup\n duration={!animated ? 0 : undefined}\n open={groupOpen}\n {...getGroupProps({\n ...componentContext.groupProps,\n ...groupProps,\n })}\n >\n {children}\n </TreeGroup>\n </styled.li>\n ) : (\n <styled.li {...getItemProps(itemProps)}>\n <styled.div data-content {...props}>\n <TreeIndicator data-hidden />\n {checkable ? <TreeCheckbox /> : null}\n {itemStartElement ? (\n <TreeStartElement>\n {runIfFn(itemStartElement, callbackProps)}\n </TreeStartElement>\n ) : null}\n {label ? <TreeLabel>{label}</TreeLabel> : null}\n {itemEndElement ? (\n <TreeEndElement>\n {runIfFn(itemEndElement, callbackProps)}\n </TreeEndElement>\n ) : null}\n </styled.div>\n </styled.li>\n )}\n </ItemComponentContext>\n </TreeItemContext>\n )\n },\n \"item\",\n)()\n\ninterface TreeGroupProps\n extends\n Omit<HTMLStyledProps<\"ul\">, \"transition\">,\n Pick<CollapseProps, \"animationOpacity\" | keyof WithTransitionProps> {}\n\nconst TreeGroup = withContext<\"ul\", TreeGroupProps>((props) => {\n return <Collapse as=\"ul\" {...cast<CollapseProps>(props)} />\n}, \"group\")()\n\ninterface TreeIndicatorProps extends HTMLStyledProps<\"svg\"> {}\n\nconst TreeIndicator = withContext<\"svg\", TreeIndicatorProps>(\n ({ children = <ChevronRightIcon />, ...rest }) => {\n const { indicatorHidden } = useComponentContext()\n\n if (indicatorHidden) return null\n\n if (isValidElement<HTMLProps<\"svg\">>(children))\n return cloneElement(children, { ...rest, ...children.props })\n\n return Children.count(children) > 1 ? Children.only(null) : null\n },\n \"indicator\",\n)(undefined, (props) => {\n const { indicatorProps } = useItemComponentContext()\n\n return mergeProps(indicatorProps, props)()\n})\n\ninterface TreeCheckboxProps extends CheckboxProps {}\n\nconst TreeCheckbox = withContext<\"input\", TreeCheckboxProps>(\n Checkbox,\n \"checkbox\",\n)(undefined, (props) => {\n const { checkboxProps } = useItemComponentContext()\n\n return mergeProps(checkboxProps, props)()\n})\n\ninterface TreeStartElementProps extends HTMLStyledProps {}\n\nconst TreeStartElement = withContext<\"div\", TreeStartElementProps>(\"div\", {\n name: \"StartElement\",\n slot: [\"element\", \"start\"],\n})(undefined, (props) => {\n const { startElementProps } = useItemComponentContext()\n\n return mergeProps(startElementProps, props)()\n})\n\ninterface TreeEndElementProps extends HTMLStyledProps {}\n\nconst TreeEndElement = withContext<\"div\", TreeEndElementProps>(\"div\", {\n name: \"EndElement\",\n slot: [\"element\", \"end\"],\n})(undefined, (props) => {\n const { endElementProps } = useItemComponentContext()\n\n return mergeProps(endElementProps, props)()\n})\n\ninterface TreeLabelProps extends HTMLStyledProps<\"span\"> {}\n\nconst TreeLabel = withContext<\"span\", TreeLabelProps>(\"span\", \"label\")(\n undefined,\n (props) => {\n const { labelProps } = useItemComponentContext()\n\n return mergeProps(labelProps, props)()\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;AAsEA,MAAM,qBAAqB,UAAuB;CAChD,OAAO,OAAO,KAAK,OAAO,UAAU;EAClC,MAAM,MACJ,MAAM,WAAA,GAAA,oBAAA,cAAA,SAAA,CAAmB,MAAM,KAAK,IAAI,GAAG,MAAM,MAAM,GAAG,UAAU;EAEtE,IA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ACC,iBAAAA,aAAD;GAAa,QAAA,GAAA,MAAA,QAAA,QApER;IACL;IACA;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;IACA;GACF,CAuC4B;aACxB,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;IAAkB,QAAA,GAAA,MAAA,QAAA,QArCf;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACF,IACA;KACE;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACF,CAM4C;cACtC,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,OAAO,IAAR,EAAW,GAAI,aAAa,EAAI,CAAA;GAChB,CAAA;EACP,CAAA;CACS,CAAA;AAE5B,GACA,QACA,EAAE,eAAe,CAAC,MAAM,EAAE,CAC5B,CAAC,CAAC;AAsEF,MAAa,WAAW,aACrB,EACC,WACA,KACA,aACA,UAAU,cACV,eAAe,mBACf,YACA,WAAW,eACX,OACA,eACA,OACA,cACA,OAAO,aAAA,GAAA,oBAAA,cAAA,SAAA,CAAqB,KAAK,IAAI,QAAQ,KAAA,GAC7C,eACA,iBACA,YACA,gBACA,YACA,WACA,mBACA,GAAG,WACC;CACJ,MAAM,EAAE,cAAcC,iBAAAA,eAAe;CACrC,MAAM,mBAAmB,oBAAoB;CAC7C,MAAM,UAAUC,8BAAAA,oBACd,iBAAiB,iBAAiB,iBAAiB,MACrD;CACA,MAAM,WAAW,gBAAgB,iBAAiB;CAClD,MAAM,YAAY,iBAAiB,iBAAiB;CACpD,MAAM,oBAAoB,uBACxB,SACA,cACA,iBAAiB,YACnB;CACA,MAAM,kBAAkB,uBACtB,SACA,YACA,iBAAiB,UACnB;CACA,MAAM,mBAAmB,uBACvB,QACA,cACA,iBAAiB,YACnB;CACA,MAAM,iBAAiB,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