@yamada-ui/react 2.2.0 → 2.3.0-next-20260411064049
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/accordion/accordion.cjs +15 -5
- package/dist/cjs/components/accordion/accordion.cjs.map +1 -1
- 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/accordion/accordion.js +15 -5
- package/dist/esm/components/accordion/accordion.js.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 -2
- package/dist/types/components/accordion/use-accordion.d.ts +11 -11
- package/dist/types/components/action-bar/action-bar.d.ts +2 -2
- package/dist/types/components/airy/airy.d.ts +2 -2
- package/dist/types/components/alert/alert.d.ts +2 -2
- package/dist/types/components/alpha-slider/alpha-slider.d.ts +2 -2
- package/dist/types/components/aspect-ratio/aspect-ratio.d.ts +2 -2
- package/dist/types/components/autocomplete/autocomplete.d.ts +2 -2
- package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
- package/dist/types/components/autocomplete/use-autocomplete.d.ts +5 -5
- 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.d.ts +2 -2
- package/dist/types/components/button/icon-button.d.ts +2 -2
- package/dist/types/components/calendar/calendar.d.ts +2 -2
- package/dist/types/components/calendar/calendar.style.d.ts +2 -2
- package/dist/types/components/calendar/use-calendar.d.ts +8 -8
- package/dist/types/components/card/card.d.ts +2 -2
- package/dist/types/components/carousel/carousel.d.ts +2 -2
- 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/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.d.ts +4 -4
- package/dist/types/components/checkbox/use-checkbox-group.d.ts +2 -2
- package/dist/types/components/checkbox-card/checkbox-card.d.ts +4 -4
- package/dist/types/components/circle-progress/circle-progress.d.ts +2 -2
- package/dist/types/components/close-button/close-button.d.ts +2 -2
- package/dist/types/components/code/code.d.ts +2 -2
- package/dist/types/components/collapse/collapse.d.ts +2 -2
- package/dist/types/components/color-picker/color-picker.d.ts +2 -2
- 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 -2
- package/dist/types/components/color-selector/color-selector.d.ts +2 -2
- 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 -3
- 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/date-picker/date-picker.d.ts +2 -2
- package/dist/types/components/date-picker/use-date-picker.d.ts +4 -4
- package/dist/types/components/drawer/drawer.d.ts +2 -2
- package/dist/types/components/drawer/drawer.style.d.ts +2 -2
- package/dist/types/components/dropzone/dropzone.d.ts +4 -4
- package/dist/types/components/editable/editable.d.ts +4 -4
- package/dist/types/components/editable/use-editable.d.ts +2 -2
- 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/fade/fade.d.ts +2 -2
- package/dist/types/components/field/field.d.ts +3 -3
- package/dist/types/components/field/use-field-props.d.ts +3 -3
- package/dist/types/components/fieldset/fieldset.d.ts +3 -3
- package/dist/types/components/file-button/file-button.d.ts +2 -2
- package/dist/types/components/file-button/use-file-button.d.ts +18 -18
- package/dist/types/components/file-input/file-input.d.ts +2 -2
- package/dist/types/components/file-input/file-input.style.d.ts +1 -1
- package/dist/types/components/file-input/use-file-input.d.ts +15 -15
- package/dist/types/components/flex/flex.d.ts +2 -2
- package/dist/types/components/flip/flip.d.ts +4 -4
- package/dist/types/components/float/float.d.ts +2 -2
- package/dist/types/components/form/form.d.ts +3 -3
- 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/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 -2
- 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/hue-slider/hue-slider.d.ts +3 -3
- package/dist/types/components/icon/icon.d.ts +5 -5
- package/dist/types/components/image/image.d.ts +2 -2
- package/dist/types/components/indicator/indicator.d.ts +4 -4
- 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.d.ts +2 -2
- 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 -3
- package/dist/types/components/mark/mark.d.ts +2 -2
- package/dist/types/components/menu/menu.d.ts +2 -2
- package/dist/types/components/menu/menu.style.d.ts +2 -2
- package/dist/types/components/menu/use-menu.d.ts +11 -11
- package/dist/types/components/modal/modal.d.ts +2 -2
- 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 -2
- 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/number-input/number-input.d.ts +2 -2
- package/dist/types/components/number-input/number-input.style.d.ts +1 -1
- package/dist/types/components/pagination/pagination.d.ts +2 -2
- package/dist/types/components/pagination/use-pagination.d.ts +2 -2
- package/dist/types/components/password-input/password-input.d.ts +2 -2
- package/dist/types/components/password-input/strength-meter.d.ts +2 -2
- package/dist/types/components/password-input/use-password-input.d.ts +2 -2
- package/dist/types/components/pin-input/pin-input.d.ts +2 -2
- package/dist/types/components/pin-input/use-pin-input.d.ts +7 -7
- package/dist/types/components/popover/popover.d.ts +4 -4
- 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.d.ts +4 -4
- package/dist/types/components/radio/use-radio-group.d.ts +2 -2
- package/dist/types/components/radio-card/radio-card.d.ts +4 -4
- package/dist/types/components/rating/use-rating.d.ts +7 -7
- package/dist/types/components/reorder/reorder.d.ts +2 -2
- 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/use-resizable.d.ts +2 -2
- package/dist/types/components/ripple/ripple.d.ts +2 -2
- package/dist/types/components/ripple/use-ripple.d.ts +2 -2
- package/dist/types/components/rotate/rotate.d.ts +2 -2
- package/dist/types/components/saturation-slider/saturation-slider.d.ts +2 -2
- package/dist/types/components/saturation-slider/use-saturation-slider.d.ts +2 -2
- package/dist/types/components/scroll-area/scroll-area.d.ts +2 -2
- package/dist/types/components/segmented-control/segmented-control.d.ts +2 -2
- package/dist/types/components/segmented-control/use-segmented-control.d.ts +9 -9
- package/dist/types/components/select/select.d.ts +2 -2
- package/dist/types/components/select/use-select.d.ts +4 -4
- package/dist/types/components/separator/separator.d.ts +2 -2
- package/dist/types/components/sidebar/sidebar.d.ts +2 -2
- package/dist/types/components/sidebar/use-sidebar.d.ts +9 -9
- package/dist/types/components/simple-grid/simple-grid.d.ts +2 -2
- package/dist/types/components/skeleton/skeleton.d.ts +2 -2
- package/dist/types/components/slide/slide.d.ts +2 -2
- package/dist/types/components/slide-fade/slide-fade.d.ts +2 -2
- package/dist/types/components/slider/slider.d.ts +2 -2
- package/dist/types/components/slider/use-slider.d.ts +2 -2
- 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/steps/steps.d.ts +2 -2
- 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/table/table.d.ts +2 -2
- package/dist/types/components/tabs/tabs.d.ts +2 -2
- 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 -2
- package/dist/types/components/textarea/use-autosize.d.ts +2 -2
- package/dist/types/components/timeline/timeline.d.ts +4 -4
- package/dist/types/components/toggle/toggle.d.ts +5 -5
- package/dist/types/components/toggle/use-toggle-group.d.ts +2 -2
- package/dist/types/components/toggle/use-toggle.d.ts +2 -2
- package/dist/types/components/tooltip/tooltip.d.ts +4 -3
- package/dist/types/components/tree/tree.d.ts +2 -2
- package/dist/types/components/tree/use-tree.d.ts +182 -182
- package/dist/types/components/visually-hidden/visually-hidden.d.ts +2 -2
- package/dist/types/components/wrap/wrap.d.ts +2 -2
- package/dist/types/core/components/create-component.d.ts +19 -10
- package/dist/types/core/components/index.d.ts +2 -2
- package/dist/types/core/index.d.ts +2 -2
- package/dist/types/core/system/color-mode-provider.d.ts +2 -2
- package/dist/types/core/system/storage-script.d.ts +3 -3
- package/dist/types/core/system/styled.d.ts +2 -2
- package/dist/types/core/system/system-provider.d.ts +2 -2
- package/dist/types/hooks/use-breakpoint/use-breakpoint-state.d.ts +2 -2
- 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/index.d.ts +3 -3
- package/dist/types/providers/i18n-provider/i18n-provider.d.ts +3 -3
- package/dist/types/providers/ui-provider/ui-provider.d.ts +2 -2
- package/dist/types/utils/children.d.ts +2 -2
- package/package.json +1 -1
|
@@ -10,38 +10,41 @@ import { useMemo } from "react";
|
|
|
10
10
|
import { jsx } from "react/jsx-runtime";
|
|
11
11
|
|
|
12
12
|
//#region src/components/native-popover/native-popover.tsx
|
|
13
|
-
const { ComponentContext, PropsContext: NativePopoverPropsContext, StyleContext, useComponentContext, usePropsContext: useNativePopoverPropsContext, withContext, useRootComponentProps } = createSlotComponent("native-popover", nativePopoverStyle);
|
|
13
|
+
const { ComponentContext, HydrationContext, PropsContext: NativePopoverPropsContext, StyleContext, useComponentContext, usePropsContext: useNativePopoverPropsContext, withContext, useRootComponentProps } = createSlotComponent("native-popover", nativePopoverStyle);
|
|
14
14
|
/**
|
|
15
15
|
* `NativePopover` is a component that floats around an element to display information using the native HTML Popover API.
|
|
16
16
|
*
|
|
17
17
|
* @see https://yamada-ui.com/docs/components/native-popover
|
|
18
18
|
*/
|
|
19
19
|
const NativePopoverRoot = (props) => {
|
|
20
|
-
const [styleContext, { children, ...rest }] = useRootComponentProps(props);
|
|
20
|
+
const [styleContext, { children, suppressHydrationWarning, ...rest }] = useRootComponentProps(props);
|
|
21
21
|
const { getAnchorProps, getBodyProps, getCloseTriggerProps, getContentProps, getFooterProps, getHeaderProps, getPositionerProps, getTriggerProps } = useNativePopover(rest);
|
|
22
22
|
return /* @__PURE__ */ jsx(StyleContext, {
|
|
23
23
|
value: styleContext,
|
|
24
|
-
children: /* @__PURE__ */ jsx(
|
|
25
|
-
value: useMemo(() =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
children: /* @__PURE__ */ jsx(HydrationContext, {
|
|
25
|
+
value: useMemo(() => suppressHydrationWarning ? { suppressHydrationWarning } : {}, [suppressHydrationWarning]),
|
|
26
|
+
children: /* @__PURE__ */ jsx(ComponentContext, {
|
|
27
|
+
value: useMemo(() => ({
|
|
28
|
+
getAnchorProps,
|
|
29
|
+
getBodyProps,
|
|
30
|
+
getCloseTriggerProps,
|
|
31
|
+
getContentProps,
|
|
32
|
+
getFooterProps,
|
|
33
|
+
getHeaderProps,
|
|
34
|
+
getPositionerProps,
|
|
35
|
+
getTriggerProps
|
|
36
|
+
}), [
|
|
37
|
+
getAnchorProps,
|
|
38
|
+
getBodyProps,
|
|
39
|
+
getCloseTriggerProps,
|
|
40
|
+
getContentProps,
|
|
41
|
+
getFooterProps,
|
|
42
|
+
getHeaderProps,
|
|
43
|
+
getPositionerProps,
|
|
44
|
+
getTriggerProps
|
|
45
|
+
]),
|
|
46
|
+
children
|
|
47
|
+
})
|
|
45
48
|
})
|
|
46
49
|
});
|
|
47
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-popover.js","names":["NativePopoverRoot: FC<NativePopoverRootProps>"],"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.js","names":["NativePopoverRoot: FC<NativePopoverRootProps>"],"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,0BACE,oBAIF,kBAAkB,mBAAmB;;;;;;AASvC,MAAaA,qBAAiD,UAAU;CACtE,MAAM,CAAC,cAAc,EAAE,UAAU,0BAA0B,GAAG,UAC5D,sBAAsB,MAAM;CAC9B,MAAM,EACJ,gBACA,cACA,sBACA,iBACA,gBACA,gBACA,oBACA,oBACE,iBAAiB,KAAK;AA4B1B,QACE,oBAAC;EAAa,OAAO;YACnB,oBAAC;GAAiB,OA7BG,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,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"}
|
|
@@ -89,7 +89,7 @@ const usePopoverStyleProps = (props = {}) => {
|
|
|
89
89
|
strategy
|
|
90
90
|
};
|
|
91
91
|
};
|
|
92
|
-
const { ComponentContext, PropsContext: PopoverPropsContext, StyleContext, useComponentContext, usePropsContext: usePopoverPropsContext, withContext, useRootComponentProps } = createSlotComponent("popover", popoverStyle);
|
|
92
|
+
const { ComponentContext, HydrationContext, PropsContext: PopoverPropsContext, StyleContext, useComponentContext, usePropsContext: usePopoverPropsContext, withContext, useRootComponentProps } = createSlotComponent("popover", popoverStyle);
|
|
93
93
|
/**
|
|
94
94
|
* `Popover` is a component that floats around an element to display information.
|
|
95
95
|
*
|
|
@@ -97,42 +97,45 @@ const { ComponentContext, PropsContext: PopoverPropsContext, StyleContext, useCo
|
|
|
97
97
|
*/
|
|
98
98
|
const PopoverRoot = (props) => {
|
|
99
99
|
const styleProps = usePopoverStyleProps(props);
|
|
100
|
-
const [styleContext, { animationScheme, children, duration, ...rest }] = useRootComponentProps({
|
|
100
|
+
const [styleContext, { animationScheme, children, duration, suppressHydrationWarning, ...rest }] = useRootComponentProps({
|
|
101
101
|
...props,
|
|
102
102
|
...styleProps
|
|
103
103
|
});
|
|
104
104
|
const { open, getAnchorProps, getBodyProps, getCloseTriggerProps, getContentProps, getFooterProps, getHeaderProps, getPositionerProps, getTriggerProps, onClose } = usePopover(rest);
|
|
105
105
|
return /* @__PURE__ */ jsx(StyleContext, {
|
|
106
106
|
value: styleContext,
|
|
107
|
-
children: /* @__PURE__ */ jsx(
|
|
108
|
-
value: useMemo(() =>
|
|
109
|
-
|
|
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
|
-
|
|
107
|
+
children: /* @__PURE__ */ jsx(HydrationContext, {
|
|
108
|
+
value: useMemo(() => suppressHydrationWarning ? { suppressHydrationWarning } : {}, [suppressHydrationWarning]),
|
|
109
|
+
children: /* @__PURE__ */ jsx(ComponentContext, {
|
|
110
|
+
value: useMemo(() => ({
|
|
111
|
+
animationScheme,
|
|
112
|
+
duration,
|
|
113
|
+
open,
|
|
114
|
+
getAnchorProps,
|
|
115
|
+
getBodyProps,
|
|
116
|
+
getCloseTriggerProps,
|
|
117
|
+
getContentProps,
|
|
118
|
+
getFooterProps,
|
|
119
|
+
getHeaderProps,
|
|
120
|
+
getPositionerProps,
|
|
121
|
+
getTriggerProps
|
|
122
|
+
}), [
|
|
123
|
+
open,
|
|
124
|
+
animationScheme,
|
|
125
|
+
duration,
|
|
126
|
+
getAnchorProps,
|
|
127
|
+
getBodyProps,
|
|
128
|
+
getCloseTriggerProps,
|
|
129
|
+
getContentProps,
|
|
130
|
+
getFooterProps,
|
|
131
|
+
getHeaderProps,
|
|
132
|
+
getPositionerProps,
|
|
133
|
+
getTriggerProps
|
|
134
|
+
]),
|
|
135
|
+
children: (0, utils_exports.runIfFn)(children, {
|
|
136
|
+
open,
|
|
137
|
+
onClose
|
|
138
|
+
})
|
|
136
139
|
})
|
|
137
140
|
})
|
|
138
141
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":["PopoverRoot: FC<PopoverRootProps>","motion"],"sources":["../../../../src/components/popover/popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren } from \"react\"\nimport type {\n HTMLProps,\n HTMLStyledProps,\n SimplePlacement,\n StyleValue,\n ThemeProps,\n} from \"../../core\"\nimport type { Merge, ReactNodeOrFunction } from \"../../utils\"\nimport type { HTMLMotionProps, MotionTransitionProps } from \"../motion\"\nimport type { PortalProps } from \"../portal\"\nimport type { PopoverStyle } from \"./popover.style\"\nimport type { UsePopoverProps, UsePopoverReturn } from \"./use-popover\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { cast, runIfFn } from \"../../utils\"\nimport { fadeScaleVariants } from \"../fade-scale\"\nimport { motion } from \"../motion\"\nimport { Portal } from \"../portal\"\nimport { slideFadeVariants } from \"../slide-fade\"\nimport { popoverStyle } from \"./popover.style\"\nimport { usePopover } from \"./use-popover\"\n\nexport interface UsePopupAnimationProps {\n /**\n * The animation of the element.\n *\n * @default 'scale'\n */\n animationScheme?: StyleValue<\"none\" | \"scale\" | SimplePlacement>\n /**\n * The animation duration.\n *\n * @default 0.1\n */\n duration?: StyleValue<MotionTransitionProps[\"duration\"]>\n}\n\nexport const usePopupAnimationProps = (props: UsePopupAnimationProps = {}) => {\n const animationScheme = useValue(props.animationScheme ?? \"scale\")\n const duration = useValue(props.duration ?? 0.1)\n const sharedProps = { animate: \"enter\", exit: \"exit\", initial: \"exit\" }\n\n switch (animationScheme) {\n case \"scale\":\n return {\n ...sharedProps,\n custom: { duration, reverse: true, scale: 0.95 },\n variants: fadeScaleVariants,\n }\n case \"block-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: 16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"block-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: 16, reverse: true },\n variants: slideFadeVariants,\n }\n default:\n return {}\n }\n}\n\nexport interface UsePopoverStyleProps {\n /**\n * If `true`, the popper will change its placement and flip when it's about to overflow its boundary area.\n *\n * @default true\n */\n flip?: StyleValue<UsePopoverProps[\"flip\"]>\n /**\n * The distance or margin between the reference and popper.\n * It is used internally to create an `offset` modifier.\n *\n * @default 8\n */\n gutter?: StyleValue<UsePopoverProps[\"gutter\"]>\n /**\n * If `true`, the popper will match the width of the reference at all times.\n * It's useful for `autocomplete`, `date-picker` and `select` patterns.\n *\n * @default false\n */\n matchWidth?: StyleValue<UsePopoverProps[\"matchWidth\"]>\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: StyleValue<UsePopoverProps[\"placement\"]>\n /**\n * The CSS positioning strategy to use.\n *\n * @default 'absolute'\n */\n strategy?: StyleValue<UsePopoverProps[\"strategy\"]>\n}\n\nexport const usePopoverStyleProps = (props: UsePopoverStyleProps = {}) => {\n const placement = useValue(props.placement)\n const gutter = useValue(props.gutter)\n const matchWidth = useValue(props.matchWidth)\n const strategy = useValue(props.strategy)\n const flip = useValue(props.flip)\n\n return {\n flip,\n gutter,\n matchWidth,\n placement,\n strategy,\n }\n}\n\ninterface ComponentContext\n extends\n Pick<\n UsePopoverReturn,\n | \"getAnchorProps\"\n | \"getBodyProps\"\n | \"getCloseTriggerProps\"\n | \"getContentProps\"\n | \"getFooterProps\"\n | \"getHeaderProps\"\n | \"getPositionerProps\"\n | \"getTriggerProps\"\n | \"open\"\n >,\n UsePopupAnimationProps {}\n\nexport interface PopoverRootProps\n extends\n Merge<UsePopoverProps, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<PopoverStyle> {\n /**\n * The children of the popover.\n */\n children?: ReactNodeOrFunction<{\n open: boolean\n onClose: () => void\n }>\n}\n\nconst {\n ComponentContext,\n PropsContext: PopoverPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: usePopoverPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<PopoverRootProps, PopoverStyle, ComponentContext>(\n \"popover\",\n popoverStyle,\n)\n\nexport { PopoverPropsContext, usePopoverPropsContext }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see https://yamada-ui.com/docs/components/popover\n */\nexport const PopoverRoot: FC<PopoverRootProps> = (props) => {\n const styleProps = usePopoverStyleProps(props)\n const [styleContext, { animationScheme, children, duration, ...rest }] =\n useRootComponentProps({ ...props, ...styleProps })\n const {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n } = usePopover(rest)\n const componentContext = useMemo(\n () => ({\n animationScheme,\n duration,\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n }),\n [\n open,\n animationScheme,\n duration,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n ],\n )\n\n return (\n <StyleContext value={styleContext}>\n <ComponentContext value={componentContext}>\n {runIfFn(children, { open, onClose })}\n </ComponentContext>\n </StyleContext>\n )\n}\n\nexport interface PopoverTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverTrigger = withContext<\"button\", PopoverTriggerProps>(\n \"button\",\n \"trigger\",\n)({ asChild: true }, (props) => {\n const { getTriggerProps } = useComponentContext()\n\n return getTriggerProps(props)\n})\n\nexport interface PopoverCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverCloseTrigger = withContext<\n \"button\",\n PopoverCloseTriggerProps\n>(\"button\", { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] })(\n { asChild: true },\n (props) => {\n const { getCloseTriggerProps } = useComponentContext()\n\n return getCloseTriggerProps(props)\n },\n)\n\nexport interface PopoverAnchorProps extends HTMLStyledProps {}\n\nexport const PopoverAnchor = withContext<\"div\", PopoverAnchorProps>(\n \"div\",\n \"anchor\",\n)({ asChild: true }, (props) => {\n const { getAnchorProps } = useComponentContext()\n\n return getAnchorProps(props)\n})\n\ninterface PopoverPositionerProps extends HTMLStyledProps {}\n\nconst PopoverPositioner = withContext<\"div\", PopoverPositionerProps>(\n \"div\",\n \"positioner\",\n)(undefined, (props) => {\n const { getPositionerProps } = useComponentContext()\n\n return getPositionerProps(props)\n})\n\nexport interface PopoverContentProps\n extends Omit<HTMLMotionProps, \"children\">, PropsWithChildren {\n /**\n * Props for portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n}\n\nexport const PopoverContent = withContext<\"div\", PopoverContentProps>(\n ({ portalProps, ...rest }) => {\n const { animationScheme, duration, open, getContentProps } =\n useComponentContext()\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n\n return (\n <AnimatePresence>\n {open ? (\n <Portal {...portalProps}>\n <PopoverPositioner>\n <motion.div\n {...popupAnimationProps}\n {...cast<HTMLMotionProps>(\n getContentProps(cast<HTMLProps>(rest)),\n )}\n />\n </PopoverPositioner>\n </Portal>\n ) : null}\n </AnimatePresence>\n )\n },\n \"content\",\n)()\n\nexport interface PopoverHeaderProps extends HTMLStyledProps {}\n\nexport const PopoverHeader = withContext<\"div\", PopoverHeaderProps>(\n \"div\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n\n return getHeaderProps(props)\n})\n\nexport interface PopoverBodyProps extends HTMLStyledProps {}\n\nexport const PopoverBody = withContext<\"div\", PopoverBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { getBodyProps } = useComponentContext()\n\n return getBodyProps(props)\n },\n)\n\nexport interface PopoverFooterProps extends HTMLStyledProps {}\n\nexport const PopoverFooter = withContext<\"div\", PopoverFooterProps>(\n \"div\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n\n return getFooter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GACN,GAAI;GACJ,2BACE,wCAAgC,KAAK,CAAC,CACvC;IACD,GACgB;GACb,GACP,OACY;GAGtB,UACD,EAAE;AAIH,MAAa,gBAAgB,YAC3B,OACA,SACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,qBAAqB;AAEhD,QAAO,eAAe,MAAM;EAC5B;AAIF,MAAa,cAAc,YAAqC,OAAO,OAAO,CAC5E,SACC,UAAU;CACT,MAAM,EAAE,iBAAiB,qBAAqB;AAE9C,QAAO,aAAa,MAAM;EAE7B;AAID,MAAa,gBAAgB,YAC3B,OACA,SACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,qBAAqB;AAEhD,QAAO,eAAe,MAAM;EAC5B"}
|
|
1
|
+
{"version":3,"file":"popover.js","names":["PopoverRoot: FC<PopoverRootProps>","motion"],"sources":["../../../../src/components/popover/popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren } from \"react\"\nimport type {\n HTMLProps,\n HTMLStyledProps,\n SimplePlacement,\n StyleValue,\n ThemeProps,\n} from \"../../core\"\nimport type { Merge, ReactNodeOrFunction } from \"../../utils\"\nimport type { HTMLMotionProps, MotionTransitionProps } from \"../motion\"\nimport type { PortalProps } from \"../portal\"\nimport type { PopoverStyle } from \"./popover.style\"\nimport type { UsePopoverProps, UsePopoverReturn } from \"./use-popover\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { createSlotComponent } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { cast, runIfFn } from \"../../utils\"\nimport { fadeScaleVariants } from \"../fade-scale\"\nimport { motion } from \"../motion\"\nimport { Portal } from \"../portal\"\nimport { slideFadeVariants } from \"../slide-fade\"\nimport { popoverStyle } from \"./popover.style\"\nimport { usePopover } from \"./use-popover\"\n\nexport interface UsePopupAnimationProps {\n /**\n * The animation of the element.\n *\n * @default 'scale'\n */\n animationScheme?: StyleValue<\"none\" | \"scale\" | SimplePlacement>\n /**\n * The animation duration.\n *\n * @default 0.1\n */\n duration?: StyleValue<MotionTransitionProps[\"duration\"]>\n}\n\nexport const usePopupAnimationProps = (props: UsePopupAnimationProps = {}) => {\n const animationScheme = useValue(props.animationScheme ?? \"scale\")\n const duration = useValue(props.duration ?? 0.1)\n const sharedProps = { animate: \"enter\", exit: \"exit\", initial: \"exit\" }\n\n switch (animationScheme) {\n case \"scale\":\n return {\n ...sharedProps,\n custom: { duration, reverse: true, scale: 0.95 },\n variants: fadeScaleVariants,\n }\n case \"block-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: 16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"inline-start\":\n return {\n ...sharedProps,\n custom: { duration, offsetX: -16, reverse: true },\n variants: slideFadeVariants,\n }\n case \"block-end\":\n return {\n ...sharedProps,\n custom: { duration, offsetY: 16, reverse: true },\n variants: slideFadeVariants,\n }\n default:\n return {}\n }\n}\n\nexport interface UsePopoverStyleProps {\n /**\n * If `true`, the popper will change its placement and flip when it's about to overflow its boundary area.\n *\n * @default true\n */\n flip?: StyleValue<UsePopoverProps[\"flip\"]>\n /**\n * The distance or margin between the reference and popper.\n * It is used internally to create an `offset` modifier.\n *\n * @default 8\n */\n gutter?: StyleValue<UsePopoverProps[\"gutter\"]>\n /**\n * If `true`, the popper will match the width of the reference at all times.\n * It's useful for `autocomplete`, `date-picker` and `select` patterns.\n *\n * @default false\n */\n matchWidth?: StyleValue<UsePopoverProps[\"matchWidth\"]>\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: StyleValue<UsePopoverProps[\"placement\"]>\n /**\n * The CSS positioning strategy to use.\n *\n * @default 'absolute'\n */\n strategy?: StyleValue<UsePopoverProps[\"strategy\"]>\n}\n\nexport const usePopoverStyleProps = (props: UsePopoverStyleProps = {}) => {\n const placement = useValue(props.placement)\n const gutter = useValue(props.gutter)\n const matchWidth = useValue(props.matchWidth)\n const strategy = useValue(props.strategy)\n const flip = useValue(props.flip)\n\n return {\n flip,\n gutter,\n matchWidth,\n placement,\n strategy,\n }\n}\n\ninterface ComponentContext\n extends\n Pick<\n UsePopoverReturn,\n | \"getAnchorProps\"\n | \"getBodyProps\"\n | \"getCloseTriggerProps\"\n | \"getContentProps\"\n | \"getFooterProps\"\n | \"getHeaderProps\"\n | \"getPositionerProps\"\n | \"getTriggerProps\"\n | \"open\"\n >,\n UsePopupAnimationProps {}\n\nexport interface PopoverRootProps\n extends\n Merge<UsePopoverProps, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<PopoverStyle>,\n Pick<HTMLProps, \"suppressHydrationWarning\"> {\n /**\n * The children of the popover.\n */\n children?: ReactNodeOrFunction<{\n open: boolean\n onClose: () => void\n }>\n}\n\nconst {\n ComponentContext,\n HydrationContext,\n PropsContext: PopoverPropsContext,\n StyleContext,\n useComponentContext,\n usePropsContext: usePopoverPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<PopoverRootProps, PopoverStyle, ComponentContext>(\n \"popover\",\n popoverStyle,\n)\n\nexport { PopoverPropsContext, usePopoverPropsContext }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see https://yamada-ui.com/docs/components/popover\n */\nexport const PopoverRoot: FC<PopoverRootProps> = (props) => {\n const styleProps = usePopoverStyleProps(props)\n const [\n styleContext,\n { animationScheme, children, duration, suppressHydrationWarning, ...rest },\n ] = useRootComponentProps({ ...props, ...styleProps })\n const {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n } = usePopover(rest)\n const hydrationContext = useMemo(\n () => (suppressHydrationWarning ? { suppressHydrationWarning } : {}),\n [suppressHydrationWarning],\n )\n const componentContext = useMemo(\n () => ({\n animationScheme,\n duration,\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n }),\n [\n open,\n animationScheme,\n duration,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n ],\n )\n\n return (\n <StyleContext value={styleContext}>\n <HydrationContext value={hydrationContext}>\n <ComponentContext value={componentContext}>\n {runIfFn(children, { open, onClose })}\n </ComponentContext>\n </HydrationContext>\n </StyleContext>\n )\n}\n\nexport interface PopoverTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverTrigger = withContext<\"button\", PopoverTriggerProps>(\n \"button\",\n \"trigger\",\n)({ asChild: true }, (props) => {\n const { getTriggerProps } = useComponentContext()\n\n return getTriggerProps(props)\n})\n\nexport interface PopoverCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const PopoverCloseTrigger = withContext<\n \"button\",\n PopoverCloseTriggerProps\n>(\"button\", { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] })(\n { asChild: true },\n (props) => {\n const { getCloseTriggerProps } = useComponentContext()\n\n return getCloseTriggerProps(props)\n },\n)\n\nexport interface PopoverAnchorProps extends HTMLStyledProps {}\n\nexport const PopoverAnchor = withContext<\"div\", PopoverAnchorProps>(\n \"div\",\n \"anchor\",\n)({ asChild: true }, (props) => {\n const { getAnchorProps } = useComponentContext()\n\n return getAnchorProps(props)\n})\n\ninterface PopoverPositionerProps extends HTMLStyledProps {}\n\nconst PopoverPositioner = withContext<\"div\", PopoverPositionerProps>(\n \"div\",\n \"positioner\",\n)(undefined, (props) => {\n const { getPositionerProps } = useComponentContext()\n\n return getPositionerProps(props)\n})\n\nexport interface PopoverContentProps\n extends Omit<HTMLMotionProps, \"children\">, PropsWithChildren {\n /**\n * Props for portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n}\n\nexport const PopoverContent = withContext<\"div\", PopoverContentProps>(\n ({ portalProps, ...rest }) => {\n const { animationScheme, duration, open, getContentProps } =\n useComponentContext()\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n\n return (\n <AnimatePresence>\n {open ? (\n <Portal {...portalProps}>\n <PopoverPositioner>\n <motion.div\n {...popupAnimationProps}\n {...cast<HTMLMotionProps>(\n getContentProps(cast<HTMLProps>(rest)),\n )}\n />\n </PopoverPositioner>\n </Portal>\n ) : null}\n </AnimatePresence>\n )\n },\n \"content\",\n)()\n\nexport interface PopoverHeaderProps extends HTMLStyledProps {}\n\nexport const PopoverHeader = withContext<\"div\", PopoverHeaderProps>(\n \"div\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n\n return getHeaderProps(props)\n})\n\nexport interface PopoverBodyProps extends HTMLStyledProps {}\n\nexport const PopoverBody = withContext<\"div\", PopoverBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { getBodyProps } = useComponentContext()\n\n return getBodyProps(props)\n },\n)\n\nexport interface PopoverFooterProps extends HTMLStyledProps {}\n\nexport const PopoverFooter = withContext<\"div\", PopoverFooterProps>(\n \"div\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n\n return getFooterProps(props)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,0BAA0B,QAAgC,EAAE,KAAK;CAC5E,MAAM,kBAAkB,SAAS,MAAM,mBAAmB,QAAQ;CAClE,MAAM,WAAW,SAAS,MAAM,YAAY,GAAI;CAChD,MAAM,cAAc;EAAE,SAAS;EAAS,MAAM;EAAQ,SAAS;EAAQ;AAEvE,SAAQ,iBAAR;EACE,KAAK,QACH,QAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAM,OAAO;IAAM;GAChD,UAAU;GACX;EACH,KAAK,cACH,QAAO;GACL,GAAG;GACH,QAAQ;IAAE;IAAU,SAAS;IAAK,SAAS;IAAM;GACjD,UAAU;GACX;EACH,KAAK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AgB,YAC3B,OACA,SACD,CAAC,SAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,qBAAqB;AAEhD,QAAO,eAAe,MAAM;EAC5B"}
|
|
@@ -14,7 +14,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
14
14
|
* @see https://yamada-ui.com/docs/components/radio
|
|
15
15
|
*/
|
|
16
16
|
const RadioGroupRoot = component((props) => {
|
|
17
|
-
const [, { colorScheme, size, variant, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], readOnly, shape, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
17
|
+
const [, { colorScheme, size, variant, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], readOnly, shape, suppressHydrationWarning, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
18
18
|
"variant",
|
|
19
19
|
"colorScheme",
|
|
20
20
|
"size",
|
|
@@ -39,7 +39,8 @@ const RadioGroupRoot = component((props) => {
|
|
|
39
39
|
focusBorderColor,
|
|
40
40
|
invalid,
|
|
41
41
|
readOnly,
|
|
42
|
-
shape
|
|
42
|
+
shape,
|
|
43
|
+
suppressHydrationWarning
|
|
43
44
|
}), [
|
|
44
45
|
variant,
|
|
45
46
|
size,
|
|
@@ -49,7 +50,8 @@ const RadioGroupRoot = component((props) => {
|
|
|
49
50
|
invalid,
|
|
50
51
|
readOnly,
|
|
51
52
|
errorBorderColor,
|
|
52
|
-
focusBorderColor
|
|
53
|
+
focusBorderColor,
|
|
54
|
+
suppressHydrationWarning
|
|
53
55
|
]),
|
|
54
56
|
children: /* @__PURE__ */ jsx(RadioGroupContext, {
|
|
55
57
|
value: useMemo(() => ({
|
|
@@ -67,7 +69,7 @@ const RadioGroupRoot = component((props) => {
|
|
|
67
69
|
]),
|
|
68
70
|
children: /* @__PURE__ */ jsx(Group, {
|
|
69
71
|
orientation: "vertical",
|
|
70
|
-
...getRootProps(),
|
|
72
|
+
...getRootProps({ suppressHydrationWarning }),
|
|
71
73
|
children: computedChildren
|
|
72
74
|
})
|
|
73
75
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","names":["rest","value"],"sources":["../../../../src/components/radio/radio-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { RadioProps } from \"./radio\"\nimport type { RadioStyle } from \"./radio.style\"\nimport type { UseRadioGroupProps } from \"./use-radio-group\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport {\n component,\n Radio,\n RadioPropsContext,\n useRootComponentProps,\n} from \"./radio\"\nimport { RadioGroupContext, useRadioGroup } from \"./use-radio-group\"\n\nexport interface RadioGroupItem<\n Y extends string = string,\n> extends RadioProps<Y> {\n label: ReactNode\n}\n\nexport interface RadioGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, RadioStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<RadioStyle>,\n UseRadioGroupProps<Y>,\n UseInputBorderProps {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: RadioGroupItem<Y>[]\n}\n\n/**\n * `RadioGroup` is a component that groups `Radio` components.\n *\n * @see https://yamada-ui.com/docs/components/radio\n */\nexport const RadioGroupRoot = component<\"div\", RadioGroupRootProps>((props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n children,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n items = [],\n readOnly,\n shape,\n ...rest\n },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\"variant\", \"colorScheme\", \"size\", \"shape\"],\n })\n const { name, value, getInputProps, getLabelProps, getRootProps, onChange } =\n useRadioGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ label, value, ...rest }, index) => (\n <Radio key={value ?? index} value={value} {...rest}>\n {label}\n </Radio>\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n readOnly,\n shape,\n }),\n [\n variant,\n size,\n colorScheme,\n shape,\n disabled,\n invalid,\n readOnly,\n errorBorderColor,\n focusBorderColor,\n ],\n )\n const groupContext = useMemo(\n () => ({ name, value, getInputProps, getLabelProps, onChange }),\n [name, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <RadioPropsContext value={context}>\n <RadioGroupContext value={groupContext}>\n <Group
|
|
1
|
+
{"version":3,"file":"radio-group.js","names":["rest","value"],"sources":["../../../../src/components/radio/radio-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement, ReactNode } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { RadioProps } from \"./radio\"\nimport type { RadioStyle } from \"./radio.style\"\nimport type { UseRadioGroupProps } from \"./use-radio-group\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport {\n component,\n Radio,\n RadioPropsContext,\n useRootComponentProps,\n} from \"./radio\"\nimport { RadioGroupContext, useRadioGroup } from \"./use-radio-group\"\n\nexport interface RadioGroupItem<\n Y extends string = string,\n> extends RadioProps<Y> {\n label: ReactNode\n}\n\nexport interface RadioGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, RadioStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<RadioStyle>,\n UseRadioGroupProps<Y>,\n UseInputBorderProps {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: RadioGroupItem<Y>[]\n}\n\n/**\n * `RadioGroup` is a component that groups `Radio` components.\n *\n * @see https://yamada-ui.com/docs/components/radio\n */\nexport const RadioGroupRoot = component<\"div\", RadioGroupRootProps>((props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n children,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n items = [],\n readOnly,\n shape,\n suppressHydrationWarning,\n ...rest\n },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\"variant\", \"colorScheme\", \"size\", \"shape\"],\n })\n const { name, value, getInputProps, getLabelProps, getRootProps, onChange } =\n useRadioGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ label, value, ...rest }, index) => (\n <Radio key={value ?? index} value={value} {...rest}>\n {label}\n </Radio>\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n readOnly,\n shape,\n suppressHydrationWarning,\n }),\n [\n variant,\n size,\n colorScheme,\n shape,\n disabled,\n invalid,\n readOnly,\n errorBorderColor,\n focusBorderColor,\n suppressHydrationWarning,\n ],\n )\n const groupContext = useMemo(\n () => ({ name, value, getInputProps, getLabelProps, onChange }),\n [name, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <RadioPropsContext value={context}>\n <RadioGroupContext value={groupContext}>\n <Group\n orientation=\"vertical\"\n {...getRootProps({ suppressHydrationWarning })}\n >\n {computedChildren}\n </Group>\n </RadioGroupContext>\n </RadioPropsContext>\n )\n}, \"group\")() as GenericsComponent<{\n <Y extends string = string>(props: RadioGroupRootProps<Y>): ReactElement\n}>\n\nexport { Radio as RadioGroupItem }\n"],"mappings":";;;;;;;;;;;;;;;AAmDA,MAAa,iBAAiB,WAAuC,UAAU;CAC7E,MAAM,GAEJ,EACE,aACA,MACA,SACA,UACA,UACA,kBACA,kBACA,SACA,QAAQ,EAAE,EACV,UACA,OACA,0BACA,GAAG,UAEH,sBAAsB,OAAO,SAAS,EACxC,eAAe;EAAC;EAAW;EAAe;EAAQ;EAAQ,EAC3D,CAAC;CACF,MAAM,EAAE,MAAM,OAAO,eAAe,eAAe,cAAc,aAC/D,cAAc,KAAK;CACrB,MAAM,mBAAmB,cAAc;AACrC,MAAI,SAAU,QAAO;AAErB,SAAO,MAAM,KAAK,EAAE,OAAO,gBAAO,GAAGA,UAAQ,UAC3C,oBAAC;GAA2B,OAAOC;GAAO,GAAID;aAC3C;KADSC,WAAS,MAEb,CACR;IACD,CAAC,OAAO,SAAS,CAAC;AAgCrB,QACE,oBAAC;EAAkB,OAhCL,eACP;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;YAQG,oBAAC;GAAkB,OAPF,eACZ;IAAE;IAAM;IAAO;IAAe;IAAe;IAAU,GAC9D;IAAC;IAAM;IAAO;IAAe;IAAe;IAAS,CACtD;aAKK,oBAAC;IACC,aAAY;IACZ,GAAI,aAAa,EAAE,0BAA0B,CAAC;cAE7C;KACK;IACU;GACF;GAErB,QAAQ,EAAE"}
|
|
@@ -15,7 +15,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
15
15
|
* @see https://yamada-ui.com/docs/components/radio-card
|
|
16
16
|
*/
|
|
17
17
|
const RadioCardGroupRoot = component((props) => {
|
|
18
|
-
const [, { colorScheme, size, variant, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], justify, readOnly, shape, withIndicator, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
18
|
+
const [, { colorScheme, size, variant, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], justify, readOnly, shape, suppressHydrationWarning, withIndicator, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
19
19
|
"variant",
|
|
20
20
|
"colorScheme",
|
|
21
21
|
"size",
|
|
@@ -43,6 +43,7 @@ const RadioCardGroupRoot = component((props) => {
|
|
|
43
43
|
justify,
|
|
44
44
|
readOnly,
|
|
45
45
|
shape,
|
|
46
|
+
suppressHydrationWarning,
|
|
46
47
|
withIndicator
|
|
47
48
|
}), [
|
|
48
49
|
colorScheme,
|
|
@@ -55,7 +56,8 @@ const RadioCardGroupRoot = component((props) => {
|
|
|
55
56
|
focusBorderColor,
|
|
56
57
|
invalid,
|
|
57
58
|
readOnly,
|
|
58
|
-
shape
|
|
59
|
+
shape,
|
|
60
|
+
suppressHydrationWarning
|
|
59
61
|
]),
|
|
60
62
|
children: /* @__PURE__ */ jsx(RadioGroupContext, {
|
|
61
63
|
value: useMemo(() => ({
|
|
@@ -72,7 +74,7 @@ const RadioCardGroupRoot = component((props) => {
|
|
|
72
74
|
onChange
|
|
73
75
|
]),
|
|
74
76
|
children: /* @__PURE__ */ jsx(Group, {
|
|
75
|
-
...getRootProps(),
|
|
77
|
+
...getRootProps({ suppressHydrationWarning }),
|
|
76
78
|
children: computedChildren
|
|
77
79
|
})
|
|
78
80
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-card-group.js","names":["rest","value"],"sources":["../../../../src/components/radio-card/radio-card-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UseRadioGroupProps } from \"../radio\"\nimport type { RadioCardRootProps } from \"./radio-card\"\nimport type { RadioCardStyle } from \"./radio-card.style\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport { RadioGroupContext, useRadioGroup } from \"../radio\"\nimport {\n component,\n RadioCardPropsContext,\n RadioCardRoot,\n useRootComponentProps,\n} from \"./radio-card\"\n\nexport interface RadioCardGroupItem<\n Y extends string = string,\n> extends RadioCardRootProps<Y> {}\n\nexport interface RadioCardGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, RadioCardStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<RadioCardStyle>,\n UseRadioGroupProps<Y>,\n UseInputBorderProps,\n Pick<RadioCardRootProps, \"withIndicator\"> {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: RadioCardGroupItem<Y>[]\n}\n\n/**\n * `RadioCardGroup` is a component that groups `RadioCard` components.\n *\n * @see https://yamada-ui.com/docs/components/radio-card\n */\nexport const RadioCardGroupRoot = component<\"div\", RadioCardGroupRootProps>(\n (props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n children,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n items = [],\n justify,\n readOnly,\n shape,\n withIndicator,\n ...rest\n },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\n \"variant\",\n \"colorScheme\",\n \"size\",\n \"shape\",\n \"justify\",\n \"withIndicator\",\n ],\n })\n const {\n name,\n value,\n getInputProps,\n getLabelProps,\n getRootProps,\n onChange,\n } = useRadioGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ value, ...rest }, index) => (\n <RadioCardRoot key={value ?? index} value={value} {...rest} />\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n justify,\n readOnly,\n shape,\n withIndicator,\n }),\n [\n colorScheme,\n size,\n variant,\n disabled,\n justify,\n withIndicator,\n errorBorderColor,\n focusBorderColor,\n invalid,\n readOnly,\n shape,\n ],\n )\n const groupContext = useMemo(\n () => ({ name, value, getInputProps, getLabelProps, onChange }),\n [name, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <RadioCardPropsContext value={context}>\n <RadioGroupContext value={groupContext}>\n <Group {...getRootProps()}
|
|
1
|
+
{"version":3,"file":"radio-card-group.js","names":["rest","value"],"sources":["../../../../src/components/radio-card/radio-card-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { UseInputBorderProps } from \"../input\"\nimport type { UseRadioGroupProps } from \"../radio\"\nimport type { RadioCardRootProps } from \"./radio-card\"\nimport type { RadioCardStyle } from \"./radio-card.style\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport { RadioGroupContext, useRadioGroup } from \"../radio\"\nimport {\n component,\n RadioCardPropsContext,\n RadioCardRoot,\n useRootComponentProps,\n} from \"./radio-card\"\n\nexport interface RadioCardGroupItem<\n Y extends string = string,\n> extends RadioCardRootProps<Y> {}\n\nexport interface RadioCardGroupRootProps<Y extends string = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, RadioCardStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n ThemeProps<RadioCardStyle>,\n UseRadioGroupProps<Y>,\n UseInputBorderProps,\n Pick<RadioCardRootProps, \"withIndicator\"> {\n /**\n * If provided, generate options based on items.\n *\n * @default []\n */\n items?: RadioCardGroupItem<Y>[]\n}\n\n/**\n * `RadioCardGroup` is a component that groups `RadioCard` components.\n *\n * @see https://yamada-ui.com/docs/components/radio-card\n */\nexport const RadioCardGroupRoot = component<\"div\", RadioCardGroupRootProps>(\n (props) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n children,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n items = [],\n justify,\n readOnly,\n shape,\n suppressHydrationWarning,\n withIndicator,\n ...rest\n },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\n \"variant\",\n \"colorScheme\",\n \"size\",\n \"shape\",\n \"justify\",\n \"withIndicator\",\n ],\n })\n const {\n name,\n value,\n getInputProps,\n getLabelProps,\n getRootProps,\n onChange,\n } = useRadioGroup(rest)\n const computedChildren = useMemo(() => {\n if (children) return children\n\n return items.map(({ value, ...rest }, index) => (\n <RadioCardRoot key={value ?? index} value={value} {...rest} />\n ))\n }, [items, children])\n const context = useMemo(\n () => ({\n colorScheme,\n size,\n variant,\n disabled,\n errorBorderColor,\n focusBorderColor,\n invalid,\n justify,\n readOnly,\n shape,\n suppressHydrationWarning,\n withIndicator,\n }),\n [\n colorScheme,\n size,\n variant,\n disabled,\n justify,\n withIndicator,\n errorBorderColor,\n focusBorderColor,\n invalid,\n readOnly,\n shape,\n suppressHydrationWarning,\n ],\n )\n const groupContext = useMemo(\n () => ({ name, value, getInputProps, getLabelProps, onChange }),\n [name, value, getInputProps, getLabelProps, onChange],\n )\n\n return (\n <RadioCardPropsContext value={context}>\n <RadioGroupContext value={groupContext}>\n <Group {...getRootProps({ suppressHydrationWarning })}>\n {computedChildren}\n </Group>\n </RadioGroupContext>\n </RadioCardPropsContext>\n )\n },\n \"group\",\n)() as GenericsComponent<{\n <Y extends string = string>(props: RadioCardGroupRootProps<Y>): ReactElement\n}>\n\nexport { RadioCardRoot as RadioCardGroupItem }\n"],"mappings":";;;;;;;;;;;;;;;;AAkDA,MAAa,qBAAqB,WAC/B,UAAU;CACT,MAAM,GAEJ,EACE,aACA,MACA,SACA,UACA,UACA,kBACA,kBACA,SACA,QAAQ,EAAE,EACV,SACA,UACA,OACA,0BACA,eACA,GAAG,UAEH,sBAAsB,OAAO,SAAS,EACxC,eAAe;EACb;EACA;EACA;EACA;EACA;EACA;EACD,EACF,CAAC;CACF,MAAM,EACJ,MACA,OACA,eACA,eACA,cACA,aACE,cAAc,KAAK;CACvB,MAAM,mBAAmB,cAAc;AACrC,MAAI,SAAU,QAAO;AAErB,SAAO,MAAM,KAAK,EAAE,gBAAO,GAAGA,UAAQ,UACpC,oBAAC;GAAmC,OAAOC;GAAO,GAAID;KAAlCC,WAAS,MAAiC,CAC9D;IACD,CAAC,OAAO,SAAS,CAAC;AAoCrB,QACE,oBAAC;EAAsB,OApCT,eACP;GACL;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,GACD;GACE;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CACF;YAQG,oBAAC;GAAkB,OAPF,eACZ;IAAE;IAAM;IAAO;IAAe;IAAe;IAAU,GAC9D;IAAC;IAAM;IAAO;IAAe;IAAe;IAAS,CACtD;aAKK,oBAAC;IAAM,GAAI,aAAa,EAAE,0BAA0B,CAAC;cAClD;KACK;IACU;GACE;GAG5B,QACD,EAAE"}
|
|
@@ -9,7 +9,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
9
9
|
|
|
10
10
|
//#region src/components/toggle/toggle-group.tsx
|
|
11
11
|
const ToggleGroupRoot = component((props) => {
|
|
12
|
-
const [, { colorScheme, size, variant, attached, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
12
|
+
const [, { colorScheme, size, variant, attached, suppressHydrationWarning, ...rest }] = useRootComponentProps(props, "group", { transferProps: [
|
|
13
13
|
"size",
|
|
14
14
|
"variant",
|
|
15
15
|
"colorScheme"
|
|
@@ -20,12 +20,14 @@ const ToggleGroupRoot = component((props) => {
|
|
|
20
20
|
colorScheme,
|
|
21
21
|
size,
|
|
22
22
|
variant,
|
|
23
|
-
focusVisibleRing: attached ? "inside" : void 0
|
|
23
|
+
focusVisibleRing: attached ? "inside" : void 0,
|
|
24
|
+
suppressHydrationWarning
|
|
24
25
|
}), [
|
|
25
26
|
variant,
|
|
26
27
|
size,
|
|
27
28
|
colorScheme,
|
|
28
|
-
attached
|
|
29
|
+
attached,
|
|
30
|
+
suppressHydrationWarning
|
|
29
31
|
]),
|
|
30
32
|
children: /* @__PURE__ */ jsx(ToggleGroupContext, {
|
|
31
33
|
value: useMemo(() => ({
|
|
@@ -43,7 +45,7 @@ const ToggleGroupRoot = component((props) => {
|
|
|
43
45
|
]),
|
|
44
46
|
children: /* @__PURE__ */ jsx(Group, {
|
|
45
47
|
attached,
|
|
46
|
-
...getGroupProps()
|
|
48
|
+
...getGroupProps({ suppressHydrationWarning })
|
|
47
49
|
})
|
|
48
50
|
})
|
|
49
51
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-group.js","names":[],"sources":["../../../../src/components/toggle/toggle-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { ToggleProps } from \"./toggle\"\nimport type { ToggleStyle } from \"./toggle.style\"\nimport type { UseToggleGroupProps } from \"./use-toggle-group\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport { component, TogglePropsContext, useRootComponentProps } from \"./toggle\"\nimport { ToggleGroupContext, useToggleGroup } from \"./use-toggle-group\"\n\n/**\n * `ToggleGroup` is a set of two-state buttons that can be toggled on or off.\n *\n * @see https://yamada-ui.com/docs/components/toggle\n */\nexport interface ToggleGroupRootProps<Y extends string | string[] = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, ToggleStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n UseToggleGroupProps<Y>,\n ThemeProps<ToggleStyle> {}\n\nexport const ToggleGroupRoot = component<\"div\", ToggleGroupRootProps>(\n (props: ToggleGroupRootProps) => {\n const [
|
|
1
|
+
{"version":3,"file":"toggle-group.js","names":[],"sources":["../../../../src/components/toggle/toggle-group.tsx"],"sourcesContent":["\"use client\"\n\nimport type { ReactElement } from \"react\"\nimport type {\n GenericsComponent,\n ThemeProps,\n WithoutThemeProps,\n} from \"../../core\"\nimport type { GroupProps } from \"../group\"\nimport type { ToggleProps } from \"./toggle\"\nimport type { ToggleStyle } from \"./toggle.style\"\nimport type { UseToggleGroupProps } from \"./use-toggle-group\"\nimport { useMemo } from \"react\"\nimport { Group } from \"../group\"\nimport { component, TogglePropsContext, useRootComponentProps } from \"./toggle\"\nimport { ToggleGroupContext, useToggleGroup } from \"./use-toggle-group\"\n\n/**\n * `ToggleGroup` is a set of two-state buttons that can be toggled on or off.\n *\n * @see https://yamada-ui.com/docs/components/toggle\n */\nexport interface ToggleGroupRootProps<Y extends string | string[] = string>\n extends\n Omit<\n WithoutThemeProps<GroupProps, ToggleStyle>,\n \"defaultValue\" | \"onChange\" | \"value\"\n >,\n UseToggleGroupProps<Y>,\n ThemeProps<ToggleStyle> {}\n\nexport const ToggleGroupRoot = component<\"div\", ToggleGroupRootProps>(\n (props: ToggleGroupRootProps) => {\n const [\n ,\n {\n colorScheme,\n size,\n variant,\n attached,\n suppressHydrationWarning,\n ...rest\n },\n ] = useRootComponentProps(props, \"group\", {\n transferProps: [\"size\", \"variant\", \"colorScheme\"],\n })\n const {\n disabled,\n readOnly,\n value,\n getGroupProps,\n onChange,\n onChangeMapRef,\n } = useToggleGroup(rest)\n const context = useMemo<ToggleProps>(\n () => ({\n colorScheme,\n size,\n variant,\n focusVisibleRing: attached ? \"inside\" : undefined,\n suppressHydrationWarning,\n }),\n [variant, size, colorScheme, attached, suppressHydrationWarning],\n )\n const groupContext = useMemo(\n () => ({\n disabled,\n readOnly,\n value,\n onChange,\n onChangeMapRef,\n }),\n [value, disabled, readOnly, onChange, onChangeMapRef],\n )\n\n return (\n <TogglePropsContext value={context}>\n <ToggleGroupContext value={groupContext}>\n <Group\n attached={attached}\n {...getGroupProps({ suppressHydrationWarning })}\n />\n </ToggleGroupContext>\n </TogglePropsContext>\n )\n },\n \"group\",\n)() as GenericsComponent<{\n <Y extends string | string[] = string>(\n props: ToggleGroupRootProps<Y>,\n ): ReactElement\n}>\n"],"mappings":";;;;;;;;;;AA+BA,MAAa,kBAAkB,WAC5B,UAAgC;CAC/B,MAAM,GAEJ,EACE,aACA,MACA,SACA,UACA,0BACA,GAAG,UAEH,sBAAsB,OAAO,SAAS,EACxC,eAAe;EAAC;EAAQ;EAAW;EAAc,EAClD,CAAC;CACF,MAAM,EACJ,UACA,UACA,OACA,eACA,UACA,mBACE,eAAe,KAAK;AAsBxB,QACE,oBAAC;EAAmB,OAtBN,eACP;GACL;GACA;GACA;GACA,kBAAkB,WAAW,WAAW;GACxC;GACD,GACD;GAAC;GAAS;GAAM;GAAa;GAAU;GAAyB,CACjE;YAcG,oBAAC;GAAmB,OAbH,eACZ;IACL;IACA;IACA;IACA;IACA;IACD,GACD;IAAC;IAAO;IAAU;IAAU;IAAU;IAAe,CACtD;aAKK,oBAAC;IACW;IACV,GAAI,cAAc,EAAE,0BAA0B,CAAC;KAC/C;IACiB;GACF;GAGzB,QACD,EAAE"}
|
|
@@ -11,41 +11,46 @@ import { usePopupAnimationProps } from "../popover/popover.js";
|
|
|
11
11
|
import "../popover/index.js";
|
|
12
12
|
import { tooltipStyle } from "./tooltip.style.js";
|
|
13
13
|
import { useTooltip } from "./use-tooltip.js";
|
|
14
|
+
import { useMemo } from "react";
|
|
14
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
16
|
import { AnimatePresence } from "motion/react";
|
|
16
17
|
|
|
17
18
|
//#region src/components/tooltip/tooltip.tsx
|
|
18
|
-
const { PropsContext: TooltipPropsContext, StyleContext, usePropsContext: useTooltipPropsContext, withContext, useRootComponentProps } = createSlotComponent("tooltip", tooltipStyle);
|
|
19
|
+
const { HydrationContext, PropsContext: TooltipPropsContext, StyleContext, usePropsContext: useTooltipPropsContext, withContext, useRootComponentProps } = createSlotComponent("tooltip", tooltipStyle);
|
|
19
20
|
/**
|
|
20
21
|
* `Tooltip` is a component that displays short information, such as supplementary details for an element.
|
|
21
22
|
*
|
|
22
23
|
* @see https://yamada-ui.com/docs/components/tooltip
|
|
23
24
|
*/
|
|
24
25
|
const Tooltip = (props) => {
|
|
25
|
-
const [
|
|
26
|
+
const [styleContext, { animationScheme = "scale", children, content, duration = .1, suppressHydrationWarning, contentProps, portalProps, ...rest }] = useRootComponentProps(props);
|
|
26
27
|
const { open, getContentProps, getPositionerProps, getTriggerProps } = useTooltip(rest);
|
|
27
28
|
const popupAnimationProps = usePopupAnimationProps({
|
|
28
29
|
animationScheme,
|
|
29
30
|
duration
|
|
30
31
|
});
|
|
32
|
+
const hydrationContext = useMemo(() => suppressHydrationWarning ? { suppressHydrationWarning } : {}, [suppressHydrationWarning]);
|
|
31
33
|
if (!content) return children;
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
value:
|
|
34
|
-
children:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
children: /* @__PURE__ */ jsx(
|
|
41
|
-
...
|
|
42
|
-
children: /* @__PURE__ */ jsx(
|
|
43
|
-
...
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
return /* @__PURE__ */ jsx(StyleContext, {
|
|
35
|
+
value: styleContext,
|
|
36
|
+
children: /* @__PURE__ */ jsxs(HydrationContext, {
|
|
37
|
+
value: hydrationContext,
|
|
38
|
+
children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
39
|
+
asChild: true,
|
|
40
|
+
...getTriggerProps(),
|
|
41
|
+
children
|
|
42
|
+
}), /* @__PURE__ */ jsx(AnimatePresence, { children: open ? /* @__PURE__ */ jsx(Portal, {
|
|
43
|
+
...portalProps,
|
|
44
|
+
children: /* @__PURE__ */ jsx(TooltipPositioner, {
|
|
45
|
+
...getPositionerProps(),
|
|
46
|
+
children: /* @__PURE__ */ jsx(TooltipContent, {
|
|
47
|
+
...popupAnimationProps,
|
|
48
|
+
...(0, utils_exports.cast)(getContentProps((0, utils_exports.cast)(contentProps))),
|
|
49
|
+
children: content
|
|
50
|
+
})
|
|
46
51
|
})
|
|
47
|
-
})
|
|
48
|
-
})
|
|
52
|
+
}) : null })]
|
|
53
|
+
})
|
|
49
54
|
});
|
|
50
55
|
};
|
|
51
56
|
const TooltipPositioner = withContext("div", "positioner")();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","names":["Tooltip: FC<TooltipProps>","motion"],"sources":["../../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["\"use client\"\n\nimport type {
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":["Tooltip: FC<TooltipProps>","motion"],"sources":["../../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["\"use client\"\n\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { HTMLMotionProps } from \"../motion\"\nimport type { UsePopupAnimationProps } from \"../popover\"\nimport type { PortalProps } from \"../portal\"\nimport type { TooltipStyle } from \"./tooltip.style\"\nimport type { UseTooltipProps } from \"./use-tooltip\"\nimport { AnimatePresence } from \"motion/react\"\nimport { type FC, type PropsWithChildren, type ReactNode, useMemo } from \"react\"\nimport { createSlotComponent } from \"../../core\"\nimport { cast } from \"../../utils\"\nimport { motion } from \"../motion\"\nimport { usePopupAnimationProps } from \"../popover\"\nimport { Portal } from \"../portal\"\nimport { tooltipStyle } from \"./tooltip.style\"\nimport { useTooltip } from \"./use-tooltip\"\n\nexport interface TooltipProps\n extends\n UseTooltipProps,\n PropsWithChildren,\n UsePopupAnimationProps,\n ThemeProps<TooltipStyle>,\n Pick<HTMLProps, \"suppressHydrationWarning\"> {\n /**\n * The content of the tooltip.\n */\n content?: ReactNode\n /**\n * The animation duration.\n *\n * @default 0.1\n */\n duration?: UsePopupAnimationProps[\"duration\"]\n /**\n * Props for content element.\n */\n contentProps?: HTMLMotionProps\n /**\n * Props for portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n}\n\nconst {\n HydrationContext,\n PropsContext: TooltipPropsContext,\n StyleContext,\n usePropsContext: useTooltipPropsContext,\n withContext,\n useRootComponentProps,\n} = createSlotComponent<TooltipProps, TooltipStyle>(\"tooltip\", tooltipStyle)\n\nexport { TooltipPropsContext, useTooltipPropsContext }\n\n/**\n * `Tooltip` is a component that displays short information, such as supplementary details for an element.\n *\n * @see https://yamada-ui.com/docs/components/tooltip\n */\nexport const Tooltip: FC<TooltipProps> = (props) => {\n const [\n styleContext,\n {\n animationScheme = \"scale\",\n children,\n content,\n duration = 0.1,\n suppressHydrationWarning,\n contentProps,\n portalProps,\n ...rest\n },\n ] = useRootComponentProps(props)\n const { open, getContentProps, getPositionerProps, getTriggerProps } =\n useTooltip(rest)\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n const hydrationContext = useMemo(\n () => (suppressHydrationWarning ? { suppressHydrationWarning } : {}),\n [suppressHydrationWarning],\n )\n\n if (!content) return children\n\n return (\n <StyleContext value={styleContext}>\n <HydrationContext value={hydrationContext}>\n <TooltipTrigger asChild {...getTriggerProps()}>\n {children}\n </TooltipTrigger>\n\n <AnimatePresence>\n {open ? (\n <Portal {...portalProps}>\n <TooltipPositioner {...getPositionerProps()}>\n <TooltipContent\n {...popupAnimationProps}\n {...cast<HTMLMotionProps>(\n getContentProps(cast<HTMLProps>(contentProps)),\n )}\n >\n {content}\n </TooltipContent>\n </TooltipPositioner>\n </Portal>\n ) : null}\n </AnimatePresence>\n </HydrationContext>\n </StyleContext>\n )\n}\n\ninterface TooltipPositionerProps extends HTMLStyledProps {}\n\nconst TooltipPositioner = withContext<\"div\", TooltipPositionerProps>(\n \"div\",\n \"positioner\",\n)()\n\ninterface TooltipTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nconst TooltipTrigger = withContext<\"button\", TooltipTriggerProps>(\n \"button\",\n \"trigger\",\n)()\n\ninterface TooltipContentProps extends Omit<\n HTMLMotionProps,\n \"children\" | \"offset\" | \"transform\"\n> {}\n\nconst TooltipContent = withContext<\"div\", TooltipContentProps>(\n motion.div,\n \"content\",\n)()\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6CA,MAAM,EACJ,kBACA,cAAc,qBACd,cACA,iBAAiB,wBACjB,aACA,0BACE,oBAAgD,WAAW,aAAa;;;;;;AAS5E,MAAaA,WAA6B,UAAU;CAClD,MAAM,CACJ,cACA,EACE,kBAAkB,SAClB,UACA,SACA,WAAW,IACX,0BACA,cACA,aACA,GAAG,UAEH,sBAAsB,MAAM;CAChC,MAAM,EAAE,MAAM,iBAAiB,oBAAoB,oBACjD,WAAW,KAAK;CAClB,MAAM,sBAAsB,uBAAuB;EACjD;EACA;EACD,CAAC;CACF,MAAM,mBAAmB,cAChB,2BAA2B,EAAE,0BAA0B,GAAG,EAAE,EACnE,CAAC,yBAAyB,CAC3B;AAED,KAAI,CAAC,QAAS,QAAO;AAErB,QACE,oBAAC;EAAa,OAAO;YACnB,qBAAC;GAAiB,OAAO;cACvB,oBAAC;IAAe;IAAQ,GAAI,iBAAiB;IAC1C;KACc,EAEjB,oBAAC,6BACE,OACC,oBAAC;IAAO,GAAI;cACV,oBAAC;KAAkB,GAAI,oBAAoB;eACzC,oBAAC;MACC,GAAI;MACJ,2BACE,wCAAgC,aAAa,CAAC,CAC/C;gBAEA;OACc;MACC;KACb,GACP,OACY;IACD;GACN;;AAMnB,MAAM,oBAAoB,YACxB,OACA,aACD,EAAE;AAIH,MAAM,iBAAiB,YACrB,UACA,UACD,EAAE;AAOH,MAAM,iBAAiB,YACrBC,SAAO,KACP,UACD,EAAE"}
|