@yahoo/uds 3.133.2 → 3.134.0
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/automated-config/dist/generated/autoVariants.cjs +14 -0
- package/dist/automated-config/dist/generated/autoVariants.d.cts +14 -0
- package/dist/automated-config/dist/generated/autoVariants.d.ts +14 -0
- package/dist/automated-config/dist/generated/autoVariants.js +14 -0
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +2796 -1
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +288 -2
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +288 -2
- package/dist/automated-config/dist/generated/generatedConfigs.js +2796 -2
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +119 -0
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +2 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +2 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +119 -0
- package/dist/automated-config/dist/properties.cjs +15 -1
- package/dist/automated-config/dist/properties.d.cts +4 -0
- package/dist/automated-config/dist/properties.d.ts +4 -0
- package/dist/automated-config/dist/properties.js +15 -1
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +2 -2
- package/dist/cli/commands/sync.cjs +4 -0
- package/dist/cli/commands/sync.js +4 -0
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/components/client/Modal/Modal.cjs +193 -0
- package/dist/components/client/Modal/Modal.d.cts +51 -0
- package/dist/components/client/Modal/Modal.d.ts +52 -0
- package/dist/components/client/Modal/Modal.js +191 -0
- package/dist/components/client/Modal/ModalActions.cjs +54 -0
- package/dist/components/client/Modal/ModalActions.d.cts +27 -0
- package/dist/components/client/Modal/ModalActions.d.ts +28 -0
- package/dist/components/client/Modal/ModalActions.js +52 -0
- package/dist/components/client/Modal/ModalContent.cjs +37 -0
- package/dist/components/client/Modal/ModalContent.d.cts +24 -0
- package/dist/components/client/Modal/ModalContent.d.ts +25 -0
- package/dist/components/client/Modal/ModalContent.js +35 -0
- package/dist/components/client/Modal/ModalContext.cjs +15 -0
- package/dist/components/client/Modal/ModalContext.d.cts +13 -0
- package/dist/components/client/Modal/ModalContext.d.ts +14 -0
- package/dist/components/client/Modal/ModalContext.js +12 -0
- package/dist/components/client/Modal/ModalDescription.cjs +29 -0
- package/dist/components/client/Modal/ModalDescription.d.cts +23 -0
- package/dist/components/client/Modal/ModalDescription.d.ts +24 -0
- package/dist/components/client/Modal/ModalDescription.js +27 -0
- package/dist/components/client/Modal/ModalTitle.cjs +29 -0
- package/dist/components/client/Modal/ModalTitle.d.cts +23 -0
- package/dist/components/client/Modal/ModalTitle.d.ts +24 -0
- package/dist/components/client/Modal/ModalTitle.js +27 -0
- package/dist/components/client/Modal/UDSModalConfigProvider.cjs +42 -0
- package/dist/components/client/Modal/UDSModalConfigProvider.d.cts +35 -0
- package/dist/components/client/Modal/UDSModalConfigProvider.d.ts +36 -0
- package/dist/components/client/Modal/UDSModalConfigProvider.js +39 -0
- package/dist/components/client/Modal/index.cjs +16 -0
- package/dist/components/client/Modal/index.d.cts +8 -0
- package/dist/components/client/Modal/index.d.ts +9 -0
- package/dist/components/client/Modal/index.js +9 -0
- package/dist/components/client/Modal/useScrollFade.cjs +38 -0
- package/dist/components/client/Modal/useScrollFade.d.cts +13 -0
- package/dist/components/client/Modal/useScrollFade.d.ts +14 -0
- package/dist/components/client/Modal/useScrollFade.js +36 -0
- package/dist/components/client/Modal/utils.cjs +32 -0
- package/dist/components/client/Modal/utils.d.cts +13 -0
- package/dist/components/client/Modal/utils.d.ts +14 -0
- package/dist/components/client/Modal/utils.js +30 -0
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +1 -1
- package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +1 -1
- package/dist/components/client/Popover/index.d.cts +1 -1
- package/dist/components/client/Popover/index.d.ts +1 -1
- package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +5 -5
- package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +5 -5
- package/dist/components/client/index.cjs +13 -0
- package/dist/components/client/index.d.cts +8 -2
- package/dist/components/client/index.d.ts +8 -2
- package/dist/components/client/index.js +7 -1
- package/dist/components/client/providers/UDSConfigProvider.cjs +6 -2
- package/dist/components/client/providers/UDSConfigProvider.d.cts +2 -1
- package/dist/components/client/providers/UDSConfigProvider.d.ts +2 -1
- package/dist/components/client/providers/UDSConfigProvider.js +6 -2
- package/dist/components/experimental/client/index.cjs +0 -5
- package/dist/components/experimental/client/index.d.cts +1 -2
- package/dist/components/experimental/client/index.d.ts +1 -2
- package/dist/components/experimental/client/index.js +1 -2
- package/dist/components/experimental/index.cjs +1 -10
- package/dist/components/experimental/index.d.cts +1 -2
- package/dist/components/experimental/index.d.ts +1 -2
- package/dist/components/experimental/index.js +2 -7
- package/dist/components/index.cjs +20 -0
- package/dist/components/index.d.cts +8 -2
- package/dist/components/index.d.ts +8 -2
- package/dist/components/index.js +14 -1
- package/dist/config/dist/index.cjs +129 -4
- package/dist/config/dist/index.js +129 -4
- package/dist/index.cjs +16 -0
- package/dist/index.d.cts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +9 -2
- package/dist/runtime/index.cjs +2 -0
- package/dist/runtime/index.d.cts +2 -1
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.js +2 -1
- package/dist/runtime/modalConfig.cjs +22 -0
- package/dist/runtime/modalConfig.d.cts +22 -0
- package/dist/runtime/modalConfig.d.ts +22 -0
- package/dist/runtime/modalConfig.js +21 -0
- package/dist/runtime/udsConfig.cjs +4 -2
- package/dist/runtime/udsConfig.d.cts +2 -0
- package/dist/runtime/udsConfig.d.ts +2 -0
- package/dist/runtime/udsConfig.js +4 -2
- package/dist/styles/styler.d.cts +75 -61
- package/dist/styles/styler.d.ts +75 -61
- package/dist/styles/variants.d.cts +42 -0
- package/dist/styles/variants.d.ts +42 -0
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.cjs +14 -0
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.js +14 -0
- package/dist/tailwind/dist/automated-config/dist/generated/autoVariants.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.cjs +2796 -1
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.js +2796 -2
- package/dist/tailwind/dist/automated-config/dist/generated/generatedConfigs.js.map +1 -1
- package/dist/tailwind/dist/automated-config/dist/properties.cjs +15 -1
- package/dist/tailwind/dist/automated-config/dist/properties.js +15 -1
- package/dist/tailwind/dist/automated-config/dist/properties.js.map +1 -1
- package/dist/tailwind/dist/config/dist/index.cjs +129 -4
- package/dist/tailwind/dist/config/dist/index.js +129 -4
- package/dist/tailwind/dist/config/dist/index.js.map +1 -1
- package/dist/tailwind/dist/css/utils.cjs +8 -0
- package/dist/tailwind/dist/css/utils.js +8 -0
- package/dist/tailwind/dist/css/utils.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/ast/expressions.cjs +9 -3
- package/dist/tailwind/dist/purger/optimized/ast/expressions.js +9 -3
- package/dist/tailwind/dist/purger/optimized/ast/expressions.js.map +1 -1
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.cjs +1 -1
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.js +1 -1
- package/dist/tailwind/dist/purger/optimized/purgeFromCode.js.map +1 -1
- package/dist/tailwind/dist/runtimeConfig/hookMetadata.cjs +34 -0
- package/dist/tailwind/dist/runtimeConfig/hookMetadata.js +34 -0
- package/dist/tailwind/dist/runtimeConfig/hookMetadata.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/blurBgFallback.cjs +3 -0
- package/dist/tailwind/dist/tailwind/plugins/blurBgFallback.js +3 -0
- package/dist/tailwind/dist/tailwind/plugins/blurBgFallback.js.map +1 -1
- package/dist/tailwind/dist/tailwind/plugins/components.cjs +1 -0
- package/dist/tailwind/dist/tailwind/plugins/components.js +2 -1
- package/dist/tailwind/dist/tailwind/plugins/components.js.map +1 -1
- package/dist/tailwind/dist/types/dist/index.d.cts.map +1 -1
- package/dist/tailwind/dist/types/dist/index.d.ts.map +1 -1
- package/dist/tokens/automation/configs/index.cjs +1 -0
- package/dist/tokens/automation/configs/index.d.cts +2 -2
- package/dist/tokens/automation/configs/index.d.ts +2 -2
- package/dist/tokens/automation/configs/index.js +2 -2
- package/dist/tokens/automation/index.cjs +1 -0
- package/dist/tokens/automation/index.d.cts +2 -2
- package/dist/tokens/automation/index.d.ts +2 -2
- package/dist/tokens/automation/index.js +2 -2
- package/dist/tokens/index.cjs +1 -0
- package/dist/tokens/index.d.cts +3 -3
- package/dist/tokens/index.d.ts +3 -3
- package/dist/tokens/index.js +2 -2
- package/dist/tokens/types.d.cts +2 -2
- package/dist/tokens/types.d.ts +2 -2
- package/dist/types/dist/index.d.cts +68 -2
- package/dist/types/dist/index.d.ts +68 -2
- package/dist/uds/generated/componentData.cjs +383 -192
- package/dist/uds/generated/componentData.js +348 -193
- package/dist/uds/generated/tailwindPurge.cjs +137 -96
- package/dist/uds/generated/tailwindPurge.js +137 -96
- package/dist/utils/exposeAriakitScrollbarWidth.cjs +17 -0
- package/dist/utils/exposeAriakitScrollbarWidth.d.cts +13 -0
- package/dist/utils/exposeAriakitScrollbarWidth.d.ts +13 -0
- package/dist/utils/exposeAriakitScrollbarWidth.js +16 -0
- package/generated/componentData.json +462 -251
- package/generated/tailwindPurge.ts +4 -4
- package/package.json +1 -1
- package/dist/components/experimental/client/Modal.cjs +0 -60
- package/dist/components/experimental/client/Modal.d.cts +0 -27
- package/dist/components/experimental/client/Modal.d.ts +0 -28
- package/dist/components/experimental/client/Modal.js +0 -55
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
6
|
+
const require_components_client_Pressable = require("../Pressable.cjs");
|
|
7
|
+
const require_components_IconSlot = require("../../IconSlot.cjs");
|
|
8
|
+
const require_components_Box = require("../../Box.cjs");
|
|
9
|
+
const require_components_HStack = require("../../HStack.cjs");
|
|
10
|
+
const require_components_VStack = require("../../VStack.cjs");
|
|
11
|
+
const require_components_Scrim = require("../../Scrim.cjs");
|
|
12
|
+
const require_utils_exposeAriakitScrollbarWidth = require("../../../utils/exposeAriakitScrollbarWidth.cjs");
|
|
13
|
+
const require_components_client_Modal_ModalContext = require("./ModalContext.cjs");
|
|
14
|
+
const require_components_client_Modal_UDSModalConfigProvider = require("./UDSModalConfigProvider.cjs");
|
|
15
|
+
const require_components_client_Modal_ModalActions = require("./ModalActions.cjs");
|
|
16
|
+
const require_components_client_Modal_ModalContent = require("./ModalContent.cjs");
|
|
17
|
+
const require_components_client_Modal_ModalDescription = require("./ModalDescription.cjs");
|
|
18
|
+
const require_components_client_Modal_ModalTitle = require("./ModalTitle.cjs");
|
|
19
|
+
const require_components_client_Modal_utils = require("./utils.cjs");
|
|
20
|
+
let _yahoo_uds_icons = require("@yahoo/uds-icons");
|
|
21
|
+
let react = require("react");
|
|
22
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
23
|
+
let _ariakit_react = require("@ariakit/react");
|
|
24
|
+
let motion_react = require("motion/react");
|
|
25
|
+
//#region src/components/client/Modal/Modal.tsx
|
|
26
|
+
require_utils_exposeAriakitScrollbarWidth.exposeAriakitScrollbarWidth();
|
|
27
|
+
const Modal = ({ children, open, onClose, onOpen, portal = true, modal = true, includeScrim, closeAriaLabel = "Close", slotProps, hideDismissButton = false, reduceMotion: forceReduceMotion = false, closeIcon = _yahoo_uds_icons.Cross, maxWidth = "auto", maxHeight: maxHeightProp = "auto", fullWidth = false, fullHeight = false, title: titleProp, description: descriptionProp, content: contentProp, actions: actionsProp, scrollBehavior = "outside", className, style }) => {
|
|
28
|
+
const prevOpen = (0, react.useRef)(open);
|
|
29
|
+
const positionerRef = (0, react.useRef)(null);
|
|
30
|
+
const { size, variant, animationDuration, animationEasing, gutter } = require_components_client_Modal_UDSModalConfigProvider.useModalConfig();
|
|
31
|
+
const { in: durationIn, out: durationOut } = typeof animationDuration === "number" ? {
|
|
32
|
+
in: animationDuration,
|
|
33
|
+
out: animationDuration
|
|
34
|
+
} : animationDuration;
|
|
35
|
+
const { in: easingIn, out: easingOut } = typeof animationEasing === "string" ? {
|
|
36
|
+
in: animationEasing,
|
|
37
|
+
out: animationEasing
|
|
38
|
+
} : animationEasing;
|
|
39
|
+
const { title: modalTitle, description: modalDescription, content: modalContent, actions: modalActions } = require_components_client_Modal_utils.separateChildren(children);
|
|
40
|
+
const reducedMotion = (0, motion_react.useReducedMotion)() || forceReduceMotion;
|
|
41
|
+
(0, react.useEffect)(() => {
|
|
42
|
+
if (open && !prevOpen.current) onOpen?.();
|
|
43
|
+
prevOpen.current = open;
|
|
44
|
+
}, [open, onOpen]);
|
|
45
|
+
const [shouldLockScroll, setShouldLockScroll] = (0, react.useState)(open);
|
|
46
|
+
if (open && !shouldLockScroll) setShouldLockScroll(true);
|
|
47
|
+
(0, react.useEffect)(() => {
|
|
48
|
+
if (open) return;
|
|
49
|
+
const duration = reducedMotion ? 0 : durationOut;
|
|
50
|
+
const timer = window.setTimeout(() => setShouldLockScroll(false), duration);
|
|
51
|
+
return () => window.clearTimeout(timer);
|
|
52
|
+
}, [
|
|
53
|
+
open,
|
|
54
|
+
reducedMotion,
|
|
55
|
+
durationOut
|
|
56
|
+
]);
|
|
57
|
+
(0, react.useLayoutEffect)(() => {
|
|
58
|
+
if (!open) return;
|
|
59
|
+
const positioner = positionerRef.current;
|
|
60
|
+
const dialog = positioner?.firstElementChild;
|
|
61
|
+
if (!positioner || !dialog) return;
|
|
62
|
+
positioner.style.zIndex = getComputedStyle(dialog).zIndex;
|
|
63
|
+
}, [open]);
|
|
64
|
+
const hasTitleOrDescription = !!(modalTitle || titleProp || modalDescription || descriptionProp);
|
|
65
|
+
const shouldRenderHeader = !!(!hideDismissButton || hasTitleOrDescription);
|
|
66
|
+
const hasContent = !!(modalContent || contentProp);
|
|
67
|
+
const maxHeight = scrollBehavior === "inside" ? maxHeightProp : void 0;
|
|
68
|
+
const classNames = {
|
|
69
|
+
positioner: require_styles_styler.getStyles({
|
|
70
|
+
spacing: gutter,
|
|
71
|
+
className: require_styles_styler.cx("fixed inset-0 z-40", scrollBehavior === "outside" ? "overflow-y-auto" : "overflow-hidden", !reducedMotion && "transition-[opacity,visibility]", open ? "visible opacity-100" : "invisible opacity-0", modal === false && "pointer-events-none")
|
|
72
|
+
}),
|
|
73
|
+
root: require_styles_styler.getStyles({
|
|
74
|
+
modalSizeRoot: size,
|
|
75
|
+
modalVariantRoot: variant,
|
|
76
|
+
className: require_styles_styler.cx("z-40", "uds-bgBlurFallback", fullWidth ? "w-full" : "w-fit", fullHeight && scrollBehavior === "inside" ? "h-full" : "h-fit", "m-auto pointer-events-auto", scrollBehavior === "inside" && "overflow-hidden max-h-full", !reducedMotion && "transition-transform")
|
|
77
|
+
}),
|
|
78
|
+
header: require_styles_styler.getStyles({
|
|
79
|
+
modalSizeSpacingHorizontal: size,
|
|
80
|
+
modalSizeHeader: size,
|
|
81
|
+
flexDirection: "row-reverse",
|
|
82
|
+
justifyContent: "space-between",
|
|
83
|
+
alignItems: hideDismissButton ? "flex-end" : "flex-start"
|
|
84
|
+
}),
|
|
85
|
+
titleDescriptionWrapper: require_styles_styler.getStyles({ modalSizeTitleDescriptionWrapper: size }),
|
|
86
|
+
closeIconContainer: require_styles_styler.getStyles({
|
|
87
|
+
modalSizeCloseIconContainer: size,
|
|
88
|
+
borderRadius: "full",
|
|
89
|
+
className: require_styles_styler.cx(reducedMotion ? "duration-0" : "duration-120", "transition-[background-color]", "bg-carbon-15/0", "hover:bg-carbon-15/10", "active:bg-carbon-15/15", "uds-ring", "[translate:50%_-50%]")
|
|
90
|
+
}),
|
|
91
|
+
closeIcon: require_styles_styler.getStyles({
|
|
92
|
+
modalSizeCloseIcon: size,
|
|
93
|
+
modalVariantCloseIcon: variant
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
const backdrop = includeScrim ?? modal ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Scrim.Scrim, {
|
|
97
|
+
animateOpacity: true,
|
|
98
|
+
...slotProps?.scrim,
|
|
99
|
+
className: require_styles_styler.cx(!open && "pointer-events-none", slotProps?.scrim?.className),
|
|
100
|
+
style: {
|
|
101
|
+
...slotProps?.scrim?.style,
|
|
102
|
+
...!reducedMotion ? {
|
|
103
|
+
transitionDuration: `${open ? durationIn : durationOut}ms`,
|
|
104
|
+
transitionTimingFunction: open ? easingIn : easingOut
|
|
105
|
+
} : void 0
|
|
106
|
+
}
|
|
107
|
+
}) : false;
|
|
108
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.Dialog, {
|
|
109
|
+
open,
|
|
110
|
+
onClose,
|
|
111
|
+
portal,
|
|
112
|
+
modal,
|
|
113
|
+
className: classNames.root,
|
|
114
|
+
backdrop,
|
|
115
|
+
preventBodyScroll: modal ? shouldLockScroll : false,
|
|
116
|
+
alwaysVisible: true,
|
|
117
|
+
autoFocusOnShow: (element) => {
|
|
118
|
+
if (scrollBehavior === "outside") {
|
|
119
|
+
element?.focus({ preventScroll: true });
|
|
120
|
+
positionerRef.current?.scrollTo(0, 0);
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
},
|
|
125
|
+
render: (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
126
|
+
...slotProps?.positioner,
|
|
127
|
+
ref: positionerRef,
|
|
128
|
+
className: require_styles_styler.cx(classNames.positioner, slotProps?.positioner?.className),
|
|
129
|
+
style: {
|
|
130
|
+
...slotProps?.positioner?.style,
|
|
131
|
+
...!reducedMotion ? {
|
|
132
|
+
transitionDuration: `${open ? durationIn : durationOut}ms`,
|
|
133
|
+
transitionTimingFunction: open ? easingIn : easingOut
|
|
134
|
+
} : void 0
|
|
135
|
+
},
|
|
136
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_VStack.VStack, {
|
|
137
|
+
...props,
|
|
138
|
+
...slotProps?.root,
|
|
139
|
+
className: require_styles_styler.cx(props.className, className, slotProps?.root?.className),
|
|
140
|
+
style: {
|
|
141
|
+
...props.style,
|
|
142
|
+
...style,
|
|
143
|
+
...slotProps?.root?.style,
|
|
144
|
+
maxWidth,
|
|
145
|
+
maxHeight,
|
|
146
|
+
...!reducedMotion ? {
|
|
147
|
+
transform: open ? "scale(1)" : "scale(0.95)",
|
|
148
|
+
transitionDuration: `${open ? durationIn : durationOut}ms`,
|
|
149
|
+
transitionTimingFunction: open ? easingIn : easingOut
|
|
150
|
+
} : void 0
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
}),
|
|
154
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_client_Modal_ModalContext.ModalContext.Provider, {
|
|
155
|
+
value: {
|
|
156
|
+
scrollBehavior,
|
|
157
|
+
shouldRenderHeader,
|
|
158
|
+
hasContent
|
|
159
|
+
},
|
|
160
|
+
children: [
|
|
161
|
+
shouldRenderHeader && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_HStack.HStack, {
|
|
162
|
+
...slotProps?.header,
|
|
163
|
+
className: require_styles_styler.cx(classNames.header, slotProps?.header?.className),
|
|
164
|
+
children: [!hideDismissButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.DialogDismiss, {
|
|
165
|
+
render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Pressable.Pressable, {
|
|
166
|
+
"aria-label": closeAriaLabel,
|
|
167
|
+
onClick: (e) => onClose?.(e.nativeEvent),
|
|
168
|
+
...slotProps?.closeIconContainer,
|
|
169
|
+
className: require_styles_styler.cx(classNames.closeIconContainer, slotProps?.closeIconContainer?.className)
|
|
170
|
+
}),
|
|
171
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
172
|
+
icon: closeIcon,
|
|
173
|
+
iconProps: {
|
|
174
|
+
color: "inherit",
|
|
175
|
+
...slotProps?.closeIcon,
|
|
176
|
+
className: require_styles_styler.cx(classNames.closeIcon, slotProps?.closeIcon?.className)
|
|
177
|
+
}
|
|
178
|
+
})
|
|
179
|
+
}), hasTitleOrDescription && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_VStack.VStack, {
|
|
180
|
+
...slotProps?.titleDescriptionWrapper,
|
|
181
|
+
className: require_styles_styler.cx(classNames.titleDescriptionWrapper, slotProps?.titleDescriptionWrapper?.className),
|
|
182
|
+
children: [modalTitle || (titleProp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Modal_ModalTitle.ModalTitle, { children: titleProp }) : null), modalDescription || (descriptionProp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Modal_ModalDescription.ModalDescription, { children: descriptionProp }) : null)]
|
|
183
|
+
})]
|
|
184
|
+
}),
|
|
185
|
+
modalContent || (contentProp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Modal_ModalContent.ModalContent, { children: contentProp }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, { flexGrow: "1" })),
|
|
186
|
+
modalActions || (actionsProp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Modal_ModalActions.ModalActions, { children: actionsProp }) : null)
|
|
187
|
+
]
|
|
188
|
+
})
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
Modal.displayName = "Modal";
|
|
192
|
+
//#endregion
|
|
193
|
+
exports.Modal = Modal;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconPropsWithSVGProps, UniversalModalProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { ScrimProps } from "../../Scrim.cjs";
|
|
4
|
+
import { PressableProps } from "../Pressable.cjs";
|
|
5
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/Modal/Modal.d.ts
|
|
8
|
+
type DataAttributes = {
|
|
9
|
+
[name: `data-${string}`]: string | boolean;
|
|
10
|
+
};
|
|
11
|
+
interface ModalProps extends UniversalModalProps {
|
|
12
|
+
slotProps?: {
|
|
13
|
+
scrim?: Partial<ScrimProps & DataAttributes>;
|
|
14
|
+
root?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
15
|
+
positioner?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
16
|
+
header?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
17
|
+
titleDescriptionWrapper?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
18
|
+
closeIconContainer?: Partial<PressableProps & DataAttributes>;
|
|
19
|
+
closeIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
declare const Modal: {
|
|
23
|
+
({
|
|
24
|
+
children,
|
|
25
|
+
open,
|
|
26
|
+
onClose,
|
|
27
|
+
onOpen,
|
|
28
|
+
portal,
|
|
29
|
+
modal,
|
|
30
|
+
includeScrim,
|
|
31
|
+
closeAriaLabel,
|
|
32
|
+
slotProps,
|
|
33
|
+
hideDismissButton,
|
|
34
|
+
reduceMotion: forceReduceMotion,
|
|
35
|
+
closeIcon,
|
|
36
|
+
maxWidth,
|
|
37
|
+
maxHeight: maxHeightProp,
|
|
38
|
+
fullWidth,
|
|
39
|
+
fullHeight,
|
|
40
|
+
title: titleProp,
|
|
41
|
+
description: descriptionProp,
|
|
42
|
+
content: contentProp,
|
|
43
|
+
actions: actionsProp,
|
|
44
|
+
scrollBehavior,
|
|
45
|
+
className,
|
|
46
|
+
style
|
|
47
|
+
}: ModalProps): _$react_jsx_runtime0.JSX.Element;
|
|
48
|
+
displayName: string;
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Modal, type ModalProps };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { IconPropsWithSVGProps, UniversalModalProps } from "../../../types/dist/index.js";
|
|
4
|
+
import { ScrimProps } from "../../Scrim.js";
|
|
5
|
+
import { PressableProps } from "../Pressable.js";
|
|
6
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Modal/Modal.d.ts
|
|
9
|
+
type DataAttributes = {
|
|
10
|
+
[name: `data-${string}`]: string | boolean;
|
|
11
|
+
};
|
|
12
|
+
interface ModalProps extends UniversalModalProps {
|
|
13
|
+
slotProps?: {
|
|
14
|
+
scrim?: Partial<ScrimProps & DataAttributes>;
|
|
15
|
+
root?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
16
|
+
positioner?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
17
|
+
header?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
18
|
+
titleDescriptionWrapper?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
19
|
+
closeIconContainer?: Partial<PressableProps & DataAttributes>;
|
|
20
|
+
closeIcon?: Partial<IconPropsWithSVGProps & DataAttributes>;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
declare const Modal: {
|
|
24
|
+
({
|
|
25
|
+
children,
|
|
26
|
+
open,
|
|
27
|
+
onClose,
|
|
28
|
+
onOpen,
|
|
29
|
+
portal,
|
|
30
|
+
modal,
|
|
31
|
+
includeScrim,
|
|
32
|
+
closeAriaLabel,
|
|
33
|
+
slotProps,
|
|
34
|
+
hideDismissButton,
|
|
35
|
+
reduceMotion: forceReduceMotion,
|
|
36
|
+
closeIcon,
|
|
37
|
+
maxWidth,
|
|
38
|
+
maxHeight: maxHeightProp,
|
|
39
|
+
fullWidth,
|
|
40
|
+
fullHeight,
|
|
41
|
+
title: titleProp,
|
|
42
|
+
description: descriptionProp,
|
|
43
|
+
content: contentProp,
|
|
44
|
+
actions: actionsProp,
|
|
45
|
+
scrollBehavior,
|
|
46
|
+
className,
|
|
47
|
+
style
|
|
48
|
+
}: ModalProps): _$react_jsx_runtime0.JSX.Element;
|
|
49
|
+
displayName: string;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Modal, type ModalProps };
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
|
+
import { Pressable } from "../Pressable.js";
|
|
5
|
+
import { IconSlot } from "../../IconSlot.js";
|
|
6
|
+
import { Box } from "../../Box.js";
|
|
7
|
+
import { HStack } from "../../HStack.js";
|
|
8
|
+
import { VStack } from "../../VStack.js";
|
|
9
|
+
import { Scrim } from "../../Scrim.js";
|
|
10
|
+
import { exposeAriakitScrollbarWidth } from "../../../utils/exposeAriakitScrollbarWidth.js";
|
|
11
|
+
import { ModalContext } from "./ModalContext.js";
|
|
12
|
+
import { useModalConfig } from "./UDSModalConfigProvider.js";
|
|
13
|
+
import { ModalActions } from "./ModalActions.js";
|
|
14
|
+
import { ModalContent } from "./ModalContent.js";
|
|
15
|
+
import { ModalDescription } from "./ModalDescription.js";
|
|
16
|
+
import { ModalTitle } from "./ModalTitle.js";
|
|
17
|
+
import { separateChildren } from "./utils.js";
|
|
18
|
+
import { Cross } from "@yahoo/uds-icons";
|
|
19
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
20
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
import { Dialog, DialogDismiss } from "@ariakit/react";
|
|
22
|
+
import { useReducedMotion } from "motion/react";
|
|
23
|
+
//#region src/components/client/Modal/Modal.tsx
|
|
24
|
+
exposeAriakitScrollbarWidth();
|
|
25
|
+
const Modal = ({ children, open, onClose, onOpen, portal = true, modal = true, includeScrim, closeAriaLabel = "Close", slotProps, hideDismissButton = false, reduceMotion: forceReduceMotion = false, closeIcon = Cross, maxWidth = "auto", maxHeight: maxHeightProp = "auto", fullWidth = false, fullHeight = false, title: titleProp, description: descriptionProp, content: contentProp, actions: actionsProp, scrollBehavior = "outside", className, style }) => {
|
|
26
|
+
const prevOpen = useRef(open);
|
|
27
|
+
const positionerRef = useRef(null);
|
|
28
|
+
const { size, variant, animationDuration, animationEasing, gutter } = useModalConfig();
|
|
29
|
+
const { in: durationIn, out: durationOut } = typeof animationDuration === "number" ? {
|
|
30
|
+
in: animationDuration,
|
|
31
|
+
out: animationDuration
|
|
32
|
+
} : animationDuration;
|
|
33
|
+
const { in: easingIn, out: easingOut } = typeof animationEasing === "string" ? {
|
|
34
|
+
in: animationEasing,
|
|
35
|
+
out: animationEasing
|
|
36
|
+
} : animationEasing;
|
|
37
|
+
const { title: modalTitle, description: modalDescription, content: modalContent, actions: modalActions } = separateChildren(children);
|
|
38
|
+
const reducedMotion = useReducedMotion() || forceReduceMotion;
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (open && !prevOpen.current) onOpen?.();
|
|
41
|
+
prevOpen.current = open;
|
|
42
|
+
}, [open, onOpen]);
|
|
43
|
+
const [shouldLockScroll, setShouldLockScroll] = useState(open);
|
|
44
|
+
if (open && !shouldLockScroll) setShouldLockScroll(true);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (open) return;
|
|
47
|
+
const duration = reducedMotion ? 0 : durationOut;
|
|
48
|
+
const timer = window.setTimeout(() => setShouldLockScroll(false), duration);
|
|
49
|
+
return () => window.clearTimeout(timer);
|
|
50
|
+
}, [
|
|
51
|
+
open,
|
|
52
|
+
reducedMotion,
|
|
53
|
+
durationOut
|
|
54
|
+
]);
|
|
55
|
+
useLayoutEffect(() => {
|
|
56
|
+
if (!open) return;
|
|
57
|
+
const positioner = positionerRef.current;
|
|
58
|
+
const dialog = positioner?.firstElementChild;
|
|
59
|
+
if (!positioner || !dialog) return;
|
|
60
|
+
positioner.style.zIndex = getComputedStyle(dialog).zIndex;
|
|
61
|
+
}, [open]);
|
|
62
|
+
const hasTitleOrDescription = !!(modalTitle || titleProp || modalDescription || descriptionProp);
|
|
63
|
+
const shouldRenderHeader = !!(!hideDismissButton || hasTitleOrDescription);
|
|
64
|
+
const hasContent = !!(modalContent || contentProp);
|
|
65
|
+
const maxHeight = scrollBehavior === "inside" ? maxHeightProp : void 0;
|
|
66
|
+
const classNames = {
|
|
67
|
+
positioner: getStyles({
|
|
68
|
+
spacing: gutter,
|
|
69
|
+
className: cx("fixed inset-0 z-40", scrollBehavior === "outside" ? "overflow-y-auto" : "overflow-hidden", !reducedMotion && "transition-[opacity,visibility]", open ? "visible opacity-100" : "invisible opacity-0", modal === false && "pointer-events-none")
|
|
70
|
+
}),
|
|
71
|
+
root: getStyles({
|
|
72
|
+
modalSizeRoot: size,
|
|
73
|
+
modalVariantRoot: variant,
|
|
74
|
+
className: cx("z-40", "uds-bgBlurFallback", fullWidth ? "w-full" : "w-fit", fullHeight && scrollBehavior === "inside" ? "h-full" : "h-fit", "m-auto pointer-events-auto", scrollBehavior === "inside" && "overflow-hidden max-h-full", !reducedMotion && "transition-transform")
|
|
75
|
+
}),
|
|
76
|
+
header: getStyles({
|
|
77
|
+
modalSizeSpacingHorizontal: size,
|
|
78
|
+
modalSizeHeader: size,
|
|
79
|
+
flexDirection: "row-reverse",
|
|
80
|
+
justifyContent: "space-between",
|
|
81
|
+
alignItems: hideDismissButton ? "flex-end" : "flex-start"
|
|
82
|
+
}),
|
|
83
|
+
titleDescriptionWrapper: getStyles({ modalSizeTitleDescriptionWrapper: size }),
|
|
84
|
+
closeIconContainer: getStyles({
|
|
85
|
+
modalSizeCloseIconContainer: size,
|
|
86
|
+
borderRadius: "full",
|
|
87
|
+
className: cx(reducedMotion ? "duration-0" : "duration-120", "transition-[background-color]", "bg-carbon-15/0", "hover:bg-carbon-15/10", "active:bg-carbon-15/15", "uds-ring", "[translate:50%_-50%]")
|
|
88
|
+
}),
|
|
89
|
+
closeIcon: getStyles({
|
|
90
|
+
modalSizeCloseIcon: size,
|
|
91
|
+
modalVariantCloseIcon: variant
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
const backdrop = includeScrim ?? modal ? /* @__PURE__ */ jsx(Scrim, {
|
|
95
|
+
animateOpacity: true,
|
|
96
|
+
...slotProps?.scrim,
|
|
97
|
+
className: cx(!open && "pointer-events-none", slotProps?.scrim?.className),
|
|
98
|
+
style: {
|
|
99
|
+
...slotProps?.scrim?.style,
|
|
100
|
+
...!reducedMotion ? {
|
|
101
|
+
transitionDuration: `${open ? durationIn : durationOut}ms`,
|
|
102
|
+
transitionTimingFunction: open ? easingIn : easingOut
|
|
103
|
+
} : void 0
|
|
104
|
+
}
|
|
105
|
+
}) : false;
|
|
106
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
107
|
+
open,
|
|
108
|
+
onClose,
|
|
109
|
+
portal,
|
|
110
|
+
modal,
|
|
111
|
+
className: classNames.root,
|
|
112
|
+
backdrop,
|
|
113
|
+
preventBodyScroll: modal ? shouldLockScroll : false,
|
|
114
|
+
alwaysVisible: true,
|
|
115
|
+
autoFocusOnShow: (element) => {
|
|
116
|
+
if (scrollBehavior === "outside") {
|
|
117
|
+
element?.focus({ preventScroll: true });
|
|
118
|
+
positionerRef.current?.scrollTo(0, 0);
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
},
|
|
123
|
+
render: (props) => /* @__PURE__ */ jsx(Box, {
|
|
124
|
+
...slotProps?.positioner,
|
|
125
|
+
ref: positionerRef,
|
|
126
|
+
className: cx(classNames.positioner, slotProps?.positioner?.className),
|
|
127
|
+
style: {
|
|
128
|
+
...slotProps?.positioner?.style,
|
|
129
|
+
...!reducedMotion ? {
|
|
130
|
+
transitionDuration: `${open ? durationIn : durationOut}ms`,
|
|
131
|
+
transitionTimingFunction: open ? easingIn : easingOut
|
|
132
|
+
} : void 0
|
|
133
|
+
},
|
|
134
|
+
children: /* @__PURE__ */ jsx(VStack, {
|
|
135
|
+
...props,
|
|
136
|
+
...slotProps?.root,
|
|
137
|
+
className: cx(props.className, className, slotProps?.root?.className),
|
|
138
|
+
style: {
|
|
139
|
+
...props.style,
|
|
140
|
+
...style,
|
|
141
|
+
...slotProps?.root?.style,
|
|
142
|
+
maxWidth,
|
|
143
|
+
maxHeight,
|
|
144
|
+
...!reducedMotion ? {
|
|
145
|
+
transform: open ? "scale(1)" : "scale(0.95)",
|
|
146
|
+
transitionDuration: `${open ? durationIn : durationOut}ms`,
|
|
147
|
+
transitionTimingFunction: open ? easingIn : easingOut
|
|
148
|
+
} : void 0
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
}),
|
|
152
|
+
children: /* @__PURE__ */ jsxs(ModalContext.Provider, {
|
|
153
|
+
value: {
|
|
154
|
+
scrollBehavior,
|
|
155
|
+
shouldRenderHeader,
|
|
156
|
+
hasContent
|
|
157
|
+
},
|
|
158
|
+
children: [
|
|
159
|
+
shouldRenderHeader && /* @__PURE__ */ jsxs(HStack, {
|
|
160
|
+
...slotProps?.header,
|
|
161
|
+
className: cx(classNames.header, slotProps?.header?.className),
|
|
162
|
+
children: [!hideDismissButton && /* @__PURE__ */ jsx(DialogDismiss, {
|
|
163
|
+
render: /* @__PURE__ */ jsx(Pressable, {
|
|
164
|
+
"aria-label": closeAriaLabel,
|
|
165
|
+
onClick: (e) => onClose?.(e.nativeEvent),
|
|
166
|
+
...slotProps?.closeIconContainer,
|
|
167
|
+
className: cx(classNames.closeIconContainer, slotProps?.closeIconContainer?.className)
|
|
168
|
+
}),
|
|
169
|
+
children: /* @__PURE__ */ jsx(IconSlot, {
|
|
170
|
+
icon: closeIcon,
|
|
171
|
+
iconProps: {
|
|
172
|
+
color: "inherit",
|
|
173
|
+
...slotProps?.closeIcon,
|
|
174
|
+
className: cx(classNames.closeIcon, slotProps?.closeIcon?.className)
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
}), hasTitleOrDescription && /* @__PURE__ */ jsxs(VStack, {
|
|
178
|
+
...slotProps?.titleDescriptionWrapper,
|
|
179
|
+
className: cx(classNames.titleDescriptionWrapper, slotProps?.titleDescriptionWrapper?.className),
|
|
180
|
+
children: [modalTitle || (titleProp ? /* @__PURE__ */ jsx(ModalTitle, { children: titleProp }) : null), modalDescription || (descriptionProp ? /* @__PURE__ */ jsx(ModalDescription, { children: descriptionProp }) : null)]
|
|
181
|
+
})]
|
|
182
|
+
}),
|
|
183
|
+
modalContent || (contentProp ? /* @__PURE__ */ jsx(ModalContent, { children: contentProp }) : /* @__PURE__ */ jsx(Box, { flexGrow: "1" })),
|
|
184
|
+
modalActions || (actionsProp ? /* @__PURE__ */ jsx(ModalActions, { children: actionsProp }) : null)
|
|
185
|
+
]
|
|
186
|
+
})
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
Modal.displayName = "Modal";
|
|
190
|
+
//#endregion
|
|
191
|
+
export { Modal };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
5
|
+
const require_styles_styler = require("../../../styles/styler.cjs");
|
|
6
|
+
const require_components_HStack = require("../../HStack.cjs");
|
|
7
|
+
const require_components_client_Modal_ModalContext = require("./ModalContext.cjs");
|
|
8
|
+
const require_components_client_Modal_UDSModalConfigProvider = require("./UDSModalConfigProvider.cjs");
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
//#region src/components/client/Modal/ModalActions.tsx
|
|
11
|
+
const ModalActions = ({ children, asChild = void 0, startContent, slotProps }) => {
|
|
12
|
+
const { size } = require_components_client_Modal_UDSModalConfigProvider.useModalConfig();
|
|
13
|
+
const { hasContent, shouldRenderHeader } = require_components_client_Modal_ModalContext.useInternalModalContext();
|
|
14
|
+
const classNames = {
|
|
15
|
+
actions: require_styles_styler.getStyles({
|
|
16
|
+
modalSizeSpacingHorizontal: size,
|
|
17
|
+
modalSizeActions: size,
|
|
18
|
+
flexDirection: "row-reverse",
|
|
19
|
+
justifyContent: "space-between",
|
|
20
|
+
alignItems: "center"
|
|
21
|
+
}),
|
|
22
|
+
actionsInner: require_styles_styler.getStyles({
|
|
23
|
+
flexDirection: "row-reverse",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
className: require_styles_styler.cx("gap-[inherit]")
|
|
26
|
+
}),
|
|
27
|
+
startContent: require_styles_styler.getStyles({
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
className: require_styles_styler.cx("gap-[inherit]")
|
|
30
|
+
})
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_HStack.HStack, {
|
|
33
|
+
...slotProps?.root,
|
|
34
|
+
className: require_styles_styler.cx(classNames.actions, slotProps?.root?.className),
|
|
35
|
+
style: {
|
|
36
|
+
paddingTop: !hasContent && shouldRenderHeader ? 0 : void 0,
|
|
37
|
+
...slotProps?.root?.style
|
|
38
|
+
},
|
|
39
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_HStack.HStack, {
|
|
40
|
+
asChild,
|
|
41
|
+
...slotProps?.actionsInner,
|
|
42
|
+
className: require_styles_styler.cx(classNames.actionsInner, slotProps?.actionsInner?.className),
|
|
43
|
+
children
|
|
44
|
+
}), startContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_HStack.HStack, {
|
|
45
|
+
...slotProps?.startContent,
|
|
46
|
+
className: require_styles_styler.cx(classNames.startContent, slotProps?.startContent?.className),
|
|
47
|
+
children: startContent
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
ModalActions.displayName = "ModalActions";
|
|
52
|
+
ModalActions.__modalSlot = "actions";
|
|
53
|
+
//#endregion
|
|
54
|
+
exports.ModalActions = ModalActions;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalModalActionsProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Modal/ModalActions.d.ts
|
|
6
|
+
type DataAttributes = {
|
|
7
|
+
[name: `data-${string}`]: string | boolean;
|
|
8
|
+
};
|
|
9
|
+
type ModalActionsProps = UniversalModalActionsProps & {
|
|
10
|
+
slotProps?: {
|
|
11
|
+
root?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
12
|
+
actionsInner?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
13
|
+
startContent?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
declare const ModalActions: {
|
|
17
|
+
({
|
|
18
|
+
children,
|
|
19
|
+
asChild,
|
|
20
|
+
startContent,
|
|
21
|
+
slotProps
|
|
22
|
+
}: ModalActionsProps): _$react_jsx_runtime0.JSX.Element;
|
|
23
|
+
displayName: string;
|
|
24
|
+
__modalSlot: "actions";
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { ModalActions, type ModalActionsProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";
|
|
3
|
+
import { UniversalModalActionsProps } from "../../../types/dist/index.js";
|
|
4
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Modal/ModalActions.d.ts
|
|
7
|
+
type DataAttributes = {
|
|
8
|
+
[name: `data-${string}`]: string | boolean;
|
|
9
|
+
};
|
|
10
|
+
type ModalActionsProps = UniversalModalActionsProps & {
|
|
11
|
+
slotProps?: {
|
|
12
|
+
root?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
13
|
+
actionsInner?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
14
|
+
startContent?: Partial<React.HTMLAttributes<HTMLDivElement> & DataAttributes>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
declare const ModalActions: {
|
|
18
|
+
({
|
|
19
|
+
children,
|
|
20
|
+
asChild,
|
|
21
|
+
startContent,
|
|
22
|
+
slotProps
|
|
23
|
+
}: ModalActionsProps): _$react_jsx_runtime0.JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
__modalSlot: "actions";
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ModalActions, type ModalActionsProps };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
2
|
+
"use client";
|
|
3
|
+
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
|
+
import { HStack } from "../../HStack.js";
|
|
5
|
+
import { useInternalModalContext } from "./ModalContext.js";
|
|
6
|
+
import { useModalConfig } from "./UDSModalConfigProvider.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/client/Modal/ModalActions.tsx
|
|
9
|
+
const ModalActions = ({ children, asChild = void 0, startContent, slotProps }) => {
|
|
10
|
+
const { size } = useModalConfig();
|
|
11
|
+
const { hasContent, shouldRenderHeader } = useInternalModalContext();
|
|
12
|
+
const classNames = {
|
|
13
|
+
actions: getStyles({
|
|
14
|
+
modalSizeSpacingHorizontal: size,
|
|
15
|
+
modalSizeActions: size,
|
|
16
|
+
flexDirection: "row-reverse",
|
|
17
|
+
justifyContent: "space-between",
|
|
18
|
+
alignItems: "center"
|
|
19
|
+
}),
|
|
20
|
+
actionsInner: getStyles({
|
|
21
|
+
flexDirection: "row-reverse",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
className: cx("gap-[inherit]")
|
|
24
|
+
}),
|
|
25
|
+
startContent: getStyles({
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
className: cx("gap-[inherit]")
|
|
28
|
+
})
|
|
29
|
+
};
|
|
30
|
+
return /* @__PURE__ */ jsxs(HStack, {
|
|
31
|
+
...slotProps?.root,
|
|
32
|
+
className: cx(classNames.actions, slotProps?.root?.className),
|
|
33
|
+
style: {
|
|
34
|
+
paddingTop: !hasContent && shouldRenderHeader ? 0 : void 0,
|
|
35
|
+
...slotProps?.root?.style
|
|
36
|
+
},
|
|
37
|
+
children: [/* @__PURE__ */ jsx(HStack, {
|
|
38
|
+
asChild,
|
|
39
|
+
...slotProps?.actionsInner,
|
|
40
|
+
className: cx(classNames.actionsInner, slotProps?.actionsInner?.className),
|
|
41
|
+
children
|
|
42
|
+
}), startContent && /* @__PURE__ */ jsx(HStack, {
|
|
43
|
+
...slotProps?.startContent,
|
|
44
|
+
className: cx(classNames.startContent, slotProps?.startContent?.className),
|
|
45
|
+
children: startContent
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
ModalActions.displayName = "ModalActions";
|
|
50
|
+
ModalActions.__modalSlot = "actions";
|
|
51
|
+
//#endregion
|
|
52
|
+
export { ModalActions };
|