@yahoo/uds-mobile 2.19.0 → 2.20.1
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/components/Modal/Modal.cjs +396 -0
- package/dist/components/Modal/Modal.d.cts +9 -0
- package/dist/components/Modal/Modal.d.cts.map +1 -0
- package/dist/components/Modal/Modal.d.ts +9 -0
- package/dist/components/Modal/Modal.d.ts.map +1 -0
- package/dist/components/Modal/Modal.js +395 -0
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Modal/ModalActions.cjs +47 -0
- package/dist/components/Modal/ModalActions.d.cts +9 -0
- package/dist/components/Modal/ModalActions.d.cts.map +1 -0
- package/dist/components/Modal/ModalActions.d.ts +9 -0
- package/dist/components/Modal/ModalActions.d.ts.map +1 -0
- package/dist/components/Modal/ModalActions.js +47 -0
- package/dist/components/Modal/ModalActions.js.map +1 -0
- package/dist/components/Modal/ModalContent.cjs +41 -0
- package/dist/components/Modal/ModalContent.d.cts +9 -0
- package/dist/components/Modal/ModalContent.d.cts.map +1 -0
- package/dist/components/Modal/ModalContent.d.ts +9 -0
- package/dist/components/Modal/ModalContent.d.ts.map +1 -0
- package/dist/components/Modal/ModalContent.js +41 -0
- package/dist/components/Modal/ModalContent.js.map +1 -0
- package/dist/components/Modal/ModalContext.cjs +14 -0
- package/dist/components/Modal/ModalContext.d.cts +10 -0
- package/dist/components/Modal/ModalContext.d.cts.map +1 -0
- package/dist/components/Modal/ModalContext.d.ts +10 -0
- package/dist/components/Modal/ModalContext.d.ts.map +1 -0
- package/dist/components/Modal/ModalContext.js +13 -0
- package/dist/components/Modal/ModalContext.js.map +1 -0
- package/dist/components/Modal/ModalDescription.cjs +21 -0
- package/dist/components/Modal/ModalDescription.d.cts +9 -0
- package/dist/components/Modal/ModalDescription.d.cts.map +1 -0
- package/dist/components/Modal/ModalDescription.d.ts +9 -0
- package/dist/components/Modal/ModalDescription.d.ts.map +1 -0
- package/dist/components/Modal/ModalDescription.js +21 -0
- package/dist/components/Modal/ModalDescription.js.map +1 -0
- package/dist/components/Modal/ModalTitle.cjs +22 -0
- package/dist/components/Modal/ModalTitle.d.cts +9 -0
- package/dist/components/Modal/ModalTitle.d.cts.map +1 -0
- package/dist/components/Modal/ModalTitle.d.ts +9 -0
- package/dist/components/Modal/ModalTitle.d.ts.map +1 -0
- package/dist/components/Modal/ModalTitle.js +22 -0
- package/dist/components/Modal/ModalTitle.js.map +1 -0
- package/dist/components/Modal/index.cjs +12 -0
- package/dist/components/Modal/index.d.cts +8 -0
- package/dist/components/Modal/index.d.ts +8 -0
- package/dist/components/Modal/index.js +7 -0
- package/dist/components/Modal/types.cjs +1 -0
- package/dist/components/Modal/types.d.cts +111 -0
- package/dist/components/Modal/types.d.cts.map +1 -0
- package/dist/components/Modal/types.d.ts +111 -0
- package/dist/components/Modal/types.d.ts.map +1 -0
- package/dist/components/Modal/types.js +1 -0
- package/dist/components/Modal/utils.cjs +59 -0
- package/dist/components/Modal/utils.d.cts +28 -0
- package/dist/components/Modal/utils.d.cts.map +1 -0
- package/dist/components/Modal/utils.d.ts +28 -0
- package/dist/components/Modal/utils.d.ts.map +1 -0
- package/dist/components/Modal/utils.js +56 -0
- package/dist/components/Modal/utils.js.map +1 -0
- package/dist/components/Pagination/paginationTheme.cjs +4 -2
- package/dist/components/Pagination/paginationTheme.d.cts +1 -1
- package/dist/components/Pagination/paginationTheme.d.ts +1 -1
- package/dist/components/Pagination/paginationTheme.js +4 -2
- package/dist/components/Pagination/paginationTheme.js.map +1 -1
- package/dist/jest/mocks/gesture-handler.cjs +29 -0
- package/dist/jest/mocks/gesture-handler.d.cts +27 -2
- package/dist/jest/mocks/gesture-handler.d.cts.map +1 -1
- package/dist/jest/mocks/gesture-handler.d.ts +27 -2
- package/dist/jest/mocks/gesture-handler.d.ts.map +1 -1
- package/dist/jest/mocks/gesture-handler.js +22 -1
- package/dist/jest/mocks/gesture-handler.js.map +1 -1
- package/dist/jest/mocks/styles.cjs +39 -0
- package/dist/jest/mocks/styles.d.cts +3 -2
- package/dist/jest/mocks/styles.d.cts.map +1 -1
- package/dist/jest/mocks/styles.d.ts +3 -2
- package/dist/jest/mocks/styles.d.ts.map +1 -1
- package/dist/jest/mocks/styles.js +39 -1
- package/dist/jest/mocks/styles.js.map +1 -1
- package/dist/jest/setup.cjs +8 -28
- package/dist/jest/setup.d.cts.map +1 -1
- package/dist/jest/setup.d.ts.map +1 -1
- package/dist/jest/setup.js +8 -28
- package/dist/jest/setup.js.map +1 -1
- package/generated/styles.d.ts +1 -1
- package/package.json +11 -1
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
4
|
+
const require_components_AndroidBackHandler = require("../AndroidBackHandler.cjs");
|
|
5
|
+
const require_components_Box = require("../Box.cjs");
|
|
6
|
+
const require_components_IconSlot = require("../IconSlot.cjs");
|
|
7
|
+
const require_components_Text = require("../Text.cjs");
|
|
8
|
+
const require_components_Pressable = require("../Pressable.cjs");
|
|
9
|
+
const require_components_Scrim = require("../Scrim.cjs");
|
|
10
|
+
const require_components_internal_Overlay_OverlayPortal = require("../internal/Overlay/OverlayPortal.cjs");
|
|
11
|
+
const require_components_Modal_ModalContext = require("./ModalContext.cjs");
|
|
12
|
+
const require_components_Modal_ModalActions = require("./ModalActions.cjs");
|
|
13
|
+
const require_components_Modal_ModalContent = require("./ModalContent.cjs");
|
|
14
|
+
const require_components_Modal_ModalDescription = require("./ModalDescription.cjs");
|
|
15
|
+
const require_components_Modal_ModalTitle = require("./ModalTitle.cjs");
|
|
16
|
+
const require_components_Modal_utils = require("./utils.cjs");
|
|
17
|
+
let react = require("react");
|
|
18
|
+
let react_native = require("react-native");
|
|
19
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
20
|
+
let generated_styles = require("../../../generated/styles");
|
|
21
|
+
let react_native_reanimated = require("react-native-reanimated");
|
|
22
|
+
react_native_reanimated = require_runtime.__toESM(react_native_reanimated);
|
|
23
|
+
let react_native_gesture_handler = require("react-native-gesture-handler");
|
|
24
|
+
let react_native_safe_area_context = require("react-native-safe-area-context");
|
|
25
|
+
//#region src/components/Modal/Modal.tsx
|
|
26
|
+
const ANIMATION_DURATION_IN = 400;
|
|
27
|
+
const ANIMATION_DURATION_OUT = 250;
|
|
28
|
+
const ANIMATION_EASING_IN = react_native_reanimated.Easing.bezier(.3, .4, .2, 1);
|
|
29
|
+
const ANIMATION_EASING_OUT = react_native_reanimated.Easing.bezier(.6, 0, .7, .6);
|
|
30
|
+
const HIDDEN_SCALE = .95;
|
|
31
|
+
const HIDDEN_PROGRESS = 1;
|
|
32
|
+
const VISIBLE_PROGRESS = 0;
|
|
33
|
+
const SCROLL_DISMISS_SUPPRESSION_MS = 150;
|
|
34
|
+
const SCROLL_OFFSET_THRESHOLD = 1;
|
|
35
|
+
function usePrefersReducedMotion() {
|
|
36
|
+
const [prefersReducedMotion, setPrefersReducedMotion] = (0, react.useState)(false);
|
|
37
|
+
(0, react.useEffect)(() => {
|
|
38
|
+
let isMounted = true;
|
|
39
|
+
react_native.AccessibilityInfo.isReduceMotionEnabled().then((isReduceMotionEnabled) => {
|
|
40
|
+
if (isMounted) setPrefersReducedMotion(isReduceMotionEnabled);
|
|
41
|
+
});
|
|
42
|
+
const subscription = react_native.AccessibilityInfo.addEventListener("reduceMotionChanged", (isReduceMotionEnabled) => {
|
|
43
|
+
setPrefersReducedMotion(isReduceMotionEnabled);
|
|
44
|
+
});
|
|
45
|
+
return () => {
|
|
46
|
+
isMounted = false;
|
|
47
|
+
subscription.remove();
|
|
48
|
+
};
|
|
49
|
+
}, []);
|
|
50
|
+
return prefersReducedMotion;
|
|
51
|
+
}
|
|
52
|
+
const Modal = (0, react.memo)(function Modal({ children, open, onClose, onOpen, portal = true, includeScrim, dismissible = true, hideDismissButton = false, reduceMotion = false, closeIcon = "Cross", closeAriaLabel = "Close", closeAccessibilityLabel, maxWidth = "auto", maxHeight = "auto", fullWidth = false, fullHeight = false, title: titleProp, description: descriptionProp, content: contentProp, actions: actionsProp, scrollBehavior = "outside", useFullWindowOverlay = true, blurTarget, style, ref, onLayout, ...viewProps }) {
|
|
53
|
+
generated_styles.modalStyles.useVariants({});
|
|
54
|
+
const surfaceRef = (0, react.useRef)(null);
|
|
55
|
+
const prevOpen = (0, react.useRef)(open);
|
|
56
|
+
const progress = (0, react_native_reanimated.useSharedValue)(HIDDEN_PROGRESS);
|
|
57
|
+
const closePressProgress = (0, react_native_reanimated.useSharedValue)(0);
|
|
58
|
+
const presenceState = (0, react.useRef)(open ? "open" : "closed");
|
|
59
|
+
const didModalScrollDuringGesture = (0, react.useRef)(false);
|
|
60
|
+
const isModalScrollInteracting = (0, react.useRef)(false);
|
|
61
|
+
const modalScrollDismissTimeout = (0, react.useRef)(null);
|
|
62
|
+
const modalScrollStartOffset = (0, react.useRef)(null);
|
|
63
|
+
const [, forcePresenceRender] = (0, react.useState)(0);
|
|
64
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
65
|
+
const reducedMotion = reduceMotion || prefersReducedMotion;
|
|
66
|
+
const safeAreaInsets = (0, react_native_safe_area_context.useSafeAreaInsets)();
|
|
67
|
+
if (open) presenceState.current = "open";
|
|
68
|
+
else if (presenceState.current === "open") presenceState.current = "closing";
|
|
69
|
+
const isRendered = open || presenceState.current === "closing";
|
|
70
|
+
const { title: modalTitle, description: modalDescription, content: modalContent, actions: modalActions } = require_components_Modal_utils.separateChildren(children);
|
|
71
|
+
const hasTitleOrDescription = !!(modalTitle || titleProp || modalDescription || descriptionProp);
|
|
72
|
+
const shouldRenderHeader = !hideDismissButton || hasTitleOrDescription;
|
|
73
|
+
const hasContent = !!(modalContent || contentProp);
|
|
74
|
+
const shouldRenderScrim = includeScrim ?? true;
|
|
75
|
+
const closeLabel = closeAccessibilityLabel ?? closeAriaLabel;
|
|
76
|
+
const durationIn = reducedMotion ? 0 : ANIMATION_DURATION_IN;
|
|
77
|
+
const durationOut = reducedMotion ? 0 : ANIMATION_DURATION_OUT;
|
|
78
|
+
(0, react.useEffect)(() => {
|
|
79
|
+
if (open && !prevOpen.current) onOpen?.();
|
|
80
|
+
prevOpen.current = open;
|
|
81
|
+
}, [open, onOpen]);
|
|
82
|
+
(0, react.useEffect)(() => {
|
|
83
|
+
if (open) {
|
|
84
|
+
progress.value = HIDDEN_PROGRESS;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (!isRendered) return;
|
|
88
|
+
progress.value = (0, react_native_reanimated.withTiming)(HIDDEN_PROGRESS, {
|
|
89
|
+
duration: durationOut,
|
|
90
|
+
easing: ANIMATION_EASING_OUT
|
|
91
|
+
});
|
|
92
|
+
const timeout = setTimeout(() => {
|
|
93
|
+
if (presenceState.current === "closing") {
|
|
94
|
+
presenceState.current = "closed";
|
|
95
|
+
forcePresenceRender((revision) => revision + 1);
|
|
96
|
+
}
|
|
97
|
+
}, durationOut);
|
|
98
|
+
return () => clearTimeout(timeout);
|
|
99
|
+
}, [
|
|
100
|
+
durationOut,
|
|
101
|
+
isRendered,
|
|
102
|
+
open,
|
|
103
|
+
progress
|
|
104
|
+
]);
|
|
105
|
+
(0, react.useEffect)(() => {
|
|
106
|
+
if (!open || !isRendered) return;
|
|
107
|
+
if (durationIn === 0) {
|
|
108
|
+
progress.value = VISIBLE_PROGRESS;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const animationFrame = requestAnimationFrame(() => {
|
|
112
|
+
progress.value = (0, react_native_reanimated.withTiming)(VISIBLE_PROGRESS, {
|
|
113
|
+
duration: durationIn,
|
|
114
|
+
easing: ANIMATION_EASING_IN
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
return () => cancelAnimationFrame(animationFrame);
|
|
118
|
+
}, [
|
|
119
|
+
durationIn,
|
|
120
|
+
isRendered,
|
|
121
|
+
open,
|
|
122
|
+
progress
|
|
123
|
+
]);
|
|
124
|
+
const handleDismiss = (0, react.useCallback)(() => {
|
|
125
|
+
onClose?.();
|
|
126
|
+
}, [onClose]);
|
|
127
|
+
const clearModalScrollDismissTimeout = (0, react.useCallback)(() => {
|
|
128
|
+
if (modalScrollDismissTimeout.current) {
|
|
129
|
+
clearTimeout(modalScrollDismissTimeout.current);
|
|
130
|
+
modalScrollDismissTimeout.current = null;
|
|
131
|
+
}
|
|
132
|
+
}, []);
|
|
133
|
+
const handleModalScrollInteractionBegin = (0, react.useCallback)((event) => {
|
|
134
|
+
clearModalScrollDismissTimeout();
|
|
135
|
+
isModalScrollInteracting.current = true;
|
|
136
|
+
didModalScrollDuringGesture.current = false;
|
|
137
|
+
modalScrollStartOffset.current = event.nativeEvent.contentOffset;
|
|
138
|
+
}, [clearModalScrollDismissTimeout]);
|
|
139
|
+
const handleModalScroll = (0, react.useCallback)((event) => {
|
|
140
|
+
if (!isModalScrollInteracting.current || didModalScrollDuringGesture.current) return;
|
|
141
|
+
const startOffset = modalScrollStartOffset.current;
|
|
142
|
+
const currentOffset = event.nativeEvent.contentOffset;
|
|
143
|
+
if (!startOffset) return;
|
|
144
|
+
const movedX = Math.abs(currentOffset.x - startOffset.x);
|
|
145
|
+
const movedY = Math.abs(currentOffset.y - startOffset.y);
|
|
146
|
+
if (movedX > SCROLL_OFFSET_THRESHOLD || movedY > SCROLL_OFFSET_THRESHOLD) didModalScrollDuringGesture.current = true;
|
|
147
|
+
}, []);
|
|
148
|
+
const handleModalScrollInteractionEnd = (0, react.useCallback)(() => {
|
|
149
|
+
clearModalScrollDismissTimeout();
|
|
150
|
+
modalScrollDismissTimeout.current = setTimeout(() => {
|
|
151
|
+
isModalScrollInteracting.current = false;
|
|
152
|
+
didModalScrollDuringGesture.current = false;
|
|
153
|
+
modalScrollDismissTimeout.current = null;
|
|
154
|
+
modalScrollStartOffset.current = null;
|
|
155
|
+
}, SCROLL_DISMISS_SUPPRESSION_MS);
|
|
156
|
+
}, [clearModalScrollDismissTimeout]);
|
|
157
|
+
(0, react.useEffect)(() => clearModalScrollDismissTimeout, [clearModalScrollDismissTimeout]);
|
|
158
|
+
const handleScrimRelease = (0, react.useCallback)((absoluteX, absoluteY) => {
|
|
159
|
+
if (!dismissible) return;
|
|
160
|
+
if (!surfaceRef.current?.measureInWindow) return;
|
|
161
|
+
surfaceRef.current.measureInWindow((x, y, width, height) => {
|
|
162
|
+
if (require_components_Modal_utils.shouldDismissModalRelease({
|
|
163
|
+
x: absoluteX,
|
|
164
|
+
y: absoluteY
|
|
165
|
+
}, {
|
|
166
|
+
x,
|
|
167
|
+
y,
|
|
168
|
+
width,
|
|
169
|
+
height
|
|
170
|
+
})) onClose?.();
|
|
171
|
+
});
|
|
172
|
+
}, [dismissible, onClose]);
|
|
173
|
+
const handleOverlayTouchEndCapture = (0, react.useCallback)((event) => {
|
|
174
|
+
if (isModalScrollInteracting.current && didModalScrollDuringGesture.current) return;
|
|
175
|
+
const pagePoint = require_components_Modal_utils.getEventPagePoint(event);
|
|
176
|
+
if (!pagePoint) return;
|
|
177
|
+
handleScrimRelease(pagePoint.x, pagePoint.y);
|
|
178
|
+
}, [handleScrimRelease]);
|
|
179
|
+
const setSurfaceRef = (0, react.useCallback)((node) => {
|
|
180
|
+
surfaceRef.current = node;
|
|
181
|
+
if (typeof ref === "function") ref(node);
|
|
182
|
+
else if (ref) ref.current = node;
|
|
183
|
+
}, [ref]);
|
|
184
|
+
const handleClosePressIn = (0, react.useCallback)(() => {
|
|
185
|
+
closePressProgress.value = (0, react_native_reanimated.withTiming)(1, { duration: reducedMotion ? 0 : 120 });
|
|
186
|
+
}, [closePressProgress, reducedMotion]);
|
|
187
|
+
const handleClosePressOut = (0, react.useCallback)(() => {
|
|
188
|
+
closePressProgress.value = (0, react_native_reanimated.withTiming)(0, { duration: reducedMotion ? 0 : 120 });
|
|
189
|
+
}, [closePressProgress, reducedMotion]);
|
|
190
|
+
const animatedSurfaceStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({
|
|
191
|
+
opacity: (0, react_native_reanimated.interpolate)(progress.value, [VISIBLE_PROGRESS, HIDDEN_PROGRESS], [1, 0], "clamp"),
|
|
192
|
+
transform: [{ scale: (0, react_native_reanimated.interpolate)(progress.value, [VISIBLE_PROGRESS, HIDDEN_PROGRESS], [1, HIDDEN_SCALE], "clamp") }]
|
|
193
|
+
}));
|
|
194
|
+
const animatedCloseIconContainerStyle = (0, react_native_reanimated.useAnimatedStyle)(() => ({ backgroundColor: `rgba(29, 34, 40, ${(0, react_native_reanimated.interpolate)(closePressProgress.value, [0, 1], [0, .15], "clamp").toFixed(3)})` }));
|
|
195
|
+
const modalContextValue = (0, react.useMemo)(() => ({
|
|
196
|
+
scrollBehavior,
|
|
197
|
+
hasContent,
|
|
198
|
+
onScroll: handleModalScroll,
|
|
199
|
+
onScrollInteractionBegin: handleModalScrollInteractionBegin,
|
|
200
|
+
onScrollInteractionEnd: handleModalScrollInteractionEnd,
|
|
201
|
+
shouldRenderHeader
|
|
202
|
+
}), [
|
|
203
|
+
handleModalScroll,
|
|
204
|
+
handleModalScrollInteractionBegin,
|
|
205
|
+
handleModalScrollInteractionEnd,
|
|
206
|
+
hasContent,
|
|
207
|
+
scrollBehavior,
|
|
208
|
+
shouldRenderHeader
|
|
209
|
+
]);
|
|
210
|
+
if (!isRendered) return null;
|
|
211
|
+
const rootTokens = react_native.StyleSheet.flatten(generated_styles.modalStyles.root);
|
|
212
|
+
const gutter = react_native.StyleSheet.flatten(generated_styles.modalStyles.scrim).padding ?? 0;
|
|
213
|
+
const blurIntensity = rootTokens.backgroundBlurRadius ?? 0;
|
|
214
|
+
const showBlurBox = blurIntensity > 0 && (react_native.Platform.OS === "ios" || blurTarget != null);
|
|
215
|
+
const rootBackgroundColor = showBlurBox ? "transparent" : blurIntensity > 0 ? rootTokens.backgroundBlurColor ?? rootTokens.backgroundColor : rootTokens.backgroundColor;
|
|
216
|
+
const rootBorderRadius = rootTokens.borderRadius ?? 0;
|
|
217
|
+
const rootMaxHeight = scrollBehavior === "inside" ? require_components_Modal_utils.resolveModalDimension(maxHeight) : void 0;
|
|
218
|
+
const shouldFillHeight = fullHeight && scrollBehavior === "inside" && rootMaxHeight !== void 0;
|
|
219
|
+
const headerSpacingBottom = hasContent ? generated_styles.modalStyles.root.paddingVertical ?? 0 : 0;
|
|
220
|
+
const closeIconContainerSize = (generated_styles.modalStyles.closeIcon.fontSize ?? 0) + (generated_styles.modalStyles.closeIconContainer.padding ?? 0) * 2;
|
|
221
|
+
const closeIconOffset = closeIconContainerSize / 2;
|
|
222
|
+
const closeIconTop = generated_styles.modalStyles.root.paddingVertical ?? 0;
|
|
223
|
+
const closeIconRight = generated_styles.modalStyles.spacingHorizontal.paddingHorizontal ?? 0;
|
|
224
|
+
const surface = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
225
|
+
ref: setSurfaceRef,
|
|
226
|
+
accessibilityViewIsModal: true,
|
|
227
|
+
importantForAccessibility: "yes",
|
|
228
|
+
...viewProps,
|
|
229
|
+
onLayout,
|
|
230
|
+
style: [
|
|
231
|
+
generated_styles.modalStyles.root,
|
|
232
|
+
internalStyles.surface,
|
|
233
|
+
{
|
|
234
|
+
backgroundColor: rootBackgroundColor,
|
|
235
|
+
maxHeight: rootMaxHeight,
|
|
236
|
+
maxWidth: require_components_Modal_utils.resolveModalDimension(maxWidth),
|
|
237
|
+
height: shouldFillHeight ? rootMaxHeight : void 0,
|
|
238
|
+
width: fullWidth ? "100%" : void 0,
|
|
239
|
+
borderRadius: rootBorderRadius,
|
|
240
|
+
overflow: showBlurBox ? "hidden" : void 0
|
|
241
|
+
},
|
|
242
|
+
animatedSurfaceStyle,
|
|
243
|
+
style
|
|
244
|
+
],
|
|
245
|
+
children: [showBlurBox && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
246
|
+
style: react_native.StyleSheet.absoluteFill,
|
|
247
|
+
blur: blurIntensity,
|
|
248
|
+
blurTarget
|
|
249
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
250
|
+
pointerEvents: "none",
|
|
251
|
+
style: [react_native.StyleSheet.absoluteFill, {
|
|
252
|
+
backgroundColor: rootTokens.backgroundBlurColor,
|
|
253
|
+
borderRadius: rootBorderRadius
|
|
254
|
+
}]
|
|
255
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_Modal_ModalContext.ModalContext.Provider, {
|
|
256
|
+
value: modalContextValue,
|
|
257
|
+
children: [
|
|
258
|
+
!hideDismissButton && closeIcon !== false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Pressable.AnimatedPressable, {
|
|
259
|
+
accessibilityLabel: closeLabel,
|
|
260
|
+
accessibilityRole: "button",
|
|
261
|
+
hitSlop: 12,
|
|
262
|
+
onPress: onClose,
|
|
263
|
+
onPressIn: handleClosePressIn,
|
|
264
|
+
onPressOut: handleClosePressOut,
|
|
265
|
+
style: [
|
|
266
|
+
generated_styles.modalStyles.closeIconContainer,
|
|
267
|
+
internalStyles.closeIconContainer,
|
|
268
|
+
{
|
|
269
|
+
borderRadius: closeIconContainerSize,
|
|
270
|
+
right: closeIconRight,
|
|
271
|
+
top: closeIconTop,
|
|
272
|
+
transform: [{ translateX: closeIconOffset }, { translateY: -closeIconOffset }]
|
|
273
|
+
},
|
|
274
|
+
animatedCloseIconContainerStyle
|
|
275
|
+
],
|
|
276
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
277
|
+
icon: closeIcon,
|
|
278
|
+
variant: "outline",
|
|
279
|
+
size: generated_styles.modalStyles.closeIcon.iconSizeToken ?? "md",
|
|
280
|
+
style: generated_styles.modalStyles.closeIcon,
|
|
281
|
+
accessibilityElementsHidden: true,
|
|
282
|
+
importantForAccessibility: "no"
|
|
283
|
+
})
|
|
284
|
+
}),
|
|
285
|
+
shouldRenderHeader && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
286
|
+
style: [
|
|
287
|
+
generated_styles.modalStyles.spacingHorizontal,
|
|
288
|
+
internalStyles.header,
|
|
289
|
+
{ marginBottom: headerSpacingBottom }
|
|
290
|
+
],
|
|
291
|
+
children: hasTitleOrDescription && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
292
|
+
style: [internalStyles.titleDescriptionWrapper, { gap: generated_styles.modalStyles.titleDescriptionWrapper.gap }],
|
|
293
|
+
children: [modalTitle || (titleProp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Modal_ModalTitle.ModalTitle, { children: titleProp }) : null), modalDescription || (descriptionProp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Modal_ModalDescription.ModalDescription, { children: descriptionProp }) : null)]
|
|
294
|
+
})
|
|
295
|
+
}),
|
|
296
|
+
modalContent || (contentProp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Modal_ModalContent.ModalContent, { children: typeof contentProp === "string" || typeof contentProp === "number" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
297
|
+
color: "secondary",
|
|
298
|
+
variant: "ui1",
|
|
299
|
+
children: contentProp
|
|
300
|
+
}) : contentProp }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, { style: internalStyles.grow })),
|
|
301
|
+
modalActions || (actionsProp ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Modal_ModalActions.ModalActions, { children: actionsProp }) : null)
|
|
302
|
+
]
|
|
303
|
+
})]
|
|
304
|
+
});
|
|
305
|
+
const positionerInsetStyle = {
|
|
306
|
+
paddingTop: safeAreaInsets.top + gutter,
|
|
307
|
+
paddingRight: safeAreaInsets.right + gutter,
|
|
308
|
+
paddingBottom: safeAreaInsets.bottom + gutter,
|
|
309
|
+
paddingLeft: safeAreaInsets.left + gutter
|
|
310
|
+
};
|
|
311
|
+
const positionerStyle = [
|
|
312
|
+
internalStyles.positioner,
|
|
313
|
+
shouldFillHeight && internalStyles.fullHeightPositioner,
|
|
314
|
+
positionerInsetStyle
|
|
315
|
+
];
|
|
316
|
+
const outsidePositionerStyle = [internalStyles.outsidePositioner, positionerInsetStyle];
|
|
317
|
+
const positionedSurface = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
318
|
+
style: positionerStyle,
|
|
319
|
+
testID: "uds-modal-positioner",
|
|
320
|
+
children: surface
|
|
321
|
+
});
|
|
322
|
+
const overlay = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureHandlerRootView, {
|
|
323
|
+
style: react_native.StyleSheet.absoluteFill,
|
|
324
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
|
|
325
|
+
onTouchEndCapture: dismissible ? handleOverlayTouchEndCapture : void 0,
|
|
326
|
+
pointerEvents: "auto",
|
|
327
|
+
style: react_native.StyleSheet.absoluteFill,
|
|
328
|
+
testID: "uds-modal-overlay",
|
|
329
|
+
children: [
|
|
330
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_AndroidBackHandler.AndroidBackHandler, {
|
|
331
|
+
isOpen: open,
|
|
332
|
+
dismissible,
|
|
333
|
+
onDismiss: handleDismiss
|
|
334
|
+
}),
|
|
335
|
+
shouldRenderScrim && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Scrim.Scrim, {
|
|
336
|
+
translateY: progress,
|
|
337
|
+
openTranslateY: VISIBLE_PROGRESS,
|
|
338
|
+
closedTranslateY: HIDDEN_PROGRESS,
|
|
339
|
+
dismissible: false,
|
|
340
|
+
onDismiss: handleDismiss,
|
|
341
|
+
blurTarget
|
|
342
|
+
}),
|
|
343
|
+
scrollBehavior === "outside" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.ScrollView, {
|
|
344
|
+
alwaysBounceVertical: false,
|
|
345
|
+
bounces: false,
|
|
346
|
+
keyboardShouldPersistTaps: "handled",
|
|
347
|
+
onMomentumScrollEnd: handleModalScrollInteractionEnd,
|
|
348
|
+
onScroll: handleModalScroll,
|
|
349
|
+
onScrollBeginDrag: handleModalScrollInteractionBegin,
|
|
350
|
+
onScrollEndDrag: handleModalScrollInteractionEnd,
|
|
351
|
+
overScrollMode: "never",
|
|
352
|
+
scrollEventThrottle: 16,
|
|
353
|
+
contentContainerStyle: outsidePositionerStyle,
|
|
354
|
+
style: react_native.StyleSheet.absoluteFill,
|
|
355
|
+
children: surface
|
|
356
|
+
}) : positionedSurface
|
|
357
|
+
]
|
|
358
|
+
})
|
|
359
|
+
});
|
|
360
|
+
if (!portal) return overlay;
|
|
361
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_internal_Overlay_OverlayPortal.OverlayPortal, {
|
|
362
|
+
useFullWindowOverlay,
|
|
363
|
+
children: overlay
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
Modal.displayName = "Modal";
|
|
367
|
+
const internalStyles = react_native.StyleSheet.create({
|
|
368
|
+
positioner: {
|
|
369
|
+
alignItems: "center",
|
|
370
|
+
flexGrow: 1,
|
|
371
|
+
justifyContent: "center"
|
|
372
|
+
},
|
|
373
|
+
fullHeightPositioner: { flex: 1 },
|
|
374
|
+
outsidePositioner: {
|
|
375
|
+
alignItems: "center",
|
|
376
|
+
justifyContent: "center",
|
|
377
|
+
minHeight: "100%",
|
|
378
|
+
position: "relative"
|
|
379
|
+
},
|
|
380
|
+
surface: {
|
|
381
|
+
alignSelf: "center",
|
|
382
|
+
position: "relative",
|
|
383
|
+
zIndex: 1
|
|
384
|
+
},
|
|
385
|
+
closeIconContainer: {
|
|
386
|
+
alignItems: "center",
|
|
387
|
+
justifyContent: "center",
|
|
388
|
+
position: "absolute",
|
|
389
|
+
zIndex: 1
|
|
390
|
+
},
|
|
391
|
+
header: { alignItems: "stretch" },
|
|
392
|
+
titleDescriptionWrapper: { minWidth: 0 },
|
|
393
|
+
grow: { flexGrow: 1 }
|
|
394
|
+
});
|
|
395
|
+
//#endregion
|
|
396
|
+
exports.Modal = Modal;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
import { ModalProps } from "./types.cjs";
|
|
3
|
+
import * as _$react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/Modal/Modal.d.ts
|
|
6
|
+
declare const Modal: _$react.NamedExoticComponent<ModalProps>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Modal };
|
|
9
|
+
//# sourceMappingURL=Modal.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.cts","names":[],"sources":["../../../src/components/Modal/Modal.tsx"],"mappings":";;;;;cA2EM,KAAA,EAAK,OAAA,CAAA,oBAAA,CAAA,UAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","names":[],"sources":["../../../src/components/Modal/Modal.tsx"],"mappings":";;;;;cA2EM,KAAA,EAAK,OAAA,CAAA,oBAAA,CAAA,UAAA"}
|