@yamada-ui/react 2.2.6-dev-20260730065117 → 2.2.6-dev-20260730091154

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.
Files changed (30) hide show
  1. package/dist/cjs/components/drawer/drawer.cjs +1 -1
  2. package/dist/cjs/components/focus-lock/focus-lock.cjs +26 -9
  3. package/dist/cjs/components/focus-lock/focus-lock.cjs.map +1 -1
  4. package/dist/cjs/components/focus-lock/index.cjs +1 -0
  5. package/dist/cjs/components/modal/modal.cjs +39 -21
  6. package/dist/cjs/components/modal/modal.cjs.map +1 -1
  7. package/dist/cjs/components/popover/popover.cjs +61 -22
  8. package/dist/cjs/components/popover/popover.cjs.map +1 -1
  9. package/dist/cjs/components/portal/portal.cjs +16 -0
  10. package/dist/cjs/components/portal/portal.cjs.map +1 -1
  11. package/dist/cjs/index.cjs +3 -1
  12. package/dist/esm/components/drawer/drawer.js +1 -1
  13. package/dist/esm/components/focus-lock/focus-lock.js +27 -11
  14. package/dist/esm/components/focus-lock/focus-lock.js.map +1 -1
  15. package/dist/esm/components/focus-lock/index.js +2 -2
  16. package/dist/esm/components/modal/modal.js +40 -21
  17. package/dist/esm/components/modal/modal.js.map +1 -1
  18. package/dist/esm/components/popover/popover.js +62 -23
  19. package/dist/esm/components/popover/popover.js.map +1 -1
  20. package/dist/esm/components/portal/portal.js +17 -1
  21. package/dist/esm/components/portal/portal.js.map +1 -1
  22. package/dist/esm/index.js +3 -2
  23. package/dist/types/components/chart/cartesian-chart.style.d.ts +1 -1
  24. package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
  25. package/dist/types/components/focus-lock/focus-lock.d.ts +2 -1
  26. package/dist/types/components/focus-lock/index.d.ts +2 -2
  27. package/dist/types/components/modal/modal.d.ts +37 -1
  28. package/dist/types/components/popover/popover.d.ts +52 -2
  29. package/dist/types/index.d.ts +3 -3
  30. package/package.json +2 -2
@@ -5,11 +5,11 @@ const require_factory = require("../../core/system/factory.cjs");
5
5
  const require_create_component = require("../../core/components/create-component.cjs");
6
6
  const require_factory$1 = require("../motion/factory.cjs");
7
7
  const require_hooks_use_value_index = require("../../hooks/use-value/index.cjs");
8
+ const require_focus_lock = require("../focus-lock/focus-lock.cjs");
8
9
  const require_portal = require("../portal/portal.cjs");
9
10
  const require_button = require("../button/button.cjs");
10
11
  const require_close_button = require("../close-button/close-button.cjs");
11
12
  const require_fade = require("../fade/fade.cjs");
12
- const require_focus_lock = require("../focus-lock/focus-lock.cjs");
13
13
  const require_drawer_style = require("./drawer.style.cjs");
14
14
  const require_slide = require("../slide/slide.cjs");
15
15
  const require_use_drawer = require("./use-drawer.cjs");
@@ -1,11 +1,16 @@
1
1
  "use client";
2
2
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
3
+ const require_context = require("../../utils/context.cjs");
3
4
  const require_utils_index = require("../../utils/index.cjs");
4
5
  let react = require("react");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
6
7
  let react_focus_lock = require("react-focus-lock");
7
8
  react_focus_lock = require_runtime.__toESM(react_focus_lock, 1);
8
9
  //#region src/components/focus-lock/focus-lock.tsx
10
+ const [FocusLockShardContext, useFocusLockShard] = require_context.createContext({
11
+ name: "FocusLockShardContext",
12
+ strict: false
13
+ });
9
14
  const InternalFocusLock = (0, require_utils_index.utils_exports.interopDefault)(react_focus_lock.default);
10
15
  /**
11
16
  * `FocusLock` is a component that improves accessibility by restricting focus within elements such as modals and dialogs, and locking the focus within that range.
@@ -13,7 +18,14 @@ const InternalFocusLock = (0, require_utils_index.utils_exports.interopDefault)(
13
18
  * @see https://yamada-ui.com/docs/components/focus-lock
14
19
  */
