@yamada-ui/react 2.2.0 → 2.3.0-next-20260411030430
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/avatar/avatar-group.cjs +6 -3
- package/dist/cjs/components/avatar/avatar-group.cjs.map +1 -1
- package/dist/cjs/components/checkbox/checkbox-group.cjs +6 -4
- package/dist/cjs/components/checkbox/checkbox-group.cjs.map +1 -1
- package/dist/cjs/components/checkbox-card/checkbox-card-group.cjs +5 -3
- package/dist/cjs/components/checkbox-card/checkbox-card-group.cjs.map +1 -1
- package/dist/cjs/components/menu/menu.cjs +45 -42
- package/dist/cjs/components/menu/menu.cjs.map +1 -1
- package/dist/cjs/components/native-popover/native-popover.cjs +26 -23
- package/dist/cjs/components/native-popover/native-popover.cjs.map +1 -1
- package/dist/cjs/components/popover/popover.cjs +34 -31
- package/dist/cjs/components/popover/popover.cjs.map +1 -1
- package/dist/cjs/components/radio/radio-group.cjs +6 -4
- package/dist/cjs/components/radio/radio-group.cjs.map +1 -1
- package/dist/cjs/components/radio-card/radio-card-group.cjs +5 -3
- package/dist/cjs/components/radio-card/radio-card-group.cjs.map +1 -1
- package/dist/cjs/components/toggle/toggle-group.cjs +6 -4
- package/dist/cjs/components/toggle/toggle-group.cjs.map +1 -1
- package/dist/cjs/components/tooltip/tooltip.cjs +23 -18
- package/dist/cjs/components/tooltip/tooltip.cjs.map +1 -1
- package/dist/cjs/core/components/create-component.cjs +31 -6
- package/dist/cjs/core/components/create-component.cjs.map +1 -1
- package/dist/esm/components/avatar/avatar-group.js +6 -3
- package/dist/esm/components/avatar/avatar-group.js.map +1 -1
- package/dist/esm/components/checkbox/checkbox-group.js +6 -4
- package/dist/esm/components/checkbox/checkbox-group.js.map +1 -1
- package/dist/esm/components/checkbox-card/checkbox-card-group.js +5 -3
- package/dist/esm/components/checkbox-card/checkbox-card-group.js.map +1 -1
- package/dist/esm/components/menu/menu.js +45 -42
- package/dist/esm/components/menu/menu.js.map +1 -1
- package/dist/esm/components/native-popover/native-popover.js +26 -23
- package/dist/esm/components/native-popover/native-popover.js.map +1 -1
- package/dist/esm/components/popover/popover.js +34 -31
- package/dist/esm/components/popover/popover.js.map +1 -1
- package/dist/esm/components/radio/radio-group.js +6 -4
- package/dist/esm/components/radio/radio-group.js.map +1 -1
- package/dist/esm/components/radio-card/radio-card-group.js +5 -3
- package/dist/esm/components/radio-card/radio-card-group.js.map +1 -1
- package/dist/esm/components/toggle/toggle-group.js +6 -4
- package/dist/esm/components/toggle/toggle-group.js.map +1 -1
- package/dist/esm/components/tooltip/tooltip.js +23 -18
- package/dist/esm/components/tooltip/tooltip.js.map +1 -1
- package/dist/esm/core/components/create-component.js +31 -6
- package/dist/esm/core/components/create-component.js.map +1 -1
- package/dist/types/components/accordion/accordion.d.ts +2 -4
- package/dist/types/components/accordion/use-accordion.d.ts +11 -11
- package/dist/types/components/action-bar/action-bar.d.ts +2 -3
- package/dist/types/components/airy/airy.d.ts +2 -3
- package/dist/types/components/alert/alert.d.ts +2 -5
- package/dist/types/components/alert/alert.style.d.ts +1 -1
- package/dist/types/components/alpha-slider/alpha-slider.d.ts +2 -3
- package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +2 -2
- package/dist/types/components/autocomplete/autocomplete.d.ts +2 -4
- package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
- package/dist/types/components/autocomplete/use-autocomplete.d.ts +5 -7
- package/dist/types/components/avatar/avatar.d.ts +5 -5
- package/dist/types/components/avatar/avatar.style.d.ts +1 -1
- package/dist/types/components/avatar/use-avatar-group.d.ts +2 -2
- package/dist/types/components/badge/badge.d.ts +2 -2
- package/dist/types/components/bleed/bleed.d.ts +2 -2
- package/dist/types/components/blockquote/blockquote.d.ts +2 -2
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/types/components/breadcrumb/use-breadcrumb.d.ts +2 -2
- package/dist/types/components/button/button-group.d.ts +0 -1
- package/dist/types/components/button/button.d.ts +2 -3
- package/dist/types/components/button/icon-button.d.ts +2 -2
- package/dist/types/components/calendar/calendar.d.ts +2 -3
- package/dist/types/components/calendar/calendar.style.d.ts +2 -2
- package/dist/types/components/calendar/use-calendar.d.ts +8 -9
- package/dist/types/components/card/card.d.ts +2 -2
- package/dist/types/components/carousel/carousel.d.ts +2 -3
- package/dist/types/components/carousel/carousel.style.d.ts +2 -2
- package/dist/types/components/carousel/use-carousel.d.ts +3 -3
- package/dist/types/components/center/center.d.ts +2 -2
- package/dist/types/components/chart/area-chart.d.ts +2 -2
- package/dist/types/components/chart/bar-chart.d.ts +2 -2
- package/dist/types/components/chart/chart.d.ts +5 -5
- package/dist/types/components/chart/composed-chart.d.ts +2 -2
- package/dist/types/components/chart/donut-chart.d.ts +2 -2
- package/dist/types/components/chart/line-chart.d.ts +2 -2
- package/dist/types/components/chart/pie-chart.d.ts +2 -2
- package/dist/types/components/chart/radar-chart.d.ts +2 -2
- package/dist/types/components/chart/radial-chart.d.ts +2 -2
- package/dist/types/components/chart/use-chart.d.ts +2 -2
- package/dist/types/components/checkbox/checkbox-group.d.ts +0 -2
- package/dist/types/components/checkbox/checkbox.d.ts +5 -6
- package/dist/types/components/checkbox/checkbox.style.d.ts +1 -1
- package/dist/types/components/checkbox/use-checkbox-group.d.ts +2 -3
- package/dist/types/components/checkbox/use-checkbox.d.ts +0 -1
- package/dist/types/components/checkbox-card/checkbox-card-group.d.ts +0 -3
- package/dist/types/components/checkbox-card/checkbox-card.d.ts +5 -7
- package/dist/types/components/checkbox-card/checkbox-card.style.d.ts +1 -1
- package/dist/types/components/circle-progress/circle-progress.d.ts +2 -3
- package/dist/types/components/close-button/close-button.d.ts +2 -3
- package/dist/types/components/code/code.d.ts +2 -2
- package/dist/types/components/collapse/collapse.d.ts +2 -3
- package/dist/types/components/color-picker/color-picker.d.ts +2 -6
- package/dist/types/components/color-picker/color-picker.style.d.ts +1 -1
- package/dist/types/components/color-picker/use-color-picker.d.ts +2 -5
- package/dist/types/components/color-selector/color-selector.d.ts +2 -6
- package/dist/types/components/color-selector/color-selector.style.d.ts +2 -2
- package/dist/types/components/color-selector/use-color-selector.d.ts +3 -5
- package/dist/types/components/color-swatch/color-swatch.d.ts +2 -2
- package/dist/types/components/container/container.d.ts +2 -2
- package/dist/types/components/data-list/data-list.d.ts +2 -2
- package/dist/types/components/data-list/data-list.style.d.ts +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +2 -5
- package/dist/types/components/date-picker/use-date-picker.d.ts +4 -7
- package/dist/types/components/drawer/drawer.d.ts +2 -5
- package/dist/types/components/drawer/drawer.style.d.ts +2 -2
- package/dist/types/components/drawer/use-drawer.d.ts +0 -2
- package/dist/types/components/dropzone/dropzone.d.ts +5 -8
- package/dist/types/components/dropzone/dropzone.style.d.ts +1 -1
- package/dist/types/components/dropzone/use-dropzone.d.ts +0 -1
- package/dist/types/components/editable/editable.d.ts +2 -3
- package/dist/types/components/editable/use-editable.d.ts +2 -3
- package/dist/types/components/em/em.d.ts +2 -2
- package/dist/types/components/empty-state/empty-state.d.ts +2 -2
- package/dist/types/components/empty-state/empty-state.style.d.ts +2 -2
- package/dist/types/components/fade/fade.d.ts +2 -3
- package/dist/types/components/fade-scale/fade-scale.d.ts +0 -1
- package/dist/types/components/field/field.d.ts +3 -3
- package/dist/types/components/field/use-field-props.d.ts +4 -4
- package/dist/types/components/fieldset/fieldset.d.ts +3 -4
- package/dist/types/components/file-button/file-button.d.ts +2 -4
- package/dist/types/components/file-button/use-file-button.d.ts +18 -20
- package/dist/types/components/file-input/file-input.d.ts +2 -4
- package/dist/types/components/file-input/file-input.style.d.ts +1 -1
- package/dist/types/components/file-input/use-file-input.d.ts +17 -18
- package/dist/types/components/flex/flex.d.ts +2 -2
- package/dist/types/components/flip/flip.d.ts +4 -5
- package/dist/types/components/float/float.d.ts +2 -2
- package/dist/types/components/form/form.d.ts +3 -4
- package/dist/types/components/format/format-byte.d.ts +4 -4
- package/dist/types/components/format/format-date-time.d.ts +4 -4
- package/dist/types/components/format/format-number.d.ts +2 -2
- package/dist/types/components/format/use-format-byte.d.ts +0 -1
- package/dist/types/components/format/use-format-date-time.d.ts +0 -1
- package/dist/types/components/format/use-format-number.d.ts +0 -1
- package/dist/types/components/grid/grid-item.d.ts +2 -2
- package/dist/types/components/grid/grid.d.ts +2 -2
- package/dist/types/components/group/group.d.ts +2 -3
- package/dist/types/components/group/use-group.d.ts +2 -2
- package/dist/types/components/heading/heading.d.ts +2 -2
- package/dist/types/components/highlight/highlight.d.ts +0 -2
- package/dist/types/components/hue-slider/hue-slider.d.ts +3 -4
- package/dist/types/components/icon/icon.d.ts +4 -4
- package/dist/types/components/image/image.d.ts +2 -2
- package/dist/types/components/indicator/indicator.d.ts +4 -5
- package/dist/types/components/infinite-scroll-area/infinite-scroll-area.d.ts +2 -2
- package/dist/types/components/input/input-addon.d.ts +2 -2
- package/dist/types/components/input/input-element.d.ts +2 -2
- package/dist/types/components/input/input-group.d.ts +0 -2
- package/dist/types/components/input/input.d.ts +2 -3
- package/dist/types/components/kbd/kbd.d.ts +2 -2
- package/dist/types/components/link/link.d.ts +2 -2
- package/dist/types/components/link-box/link-box.d.ts +2 -2
- package/dist/types/components/list/list.d.ts +2 -2
- package/dist/types/components/loading/loading-provider.d.ts +2 -2
- package/dist/types/components/loading/loading.d.ts +3 -4
- package/dist/types/components/loading/use-loading-component.d.ts +0 -1
- package/dist/types/components/mark/mark.d.ts +2 -2
- package/dist/types/components/menu/menu.d.ts +2 -3
- package/dist/types/components/menu/use-menu.d.ts +11 -11
- package/dist/types/components/modal/modal.d.ts +2 -6
- package/dist/types/components/modal/modal.style.d.ts +2 -2
- package/dist/types/components/native-accordion/native-accordion.d.ts +2 -2
- package/dist/types/components/native-accordion/use-native-accordion.d.ts +2 -2
- package/dist/types/components/native-popover/native-popover.d.ts +4 -4
- package/dist/types/components/native-select/native-select.d.ts +2 -4
- package/dist/types/components/native-select/use-native-select.d.ts +0 -1
- package/dist/types/components/native-table/native-table.d.ts +4 -4
- package/dist/types/components/notice/notice.style.d.ts +1 -1
- package/dist/types/components/notice/use-notice.d.ts +0 -3
- package/dist/types/components/number-input/number-input.d.ts +2 -3
- package/dist/types/components/number-input/number-input.style.d.ts +1 -1
- package/dist/types/components/number-input/use-number-input.d.ts +0 -1
- package/dist/types/components/pagination/pagination.d.ts +2 -3
- package/dist/types/components/pagination/use-pagination.d.ts +2 -2
- package/dist/types/components/password-input/password-input.d.ts +2 -3
- package/dist/types/components/password-input/strength-meter.d.ts +2 -2
- package/dist/types/components/password-input/strength-meter.style.d.ts +1 -1
- package/dist/types/components/password-input/use-password-input.d.ts +2 -3
- package/dist/types/components/picture/picture.d.ts +0 -1
- package/dist/types/components/pin-input/pin-input.d.ts +2 -4
- package/dist/types/components/pin-input/use-pin-input.d.ts +7 -8
- package/dist/types/components/popover/popover.d.ts +4 -5
- package/dist/types/components/progress/progress.d.ts +4 -4
- package/dist/types/components/progress/use-progress.d.ts +706 -706
- package/dist/types/components/qr-code/qr-code.d.ts +2 -2
- package/dist/types/components/radio/radio-group.d.ts +0 -2
- package/dist/types/components/radio/radio.d.ts +5 -6
- package/dist/types/components/radio/radio.style.d.ts +1 -1
- package/dist/types/components/radio/use-radio-group.d.ts +2 -3
- package/dist/types/components/radio/use-radio.d.ts +0 -1
- package/dist/types/components/radio-card/radio-card-group.d.ts +0 -3
- package/dist/types/components/radio-card/radio-card.d.ts +5 -7
- package/dist/types/components/radio-card/radio-card.style.d.ts +1 -1
- package/dist/types/components/rating/use-rating.d.ts +7 -8
- package/dist/types/components/reorder/reorder.d.ts +2 -3
- package/dist/types/components/reorder/reorder.style.d.ts +1 -1
- package/dist/types/components/reorder/use-reorder.d.ts +3 -3
- package/dist/types/components/resizable/resizable.d.ts +2 -2
- package/dist/types/components/resizable/resizable.style.d.ts +2 -2
- package/dist/types/components/resizable/use-resizable.d.ts +2 -2
- package/dist/types/components/ripple/ripple.d.ts +2 -3
- package/dist/types/components/ripple/use-ripple.d.ts +2 -2
- package/dist/types/components/rotate/rotate.d.ts +2 -3
- package/dist/types/components/saturation-slider/saturation-slider.d.ts +2 -2
- package/dist/types/components/saturation-slider/use-saturation-slider.d.ts +2 -3
- package/dist/types/components/scroll-area/scroll-area.d.ts +2 -2
- package/dist/types/components/segmented-control/segmented-control.d.ts +2 -3
- package/dist/types/components/segmented-control/segmented-control.style.d.ts +2 -2
- package/dist/types/components/segmented-control/use-segmented-control.d.ts +9 -10
- package/dist/types/components/select/select.d.ts +2 -4
- package/dist/types/components/select/select.style.d.ts +1 -1
- package/dist/types/components/select/use-select.d.ts +4 -6
- package/dist/types/components/separator/separator.d.ts +2 -2
- package/dist/types/components/sidebar/sidebar.d.ts +2 -7
- package/dist/types/components/sidebar/use-sidebar.d.ts +9 -9
- package/dist/types/components/simple-grid/simple-grid.d.ts +2 -3
- package/dist/types/components/skeleton/skeleton.d.ts +2 -2
- package/dist/types/components/slide/slide.d.ts +2 -3
- package/dist/types/components/slide-fade/slide-fade.d.ts +2 -3
- package/dist/types/components/slider/slider.d.ts +2 -2
- package/dist/types/components/slider/use-slider.d.ts +2 -3
- package/dist/types/components/snacks/snacks.d.ts +0 -2
- package/dist/types/components/snacks/use-snacks.d.ts +0 -1
- package/dist/types/components/stack/h-stack.d.ts +2 -2
- package/dist/types/components/stack/stack.d.ts +2 -2
- package/dist/types/components/stack/v-stack.d.ts +2 -2
- package/dist/types/components/stack/z-stack.d.ts +2 -2
- package/dist/types/components/stat/stat.d.ts +2 -2
- package/dist/types/components/status/status.d.ts +2 -2
- package/dist/types/components/status/status.style.d.ts +2 -2
- package/dist/types/components/steps/steps.d.ts +2 -2
- package/dist/types/components/steps/steps.style.d.ts +1 -1
- package/dist/types/components/steps/use-steps.d.ts +10 -10
- package/dist/types/components/switch/switch.d.ts +2 -2
- package/dist/types/components/switch/use-switch.d.ts +0 -1
- package/dist/types/components/table/table.d.ts +2 -4
- package/dist/types/components/tabs/tabs.d.ts +2 -2
- package/dist/types/components/tabs/tabs.style.d.ts +1 -1
- package/dist/types/components/tabs/use-tabs.d.ts +16 -16
- package/dist/types/components/tag/tag.d.ts +2 -2
- package/dist/types/components/tag/tag.style.d.ts +1 -1
- package/dist/types/components/text/text.d.ts +2 -2
- package/dist/types/components/textarea/textarea.d.ts +2 -4
- package/dist/types/components/textarea/use-autosize.d.ts +2 -2
- package/dist/types/components/timeline/timeline.d.ts +5 -5
- package/dist/types/components/timeline/timeline.style.d.ts +1 -1
- package/dist/types/components/tip/tip.d.ts +0 -3
- package/dist/types/components/toggle/toggle-group.d.ts +1 -1
- package/dist/types/components/toggle/toggle.d.ts +5 -7
- package/dist/types/components/toggle/use-toggle-group.d.ts +2 -2
- package/dist/types/components/toggle/use-toggle.d.ts +2 -3
- package/dist/types/components/tooltip/tooltip.d.ts +4 -5
- package/dist/types/components/tree/tree.d.ts +2 -6
- package/dist/types/components/tree/tree.style.d.ts +1 -1
- package/dist/types/components/tree/use-tree.d.ts +184 -185
- package/dist/types/components/visually-hidden/visually-hidden.d.ts +2 -2
- package/dist/types/components/wrap/wrap.d.ts +2 -3
- package/dist/types/core/components/create-component.d.ts +21 -10
- package/dist/types/core/components/index.d.ts +2 -2
- package/dist/types/core/components/index.types.d.ts +1 -0
- package/dist/types/core/components/use-component-style.d.ts +2 -0
- package/dist/types/core/components/utils.d.ts +1 -0
- package/dist/types/core/constant.d.ts +1 -0
- package/dist/types/core/css/calc.d.ts +1 -0
- package/dist/types/core/css/config.d.ts +1 -0
- package/dist/types/core/css/css.d.ts +1 -0
- package/dist/types/core/css/index.types.d.ts +1 -0
- package/dist/types/core/css/styles.d.ts +1 -0
- package/dist/types/core/css/token.d.ts +1 -0
- package/dist/types/core/css/use-css.d.ts +1 -0
- package/dist/types/core/css/utils.d.ts +2 -0
- package/dist/types/core/generated-theme-tokens.types.d.ts +1 -0
- package/dist/types/core/index.d.ts +4 -2
- package/dist/types/core/system/color-mode-provider.d.ts +2 -2
- package/dist/types/core/system/config.d.ts +1 -0
- package/dist/types/core/system/create-system.d.ts +1 -0
- package/dist/types/core/system/factory.d.ts +1 -0
- package/dist/types/core/system/index.types.d.ts +1 -0
- package/dist/types/core/system/storage-script.d.ts +3 -3
- package/dist/types/core/system/styled.d.ts +3 -2
- package/dist/types/core/system/system-provider.d.ts +2 -2
- package/dist/types/core/system/var.d.ts +2 -0
- package/dist/types/hooks/use-async-callback/index.d.ts +0 -1
- package/dist/types/hooks/use-breakpoint/use-breakpoint-state.d.ts +2 -2
- package/dist/types/hooks/use-clickable/index.d.ts +2 -2
- package/dist/types/hooks/use-clipboard/index.d.ts +2 -2
- package/dist/types/hooks/use-combobox/index.d.ts +12 -13
- package/dist/types/hooks/use-counter/index.d.ts +2 -2
- package/dist/types/hooks/use-descendants/index.d.ts +2 -2
- package/dist/types/hooks/use-field-sizing/index.d.ts +2 -2
- package/dist/types/hooks/use-hover/index.d.ts +2 -2
- package/dist/types/index.d.ts +3 -109
- package/dist/types/providers/i18n-provider/i18n-provider.d.ts +3 -3
- package/dist/types/providers/ui-provider/ui-provider.d.ts +2 -3
- package/dist/types/utils/children.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":["PopoverRoot: FC<PopoverRootProps>","motion"],"sources":["../../../../src/components/popover/popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren } from \"react\"\nimport type {\n HTMLProps,\n HTMLStyledProps,\n SimplePlacement,\n StyleValue,\n ThemeProps,\n} from \"../../core\"\nimport type { Merge, ReactNodeOrFunction } from \"../../utils\"\nimport type { HTMLMotionProps, MotionTransitionProps } from \"../motion\"\nimport type { PortalProps } from \"../portal\"\nimport type { PopoverStyle } from \"./popover.style\"\nimport type { UsePopoverProps, UsePopoverReturn } from \"./use-popover\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { cast, runIfFn } from \"../../utils\"\nimport { fadeScaleVariants } from \"../fade-scale\"\nimport { motion } from \"../motion\"\nimport { Portal } from \"../portal\"\nimport { slideFadeVariants } from \"../slide-fade\"\nimport { popoverStyle } from \"./popover.style\"\nimport { usePopover } from \"./use-popover\"\n\nexport interface UsePopupAnimationProps {\n /**\n * The animation of the element.\n *\n * @default 'scale'\n */\n animationScheme?: StyleValue<\"none\" | \"scale\" | SimplePlacement>\n /**\n * The animation duration.\n *\n * @default 0.1\n */\n duration?: StyleValue<MotionTransitionProps[\"duration\"]>\n}\n\nexport const usePopupAnimationProps = (props: UsePopupAnimationProps = {}) => {\n const animationScheme = useValue(props.animationScheme ?? \"scale\")\n const duration = useValue(props.duration ?? 0.1)\n const sharedProps = { animate: \"enter\", exit: \"exit\", initial: \"exit\" }\n\n switch (animationScheme) {\n case \"scale\":\n return {\n ...sharedProps,\n custom: { duration, reverse: true, scale: 0.95 },\n variants: fadeScaleVariants,\n }\n case \"block-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: 16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"block-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: 16, reverse: true },\n variants: slideFadeVariants,\n }\n default:\n return {}\n }\n}\n\nexport interface UsePopoverStyleProps {\n /**\n * If `true`, the popper will change its placement and flip when it's about to overflow its boundary area.\n *\n * @default true\n */\n flip?: StyleValue<UsePopoverProps[\"flip\"]>\n /**\n * The distance or margin between the reference and popper.\n * It is used internally to create an `offset` modifier.\n *\n * @default 8\n */\n gutter?: StyleValue<UsePopoverProps[\"gutter\"]>\n /**\n * If `true`, the popper will match the width of the reference at all times.\n * It's useful for `autocomplete`, `date-picker` and `select` patterns.\n *\n * @default false\n */\n matchWidth?: StyleValue<UsePopoverProps[\"matchWidth\"]>\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: StyleValue<UsePopoverProps[\"placement\"]>\n /**\n * The CSS positioning strategy to use.\n *\n * @default 'absolute'\n */\n strategy?: StyleValue<UsePopoverProps[\"strategy\"]>\n}\n\nexport const usePopoverStyleProps = (props: UsePopoverStyleProps = {}) => {\n const placement = useValue(props.placement)\n const gutter = useValue(props.gutter)\n const matchWidth = useValue(props.matchWidth)\n const strategy = useValue(props.strategy)\n const flip = useValue(props.flip)\n\n return {\n flip,\n gutter,\n matchWidth,\n placement,\n strategy,\n }\n}\n\ninterface ComponentContext\n extends\n Pick<\n UsePopoverReturn,\n | \"getAnchorProps\"\n | \"getBodyProps\"\n | \"getCloseTriggerProps\"\n | \"getContentProps\"\n | \"getFooterProps\"\n | \"getHeaderProps\"\n | \"getPositionerProps\"\n | \"getTriggerProps\"\n | \"open\"\n >,\n UsePopupAnimationProps {}\n\nexport interface PopoverRootProps\n extends\n Merge<UsePopoverProps, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<PopoverStyle> {\n /**\n * The children of the popover.\n */\n children?: ReactNodeOrFunction<{\n open: boolean\n onClose: () => void\n }>\n}\n\nconst {\n ComponentContext,\n PropsContext: PopoverPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: usePopoverPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<PopoverRootProps, PopoverStyle, ComponentContext>(\n \"popover\",\n popoverStyle,\n)\n\nexport { PopoverPropsContext, usePopoverPropsContext }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see https://yamada-ui.com/docs/components/popover\n */\nexport const PopoverRoot: FC<PopoverRootProps> = (props) => {\n const styleProps = usePopoverStyleProps(props)\n const [styleContext, { animationScheme, children, duration, ...rest }] =\n useRootComponentProps({ ...props, ...styleProps })\n const {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n } = usePopover(rest)\n const componentContext = useMemo(\n () => ({\n animationScheme,\n duration,\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n }),\n [\n open,\n animationScheme,\n duration,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n ],\n )\n\n return (\n <StyleContext value={styleContext}>\n <ComponentContext value={componentContext}>\n {runIfFn(children, { open, onClose })}\n </ComponentContext>\n </StyleContext>\n )\n}\n\nexport interface PopoverTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverTrigger = withContext<\"button\", PopoverTriggerProps>(\n \"button\",\n \"trigger\",\n)({ asChild: true }, (props) => {\n const { getTriggerProps } = useComponentContext()\n\n return getTriggerProps(props)\n})\n\nexport interface PopoverCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverCloseTrigger = withContext<\n \"button\",\n PopoverCloseTriggerProps\n>(\"button\", { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] })(\n { asChild: true },\n (props) => {\n const { getCloseTriggerProps } = useComponentContext()\n\n return getCloseTriggerProps(props)\n },\n)\n\nexport interface PopoverAnchorProps extends HTMLStyledProps {}\n\nexport const PopoverAnchor = withContext<\"div\", PopoverAnchorProps>(\n \"div\",\n \"anchor\",\n)({ asChild: true }, (props) => {\n const { getAnchorProps } = useComponentContext()\n\n return getAnchorProps(props)\n})\n\ninterface PopoverPositionerProps extends HTMLStyledProps {}\n\nconst PopoverPositioner = withContext<\"div\", PopoverPositionerProps>(\n \"div\",\n \"positioner\",\n)(undefined, (props) => {\n const { getPositionerProps } = useComponentContext()\n\n return getPositionerProps(props)\n})\n\nexport interface PopoverContentProps\n extends Omit<HTMLMotionProps, \"children\">, PropsWithChildren {\n /**\n * Props for portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n}\n\nexport const PopoverContent = withContext<\"div\", PopoverContentProps>(\n ({ portalProps, ...rest }) => {\n const { animationScheme, duration, open, getContentProps } =\n useComponentContext()\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n\n return (\n <AnimatePresence>\n {open ? (\n <Portal {...portalProps}>\n <PopoverPositioner>\n <motion.div\n {...popupAnimationProps}\n {...cast<HTMLMotionProps>(\n getContentProps(cast<HTMLProps>(rest)),\n )}\n />\n </PopoverPositioner>\n </Portal>\n ) : null}\n </AnimatePresence>\n )\n },\n \"content\",\n)()\n\nexport interface PopoverHeaderProps extends HTMLStyledProps {}\n\nexport const PopoverHeader = withContext<\"div\", PopoverHeaderProps>(\n \"div\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n\n return getHeaderProps(props)\n})\n\nexport interface PopoverBodyProps extends HTMLStyledProps {}\n\nexport const PopoverBody = withContext<\"div\", PopoverBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { getBodyProps } = useComponentContext()\n\n return getBodyProps(props)\n },\n)\n\nexport interface PopoverFooterProps extends HTMLStyledProps {}\n\nexport const PopoverFooter = withContext<\"div\", PopoverFooterProps>(\n \"div\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n\n return getFooterProps(props)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,0BAA0B,QAAgC,EAAE,KAAK;CAC5E,MAAM,kBAAkB,SAAS,MAAM,mBAAmB,QAAQ;CAClE,MAAM,WAAW,SAAS,MAAM,YAAY,GAAI;CAChD,MAAM,cAAc;EAAE,SAAS;EAAS,MAAM;EAAQ,SAAS;EAAQ;AAEvE,SAAQ,iBAAR;EACE,KAAK,QACH,QAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAM,OAAO;IAAM;GAChD,UAAU;GACX;EACH,KAAK,cACH,QAAO;GACL,GAAG;GACH,QAA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M,EAAE,mBAAmB,qBAAqB;AAEhD,QAAO,eAAe,MAAM;EAC5B"}
|
|
1
|
+
{"version":3,"file":"popover.js","names":["PopoverRoot: FC<PopoverRootProps>","motion"],"sources":["../../../../src/components/popover/popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren } from \"react\"\nimport type {\n HTMLProps,\n HTMLStyledProps,\n SimplePlacement,\n StyleValue,\n ThemeProps,\n} from \"../../core\"\nimport type { Merge, ReactNodeOrFunction } from \"../../utils\"\nimport type { HTMLMotionProps, MotionTransitionProps } from \"../motion\"\nimport type { PortalProps } from \"../portal\"\nimport type { PopoverStyle } from \"./popover.style\"\nimport type { UsePopoverProps, UsePopoverReturn } from \"./use-popover\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { cast, runIfFn } from \"../../utils\"\nimport { fadeScaleVariants } from \"../fade-scale\"\nimport { motion } from \"../motion\"\nimport { Portal } from \"../portal\"\nimport { slideFadeVariants } from \"../slide-fade\"\nimport { popoverStyle } from \"./popover.style\"\nimport { usePopover } from \"./use-popover\"\n\nexport interface UsePopupAnimationProps {\n /**\n * The animation of the element.\n *\n * @default 'scale'\n */\n animationScheme?: StyleValue<\"none\" | \"scale\" | SimplePlacement>\n /**\n * The animation duration.\n *\n * @default 0.1\n */\n duration?: StyleValue<MotionTransitionProps[\"duration\"]>\n}\n\nexport const usePopupAnimationProps = (props: UsePopupAnimationProps = {}) => {\n const animationScheme = useValue(props.animationScheme ?? \"scale\")\n const duration = useValue(props.duration ?? 0.1)\n const sharedProps = { animate: \"enter\", exit: \"exit\", initial: \"exit\" }\n\n switch (animationScheme) {\n case \"scale\":\n return {\n ...sharedProps,\n custom: { duration, reverse: true, scale: 0.95 },\n variants: fadeScaleVariants,\n }\n case \"block-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: 16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"block-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: 16, reverse: true },\n variants: slideFadeVariants,\n }\n default:\n return {}\n }\n}\n\nexport interface UsePopoverStyleProps {\n /**\n * If `true`, the popper will change its placement and flip when it's about to overflow its boundary area.\n *\n * @default true\n */\n flip?: StyleValue<UsePopoverProps[\"flip\"]>\n /**\n * The distance or margin between the reference and popper.\n * It is used internally to create an `offset` modifier.\n *\n * @default 8\n */\n gutter?: StyleValue<UsePopoverProps[\"gutter\"]>\n /**\n * If `true`, the popper will match the width of the reference at all times.\n * It's useful for `autocomplete`, `date-picker` and `select` patterns.\n *\n * @default false\n */\n matchWidth?: StyleValue<UsePopoverProps[\"matchWidth\"]>\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: StyleValue<UsePopoverProps[\"placement\"]>\n /**\n * The CSS positioning strategy to use.\n *\n * @default 'absolute'\n */\n strategy?: StyleValue<UsePopoverProps[\"strategy\"]>\n}\n\nexport const usePopoverStyleProps = (props: UsePopoverStyleProps = {}) => {\n const placement = useValue(props.placement)\n const gutter = useValue(props.gutter)\n const matchWidth = useValue(props.matchWidth)\n const strategy = useValue(props.strategy)\n const flip = useValue(props.flip)\n\n return {\n flip,\n gutter,\n matchWidth,\n placement,\n strategy,\n }\n}\n\ninterface ComponentContext\n extends\n Pick<\n UsePopoverReturn,\n | \"getAnchorProps\"\n | \"getBodyProps\"\n | \"getCloseTriggerProps\"\n | \"getContentProps\"\n | \"getFooterProps\"\n | \"getHeaderProps\"\n | \"getPositionerProps\"\n | \"getTriggerProps\"\n | \"open\"\n >,\n UsePopupAnimationProps {}\n\nexport interface PopoverRootProps\n extends\n Merge<UsePopoverProps, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<PopoverStyle>,\n Pick<HTMLProps, \"suppressHydrationWarning\"> {\n /**\n * The children of the popover.\n */\n children?: ReactNodeOrFunction<{\n open: boolean\n onClose: () => void\n }>\n}\n\nconst {\n ComponentContext,\n HydrationContext,\n PropsContext: PopoverPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: usePopoverPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<PopoverRootProps, PopoverStyle, ComponentContext>(\n \"popover\",\n popoverStyle,\n)\n\nexport { PopoverPropsContext, usePopoverPropsContext }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see https://yamada-ui.com/docs/components/popover\n */\nexport const PopoverRoot: FC<PopoverRootProps> = (props) => {\n const styleProps = usePopoverStyleProps(props)\n const [\n styleContext,\n { animationScheme, children, duration, suppressHydrationWarning, ...rest },\n ] = useRootComponentProps({ ...props, ...styleProps })\n const {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n } = usePopover(rest)\n const hydrationContext = useMemo(\n () => (suppressHydrationWarning ? { suppressHydrationWarning } : {}),\n [suppressHydrationWarning],\n )\n const componentContext = useMemo(\n () => ({\n animationScheme,\n duration,\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n }),\n [\n open,\n animationScheme,\n duration,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n ],\n )\n\n return (\n <StyleContext value={styleContext}>\n <HydrationContext value={hydrationContext}>\n <ComponentContext value={componentContext}>\n {runIfFn(children, { open, onClose })}\n </ComponentContext>\n </HydrationContext>\n </StyleContext>\n )\n}\n\nexport interface PopoverTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverTrigger = withContext<\"button\", PopoverTriggerProps>(\n \"button\",\n \"trigger\",\n)({ asChild: true }, (props) => {\n const { getTriggerProps } = useComponentContext()\n\n return getTriggerProps(props)\n})\n\nexport interface PopoverCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverCloseTrigger = withContext<\n \"button\",\n PopoverCloseTriggerProps\n>(\"button\", { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] })(\n { asChild: true },\n (props) => {\n const { getCloseTriggerProps } = useComponentContext()\n\n return getCloseTriggerProps(props)\n },\n)\n\nexport interface PopoverAnchorProps extends HTMLStyledProps {}\n\nexport const PopoverAnchor = withContext<\"div\", PopoverAnchorProps>(\n \"div\",\n \"anchor\",\n)({ asChild: true }, (props) => {\n const { getAnchorProps } = useComponentContext()\n\n return getAnchorProps(props)\n})\n\ninterface PopoverPositionerProps extends HTMLStyledProps {}\n\nconst PopoverPositioner = withContext<\"div\", PopoverPositionerProps>(\n \"div\",\n \"positioner\",\n)(undefined, (props) => {\n const { getPositionerProps } = useComponentContext()\n\n return getPositionerProps(props)\n})\n\nexport interface PopoverContentProps\n extends Omit<HTMLMotionProps, \"children\">, PropsWithChildren {\n /**\n * Props for portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n}\n\nexport const PopoverContent = withContext<\"div\", PopoverContentProps>(\n ({ portalProps, ...rest }) => {\n const { animationScheme, duration, open, getContentProps } =\n useComponentContext()\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n\n return (\n <AnimatePresence>\n {open ? (\n <Portal {...portalProps}>\n <PopoverPositioner>\n <motion.div\n {...popupAnimationProps}\n {...cast<HTMLMotionProps>(\n getContentProps(cast<HTMLProps>(rest)),\n )}\n />\n </PopoverPositioner>\n </Portal>\n ) : null}\n </AnimatePresence>\n )\n },\n \"content\",\n)()\n\nexport interface PopoverHeaderProps extends HTMLStyledProps {}\n\nexport const PopoverHeader = withContext<\"div\", PopoverHeaderProps>(\n \"div\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n\n return getHeaderProps(props)\n})\n\nexport interface PopoverBodyProps extends HTMLStyledProps {}\n\nexport const PopoverBody = withContext<\"div\", PopoverBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { getBodyProps } = useComponentContext()\n\n return getBodyProps(props)\n },\n)\n\nexport interface PopoverFooterProps extends HTMLStyledProps {}\n\nexport const PopoverFooter = withContext<\"div\", PopoverFooterProps>(\n \"div\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n\n return getFooterProps(props)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,0BAA0B,QAAgC,EAAE,KAAK;CAC5E,MAAM,kBAAkB,SAAS,MAAM,mBAAmB,QAAQ;CAClE,MAAM,WAAW,SAAS,MAAM,YAAY,GAAI;CAChD,MAAM,cAAc;EAAE,SAAS;EAAS,MAAM;EAAQ,SAAS;EAAQ;AAEvE,SAAQ,iBAAR;EACE,KAAK,QACH,QAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAM,OAAO;IAAM;GAChD,UAAU;GACX;EACH,KAAK,cACH,QAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAK,SAAS;IAAM;GACjD,UAAU;GACX;EACH,KAAK,aACH,QAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAI,SAAS;IAAM;GAChD,UAAU;GACX;EACH,KAAK,eACH,QAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAK,SAAS;IAAM;GACjD,UAAU;GACX;EACH,KAAK,YACH,QAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAI,SAAS;IAAM;GAChD,UAAU;GACX;EACH,QACE,QAAO,EAAE;;;AAuCf,MAAa,wBAAwB,QAA8B,EAAE,KAAK;CACxE,MAAM,YAAY,SAAS,MAAM,UAAU;CAC3C,MAAM,SAA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AC3B,OACA,SACD,CAAC,EAAE,SAAS,MAAM,GAAG,UAAU;CAC9B,MAAM,EAAE,mBAAmB,qBAAqB;AAEhD,QAAO,eAAe,MAAM;EAC5B;AAIF,MAAM,oBAAoB,YACxB,OACA,aACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,uBAAuB,qBAAqB;AAEpD,QAAO,mBAAmB,MAAM;EAChC;AAUF,MAAa,iBAAiB,aAC3B,EAAE,aAAa,GAAG,WAAW;CAC5B,MAAM,EAAE,iBAAiB,UAAU,MAAM,oBACvC,qBAAqB;CACvB,MAAM,sBAAsB,uBAAuB;EACjD;EACA;EACD,CAAC;AAEF,QACE,oBAAC,6BACE,OACC,oBAAC;EAAO,GAAI;YACV,oBAAC,+BACC,oBAACC,SAAO;GACN,GAAI;GACJ,2BACE,wCAAgC,KAAK,CAAC,CACvC;IACD,GACgB;GACb,GACP,OACY;GAGtB,UACD,EAAE;AAIH,MAAa,gBAAgB,YAC3B,OACA,SACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,qBAAqB;AAEhD,QAAO,eAAe,MAAM;EAC5B;AAIF,MAAa,cAAc,YAAqC,OAAO,OAAO,CAC5E,SACC,UAAU;CACT,MAAM,EAAE,iBAAiB,qBAAqB;AAE9C,QAAO,aAAa,MAAM;EAE7B;AAID,MAAa,gBAAgB,YAC3B,OACA,SACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,qBAAqB;AAEhD,QAAO,eAAe,MAAM;EAC5B"}
|
|
@@ -14,7 +14,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
14
14
|
* @see https://yamada-ui.com/docs/components/radio
|
|
15
15
|
*/
|
|
16
16
|
const RadioGroupRoot = component((props) => {
|
|
17
|
-
const [, { colorScheme, size, variant, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], readOnly, shape, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
17
|
+
const [, { colorScheme, size, variant, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], readOnly, shape, suppressHydrationWarning, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
18
18
|
"variant",
|
|
19
19
|
"colorScheme",
|
|
20
20
|
"size",
|
|
@@ -39,7 +39,8 @@ const RadioGroupRoot = component((props) => {
|
|
|
39
39
|
focusBorderColor,
|
|
40
40
|
invalid,
|
|
41
41
|
readOnly,
|
|
42
|
-
shape
|
|
42
|
+
shape,
|
|
43
|
+
suppressHydrationWarning
|
|
43
44
|
}), [
|
|
44
45
|
variant,
|
|
45
46
|
size,
|
|
@@ -49,7 +50,8 @@ const RadioGroupRoot = component((props) => {
|
|
|
49
50
|
invalid,
|
|
50
51
|
readOnly,
|
|
51
52
|
errorBorderColor,
|
|
52
|
-
focusBorderColor
|
|
53
|
+
focusBorderColor,
|
|
54
|
+
suppressHydrationWarning
|
|
53
55
|
]),
|
|
54
56
|
children: /* @__PURE__ */ jsx(RadioGroupContext, {
|
|
55
57
|
value: useMemo(() => ({
|
|
@@ -67,7 +69,7 @@ const RadioGroupRoot = component((props) => {
|
|
|
67
69
|
]),
|
|
68
70
|
children: /* @__PURE__ */ jsx(Group, {
|
|
69
71
|
orientation: "vertical",
|
|
70
|
-
...getRootProps(),
|
|
72
|
+
...getRootProps({ suppressHydrationWarning }),
|
|
71
73
|
children: computedChildren
|
|
72
74
|
})
|
|
73
75
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","names":["rest","value"],"sources":["../../../../src/components/radio/radio-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { RadioProps } from \"./radio\"\nimport type { RadioStyle } from \"./radio.style\"\nimport type { UseRadioGroupProps } from \"./use-radio-group\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport {\n component,\n Radio,\n RadioPropsContext,\n useRootComponentProps,\n} from \"./radio\"\nimport { RadioGroupContext, useRadioGroup } from \"./use-radio-group\"\n\nexport interface RadioGroupItem<\n Y extends string = string,\n> extends RadioProps<Y> {\n label: ReactNode\n}\n\nexport interface RadioGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, RadioStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<RadioStyle>,\n UseRadioGroupProps<Y>,\n UseInputBorderProps {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: RadioGroupItem<Y>[]\n}\n\n/**\n * `RadioGroup` is a component that groups `Radio` components.\n *\n * @see https://yamada-ui.com/docs/components/radio\n */\nexport const RadioGroupRoot = component<\"div\", RadioGroupRootProps>((props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n children,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n items = [],\n readOnly,\n shape,\n ...rest\n },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\"variant\", \"colorScheme\", \"size\", \"shape\"],\n })\n const { name, value, getInputProps, getLabelProps, getRootProps, onChange } =\n useRadioGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ label, value, ...rest }, index) => (\n <Radio key={value ?? index} value={value} {...rest}>\n {label}\n </Radio>\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n readOnly,\n shape,\n }),\n [\n variant,\n size,\n colorScheme,\n shape,\n disabled,\n invalid,\n readOnly,\n errorBorderColor,\n focusBorderColor,\n ],\n )\n const groupContext = useMemo(\n () => ({ name, value, getInputProps, getLabelProps, onChange }),\n [name, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <RadioPropsContext value={context}>\n <RadioGroupContext value={groupContext}>\n <Group
|
|
1
|
+
{"version":3,"file":"radio-group.js","names":["rest","value"],"sources":["../../../../src/components/radio/radio-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { RadioProps } from \"./radio\"\nimport type { RadioStyle } from \"./radio.style\"\nimport type { UseRadioGroupProps } from \"./use-radio-group\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport {\n component,\n Radio,\n RadioPropsContext,\n useRootComponentProps,\n} from \"./radio\"\nimport { RadioGroupContext, useRadioGroup } from \"./use-radio-group\"\n\nexport interface RadioGroupItem<\n Y extends string = string,\n> extends RadioProps<Y> {\n label: ReactNode\n}\n\nexport interface RadioGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, RadioStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<RadioStyle>,\n UseRadioGroupProps<Y>,\n UseInputBorderProps {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: RadioGroupItem<Y>[]\n}\n\n/**\n * `RadioGroup` is a component that groups `Radio` components.\n *\n * @see https://yamada-ui.com/docs/components/radio\n */\nexport const RadioGroupRoot = component<\"div\", RadioGroupRootProps>((props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n children,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n items = [],\n readOnly,\n shape,\n suppressHydrationWarning,\n ...rest\n },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\"variant\", \"colorScheme\", \"size\", \"shape\"],\n })\n const { name, value, getInputProps, getLabelProps, getRootProps, onChange } =\n useRadioGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ label, value, ...rest }, index) => (\n <Radio key={value ?? index} value={value} {...rest}>\n {label}\n </Radio>\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n readOnly,\n shape,\n suppressHydrationWarning,\n }),\n [\n variant,\n size,\n colorScheme,\n shape,\n disabled,\n invalid,\n readOnly,\n errorBorderColor,\n focusBorderColor,\n suppressHydrationWarning,\n ],\n )\n const groupContext = useMemo(\n () => ({ name, value, getInputProps, getLabelProps, onChange }),\n [name, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <RadioPropsContext value={context}>\n <RadioGroupContext value={groupContext}>\n <Group\n orientation=\"vertical\"\n {...getRootProps({ suppressHydrationWarning })}\n >\n {computedChildren}\n </Group>\n </RadioGroupContext>\n </RadioPropsContext>\n )\n}, \"group\")() as GenericsComponent<{\n <Y extends string = string>(props: RadioGroupRootProps<Y>): ReactElement\n}>\n\nexport { Radio as RadioGroupItem }\n"],"mappings":";;;;;;;;;;;;;;;AAmDA,MAAa,iBAAiB,WAAuC,UAAU;CAC7E,MAAM,GAEJ,EACE,aACA,MACA,SACA,UACA,UACA,kBACA,kBACA,SACA,QAAQ,EAAE,EACV,UACA,OACA,0BACA,GAAG,UAEH,sBAAsB,OAAO,SAAS,EACxC,eAAe;EAAC;EAAW;EAAe;EAAQ;EAAQ,EAC3D,CAAC;CACF,MAAM,EAAE,MAAM,OAAO,eAAe,eAAe,cAAc,aAC/D,cAAc,KAAK;CACrB,MAAM,mBAAmB,cAAc;AACrC,MAAI,SAAU,QAAO;AAErB,SAAO,MAAM,KAAK,EAAE,OAAO,gBAAO,GAAGA,UAAQ,UAC3C,oBAAC;GAA2B,OAAOC;GAAO,GAAID;aAC3C;KADSC,WAAS,MAEb,CACR;IACD,CAAC,OAAO,SAAS,CAAC;AAgCrB,QACE,oBAAC;EAAkB,OAhCL,eACP;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;YAQG,oBAAC;GAAkB,OAPF,eACZ;IAAE;IAAM;IAAO;IAAe;IAAe;IAAU,GAC9D;IAAC;IAAM;IAAO;IAAe;IAAe;IAAS,CACtD;aAKK,oBAAC;IACC,aAAY;IACZ,GAAI,aAAa,EAAE,0BAA0B,CAAC;cAE7C;KACK;IACU;GACF;GAErB,QAAQ,EAAE"}
|
|
@@ -15,7 +15,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
15
15
|
* @see https://yamada-ui.com/docs/components/radio-card
|
|
16
16
|
*/
|
|
17
17
|
const RadioCardGroupRoot = component((props) => {
|
|
18
|
-
const [, { colorScheme, size, variant, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], justify, readOnly, shape, withIndicator, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
18
|
+
const [, { colorScheme, size, variant, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], justify, readOnly, shape, suppressHydrationWarning, withIndicator, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
19
19
|
"variant",
|
|
20
20
|
"colorScheme",
|
|
21
21
|
"size",
|
|
@@ -43,6 +43,7 @@ const RadioCardGroupRoot = component((props) => {
|
|
|
43
43
|
justify,
|
|
44
44
|
readOnly,
|
|
45
45
|
shape,
|
|
46
|
+
suppressHydrationWarning,
|
|
46
47
|
withIndicator
|
|
47
48
|
}), [
|
|
48
49
|
colorScheme,
|
|
@@ -55,7 +56,8 @@ const RadioCardGroupRoot = component((props) => {
|
|
|
55
56
|
focusBorderColor,
|
|
56
57
|
invalid,
|
|
57
58
|
readOnly,
|
|
58
|
-
shape
|
|
59
|
+
shape,
|
|
60
|
+
suppressHydrationWarning
|
|
59
61
|
]),
|
|
60
62
|
children: /* @__PURE__ */ jsx(RadioGroupContext, {
|
|
61
63
|
value: useMemo(() => ({
|
|
@@ -72,7 +74,7 @@ const RadioCardGroupRoot = component((props) => {
|
|
|
72
74
|
onChange
|
|
73
75
|
]),
|
|
74
76
|
children: /* @__PURE__ */ jsx(Group, {
|
|
75
|
-
...getRootProps(),
|
|
77
|
+
...getRootProps({ suppressHydrationWarning }),
|
|
76
78
|
children: computedChildren
|
|
77
79
|
})
|
|
78
80
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-card-group.js","names":["rest","value"],"sources":["../../../../src/components/radio-card/radio-card-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UseRadioGroupProps } from \"../radio\"\nimport type { RadioCardRootProps } from \"./radio-card\"\nimport type { RadioCardStyle } from \"./radio-card.style\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport { RadioGroupContext, useRadioGroup } from \"../radio\"\nimport {\n component,\n RadioCardPropsContext,\n RadioCardRoot,\n useRootComponentProps,\n} from \"./radio-card\"\n\nexport interface RadioCardGroupItem<\n Y extends string = string,\n> extends RadioCardRootProps<Y> {}\n\nexport interface RadioCardGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, RadioCardStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<RadioCardStyle>,\n UseRadioGroupProps<Y>,\n UseInputBorderProps,\n Pick<RadioCardRootProps, \"withIndicator\"> {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: RadioCardGroupItem<Y>[]\n}\n\n/**\n * `RadioCardGroup` is a component that groups `RadioCard` components.\n *\n * @see https://yamada-ui.com/docs/components/radio-card\n */\nexport const RadioCardGroupRoot = component<\"div\", RadioCardGroupRootProps>(\n (props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n children,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n items = [],\n justify,\n readOnly,\n shape,\n withIndicator,\n ...rest\n },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\n \"variant\",\n \"colorScheme\",\n \"size\",\n \"shape\",\n \"justify\",\n \"withIndicator\",\n ],\n })\n const {\n name,\n value,\n getInputProps,\n getLabelProps,\n getRootProps,\n onChange,\n } = useRadioGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ value, ...rest }, index) => (\n <RadioCardRoot key={value ?? index} value={value} {...rest} />\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n justify,\n readOnly,\n shape,\n withIndicator,\n }),\n [\n colorScheme,\n size,\n variant,\n disabled,\n justify,\n withIndicator,\n errorBorderColor,\n focusBorderColor,\n invalid,\n readOnly,\n shape,\n ],\n )\n const groupContext = useMemo(\n () => ({ name, value, getInputProps, getLabelProps, onChange }),\n [name, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <RadioCardPropsContext value={context}>\n <RadioGroupContext value={groupContext}>\n <Group {...getRootProps()}
|
|
1
|
+
{"version":3,"file":"radio-card-group.js","names":["rest","value"],"sources":["../../../../src/components/radio-card/radio-card-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UseRadioGroupProps } from \"../radio\"\nimport type { RadioCardRootProps } from \"./radio-card\"\nimport type { RadioCardStyle } from \"./radio-card.style\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport { RadioGroupContext, useRadioGroup } from \"../radio\"\nimport {\n component,\n RadioCardPropsContext,\n RadioCardRoot,\n useRootComponentProps,\n} from \"./radio-card\"\n\nexport interface RadioCardGroupItem<\n Y extends string = string,\n> extends RadioCardRootProps<Y> {}\n\nexport interface RadioCardGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, RadioCardStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<RadioCardStyle>,\n UseRadioGroupProps<Y>,\n UseInputBorderProps,\n Pick<RadioCardRootProps, \"withIndicator\"> {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: RadioCardGroupItem<Y>[]\n}\n\n/**\n * `RadioCardGroup` is a component that groups `RadioCard` components.\n *\n * @see https://yamada-ui.com/docs/components/radio-card\n */\nexport const RadioCardGroupRoot = component<\"div\", RadioCardGroupRootProps>(\n (props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n children,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n items = [],\n justify,\n readOnly,\n shape,\n suppressHydrationWarning,\n withIndicator,\n ...rest\n },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\n \"variant\",\n \"colorScheme\",\n \"size\",\n \"shape\",\n \"justify\",\n \"withIndicator\",\n ],\n })\n const {\n name,\n value,\n getInputProps,\n getLabelProps,\n getRootProps,\n onChange,\n } = useRadioGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ value, ...rest }, index) => (\n <RadioCardRoot key={value ?? index} value={value} {...rest} />\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n justify,\n readOnly,\n shape,\n suppressHydrationWarning,\n withIndicator,\n }),\n [\n colorScheme,\n size,\n variant,\n disabled,\n justify,\n withIndicator,\n errorBorderColor,\n focusBorderColor,\n invalid,\n readOnly,\n shape,\n suppressHydrationWarning,\n ],\n )\n const groupContext = useMemo(\n () => ({ name, value, getInputProps, getLabelProps, onChange }),\n [name, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <RadioCardPropsContext value={context}>\n <RadioGroupContext value={groupContext}>\n <Group {...getRootProps({ suppressHydrationWarning })}>\n {computedChildren}\n </Group>\n </RadioGroupContext>\n </RadioCardPropsContext>\n )\n },\n \"group\",\n)() as GenericsComponent<{\n <Y extends string = string>(props: RadioCardGroupRootProps<Y>): ReactElement\n}>\n\nexport { RadioCardRoot as RadioCardGroupItem }\n"],"mappings":";;;;;;;;;;;;;;;;AAkDA,MAAa,qBAAqB,WAC/B,UAAU;CACT,MAAM,GAEJ,EACE,aACA,MACA,SACA,UACA,UACA,kBACA,kBACA,SACA,QAAQ,EAAE,EACV,SACA,UACA,OACA,0BACA,eACA,GAAG,UAEH,sBAAsB,OAAO,SAAS,EACxC,eAAe;EACb;EACA;EACA;EACA;EACA;EACA;EACD,EACF,CAAC;CACF,MAAM,EACJ,MACA,OACA,eACA,eACA,cACA,aACE,cAAc,KAAK;CACvB,MAAM,mBAAmB,cAAc;AACrC,MAAI,SAAU,QAAO;AAErB,SAAO,MAAM,KAAK,EAAE,gBAAO,GAAGA,UAAQ,UACpC,oBAAC;GAAmC,OAAOC;GAAO,GAAID;KAAlCC,WAAS,MAAiC,CAC9D;IACD,CAAC,OAAO,SAAS,CAAC;AAoCrB,QACE,oBAAC;EAAsB,OApCT,eACP;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;YAQG,oBAAC;GAAkB,OAPF,eACZ;IAAE;IAAM;IAAO;IAAe;IAAe;IAAU,GAC9D;IAAC;IAAM;IAAO;IAAe;IAAe;IAAS,CACtD;aAKK,oBAAC;IAAM,GAAI,aAAa,EAAE,0BAA0B,CAAC;cAClD;KACK;IACU;GACE;GAG5B,QACD,EAAE"}
|
|
@@ -9,7 +9,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
9
9
|
|
|
10
10
|
//#region src/components/toggle/toggle-group.tsx
|
|
11
11
|
const ToggleGroupRoot = component((props) => {
|
|
12
|
-
const [, { colorScheme, size, variant, attached, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
12
|
+
const [, { colorScheme, size, variant, attached, suppressHydrationWarning, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
13
13
|
"size",
|
|
14
14
|
"variant",
|
|
15
15
|
"colorScheme"
|
|
@@ -20,12 +20,14 @@ const ToggleGroupRoot = component((props) => {
|
|
|
20
20
|
colorScheme,
|
|
21
21
|
size,
|
|
22
22
|
variant,
|
|
23
|
-
focusVisibleRing: attached ? "inside" : void 0
|
|
23
|
+
focusVisibleRing: attached ? "inside" : void 0,
|
|
24
|
+
suppressHydrationWarning
|
|
24
25
|
}), [
|
|
25
26
|
variant,
|
|
26
27
|
size,
|
|
27
28
|
colorScheme,
|
|
28
|
-
attached
|
|
29
|
+
attached,
|
|
30
|
+
suppressHydrationWarning
|
|
29
31
|
]),
|
|
30
32
|
children: /* @__PURE__ */ jsx(ToggleGroupContext, {
|
|
31
33
|
value: useMemo(() => ({
|
|
@@ -43,7 +45,7 @@ const ToggleGroupRoot = component((props) => {
|
|
|
43
45
|
]),
|
|
44
46
|
children: /* @__PURE__ */ jsx(Group, {
|
|
45
47
|
attached,
|
|
46
|
-
...getGroupProps()
|
|
48
|
+
...getGroupProps({ suppressHydrationWarning })
|
|
47
49
|
})
|
|
48
50
|
})
|
|
49
51
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-group.js","names":[],"sources":["../../../../src/components/toggle/toggle-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { ToggleProps } from \"./toggle\"\nimport type { ToggleStyle } from \"./toggle.style\"\nimport type { UseToggleGroupProps } from \"./use-toggle-group\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport { component, TogglePropsContext, useRootComponentProps } from \"./toggle\"\nimport { ToggleGroupContext, useToggleGroup } from \"./use-toggle-group\"\n\n/**\n * `ToggleGroup` is a set of two-state buttons that can be toggled on or off.\n *\n * @see https://yamada-ui.com/docs/components/toggle\n */\nexport interface ToggleGroupRootProps<Y extends string | string[] = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, ToggleStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n UseToggleGroupProps<Y>,\n ThemeProps<ToggleStyle> {}\n\nexport const ToggleGroupRoot = component<\"div\", ToggleGroupRootProps>(\n (props: ToggleGroupRootProps) => {\n const [
|
|
1
|
+
{"version":3,"file":"toggle-group.js","names":[],"sources":["../../../../src/components/toggle/toggle-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { ToggleProps } from \"./toggle\"\nimport type { ToggleStyle } from \"./toggle.style\"\nimport type { UseToggleGroupProps } from \"./use-toggle-group\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport { component, TogglePropsContext, useRootComponentProps } from \"./toggle\"\nimport { ToggleGroupContext, useToggleGroup } from \"./use-toggle-group\"\n\n/**\n * `ToggleGroup` is a set of two-state buttons that can be toggled on or off.\n *\n * @see https://yamada-ui.com/docs/components/toggle\n */\nexport interface ToggleGroupRootProps<Y extends string | string[] = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, ToggleStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n UseToggleGroupProps<Y>,\n ThemeProps<ToggleStyle> {}\n\nexport const ToggleGroupRoot = component<\"div\", ToggleGroupRootProps>(\n (props: ToggleGroupRootProps) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n attached,\n suppressHydrationWarning,\n ...rest\n },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\"size\", \"variant\", \"colorScheme\"],\n })\n const {\n disabled,\n readOnly,\n value,\n getGroupProps,\n onChange,\n onChangeMapRef,\n } = useToggleGroup(rest)\n const context = useMemo<ToggleProps>(\n () => ({\n colorScheme,\n size,\n variant,\n focusVisibleRing: attached ? \"inside\" : undefined,\n suppressHydrationWarning,\n }),\n [variant, size, colorScheme, attached, suppressHydrationWarning],\n )\n const groupContext = useMemo(\n () => ({\n disabled,\n readOnly,\n value,\n onChange,\n onChangeMapRef,\n }),\n [value, disabled, readOnly, onChange, onChangeMapRef],\n )\n\n return (\n <TogglePropsContext value={context}>\n <ToggleGroupContext value={groupContext}>\n <Group\n attached={attached}\n {...getGroupProps({ suppressHydrationWarning })}\n />\n </ToggleGroupContext>\n </TogglePropsContext>\n )\n },\n \"group\",\n)() as GenericsComponent<{\n <Y extends string | string[] = string>(\n props: ToggleGroupRootProps<Y>,\n ): ReactElement\n}>\n"],"mappings":";;;;;;;;;;AA+BA,MAAa,kBAAkB,WAC5B,UAAgC;CAC/B,MAAM,GAEJ,EACE,aACA,MACA,SACA,UACA,0BACA,GAAG,UAEH,sBAAsB,OAAO,SAAS,EACxC,eAAe;EAAC;EAAQ;EAAW;EAAc,EAClD,CAAC;CACF,MAAM,EACJ,UACA,UACA,OACA,eACA,UACA,mBACE,eAAe,KAAK;AAsBxB,QACE,oBAAC;EAAmB,OAtBN,eACP;GACL;GACA;GACA;GACA,kBAAkB,WAAW,WAAW;GACxC;GACD,GACD;GAAC;GAAS;GAAM;GAAa;GAAU;GAAyB,CACjE;YAcG,oBAAC;GAAmB,OAbH,eACZ;IACL;IACA;IACA;IACA;IACA;IACD,GACD;IAAC;IAAO;IAAU;IAAU;IAAU;IAAe,CACtD;aAKK,oBAAC;IACW;IACV,GAAI,cAAc,EAAE,0BAA0B,CAAC;KAC/C;IACiB;GACF;GAGzB,QACD,EAAE"}
|
|
@@ -11,41 +11,46 @@ import { usePopupAnimationProps } from "../popover/popover.js";
|
|
|
11
11
|
import "../popover/index.js";
|
|
12
12
|
import { tooltipStyle } from "./tooltip.style.js";
|
|
13
13
|
import { useTooltip } from "./use-tooltip.js";
|
|
14
|
+
import { useMemo } from "react";
|
|
14
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
16
|
import { AnimatePresence } from "motion/react";
|
|
16
17
|
|
|
17
18
|
//#region src/components/tooltip/tooltip.tsx
|
|
18
|
-
const { PropsContext: TooltipPropsContext, StyleContext, usePropsContext: useTooltipPropsContext, withContext, useRootComponentProps } = createSlotComponent("tooltip", tooltipStyle);
|
|
19
|
+
const { HydrationContext, PropsContext: TooltipPropsContext, StyleContext, usePropsContext: useTooltipPropsContext, withContext, useRootComponentProps } = createSlotComponent("tooltip", tooltipStyle);
|
|
19
20
|
/**
|
|
20
21
|
* `Tooltip` is a component that displays short information, such as supplementary details for an element.
|
|
21
22
|
*
|
|
22
23
|
* @see https://yamada-ui.com/docs/components/tooltip
|
|
23
24
|
*/
|
|
24
25
|
const Tooltip = (props) => {
|
|
25
|
-
const [
|
|
26
|
+
const [styleContext, { animationScheme = "scale", children, content, duration = .1, suppressHydrationWarning, contentProps, portalProps, ...rest }] = useRootComponentProps(props);
|
|
26
27
|
const { open, getContentProps, getPositionerProps, getTriggerProps } = useTooltip(rest);
|
|
27
28
|
const popupAnimationProps = usePopupAnimationProps({
|
|
28
29
|
animationScheme,
|
|
29
30
|
duration
|
|
30
31
|
});
|
|
32
|
+
const hydrationContext = useMemo(() => suppressHydrationWarning ? { suppressHydrationWarning } : {}, [suppressHydrationWarning]);
|
|
31
33
|
if (!content) return children;
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
value:
|
|
34
|
-
children:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
children: /* @__PURE__ */ jsx(
|
|
41
|
-
...
|
|
42
|
-
children: /* @__PURE__ */ jsx(
|
|
43
|
-
...
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
return /* @__PURE__ */ jsx(StyleContext, {
|
|
35
|
+
value: styleContext,
|
|
36
|
+
children: /* @__PURE__ */ jsxs(HydrationContext, {
|
|
37
|
+
value: hydrationContext,
|
|
38
|
+
children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
39
|
+
asChild: true,
|
|
40
|
+
...getTriggerProps(),
|
|
41
|
+
children
|
|
42
|
+
}), /* @__PURE__ */ jsx(AnimatePresence, { children: open ? /* @__PURE__ */ jsx(Portal, {
|
|
43
|
+
...portalProps,
|
|
44
|
+
children: /* @__PURE__ */ jsx(TooltipPositioner, {
|
|
45
|
+
...getPositionerProps(),
|
|
46
|
+
children: /* @__PURE__ */ jsx(TooltipContent, {
|
|
47
|
+
...popupAnimationProps,
|
|
48
|
+
...(0, utils_exports.cast)(getContentProps((0, utils_exports.cast)(contentProps))),
|
|
49
|
+
children: content
|
|
50
|
+
})
|
|
46
51
|
})
|
|
47
|
-
})
|
|
48
|
-
})
|
|
52
|
+
}) : null })]
|
|
53
|
+
})
|
|
49
54
|
});
|
|
50
55
|
};
|
|
51
56
|
const TooltipPositioner = withContext("div", "positioner")();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","names":["Tooltip: FC<TooltipProps>","motion"],"sources":["../../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["\"use client\"\n\nimport type {
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":["Tooltip: FC<TooltipProps>","motion"],"sources":["../../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { HTMLMotionProps } from \"../motion\"\nimport type { UsePopupAnimationProps } from \"../popover\"\nimport type { PortalProps } from \"../portal\"\nimport type { TooltipStyle } from \"./tooltip.style\"\nimport type { UseTooltipProps } from \"./use-tooltip\"\nimport { AnimatePresence } from \"motion/react\"\nimport { type FC, type PropsWithChildren, type ReactNode, useMemo } from \"react\"\nimport { createSlotComponent } from \"../../core\"\nimport { cast } from \"../../utils\"\nimport { motion } from \"../motion\"\nimport { usePopupAnimationProps } from \"../popover\"\nimport { Portal } from \"../portal\"\nimport { tooltipStyle } from \"./tooltip.style\"\nimport { useTooltip } from \"./use-tooltip\"\n\nexport interface TooltipProps\n extends\n UseTooltipProps,\n PropsWithChildren,\n UsePopupAnimationProps,\n ThemeProps<TooltipStyle>,\n Pick<HTMLProps, \"suppressHydrationWarning\"> {\n /**\n * The content of the tooltip.\n */\n content?: ReactNode\n /**\n * The animation duration.\n *\n * @default 0.1\n */\n duration?: UsePopupAnimationProps[\"duration\"]\n /**\n * Props for content element.\n */\n contentProps?: HTMLMotionProps\n /**\n * Props for portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n}\n\nconst {\n HydrationContext,\n PropsContext: TooltipPropsContext,\n StyleContext,\n usePropsContext: useTooltipPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<TooltipProps, TooltipStyle>(\"tooltip\", tooltipStyle)\n\nexport { TooltipPropsContext, useTooltipPropsContext }\n\n/**\n * `Tooltip` is a component that displays short information, such as supplementary details for an element.\n *\n * @see https://yamada-ui.com/docs/components/tooltip\n */\nexport const Tooltip: FC<TooltipProps> = (props) => {\n const [\n styleContext,\n {\n animationScheme = \"scale\",\n children,\n content,\n duration = 0.1,\n suppressHydrationWarning,\n contentProps,\n portalProps,\n ...rest\n },\n ] = useRootComponentProps(props)\n const { open, getContentProps, getPositionerProps, getTriggerProps } =\n useTooltip(rest)\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n const hydrationContext = useMemo(\n () => (suppressHydrationWarning ? { suppressHydrationWarning } : {}),\n [suppressHydrationWarning],\n )\n\n if (!content) return children\n\n return (\n <StyleContext value={styleContext}>\n <HydrationContext value={hydrationContext}>\n <TooltipTrigger asChild {...getTriggerProps()}>\n {children}\n </TooltipTrigger>\n\n <AnimatePresence>\n {open ? (\n <Portal {...portalProps}>\n <TooltipPositioner {...getPositionerProps()}>\n <TooltipContent\n {...popupAnimationProps}\n {...cast<HTMLMotionProps>(\n getContentProps(cast<HTMLProps>(contentProps)),\n )}\n >\n {content}\n </TooltipContent>\n </TooltipPositioner>\n </Portal>\n ) : null}\n </AnimatePresence>\n </HydrationContext>\n </StyleContext>\n )\n}\n\ninterface TooltipPositionerProps extends HTMLStyledProps {}\n\nconst TooltipPositioner = withContext<\"div\", TooltipPositionerProps>(\n \"div\",\n \"positioner\",\n)()\n\ninterface TooltipTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nconst TooltipTrigger = withContext<\"button\", TooltipTriggerProps>(\n \"button\",\n \"trigger\",\n)()\n\ninterface TooltipContentProps extends Omit<\n HTMLMotionProps,\n \"children\" | \"offset\" | \"transform\"\n> {}\n\nconst TooltipContent = withContext<\"div\", TooltipContentProps>(\n motion.div,\n \"content\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6CA,MAAM,EACJ,kBACA,cAAc,qBACd,cACA,iBAAiB,wBACjB,aACA,0BACE,oBAAgD,WAAW,aAAa;;;;;;AAS5E,MAAaA,WAA6B,UAAU;CAClD,MAAM,CACJ,cACA,EACE,kBAAkB,SAClB,UACA,SACA,WAAW,IACX,0BACA,cACA,aACA,GAAG,UAEH,sBAAsB,MAAM;CAChC,MAAM,EAAE,MAAM,iBAAiB,oBAAoB,oBACjD,WAAW,KAAK;CAClB,MAAM,sBAAsB,uBAAuB;EACjD;EACA;EACD,CAAC;CACF,MAAM,mBAAmB,cAChB,2BAA2B,EAAE,0BAA0B,GAAG,EAAE,EACnE,CAAC,yBAAyB,CAC3B;AAED,KAAI,CAAC,QAAS,QAAO;AAErB,QACE,oBAAC;EAAa,OAAO;YACnB,qBAAC;GAAiB,OAAO;cACvB,oBAAC;IAAe;IAAQ,GAAI,iBAAiB;IAC1C;KACc,EAEjB,oBAAC,6BACE,OACC,oBAAC;IAAO,GAAI;cACV,oBAAC;KAAkB,GAAI,oBAAoB;eACzC,oBAAC;MACC,GAAI;MACJ,2BACE,wCAAgC,aAAa,CAAC,CAC/C;gBAEA;OACc;MACC;KACb,GACP,OACY;IACD;GACN;;AAMnB,MAAM,oBAAoB,YACxB,OACA,aACD,EAAE;AAIH,MAAM,iBAAiB,YACrB,UACA,UACD,EAAE;AAOH,MAAM,iBAAiB,YACrBC,SAAO,KACP,UACD,EAAE"}
|
|
@@ -49,6 +49,10 @@ function createComponent(name, style) {
|
|
|
49
49
|
name: `${defaultDisplayName}PropsContext`,
|
|
50
50
|
strict: false
|
|
51
51
|
});
|
|
52
|
+
const [HydrationContext, useHydrationContext] = createContext$1({
|
|
53
|
+
name: `${defaultDisplayName}HydrationContext`,
|
|
54
|
+
strict: false
|
|
55
|
+
});
|
|
52
56
|
function useClassName(name$1, className) {
|
|
53
57
|
const system = useSystem();
|
|
54
58
|
className = (0, utils_exports.runIfFn)(className, system);
|
|
@@ -75,9 +79,11 @@ function createComponent(name, style) {
|
|
|
75
79
|
return function(initialProps, ...superProps) {
|
|
76
80
|
return withDisplayName((props) => {
|
|
77
81
|
className = useClassName(name$1, className);
|
|
82
|
+
const hydrationProps = useHydrationContext();
|
|
78
83
|
const computedProps = (0, utils_exports.isFunction)(initialProps) ? initialProps(props) : mergeProps(initialProps ?? {}, props)();
|
|
79
84
|
const mergedProps = chainProps(...superProps)()(computedProps);
|
|
80
85
|
return /* @__PURE__ */ jsx(ProxyComponent, {
|
|
86
|
+
...hydrationProps,
|
|
81
87
|
...mergedProps,
|
|
82
88
|
className: (0, utils_exports.cx)(className, mergedProps.className)
|
|
83
89
|
});
|
|
@@ -95,15 +101,21 @@ function createComponent(name, style) {
|
|
|
95
101
|
withContext: withContext$1,
|
|
96
102
|
transferProps
|
|
97
103
|
});
|
|
98
|
-
|
|
104
|
+
const rest = chainProps(...(0, utils_exports.toArray)(superProps))()(mergedProps);
|
|
105
|
+
return /* @__PURE__ */ jsx(HydrationContext, {
|
|
106
|
+
value: rest.suppressHydrationWarning ? { suppressHydrationWarning: true } : {},
|
|
107
|
+
children: /* @__PURE__ */ jsx(ProxyComponent, { ...rest })
|
|
108
|
+
});
|
|
99
109
|
}, displayName);
|
|
100
110
|
};
|
|
101
111
|
}
|
|
102
112
|
return {
|
|
103
113
|
component,
|
|
104
114
|
ComponentContext,
|
|
115
|
+
HydrationContext,
|
|
105
116
|
PropsContext,
|
|
106
117
|
useComponentContext,
|
|
118
|
+
useHydrationContext,
|
|
107
119
|
usePropsContext,
|
|
108
120
|
withContext,
|
|
109
121
|
useComponentProps
|
|
@@ -119,6 +131,10 @@ function createSlotComponent(rootName, style) {
|
|
|
119
131
|
name: `${rootDisplayName}PropsContext`,
|
|
120
132
|
strict: false
|
|
121
133
|
});
|
|
134
|
+
const [HydrationContext, useHydrationContext] = createContext$1({
|
|
135
|
+
name: `${rootDisplayName}HydrationContext`,
|
|
136
|
+
strict: false
|
|
137
|
+
});
|
|
122
138
|
function useClassName(slot, className) {
|
|
123
139
|
const system = useSystem();
|
|
124
140
|
className = (0, utils_exports.runIfFn)(className, system);
|
|
@@ -137,19 +153,20 @@ function createSlotComponent(rootName, style) {
|
|
|
137
153
|
function useRootComponentProps(props, slot, { className, withContext: withContext$1 = true, transferProps } = {}) {
|
|
138
154
|
className = useClassName(slot, className);
|
|
139
155
|
const contextProps = usePropsContext() ?? {};
|
|
140
|
-
const [
|
|
156
|
+
const [styleContext, rest] = useComponentSlotStyle(withContext$1 ? mergeProps(contextProps, props)() : props, {
|
|
141
157
|
name: rootName,
|
|
142
158
|
className,
|
|
143
159
|
style,
|
|
144
160
|
slot,
|
|
145
161
|
transferProps
|
|
146
162
|
});
|
|
147
|
-
return [
|
|
163
|
+
return [styleContext, rest];
|
|
148
164
|
}
|
|
149
165
|
function useSlotComponentProps(props, slot, { className } = {}) {
|
|
150
166
|
className = useClassName(slot, className);
|
|
151
167
|
const style$1 = useStyleContext();
|
|
152
168
|
return {
|
|
169
|
+
...useHydrationContext(),
|
|
153
170
|
...props,
|
|
154
171
|
className: (0, utils_exports.cx)(className, props.className),
|
|
155
172
|
css: mergeSlotCSS(slot, style$1, props.css)
|
|
@@ -166,9 +183,11 @@ function createSlotComponent(rootName, style) {
|
|
|
166
183
|
return function(initialProps, ...superProps) {
|
|
167
184
|
return withDisplayName((props) => {
|
|
168
185
|
className = useClassName(slot, className);
|
|
186
|
+
const hydrationProps = useHydrationContext();
|
|
169
187
|
const computedProps = (0, utils_exports.isFunction)(initialProps) ? initialProps(props) : mergeProps(initialProps ?? {}, props)();
|
|
170
188
|
const mergedProps = chainProps(...superProps)()(computedProps);
|
|
171
189
|
return /* @__PURE__ */ jsx(ProxyComponent, {
|
|
190
|
+
...hydrationProps,
|
|
172
191
|
...mergedProps,
|
|
173
192
|
className: (0, utils_exports.cx)(className, mergedProps.className)
|
|
174
193
|
});
|
|
@@ -185,14 +204,18 @@ function createSlotComponent(rootName, style) {
|
|
|
185
204
|
});
|
|
186
205
|
return function(initialProps, ...superProps) {
|
|
187
206
|
return withDisplayName((props) => {
|
|
188
|
-
const [
|
|
207
|
+
const [styleContext, mergedProps] = useRootComponentProps((0, utils_exports.isFunction)(initialProps) ? initialProps(props) : mergeProps(initialProps ?? {}, props)(), slot, {
|
|
189
208
|
className,
|
|
190
209
|
withContext: withContext$1,
|
|
191
210
|
transferProps
|
|
192
211
|
});
|
|
212
|
+
const rest = chainProps(...superProps)()(mergedProps);
|
|
193
213
|
return /* @__PURE__ */ jsx(StyleContext, {
|
|
194
|
-
value:
|
|
195
|
-
children: /* @__PURE__ */ jsx(
|
|
214
|
+
value: styleContext,
|
|
215
|
+
children: /* @__PURE__ */ jsx(HydrationContext, {
|
|
216
|
+
value: rest.suppressHydrationWarning ? { suppressHydrationWarning: true } : {},
|
|
217
|
+
children: /* @__PURE__ */ jsx(ProxyComponent, { ...rest })
|
|
218
|
+
})
|
|
196
219
|
});
|
|
197
220
|
}, displayName);
|
|
198
221
|
};
|
|
@@ -218,10 +241,12 @@ function createSlotComponent(rootName, style) {
|
|
|
218
241
|
return {
|
|
219
242
|
component,
|
|
220
243
|
ComponentContext,
|
|
244
|
+
HydrationContext,
|
|
221
245
|
PropsContext,
|
|
222
246
|
StyleContext,
|
|
223
247
|
useClassNames,
|
|
224
248
|
useComponentContext,
|
|
249
|
+
useHydrationContext,
|
|
225
250
|
usePropsContext,
|
|
226
251
|
useStyleContext,
|
|
227
252
|
withContext,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-component.js","names":["createContext","name","withContext","style"],"sources":["../../../../src/core/components/create-component.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, FunctionComponent } from \"react\"\nimport type { AnyString, Dict, Merge } from \"../../utils\"\nimport type { CSSObject, CSSSlotObject } from \"../css\"\nimport type {\n ComponentSlotStyle,\n ComponentStyle,\n StyledOptions,\n System,\n WithoutThemeProps,\n} from \"../system\"\nimport type {\n As,\n DOMElement,\n HTMLStyledProps,\n Component as OriginalComponent,\n} from \"./index.types\"\nimport { Fragment } from \"react\"\nimport {\n createContext,\n cx,\n isArray,\n isFunction,\n isObject,\n isString,\n runIfFn,\n toArray,\n toCamelCase,\n toPascalCase,\n} from \"../../utils\"\nimport { styled, useSystem } from \"../system\"\nimport { chainProps, mergeProps } from \"./props\"\nimport {\n getSlotClassName,\n mergeSlotCSS,\n useComponentSlotStyle,\n useComponentStyle,\n} from \"./use-component-style\"\nimport { getClassName, getDisplayName } from \"./utils\"\n\ntype AsWithFragment = \"fragment\" | As\ntype ClassName = ((system: System) => string) | string\n\ntype Component<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n> = Y extends \"fragment\"\n ? FunctionComponent<M>\n : OriginalComponent<Exclude<Y, \"fragment\">, M>\n\nexport type ComponentSlotName<\n Y extends ComponentSlotStyle | ComponentStyle = ComponentSlotStyle,\n> = AnyString | Extract<keyof NonNullable<Y[\"base\"]>, string>\n\nexport type ComponentSlot<Y extends string> =\n | [Y, Y]\n | Y\n | { name: string; slot: [Y, Y] | Y }\n\nexport type InitialProps<Y extends Dict = Dict> =\n | ((props: Y) => any)\n | Partial<Y>\nexport type SuperProps<Y extends Dict = Dict> = ((props: Y) => any) | Y\n\nexport type SuperWithoutThemeProps<\n Y extends Dict = Dict,\n M extends Dict = Dict,\n D extends keyof Y = keyof Y,\n> = ((props: WithoutThemeProps<Y, M, D>) => any) | WithoutThemeProps<Y, M, D>\n\nexport interface UseComponentPropsOptions<\n Y extends number | string | symbol = string,\n> {\n className?: ClassName\n withContext?: boolean\n transferProps?: Y[]\n}\n\nexport interface ComponentOptions extends Omit<StyledOptions, \"transferProps\"> {\n className?: ClassName\n shouldStyleProps?: boolean\n}\n\ninterface classNameOptions<Y extends string = string> {\n className?: ClassName\n slot?: ComponentSlot<Y>\n}\n\nexport interface ComponentWithContextOptions<\n Y extends number | string | symbol = string,\n>\n extends ComponentOptions, UseComponentPropsOptions<Y> {}\n\nfunction createProxyComponent<\n Y extends AsWithFragment = \"div\",\n M extends Dict = Dict,\n>(el: FC<M> | Y, { shouldStyleProps, ...options }: ComponentOptions = {}) {\n options.shouldForwardProp ??= isFunction(el)\n shouldStyleProps ??= !isFunction(el)\n\n if (el === \"fragment\") el = Fragment\n\n if (shouldStyleProps || isString(el)) {\n const ProxyComponent = styled(el as As, options)\n\n ProxyComponent.displayName = \"ProxyComponent\"\n\n return ProxyComponent\n } else {\n el.displayName ??= \"ProxyComponent\"\n\n return el as FC<M>\n }\n}\n\nfunction withDisplayName<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n>(Component: FC<M>, displayName: string) {\n Object.defineProperty(Component, \"name\", { value: displayName })\n Object.defineProperty(Component, \"displayName\", { value: displayName })\n\n return Component as Component<Y, M>\n}\n\nfunction getSlotKey<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"unknown\"\n\n if (isArray(slot) || !isObject(slot)) {\n return toCamelCase(toArray(slot).join(\"-\"))\n } else {\n return toCamelCase(slot.name)\n }\n}\n\nfunction getSlotName<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"\"\n\n if (isArray(slot)) {\n return slot.map((value) => toPascalCase(value as string)).join(\"\")\n } else if (isObject(slot)) {\n return toPascalCase(slot.name)\n } else {\n return toPascalCase(slot as string)\n }\n}\n\nexport function createComponent<\n Y extends object = {},\n M extends ComponentStyle = Dict,\n D extends Dict = Dict,\n>(name: string, style?: M) {\n const defaultClassName = style?.className\n const defaultDisplayName = getDisplayName(name)\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${defaultDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${defaultDisplayName}PropsContext`,\n strict: false,\n })\n\n function useClassName(name?: string, className?: ClassName) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getClassName(name, defaultClassName)(system)\n\n return className\n }\n\n function useComponentProps<H extends Y = Y, R extends keyof H = keyof H>(\n props: H,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= defaultClassName\n className ??= getClassName(name)(system)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext\n ? (mergeProps(contextProps, props)() as H)\n : props\n const [, rest] = useComponentStyle(mergedProps, {\n name,\n className,\n style,\n transferProps,\n })\n\n return rest\n }\n\n function component<D extends AsWithFragment = \"div\", H extends Dict = Y>(\n el: D | FC<H>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperProps<H>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps<any>(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withContext<\n D extends AsWithFragment = \"div\",\n H extends Y = Y,\n R extends keyof H = keyof H,\n >(\n el: D | FC<WithoutThemeProps<H, M, R>>,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<R> = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperWithoutThemeProps<H, M, R>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useComponentProps(computedProps, {\n className,\n withContext,\n transferProps,\n })\n const rest = chainProps<any>(...toArray(superProps))()(mergedProps)\n\n return <ProxyComponent {...rest} />\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n PropsContext,\n useComponentContext,\n usePropsContext,\n withContext,\n useComponentProps,\n }\n}\n\nexport function createSlotComponent<\n Y extends object = {},\n M extends ComponentSlotStyle = Dict,\n D extends Dict = Dict,\n>(rootName: string, style?: M) {\n const rootClassName = style?.className\n const rootDisplayName = getDisplayName(rootName)\n const classNameMap = new Map<string, classNameOptions>()\n const [StyleContext, useStyleContext] = createContext<\n CSSSlotObject<ComponentSlotName<M>>\n >({\n name: `${rootDisplayName}StyleContext`,\n })\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${rootDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${rootDisplayName}PropsContext`,\n strict: false,\n })\n\n function useClassName(\n slot?: ComponentSlot<ComponentSlotName<M>>,\n className?: ClassName,\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return className\n }\n\n function useClassNames() {\n const system = useSystem()\n const entries = classNameMap.entries().map(([key, { className, slot }]) => {\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return [key, className]\n })\n\n return Object.fromEntries(\n entries.filter(([_, className]) => className),\n ) as { [key: string]: string }\n }\n\n function useRootComponentProps<\n Y extends Dict = {},\n R extends keyof Y = keyof Y,\n >(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ): [\n CSSSlotObject,\n Merge<WithoutThemeProps<Y, M, R>, { css?: CSSObject | CSSObject[] }>,\n ] {\n className = useClassName(slot, className)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext\n ? (mergeProps(contextProps, props)() as Y)\n : props\n const [css, rest] = useComponentSlotStyle(mergedProps, {\n name: rootName,\n className,\n style,\n slot,\n transferProps,\n })\n\n return [css, rest]\n }\n\n function useSlotComponentProps<Y extends Dict = {}>(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { className }: Omit<UseComponentPropsOptions, \"transferProps\"> = {},\n ) {\n className = useClassName(slot, className)\n\n const style = useStyleContext()\n\n return {\n ...props,\n className: cx(className, props.className),\n css: mergeSlotCSS(slot, style, props.css),\n }\n }\n\n function component<H extends AsWithFragment = \"div\", R extends Dict = Dict>(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n className = useClassName(slot, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withProvider<\n H extends AsWithFragment = \"div\",\n R extends Y = Y,\n T extends keyof R = keyof R,\n >(\n el: FC<WithoutThemeProps<R, M, T>> | H,\n slot: ComponentSlot<ComponentSlotName<M>> = \"root\" as ComponentSlot<\n ComponentSlotName<M>\n >,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<T> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperWithoutThemeProps<R, M, T>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const [context, mergedProps] = useRootComponentProps(\n computedProps,\n slot,\n {\n className,\n withContext,\n transferProps,\n },\n )\n const rest = chainProps<any>(...superProps)()(mergedProps)\n\n return (\n <StyleContext value={context}>\n <ProxyComponent {...rest} />\n </StyleContext>\n )\n }, displayName)\n }\n }\n\n function withContext<\n H extends AsWithFragment = \"div\",\n R extends Dict = H extends DOMElement ? HTMLStyledProps<H> : Dict,\n >(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n name,\n className,\n withContext,\n ...options\n }: Omit<ComponentWithContextOptions, \"transferProps\"> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useSlotComponentProps(computedProps, slot, {\n className,\n withContext,\n })\n const rest = chainProps(...superProps)()(mergedProps)\n\n return <ProxyComponent {...rest} />\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n PropsContext,\n StyleContext,\n useClassNames,\n useComponentContext,\n usePropsContext,\n useStyleContext,\n withContext,\n withProvider,\n useRootComponentProps,\n useSlotComponentProps,\n }\n}\n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nB,WAAW,gBAAgB,EAAE,EAAE,MAAM,EAAE,EAGzC,MACA;KACE;KACA;KACA;KACD,CACF;AAGD,WACE,oBAAC;KAAa,OAAO;eACnB,oBAAC,kBAAe,GAJP,WAAgB,GAAG,WAAW,EAAE,CAAC,YAAY,GAI1B;MACf;MAEhB,YAAY;;;CAInB,SAAS,YAIP,IACA,MACA,EACE,MACA,WACA,4BACA,GAAG,YACmD,EAAE,EAC1D;EACA,MAAM,iBAAiB,qBAAqB,IAAI,QAAQ;EACxD,MAAM,UAAU,WAAW,KAAK;EAEhC,MAAM,cAAc,eAAe,MAAM,GAAG,kBAD3B,YAAY,KAAK,GACuC;AAEzE,eAAa,IAAI,SAAS;GAAE;GAAW;GAAM,CAAC;AAE9C,SAAO,SACL,cACA,GAAG,YACH;AACA,UAAO,iBAAuB,UAAU;IAItC,MAAM,cAAc,oDAHa,aAAa,GAC1C,aAAa,MAAM,GACnB,WAAW,gBAAgB,EAAE,EAAE,MAAM,EAAE,EACc,MAAM;KAC7D;KACA;KACD,CAAC;AAGF,WAAO,oBAAC,kBAAe,GAFV,WAAW,GAAG,WAAW,EAAE,CAAC,YAAY,GAElB;MAClC,YAAY;;;AAInB,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
1
|
+
{"version":3,"file":"create-component.js","names":["createContext","name","withContext","style"],"sources":["../../../../src/core/components/create-component.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, FunctionComponent } from \"react\"\nimport type { AnyString, Dict, Merge } from \"../../utils\"\nimport type { CSSObject, CSSSlotObject } from \"../css\"\nimport type {\n ComponentSlotStyle,\n ComponentStyle,\n StyledOptions,\n System,\n WithoutThemeProps,\n} from \"../system\"\nimport type {\n As,\n DOMElement,\n HTMLStyledProps,\n Component as OriginalComponent,\n} from \"./index.types\"\nimport { Fragment } from \"react\"\nimport {\n createContext,\n cx,\n isArray,\n isFunction,\n isObject,\n isString,\n runIfFn,\n toArray,\n toCamelCase,\n toPascalCase,\n} from \"../../utils\"\nimport { styled, useSystem } from \"../system\"\nimport { chainProps, mergeProps } from \"./props\"\nimport {\n getSlotClassName,\n mergeSlotCSS,\n useComponentSlotStyle,\n useComponentStyle,\n} from \"./use-component-style\"\nimport { getClassName, getDisplayName } from \"./utils\"\n\nexport interface HydrationContext {\n suppressHydrationWarning?: boolean\n}\n\ntype AsWithFragment = \"fragment\" | As\ntype ClassName = ((system: System) => string) | string\n\ntype Component<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n> = Y extends \"fragment\"\n ? FunctionComponent<M>\n : OriginalComponent<Exclude<Y, \"fragment\">, M>\n\nexport type ComponentSlotName<\n Y extends ComponentSlotStyle | ComponentStyle = ComponentSlotStyle,\n> = AnyString | Extract<keyof NonNullable<Y[\"base\"]>, string>\n\nexport type ComponentSlot<Y extends string> =\n | [Y, Y]\n | Y\n | { name: string; slot: [Y, Y] | Y }\n\nexport type InitialProps<Y extends Dict = Dict> =\n | ((props: Y) => any)\n | Partial<Y>\nexport type SuperProps<Y extends Dict = Dict> = ((props: Y) => any) | Y\n\nexport type SuperWithoutThemeProps<\n Y extends Dict = Dict,\n M extends Dict = Dict,\n D extends keyof Y = keyof Y,\n> = ((props: WithoutThemeProps<Y, M, D>) => any) | WithoutThemeProps<Y, M, D>\n\nexport interface UseComponentPropsOptions<\n Y extends number | string | symbol = string,\n> {\n className?: ClassName\n withContext?: boolean\n transferProps?: Y[]\n}\n\nexport interface ComponentOptions extends Omit<StyledOptions, \"transferProps\"> {\n className?: ClassName\n shouldStyleProps?: boolean\n}\n\ninterface classNameOptions<Y extends string = string> {\n className?: ClassName\n slot?: ComponentSlot<Y>\n}\n\nexport interface ComponentWithContextOptions<\n Y extends number | string | symbol = string,\n>\n extends ComponentOptions, UseComponentPropsOptions<Y> {}\n\nfunction createProxyComponent<\n Y extends AsWithFragment = \"div\",\n M extends Dict = Dict,\n>(el: FC<M> | Y, { shouldStyleProps, ...options }: ComponentOptions = {}) {\n options.shouldForwardProp ??= isFunction(el)\n shouldStyleProps ??= !isFunction(el)\n\n if (el === \"fragment\") el = Fragment\n\n if (shouldStyleProps || isString(el)) {\n const ProxyComponent = styled(el as As, options)\n\n ProxyComponent.displayName = \"ProxyComponent\"\n\n return ProxyComponent\n } else {\n el.displayName ??= \"ProxyComponent\"\n\n return el as FC<M>\n }\n}\n\nfunction withDisplayName<\n Y extends AsWithFragment = AsWithFragment,\n M extends object = {},\n>(Component: FC<M>, displayName: string) {\n Object.defineProperty(Component, \"name\", { value: displayName })\n Object.defineProperty(Component, \"displayName\", { value: displayName })\n\n return Component as Component<Y, M>\n}\n\nfunction getSlotKey<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"unknown\"\n\n if (isArray(slot) || !isObject(slot)) {\n return toCamelCase(toArray(slot).join(\"-\"))\n } else {\n return toCamelCase(slot.name)\n }\n}\n\nfunction getSlotName<Y extends string>(slot?: ComponentSlot<Y>) {\n if (!slot) return \"\"\n\n if (isArray(slot)) {\n return slot.map((value) => toPascalCase(value as string)).join(\"\")\n } else if (isObject(slot)) {\n return toPascalCase(slot.name)\n } else {\n return toPascalCase(slot as string)\n }\n}\n\nexport function createComponent<\n Y extends Dict = {},\n M extends ComponentStyle = Dict,\n D extends Dict = Dict,\n>(name: string, style?: M) {\n const defaultClassName = style?.className\n const defaultDisplayName = getDisplayName(name)\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${defaultDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${defaultDisplayName}PropsContext`,\n strict: false,\n })\n const [HydrationContext, useHydrationContext] =\n createContext<HydrationContext>({\n name: `${defaultDisplayName}HydrationContext`,\n strict: false,\n })\n\n function useClassName(name?: string, className?: ClassName) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getClassName(name, defaultClassName)(system)\n\n return className\n }\n\n function useComponentProps<H extends Y = Y, R extends keyof H = keyof H>(\n props: H,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= defaultClassName\n className ??= getClassName(name)(system)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext\n ? (mergeProps(contextProps, props)() as H)\n : props\n const [, rest] = useComponentStyle(mergedProps, {\n name,\n className,\n style,\n transferProps,\n })\n\n return rest\n }\n\n function component<D extends AsWithFragment = \"div\", H extends Dict = Y>(\n el: D | FC<H>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperProps<H>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const hydrationProps = useHydrationContext()\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps<any>(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...hydrationProps}\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withContext<\n D extends AsWithFragment = \"div\",\n H extends Y = Y,\n R extends keyof H = keyof H,\n >(\n el: D | FC<WithoutThemeProps<H, M, R>>,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<R> = {},\n ) {\n const displayName = getDisplayName(name, defaultDisplayName)\n const ProxyComponent = createProxyComponent(el, options)\n\n return function (\n initialProps?: InitialProps<H>,\n ...superProps: SuperWithoutThemeProps<H, M, R>[]\n ) {\n return withDisplayName<D, H>((props) => {\n className = useClassName(name, className)\n\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useComponentProps(computedProps, {\n className,\n withContext,\n transferProps,\n })\n const rest = chainProps<any>(...toArray(superProps))()(mergedProps)\n const hydrationContext = rest.suppressHydrationWarning\n ? { suppressHydrationWarning: true }\n : {}\n\n return (\n <HydrationContext value={hydrationContext}>\n <ProxyComponent {...rest} />\n </HydrationContext>\n )\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n HydrationContext,\n PropsContext,\n useComponentContext,\n useHydrationContext,\n usePropsContext,\n withContext,\n useComponentProps,\n }\n}\n\nexport function createSlotComponent<\n Y extends object = {},\n M extends ComponentSlotStyle = Dict,\n D extends Dict = Dict,\n>(rootName: string, style?: M) {\n const rootClassName = style?.className\n const rootDisplayName = getDisplayName(rootName)\n const classNameMap = new Map<string, classNameOptions>()\n const [StyleContext, useStyleContext] = createContext<\n CSSSlotObject<ComponentSlotName<M>>\n >({\n name: `${rootDisplayName}StyleContext`,\n })\n const [ComponentContext, useComponentContext] = createContext<D>({\n name: `${rootDisplayName}Context`,\n })\n const [PropsContext, usePropsContext] = createContext<Partial<Y>>({\n name: `${rootDisplayName}PropsContext`,\n strict: false,\n })\n const [HydrationContext, useHydrationContext] =\n createContext<HydrationContext>({\n name: `${rootDisplayName}HydrationContext`,\n strict: false,\n })\n\n function useClassName(\n slot?: ComponentSlot<ComponentSlotName<M>>,\n className?: ClassName,\n ) {\n const system = useSystem()\n\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return className\n }\n\n function useClassNames() {\n const system = useSystem()\n const entries = classNameMap.entries().map(([key, { className, slot }]) => {\n className = runIfFn(className, system)\n className ??= getSlotClassName(\n rootClassName ?? getClassName(rootName)(system),\n slot,\n )\n\n return [key, className]\n })\n\n return Object.fromEntries(\n entries.filter(([_, className]) => className),\n ) as { [key: string]: string }\n }\n\n function useRootComponentProps<\n Y extends Dict = {},\n R extends keyof Y = keyof Y,\n >(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n className,\n withContext = true,\n transferProps,\n }: UseComponentPropsOptions<R> = {},\n ): [\n CSSSlotObject,\n Merge<WithoutThemeProps<Y, M, R>, { css?: CSSObject | CSSObject[] }>,\n ] {\n className = useClassName(slot, className)\n\n const contextProps = usePropsContext() ?? {}\n const mergedProps = withContext\n ? (mergeProps(contextProps, props)() as Y)\n : props\n const [styleContext, rest] = useComponentSlotStyle(mergedProps, {\n name: rootName,\n className,\n style,\n slot,\n transferProps,\n })\n\n return [styleContext, rest]\n }\n\n function useSlotComponentProps<Y extends Dict = {}>(\n props: Y,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { className }: Omit<UseComponentPropsOptions, \"transferProps\"> = {},\n ) {\n className = useClassName(slot, className)\n\n const style = useStyleContext()\n const hydrationProps = useHydrationContext()\n\n return {\n ...hydrationProps,\n ...props,\n className: cx(className, props.className),\n css: mergeSlotCSS(slot, style, props.css),\n }\n }\n\n function component<H extends AsWithFragment = \"div\", R extends Dict = Dict>(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n { name, className, ...options }: ComponentOptions = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n className = useClassName(slot, className)\n\n const hydrationProps = useHydrationContext()\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = chainProps(...superProps)()(computedProps)\n\n return (\n <ProxyComponent\n {...hydrationProps}\n {...mergedProps}\n className={cx(className, mergedProps.className)}\n />\n )\n }, displayName)\n }\n }\n\n function withProvider<\n H extends AsWithFragment = \"div\",\n R extends Y = Y,\n T extends keyof R = keyof R,\n >(\n el: FC<WithoutThemeProps<R, M, T>> | H,\n slot: ComponentSlot<ComponentSlotName<M>> = \"root\" as ComponentSlot<\n ComponentSlotName<M>\n >,\n {\n name,\n className,\n withContext,\n transferProps,\n ...options\n }: ComponentWithContextOptions<T> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperWithoutThemeProps<R, M, T>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const [styleContext, mergedProps] = useRootComponentProps(\n computedProps,\n slot,\n {\n className,\n withContext,\n transferProps,\n },\n )\n const rest = chainProps<any>(...superProps)()(mergedProps)\n const hydrationContext = rest.suppressHydrationWarning\n ? { suppressHydrationWarning: true }\n : {}\n\n return (\n <StyleContext value={styleContext}>\n <HydrationContext value={hydrationContext}>\n <ProxyComponent {...rest} />\n </HydrationContext>\n </StyleContext>\n )\n }, displayName)\n }\n }\n\n function withContext<\n H extends AsWithFragment = \"div\",\n R extends Dict = H extends DOMElement ? HTMLStyledProps<H> : Dict,\n >(\n el: FC<R> | H,\n slot?: ComponentSlot<ComponentSlotName<M>>,\n {\n name,\n className,\n withContext,\n ...options\n }: Omit<ComponentWithContextOptions, \"transferProps\"> = {},\n ) {\n const ProxyComponent = createProxyComponent(el, options)\n const slotKey = getSlotKey(slot)\n const slotName = getSlotName(slot)\n const displayName = getDisplayName(name, `${rootDisplayName}${slotName}`)\n\n classNameMap.set(slotKey, { className, slot })\n\n return function (\n initialProps?: InitialProps<R>,\n ...superProps: SuperProps<R>[]\n ) {\n return withDisplayName<H, R>((props) => {\n const computedProps = isFunction(initialProps)\n ? initialProps(props)\n : mergeProps(initialProps ?? {}, props)()\n const mergedProps = useSlotComponentProps(computedProps, slot, {\n className,\n withContext,\n })\n const rest = chainProps(...superProps)()(mergedProps)\n\n return <ProxyComponent {...rest} />\n }, displayName)\n }\n }\n\n return {\n component,\n ComponentContext,\n HydrationContext,\n PropsContext,\n StyleContext,\n useClassNames,\n useComponentContext,\n useHydrationContext,\n usePropsContext,\n useStyleContext,\n withContext,\n withProvider,\n useRootComponentProps,\n useSlotComponentProps,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAkGA,SAAS,qBAGP,IAAe,EAAE,kBAAkB,GAAG,YAA8B,EAAE,EAAE;AACxE,SAAQ,oDAAiC,GAAG;AAC5C,sBAAqB,+BAAY,GAAG;AAEpC,KAAI,OAAO,WAAY,MAAK;AAE5B,KAAI,gDAA6B,GAAG,EAAE;EACpC,MAAM,iBAAiB,OAAO,IAAU,QAAQ;AAEhD,iBAAe,cAAc;AAE7B,SAAO;QACF;AACL,KAAG,gBAAgB;AAEnB,SAAO;;;AAIX,SAAS,gBAGP,WAAkB,aAAqB;AACvC,QAAO,eAAe,WAAW,QAAQ,EAAE,OAAO,aAAa,CAAC;AAChE,QAAO,eAAe,WAAW,eAAe,EAAE,OAAO,aAAa,CAAC;AAEvE,QAAO;;AAGT,SAAS,WAA6B,MAAyB;AAC7D,KAAI,CAAC,KAAM,QAAO;AAElB,gCAAY,KAAK,IAAI,6BAAU,KAAK,CAClC,kEAA2B,KAAK,CAAC,KAAK,IAAI,CAAC;KAE3C,uCAAmB,KAAK,KAAK;;AAIjC,SAAS,YAA8B,MAAyB;AAC9D,KAAI,CAAC,KAAM,QAAO;AAElB,gCAAY,KAAK,CACf,QAAO,KAAK,KAAK,0CAAuB,MAAgB,CAAC,CAAC,KAAK,GAAG;sCAChD,KAAK,CACvB,wCAAoB,KAAK,KAAK;KAE9B,wCAAoB,KAAe;;AAIvC,SAAgB,gBAId,MAAc,OAAW;CACzB,MAAM,mBAAmB,OAAO;CAChC,MAAM,qBAAqB,eAAe,KAAK;CAC/C,MAAM,CAAC,kBAAkB,uBAAuBA,gBAAiB,EAC/D,MAAM,GAAG,mBAAmB,UAC7B,CAAC;CACF,MAAM,CAAC,cAAc,mBAAmBA,gBAA0B;EAChE,MAAM,GAAG,mBAAmB;EAC5B,QAAQ;EACT,CAAC;C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D;KACA;KACD,CAAC;AAGF,WAAO,oBAAC,kBAAe,GAFV,WAAW,GAAG,WAAW,EAAE,CAAC,YAAY,GAElB;MAClC,YAAY;;;AAInB,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
@@ -3,13 +3,11 @@ import { ThemeProps } from "../../core/system/index.types.js";
|
|
|
3
3
|
import { Component, HTMLStyledProps } from "../../core/components/index.types.js";
|
|
4
4
|
import "../../core/index.js";
|
|
5
5
|
import { WithTransitionProps } from "../motion/index.types.js";
|
|
6
|
-
import "../motion/index.js";
|
|
7
6
|
import { CollapseProps } from "../collapse/collapse.js";
|
|
8
|
-
import "../collapse/index.js";
|
|
9
7
|
import "../../index.js";
|
|
10
8
|
import { AccordionStyle } from "./accordion.style.js";
|
|
11
9
|
import { UseAccordionItemProps, UseAccordionProps } from "./use-accordion.js";
|
|
12
|
-
import * as
|
|
10
|
+
import * as react961 from "react";
|
|
13
11
|
|
|
14
12
|
//#region src/components/accordion/accordion.d.ts
|
|
15
13
|
interface AccordionCallBackProps {
|
|
@@ -33,7 +31,7 @@ interface AccordionRootProps extends Omit<HTMLStyledProps, "onChange">, ThemePro
|
|
|
33
31
|
*/
|
|
34
32
|
items?: AccordionItem[];
|
|
35
33
|
}
|
|
36
|
-
declare const AccordionPropsContext:
|
|
34
|
+
declare const AccordionPropsContext: react961.Context<Partial<AccordionRootProps> | undefined>, useAccordionPropsContext: () => Partial<AccordionRootProps> | undefined;
|
|
37
35
|
/**
|
|
38
36
|
* `Accordion` is a component for a list that displays information in an expandable or collapsible manner.
|
|
39
37
|
*
|