@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
|
@@ -15,7 +15,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
15
15
|
* @see https://yamada-ui.com/docs/components/avatar
|
|
16
16
|
*/
|
|
17
17
|
const AvatarGroupRoot = require_avatar.component((props) => {
|
|
18
|
-
const [, { colorScheme, size, variant, shape, ...rest }] = require_avatar.useRootComponentProps(props, "group", { transferProps: [
|
|
18
|
+
const [, { colorScheme, size, variant, shape, suppressHydrationWarning, ...rest }] = require_avatar.useRootComponentProps(props, "group", { transferProps: [
|
|
19
19
|
"variant",
|
|
20
20
|
"colorScheme",
|
|
21
21
|
"size",
|
|
@@ -27,14 +27,17 @@ const AvatarGroupRoot = require_avatar.component((props) => {
|
|
|
27
27
|
colorScheme,
|
|
28
28
|
size,
|
|
29
29
|
variant,
|
|
30
|
-
shape
|
|
30
|
+
shape,
|
|
31
|
+
suppressHydrationWarning
|
|
31
32
|
}), [
|
|
32
33
|
variant,
|
|
33
34
|
size,
|
|
34
35
|
colorScheme,
|
|
35
|
-
shape
|
|
36
|
+
shape,
|
|
37
|
+
suppressHydrationWarning
|
|
36
38
|
]),
|
|
37
39
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory.styled.div, {
|
|
40
|
+
suppressHydrationWarning,
|
|
38
41
|
...getRootProps(),
|
|
39
42
|
children: [excess > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_avatar.Avatar, { fallback: `+${excess}` }) : null, children]
|
|
40
43
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar-group.cjs","names":["component","useRootComponentProps","useAvatarGroup","AvatarPropsContext","styled","Avatar"],"sources":["../../../../src/components/avatar/avatar-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { AvatarStyle } from \"./avatar.style\"\nimport type { UseAvatarGroupProps } from \"./use-avatar-group\"\nimport { useMemo } from \"react\"\nimport { styled } from \"../../core\"\nimport {\n Avatar,\n AvatarPropsContext,\n component,\n useRootComponentProps,\n} from \"./avatar\"\nimport { useAvatarGroup } from \"./use-avatar-group\"\n\nexport interface AvatarGroupRootProps\n extends HTMLStyledProps, ThemeProps<AvatarStyle>, UseAvatarGroupProps {}\n\n/**\n * `Avatar` is a component that displays a profile picture or an icon with initials representing a user.\n *\n * @see https://yamada-ui.com/docs/components/avatar\n */\nexport const AvatarGroupRoot = component<\"div\", AvatarGroupRootProps>(\n (props) => {\n const [
|
|
1
|
+
{"version":3,"file":"avatar-group.cjs","names":["component","useRootComponentProps","useAvatarGroup","AvatarPropsContext","styled","Avatar"],"sources":["../../../../src/components/avatar/avatar-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { AvatarStyle } from \"./avatar.style\"\nimport type { UseAvatarGroupProps } from \"./use-avatar-group\"\nimport { useMemo } from \"react\"\nimport { styled } from \"../../core\"\nimport {\n Avatar,\n AvatarPropsContext,\n component,\n useRootComponentProps,\n} from \"./avatar\"\nimport { useAvatarGroup } from \"./use-avatar-group\"\n\nexport interface AvatarGroupRootProps\n extends HTMLStyledProps, ThemeProps<AvatarStyle>, UseAvatarGroupProps {}\n\n/**\n * `Avatar` is a component that displays a profile picture or an icon with initials representing a user.\n *\n * @see https://yamada-ui.com/docs/components/avatar\n */\nexport const AvatarGroupRoot = component<\"div\", AvatarGroupRootProps>(\n (props) => {\n const [\n ,\n { colorScheme, size, variant, shape, suppressHydrationWarning, ...rest },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\"variant\", \"colorScheme\", \"size\", \"shape\"],\n })\n const { children, excess, getRootProps } = useAvatarGroup(rest)\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n shape,\n suppressHydrationWarning,\n }),\n [variant, size, colorScheme, shape, suppressHydrationWarning],\n )\n\n return (\n <AvatarPropsContext value={context}>\n <styled.div\n suppressHydrationWarning={suppressHydrationWarning}\n {...getRootProps()}\n >\n {excess > 0 ? <Avatar fallback={`+${excess}`} /> : null}\n {children}\n </styled.div>\n </AvatarPropsContext>\n )\n },\n \"group\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;;AAuBA,MAAa,kBAAkBA,0BAC5B,UAAU;CACT,MAAM,GAEJ,EAAE,aAAa,MAAM,SAAS,OAAO,0BAA0B,GAAG,UAChEC,qCAAsB,OAAO,SAAS,EACxC,eAAe;EAAC;EAAW;EAAe;EAAQ;EAAQ,EAC3D,CAAC;CACF,MAAM,EAAE,UAAU,QAAQ,iBAAiBC,wCAAe,KAAK;AAY/D,QACE,2CAACC;EAAmB,iCAXb;GACL;GACA;GACA;GACA;GACA;GACD,GACD;GAAC;GAAS;GAAM;GAAa;GAAO;GAAyB,CAC9D;YAIG,4CAACC,uBAAO;GACoB;GAC1B,GAAI,cAAc;cAEjB,SAAS,IAAI,2CAACC,yBAAO,UAAU,IAAI,WAAY,GAAG,MAClD;IACU;GACM;GAGzB,QACD,EAAE"}
|
|
@@ -15,7 +15,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
15
15
|
* @see https://yamada-ui.com/docs/components/checkbox
|
|
16
16
|
*/
|
|
17
17
|
const CheckboxGroupRoot = require_checkbox.component((props) => {
|
|
18
|
-
const [, { colorScheme, size, variant, checkedIcon, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], readOnly, shape, ...rest }] = require_checkbox.useRootComponentProps(props, "group", { transferProps: [
|
|
18
|
+
const [, { colorScheme, size, variant, checkedIcon, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], readOnly, shape, suppressHydrationWarning, ...rest }] = require_checkbox.useRootComponentProps(props, "group", { transferProps: [
|
|
19
19
|
"variant",
|
|
20
20
|
"colorScheme",
|
|
21
21
|
"size",
|
|
@@ -41,7 +41,8 @@ const CheckboxGroupRoot = require_checkbox.component((props) => {
|
|
|
41
41
|
focusBorderColor,
|
|
42
42
|
invalid,
|
|
43
43
|
readOnly,
|
|
44
|
-
shape
|
|
44
|
+
shape,
|
|
45
|
+
suppressHydrationWarning
|
|
45
46
|
}), [
|
|
46
47
|
variant,
|
|
47
48
|
size,
|
|
@@ -52,7 +53,8 @@ const CheckboxGroupRoot = require_checkbox.component((props) => {
|
|
|
52
53
|
readOnly,
|
|
53
54
|
errorBorderColor,
|
|
54
55
|
focusBorderColor,
|
|
55
|
-
checkedIcon
|
|
56
|
+
checkedIcon,
|
|
57
|
+
suppressHydrationWarning
|
|
56
58
|
]),
|
|
57
59
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_checkbox_group.CheckboxGroupContext, {
|
|
58
60
|
value: (0, react.useMemo)(() => ({
|
|
@@ -70,7 +72,7 @@ const CheckboxGroupRoot = require_checkbox.component((props) => {
|
|
|
70
72
|
]),
|
|
71
73
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_group.Group, {
|
|
72
74
|
orientation: "vertical",
|
|
73
|
-
...getRootProps(),
|
|
75
|
+
...getRootProps({ suppressHydrationWarning }),
|
|
74
76
|
children: computedChildren
|
|
75
77
|
})
|
|
76
78
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-group.cjs","names":["component","useRootComponentProps","useCheckboxGroup","rest","Checkbox","value","CheckboxPropsContext","CheckboxGroupContext","Group"],"sources":["../../../../src/components/checkbox/checkbox-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 { CheckboxProps } from \"./checkbox\"\nimport type { CheckboxStyle } from \"./checkbox.style\"\nimport type { UseCheckboxGroupProps } from \"./use-checkbox-group\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport {\n Checkbox,\n CheckboxPropsContext,\n component,\n useRootComponentProps,\n} from \"./checkbox\"\nimport { CheckboxGroupContext, useCheckboxGroup } from \"./use-checkbox-group\"\n\nexport interface CheckboxGroupItem<\n Y extends string = string,\n> extends CheckboxProps<Y> {\n label: ReactNode\n}\n\nexport interface CheckboxGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, CheckboxStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<CheckboxStyle>,\n UseCheckboxGroupProps<Y>,\n UseInputBorderProps,\n Pick<CheckboxProps, \"checkedIcon\"> {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: CheckboxGroupItem<Y>[]\n}\n\n/**\n * `CheckboxGroup` is a component that groups `Checkbox` components.\n *\n * @see https://yamada-ui.com/docs/components/checkbox\n */\nexport const CheckboxGroupRoot = component<\"div\", CheckboxGroupRootProps>(\n (props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n checkedIcon,\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 { max, value, getInputProps, getLabelProps, getRootProps, onChange } =\n useCheckboxGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ label, value, ...rest }, index) => (\n <Checkbox key={value ?? index} value={value} {...rest}>\n {label}\n </Checkbox>\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n checkedIcon,\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 checkedIcon,\n ],\n )\n const groupContext = useMemo(\n () => ({ max, value, getInputProps, getLabelProps, onChange }),\n [max, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <CheckboxPropsContext value={context}>\n <CheckboxGroupContext value={groupContext}>\n <Group
|
|
1
|
+
{"version":3,"file":"checkbox-group.cjs","names":["component","useRootComponentProps","useCheckboxGroup","rest","Checkbox","value","CheckboxPropsContext","CheckboxGroupContext","Group"],"sources":["../../../../src/components/checkbox/checkbox-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 { CheckboxProps } from \"./checkbox\"\nimport type { CheckboxStyle } from \"./checkbox.style\"\nimport type { UseCheckboxGroupProps } from \"./use-checkbox-group\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport {\n Checkbox,\n CheckboxPropsContext,\n component,\n useRootComponentProps,\n} from \"./checkbox\"\nimport { CheckboxGroupContext, useCheckboxGroup } from \"./use-checkbox-group\"\n\nexport interface CheckboxGroupItem<\n Y extends string = string,\n> extends CheckboxProps<Y> {\n label: ReactNode\n}\n\nexport interface CheckboxGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, CheckboxStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<CheckboxStyle>,\n UseCheckboxGroupProps<Y>,\n UseInputBorderProps,\n Pick<CheckboxProps, \"checkedIcon\"> {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: CheckboxGroupItem<Y>[]\n}\n\n/**\n * `CheckboxGroup` is a component that groups `Checkbox` components.\n *\n * @see https://yamada-ui.com/docs/components/checkbox\n */\nexport const CheckboxGroupRoot = component<\"div\", CheckboxGroupRootProps>(\n (props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n checkedIcon,\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 { max, value, getInputProps, getLabelProps, getRootProps, onChange } =\n useCheckboxGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ label, value, ...rest }, index) => (\n <Checkbox key={value ?? index} value={value} {...rest}>\n {label}\n </Checkbox>\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n checkedIcon,\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 checkedIcon,\n suppressHydrationWarning,\n ],\n )\n const groupContext = useMemo(\n () => ({ max, value, getInputProps, getLabelProps, onChange }),\n [max, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <CheckboxPropsContext value={context}>\n <CheckboxGroupContext value={groupContext}>\n <Group\n orientation=\"vertical\"\n {...getRootProps({ suppressHydrationWarning })}\n >\n {computedChildren}\n </Group>\n </CheckboxGroupContext>\n </CheckboxPropsContext>\n )\n },\n \"group\",\n)() as GenericsComponent<{\n <Y extends string = string>(props: CheckboxGroupRootProps<Y>): ReactElement\n}>\n\nexport { Checkbox as CheckboxGroupItem }\n"],"mappings":";;;;;;;;;;;;;;;;AAoDA,MAAa,oBAAoBA,4BAC9B,UAAU;CACT,MAAM,GAEJ,EACE,aACA,MACA,SACA,aACA,UACA,UACA,kBACA,kBACA,SACA,QAAQ,EAAE,EACV,UACA,OACA,0BACA,GAAG,UAEHC,uCAAsB,OAAO,SAAS,EACxC,eAAe;EAAC;EAAW;EAAe;EAAQ;EAAQ,EAC3D,CAAC;CACF,MAAM,EAAE,KAAK,OAAO,eAAe,eAAe,cAAc,aAC9DC,4CAAiB,KAAK;CACxB,MAAM,4CAAiC;AACrC,MAAI,SAAU,QAAO;AAErB,SAAO,MAAM,KAAK,EAAE,OAAO,gBAAO,GAAGC,UAAQ,UAC3C,2CAACC;GAA8B,OAAOC;GAAO,GAAIF;aAC9C;KADYE,WAAS,MAEb,CACX;IACD,CAAC,OAAO,SAAS,CAAC;AAkCrB,QACE,2CAACC;EAAqB,iCAjCf;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;YAQG,2CAACC;GAAqB,iCANjB;IAAE;IAAK;IAAO;IAAe;IAAe;IAAU,GAC7D;IAAC;IAAK;IAAO;IAAe;IAAe;IAAS,CACrD;aAKK,2CAACC;IACC,aAAY;IACZ,GAAI,aAAa,EAAE,0BAA0B,CAAC;cAE7C;KACK;IACa;GACF;GAG3B,QACD,EAAE"}
|
|
@@ -16,7 +16,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
16
16
|
* @see https://yamada-ui.com/docs/components/checkbox-card
|
|
17
17
|
*/
|
|
18
18
|
const CheckboxCardGroupRoot = require_checkbox_card.component((props) => {
|
|
19
|
-
const [, { colorScheme, size, variant, checkedIcon, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], justify, readOnly, shape, withIndicator, ...rest }] = require_checkbox_card.useRootComponentProps(props, "group", { transferProps: [
|
|
19
|
+
const [, { colorScheme, size, variant, checkedIcon, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], justify, readOnly, shape, suppressHydrationWarning, withIndicator, ...rest }] = require_checkbox_card.useRootComponentProps(props, "group", { transferProps: [
|
|
20
20
|
"variant",
|
|
21
21
|
"colorScheme",
|
|
22
22
|
"size",
|
|
@@ -45,6 +45,7 @@ const CheckboxCardGroupRoot = require_checkbox_card.component((props) => {
|
|
|
45
45
|
justify,
|
|
46
46
|
readOnly,
|
|
47
47
|
shape,
|
|
48
|
+
suppressHydrationWarning,
|
|
48
49
|
withIndicator
|
|
49
50
|
}), [
|
|
50
51
|
colorScheme,
|
|
@@ -58,7 +59,8 @@ const CheckboxCardGroupRoot = require_checkbox_card.component((props) => {
|
|
|
58
59
|
focusBorderColor,
|
|
59
60
|
invalid,
|
|
60
61
|
readOnly,
|
|
61
|
-
shape
|
|
62
|
+
shape,
|
|
63
|
+
suppressHydrationWarning
|
|
62
64
|
]),
|
|
63
65
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_checkbox_group.CheckboxGroupContext, {
|
|
64
66
|
value: (0, react.useMemo)(() => ({
|
|
@@ -75,7 +77,7 @@ const CheckboxCardGroupRoot = require_checkbox_card.component((props) => {
|
|
|
75
77
|
onChange
|
|
76
78
|
]),
|
|
77
79
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_group.Group, {
|
|
78
|
-
...getRootProps(),
|
|
80
|
+
...getRootProps({ suppressHydrationWarning }),
|
|
79
81
|
children: computedChildren
|
|
80
82
|
})
|
|
81
83
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-card-group.cjs","names":["component","useRootComponentProps","useCheckboxGroup","rest","CheckboxCardRoot","value","CheckboxCardPropsContext","CheckboxGroupContext","Group"],"sources":["../../../../src/components/checkbox-card/checkbox-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 { UseCheckboxGroupProps } from \"../checkbox\"\nimport type { GroupProps } from \"../group\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { CheckboxCardRootProps } from \"./checkbox-card\"\nimport type { CheckboxCardStyle } from \"./checkbox-card.style\"\nimport { useMemo } from \"react\"\nimport { CheckboxGroupContext, useCheckboxGroup } from \"../checkbox\"\nimport { Group } from \"../group\"\nimport {\n CheckboxCardPropsContext,\n CheckboxCardRoot,\n component,\n useRootComponentProps,\n} from \"./checkbox-card\"\n\nexport interface CheckboxCardGroupItem<\n Y extends string = string,\n> extends CheckboxCardRootProps<Y> {}\n\nexport interface CheckboxCardGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, CheckboxCardStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<CheckboxCardStyle>,\n UseCheckboxGroupProps<Y>,\n UseInputBorderProps,\n Pick<CheckboxCardRootProps, \"checkedIcon\" | \"withIndicator\"> {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: CheckboxCardGroupItem<Y>[]\n}\n\n/**\n * `CheckboxCardGroup` is a component that groups `CheckboxCard` components.\n *\n * @see https://yamada-ui.com/docs/components/checkbox-card\n */\nexport const CheckboxCardGroupRoot = component<\n \"div\",\n CheckboxCardGroupRootProps\n>((props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n checkedIcon,\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 { max, value, getInputProps, getLabelProps, getRootProps, onChange } =\n useCheckboxGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ value, ...rest }, index) => (\n <CheckboxCardRoot key={value ?? index} value={value} {...rest} />\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n checkedIcon,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n justify,\n readOnly,\n shape,\n withIndicator,\n }),\n [\n colorScheme,\n size,\n checkedIcon,\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 () => ({ max, value, getInputProps, getLabelProps, onChange }),\n [max, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <CheckboxCardPropsContext value={context}>\n <CheckboxGroupContext value={groupContext}>\n <Group {...getRootProps()}
|
|
1
|
+
{"version":3,"file":"checkbox-card-group.cjs","names":["component","useRootComponentProps","useCheckboxGroup","rest","CheckboxCardRoot","value","CheckboxCardPropsContext","CheckboxGroupContext","Group"],"sources":["../../../../src/components/checkbox-card/checkbox-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 { UseCheckboxGroupProps } from \"../checkbox\"\nimport type { GroupProps } from \"../group\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { CheckboxCardRootProps } from \"./checkbox-card\"\nimport type { CheckboxCardStyle } from \"./checkbox-card.style\"\nimport { useMemo } from \"react\"\nimport { CheckboxGroupContext, useCheckboxGroup } from \"../checkbox\"\nimport { Group } from \"../group\"\nimport {\n CheckboxCardPropsContext,\n CheckboxCardRoot,\n component,\n useRootComponentProps,\n} from \"./checkbox-card\"\n\nexport interface CheckboxCardGroupItem<\n Y extends string = string,\n> extends CheckboxCardRootProps<Y> {}\n\nexport interface CheckboxCardGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, CheckboxCardStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<CheckboxCardStyle>,\n UseCheckboxGroupProps<Y>,\n UseInputBorderProps,\n Pick<CheckboxCardRootProps, \"checkedIcon\" | \"withIndicator\"> {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: CheckboxCardGroupItem<Y>[]\n}\n\n/**\n * `CheckboxCardGroup` is a component that groups `CheckboxCard` components.\n *\n * @see https://yamada-ui.com/docs/components/checkbox-card\n */\nexport const CheckboxCardGroupRoot = component<\n \"div\",\n CheckboxCardGroupRootProps\n>((props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n checkedIcon,\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 { max, value, getInputProps, getLabelProps, getRootProps, onChange } =\n useCheckboxGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ value, ...rest }, index) => (\n <CheckboxCardRoot key={value ?? index} value={value} {...rest} />\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n checkedIcon,\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 checkedIcon,\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 () => ({ max, value, getInputProps, getLabelProps, onChange }),\n [max, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <CheckboxCardPropsContext value={context}>\n <CheckboxGroupContext value={groupContext}>\n <Group {...getRootProps({ suppressHydrationWarning })}>\n {computedChildren}\n </Group>\n </CheckboxGroupContext>\n </CheckboxCardPropsContext>\n )\n}, \"group\")() as GenericsComponent<{\n <Y extends string = string>(\n props: CheckboxCardGroupRootProps<Y>,\n ): ReactElement\n}>\n\nexport { CheckboxCardRoot as CheckboxCardGroupItem }\n"],"mappings":";;;;;;;;;;;;;;;;;AAkDA,MAAa,wBAAwBA,iCAGlC,UAAU;CACX,MAAM,GAEJ,EACE,aACA,MACA,SACA,aACA,UACA,UACA,kBACA,kBACA,SACA,QAAQ,EAAE,EACV,SACA,UACA,OACA,0BACA,eACA,GAAG,UAEHC,4CAAsB,OAAO,SAAS,EACxC,eAAe;EACb;EACA;EACA;EACA;EACA;EACA;EACD,EACF,CAAC;CACF,MAAM,EAAE,KAAK,OAAO,eAAe,eAAe,cAAc,aAC9DC,4CAAiB,KAAK;CACxB,MAAM,4CAAiC;AACrC,MAAI,SAAU,QAAO;AAErB,SAAO,MAAM,KAAK,EAAE,gBAAO,GAAGC,UAAQ,UACpC,2CAACC;GAAsC,OAAOC;GAAO,GAAIF;KAAlCE,WAAS,MAAiC,CACjE;IACD,CAAC,OAAO,SAAS,CAAC;AAsCrB,QACE,2CAACC;EAAyB,iCArCnB;GACL;GACA;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;GACA;GACD,CACF;YAQG,2CAACC;GAAqB,iCANjB;IAAE;IAAK;IAAO;IAAe;IAAe;IAAU,GAC7D;IAAC;IAAK;IAAO;IAAe;IAAe;IAAS,CACrD;aAKK,2CAACC;IAAM,GAAI,aAAa,EAAE,0BAA0B,CAAC;cAClD;KACK;IACa;GACE;GAE5B,QAAQ,EAAE"}
|
|
@@ -18,7 +18,7 @@ let react = require("react");
|
|
|
18
18
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
19
19
|
|
|
20
20
|
//#region src/components/menu/menu.tsx
|
|
21
|
-
const { ComponentContext, PropsContext: MenuPropsContext, StyleContext, useComponentContext, usePropsContext: useMenuPropsContext, withContext, useRootComponentProps } = require_create_component.createSlotComponent("menu", require_menu_style.menuStyle);
|
|
21
|
+
const { ComponentContext, HydrationContext, PropsContext: MenuPropsContext, StyleContext, useComponentContext, usePropsContext: useMenuPropsContext, withContext, useRootComponentProps } = require_create_component.createSlotComponent("menu", require_menu_style.menuStyle);
|
|
22
22
|
/**
|
|
23
23
|
* `Menu` is a component that displays a common dropdown menu.
|
|
24
24
|
*
|
|
@@ -26,7 +26,7 @@ const { ComponentContext, PropsContext: MenuPropsContext, StyleContext, useCompo
|
|
|
26
26
|
*/
|
|
27
27
|
const MenuRoot = (props) => {
|
|
28
28
|
const [styleContext, mergedProps] = useRootComponentProps(props);
|
|
29
|
-
const [{ animationScheme, initialFocusRef, offset, placement, ...popoverProps }, { children, disabled, ...rest }] = require_use_popover.usePopoverProps(mergedProps, [
|
|
29
|
+
const [{ animationScheme, initialFocusRef, offset, placement, ...popoverProps }, { children, disabled, suppressHydrationWarning, ...rest }] = require_use_popover.usePopoverProps(mergedProps, [
|
|
30
30
|
"disabled",
|
|
31
31
|
"open",
|
|
32
32
|
"defaultOpen",
|
|
@@ -65,55 +65,58 @@ const MenuRoot = (props) => {
|
|
|
65
65
|
]);
|
|
66
66
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyleContext, {
|
|
67
67
|
value: styleContext,
|
|
68
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
69
|
-
value:
|
|
70
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_menu.
|
|
71
|
-
value:
|
|
72
|
-
|
|
73
|
-
subMenuDirection,
|
|
74
|
-
onActiveDescendant,
|
|
75
|
-
onClose,
|
|
76
|
-
onCloseSubMenu,
|
|
77
|
-
onOpen,
|
|
78
|
-
onSelect
|
|
79
|
-
}), [
|
|
80
|
-
onClose,
|
|
81
|
-
onOpen,
|
|
82
|
-
onSelect,
|
|
83
|
-
onActiveDescendant,
|
|
84
|
-
subMenu,
|
|
85
|
-
subMenuDirection,
|
|
86
|
-
onCloseSubMenu
|
|
87
|
-
]),
|
|
88
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_menu.MainMenuContext, {
|
|
68
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HydrationContext, {
|
|
69
|
+
value: (0, react.useMemo)(() => suppressHydrationWarning ? { suppressHydrationWarning } : {}, [suppressHydrationWarning]),
|
|
70
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_menu.MenuDescendantsContext, {
|
|
71
|
+
value: descendants,
|
|
72
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_menu.MenuContext, {
|
|
89
73
|
value: (0, react.useMemo)(() => ({
|
|
90
|
-
|
|
91
|
-
|
|
74
|
+
subMenu,
|
|
75
|
+
subMenuDirection,
|
|
92
76
|
onActiveDescendant,
|
|
93
|
-
|
|
77
|
+
onClose,
|
|
78
|
+
onCloseSubMenu,
|
|
79
|
+
onOpen,
|
|
94
80
|
onSelect
|
|
95
81
|
}), [
|
|
96
|
-
|
|
97
|
-
|
|
82
|
+
onClose,
|
|
83
|
+
onOpen,
|
|
84
|
+
onSelect,
|
|
98
85
|
onActiveDescendant,
|
|
99
|
-
|
|
100
|
-
|
|
86
|
+
subMenu,
|
|
87
|
+
subMenuDirection,
|
|
88
|
+
onCloseSubMenu
|
|
101
89
|
]),
|
|
102
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
90
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_menu.MainMenuContext, {
|
|
103
91
|
value: (0, react.useMemo)(() => ({
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
92
|
+
closeOnSelect,
|
|
93
|
+
descendants,
|
|
94
|
+
onActiveDescendant,
|
|
95
|
+
onCloseRef,
|
|
96
|
+
onSelect
|
|
108
97
|
}), [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
98
|
+
closeOnSelect,
|
|
99
|
+
descendants,
|
|
100
|
+
onActiveDescendant,
|
|
101
|
+
onCloseRef,
|
|
102
|
+
onSelect
|
|
113
103
|
]),
|
|
114
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
115
|
-
|
|
116
|
-
|
|
104
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContext, {
|
|
105
|
+
value: (0, react.useMemo)(() => ({
|
|
106
|
+
getContentProps,
|
|
107
|
+
getContextTriggerProps,
|
|
108
|
+
getSeparatorProps,
|
|
109
|
+
getTriggerProps
|
|
110
|
+
}), [
|
|
111
|
+
getContentProps,
|
|
112
|
+
getContextTriggerProps,
|
|
113
|
+
getSeparatorProps,
|
|
114
|
+
getTriggerProps
|
|
115
|
+
]),
|
|
116
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_popover.PopoverRoot, {
|
|
117
|
+
...mergedPopoverProps,
|
|
118
|
+
children
|
|
119
|
+
})
|
|
117
120
|
})
|
|
118
121
|
})
|
|
119
122
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.cjs","names":["createSlotComponent","menuStyle","MenuRoot: FC<MenuRootProps>","usePopoverProps","useMenu","MenuDescendantsContext","MenuContext","MainMenuContext","styled","useMenuContext","rest","Fragment","items","index","useMenuGroupContext","useMenuGroup","MenuGroupContext","useMenuOptionGroup","MenuOptionGroupContext","useMenuItem","ChevronRightIcon","useMenuOptionItem","CircleSmallIcon","CheckIcon"],"sources":["../../../../src/components/menu/menu.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { MenuStyle } from \"./menu.style\"\nimport type {\n MenuOptionGroupType,\n MenuOptionGroupValue,\n UseMenuGroupProps,\n UseMenuItemProps,\n UseMenuOptionGroupProps,\n UseMenuOptionItemProps,\n UseMenuProps,\n UseMenuReturn,\n} from \"./use-menu\"\nimport { Fragment, useMemo, useState } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { cast, handlerAll } from \"../../utils\"\nimport { CheckIcon, ChevronRightIcon, CircleSmallIcon } from \"../icon\"\nimport { Popover, usePopoverProps } from \"../popover\"\nimport { menuStyle } from \"./menu.style\"\nimport {\n MainMenuContext,\n MenuContext,\n MenuDescendantsContext,\n MenuGroupContext,\n MenuOptionGroupContext,\n useMenu,\n useMenuContext,\n useMenuGroup,\n useMenuGroupContext,\n useMenuItem,\n useMenuOptionGroup,\n useMenuOptionItem,\n} from \"./use-menu\"\n\ninterface MenuSharedItem {\n label?: ReactNode\n}\n\ninterface MenuItemWithValue extends MenuSharedItem, MenuItemProps {}\n\ninterface MenuOptionItem extends MenuSharedItem, MenuOptionItemProps {}\n\ninterface MenuItemWithSeparator extends MenuSeparatorProps {\n type: \"separator\"\n}\n\ninterface MenuItemWithRadioGroup<Y extends string = string>\n extends\n Omit<MenuItemWithItems, \"defaultValue\" | \"items\" | \"onChange\">,\n MenuOptionGroupProps<\"radio\", Y> {\n type: \"radio\"\n items?: MenuOptionItem[]\n}\n\ninterface MenuItemWithCheckboxGroup<Y extends string[] = string[]>\n extends\n Omit<MenuItemWithItems, \"defaultValue\" | \"items\" | \"onChange\">,\n MenuOptionGroupProps<\"checkbox\", Y> {\n type: \"checkbox\"\n items?: MenuOptionItem[]\n}\n\ninterface MenuItemWithItems extends MenuSharedItem, MenuGroupProps {\n hasEndSeparator?: boolean\n hasSeparator?: boolean\n hasStartSeparator?: boolean\n items?: MenuItemWithValue[]\n labelProps?: MenuLabelProps\n}\n\nexport type MenuItem =\n | MenuItemWithCheckboxGroup\n | MenuItemWithItems\n | MenuItemWithRadioGroup\n | MenuItemWithSeparator\n | MenuItemWithValue\n\ninterface ComponentContext extends Pick<\n UseMenuReturn,\n | \"getContentProps\"\n | \"getContextTriggerProps\"\n | \"getSeparatorProps\"\n | \"getTriggerProps\"\n> {}\n\nexport interface MenuRootProps\n extends\n UseMenuProps,\n Omit<\n WithoutThemeProps<Popover.RootProps, MenuStyle>,\n \"autoFocus\" | \"modal\" | \"updateRef\" | \"withCloseButton\"\n >,\n ThemeProps<MenuStyle> {\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end-start'\n */\n placement?: Popover.RootProps[\"placement\"]\n}\n\nconst {\n ComponentContext,\n PropsContext: MenuPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: useMenuPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<MenuRootProps, MenuStyle, ComponentContext>(\n \"menu\",\n menuStyle,\n)\n\nexport { MenuPropsContext, useMenuPropsContext }\n\n/**\n * `Menu` is a component that displays a common dropdown menu.\n *\n * @see https://yamada-ui.com/docs/components/menu\n */\nexport const MenuRoot: FC<MenuRootProps> = (props) => {\n const [styleContext, mergedProps] = useRootComponentProps(props)\n const [\n { animationScheme, initialFocusRef, offset, placement, ...popoverProps },\n { children, disabled, ...rest },\n ] = usePopoverProps(mergedProps, [\n \"disabled\",\n \"open\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n ])\n const {\n closeOnSelect,\n descendants,\n open,\n subMenu,\n subMenuDirection,\n updateRef,\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n onActiveDescendant,\n onClose,\n onCloseRef,\n onCloseSubMenu,\n onOpen,\n onSelect,\n } = useMenu({ disabled, ...rest })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n ...popoverProps,\n animationScheme:\n animationScheme ?? (subMenu ? \"inline-start\" : \"block-start\"),\n autoFocus: !!initialFocusRef,\n disabled,\n initialFocusRef,\n offset: offset ?? (subMenu ? [0, 0] : undefined),\n open,\n placement:\n placement ?? (subMenu ? `center-${subMenuDirection}` : \"end-start\"),\n updateRef,\n onClose,\n onOpen,\n }),\n [\n animationScheme,\n disabled,\n initialFocusRef,\n offset,\n onClose,\n onOpen,\n open,\n placement,\n popoverProps,\n subMenu,\n subMenuDirection,\n updateRef,\n ],\n )\n const menuContext = useMemo(\n () => ({\n subMenu,\n subMenuDirection,\n onActiveDescendant,\n onClose,\n onCloseSubMenu,\n onOpen,\n onSelect,\n }),\n [\n onClose,\n onOpen,\n onSelect,\n onActiveDescendant,\n subMenu,\n subMenuDirection,\n onCloseSubMenu,\n ],\n )\n const mainMenuContext = useMemo(\n () => ({\n closeOnSelect,\n descendants,\n onActiveDescendant,\n onCloseRef,\n onSelect,\n }),\n [closeOnSelect, descendants, onActiveDescendant, onCloseRef, onSelect],\n )\n const componentContext = useMemo(\n () => ({\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n }),\n [\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n ],\n )\n\n return (\n <StyleContext value={styleContext}>\n <MenuDescendantsContext value={descendants}>\n <MenuContext value={menuContext}>\n <MainMenuContext value={mainMenuContext}>\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>{children}</Popover.Root>\n </ComponentContext>\n </MainMenuContext>\n </MenuContext>\n </MenuDescendantsContext>\n </StyleContext>\n )\n}\n\nexport interface MenuTriggerProps extends Popover.TriggerProps {}\n\nexport const MenuTrigger = withContext<\"button\", MenuTriggerProps>(\n Popover.Trigger,\n \"trigger\",\n)(undefined, (props) => {\n const { getTriggerProps } = useComponentContext()\n\n return cast<HTMLProps<\"button\">>(getTriggerProps(cast<HTMLProps>(props)))\n})\n\ninterface Rect {\n left: number\n top: number\n}\n\nexport interface MenuContextTriggerProps extends HTMLProps {}\n\nexport const MenuContextTrigger = withContext<\"div\", MenuContextTriggerProps>(\n ({ children, onContextMenu, ...rest }) => {\n const [rect, setRect] = useState<Rect>({\n left: 0,\n top: 0,\n })\n const { getContextTriggerProps } = useComponentContext()\n\n return (\n <>\n <MenuAnchor>\n <styled.div style={{ position: \"fixed\", ...rect }} />\n </MenuAnchor>\n\n <styled.div\n asChild\n {...getContextTriggerProps({\n onContextMenu: handlerAll(onContextMenu, (ev) => {\n setRect({ left: ev.clientX, top: ev.clientY })\n }),\n ...rest,\n })}\n >\n {children}\n </styled.div>\n </>\n )\n },\n \"contextTrigger\",\n)()\n\nexport interface MenuAnchorProps extends Popover.AnchorProps {}\n\nexport const MenuAnchor = withContext<\"div\", MenuAnchorProps>(\n Popover.Anchor,\n \"anchor\",\n)()\n\nexport interface MenuContentProps extends Popover.ContentProps {\n /**\n * The footer of the menu.\n */\n footer?: ReactNode\n /**\n * The header of the menu.\n */\n header?: ReactNode\n /**\n * If provided, generate elements based on items.\n */\n items?: MenuItem[]\n /**\n * Props for the footer component.\n */\n footerProps?: MenuFooterProps\n /**\n * Props for the header component.\n */\n headerProps?: MenuHeaderProps\n}\n\nexport const MenuContent = withContext<\"div\", MenuContentProps>(\n Popover.Content,\n \"content\",\n)(\n undefined,\n ({\n children,\n footer,\n header,\n items = [],\n footerProps,\n headerProps,\n portalProps,\n ...rest\n }) => {\n const { subMenu } = useMenuContext()\n const { getContentProps } = useComponentContext()\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <>\n {header ? <MenuHeader {...headerProps}>{header}</MenuHeader> : null}\n\n {items.map((props, index) => {\n if (\"type\" in props) {\n if (props.type === \"radio\") {\n const {\n type,\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuOptionGroup type={type} {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuOptionItem key={index} {...rest}>\n {label}\n </MenuOptionItem>\n ))}\n </MenuOptionGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else if (props.type === \"checkbox\") {\n const {\n type,\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuOptionGroup type={type} {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuOptionItem key={index} {...rest}>\n {label}\n </MenuOptionItem>\n ))}\n </MenuOptionGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else {\n return <MenuSeparator key={index} />\n }\n } else if (\"items\" in props) {\n const {\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuGroup {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuItem key={index} {...rest}>\n {label}\n </MenuItem>\n ))}\n </MenuGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else if (\"value\" in props) {\n const { label, ...rest } = props\n\n return (\n <MenuItem key={index} {...rest}>\n {label}\n </MenuItem>\n )\n }\n })}\n\n {footer ? <MenuFooter {...footerProps}>{footer}</MenuFooter> : null}\n </>\n )\n }, [children, footer, footerProps, header, headerProps, items])\n\n return {\n ...getContentProps(\n cast<HTMLProps>({ ...rest, children: computedChildren }),\n ),\n portalProps: subMenu ? { ...portalProps, disabled: true } : portalProps,\n }\n },\n)\n\nexport interface MenuHeaderProps extends HTMLStyledProps {}\n\nexport const MenuHeader = withContext<\"div\", MenuHeaderProps>(\n \"div\",\n \"header\",\n)({ \"data-header\": \"\" })\n\nexport interface MenuFooterProps extends HTMLStyledProps {}\n\nexport const MenuFooter = withContext<\"div\", MenuFooterProps>(\n \"div\",\n \"footer\",\n)({ \"data-footer\": \"\" })\n\nexport interface MenuLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const MenuLabel = withContext<\"span\", MenuLabelProps>(\"span\", \"label\")(\n undefined,\n (props) => {\n const { getLabelProps } = useMenuGroupContext()\n\n return getLabelProps(props)\n },\n)\n\nexport interface MenuGroupProps extends UseMenuGroupProps, HTMLStyledProps {\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the label component.\n */\n labelProps?: MenuLabelProps\n}\n\nexport const MenuGroup = withContext<\"div\", MenuGroupProps>(\n ({ children, label, labelProps, ...rest }) => {\n const { getGroupProps, getLabelProps } = useMenuGroup(rest)\n const context = useMemo(() => ({ getLabelProps }), [getLabelProps])\n\n return (\n <MenuGroupContext value={context}>\n <styled.div {...getGroupProps()}>\n {label ? <MenuLabel {...labelProps}>{label}</MenuLabel> : null}\n {children}\n </styled.div>\n </MenuGroupContext>\n )\n },\n \"group\",\n)()\n\nexport interface MenuOptionGroupProps<\n Y extends MenuOptionGroupType = \"checkbox\",\n M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>,\n>\n extends\n UseMenuOptionGroupProps<Y, M>,\n Omit<MenuGroupProps, \"defaultValue\" | \"onChange\"> {}\n\nexport const MenuOptionGroup = withContext<\"div\", MenuOptionGroupProps>(\n ({\n type: typeProp,\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n ...rest\n }) => {\n const { type, value, onChange } = useMenuOptionGroup({\n type: typeProp,\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const context = useMemo(\n () => ({ type, value, onChange }),\n [type, value, onChange],\n )\n\n return (\n <MenuOptionGroupContext value={context}>\n <MenuGroup {...rest} />\n </MenuOptionGroupContext>\n )\n },\n { name: \"OptionGroup\", slot: [\"group\", \"option\"] },\n)() as GenericsComponent<{\n <\n Y extends MenuOptionGroupType = \"checkbox\",\n M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>,\n >(\n props: MenuOptionGroupProps<Y, M>,\n ): ReactElement\n}>\n\nexport interface MenuItemProps extends HTMLStyledProps, UseMenuItemProps {}\n\nexport const MenuItem = withContext<\"div\", MenuItemProps>(\n ({ children, ...rest }) => {\n const { subMenuTrigger, getItemProps } = useMenuItem(rest)\n\n return (\n <styled.div {...getItemProps()}>\n {children}\n\n {subMenuTrigger ? (\n <MenuIndicator as={ChevronRightIcon} ms=\"auto\" />\n ) : null}\n </styled.div>\n )\n },\n \"item\",\n)()\n\nexport interface MenuOptionItemProps\n extends HTMLStyledProps, UseMenuOptionItemProps {\n /**\n * The icon to be used in the menu option item.\n */\n icon?: ReactNode\n}\n\nexport const MenuOptionItem = withContext<\"div\", MenuOptionItemProps>(\n ({ children, icon, ...rest }) => {\n const { type, getIndicatorProps, getOptionItemProps } =\n useMenuOptionItem(rest)\n\n return (\n <styled.div {...getOptionItemProps()}>\n <MenuIndicator {...getIndicatorProps()}>\n {icon ||\n (type === \"radio\" ? (\n <CircleSmallIcon fill=\"currentColor\" />\n ) : (\n <CheckIcon />\n ))}\n </MenuIndicator>\n {children}\n </styled.div>\n )\n },\n { name: \"OptionItem\", slot: [\"item\", \"option\"] },\n)()\n\nexport interface MenuIndicatorProps extends HTMLStyledProps {}\n\nexport const MenuIndicator = withContext<\"div\", MenuIndicatorProps>(\n \"div\",\n \"indicator\",\n)()\n\nexport interface MenuCommandProps extends HTMLStyledProps<\"kbd\"> {}\n\nexport const MenuCommand = withContext<\"kbd\", MenuCommandProps>(\n \"kbd\",\n \"command\",\n)()\n\nexport interface MenuSeparatorProps extends HTMLStyledProps<\"hr\"> {}\n\nexport const MenuSeparator = withContext<\"hr\", MenuSeparatorProps>(\n \"hr\",\n \"separator\",\n)(undefined, (props) => {\n const { getSeparatorProps } = useComponentContext()\n\n return getSeparatorProps(props)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6GA,MAAM,EACJ,kBACA,cAAc,kBACd,cACA,qBACA,iBAAiB,qBACjB,aACA,0BACEA,6CACF,QACAC,6BACD;;;;;;AASD,MAAaC,YAA+B,UAAU;CACpD,MAAM,CAAC,cAAc,eAAe,sBAAsB,MAAM;CAChE,MAAM,CACJ,EAAE,iBAAiB,iBAAiB,QAAQ,WAAW,GAAG,gBAC1D,EAAE,UAAU,UAAU,GAAG,UACvBC,oCAAgB,aAAa;EAC/B;EACA;EACA;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,eACA,aACA,MACA,SACA,kBACA,WACA,iBACA,wBACA,mBACA,iBACA,oBACA,SACA,YACA,gBACA,QACA,aACEC,yBAAQ;EAAE;EAAU,GAAG;EAAM,CAAC;CAClC,MAAM,+CACG;EACL,GAAG;EACH,iBACE,oBAAoB,UAAU,iBAAiB;EACjD,WAAW,CAAC,CAAC;EACb;EACA;EACA,QAAQ,WAAW,UAAU,CAAC,GAAG,EAAE,GAAG;EACtC;EACA,WACE,cAAc,UAAU,UAAU,qBAAqB;EACzD;EACA;EACA;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AA8CD,QACE,2CAAC;EAAa,OAAO;YACnB,2CAACC;GAAuB,OAAO;aAC7B,2CAACC;IAAY,iCA/CV;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KACD,GACD;KACE;KACA;KACA;KACA;KACA;KACA;KACA;KACD,CACF;cA8BO,2CAACC;KAAgB,iCA5BhB;MACL;MACA;MACA;MACA;MACA;MACD,GACD;MAAC;MAAe;MAAa;MAAoB;MAAY;MAAS,CACvE;eAqBS,2CAAC;MAAiB,iCAnBnB;OACL;OACA;OACA;OACA;OACD,GACD;OACE;OACA;OACA;OACA;OACD,CACF;gBAQW;OAAc,GAAI;OAAqB;QAAwB;OAC9C;MACH;KACN;IACS;GACZ;;AAMnB,MAAa,cAAc,4CAEzB,UACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,oBAAoB,qBAAqB;AAEjD,oDAAiC,4DAAgC,MAAM,CAAC,CAAC;EACzE;AASF,MAAa,qBAAqB,aA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K,iBAAiB,GAEvC,2CAACC,iCAAY;IAEH,EACf;GACU;GAGjB;CAAE,MAAM;CAAc,MAAM,CAAC,QAAQ,SAAS;CAAE,CACjD,EAAE;AAIH,MAAa,gBAAgB,YAC3B,OACA,YACD,EAAE;AAIH,MAAa,cAAc,YACzB,OACA,UACD,EAAE;AAIH,MAAa,gBAAgB,YAC3B,MACA,YACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,sBAAsB,qBAAqB;AAEnD,QAAO,kBAAkB,MAAM;EAC/B"}
|
|
1
|
+
{"version":3,"file":"menu.cjs","names":["createSlotComponent","menuStyle","MenuRoot: FC<MenuRootProps>","usePopoverProps","useMenu","MenuDescendantsContext","MenuContext","MainMenuContext","styled","useMenuContext","rest","Fragment","items","index","useMenuGroupContext","useMenuGroup","MenuGroupContext","useMenuOptionGroup","MenuOptionGroupContext","useMenuItem","ChevronRightIcon","useMenuOptionItem","CircleSmallIcon","CheckIcon"],"sources":["../../../../src/components/menu/menu.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n HTMLProps,\n HTMLStyledProps,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { MenuStyle } from \"./menu.style\"\nimport type {\n MenuOptionGroupType,\n MenuOptionGroupValue,\n UseMenuGroupProps,\n UseMenuItemProps,\n UseMenuOptionGroupProps,\n UseMenuOptionItemProps,\n UseMenuProps,\n UseMenuReturn,\n} from \"./use-menu\"\nimport { Fragment, useMemo, useState } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { cast, handlerAll } from \"../../utils\"\nimport { CheckIcon, ChevronRightIcon, CircleSmallIcon } from \"../icon\"\nimport { Popover, usePopoverProps } from \"../popover\"\nimport { menuStyle } from \"./menu.style\"\nimport {\n MainMenuContext,\n MenuContext,\n MenuDescendantsContext,\n MenuGroupContext,\n MenuOptionGroupContext,\n useMenu,\n useMenuContext,\n useMenuGroup,\n useMenuGroupContext,\n useMenuItem,\n useMenuOptionGroup,\n useMenuOptionItem,\n} from \"./use-menu\"\n\ninterface MenuSharedItem {\n label?: ReactNode\n}\n\ninterface MenuItemWithValue extends MenuSharedItem, MenuItemProps {}\n\ninterface MenuOptionItem extends MenuSharedItem, MenuOptionItemProps {}\n\ninterface MenuItemWithSeparator extends MenuSeparatorProps {\n type: \"separator\"\n}\n\ninterface MenuItemWithRadioGroup<Y extends string = string>\n extends\n Omit<MenuItemWithItems, \"defaultValue\" | \"items\" | \"onChange\">,\n MenuOptionGroupProps<\"radio\", Y> {\n type: \"radio\"\n items?: MenuOptionItem[]\n}\n\ninterface MenuItemWithCheckboxGroup<Y extends string[] = string[]>\n extends\n Omit<MenuItemWithItems, \"defaultValue\" | \"items\" | \"onChange\">,\n MenuOptionGroupProps<\"checkbox\", Y> {\n type: \"checkbox\"\n items?: MenuOptionItem[]\n}\n\ninterface MenuItemWithItems extends MenuSharedItem, MenuGroupProps {\n hasEndSeparator?: boolean\n hasSeparator?: boolean\n hasStartSeparator?: boolean\n items?: MenuItemWithValue[]\n labelProps?: MenuLabelProps\n}\n\nexport type MenuItem =\n | MenuItemWithCheckboxGroup\n | MenuItemWithItems\n | MenuItemWithRadioGroup\n | MenuItemWithSeparator\n | MenuItemWithValue\n\ninterface ComponentContext extends Pick<\n UseMenuReturn,\n | \"getContentProps\"\n | \"getContextTriggerProps\"\n | \"getSeparatorProps\"\n | \"getTriggerProps\"\n> {}\n\nexport interface MenuRootProps\n extends\n UseMenuProps,\n Omit<\n WithoutThemeProps<Popover.RootProps, MenuStyle>,\n \"autoFocus\" | \"modal\" | \"updateRef\" | \"withCloseButton\"\n >,\n ThemeProps<MenuStyle> {\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end-start'\n */\n placement?: Popover.RootProps[\"placement\"]\n}\n\nconst {\n ComponentContext,\n HydrationContext,\n PropsContext: MenuPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: useMenuPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<MenuRootProps, MenuStyle, ComponentContext>(\n \"menu\",\n menuStyle,\n)\n\nexport { MenuPropsContext, useMenuPropsContext }\n\n/**\n * `Menu` is a component that displays a common dropdown menu.\n *\n * @see https://yamada-ui.com/docs/components/menu\n */\nexport const MenuRoot: FC<MenuRootProps> = (props) => {\n const [styleContext, mergedProps] = useRootComponentProps(props)\n const [\n { animationScheme, initialFocusRef, offset, placement, ...popoverProps },\n { children, disabled, suppressHydrationWarning, ...rest },\n ] = usePopoverProps(mergedProps, [\n \"disabled\",\n \"open\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n ])\n const {\n closeOnSelect,\n descendants,\n open,\n subMenu,\n subMenuDirection,\n updateRef,\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n onActiveDescendant,\n onClose,\n onCloseRef,\n onCloseSubMenu,\n onOpen,\n onSelect,\n } = useMenu({ disabled, ...rest })\n const mergedPopoverProps = useMemo<Popover.RootProps>(\n () => ({\n ...popoverProps,\n animationScheme:\n animationScheme ?? (subMenu ? \"inline-start\" : \"block-start\"),\n autoFocus: !!initialFocusRef,\n disabled,\n initialFocusRef,\n offset: offset ?? (subMenu ? [0, 0] : undefined),\n open,\n placement:\n placement ?? (subMenu ? `center-${subMenuDirection}` : \"end-start\"),\n updateRef,\n onClose,\n onOpen,\n }),\n [\n animationScheme,\n disabled,\n initialFocusRef,\n offset,\n onClose,\n onOpen,\n open,\n placement,\n popoverProps,\n subMenu,\n subMenuDirection,\n updateRef,\n ],\n )\n const hydrationContext = useMemo(\n () => (suppressHydrationWarning ? { suppressHydrationWarning } : {}),\n [suppressHydrationWarning],\n )\n const menuContext = useMemo(\n () => ({\n subMenu,\n subMenuDirection,\n onActiveDescendant,\n onClose,\n onCloseSubMenu,\n onOpen,\n onSelect,\n }),\n [\n onClose,\n onOpen,\n onSelect,\n onActiveDescendant,\n subMenu,\n subMenuDirection,\n onCloseSubMenu,\n ],\n )\n const mainMenuContext = useMemo(\n () => ({\n closeOnSelect,\n descendants,\n onActiveDescendant,\n onCloseRef,\n onSelect,\n }),\n [closeOnSelect, descendants, onActiveDescendant, onCloseRef, onSelect],\n )\n const componentContext = useMemo(\n () => ({\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n }),\n [\n getContentProps,\n getContextTriggerProps,\n getSeparatorProps,\n getTriggerProps,\n ],\n )\n\n return (\n <StyleContext value={styleContext}>\n <HydrationContext value={hydrationContext}>\n <MenuDescendantsContext value={descendants}>\n <MenuContext value={menuContext}>\n <MainMenuContext value={mainMenuContext}>\n <ComponentContext value={componentContext}>\n <Popover.Root {...mergedPopoverProps}>{children}</Popover.Root>\n </ComponentContext>\n </MainMenuContext>\n </MenuContext>\n </MenuDescendantsContext>\n </HydrationContext>\n </StyleContext>\n )\n}\n\nexport interface MenuTriggerProps extends Popover.TriggerProps {}\n\nexport const MenuTrigger = withContext<\"button\", MenuTriggerProps>(\n Popover.Trigger,\n \"trigger\",\n)(undefined, (props) => {\n const { getTriggerProps } = useComponentContext()\n\n return cast<HTMLProps<\"button\">>(getTriggerProps(cast<HTMLProps>(props)))\n})\n\ninterface Rect {\n left: number\n top: number\n}\n\nexport interface MenuContextTriggerProps extends HTMLProps {}\n\nexport const MenuContextTrigger = withContext<\"div\", MenuContextTriggerProps>(\n ({ children, onContextMenu, ...rest }) => {\n const [rect, setRect] = useState<Rect>({\n left: 0,\n top: 0,\n })\n const { getContextTriggerProps } = useComponentContext()\n\n return (\n <>\n <MenuAnchor>\n <styled.div style={{ position: \"fixed\", ...rect }} />\n </MenuAnchor>\n\n <styled.div\n asChild\n {...getContextTriggerProps({\n onContextMenu: handlerAll(onContextMenu, (ev) => {\n setRect({ left: ev.clientX, top: ev.clientY })\n }),\n ...rest,\n })}\n >\n {children}\n </styled.div>\n </>\n )\n },\n \"contextTrigger\",\n)()\n\nexport interface MenuAnchorProps extends Popover.AnchorProps {}\n\nexport const MenuAnchor = withContext<\"div\", MenuAnchorProps>(\n Popover.Anchor,\n \"anchor\",\n)()\n\nexport interface MenuContentProps extends Popover.ContentProps {\n /**\n * The footer of the menu.\n */\n footer?: ReactNode\n /**\n * The header of the menu.\n */\n header?: ReactNode\n /**\n * If provided, generate elements based on items.\n */\n items?: MenuItem[]\n /**\n * Props for the footer component.\n */\n footerProps?: MenuFooterProps\n /**\n * Props for the header component.\n */\n headerProps?: MenuHeaderProps\n}\n\nexport const MenuContent = withContext<\"div\", MenuContentProps>(\n Popover.Content,\n \"content\",\n)(\n undefined,\n ({\n children,\n footer,\n header,\n items = [],\n footerProps,\n headerProps,\n portalProps,\n ...rest\n }) => {\n const { subMenu } = useMenuContext()\n const { getContentProps } = useComponentContext()\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return (\n <>\n {header ? <MenuHeader {...headerProps}>{header}</MenuHeader> : null}\n\n {items.map((props, index) => {\n if (\"type\" in props) {\n if (props.type === \"radio\") {\n const {\n type,\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuOptionGroup type={type} {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuOptionItem key={index} {...rest}>\n {label}\n </MenuOptionItem>\n ))}\n </MenuOptionGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else if (props.type === \"checkbox\") {\n const {\n type,\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuOptionGroup type={type} {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuOptionItem key={index} {...rest}>\n {label}\n </MenuOptionItem>\n ))}\n </MenuOptionGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else {\n return <MenuSeparator key={index} />\n }\n } else if (\"items\" in props) {\n const {\n hasSeparator = true,\n hasEndSeparator = hasSeparator,\n hasStartSeparator = hasSeparator,\n items = [],\n ...rest\n } = props\n\n return (\n <Fragment key={index}>\n {hasStartSeparator ? <MenuSeparator /> : null}\n\n <MenuGroup {...rest}>\n {items.map(({ label, ...rest }, index) => (\n <MenuItem key={index} {...rest}>\n {label}\n </MenuItem>\n ))}\n </MenuGroup>\n\n {hasEndSeparator ? <MenuSeparator /> : null}\n </Fragment>\n )\n } else if (\"value\" in props) {\n const { label, ...rest } = props\n\n return (\n <MenuItem key={index} {...rest}>\n {label}\n </MenuItem>\n )\n }\n })}\n\n {footer ? <MenuFooter {...footerProps}>{footer}</MenuFooter> : null}\n </>\n )\n }, [children, footer, footerProps, header, headerProps, items])\n\n return {\n ...getContentProps(\n cast<HTMLProps>({ ...rest, children: computedChildren }),\n ),\n portalProps: subMenu ? { ...portalProps, disabled: true } : portalProps,\n }\n },\n)\n\nexport interface MenuHeaderProps extends HTMLStyledProps {}\n\nexport const MenuHeader = withContext<\"div\", MenuHeaderProps>(\n \"div\",\n \"header\",\n)({ \"data-header\": \"\" })\n\nexport interface MenuFooterProps extends HTMLStyledProps {}\n\nexport const MenuFooter = withContext<\"div\", MenuFooterProps>(\n \"div\",\n \"footer\",\n)({ \"data-footer\": \"\" })\n\nexport interface MenuLabelProps extends HTMLStyledProps<\"span\"> {}\n\nexport const MenuLabel = withContext<\"span\", MenuLabelProps>(\"span\", \"label\")(\n undefined,\n (props) => {\n const { getLabelProps } = useMenuGroupContext()\n\n return getLabelProps(props)\n },\n)\n\nexport interface MenuGroupProps extends UseMenuGroupProps, HTMLStyledProps {\n /**\n * The label of the group.\n */\n label?: ReactNode\n /**\n * Props for the label component.\n */\n labelProps?: MenuLabelProps\n}\n\nexport const MenuGroup = withContext<\"div\", MenuGroupProps>(\n ({ children, label, labelProps, ...rest }) => {\n const { getGroupProps, getLabelProps } = useMenuGroup(rest)\n const context = useMemo(() => ({ getLabelProps }), [getLabelProps])\n\n return (\n <MenuGroupContext value={context}>\n <styled.div {...getGroupProps()}>\n {label ? <MenuLabel {...labelProps}>{label}</MenuLabel> : null}\n {children}\n </styled.div>\n </MenuGroupContext>\n )\n },\n \"group\",\n)()\n\nexport interface MenuOptionGroupProps<\n Y extends MenuOptionGroupType = \"checkbox\",\n M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>,\n>\n extends\n UseMenuOptionGroupProps<Y, M>,\n Omit<MenuGroupProps, \"defaultValue\" | \"onChange\"> {}\n\nexport const MenuOptionGroup = withContext<\"div\", MenuOptionGroupProps>(\n ({\n type: typeProp,\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n ...rest\n }) => {\n const { type, value, onChange } = useMenuOptionGroup({\n type: typeProp,\n defaultValue,\n value: valueProp,\n onChange: onChangeProp,\n })\n const context = useMemo(\n () => ({ type, value, onChange }),\n [type, value, onChange],\n )\n\n return (\n <MenuOptionGroupContext value={context}>\n <MenuGroup {...rest} />\n </MenuOptionGroupContext>\n )\n },\n { name: \"OptionGroup\", slot: [\"group\", \"option\"] },\n)() as GenericsComponent<{\n <\n Y extends MenuOptionGroupType = \"checkbox\",\n M extends MenuOptionGroupValue<Y> = MenuOptionGroupValue<Y>,\n >(\n props: MenuOptionGroupProps<Y, M>,\n ): ReactElement\n}>\n\nexport interface MenuItemProps extends HTMLStyledProps, UseMenuItemProps {}\n\nexport const MenuItem = withContext<\"div\", MenuItemProps>(\n ({ children, ...rest }) => {\n const { subMenuTrigger, getItemProps } = useMenuItem(rest)\n\n return (\n <styled.div {...getItemProps()}>\n {children}\n\n {subMenuTrigger ? (\n <MenuIndicator as={ChevronRightIcon} ms=\"auto\" />\n ) : null}\n </styled.div>\n )\n },\n \"item\",\n)()\n\nexport interface MenuOptionItemProps\n extends HTMLStyledProps, UseMenuOptionItemProps {\n /**\n * The icon to be used in the menu option item.\n */\n icon?: ReactNode\n}\n\nexport const MenuOptionItem = withContext<\"div\", MenuOptionItemProps>(\n ({ children, icon, ...rest }) => {\n const { type, getIndicatorProps, getOptionItemProps } =\n useMenuOptionItem(rest)\n\n return (\n <styled.div {...getOptionItemProps()}>\n <MenuIndicator {...getIndicatorProps()}>\n {icon ||\n (type === \"radio\" ? (\n <CircleSmallIcon fill=\"currentColor\" />\n ) : (\n <CheckIcon />\n ))}\n </MenuIndicator>\n {children}\n </styled.div>\n )\n },\n { name: \"OptionItem\", slot: [\"item\", \"option\"] },\n)()\n\nexport interface MenuIndicatorProps extends HTMLStyledProps {}\n\nexport const MenuIndicator = withContext<\"div\", MenuIndicatorProps>(\n \"div\",\n \"indicator\",\n)()\n\nexport interface MenuCommandProps extends HTMLStyledProps<\"kbd\"> {}\n\nexport const MenuCommand = withContext<\"kbd\", MenuCommandProps>(\n \"kbd\",\n \"command\",\n)()\n\nexport interface MenuSeparatorProps extends HTMLStyledProps<\"hr\"> {}\n\nexport const MenuSeparator = withContext<\"hr\", MenuSeparatorProps>(\n \"hr\",\n \"separator\",\n)(undefined, (props) => {\n const { getSeparatorProps } = useComponentContext()\n\n return getSeparatorProps(props)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6GA,MAAM,EACJ,kBACA,kBACA,cAAc,kBACd,cACA,qBACA,iBAAiB,qBACjB,aACA,0BACEA,6CACF,QACAC,6BACD;;;;;;AASD,MAAaC,YAA+B,UAAU;CACpD,MAAM,CAAC,cAAc,eAAe,sBAAsB,MAAM;CAChE,MAAM,CACJ,EAAE,iBAAiB,iBAAiB,QAAQ,WAAW,GAAG,gBAC1D,EAAE,UAAU,UAAU,0BAA0B,GAAG,UACjDC,oCAAgB,aAAa;EAC/B;EACA;EACA;EACA;EACA;EACD,CAAC;CACF,MAAM,EACJ,eACA,aACA,MACA,SACA,kBACA,WACA,iBACA,wBACA,mBACA,iBACA,oBACA,SACA,YACA,gBACA,QACA,aACEC,yBAAQ;EAAE;EAAU,GAAG;EAAM,CAAC;CAClC,MAAM,+CACG;EACL,GAAG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,QAAO,kBAAkB,MAAM;EAC/B"}
|
|
@@ -11,38 +11,41 @@ let react = require("react");
|
|
|
11
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
12
|
|
|
13
13
|
//#region src/components/native-popover/native-popover.tsx
|
|
14
|
-
const { ComponentContext, PropsContext: NativePopoverPropsContext, StyleContext, useComponentContext, usePropsContext: useNativePopoverPropsContext, withContext, useRootComponentProps } = require_create_component.createSlotComponent("native-popover", require_native_popover_style.nativePopoverStyle);
|
|
14
|
+
const { ComponentContext, HydrationContext, PropsContext: NativePopoverPropsContext, StyleContext, useComponentContext, usePropsContext: useNativePopoverPropsContext, withContext, useRootComponentProps } = require_create_component.createSlotComponent("native-popover", require_native_popover_style.nativePopoverStyle);
|
|
15
15
|
/**
|
|
16
16
|
* `NativePopover` is a component that floats around an element to display information using the native HTML Popover API.
|
|
17
17
|
*
|
|
18
18
|
* @see https://yamada-ui.com/docs/components/native-popover
|
|
19
19
|
*/
|
|
20
20
|
const NativePopoverRoot = (props) => {
|
|
21
|
-
const [styleContext, { children, ...rest }] = useRootComponentProps(props);
|
|
21
|
+
const [styleContext, { children, suppressHydrationWarning, ...rest }] = useRootComponentProps(props);
|
|
22
22
|
const { getAnchorProps, getBodyProps, getCloseTriggerProps, getContentProps, getFooterProps, getHeaderProps, getPositionerProps, getTriggerProps } = require_use_native_popover.useNativePopover(rest);
|
|
23
23
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyleContext, {
|
|
24
24
|
value: styleContext,
|
|
25
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
26
|
-
value: (0, react.useMemo)(() =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HydrationContext, {
|
|
26
|
+
value: (0, react.useMemo)(() => suppressHydrationWarning ? { suppressHydrationWarning } : {}, [suppressHydrationWarning]),
|
|
27
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContext, {
|
|
28
|
+
value: (0, react.useMemo)(() => ({
|
|
29
|
+
getAnchorProps,
|
|
30
|
+
getBodyProps,
|
|
31
|
+
getCloseTriggerProps,
|
|
32
|
+
getContentProps,
|
|
33
|
+
getFooterProps,
|
|
34
|
+
getHeaderProps,
|
|
35
|
+
getPositionerProps,
|
|
36
|
+
getTriggerProps
|
|
37
|
+
}), [
|
|
38
|
+
getAnchorProps,
|
|
39
|
+
getBodyProps,
|
|
40
|
+
getCloseTriggerProps,
|
|
41
|
+
getContentProps,
|
|
42
|
+
getFooterProps,
|
|
43
|
+
getHeaderProps,
|
|
44
|
+
getPositionerProps,
|
|
45
|
+
getTriggerProps
|
|
46
|
+
]),
|
|
47
|
+
children
|
|
48
|
+
})
|
|
46
49
|
})
|
|
47
50
|
});
|
|
48
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-popover.cjs","names":["createSlotComponent","nativePopoverStyle","NativePopoverRoot: FC<NativePopoverRootProps>","useNativePopover","styled"],"sources":["../../../../src/components/native-popover/native-popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren } from \"react\"\nimport type { HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { NativePopoverStyle } from \"./native-popover.style\"\nimport type {\n UseNativePopoverProps,\n UseNativePopoverReturn,\n} from \"./use-native-popover\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { cast } from \"../../utils\"\nimport { nativePopoverStyle } from \"./native-popover.style\"\nimport { useNativePopover } from \"./use-native-popover\"\n\ninterface ComponentContext extends Pick<\n UseNativePopoverReturn,\n | \"getAnchorProps\"\n | \"getBodyProps\"\n | \"getCloseTriggerProps\"\n | \"getContentProps\"\n | \"getFooterProps\"\n | \"getHeaderProps\"\n | \"getPositionerProps\"\n | \"getTriggerProps\"\n> {}\n\nexport interface NativePopoverRootProps\n extends\n UseNativePopoverProps,\n ThemeProps<NativePopoverStyle>,\n PropsWithChildren {}\n\nconst {\n ComponentContext,\n PropsContext: NativePopoverPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: useNativePopoverPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<\n NativePopoverRootProps,\n NativePopoverStyle,\n ComponentContext\n>(\"native-popover\", nativePopoverStyle)\n\nexport { NativePopoverPropsContext, useNativePopoverPropsContext }\n\n/**\n * `NativePopover` is a component that floats around an element to display information using the native HTML Popover API.\n *\n * @see https://yamada-ui.com/docs/components/native-popover\n */\nexport const NativePopoverRoot: FC<NativePopoverRootProps> = (props) => {\n const [styleContext, { children, ...rest }]
|
|
1
|
+
{"version":3,"file":"native-popover.cjs","names":["createSlotComponent","nativePopoverStyle","NativePopoverRoot: FC<NativePopoverRootProps>","useNativePopover","styled"],"sources":["../../../../src/components/native-popover/native-popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren } from \"react\"\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { NativePopoverStyle } from \"./native-popover.style\"\nimport type {\n UseNativePopoverProps,\n UseNativePopoverReturn,\n} from \"./use-native-popover\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { cast } from \"../../utils\"\nimport { nativePopoverStyle } from \"./native-popover.style\"\nimport { useNativePopover } from \"./use-native-popover\"\n\ninterface ComponentContext extends Pick<\n UseNativePopoverReturn,\n | \"getAnchorProps\"\n | \"getBodyProps\"\n | \"getCloseTriggerProps\"\n | \"getContentProps\"\n | \"getFooterProps\"\n | \"getHeaderProps\"\n | \"getPositionerProps\"\n | \"getTriggerProps\"\n> {}\n\nexport interface NativePopoverRootProps\n extends\n UseNativePopoverProps,\n ThemeProps<NativePopoverStyle>,\n PropsWithChildren,\n Pick<HTMLProps, \"suppressHydrationWarning\"> {}\n\nconst {\n ComponentContext,\n HydrationContext,\n PropsContext: NativePopoverPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: useNativePopoverPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<\n NativePopoverRootProps,\n NativePopoverStyle,\n ComponentContext\n>(\"native-popover\", nativePopoverStyle)\n\nexport { NativePopoverPropsContext, useNativePopoverPropsContext }\n\n/**\n * `NativePopover` is a component that floats around an element to display information using the native HTML Popover API.\n *\n * @see https://yamada-ui.com/docs/components/native-popover\n */\nexport const NativePopoverRoot: FC<NativePopoverRootProps> = (props) => {\n const [styleContext, { children, suppressHydrationWarning, ...rest }] =\n useRootComponentProps(props)\n const {\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n } = useNativePopover(rest)\n const hydrationContext = useMemo(\n () => (suppressHydrationWarning ? { suppressHydrationWarning } : {}),\n [suppressHydrationWarning],\n )\n const componentContext = useMemo(\n () => ({\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n }),\n [\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}>{children}</ComponentContext>\n </HydrationContext>\n </StyleContext>\n )\n}\n\nexport interface NativePopoverTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const NativePopoverTrigger = withContext<\n \"button\",\n NativePopoverTriggerProps\n>(\"button\", \"trigger\")({ asChild: true }, (props) => {\n const { getTriggerProps } = useComponentContext()\n\n return getTriggerProps(props)\n})\n\nexport interface NativePopoverAnchorProps extends HTMLStyledProps {}\n\nexport const NativePopoverAnchor = withContext<\"div\", NativePopoverAnchorProps>(\n \"div\",\n \"anchor\",\n)({ asChild: true }, (props) => {\n const { getAnchorProps } = useComponentContext()\n\n return getAnchorProps(props)\n})\n\ninterface NativePopoverPositionerProps extends HTMLStyledProps {}\n\nconst NativePopoverPositioner = withContext<\n \"div\",\n NativePopoverPositionerProps\n>(\"div\", \"positioner\")({ asChild: true }, (props) => {\n const { getPositionerProps } = useComponentContext()\n\n return getPositionerProps(props)\n})\n\nexport interface NativePopoverCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const NativePopoverCloseTrigger = withContext<\n \"button\",\n NativePopoverCloseTriggerProps\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 NativePopoverContentProps\n extends HTMLStyledProps, PropsWithChildren {}\n\nexport const NativePopoverContent = withContext<\n \"div\",\n NativePopoverContentProps\n>(({ children, ...rest }) => {\n const { getContentProps } = useComponentContext()\n\n return (\n <NativePopoverPositioner>\n <styled.div {...getContentProps(cast<HTMLStyledProps>(rest))}>\n {children}\n </styled.div>\n </NativePopoverPositioner>\n )\n}, \"content\")({\n suppressHydrationWarning: true,\n})\n\nexport interface NativePopoverHeaderProps extends HTMLStyledProps {}\n\nexport const NativePopoverHeader = withContext<\"div\", NativePopoverHeaderProps>(\n \"div\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n\n return getHeaderProps(props)\n})\n\nexport interface NativePopoverBodyProps extends HTMLStyledProps {}\n\nexport const NativePopoverBody = withContext<\"div\", NativePopoverBodyProps>(\n \"div\",\n \"body\",\n)(undefined, (props) => {\n const { getBodyProps } = useComponentContext()\n\n return getBodyProps(props)\n})\n\nexport interface NativePopoverFooterProps extends HTMLStyledProps {}\n\nexport const NativePopoverFooter = withContext<\"div\", NativePopoverFooterProps>(\n \"div\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n\n return getFooterProps(props)\n})\n"],"mappings":";;;;;;;;;;;;;AAkCA,MAAM,EACJ,kBACA,kBACA,cAAc,2BACd,cACA,qBACA,iBAAiB,8BACjB,aACA,0BACEA,6CAIF,kBAAkBC,gDAAmB;;;;;;AASvC,MAAaC,qBAAiD,UAAU;CACtE,MAAM,CAAC,cAAc,EAAE,UAAU,0BAA0B,GAAG,UAC5D,sBAAsB,MAAM;CAC9B,MAAM,EACJ,gBACA,cACA,sBACA,iBACA,gBACA,gBACA,oBACA,oBACEC,4CAAiB,KAAK;AA4B1B,QACE,2CAAC;EAAa,OAAO;YACnB,2CAAC;GAAiB,gCA5Bb,2BAA2B,EAAE,0BAA0B,GAAG,EAAE,EACnE,CAAC,yBAAyB,CAC3B;aA2BK,2CAAC;IAAiB,iCAzBf;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD,GACD;KACE;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACD,CACF;IAKiD;KAA4B;IACvD;GACN;;AAMnB,MAAa,uBAAuB,YAGlC,UAAU,UAAU,CAAC,EAAE,SAAS,MAAM,GAAG,UAAU;CACnD,MAAM,EAAE,oBAAoB,qBAAqB;AAEjD,QAAO,gBAAgB,MAAM;EAC7B;AAIF,MAAa,sBAAsB,YACjC,OACA,SACD,CAAC,EAAE,SAAS,MAAM,GAAG,UAAU;CAC9B,MAAM,EAAE,mBAAmB,qBAAqB;AAEhD,QAAO,eAAe,MAAM;EAC5B;AAIF,MAAM,0BAA0B,YAG9B,OAAO,aAAa,CAAC,EAAE,SAAS,MAAM,GAAG,UAAU;CACnD,MAAM,EAAE,uBAAuB,qBAAqB;AAEpD,QAAO,mBAAmB,MAAM;EAChC;AAIF,MAAa,4BAA4B,YAGvC,UAAU;CAAE,MAAM;CAAgB,MAAM,CAAC,WAAW,QAAQ;CAAE,CAAC,CAC/D,EAAE,SAAS,MAAM,GAChB,UAAU;CACT,MAAM,EAAE,yBAAyB,qBAAqB;AAEtD,QAAO,qBAAqB,MAAM;EAErC;AAKD,MAAa,uBAAuB,aAGjC,EAAE,UAAU,GAAG,WAAW;CAC3B,MAAM,EAAE,oBAAoB,qBAAqB;AAEjD,QACE,2CAAC,qCACC,2CAACC,uBAAO;EAAI,GAAI,4DAAsC,KAAK,CAAC;EACzD;GACU,GACW;GAE3B,UAAU,CAAC,EACZ,0BAA0B,MAC3B,CAAC;AAIF,MAAa,sBAAsB,YACjC,OACA,SACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,qBAAqB;AAEhD,QAAO,eAAe,MAAM;EAC5B;AAIF,MAAa,oBAAoB,YAC/B,OACA,OACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,iBAAiB,qBAAqB;AAE9C,QAAO,aAAa,MAAM;EAC1B;AAIF,MAAa,sBAAsB,YACjC,OACA,SACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,qBAAqB;AAEhD,QAAO,eAAe,MAAM;EAC5B"}
|
|
@@ -90,7 +90,7 @@ const usePopoverStyleProps = (props = {}) => {
|
|
|
90
90
|
strategy
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
|
-
const { ComponentContext, PropsContext: PopoverPropsContext, StyleContext, useComponentContext, usePropsContext: usePopoverPropsContext, withContext, useRootComponentProps } = require_create_component.createSlotComponent("popover", require_popover_style.popoverStyle);
|
|
93
|
+
const { ComponentContext, HydrationContext, PropsContext: PopoverPropsContext, StyleContext, useComponentContext, usePropsContext: usePopoverPropsContext, withContext, useRootComponentProps } = require_create_component.createSlotComponent("popover", require_popover_style.popoverStyle);
|
|
94
94
|
/**
|
|
95
95
|
* `Popover` is a component that floats around an element to display information.
|
|
96
96
|
*
|
|
@@ -98,42 +98,45 @@ const { ComponentContext, PropsContext: PopoverPropsContext, StyleContext, useCo
|
|
|
98
98
|
*/
|
|
99
99
|
const PopoverRoot = (props) => {
|
|
100
100
|
const styleProps = usePopoverStyleProps(props);
|
|
101
|
-
const [styleContext, { animationScheme, children, duration, ...rest }] = useRootComponentProps({
|
|
101
|
+
const [styleContext, { animationScheme, children, duration, suppressHydrationWarning, ...rest }] = useRootComponentProps({
|
|
102
102
|
...props,
|
|
103
103
|
...styleProps
|
|
104
104
|
});
|
|
105
105
|
const { open, getAnchorProps, getBodyProps, getCloseTriggerProps, getContentProps, getFooterProps, getHeaderProps, getPositionerProps, getTriggerProps, onClose } = require_use_popover.usePopover(rest);
|
|
106
106
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyleContext, {
|
|
107
107
|
value: styleContext,
|
|
108
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
109
|
-
value: (0, react.useMemo)(() =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
108
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HydrationContext, {
|
|
109
|
+
value: (0, react.useMemo)(() => suppressHydrationWarning ? { suppressHydrationWarning } : {}, [suppressHydrationWarning]),
|
|
110
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContext, {
|
|
111
|
+
value: (0, react.useMemo)(() => ({
|
|
112
|
+
animationScheme,
|
|
113
|
+
duration,
|
|
114
|
+
open,
|
|
115
|
+
getAnchorProps,
|
|
116
|
+
getBodyProps,
|
|
117
|
+
getCloseTriggerProps,
|
|
118
|
+
getContentProps,
|
|
119
|
+
getFooterProps,
|
|
120
|
+
getHeaderProps,
|
|
121
|
+
getPositionerProps,
|
|
122
|
+
getTriggerProps
|
|
123
|
+
}), [
|
|
124
|
+
open,
|
|
125
|
+
animationScheme,
|
|
126
|
+
duration,
|
|
127
|
+
getAnchorProps,
|
|
128
|
+
getBodyProps,
|
|
129
|
+
getCloseTriggerProps,
|
|
130
|
+
getContentProps,
|
|
131
|
+
getFooterProps,
|
|
132
|
+
getHeaderProps,
|
|
133
|
+
getPositionerProps,
|
|
134
|
+
getTriggerProps
|
|
135
|
+
]),
|
|
136
|
+
children: (0, require_utils_index.utils_exports.runIfFn)(children, {
|
|
137
|
+
open,
|
|
138
|
+
onClose
|
|
139
|
+
})
|
|
137
140
|
})
|
|
138
141
|
})
|
|
139
142
|
});
|