15
20
  const FocusLock = ({ autoFocus, children, contentRef, disabled, finalFocusRef, initialFocusRef, lockFocusAcrossFrames, persistentFocus, restoreFocus }) => {
21
+ const [shards, setShards] = (0, react.useState)([]);
16
22
  const returnFocus = restoreFocus && !finalFocusRef;
23
+ const registerShard = (0, react.useCallback)((shard) => {
24
+ setShards((prev) => prev.includes(shard) ? prev : [...prev, shard]);
25
+ return () => {
26
+ setShards((prev) => prev.filter((item) => item !== shard));
27
+ };
28
+ }, []);
17
29
  const onActivation = (0, react.useCallback)(() => {
18
30
  if (initialFocusRef?.current) initialFocusRef.current.focus();
19
31
  else if (contentRef?.current) {
@@ -25,18 +37,23 @@ const FocusLock = ({ autoFocus, children, contentRef, disabled, finalFocusRef, i
25
37
  const onDeactivation = (0, react.useCallback)(() => {
26
38
  finalFocusRef?.current?.focus();
27
39
  }, [finalFocusRef]);
28
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalFocusLock, {
29
- autoFocus,
30
- crossFrame: lockFocusAcrossFrames,
31
- disabled,
32
- persistentFocus,
33
- returnFocus,
34
- onActivation,
35
- onDeactivation,
36
- children
40
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FocusLockShardContext, {
41
+ value: registerShard,
42
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InternalFocusLock, {
43
+ autoFocus,
44
+ crossFrame: lockFocusAcrossFrames,
45
+ disabled,
46
+ persistentFocus,
47
+ returnFocus,
48
+ shards,
49
+ onActivation,
50
+ onDeactivation,
51
+ children
52
+ })
37
53
  });
38
54
  };
39
55
  //#endregion
40
56
  exports.FocusLock = FocusLock;
57
+ exports.useFocusLockShard = useFocusLockShard;
41
58
 
42
59
  //# sourceMappingURL=focus-lock.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"focus-lock.cjs","names":["ReactFocusLock"],"sources":["../../../../src/components/focus-lock/focus-lock.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, RefObject } from \"react\"\nimport { useCallback } from \"react\"\nimport ReactFocusLock from \"react-focus-lock\"\nimport { getFocusableElements, interopDefault } from \"../../utils\"\n\nconst InternalFocusLock = interopDefault(ReactFocusLock)\n\nexport interface FocusLockProps extends PropsWithChildren {\n /**\n * If `true`, the first focusable element within the `children` will auto-focused once `FocusLock` mounts.\n *\n * @default false\n */\n autoFocus?: boolean\n /**\n * The `ref` of the wrapper for which the focus-lock wraps.\n */\n contentRef?: RefObject<HTMLElement | null>\n /**\n * If `true`, focus trapping will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * `ref` of the element to return focus to when `FocusLock` unmounts.\n */\n finalFocusRef?: RefObject<HTMLElement | null>\n /**\n * `ref` of the element to receive focus initially.\n */\n initialFocusRef?: RefObject<HTMLElement | null>\n /**\n * Enables aggressive focus capturing within iframes.\n * - If `true`: keep focus in the lock, no matter where lock is active.\n * - If `false`: allows focus to move outside of iframe.\n *\n * @default false\n */\n lockFocusAcrossFrames?: boolean\n /**\n * If `true`, disables text selections inside, and outside focus lock.\n *\n * @default false\n */\n persistentFocus?: boolean\n /**\n * If `true`, focus will be restored to the element that triggered the `FocusLock` once it unmounts.\n *\n * @default false\n */\n restoreFocus?: boolean\n}\n\n/**\n * `FocusLock` is a component that improves accessibility by restricting focus within elements such as modals and dialogs, and locking the focus within that range.\n *\n * @see https://yamada-ui.com/docs/components/focus-lock\n */\nexport const FocusLock: FC<FocusLockProps> = ({\n autoFocus,\n children,\n contentRef,\n disabled,\n finalFocusRef,\n initialFocusRef,\n lockFocusAcrossFrames,\n persistentFocus,\n restoreFocus,\n}) => {\n const returnFocus = restoreFocus && !finalFocusRef\n\n const onActivation = useCallback(() => {\n if (initialFocusRef?.current) {\n initialFocusRef.current.focus()\n } else if (contentRef?.current) {\n const focusables = getFocusableElements(contentRef.current)\n\n if (focusables.length === 0)\n requestAnimationFrame(() => {\n contentRef.current?.focus()\n })\n }\n }, [initialFocusRef, contentRef])\n\n const onDeactivation = useCallback(() => {\n finalFocusRef?.current?.focus()\n }, [finalFocusRef])\n\n return (\n <InternalFocusLock\n autoFocus={autoFocus}\n crossFrame={lockFocusAcrossFrames}\n disabled={disabled}\n persistentFocus={persistentFocus}\n returnFocus={returnFocus}\n onActivation={onActivation}\n onDeactivation={onDeactivation}\n >\n {children}\n </InternalFocusLock>\n )\n}\n"],"mappings":";;;;;;;;AAOA,MAAM,qBAAA,GAAA,oBAAA,cAAA,eAAA,CAAmCA,iBAAAA,OAAc;;;;;;AAsDvD,MAAa,aAAiC,EAC5C,WACA,UACA,YACA,UACA,eACA,iBACA,uBACA,iBACA,mBACI;CACJ,MAAM,cAAc,gBAAgB,CAAC;CAErC,MAAM,gBAAA,GAAA,MAAA,YAAA,OAAiC;EACrC,IAAI,iBAAiB,SACnB,gBAAgB,QAAQ,MAAM;OACzB,IAAI,YAAY,SACmB;QAAA,GAAA,oBAAA,cAAA,qBAAA,CAAA,WAAW,OAEtC,CAAC,CAAC,WAAW,GACxB,4BAA4B;IAC1B,WAAW,SAAS,MAAM;GAC5B,CAAC;EAAA;CAEP,GAAG,CAAC,iBAAiB,UAAU,CAAC;CAEhC,MAAM,kBAAA,GAAA,MAAA,YAAA,OAAmC;EACvC,eAAe,SAAS,MAAM;CAChC,GAAG,CAAC,aAAa,CAAC;CAElB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD;EACa;EACX,YAAY;EACF;EACO;EACJ;EACC;EACE;EAEf;CACgB,CAAA;AAEvB"}
1
+ {"version":3,"file":"focus-lock.cjs","names":["createContext","ReactFocusLock"],"sources":["../../../../src/components/focus-lock/focus-lock.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, RefObject } from \"react\"\nimport { useCallback, useState } from \"react\"\nimport ReactFocusLock from \"react-focus-lock\"\nimport {\n createContext,\n getFocusableElements,\n interopDefault,\n} from \"../../utils\"\n\nconst [FocusLockShardContext, useFocusLockShard] = createContext<\n ((shard: HTMLElement) => () => void) | undefined\n>({ name: \"FocusLockShardContext\", strict: false })\n\nexport { useFocusLockShard }\n\nconst InternalFocusLock = interopDefault(ReactFocusLock)\n\nexport interface FocusLockProps extends PropsWithChildren {\n /**\n * If `true`, the first focusable element within the `children` will auto-focused once `FocusLock` mounts.\n *\n * @default false\n */\n autoFocus?: boolean\n /**\n * The `ref` of the wrapper for which the focus-lock wraps.\n */\n contentRef?: RefObject<HTMLElement | null>\n /**\n * If `true`, focus trapping will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * `ref` of the element to return focus to when `FocusLock` unmounts.\n */\n finalFocusRef?: RefObject<HTMLElement | null>\n /**\n * `ref` of the element to receive focus initially.\n */\n initialFocusRef?: RefObject<HTMLElement | null>\n /**\n * Enables aggressive focus capturing within iframes.\n * - If `true`: keep focus in the lock, no matter where lock is active.\n * - If `false`: allows focus to move outside of iframe.\n *\n * @default false\n */\n lockFocusAcrossFrames?: boolean\n /**\n * If `true`, disables text selections inside, and outside focus lock.\n *\n * @default false\n */\n persistentFocus?: boolean\n /**\n * If `true`, focus will be restored to the element that triggered the `FocusLock` once it unmounts.\n *\n * @default false\n */\n restoreFocus?: boolean\n}\n\n/**\n * `FocusLock` is a component that improves accessibility by restricting focus within elements such as modals and dialogs, and locking the focus within that range.\n *\n * @see https://yamada-ui.com/docs/components/focus-lock\n */\nexport const FocusLock: FC<FocusLockProps> = ({\n autoFocus,\n children,\n contentRef,\n disabled,\n finalFocusRef,\n initialFocusRef,\n lockFocusAcrossFrames,\n persistentFocus,\n restoreFocus,\n}) => {\n const [shards, setShards] = useState<HTMLElement[]>([])\n const returnFocus = restoreFocus && !finalFocusRef\n\n const registerShard = useCallback((shard: HTMLElement) => {\n setShards((prev) => (prev.includes(shard) ? prev : [...prev, shard]))\n\n return () => {\n setShards((prev) => prev.filter((item) => item !== shard))\n }\n }, [])\n\n const onActivation = useCallback(() => {\n if (initialFocusRef?.current) {\n initialFocusRef.current.focus()\n } else if (contentRef?.current) {\n const focusables = getFocusableElements(contentRef.current)\n\n if (focusables.length === 0)\n requestAnimationFrame(() => {\n contentRef.current?.focus()\n })\n }\n }, [initialFocusRef, contentRef])\n\n const onDeactivation = useCallback(() => {\n finalFocusRef?.current?.focus()\n }, [finalFocusRef])\n\n return (\n <FocusLockShardContext value={registerShard}>\n <InternalFocusLock\n autoFocus={autoFocus}\n crossFrame={lockFocusAcrossFrames}\n disabled={disabled}\n persistentFocus={persistentFocus}\n returnFocus={returnFocus}\n shards={shards}\n onActivation={onActivation}\n onDeactivation={onDeactivation}\n >\n {children}\n </InternalFocusLock>\n </FocusLockShardContext>\n )\n}\n"],"mappings":";;;;;;;;;AAWA,MAAM,CAAC,uBAAuB,qBAAqBA,gBAAAA,cAEjD;CAAE,MAAM;CAAyB,QAAQ;AAAM,CAAC;AAIlD,MAAM,qBAAA,GAAA,oBAAA,cAAA,eAAA,CAAmCC,iBAAAA,OAAc;;;;;;AAsDvD,MAAa,aAAiC,EAC5C,WACA,UACA,YACA,UACA,eACA,iBACA,uBACA,iBACA,mBACI;CACJ,MAAM,CAAC,QAAQ,cAAA,GAAA,MAAA,SAAA,CAAqC,CAAC,CAAC;CACtD,MAAM,cAAc,gBAAgB,CAAC;CAErC,MAAM,iBAAA,GAAA,MAAA,YAAA,EAA6B,UAAuB;EACxD,WAAW,SAAU,KAAK,SAAS,KAAK,IAAI,OAAO,CAAC,GAAG,MAAM,KAAK,CAAE;EAEpE,aAAa;GACX,WAAW,SAAS,KAAK,QAAQ,SAAS,SAAS,KAAK,CAAC;EAC3D;CACF,GAAG,CAAC,CAAC;CAEL,MAAM,gBAAA,GAAA,MAAA,YAAA,OAAiC;EACrC,IAAI,iBAAiB,SACnB,gBAAgB,QAAQ,MAAM;OACzB,IAAI,YAAY,SACmB;QAAA,GAAA,oBAAA,cAAA,qBAAA,CAAA,WAAW,OAEtC,CAAC,CAAC,WAAW,GACxB,4BAA4B;IAC1B,WAAW,SAAS,MAAM;GAC5B,CAAC;EAAA;CAEP,GAAG,CAAC,iBAAiB,UAAU,CAAC;CAEhC,MAAM,kBAAA,GAAA,MAAA,YAAA,OAAmC;EACvC,eAAe,SAAS,MAAM;CAChC,GAAG,CAAC,aAAa,CAAC;CAElB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,uBAAD;EAAuB,OAAO;EAC5B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD;GACa;GACX,YAAY;GACF;GACO;GACJ;GACL;GACM;GACE;GAEf;EACgB,CAAA;CACE,CAAA;AAE3B"}
@@ -1,3 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_focus_lock = require("./focus-lock.cjs");
3
3
  exports.FocusLock = require_focus_lock.FocusLock;
4
+ exports.useFocusLockShard = require_focus_lock.useFocusLockShard;
@@ -2,16 +2,17 @@
2
2
  const require_children = require("../../utils/children.cjs");
3
3
  const require_utils_index = require("../../utils/index.cjs");
4
4
  const require_factory = require("../../core/system/factory.cjs");
5
+ const require_props = require("../../core/components/props.cjs");
5
6
  const require_create_component = require("../../core/components/create-component.cjs");
6
7
  const require_factory$1 = require("../motion/factory.cjs");
7
8
  const require_hooks_use_value_index = require("../../hooks/use-value/index.cjs");
9
+ const require_focus_lock = require("../focus-lock/focus-lock.cjs");
8
10
  const require_portal = require("../portal/portal.cjs");
9
11
  const require_popover = require("../popover/popover.cjs");
10
12
  const require_button = require("../button/button.cjs");
11
13
  const require_close_button = require("../close-button/close-button.cjs");
12
14
  const require_modal_style = require("./modal.style.cjs");
13
15
  const require_fade = require("../fade/fade.cjs");
14
- const require_focus_lock = require("../focus-lock/focus-lock.cjs");
15
16
  const require_use_modal = require("./use-modal.cjs");
16
17
  let react = require("react");
17
18
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -24,7 +25,7 @@ const { ComponentContext, PropsContext: ModalPropsContext, useComponentContext,
24
25
  *
25
26
  * @see https://yamada-ui.com/docs/components/modal
26
27
  */
27
- const ModalRoot = withProvider(({ allowPinchZoom = false, animationScheme = "scale", autoFocus, blockScrollOnMount = true, body, cancel, children, duration, finalFocusRef, footer, header, initialFocusRef, lockFocusAcrossFrames = true, middle, restoreFocus, success, title, trigger, withCloseButton = true, withOverlay = true, portalProps, onCancel, onCloseComplete, onMiddle, onSuccess, ...props }) => {
28
+ const ModalRoot = withProvider(({ allowPinchZoom = false, animationScheme = "scale", autoFocus, blockScrollOnMount = true, body, cancel, children, duration, finalFocusRef, footer, header, initialFocusRef, lockFocusAcrossFrames = true, middle, restoreFocus, success, title, trigger, withCloseButton = true, withOverlay = true, bodyProps, closeButtonProps, closeTriggerProps, contentProps, footerProps, headerProps, openTriggerProps, overlayProps, portalProps, titleProps, onCancel, onCloseComplete, onMiddle, onSuccess, ...props }) => {
28
29
  const [omittedChildren, openTrigger, customOverlay] = require_children.useSplitChildren(children, ModalOpenTrigger, ModalOverlay);
29
30
  const hasChildren = (0, require_utils_index.utils_exports.isArray)(omittedChildren) && !!omittedChildren.length;
30
31
  const { open, getRootProps, ...rest } = require_use_modal.useModal(props);
@@ -34,12 +35,30 @@ const ModalRoot = withProvider(({ allowPinchZoom = false, animationScheme = "sca
34
35
  duration,
35
36
  open,
36
37
  withCloseButton,
38
+ bodyProps,
39
+ closeButtonProps,
40
+ closeTriggerProps,
41
+ contentProps,
42
+ footerProps,
43
+ headerProps,
44
+ openTriggerProps,
45
+ overlayProps,
46
+ titleProps,
37
47
  ...rest
38
48
  }), [
39
49
  animationScheme,
40
50
  duration,
41
51
  open,
42
52
  withCloseButton,
53
+ contentProps,
54
+ bodyProps,
55
+ footerProps,
56
+ headerProps,
57
+ titleProps,
58
+ openTriggerProps,
59
+ closeTriggerProps,
60
+ closeButtonProps,
61
+ overlayProps,
43
62
  rest
44
63
  ]);
45
64
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ComponentContext, {
@@ -83,28 +102,28 @@ const ModalOpenTrigger = withContext("button", {
83
102
  name: "OpenTrigger",
84
103
  slot: ["trigger", "open"]
85
104
  })(void 0, (props) => {
86
- const { getOpenTriggerProps } = useComponentContext();
105
+ const { getOpenTriggerProps, openTriggerProps } = useComponentContext();
87
106
  return {
88
107
  asChild: true,
89
- ...getOpenTriggerProps(props)
108
+ ...getOpenTriggerProps(require_props.mergeProps(openTriggerProps, props)())
90
109
  };
91
110
  });
92
111
  const ModalCloseTrigger = withContext("button", {
93
112
  name: "CloseTrigger",
94
113
  slot: ["trigger", "close"]
95
114
  })(void 0, (props) => {
96
- const { getCloseTriggerProps } = useComponentContext();
115
+ const { closeTriggerProps, getCloseTriggerProps } = useComponentContext();
97
116
  return {
98
117
  asChild: true,
99
- ...getCloseTriggerProps(props)
118
+ ...getCloseTriggerProps(require_props.mergeProps(closeTriggerProps, props)())
100
119
  };
101
120
  });
102
121
  const ModalCloseButton = withContext(require_close_button.CloseButton, "closeButton")(void 0, (props) => {
103
- const { getCloseButtonProps } = useComponentContext();
104
- return { ...getCloseButtonProps(props) };
122
+ const { closeButtonProps, getCloseButtonProps } = useComponentContext();
123
+ return { ...getCloseButtonProps(require_props.mergeProps(closeButtonProps, props)()) };
105
124
  });
106
125
  const ModalOverlay = withContext((props) => {
107
- const { animationScheme, duration: durationProp, getOverlayProps } = useComponentContext();
126
+ const { animationScheme, duration: durationProp, getOverlayProps, overlayProps } = useComponentContext();
108
127
  const duration = require_hooks_use_value_index.useValue(durationProp);
109
128
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory$1.motion.div, {
110
129
  custom: { duration },
@@ -114,11 +133,11 @@ const ModalOverlay = withContext((props) => {
114
133
  initial: "exit",
115
134
  variants: require_fade.fadeVariants
116
135
  } : {},
117
- ...(0, require_utils_index.utils_exports.cast)(getOverlayProps((0, require_utils_index.utils_exports.cast)(props)))
136
+ ...(0, require_utils_index.utils_exports.cast)(getOverlayProps((0, require_utils_index.utils_exports.cast)(require_props.mergeProps(overlayProps, props)())))
118
137
  });
119
138
  }, "overlay")();
120
139
  const ModalContent = withContext(({ children, ...rest }) => {
121
- const { animationScheme, duration, withCloseButton, getContentProps } = useComponentContext();
140
+ const { animationScheme, duration, withCloseButton, contentProps, getContentProps } = useComponentContext();
122
141
  const [omittedChildren, customCloseButton] = require_children.useSplitChildren(children, ModalCloseButton);
123
142
  const popupAnimationProps = require_popover.usePopupAnimationProps({
124
143
  animationScheme,
@@ -126,7 +145,7 @@ const ModalContent = withContext(({ children, ...rest }) => {
126
145
  });
127
146
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_factory$1.motion.section, {
128
147
  ...popupAnimationProps,
129
- ...(0, require_utils_index.utils_exports.cast)(getContentProps((0, require_utils_index.utils_exports.cast)(rest))),
148
+ ...(0, require_utils_index.utils_exports.cast)(getContentProps((0, require_utils_index.utils_exports.cast)(require_props.mergeProps(contentProps, rest)()))),
130
149
  children: [customCloseButton ?? (withCloseButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModalCloseButton, {}) : null), omittedChildren]
131
150
  });
132
151
  }, "content")();
@@ -160,20 +179,20 @@ const ShorthandModalContent = ({ body, cancel, footer, header, middle, success,
160
179
  ] });
161
180
  };
162
181
  const ModalHeader = withContext("header", "header")(void 0, (props) => {
163
- const { getHeaderProps } = useComponentContext();
164
- return { ...getHeaderProps(props) };
182
+ const { getHeaderProps, headerProps } = useComponentContext();
183
+ return { ...getHeaderProps(require_props.mergeProps(headerProps, props)()) };
165
184
  });
166
185
  const ModalTitle = withContext("h2", "title")(void 0, (props) => {
167
- const { getTitleProps } = useComponentContext();
168
- return { ...getTitleProps(props) };
186
+ const { getTitleProps, titleProps } = useComponentContext();
187
+ return { ...getTitleProps(require_props.mergeProps(titleProps, props)()) };
169
188
  });
170
189
  const ModalBody = withContext("div", "body")(void 0, (props) => {
171
- const { getBodyProps } = useComponentContext();
172
- return { ...getBodyProps(props) };
190
+ const { bodyProps, getBodyProps } = useComponentContext();
191
+ return { ...getBodyProps(require_props.mergeProps(bodyProps, props)()) };
173
192
  });
174
193
  const ModalFooter = withContext("footer", "footer")(void 0, (props) => {
175
- const { getFooterProps } = useComponentContext();
176
- return { ...getFooterProps(props) };
194
+ const { footerProps, getFooterProps } = useComponentContext();
195
+ return { ...getFooterProps(require_props.mergeProps(footerProps, props)()) };
177
196
  });
178
197
  //#endregion
179
198
  exports.ModalBody = ModalBody;
@@ -187,7 +206,6 @@ exports.ModalOverlay = ModalOverlay;
187
206
  exports.ModalPropsContext = ModalPropsContext;
188
207
  exports.ModalRoot = ModalRoot;
189
208
  exports.ModalTitle = ModalTitle;
190
- exports.ShorthandModalContent = ShorthandModalContent;
191
209
  exports.useModalPropsContext = useModalPropsContext;
192
210
 
193
211
  //# sourceMappingURL=modal.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"modal.cjs","names":["createSlotComponent","modalStyle","useSplitChildren","useModal","AnimatePresence","Portal","FocusLock","RemoveScroll","styled","CloseButton","useValue","motion","fadeVariants","usePopupAnimationProps","wrapOrPassProps","Button"],"sources":["../../../../src/components/modal/modal.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ButtonProps } from \"../button\"\nimport type { CloseButtonProps } from \"../close-button\"\nimport type { FocusLockProps } from \"../focus-lock\"\nimport type { HTMLMotionProps, HTMLMotionPropsWithoutAs } from \"../motion\"\nimport type { UsePopupAnimationProps } from \"../popover\"\nimport type { PortalProps } from \"../portal\"\nimport type { ModalStyle } from \"./modal.style\"\nimport type { UseModalProps, UseModalReturn } from \"./use-modal\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { RemoveScroll } from \"react-remove-scroll\"\nimport { createSlotComponent, styled } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { cast, isArray, useSplitChildren, wrapOrPassProps } from \"../../utils\"\nimport { Button } from \"../button\"\nimport { CloseButton } from \"../close-button\"\nimport { fadeVariants } from \"../fade\"\nimport { FocusLock } from \"../focus-lock\"\nimport { motion } from \"../motion\"\nimport { usePopupAnimationProps } from \"../popover\"\nimport { Portal } from \"../portal\"\nimport { modalStyle } from \"./modal.style\"\nimport { useModal } from \"./use-modal\"\n\ninterface ComponentContext\n extends\n Omit<UseModalReturn, \"getRootProps\">,\n UsePopupAnimationProps,\n Pick<ModalRootProps, \"withCloseButton\"> {}\n\nexport interface ModalRootProps\n extends\n Omit<HTMLStyledProps<\"div\">, \"scrollBehavior\" | \"title\">,\n ThemeProps<ModalStyle>,\n Omit<UseModalProps, \"title\">,\n Pick<\n FocusLockProps,\n | \"autoFocus\"\n | \"finalFocusRef\"\n | \"initialFocusRef\"\n | \"lockFocusAcrossFrames\"\n | \"restoreFocus\"\n >,\n UsePopupAnimationProps,\n ShorthandModalContentProps {\n /**\n * Handle zoom or pinch gestures on iOS devices when scroll locking is enabled.\n *\n * @default false.\n */\n allowPinchZoom?: boolean\n /**\n * If `true`, scrolling will be disabled on the `body` when the modal opens.\n *\n * @default true\n */\n blockScrollOnMount?: boolean\n /**\n * The modal trigger to use.\n */\n trigger?: ReactNode\n /**\n * If `true`, display the modal close button.\n *\n * @default true\n */\n withCloseButton?: boolean\n /**\n * If `true`, display the modal overlay.\n *\n * @default true\n */\n withOverlay?: boolean\n /**\n * Props to be forwarded to the portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n /**\n * Callback function to run side effects after the modal has closed.\n */\n onCloseComplete?: () => void\n}\n\nconst {\n ComponentContext,\n PropsContext: ModalPropsContext,\n useComponentContext,\n usePropsContext: useModalPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ModalRootProps, ModalStyle, ComponentContext>(\n \"modal\",\n modalStyle,\n)\n\nexport { ModalPropsContext, useModalPropsContext }\n\n/**\n * `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information.\n *\n * @see https://yamada-ui.com/docs/components/modal\n */\nexport const ModalRoot = withProvider<\"div\", ModalRootProps>(\n ({\n allowPinchZoom = false,\n animationScheme = \"scale\",\n autoFocus,\n blockScrollOnMount = true,\n body,\n cancel,\n children,\n duration,\n finalFocusRef,\n footer,\n header,\n initialFocusRef,\n lockFocusAcrossFrames = true,\n middle,\n restoreFocus,\n success,\n title,\n trigger,\n withCloseButton = true,\n withOverlay = true,\n portalProps,\n onCancel,\n onCloseComplete,\n onMiddle,\n onSuccess,\n ...props\n }) => {\n const [omittedChildren, openTrigger, customOverlay] = useSplitChildren(\n children,\n ModalOpenTrigger,\n ModalOverlay,\n )\n const hasChildren = isArray(omittedChildren) && !!omittedChildren.length\n const { open, getRootProps, ...rest } = useModal(props)\n const customOpenTrigger = trigger ? (\n <ModalOpenTrigger>{trigger}</ModalOpenTrigger>\n ) : null\n const context = useMemo(\n () => ({\n animationScheme,\n duration,\n open,\n withCloseButton,\n ...rest,\n }),\n [animationScheme, duration, open, withCloseButton, rest],\n )\n\n return (\n <ComponentContext value={context}>\n {openTrigger ?? customOpenTrigger}\n\n <AnimatePresence onExitComplete={onCloseComplete}>\n {open ? (\n <Portal {...portalProps}>\n <FocusLock\n autoFocus={autoFocus}\n finalFocusRef={finalFocusRef}\n initialFocusRef={initialFocusRef}\n lockFocusAcrossFrames={lockFocusAcrossFrames}\n restoreFocus={restoreFocus}\n >\n <RemoveScroll\n allowPinchZoom={allowPinchZoom}\n enabled={blockScrollOnMount}\n forwardProps\n >\n <styled.div {...getRootProps()}>\n {customOverlay ?? (withOverlay ? <ModalOverlay /> : null)}\n\n {hasChildren ? (\n omittedChildren\n ) : (\n <ShorthandModalContent\n body={body}\n cancel={cancel}\n footer={footer}\n header={header}\n middle={middle}\n success={success}\n title={title}\n onCancel={onCancel}\n onMiddle={onMiddle}\n onSuccess={onSuccess}\n />\n )}\n </styled.div>\n </RemoveScroll>\n </FocusLock>\n </Portal>\n ) : null}\n </AnimatePresence>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface ModalOpenTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ModalOpenTrigger = withContext<\"button\", ModalOpenTriggerProps>(\n \"button\",\n { name: \"OpenTrigger\", slot: [\"trigger\", \"open\"] },\n)(undefined, (props) => {\n const { getOpenTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getOpenTriggerProps(props) }\n})\n\nexport interface ModalCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ModalCloseTrigger = withContext<\"button\", ModalCloseTriggerProps>(\n \"button\",\n { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] },\n)(undefined, (props) => {\n const { getCloseTriggerProps } = useComponentContext()\n\n return { asChild: true, ...getCloseTriggerProps(props) }\n})\n\nexport interface ModalCloseButtonProps extends CloseButtonProps {}\n\nexport const ModalCloseButton = withContext<\"button\", ModalCloseButtonProps>(\n CloseButton,\n \"closeButton\",\n)(undefined, (props) => {\n const { getCloseButtonProps } = useComponentContext()\n\n return { ...getCloseButtonProps(props) }\n})\n\nexport interface ModalOverlayProps extends HTMLMotionProps {}\n\nexport const ModalOverlay = withContext<\"div\", ModalOverlayProps>((props) => {\n const {\n animationScheme,\n duration: durationProp,\n getOverlayProps,\n } = useComponentContext()\n const duration = useValue(durationProp)\n\n return (\n <motion.div\n custom={{ duration }}\n {...(animationScheme !== \"none\"\n ? {\n animate: \"enter\",\n exit: \"exit\",\n initial: \"exit\",\n variants: fadeVariants,\n }\n : {})}\n {...cast<HTMLMotionProps>(getOverlayProps(cast<HTMLProps>(props)))}\n />\n )\n}, \"overlay\")()\n\nexport interface ModalContentProps\n extends Omit<HTMLMotionProps<\"section\">, \"children\">, PropsWithChildren {}\n\nexport const ModalContent = withContext<\"section\", ModalContentProps>(\n ({ children, ...rest }) => {\n const { animationScheme, duration, withCloseButton, getContentProps } =\n useComponentContext()\n const [omittedChildren, customCloseButton] = useSplitChildren(\n children,\n ModalCloseButton,\n )\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n\n return (\n <motion.section\n {...popupAnimationProps}\n {...cast<HTMLMotionPropsWithoutAs<\"section\">>(\n getContentProps(cast<HTMLProps<\"section\">>(rest)),\n )}\n >\n {customCloseButton ?? (withCloseButton ? <ModalCloseButton /> : null)}\n\n {omittedChildren}\n </motion.section>\n )\n },\n \"content\",\n)()\n\ninterface ShorthandModalContentProps {\n /**\n * The modal body to use.\n */\n body?: ModalBodyProps | ReactNode\n /**\n * The modal cancel button to use.\n */\n cancel?: ButtonProps | ReactNode\n /**\n * The modal footer to use.\n */\n footer?: ModalFooterProps | ReactNode\n /**\n * The modal header to use.\n */\n header?: ModalHeaderProps | ReactNode\n /**\n * The modal middle button to use.\n */\n middle?: ButtonProps | ReactNode\n /**\n * The modal success button to use.\n */\n success?: ButtonProps | ReactNode\n /**\n * The modal title to use.\n */\n title?: ModalTitleProps | ReactNode\n /**\n * The callback invoked when cancel button clicked.\n */\n onCancel?: (onClose: () => void) => void\n /**\n * The callback invoked when middle button clicked.\n */\n onMiddle?: (onClose: () => void) => void\n /**\n * The callback invoked when success button clicked.\n */\n onSuccess?: (onClose: () => void) => void\n}\n\nexport const ShorthandModalContent: FC<ShorthandModalContentProps> = ({\n body,\n cancel,\n footer,\n header,\n middle,\n success,\n title,\n onCancel,\n onMiddle,\n onSuccess,\n}) => {\n const { onClose } = useComponentContext()\n const customHeader = wrapOrPassProps(ModalHeader, header)\n const customTitle = wrapOrPassProps(ModalTitle, title)\n const customBody = wrapOrPassProps(ModalBody, body)\n const customFooter = wrapOrPassProps(ModalFooter, footer)\n const customCancel = wrapOrPassProps(Button, cancel, {\n colorScheme: \"mono\",\n variant: \"ghost\",\n onClick: () => (onCancel ? onCancel(onClose) : onClose()),\n })\n const customMiddle = wrapOrPassProps(Button, middle, {\n colorScheme: \"secondary\",\n onClick: () => (onMiddle ? onMiddle(onClose) : onClose()),\n })\n const customSuccess = wrapOrPassProps(Button, success, {\n colorScheme: \"primary\",\n onClick: () => (onSuccess ? onSuccess(onClose) : onClose()),\n })\n\n return (\n <ModalContent>\n {customHeader ??\n (customTitle ? <ModalHeader>{customTitle}</ModalHeader> : null)}\n {customBody}\n {customFooter ??\n (customCancel || customMiddle || customSuccess ? (\n <ModalFooter>\n {customCancel}\n {customMiddle}\n {customSuccess}\n </ModalFooter>\n ) : null)}\n </ModalContent>\n )\n}\n\nexport interface ModalHeaderProps extends HTMLStyledProps<\"header\"> {}\n\nexport const ModalHeader = withContext<\"header\", ModalHeaderProps>(\n \"header\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps } = useComponentContext()\n\n return { ...getHeaderProps(props) }\n})\n\nexport interface ModalTitleProps extends HTMLStyledProps<\"h2\"> {}\n\nexport const ModalTitle = withContext<\"h2\", ModalTitleProps>(\"h2\", \"title\")(\n undefined,\n (props) => {\n const { getTitleProps } = useComponentContext()\n\n return { ...getTitleProps(props) }\n },\n)\n\nexport interface ModalBodyProps extends HTMLStyledProps {}\n\nexport const ModalBody = withContext<\"div\", ModalBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { getBodyProps } = useComponentContext()\n\n return { ...getBodyProps(props) }\n },\n)\n\nexport interface ModalFooterProps extends HTMLStyledProps<\"footer\"> {}\n\nexport const ModalFooter = withContext<\"footer\", ModalFooterProps>(\n \"footer\",\n \"footer\",\n)(undefined, (props) => {\n const { getFooterProps } = useComponentContext()\n\n return { ...getFooterProps(props) }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuFA,MAAM,EACJ,kBACA,cAAc,mBACd,qBACA,iBAAiB,sBACjB,aACA,iBACEA,yBAAAA,oBACF,SACAC,oBAAAA,UACF;;;;;;AASA,MAAa,YAAY,cACtB,EACC,iBAAiB,OACjB,kBAAkB,SAClB,WACA,qBAAqB,MACrB,MACA,QACA,UACA,UACA,eACA,QACA,QACA,iBACA,wBAAwB,MACxB,QACA,cACA,SACA,OACA,SACA,kBAAkB,MAClB,cAAc,MACd,aACA,UACA,iBACA,UACA,WACA,GAAG,YACC;CACJ,MAAM,CAAC,iBAAiB,aAAa,iBAAiBC,iBAAAA,iBACpD,UACA,kBACA,YACF;CACA,MAAM,eAAA,GAAA,oBAAA,cAAA,QAAA,CAAsB,eAAe,KAAK,CAAC,CAAC,gBAAgB;CAClE,MAAM,EAAE,MAAM,cAAc,GAAG,SAASC,kBAAAA,SAAS,KAAK;CACtD,MAAM,oBAAoB,UACxB,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD,EAAA,UAAmB,QAA0B,CAAA,IAC3C;CACJ,MAAM,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ACC,UAAU;CACT,MAAM,EAAE,kBAAkB,oBAAoB;CAE9C,OAAO,EAAE,GAAG,cAAc,KAAK,EAAE;AACnC,CACF;AAIA,MAAa,YAAY,YAAmC,OAAO,MAAM,CAAC,CACxE,KAAA,IACC,UAAU;CACT,MAAM,EAAE,iBAAiB,oBAAoB;CAE7C,OAAO,EAAE,GAAG,aAAa,KAAK,EAAE;AAClC,CACF;AAIA,MAAa,cAAc,YACzB,UACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,oBAAoB;CAE/C,OAAO,EAAE,GAAG,eAAe,KAAK,EAAE;AACpC,CAAC"}
1
+ {"version":3,"file":"modal.cjs","names":["createSlotComponent","modalStyle","useSplitChildren","useModal","AnimatePresence","Portal","FocusLock","RemoveScroll","styled","mergeProps","CloseButton","useValue","motion","fadeVariants","usePopupAnimationProps","wrapOrPassProps","Button"],"sources":["../../../../src/components/modal/modal.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } from \"react\"\nimport type { HTMLProps, HTMLStyledProps, ThemeProps } from \"../../core\"\nimport type { ButtonProps } from \"../button\"\nimport type { CloseButtonProps } from \"../close-button\"\nimport type { FocusLockProps } from \"../focus-lock\"\nimport type { HTMLMotionProps, HTMLMotionPropsWithoutAs } from \"../motion\"\nimport type { UsePopupAnimationProps } from \"../popover\"\nimport type { PortalProps } from \"../portal\"\nimport type { ModalStyle } from \"./modal.style\"\nimport type { UseModalProps, UseModalReturn } from \"./use-modal\"\nimport { AnimatePresence } from \"motion/react\"\nimport { useMemo } from \"react\"\nimport { RemoveScroll } from \"react-remove-scroll\"\nimport { createSlotComponent, mergeProps, styled } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport { cast, isArray, useSplitChildren, wrapOrPassProps } from \"../../utils\"\nimport { Button } from \"../button\"\nimport { CloseButton } from \"../close-button\"\nimport { fadeVariants } from \"../fade\"\nimport { FocusLock } from \"../focus-lock\"\nimport { motion } from \"../motion\"\nimport { usePopupAnimationProps } from \"../popover\"\nimport { Portal } from \"../portal\"\nimport { modalStyle } from \"./modal.style\"\nimport { useModal } from \"./use-modal\"\n\ninterface ComponentContext\n extends\n Omit<UseModalReturn, \"getRootProps\">,\n UsePopupAnimationProps,\n Pick<\n ModalRootProps,\n | \"bodyProps\"\n | \"closeButtonProps\"\n | \"closeTriggerProps\"\n | \"contentProps\"\n | \"footerProps\"\n | \"headerProps\"\n | \"openTriggerProps\"\n | \"overlayProps\"\n | \"titleProps\"\n | \"withCloseButton\"\n > {}\n\nexport interface ModalRootProps\n extends\n Omit<HTMLStyledProps<\"div\">, \"scrollBehavior\" | \"title\">,\n ThemeProps<ModalStyle>,\n Omit<UseModalProps, \"title\">,\n Pick<\n FocusLockProps,\n | \"autoFocus\"\n | \"finalFocusRef\"\n | \"initialFocusRef\"\n | \"lockFocusAcrossFrames\"\n | \"restoreFocus\"\n >,\n UsePopupAnimationProps,\n ShorthandModalContentProps {\n /**\n * Handle zoom or pinch gestures on iOS devices when scroll locking is enabled.\n *\n * @default false.\n */\n allowPinchZoom?: boolean\n /**\n * If `true`, scrolling will be disabled on the `body` when the modal opens.\n *\n * @default true\n */\n blockScrollOnMount?: boolean\n /**\n * The modal trigger to use.\n */\n trigger?: ReactNode\n /**\n * If `true`, display the modal close button.\n *\n * @default true\n */\n withCloseButton?: boolean\n /**\n * If `true`, display the modal overlay.\n *\n * @default true\n */\n withOverlay?: boolean\n /**\n * Props for body element.\n */\n bodyProps?: Omit<ModalBodyProps, \"children\">\n /**\n * Props for close button element.\n */\n closeButtonProps?: Omit<ModalCloseButtonProps, \"children\">\n /**\n * Props for close trigger element.\n */\n closeTriggerProps?: Omit<ModalCloseTriggerProps, \"asChild\" | \"children\">\n /**\n * Props for content element.\n */\n contentProps?: Omit<ModalContentProps, \"children\">\n /**\n * Props for footer element.\n */\n footerProps?: Omit<ModalFooterProps, \"children\">\n /**\n * Props for header element.\n */\n headerProps?: Omit<ModalHeaderProps, \"children\">\n /**\n * Props for open trigger element.\n */\n openTriggerProps?: Omit<ModalOpenTriggerProps, \"asChild\" | \"children\">\n /**\n * Props for overlay element.\n */\n overlayProps?: Omit<ModalOverlayProps, \"children\">\n /**\n * Props to be forwarded to the portal component.\n */\n portalProps?: Omit<PortalProps, \"children\">\n /**\n * Props for title element.\n */\n titleProps?: Omit<ModalTitleProps, \"children\">\n /**\n * Callback function to run side effects after the modal has closed.\n */\n onCloseComplete?: () => void\n}\n\nconst {\n ComponentContext,\n PropsContext: ModalPropsContext,\n useComponentContext,\n usePropsContext: useModalPropsContext,\n withContext,\n withProvider,\n} = createSlotComponent<ModalRootProps, ModalStyle, ComponentContext>(\n \"modal\",\n modalStyle,\n)\n\nexport { ModalPropsContext, useModalPropsContext }\n\n/**\n * `Modal` is a component that is displayed over the main content to focus the user's attention solely on the information.\n *\n * @see https://yamada-ui.com/docs/components/modal\n */\nexport const ModalRoot = withProvider<\"div\", ModalRootProps>(\n ({\n allowPinchZoom = false,\n animationScheme = \"scale\",\n autoFocus,\n blockScrollOnMount = true,\n body,\n cancel,\n children,\n duration,\n finalFocusRef,\n footer,\n header,\n initialFocusRef,\n lockFocusAcrossFrames = true,\n middle,\n restoreFocus,\n success,\n title,\n trigger,\n withCloseButton = true,\n withOverlay = true,\n bodyProps,\n closeButtonProps,\n closeTriggerProps,\n contentProps,\n footerProps,\n headerProps,\n openTriggerProps,\n overlayProps,\n portalProps,\n titleProps,\n onCancel,\n onCloseComplete,\n onMiddle,\n onSuccess,\n ...props\n }) => {\n const [omittedChildren, openTrigger, customOverlay] = useSplitChildren(\n children,\n ModalOpenTrigger,\n ModalOverlay,\n )\n const hasChildren = isArray(omittedChildren) && !!omittedChildren.length\n const { open, getRootProps, ...rest } = useModal(props)\n const customOpenTrigger = trigger ? (\n <ModalOpenTrigger>{trigger}</ModalOpenTrigger>\n ) : null\n const context = useMemo(\n () => ({\n animationScheme,\n duration,\n open,\n withCloseButton,\n bodyProps,\n closeButtonProps,\n closeTriggerProps,\n contentProps,\n footerProps,\n headerProps,\n openTriggerProps,\n overlayProps,\n titleProps,\n ...rest,\n }),\n [\n animationScheme,\n duration,\n open,\n withCloseButton,\n contentProps,\n bodyProps,\n footerProps,\n headerProps,\n titleProps,\n openTriggerProps,\n closeTriggerProps,\n closeButtonProps,\n overlayProps,\n rest,\n ],\n )\n\n return (\n <ComponentContext value={context}>\n {openTrigger ?? customOpenTrigger}\n\n <AnimatePresence onExitComplete={onCloseComplete}>\n {open ? (\n <Portal {...portalProps}>\n <FocusLock\n autoFocus={autoFocus}\n finalFocusRef={finalFocusRef}\n initialFocusRef={initialFocusRef}\n lockFocusAcrossFrames={lockFocusAcrossFrames}\n restoreFocus={restoreFocus}\n >\n <RemoveScroll\n allowPinchZoom={allowPinchZoom}\n enabled={blockScrollOnMount}\n forwardProps\n >\n <styled.div {...getRootProps()}>\n {customOverlay ?? (withOverlay ? <ModalOverlay /> : null)}\n\n {hasChildren ? (\n omittedChildren\n ) : (\n <ShorthandModalContent\n body={body}\n cancel={cancel}\n footer={footer}\n header={header}\n middle={middle}\n success={success}\n title={title}\n onCancel={onCancel}\n onMiddle={onMiddle}\n onSuccess={onSuccess}\n />\n )}\n </styled.div>\n </RemoveScroll>\n </FocusLock>\n </Portal>\n ) : null}\n </AnimatePresence>\n </ComponentContext>\n )\n },\n \"root\",\n)()\n\nexport interface ModalOpenTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ModalOpenTrigger = withContext<\"button\", ModalOpenTriggerProps>(\n \"button\",\n { name: \"OpenTrigger\", slot: [\"trigger\", \"open\"] },\n)(undefined, (props) => {\n const { getOpenTriggerProps, openTriggerProps } = useComponentContext()\n\n return {\n asChild: true,\n ...getOpenTriggerProps(mergeProps(openTriggerProps, props)()),\n }\n})\n\nexport interface ModalCloseTriggerProps extends HTMLStyledProps<\"button\"> {}\n\nexport const ModalCloseTrigger = withContext<\"button\", ModalCloseTriggerProps>(\n \"button\",\n { name: \"CloseTrigger\", slot: [\"trigger\", \"close\"] },\n)(undefined, (props) => {\n const { closeTriggerProps, getCloseTriggerProps } = useComponentContext()\n\n return {\n asChild: true,\n ...getCloseTriggerProps(mergeProps(closeTriggerProps, props)()),\n }\n})\n\nexport interface ModalCloseButtonProps extends CloseButtonProps {}\n\nexport const ModalCloseButton = withContext<\"button\", ModalCloseButtonProps>(\n CloseButton,\n \"closeButton\",\n)(undefined, (props) => {\n const { closeButtonProps, getCloseButtonProps } = useComponentContext()\n\n return { ...getCloseButtonProps(mergeProps(closeButtonProps, props)()) }\n})\n\nexport interface ModalOverlayProps extends HTMLMotionProps {}\n\nexport const ModalOverlay = withContext<\"div\", ModalOverlayProps>((props) => {\n const {\n animationScheme,\n duration: durationProp,\n getOverlayProps,\n overlayProps,\n } = useComponentContext()\n const duration = useValue(durationProp)\n\n return (\n <motion.div\n custom={{ duration }}\n {...(animationScheme !== \"none\"\n ? {\n animate: \"enter\",\n exit: \"exit\",\n initial: \"exit\",\n variants: fadeVariants,\n }\n : {})}\n {...cast<HTMLMotionProps>(\n getOverlayProps(cast<HTMLProps>(mergeProps(overlayProps, props)())),\n )}\n />\n )\n}, \"overlay\")()\n\nexport interface ModalContentProps\n extends Omit<HTMLMotionProps<\"section\">, \"children\">, PropsWithChildren {}\n\nexport const ModalContent = withContext<\"section\", ModalContentProps>(\n ({ children, ...rest }) => {\n const {\n animationScheme,\n duration,\n withCloseButton,\n contentProps,\n getContentProps,\n } = useComponentContext()\n const [omittedChildren, customCloseButton] = useSplitChildren(\n children,\n ModalCloseButton,\n )\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n\n return (\n <motion.section\n {...popupAnimationProps}\n {...cast<HTMLMotionPropsWithoutAs<\"section\">>(\n getContentProps(\n cast<HTMLProps<\"section\">>(mergeProps(contentProps, rest)()),\n ),\n )}\n >\n {customCloseButton ?? (withCloseButton ? <ModalCloseButton /> : null)}\n\n {omittedChildren}\n </motion.section>\n )\n },\n \"content\",\n)()\n\ninterface ShorthandModalContentProps {\n /**\n * The modal body to use.\n */\n body?: ModalBodyProps | ReactNode\n /**\n * The modal cancel button to use.\n */\n cancel?: ButtonProps | ReactNode\n /**\n * The modal footer to use.\n */\n footer?: ModalFooterProps | ReactNode\n /**\n * The modal header to use.\n */\n header?: ModalHeaderProps | ReactNode\n /**\n * The modal middle button to use.\n */\n middle?: ButtonProps | ReactNode\n /**\n * The modal success button to use.\n */\n success?: ButtonProps | ReactNode\n /**\n * The modal title to use.\n */\n title?: ModalTitleProps | ReactNode\n /**\n * The callback invoked when cancel button clicked.\n */\n onCancel?: (onClose: () => void) => void\n /**\n * The callback invoked when middle button clicked.\n */\n onMiddle?: (onClose: () => void) => void\n /**\n * The callback invoked when success button clicked.\n */\n onSuccess?: (onClose: () => void) => void\n}\n\nconst ShorthandModalContent: FC<ShorthandModalContentProps> = ({\n body,\n cancel,\n footer,\n header,\n middle,\n success,\n title,\n onCancel,\n onMiddle,\n onSuccess,\n}) => {\n const { onClose } = useComponentContext()\n const customHeader = wrapOrPassProps(ModalHeader, header)\n const customTitle = wrapOrPassProps(ModalTitle, title)\n const customBody = wrapOrPassProps(ModalBody, body)\n const customFooter = wrapOrPassProps(ModalFooter, footer)\n const customCancel = wrapOrPassProps(Button, cancel, {\n colorScheme: \"mono\",\n variant: \"ghost\",\n onClick: () => (onCancel ? onCancel(onClose) : onClose()),\n })\n const customMiddle = wrapOrPassProps(Button, middle, {\n colorScheme: \"secondary\",\n onClick: () => (onMiddle ? onMiddle(onClose) : onClose()),\n })\n const customSuccess = wrapOrPassProps(Button, success, {\n colorScheme: \"primary\",\n onClick: () => (onSuccess ? onSuccess(onClose) : onClose()),\n })\n\n return (\n <ModalContent>\n {customHeader ??\n (customTitle ? <ModalHeader>{customTitle}</ModalHeader> : null)}\n {customBody}\n {customFooter ??\n (customCancel || customMiddle || customSuccess ? (\n <ModalFooter>\n {customCancel}\n {customMiddle}\n {customSuccess}\n </ModalFooter>\n ) : null)}\n </ModalContent>\n )\n}\n\nexport interface ModalHeaderProps extends HTMLStyledProps<\"header\"> {}\n\nexport const ModalHeader = withContext<\"header\", ModalHeaderProps>(\n \"header\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps, headerProps } = useComponentContext()\n\n return { ...getHeaderProps(mergeProps(headerProps, props)()) }\n})\n\nexport interface ModalTitleProps extends HTMLStyledProps<\"h2\"> {}\n\nexport const ModalTitle = withContext<\"h2\", ModalTitleProps>(\"h2\", \"title\")(\n undefined,\n (props) => {\n const { getTitleProps, titleProps } = useComponentContext()\n\n return { ...getTitleProps(mergeProps(titleProps, props)()) }\n },\n)\n\nexport interface ModalBodyProps extends HTMLStyledProps {}\n\nexport const ModalBody = withContext<\"div\", ModalBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { bodyProps, getBodyProps } = useComponentContext()\n\n return { ...getBodyProps(mergeProps(bodyProps, props)()) }\n },\n)\n\nexport interface ModalFooterProps extends HTMLStyledProps<\"footer\"> {}\n\nexport const ModalFooter = withContext<\"footer\", ModalFooterProps>(\n \"footer\",\n \"footer\",\n)(undefined, (props) => {\n const { footerProps, getFooterProps } = useComponentContext()\n\n return { ...getFooterProps(mergeProps(footerProps, props)()) }\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuIA,MAAM,EACJ,kBACA,cAAc,mBACd,qBACA,iBAAiB,sBACjB,aACA,iBACEA,yBAAAA,oBACF,SACAC,oBAAAA,UACF;;;;;;AASA,MAAa,YAAY,cACtB,EACC,iBAAiB,OACjB,kBAAkB,SAClB,WACA,qBAAqB,MACrB,MACA,QACA,UACA,UACA,eACA,QACA,QACA,iBACA,wBAAwB,MACxB,QACA,cACA,SACA,OACA,SACA,kBAAkB,MAClB,cAAc,MACd,WACA,kBACA,mBACA,cACA,aACA,aACA,kBACA,cACA,aACA,YACA,UACA,iBACA,UACA,WACA,GAAG,YACC;CACJ,MAAM,CAAC,iBAAiB,aAAa,iBAAiBC,iBAAAA,iBACpD,UACA,kBACA,YACF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YAAY,UAAU,OAAO,IAAI,QAAQ;CAC3D,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,cAAD,EAAA,UAAA;EACG,iBACE,cAAc,iBAAA,GAAA,kBAAA,IAAA,CAAC,aAAD,EAAA,UAAc,YAAyB,CAAA,IAAI;EAC3D;EACA,iBACE,gBAAgB,gBAAgB,gBAC/B,iBAAA,GAAA,kBAAA,KAAA,CAAC,aAAD,EAAA,UAAA;GACG;GACA;GACA;EACU,EAAA,CAAA,IACX;CACM,EAAA,CAAA;AAElB;AAIA,MAAa,cAAc,YACzB,UACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,gBAAgB,gBAAgB,oBAAoB;CAE5D,OAAO,EAAE,GAAG,eAAeP,cAAAA,WAAW,aAAa,KAAK,CAAC,CAAC,CAAC,EAAE;AAC/D,CAAC;AAID,MAAa,aAAa,YAAmC,MAAM,OAAO,CAAC,CACzE,KAAA,IACC,UAAU;CACT,MAAM,EAAE,eAAe,eAAe,oBAAoB;CAE1D,OAAO,EAAE,GAAG,cAAcA,cAAAA,WAAW,YAAY,KAAK,CAAC,CAAC,CAAC,EAAE;AAC7D,CACF;AAIA,MAAa,YAAY,YAAmC,OAAO,MAAM,CAAC,CACxE,KAAA,IACC,UAAU;CACT,MAAM,EAAE,WAAW,iBAAiB,oBAAoB;CAExD,OAAO,EAAE,GAAG,aAAaA,cAAAA,WAAW,WAAW,KAAK,CAAC,CAAC,CAAC,EAAE;AAC3D,CACF;AAIA,MAAa,cAAc,YACzB,UACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,aAAa,mBAAmB,oBAAoB;CAE5D,OAAO,EAAE,GAAG,eAAeA,cAAAA,WAAW,aAAa,KAAK,CAAC,CAAC,CAAC,EAAE;AAC/D,CAAC"}
@@ -1,5 +1,7 @@
1
1
  "use client";
2
+ const require_children = require("../../utils/children.cjs");
2
3
  const require_utils_index = require("../../utils/index.cjs");
4
+ const require_props = require("../../core/components/props.cjs");
3
5
  const require_create_component = require("../../core/components/create-component.cjs");
4
6
  const require_factory = require("../motion/factory.cjs");
5
7
  const require_hooks_use_value_index = require("../../hooks/use-value/index.cjs");
@@ -97,15 +99,21 @@ const { ComponentContext, PropsContext: PopoverPropsContext, StyleContext, useCo
97
99
  */
98
100
  const PopoverRoot = (props) => {
99
101
  const styleProps = usePopoverStyleProps(props);
100
- const [styleContext, { animationScheme, children, duration, ...rest }] = useRootComponentProps({
102
+ const [styleContext, { anchor: anchorProp, animationScheme, body, children, duration, footer, header, trigger: triggerProp, anchorProps, bodyProps, closeTriggerProps, contentProps, footerProps, headerProps, triggerProps, ...rest }] = useRootComponentProps({
101
103
  ...props,
102
104
  ...styleProps
103
105
  });
106
+ const [omittedChildren, trigger, anchor, customContent] = require_children.useSplitChildren((0, require_utils_index.utils_exports.isFunction)(children) ? void 0 : children, PopoverTrigger, PopoverAnchor, PopoverContent);
104
107
  const { open, getAnchorProps, getBodyProps, getCloseTriggerProps, getContentProps, getFooterProps, getHeaderProps, getPositionerProps, getTriggerProps, onClose } = require_use_popover.usePopover(rest);
105
108
  const componentContext = (0, react.useMemo)(() => ({
106
109
  animationScheme,
107
110
  duration,
108
111
  open,
112
+ anchorProps,
113
+ bodyProps,
114
+ closeTriggerProps,
115
+ contentProps,
116
+ footerProps,
109
117
  getAnchorProps,
110
118
  getBodyProps,
111
119
  getCloseTriggerProps,
@@ -113,11 +121,19 @@ const PopoverRoot = (props) => {
113
121
  getFooterProps,
114
122
  getHeaderProps,
115
123
  getPositionerProps,
116
- getTriggerProps
124
+ getTriggerProps,
125
+ headerProps,
126
+ triggerProps
117
127
  }), [
118
128
  open,
119
129
  animationScheme,
130
+ anchorProps,
131
+ bodyProps,
132
+ closeTriggerProps,
133
+ contentProps,
120
134
  duration,
135
+ footerProps,
136
+ headerProps,
121
137
  getAnchorProps,
122
138
  getBodyProps,
123
139
  getCloseTriggerProps,
@@ -125,66 +141,89 @@ const PopoverRoot = (props) => {
125
141
  getFooterProps,
126
142
  getHeaderProps,
127
143
  getPositionerProps,
128
- getTriggerProps
144
+ getTriggerProps,
145
+ triggerProps
129
146
  ]);
147
+ const customAnchor = anchorProp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopoverAnchor, { children: anchorProp }) : null;
148
+ const customTrigger = triggerProp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopoverTrigger, { children: triggerProp }) : null;
149
+ const customContentProp = header !== void 0 || body !== void 0 || footer !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ShorthandPopoverContent, {
150
+ body,
151
+ footer,
152
+ header
153
+ }) : null;
130
154
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyleContext, {
131
155
  value: styleContext,
132
156
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContext, {
133
157
  value: componentContext,
134
- children: (0, require_utils_index.utils_exports.runIfFn)(children, {
158
+ children: (0, require_utils_index.utils_exports.isFunction)(children) ? (0, require_utils_index.utils_exports.runIfFn)(children, {
135
159
  open,
136
160
  onClose
137
- })
161
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
162
+ anchor ?? customAnchor,
163
+ trigger ?? customTrigger,
164
+ omittedChildren,
165
+ customContent ?? customContentProp
166
+ ] })
138
167
  })
139
168
  });
140
169
  };
141
170
  const PopoverTrigger = withContext("button", "trigger")({ asChild: true }, (props) => {
142
- const { getTriggerProps } = useComponentContext();
143
- return getTriggerProps(props);
171
+ const { getTriggerProps, triggerProps } = useComponentContext();
172
+ return getTriggerProps(require_props.mergeProps(triggerProps, props)());
144
173
  });
145
174
  const PopoverCloseTrigger = withContext("button", {
146
175
  name: "CloseTrigger",
147
176
  slot: ["trigger", "close"]
148
177
  })({ asChild: true }, (props) => {
149
- const { getCloseTriggerProps } = useComponentContext();
150
- return getCloseTriggerProps(props);
178
+ const { closeTriggerProps, getCloseTriggerProps } = useComponentContext();
179
+ return getCloseTriggerProps(require_props.mergeProps(closeTriggerProps, props)());
151
180
  });
152
181
  const PopoverAnchor = withContext("div", "anchor")({ asChild: true }, (props) => {
153
- const { getAnchorProps } = useComponentContext();
154
- return getAnchorProps(props);
182
+ const { anchorProps, getAnchorProps } = useComponentContext();
183
+ return getAnchorProps(require_props.mergeProps(anchorProps, props)());
155
184
  });
156
185
  const PopoverPositioner = withContext("div", "positioner")(void 0, (props) => {
157
186
  const { getPositionerProps } = useComponentContext();
158
187
  return getPositionerProps(props);
159
188
  });
160
- const PopoverContent = withContext(({ portalProps, positionerProps, ...rest }) => {
161
- const { animationScheme, duration, open, getContentProps } = useComponentContext();
189
+ const PopoverContent = withContext(({ portalProps: portalPropsProp, positionerProps: positionerPropsProp, ...rest }) => {
190
+ const { animationScheme, duration, open, contentProps: { portalProps, positionerProps, ...contentProps } = {}, getContentProps } = useComponentContext();
162
191
  const popupAnimationProps = usePopupAnimationProps({
163
192
  animationScheme,
164
193
  duration
165
194
  });
166
195
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.AnimatePresence, { children: open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_portal.Portal, {
167
- ...portalProps,
196
+ ...require_props.mergeProps(portalProps, portalPropsProp)(),
168
197
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopoverPositioner, {
169
- ...positionerProps,
198
+ ...require_props.mergeProps(positionerProps, positionerPropsProp)(),
170
199
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.motion.div, {
171
200
  ...popupAnimationProps,
172
- ...(0, require_utils_index.utils_exports.cast)(getContentProps((0, require_utils_index.utils_exports.cast)(rest)))
201
+ ...(0, require_utils_index.utils_exports.cast)(getContentProps((0, require_utils_index.utils_exports.cast)(require_props.mergeProps(contentProps, rest)())))
173
202
  })
174
203
  })
175
204
  }) : null });
176
205
  }, "content")();
206
+ const ShorthandPopoverContent = ({ body, footer, header }) => {
207
+ const customHeader = require_children.wrapOrPassProps(PopoverHeader, header);
208
+ const customBody = require_children.wrapOrPassProps(PopoverBody, body);
209
+ const customFooter = require_children.wrapOrPassProps(PopoverFooter, footer);
210
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverContent, { children: [
211
+ customHeader,
212
+ customBody,
213
+ customFooter
214
+ ] });
215
+ };
177
216
  const PopoverHeader = withContext("div", "header")(void 0, (props) => {
178
- const { getHeaderProps } = useComponentContext();
179
- return getHeaderProps(props);
217
+ const { getHeaderProps, headerProps } = useComponentContext();
218
+ return getHeaderProps(require_props.mergeProps(headerProps, props)());
180
219
  });
181
220
  const PopoverBody = withContext("div", "body")(void 0, (props) => {
182
- const { getBodyProps } = useComponentContext();
183
- return getBodyProps(props);
221
+ const { bodyProps, getBodyProps } = useComponentContext();
222
+ return getBodyProps(require_props.mergeProps(bodyProps, props)());
184
223
  });
185
224
  const PopoverFooter = withContext("div", "footer")(void 0, (props) => {
186
- const { getFooterProps } = useComponentContext();
187
- return getFooterProps(props);
225
+ const { footerProps, getFooterProps } = useComponentContext();
226
+ return getFooterProps(require_props.mergeProps(footerProps, props)());
188
227
  });
189
228
  //#endregion
190
229
  exports.PopoverAnchor = PopoverAnchor;
@@ -1 +1 @@
1
- {"version":3,"file":"popover.cjs","names":["useValue","fadeScaleVariants","slideFadeVariants","createSlotComponent","popoverStyle","usePopover","AnimatePresence","Portal","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, filterUndefined, 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 useMemo(\n () => filterUndefined({ flip, gutter, matchWidth, placement, strategy }),\n [flip, gutter, matchWidth, placement, 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 * Props for positioner component.\n */\n positionerProps?: Omit<PopoverPositionerProps, \"children\">\n}\n\nexport const PopoverContent = withContext<\"div\", PopoverContentProps>(\n ({ portalProps, positionerProps, ...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 {...positionerProps}>\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,CAAC,MAAM;CAC5E,MAAM,kBAAkBA,8BAAAA,SAAS,MAAM,mBAAmB,OAAO;CACjE,MAAM,WAAWA,8BAAAA,SAAS,MAAM,YAAY,EA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MAAM,EAAE,uBAAuB,oBAAoB;CAEnD,OAAO,mBAAmB,KAAK;AACjC,CAAC;AAcD,MAAa,iBAAiB,aAC3B,EAAE,aAAa,iBAAiB,GAAG,WAAW;CAC7C,MAAM,EAAE,iBAAiB,UAAU,MAAM,oBACvC,oBAAoB;CACtB,MAAM,sBAAsB,uBAAuB;EACjD;EACA;CACF,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,aAAAA,iBAAD,EAAA,UACG,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,eAAAA,QAAD;EAAQ,GAAI;EACV,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,mBAAD;GAAmB,GAAI;GACrB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,gBAAAA,OAAO,KAAR;IACE,GAAI;IACJ,IAAA,GAAA,oBAAA,cAAA,KAAA,CACE,iBAAA,GAAA,oBAAA,cAAA,KAAA,CAAgC,IAAI,CAAC,CACvC;GACD,CAAA;EACgB,CAAA;CACb,CAAA,IACN,KACW,CAAA;AAErB,GACA,SACF,CAAC,CAAC;AAIF,MAAa,gBAAgB,YAC3B,OACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,oBAAoB;CAE/C,OAAO,eAAe,KAAK;AAC7B,CAAC;AAID,MAAa,cAAc,YAAqC,OAAO,MAAM,CAAC,CAC5E,KAAA,IACC,UAAU;CACT,MAAM,EAAE,iBAAiB,oBAAoB;CAE7C,OAAO,aAAa,KAAK;AAC3B,CACF;AAIA,MAAa,gBAAgB,YAC3B,OACA,QACF,CAAC,CAAC,KAAA,IAAY,UAAU;CACtB,MAAM,EAAE,mBAAmB,oBAAoB;CAE/C,OAAO,eAAe,KAAK;AAC7B,CAAC"}
1
+ {"version":3,"file":"popover.cjs","names":["useValue","fadeScaleVariants","slideFadeVariants","createSlotComponent","popoverStyle","useSplitChildren","usePopover","mergeProps","AnimatePresence","Portal","motion","wrapOrPassProps"],"sources":["../../../../src/components/popover/popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FC, PropsWithChildren, ReactNode } 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, mergeProps } from \"../../core\"\nimport { useValue } from \"../../hooks/use-value\"\nimport {\n cast,\n filterUndefined,\n isFunction,\n runIfFn,\n useSplitChildren,\n wrapOrPassProps,\n} 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 useMemo(\n () => filterUndefined({ flip, gutter, matchWidth, placement, strategy }),\n [flip, gutter, matchWidth, placement, 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 Pick<\n PopoverRootProps,\n | \"anchorProps\"\n | \"bodyProps\"\n | \"closeTriggerProps\"\n | \"contentProps\"\n | \"footerProps\"\n | \"headerProps\"\n | \"triggerProps\"\n > {}\n\nexport interface PopoverRootProps\n extends\n Merge<UsePopoverProps, UsePopoverStyleProps>,\n UsePopupAnimationProps,\n ThemeProps<PopoverStyle>,\n ShorthandPopoverContentProps {\n /**\n * The popover anchor to use.\n */\n anchor?: ReactNode\n /**\n * The children of the popover.\n */\n children?: ReactNodeOrFunction<{\n open: boolean\n onClose: () => void\n }>\n /**\n * The popover trigger to use.\n */\n trigger?: ReactNode\n /**\n * Props for anchor element.\n */\n anchorProps?: Omit<PopoverAnchorProps, \"asChild\" | \"children\">\n /**\n * Props for body element.\n */\n bodyProps?: Omit<PopoverBodyProps, \"children\">\n /**\n * Props for close trigger element.\n */\n closeTriggerProps?: Omit<PopoverCloseTriggerProps, \"asChild\" | \"children\">\n /**\n * Props for content element.\n */\n contentProps?: Omit<PopoverContentProps, \"children\">\n /**\n * Props for footer element.\n */\n footerProps?: Omit<PopoverFooterProps, \"children\">\n /**\n * Props for header element.\n */\n headerProps?: Omit<PopoverHeaderProps, \"children\">\n /**\n * Props for trigger element.\n */\n triggerProps?: Omit<PopoverTriggerProps, \"asChild\" | \"children\">\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 [\n styleContext,\n {\n anchor: anchorProp,\n animationScheme,\n body,\n children,\n duration,\n footer,\n header,\n trigger: triggerProp,\n anchorProps,\n bodyProps,\n closeTriggerProps,\n contentProps,\n footerProps,\n headerProps,\n triggerProps,\n ...rest\n },\n ] = useRootComponentProps({ ...props, ...styleProps })\n const [omittedChildren, trigger, anchor, customContent] = useSplitChildren(\n isFunction(children) ? undefined : children,\n PopoverTrigger,\n PopoverAnchor,\n PopoverContent,\n )\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 anchorProps,\n bodyProps,\n closeTriggerProps,\n contentProps,\n footerProps,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n headerProps,\n triggerProps,\n }),\n [\n open,\n animationScheme,\n anchorProps,\n bodyProps,\n closeTriggerProps,\n contentProps,\n duration,\n footerProps,\n headerProps,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n triggerProps,\n ],\n )\n const customAnchor = anchorProp ? (\n <PopoverAnchor>{anchorProp}</PopoverAnchor>\n ) : null\n const customTrigger = triggerProp ? (\n <PopoverTrigger>{triggerProp}</PopoverTrigger>\n ) : null\n const customContentProp =\n header !== undefined || body !== undefined || footer !== undefined ? (\n <ShorthandPopoverContent body={body} footer={footer} header={header} />\n ) : null\n\n return (\n <StyleContext value={styleContext}>\n <ComponentContext value={componentContext}>\n {isFunction(children) ? (\n runIfFn(children, { open, onClose })\n ) : (\n <>\n {anchor ?? customAnchor}\n {trigger ?? customTrigger}\n {omittedChildren}\n {customContent ?? customContentProp}\n </>\n )}\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, triggerProps } = useComponentContext()\n\n return getTriggerProps(mergeProps(triggerProps, 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 { closeTriggerProps, getCloseTriggerProps } = useComponentContext()\n\n return getCloseTriggerProps(mergeProps(closeTriggerProps, 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 { anchorProps, getAnchorProps } = useComponentContext()\n\n return getAnchorProps(mergeProps(anchorProps, 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 * Props for positioner component.\n */\n positionerProps?: Omit<PopoverPositionerProps, \"children\">\n}\n\nexport const PopoverContent = withContext<\"div\", PopoverContentProps>(\n ({\n portalProps: portalPropsProp,\n positionerProps: positionerPropsProp,\n ...rest\n }) => {\n const {\n animationScheme,\n duration,\n open,\n contentProps: { portalProps, positionerProps, ...contentProps } = {},\n getContentProps,\n } = useComponentContext()\n const popupAnimationProps = usePopupAnimationProps({\n animationScheme,\n duration,\n })\n\n return (\n <AnimatePresence>\n {open ? (\n <Portal {...mergeProps(portalProps, portalPropsProp)()}>\n <PopoverPositioner\n {...mergeProps(positionerProps, positionerPropsProp)()}\n >\n <motion.div\n {...popupAnimationProps}\n {...cast<HTMLMotionProps>(\n getContentProps(\n cast<HTMLProps>(mergeProps(contentProps, rest)()),\n ),\n )}\n />\n </PopoverPositioner>\n </Portal>\n ) : null}\n </AnimatePresence>\n )\n },\n \"content\",\n)()\n\ninterface ShorthandPopoverContentProps {\n /**\n * The popover body to use.\n */\n body?: PopoverBodyProps | ReactNode\n /**\n * The popover footer to use.\n */\n footer?: PopoverFooterProps | ReactNode\n /**\n * The popover header to use.\n */\n header?: PopoverHeaderProps | ReactNode\n}\n\nconst ShorthandPopoverContent: FC<ShorthandPopoverContentProps> = ({\n body,\n footer,\n header,\n}) => {\n const customHeader = wrapOrPassProps(PopoverHeader, header)\n const customBody = wrapOrPassProps(PopoverBody, body)\n const customFooter = wrapOrPassProps(PopoverFooter, footer)\n\n return (\n <PopoverContent>\n {customHeader}\n {customBody}\n {customFooter}\n </PopoverContent>\n )\n}\n\nexport interface PopoverHeaderProps extends HTMLStyledProps {}\n\nexport const PopoverHeader = withContext<\"div\", PopoverHeaderProps>(\n \"div\",\n \"header\",\n)(undefined, (props) => {\n const { getHeaderProps, headerProps } = useComponentContext()\n\n return getHeaderProps(mergeProps(headerProps, props)())\n})\n\nexport interface PopoverBodyProps extends HTMLStyledProps {}\n\nexport const PopoverBody = withContext<\"div\", PopoverBodyProps>(\"div\", \"body\")(\n undefined,\n (props) => {\n const { bodyProps, getBodyProps } = useComponentContext()\n\n return getBodyProps(mergeProps(bodyProps, 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 { footerProps, getFooterProps } = useComponentContext()\n\n return getFooterProps(mergeProps(footerProps, props)())\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAiDA,MAAa,0BAA0B,QAAgC,CAAC,MAAM;CAC5E,MAAM,kBAAkBA,8BAAAA,SAAS,MAAM,mBAAmB,OAAO;CACjE,MAAM,WAAWA,8BAAAA,SAAS,MAAM,YAAY,EAAG;CAC/C,MAAM,cAAc;EAAE,SAAS;EAAS,MAA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