@dloizides/ui-layout 1.31.0 → 1.33.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/CHANGELOG.md +8 -0
- package/dist/index.d.mts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +284 -172
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +211 -102
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React11 = require('react');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
var uiFeedback = require('@dloizides/ui-feedback');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -14,7 +14,7 @@ var rnWebHooks = require('@dloizides/rn-web-hooks');
|
|
|
14
14
|
|
|
15
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var React11__default = /*#__PURE__*/_interopDefault(React11);
|
|
18
18
|
|
|
19
19
|
// src/Section/Section.tsx
|
|
20
20
|
var styles = reactNative.StyleSheet.create({
|
|
@@ -26,7 +26,7 @@ var styles = reactNative.StyleSheet.create({
|
|
|
26
26
|
});
|
|
27
27
|
var Section = ({ children, style }) => {
|
|
28
28
|
const { theme } = uiFeedback.useUi();
|
|
29
|
-
const containerStyle =
|
|
29
|
+
const containerStyle = React11__default.default.useMemo(
|
|
30
30
|
() => [styles.card, { borderColor: theme.colors.border, backgroundColor: theme.colors.surface }, style],
|
|
31
31
|
[theme.colors.border, theme.colors.surface, style]
|
|
32
32
|
);
|
|
@@ -37,6 +37,7 @@ var Section = ({ children, style }) => {
|
|
|
37
37
|
var LAYOUT_TEST_IDS = {
|
|
38
38
|
headingText: "heading-text",
|
|
39
39
|
statusLabel: "status-label",
|
|
40
|
+
stickyPreview: "sticky-preview",
|
|
40
41
|
upgradePrompt: "upgrade-prompt",
|
|
41
42
|
upgradePromptCta: "upgrade-prompt-cta",
|
|
42
43
|
upgradePromptDismiss: "upgrade-prompt-dismiss",
|
|
@@ -124,7 +125,7 @@ var Heading = ({
|
|
|
124
125
|
testID
|
|
125
126
|
}) => {
|
|
126
127
|
const { theme } = uiFeedback.useUi();
|
|
127
|
-
const headingStyle =
|
|
128
|
+
const headingStyle = React11__default.default.useMemo(
|
|
128
129
|
() => [styles2.heading, { color: theme.colors.text }, style],
|
|
129
130
|
[theme.colors.text, style]
|
|
130
131
|
);
|
|
@@ -143,6 +144,7 @@ var DEFAULT_PADDING_H = 10;
|
|
|
143
144
|
var DEFAULT_PADDING_V = 4;
|
|
144
145
|
var DEFAULT_BORDER_RADIUS = 12;
|
|
145
146
|
var DEFAULT_FONT_SIZE = 12;
|
|
147
|
+
var ICON_GAP = 4;
|
|
146
148
|
var styles3 = reactNative.StyleSheet.create({
|
|
147
149
|
badge: {
|
|
148
150
|
paddingHorizontal: DEFAULT_PADDING_H,
|
|
@@ -152,6 +154,15 @@ var styles3 = reactNative.StyleSheet.create({
|
|
|
152
154
|
// Never wider than the container: a long label wraps inside the pill instead of being clipped.
|
|
153
155
|
maxWidth: "100%"
|
|
154
156
|
},
|
|
157
|
+
badgeWithIcon: {
|
|
158
|
+
flexDirection: "row",
|
|
159
|
+
alignItems: "center",
|
|
160
|
+
gap: ICON_GAP
|
|
161
|
+
},
|
|
162
|
+
badgeDashed: {
|
|
163
|
+
borderWidth: 1,
|
|
164
|
+
borderStyle: "dashed"
|
|
165
|
+
},
|
|
155
166
|
text: {
|
|
156
167
|
fontSize: DEFAULT_FONT_SIZE,
|
|
157
168
|
fontWeight: "600",
|
|
@@ -162,24 +173,130 @@ var StatusBadge = ({
|
|
|
162
173
|
label,
|
|
163
174
|
color,
|
|
164
175
|
backgroundColor,
|
|
176
|
+
icon,
|
|
177
|
+
dashed = false,
|
|
165
178
|
testID = LAYOUT_TEST_IDS.statusLabel,
|
|
166
179
|
accessibilityLabel,
|
|
167
180
|
accessibilityHint
|
|
168
181
|
}) => {
|
|
169
182
|
const { t } = uiFeedback.useUi();
|
|
170
|
-
const dynamicBadge =
|
|
171
|
-
const
|
|
172
|
-
|
|
183
|
+
const dynamicBadge = React11.useMemo(() => ({ backgroundColor }), [backgroundColor]);
|
|
184
|
+
const dashedColor = React11.useMemo(() => ({ borderColor: color }), [color]);
|
|
185
|
+
const dynamicText = React11.useMemo(() => ({ color }), [color]);
|
|
186
|
+
const hasIcon = icon !== void 0 && icon !== null;
|
|
187
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
173
188
|
reactNative.View,
|
|
174
189
|
{
|
|
175
190
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.statusBadgeHint),
|
|
176
191
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
177
|
-
style: [styles3.badge, dynamicBadge],
|
|
192
|
+
style: [styles3.badge, hasIcon && styles3.badgeWithIcon, dynamicBadge, dashed && styles3.badgeDashed, dashed && dashedColor],
|
|
178
193
|
testID,
|
|
179
|
-
children:
|
|
194
|
+
children: [
|
|
195
|
+
hasIcon ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, children: icon }) : null,
|
|
196
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles3.text, dynamicText], children: label })
|
|
197
|
+
]
|
|
180
198
|
}
|
|
181
199
|
);
|
|
182
200
|
};
|
|
201
|
+
|
|
202
|
+
// src/responsive.ts
|
|
203
|
+
var WEB_PLATFORM = "web";
|
|
204
|
+
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
205
|
+
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
206
|
+
}
|
|
207
|
+
function isPastStickyLine(sentinelTop, isIntersecting, topOffset) {
|
|
208
|
+
return !isIntersecting && sentinelTop < topOffset;
|
|
209
|
+
}
|
|
210
|
+
function useStuckSentinel(topOffset) {
|
|
211
|
+
const sentinelRef = React11.useRef(null);
|
|
212
|
+
const [isStuck, setIsStuck] = React11.useState(false);
|
|
213
|
+
React11.useEffect(() => {
|
|
214
|
+
const node = sentinelRef.current;
|
|
215
|
+
if (node === null || typeof IntersectionObserver === "undefined") return void 0;
|
|
216
|
+
const observer = new IntersectionObserver(
|
|
217
|
+
(entries) => {
|
|
218
|
+
const entry = entries[entries.length - 1];
|
|
219
|
+
if (entry !== void 0) setIsStuck(isPastStickyLine(entry.boundingClientRect.top, entry.isIntersecting, topOffset));
|
|
220
|
+
},
|
|
221
|
+
{ rootMargin: `-${topOffset}px 0px 0px 0px` }
|
|
222
|
+
);
|
|
223
|
+
observer.observe(node);
|
|
224
|
+
return () => observer.disconnect();
|
|
225
|
+
}, [topOffset]);
|
|
226
|
+
return { sentinelRef, isStuck };
|
|
227
|
+
}
|
|
228
|
+
var KEYBOARD_HEIGHT_RATIO = 0.75;
|
|
229
|
+
var INITIAL = { offsetTop: 0, keyboardOpen: false };
|
|
230
|
+
function isKeyboardOpen(visibleHeight, tallestHeight) {
|
|
231
|
+
return visibleHeight < tallestHeight * KEYBOARD_HEIGHT_RATIO;
|
|
232
|
+
}
|
|
233
|
+
function useVisibleViewport() {
|
|
234
|
+
const [state, setState] = React11.useState(INITIAL);
|
|
235
|
+
const tallest = React11.useRef({ width: 0, height: 0 });
|
|
236
|
+
React11.useEffect(() => {
|
|
237
|
+
const viewport = typeof window === "undefined" ? void 0 : window.visualViewport;
|
|
238
|
+
if (viewport === void 0 || viewport === null) return void 0;
|
|
239
|
+
const read = () => {
|
|
240
|
+
const unzoomedHeight = viewport.height * viewport.scale;
|
|
241
|
+
const unzoomedWidth = viewport.width * viewport.scale;
|
|
242
|
+
const widthChanged = tallest.current.width !== unzoomedWidth;
|
|
243
|
+
const height = widthChanged ? unzoomedHeight : Math.max(tallest.current.height, unzoomedHeight);
|
|
244
|
+
tallest.current = { width: unzoomedWidth, height };
|
|
245
|
+
const offsetTop = viewport.offsetTop;
|
|
246
|
+
const keyboardOpen = isKeyboardOpen(unzoomedHeight, height);
|
|
247
|
+
setState(
|
|
248
|
+
(previous) => previous.offsetTop === offsetTop && previous.keyboardOpen === keyboardOpen ? previous : { offsetTop, keyboardOpen }
|
|
249
|
+
);
|
|
250
|
+
};
|
|
251
|
+
read();
|
|
252
|
+
viewport.addEventListener("resize", read);
|
|
253
|
+
viewport.addEventListener("scroll", read);
|
|
254
|
+
return () => {
|
|
255
|
+
viewport.removeEventListener("resize", read);
|
|
256
|
+
viewport.removeEventListener("scroll", read);
|
|
257
|
+
};
|
|
258
|
+
}, []);
|
|
259
|
+
return state;
|
|
260
|
+
}
|
|
261
|
+
var STICKY_Z_INDEX = 5;
|
|
262
|
+
var styles4 = reactNative.StyleSheet.create({
|
|
263
|
+
sentinel: { height: 1, marginBottom: -1 },
|
|
264
|
+
compact: { borderBottomWidth: 1 }
|
|
265
|
+
});
|
|
266
|
+
var StickyPreview = ({
|
|
267
|
+
full,
|
|
268
|
+
compact,
|
|
269
|
+
forceCompact = false,
|
|
270
|
+
topOffset = 0,
|
|
271
|
+
accessibilityLabel,
|
|
272
|
+
testID = LAYOUT_TEST_IDS.stickyPreview
|
|
273
|
+
}) => {
|
|
274
|
+
const { theme } = uiFeedback.useUi();
|
|
275
|
+
const { offsetTop, keyboardOpen } = useVisibleViewport();
|
|
276
|
+
const { sentinelRef, isStuck } = useStuckSentinel(topOffset);
|
|
277
|
+
const isCompact = forceCompact || isStuck || keyboardOpen;
|
|
278
|
+
const pinned = React11.useMemo(() => {
|
|
279
|
+
const web = { position: "sticky", top: topOffset + offsetTop, zIndex: STICKY_Z_INDEX };
|
|
280
|
+
return reactNative.Platform.OS === WEB_PLATFORM ? web : {};
|
|
281
|
+
}, [offsetTop, topOffset]);
|
|
282
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
283
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, ref: sentinelRef, style: styles4.sentinel }),
|
|
284
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
285
|
+
reactNative.View,
|
|
286
|
+
{
|
|
287
|
+
accessibilityLabel,
|
|
288
|
+
role: "region",
|
|
289
|
+
style: [
|
|
290
|
+
pinned,
|
|
291
|
+
{ backgroundColor: theme.colors.background, borderColor: theme.colors.border },
|
|
292
|
+
isCompact && styles4.compact
|
|
293
|
+
],
|
|
294
|
+
testID,
|
|
295
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID: `${testID}-${isCompact ? "compact" : "full"}`, children: isCompact ? compact : full })
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] });
|
|
299
|
+
};
|
|
183
300
|
var TRACK_PADDING = 3;
|
|
184
301
|
var TRACK_RADIUS = 999;
|
|
185
302
|
var SEGMENT_RADIUS = 999;
|
|
@@ -191,7 +308,7 @@ var BORDER_WIDTH = 1;
|
|
|
191
308
|
var SEGMENT_BOX_SHADOW = "0px 1px 3px rgba(20, 30, 50, 0.1)";
|
|
192
309
|
var SHADOW_ELEVATION = 2;
|
|
193
310
|
var TRANSPARENT = "transparent";
|
|
194
|
-
var
|
|
311
|
+
var styles5 = reactNative.StyleSheet.create({
|
|
195
312
|
track: {
|
|
196
313
|
flexDirection: "row",
|
|
197
314
|
alignSelf: "flex-start",
|
|
@@ -236,7 +353,7 @@ function SegmentedControl({
|
|
|
236
353
|
{
|
|
237
354
|
accessibilityRole: "tablist",
|
|
238
355
|
"aria-label": accessibilityLabel,
|
|
239
|
-
style: [
|
|
356
|
+
style: [styles5.track, { backgroundColor: colors.background, borderColor: colors.border }, style],
|
|
240
357
|
testID,
|
|
241
358
|
children: options.map((opt) => {
|
|
242
359
|
const selected = opt.value === value;
|
|
@@ -249,13 +366,13 @@ function SegmentedControl({
|
|
|
249
366
|
accessibilityHint: opt.accessibilityHint,
|
|
250
367
|
onPress: () => onChange(opt.value),
|
|
251
368
|
style: [
|
|
252
|
-
|
|
253
|
-
selected ?
|
|
369
|
+
styles5.segment,
|
|
370
|
+
selected ? styles5.segmentSelected : null,
|
|
254
371
|
{ backgroundColor: selected ? colors.surface : TRANSPARENT }
|
|
255
372
|
],
|
|
256
373
|
testID: opt.testID,
|
|
257
374
|
...ariaSelectedProps(selected),
|
|
258
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
375
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.label, { color: selected ? colors.text : colors.textSecondary }], children: opt.label })
|
|
259
376
|
},
|
|
260
377
|
opt.value
|
|
261
378
|
);
|
|
@@ -316,8 +433,8 @@ function handleKeyDown(domNode, event) {
|
|
|
316
433
|
}
|
|
317
434
|
}
|
|
318
435
|
function useFocusTrap(containerRef, enabled, initialFocusTestID) {
|
|
319
|
-
const previousFocusRef =
|
|
320
|
-
|
|
436
|
+
const previousFocusRef = React11.useRef(null);
|
|
437
|
+
React11.useEffect(() => {
|
|
321
438
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
322
439
|
const domNode = containerRef.current;
|
|
323
440
|
if (!domNode) return;
|
|
@@ -392,7 +509,7 @@ var HEADING_PADDING_H = 16;
|
|
|
392
509
|
var HEADING_PADDING_TOP = 8;
|
|
393
510
|
var HEADING_PADDING_BOTTOM = 4;
|
|
394
511
|
var HEADING_LETTER_SPACING = 0.5;
|
|
395
|
-
var
|
|
512
|
+
var styles6 = reactNative.StyleSheet.create({
|
|
396
513
|
heading: {
|
|
397
514
|
fontSize: HEADING_FONT_SIZE,
|
|
398
515
|
fontWeight: HEADING_FONT_WEIGHT,
|
|
@@ -408,7 +525,7 @@ var MenuHeading = ({ testID, text }) => {
|
|
|
408
525
|
reactNative.Text,
|
|
409
526
|
{
|
|
410
527
|
accessibilityRole: "header",
|
|
411
|
-
style: [
|
|
528
|
+
style: [styles6.heading, { color: theme.colors.textSecondary }],
|
|
412
529
|
testID: `${testID}-menu-heading`,
|
|
413
530
|
children: text
|
|
414
531
|
}
|
|
@@ -429,7 +546,7 @@ var OPTION_PADDING_V = 12;
|
|
|
429
546
|
var ACCENT_BAR_WIDTH = 3;
|
|
430
547
|
var CHECK_GAP = 8;
|
|
431
548
|
var CHECK_GLYPH = "\u2713";
|
|
432
|
-
var
|
|
549
|
+
var styles7 = reactNative.StyleSheet.create({
|
|
433
550
|
option: {
|
|
434
551
|
paddingHorizontal: OPTION_PADDING_H,
|
|
435
552
|
paddingVertical: OPTION_PADDING_V,
|
|
@@ -461,23 +578,23 @@ var OptionRow = ({
|
|
|
461
578
|
}) => {
|
|
462
579
|
const { theme, t } = uiFeedback.useUi();
|
|
463
580
|
const { colors } = theme;
|
|
464
|
-
const handlePress =
|
|
581
|
+
const handlePress = React11.useCallback(() => {
|
|
465
582
|
onSelect();
|
|
466
583
|
}, [onSelect]);
|
|
467
584
|
const accentColor = theme.palette.primary["500"];
|
|
468
585
|
const isMarked = selectedMarker === "accent-check" /* AccentCheck */;
|
|
469
586
|
const isActive = isSelected || isHighlighted;
|
|
470
587
|
const rowStyle = [
|
|
471
|
-
|
|
472
|
-
isMarked ?
|
|
588
|
+
styles7.option,
|
|
589
|
+
isMarked ? styles7.markedRow : null,
|
|
473
590
|
isActive ? { backgroundColor: colors.surfaceElevated } : null,
|
|
474
591
|
isMarked && isSelected ? { borderLeftColor: accentColor } : null
|
|
475
592
|
];
|
|
476
593
|
const textStyle = [
|
|
477
|
-
|
|
594
|
+
styles7.optionText,
|
|
478
595
|
{ color: colors.text },
|
|
479
|
-
isSelected ?
|
|
480
|
-
isMarked ?
|
|
596
|
+
isSelected ? styles7.selectedText : null,
|
|
597
|
+
isMarked ? styles7.markedText : null
|
|
481
598
|
];
|
|
482
599
|
const selectionProps = asMenuItem ? { "aria-current": isSelected ? "true" : void 0 } : { "aria-selected": isSelected };
|
|
483
600
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -493,7 +610,7 @@ var OptionRow = ({
|
|
|
493
610
|
onPress: handlePress,
|
|
494
611
|
children: [
|
|
495
612
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label }),
|
|
496
|
-
isMarked && isSelected ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, testID: `${testID}-check`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
613
|
+
isMarked && isSelected ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, testID: `${testID}-check`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles7.selectedText, { color: accentColor }], children: CHECK_GLYPH }) }) : null
|
|
497
614
|
]
|
|
498
615
|
}
|
|
499
616
|
);
|
|
@@ -550,8 +667,8 @@ function isSameRect(a, b) {
|
|
|
550
667
|
return a.top === b.top && a.left === b.left && a.width === b.width && a.bottom === b.bottom;
|
|
551
668
|
}
|
|
552
669
|
function useAnchorTracking(containerRef, onOutOfView) {
|
|
553
|
-
const [rect, setRect] =
|
|
554
|
-
|
|
670
|
+
const [rect, setRect] = React11.useState(() => readAnchorRect(containerRef));
|
|
671
|
+
React11.useLayoutEffect(() => {
|
|
555
672
|
if (!IS_WEB) return void 0;
|
|
556
673
|
let frame = null;
|
|
557
674
|
let isDisposed = false;
|
|
@@ -630,7 +747,7 @@ function buildKeyHandler(params) {
|
|
|
630
747
|
}
|
|
631
748
|
function useMenuKeyboard(params) {
|
|
632
749
|
const { containerRef, menuRef, enabled, onClose } = params;
|
|
633
|
-
|
|
750
|
+
React11.useEffect(() => {
|
|
634
751
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
635
752
|
const onKeyDown = buildKeyHandler(params);
|
|
636
753
|
const onMouseDown = (event) => {
|
|
@@ -651,7 +768,7 @@ var IS_WEB2 = reactNative.Platform.OS === "web";
|
|
|
651
768
|
var BORDER_RADIUS2 = 8;
|
|
652
769
|
var BORDER_WIDTH3 = 1;
|
|
653
770
|
var MENU_PADDING2 = 4;
|
|
654
|
-
var
|
|
771
|
+
var styles8 = reactNative.StyleSheet.create({
|
|
655
772
|
/** Native (in-tree) popover — anchored absolutely just under the trigger. */
|
|
656
773
|
popover: {
|
|
657
774
|
position: "absolute",
|
|
@@ -694,27 +811,27 @@ var InlineMenu = ({
|
|
|
694
811
|
}) => {
|
|
695
812
|
const { theme } = uiFeedback.useUi();
|
|
696
813
|
const { colors } = theme;
|
|
697
|
-
const menuRef =
|
|
814
|
+
const menuRef = React11.useRef(null);
|
|
698
815
|
const rect = useAnchorTracking(containerRef, onClose);
|
|
699
|
-
const selectedIndex =
|
|
816
|
+
const selectedIndex = React11.useMemo(
|
|
700
817
|
() => Math.max(0, options.findIndex((opt) => opt.value === value)),
|
|
701
818
|
[options, value]
|
|
702
819
|
);
|
|
703
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
704
|
-
const handleSelect =
|
|
820
|
+
const [highlightedIndex, setHighlightedIndex] = React11.useState(() => selectedIndex);
|
|
821
|
+
const handleSelect = React11.useCallback(
|
|
705
822
|
(optionValue) => {
|
|
706
823
|
if (isOpen) onSelect(optionValue);
|
|
707
824
|
},
|
|
708
825
|
[isOpen, onSelect]
|
|
709
826
|
);
|
|
710
|
-
const selectAt =
|
|
827
|
+
const selectAt = React11.useCallback(
|
|
711
828
|
(index) => {
|
|
712
829
|
const option = options[index];
|
|
713
830
|
if (option !== void 0) handleSelect(option.value);
|
|
714
831
|
},
|
|
715
832
|
[options, handleSelect]
|
|
716
833
|
);
|
|
717
|
-
const selectHighlighted =
|
|
834
|
+
const selectHighlighted = React11.useCallback(
|
|
718
835
|
() => {
|
|
719
836
|
selectAt(highlightedIndex);
|
|
720
837
|
},
|
|
@@ -729,7 +846,7 @@ var InlineMenu = ({
|
|
|
729
846
|
onSelectHighlighted: selectHighlighted,
|
|
730
847
|
onClose
|
|
731
848
|
});
|
|
732
|
-
const popoverStyle =
|
|
849
|
+
const popoverStyle = React11.useMemo(() => {
|
|
733
850
|
const themed = { borderColor: colors.border, backgroundColor: colors.surface };
|
|
734
851
|
if (IS_WEB2) {
|
|
735
852
|
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 0;
|
|
@@ -738,7 +855,7 @@ var InlineMenu = ({
|
|
|
738
855
|
themed
|
|
739
856
|
];
|
|
740
857
|
}
|
|
741
|
-
return [
|
|
858
|
+
return [styles8.popover, { minWidth: menuMinWidth }, themed];
|
|
742
859
|
}, [colors.border, colors.surface, menuMinWidth, rect]);
|
|
743
860
|
const menu = /* @__PURE__ */ jsxRuntime.jsx(
|
|
744
861
|
reactNative.View,
|
|
@@ -753,10 +870,10 @@ var InlineMenu = ({
|
|
|
753
870
|
reactNative.Animated.View,
|
|
754
871
|
{
|
|
755
872
|
pointerEvents: isOpen ? "auto" : "none",
|
|
756
|
-
style: [
|
|
873
|
+
style: [styles8.animated, animatedStyle, isOpen ? null : styles8.inert],
|
|
757
874
|
children: [
|
|
758
875
|
menuHeading !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MenuHeading, { testID, text: menuHeading }) : null,
|
|
759
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style:
|
|
876
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style: styles8.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
760
877
|
OptionRow,
|
|
761
878
|
{
|
|
762
879
|
asMenuItem: true,
|
|
@@ -777,14 +894,6 @@ var InlineMenu = ({
|
|
|
777
894
|
if (IS_WEB2) return reactDom.createPortal(menu, document.body);
|
|
778
895
|
return menu;
|
|
779
896
|
};
|
|
780
|
-
|
|
781
|
-
// src/responsive.ts
|
|
782
|
-
var WEB_PLATFORM = "web";
|
|
783
|
-
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
784
|
-
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
// src/ModalDropdown/resolveDropdownVariant.ts
|
|
788
897
|
var MENU_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
789
898
|
function resolveDropdownVariant(explicit, width, platformOS) {
|
|
790
899
|
if (explicit !== void 0) return explicit;
|
|
@@ -812,7 +921,7 @@ var CARET_OPEN_ROTATION = "180deg";
|
|
|
812
921
|
var CARET_CLOSED_ROTATION = "0deg";
|
|
813
922
|
var POPOVER_ENTER_SCALE = 0.96;
|
|
814
923
|
var POPOVER_MOTION_MS = 120;
|
|
815
|
-
var
|
|
924
|
+
var styles9 = reactNative.StyleSheet.create({
|
|
816
925
|
anchor: { position: "relative" },
|
|
817
926
|
container: {
|
|
818
927
|
borderWidth: BORDER_WIDTH4,
|
|
@@ -882,7 +991,7 @@ var ModalDropdown = ({
|
|
|
882
991
|
const { colors } = theme;
|
|
883
992
|
const resolvedVariant = useResolvedDropdownVariant(variant);
|
|
884
993
|
const isMenu = resolvedVariant === "menu" /* Menu */;
|
|
885
|
-
const [isOpen, setIsOpen] =
|
|
994
|
+
const [isOpen, setIsOpen] = React11.useState(false);
|
|
886
995
|
const { a11yProps, hintNode } = a11y.useA11y({
|
|
887
996
|
label: accessibilityLabel,
|
|
888
997
|
hint: accessibilityHint,
|
|
@@ -890,10 +999,10 @@ var ModalDropdown = ({
|
|
|
890
999
|
state: { expanded: isOpen },
|
|
891
1000
|
testID
|
|
892
1001
|
});
|
|
893
|
-
const anchorRef =
|
|
894
|
-
const triggerRef =
|
|
1002
|
+
const anchorRef = React11.useRef(null);
|
|
1003
|
+
const triggerRef = React11.useRef(null);
|
|
895
1004
|
const popupProps = { "aria-haspopup": isMenu ? "menu" : "dialog" };
|
|
896
|
-
const dialogRef =
|
|
1005
|
+
const dialogRef = React11.useRef(null);
|
|
897
1006
|
useFocusTrap(dialogRef, isOpen && !isMenu);
|
|
898
1007
|
const menuAnim = uiMotion.useEnterExit({
|
|
899
1008
|
visible: isMenu && isOpen,
|
|
@@ -905,17 +1014,17 @@ var ModalDropdown = ({
|
|
|
905
1014
|
fromScale: POPOVER_ENTER_SCALE,
|
|
906
1015
|
duration: POPOVER_MOTION_MS
|
|
907
1016
|
});
|
|
908
|
-
const selectedLabel =
|
|
1017
|
+
const selectedLabel = React11.useMemo(() => {
|
|
909
1018
|
const found = options.find((opt) => opt.value === value);
|
|
910
1019
|
return found?.label ?? t(LAYOUT_I18N.selectPlaceholder);
|
|
911
1020
|
}, [options, value, t]);
|
|
912
|
-
const handleToggle =
|
|
1021
|
+
const handleToggle = React11.useCallback(() => {
|
|
913
1022
|
setIsOpen((prev) => !prev);
|
|
914
1023
|
}, []);
|
|
915
|
-
const handleClose =
|
|
1024
|
+
const handleClose = React11.useCallback(() => {
|
|
916
1025
|
setIsOpen(false);
|
|
917
1026
|
}, []);
|
|
918
|
-
const handleSelect =
|
|
1027
|
+
const handleSelect = React11.useCallback(
|
|
919
1028
|
(optionValue) => {
|
|
920
1029
|
onChange(optionValue);
|
|
921
1030
|
setIsOpen(false);
|
|
@@ -925,38 +1034,38 @@ var ModalDropdown = ({
|
|
|
925
1034
|
);
|
|
926
1035
|
const isHamburger = showHamburger;
|
|
927
1036
|
const isCaret = showCaret && !isHamburger;
|
|
928
|
-
const containerStyle =
|
|
1037
|
+
const containerStyle = React11.useMemo(
|
|
929
1038
|
() => renderTrigger !== void 0 ? void 0 : [
|
|
930
|
-
|
|
931
|
-
isHamburger ?
|
|
1039
|
+
styles9.container,
|
|
1040
|
+
isHamburger ? styles9.containerHamburger : isCaret ? styles9.containerMenu : null,
|
|
932
1041
|
{ borderColor: colors.border, backgroundColor: colors.surface }
|
|
933
1042
|
],
|
|
934
1043
|
[colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
|
|
935
1044
|
);
|
|
936
|
-
const hamburgerStyle =
|
|
937
|
-
() => [
|
|
1045
|
+
const hamburgerStyle = React11.useMemo(
|
|
1046
|
+
() => [styles9.hamburger, { color: colors.textSecondary }],
|
|
938
1047
|
[colors.textSecondary]
|
|
939
1048
|
);
|
|
940
|
-
const caretStyle =
|
|
1049
|
+
const caretStyle = React11.useMemo(
|
|
941
1050
|
() => [
|
|
942
|
-
|
|
1051
|
+
styles9.caret,
|
|
943
1052
|
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
944
1053
|
],
|
|
945
1054
|
[colors.textSecondary, isOpen]
|
|
946
1055
|
);
|
|
947
|
-
const optionTestIDFor =
|
|
1056
|
+
const optionTestIDFor = React11.useCallback(
|
|
948
1057
|
(optionValue) => optionTestID !== void 0 ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,
|
|
949
1058
|
[optionTestID, testID]
|
|
950
1059
|
);
|
|
951
|
-
const anchorStyle =
|
|
952
|
-
() => [
|
|
1060
|
+
const anchorStyle = React11.useMemo(
|
|
1061
|
+
() => [styles9.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
953
1062
|
[isMenu, isOpen]
|
|
954
1063
|
);
|
|
955
|
-
const modalContentStyle =
|
|
956
|
-
() => [
|
|
1064
|
+
const modalContentStyle = React11.useMemo(
|
|
1065
|
+
() => [styles9.modalContent, { backgroundColor: colors.surface }],
|
|
957
1066
|
[colors.surface]
|
|
958
1067
|
);
|
|
959
|
-
const renderModalOption =
|
|
1068
|
+
const renderModalOption = React11.useCallback(
|
|
960
1069
|
({ item }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
961
1070
|
OptionRow,
|
|
962
1071
|
{
|
|
@@ -969,16 +1078,16 @@ var ModalDropdown = ({
|
|
|
969
1078
|
),
|
|
970
1079
|
[handleSelect, optionTestIDFor, selectedMarker, value]
|
|
971
1080
|
);
|
|
972
|
-
const keyExtractor =
|
|
1081
|
+
const keyExtractor = React11.useCallback((item) => String(item.value), []);
|
|
973
1082
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: anchorStyle, children: [
|
|
974
1083
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, ...popupProps, ref: triggerRef, style: containerStyle, onPress: handleToggle, children: [
|
|
975
1084
|
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
976
1085
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: hamburgerStyle, children: HAMBURGER_GLYPH }),
|
|
977
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [
|
|
1086
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles9.selectedText, styles9.selectedTextMenu, { color: colors.text }], children: selectedLabel })
|
|
978
1087
|
] }) : isCaret ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
979
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [
|
|
1088
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles9.selectedText, styles9.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
|
|
980
1089
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: caretStyle, children: CARET_GLYPH })
|
|
981
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1090
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.selectedText, { color: colors.text }], children: selectedLabel }),
|
|
982
1091
|
hintNode
|
|
983
1092
|
] }),
|
|
984
1093
|
isMenu && menuAnim.mounted ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -999,7 +1108,7 @@ var ModalDropdown = ({
|
|
|
999
1108
|
onSelect: handleSelect
|
|
1000
1109
|
}
|
|
1001
1110
|
) : null,
|
|
1002
|
-
!isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1111
|
+
!isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles9.modalOverlay, children: [
|
|
1003
1112
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
1113
|
reactNative.TouchableOpacity,
|
|
1005
1114
|
{
|
|
@@ -1045,11 +1154,11 @@ var TabsMenu = ({
|
|
|
1045
1154
|
collapsedTrigger = "caret" /* Caret */
|
|
1046
1155
|
}) => {
|
|
1047
1156
|
const { t } = uiFeedback.useUi();
|
|
1048
|
-
const options =
|
|
1157
|
+
const options = React11.useMemo(
|
|
1049
1158
|
() => tabs.map((tab) => ({ label: tab.label, value: tab.key })),
|
|
1050
1159
|
[tabs]
|
|
1051
1160
|
);
|
|
1052
|
-
const optionTestID =
|
|
1161
|
+
const optionTestID = React11.useCallback(
|
|
1053
1162
|
(key) => {
|
|
1054
1163
|
const found = tabs.find((tab) => tab.key === key);
|
|
1055
1164
|
return found?.testID ?? `${idPrefix}-tab-${key}`;
|
|
@@ -1092,7 +1201,7 @@ var ROW_PAD_V = 8;
|
|
|
1092
1201
|
var PANEL_PAD_TOP = 16;
|
|
1093
1202
|
var BORDER_WIDTH5 = 1;
|
|
1094
1203
|
var TEXT_ON_PRIMARY = "#ffffff";
|
|
1095
|
-
var
|
|
1204
|
+
var styles10 = reactNative.StyleSheet.create({
|
|
1096
1205
|
root: {
|
|
1097
1206
|
width: "100%"
|
|
1098
1207
|
},
|
|
@@ -1146,7 +1255,7 @@ var WideTabStrip = ({
|
|
|
1146
1255
|
textSecondary,
|
|
1147
1256
|
surfaceElevated,
|
|
1148
1257
|
stripStyle
|
|
1149
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [
|
|
1258
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles10.stripOuter, { borderBottomColor: borderColor }], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "tablist", "aria-label": accessibilityLabel, style: [styles10.strip, stripStyle], children: tabs.map((tab) => {
|
|
1150
1259
|
const selected = tab.key === activeKey;
|
|
1151
1260
|
const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;
|
|
1152
1261
|
const pillColor = selected ? primaryColor : surfaceElevated;
|
|
@@ -1160,10 +1269,10 @@ var WideTabStrip = ({
|
|
|
1160
1269
|
accessibilityLabel: tab.accessibilityLabel ?? tab.label,
|
|
1161
1270
|
accessibilityHint: tab.accessibilityHint,
|
|
1162
1271
|
onPress: () => onChange(tab.key),
|
|
1163
|
-
style: [
|
|
1272
|
+
style: [styles10.pill, { backgroundColor: pillColor }],
|
|
1164
1273
|
testID: tab.testID,
|
|
1165
1274
|
...ariaTabProps(selected, panelId, tabId),
|
|
1166
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1275
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.pillText, { color: textColor }], children: tab.label })
|
|
1167
1276
|
},
|
|
1168
1277
|
tab.key
|
|
1169
1278
|
);
|
|
@@ -1188,7 +1297,7 @@ var Tabs = ({
|
|
|
1188
1297
|
const activePanelId = `${idPrefix}-panel-${activeKey}`;
|
|
1189
1298
|
const activeTabId = `${idPrefix}-tab-${activeKey}`;
|
|
1190
1299
|
const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
|
|
1191
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
1300
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles10.root, style], testID, children: [
|
|
1192
1301
|
collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1193
1302
|
TabsMenu,
|
|
1194
1303
|
{
|
|
@@ -1215,7 +1324,7 @@ var Tabs = ({
|
|
|
1215
1324
|
onChange
|
|
1216
1325
|
}
|
|
1217
1326
|
),
|
|
1218
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [
|
|
1327
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [styles10.panel, panelStyle], ...panelAria, children })
|
|
1219
1328
|
] });
|
|
1220
1329
|
};
|
|
1221
1330
|
var PROMPT_PADDING = 20;
|
|
@@ -1230,7 +1339,7 @@ var DISMISS_FONT_SIZE = 13;
|
|
|
1230
1339
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
1231
1340
|
var MESSAGE_MARGIN_BOTTOM = 16;
|
|
1232
1341
|
var CTA_MARGIN_BOTTOM = 8;
|
|
1233
|
-
var
|
|
1342
|
+
var styles11 = reactNative.StyleSheet.create({
|
|
1234
1343
|
container: {
|
|
1235
1344
|
padding: PROMPT_PADDING,
|
|
1236
1345
|
borderRadius: PROMPT_BORDER_RADIUS,
|
|
@@ -1265,21 +1374,21 @@ var UpgradePrompt = ({
|
|
|
1265
1374
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1266
1375
|
reactNative.View,
|
|
1267
1376
|
{
|
|
1268
|
-
style: [
|
|
1377
|
+
style: [styles11.container, { borderColor: primary, backgroundColor: colors.surface }],
|
|
1269
1378
|
testID: LAYOUT_TEST_IDS.upgradePrompt,
|
|
1270
1379
|
children: [
|
|
1271
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1272
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1380
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
|
|
1381
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
|
|
1273
1382
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1274
1383
|
reactNative.TouchableOpacity,
|
|
1275
1384
|
{
|
|
1276
1385
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
|
|
1277
1386
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
|
|
1278
1387
|
accessibilityRole: "button",
|
|
1279
|
-
style: [
|
|
1388
|
+
style: [styles11.cta, { backgroundColor: primary }],
|
|
1280
1389
|
testID: LAYOUT_TEST_IDS.upgradePromptCta,
|
|
1281
1390
|
onPress: handleUpgradePress,
|
|
1282
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1391
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
|
|
1283
1392
|
}
|
|
1284
1393
|
),
|
|
1285
1394
|
onDismiss ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1288,10 +1397,10 @@ var UpgradePrompt = ({
|
|
|
1288
1397
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
|
|
1289
1398
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
|
|
1290
1399
|
accessibilityRole: "button",
|
|
1291
|
-
style:
|
|
1400
|
+
style: styles11.dismiss,
|
|
1292
1401
|
testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
|
|
1293
1402
|
onPress: onDismiss,
|
|
1294
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1403
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
|
|
1295
1404
|
}
|
|
1296
1405
|
) : null
|
|
1297
1406
|
]
|
|
@@ -1300,7 +1409,7 @@ var UpgradePrompt = ({
|
|
|
1300
1409
|
};
|
|
1301
1410
|
var CLOSE_ICON_SIZE = 18;
|
|
1302
1411
|
var PANEL_ENTER_SCALE = 0.96;
|
|
1303
|
-
var
|
|
1412
|
+
var styles12 = reactNative.StyleSheet.create({
|
|
1304
1413
|
animatedFill: { flex: 1 },
|
|
1305
1414
|
container: {
|
|
1306
1415
|
flex: 1,
|
|
@@ -1326,8 +1435,8 @@ var ModalShell = ({
|
|
|
1326
1435
|
}) => {
|
|
1327
1436
|
const { theme, t } = uiFeedback.useUi();
|
|
1328
1437
|
const { style: sheetStyle, mounted } = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });
|
|
1329
|
-
const containerStyle =
|
|
1330
|
-
() => [
|
|
1438
|
+
const containerStyle = React11__default.default.useMemo(
|
|
1439
|
+
() => [styles12.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1331
1440
|
[theme.colors.background, contentStyle]
|
|
1332
1441
|
);
|
|
1333
1442
|
const closeA11yLabel = t(LAYOUT_I18N.close);
|
|
@@ -1339,7 +1448,7 @@ var ModalShell = ({
|
|
|
1339
1448
|
testID: LAYOUT_TEST_IDS.modalShell,
|
|
1340
1449
|
visible: mounted,
|
|
1341
1450
|
onRequestClose: onCancel,
|
|
1342
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [
|
|
1451
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles12.animatedFill, sheetStyle], children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1343
1452
|
reactNative.ScrollView,
|
|
1344
1453
|
{
|
|
1345
1454
|
accessibilityViewIsModal: true,
|
|
@@ -1347,7 +1456,7 @@ var ModalShell = ({
|
|
|
1347
1456
|
role: "dialog",
|
|
1348
1457
|
style: containerStyle,
|
|
1349
1458
|
children: [
|
|
1350
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1459
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles12.headerRow, children: [
|
|
1351
1460
|
/* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
|
|
1352
1461
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1353
1462
|
reactNative.TouchableOpacity,
|
|
@@ -1355,7 +1464,7 @@ var ModalShell = ({
|
|
|
1355
1464
|
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1356
1465
|
accessibilityLabel: closeA11yLabel,
|
|
1357
1466
|
accessibilityRole: "button",
|
|
1358
|
-
style:
|
|
1467
|
+
style: styles12.closeButton,
|
|
1359
1468
|
testID: LAYOUT_TEST_IDS.modalShellClose,
|
|
1360
1469
|
onPress: onCancel,
|
|
1361
1470
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
|
|
@@ -1370,7 +1479,7 @@ var ModalShell = ({
|
|
|
1370
1479
|
);
|
|
1371
1480
|
};
|
|
1372
1481
|
function useEscapeKey(enabled, onClose) {
|
|
1373
|
-
|
|
1482
|
+
React11.useEffect(() => {
|
|
1374
1483
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1375
1484
|
const onKeyDown = (event) => {
|
|
1376
1485
|
if (event.key === "Escape") onClose();
|
|
@@ -1382,7 +1491,7 @@ function useEscapeKey(enabled, onClose) {
|
|
|
1382
1491
|
}, [enabled, onClose]);
|
|
1383
1492
|
}
|
|
1384
1493
|
function useScrollLock(enabled) {
|
|
1385
|
-
|
|
1494
|
+
React11.useEffect(() => {
|
|
1386
1495
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1387
1496
|
const { body } = document;
|
|
1388
1497
|
const previousOverflow = body.style.overflow;
|
|
@@ -1401,7 +1510,7 @@ var HEADER_MARGIN = 12;
|
|
|
1401
1510
|
var DIALOG_MAX_HEIGHT = "90%";
|
|
1402
1511
|
var PANEL_ENTER_SCALE2 = 0.96;
|
|
1403
1512
|
var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640 };
|
|
1404
|
-
var
|
|
1513
|
+
var styles13 = reactNative.StyleSheet.create({
|
|
1405
1514
|
overlay: {
|
|
1406
1515
|
flex: 1,
|
|
1407
1516
|
justifyContent: "center",
|
|
@@ -1443,7 +1552,7 @@ var Modal3 = ({
|
|
|
1443
1552
|
initialFocusTestID
|
|
1444
1553
|
}) => {
|
|
1445
1554
|
const { theme, t } = uiFeedback.useUi();
|
|
1446
|
-
const dialogRef =
|
|
1555
|
+
const dialogRef = React11.useRef(null);
|
|
1447
1556
|
const backdrop = uiMotion.useEnterExit({ visible });
|
|
1448
1557
|
const panel = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE2 });
|
|
1449
1558
|
const mounted = panel.mounted || backdrop.mounted;
|
|
@@ -1452,16 +1561,16 @@ var Modal3 = ({
|
|
|
1452
1561
|
useScrollLock(visible);
|
|
1453
1562
|
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
1454
1563
|
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
1455
|
-
const dialogStyle =
|
|
1456
|
-
() => [
|
|
1564
|
+
const dialogStyle = React11.useMemo(
|
|
1565
|
+
() => [styles13.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
1457
1566
|
[theme.colors.surface, size]
|
|
1458
1567
|
);
|
|
1459
1568
|
const hasHeader = title !== void 0 || showClose;
|
|
1460
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1569
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles13.overlay, children: [
|
|
1461
1570
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1462
1571
|
reactNative.Animated.View,
|
|
1463
1572
|
{
|
|
1464
|
-
style: [reactNative.StyleSheet.absoluteFill,
|
|
1573
|
+
style: [reactNative.StyleSheet.absoluteFill, styles13.scrim, { opacity: backdrop.style.opacity }]
|
|
1465
1574
|
}
|
|
1466
1575
|
),
|
|
1467
1576
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1487,8 +1596,8 @@ var Modal3 = ({
|
|
|
1487
1596
|
style: [dialogStyle, panel.style],
|
|
1488
1597
|
testID,
|
|
1489
1598
|
children: [
|
|
1490
|
-
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1491
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
1599
|
+
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles13.headerRow, children: [
|
|
1600
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles13.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title }) : null }),
|
|
1492
1601
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1493
1602
|
uiButtons.IconButton,
|
|
1494
1603
|
{
|
|
@@ -1505,7 +1614,7 @@ var Modal3 = ({
|
|
|
1505
1614
|
) : null
|
|
1506
1615
|
] }) : null,
|
|
1507
1616
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children }),
|
|
1508
|
-
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
1617
|
+
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles13.footer, children: footer }) : null
|
|
1509
1618
|
]
|
|
1510
1619
|
}
|
|
1511
1620
|
)
|
|
@@ -1514,7 +1623,7 @@ var Modal3 = ({
|
|
|
1514
1623
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
1515
1624
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
1516
1625
|
var BUTTON_GAP = 12;
|
|
1517
|
-
var
|
|
1626
|
+
var styles14 = reactNative.StyleSheet.create({
|
|
1518
1627
|
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
|
|
1519
1628
|
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
1520
1629
|
});
|
|
@@ -1533,7 +1642,7 @@ var ConfirmDialog = ({
|
|
|
1533
1642
|
const { theme, t } = uiFeedback.useUi();
|
|
1534
1643
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
1535
1644
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
1536
|
-
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1645
|
+
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.footer, children: [
|
|
1537
1646
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1538
1647
|
uiButtons.Button,
|
|
1539
1648
|
{
|
|
@@ -1569,27 +1678,27 @@ var ConfirmDialog = ({
|
|
|
1569
1678
|
title,
|
|
1570
1679
|
visible,
|
|
1571
1680
|
onClose: onCancel,
|
|
1572
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1681
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
|
|
1573
1682
|
}
|
|
1574
1683
|
);
|
|
1575
1684
|
};
|
|
1576
|
-
var AccordionContext =
|
|
1685
|
+
var AccordionContext = React11.createContext(null);
|
|
1577
1686
|
function useAccordionContext() {
|
|
1578
|
-
const value =
|
|
1687
|
+
const value = React11.useContext(AccordionContext);
|
|
1579
1688
|
if (value === null) {
|
|
1580
1689
|
throw new Error("AccordionItem must be rendered inside an <Accordion>.");
|
|
1581
1690
|
}
|
|
1582
1691
|
return value;
|
|
1583
1692
|
}
|
|
1584
1693
|
var BOXED_GAP = 12;
|
|
1585
|
-
var
|
|
1694
|
+
var styles15 = reactNative.StyleSheet.create({
|
|
1586
1695
|
container: { alignSelf: "stretch" },
|
|
1587
1696
|
boxed: { gap: BOXED_GAP }
|
|
1588
1697
|
});
|
|
1589
1698
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
1590
1699
|
const ids = new Set(defaultOpenIds ?? []);
|
|
1591
|
-
|
|
1592
|
-
if (!
|
|
1700
|
+
React11__default.default.Children.forEach(children, (child) => {
|
|
1701
|
+
if (!React11__default.default.isValidElement(child)) return;
|
|
1593
1702
|
const props = child.props;
|
|
1594
1703
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
1595
1704
|
ids.add(props.id);
|
|
@@ -1612,14 +1721,14 @@ var Accordion = ({
|
|
|
1612
1721
|
style
|
|
1613
1722
|
}) => {
|
|
1614
1723
|
const isControlled = openIds !== void 0;
|
|
1615
|
-
const [internalOpen, setInternalOpen] =
|
|
1724
|
+
const [internalOpen, setInternalOpen] = React11.useState(
|
|
1616
1725
|
() => computeInitialOpen(children, defaultOpenIds, allowMultiple)
|
|
1617
1726
|
);
|
|
1618
|
-
const openSet =
|
|
1727
|
+
const openSet = React11.useMemo(
|
|
1619
1728
|
() => isControlled ? new Set(openIds) : internalOpen,
|
|
1620
1729
|
[isControlled, openIds, internalOpen]
|
|
1621
1730
|
);
|
|
1622
|
-
const toggle =
|
|
1731
|
+
const toggle = React11.useCallback(
|
|
1623
1732
|
(id) => {
|
|
1624
1733
|
const next = new Set(openSet);
|
|
1625
1734
|
const willOpen = !next.has(id);
|
|
@@ -1634,12 +1743,12 @@ var Accordion = ({
|
|
|
1634
1743
|
},
|
|
1635
1744
|
[allowMultiple, isControlled, onOpenChange, openSet]
|
|
1636
1745
|
);
|
|
1637
|
-
const contextValue =
|
|
1746
|
+
const contextValue = React11.useMemo(
|
|
1638
1747
|
() => ({ openIds: openSet, toggle, allowMultiple, variant }),
|
|
1639
1748
|
[openSet, toggle, allowMultiple, variant]
|
|
1640
1749
|
);
|
|
1641
|
-
const containerStyle =
|
|
1642
|
-
const base = variant === "boxed" ? [
|
|
1750
|
+
const containerStyle = React11.useMemo(() => {
|
|
1751
|
+
const base = variant === "boxed" ? [styles15.container, styles15.boxed] : [styles15.container];
|
|
1643
1752
|
if (style === void 0) return base;
|
|
1644
1753
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1645
1754
|
}, [style, variant]);
|
|
@@ -1671,7 +1780,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1671
1780
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1672
1781
|
var BOX_MARKER_GAP = 6;
|
|
1673
1782
|
var BOX_MARKER = "\u25B8";
|
|
1674
|
-
var
|
|
1783
|
+
var styles16 = reactNative.StyleSheet.create({
|
|
1675
1784
|
item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
1676
1785
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1677
1786
|
header: {
|
|
@@ -1717,9 +1826,9 @@ var AccordionItem = ({
|
|
|
1717
1826
|
const headerTestID = testID ?? `accordion-item-${id}`;
|
|
1718
1827
|
const bodyTestID = `${headerTestID}-body`;
|
|
1719
1828
|
const chevronTestID = `${headerTestID}-chevron`;
|
|
1720
|
-
const [rotation] =
|
|
1829
|
+
const [rotation] = React11.useState(() => new reactNative.Animated.Value(expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED));
|
|
1721
1830
|
const reducedMotion = rnWebHooks.useReducedMotion();
|
|
1722
|
-
|
|
1831
|
+
React11.useEffect(() => {
|
|
1723
1832
|
reactNative.Animated.timing(rotation, {
|
|
1724
1833
|
toValue: expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED,
|
|
1725
1834
|
duration: reducedMotion ? INSTANT_DURATION_MS : ROTATE_DURATION_MS,
|
|
@@ -1731,10 +1840,10 @@ var AccordionItem = ({
|
|
|
1731
1840
|
inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],
|
|
1732
1841
|
outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG]
|
|
1733
1842
|
});
|
|
1734
|
-
const handlePress =
|
|
1843
|
+
const handlePress = React11.useCallback(() => {
|
|
1735
1844
|
if (!disabled) toggle(id);
|
|
1736
1845
|
}, [disabled, id, toggle]);
|
|
1737
|
-
const handleKeyDown2 =
|
|
1846
|
+
const handleKeyDown2 = React11.useCallback(
|
|
1738
1847
|
(event) => {
|
|
1739
1848
|
if (disabled) return;
|
|
1740
1849
|
const key = event.key ?? "";
|
|
@@ -1746,20 +1855,20 @@ var AccordionItem = ({
|
|
|
1746
1855
|
[disabled, id, toggle]
|
|
1747
1856
|
);
|
|
1748
1857
|
const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1749
|
-
const itemStyle =
|
|
1750
|
-
() => boxed ? [
|
|
1858
|
+
const itemStyle = React11.useMemo(
|
|
1859
|
+
() => boxed ? [styles16.boxItem, { borderColor: colors.border }] : [styles16.item, { borderTopColor: colors.border }],
|
|
1751
1860
|
[boxed, colors.border]
|
|
1752
1861
|
);
|
|
1753
|
-
const headerStyle =
|
|
1862
|
+
const headerStyle = React11.useMemo(
|
|
1754
1863
|
() => [
|
|
1755
|
-
|
|
1756
|
-
...boxed ? [
|
|
1864
|
+
styles16.header,
|
|
1865
|
+
...boxed ? [styles16.boxHeader] : [],
|
|
1757
1866
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1758
1867
|
],
|
|
1759
1868
|
[boxed, disabled]
|
|
1760
1869
|
);
|
|
1761
1870
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1762
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ?
|
|
1871
|
+
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ? styles16.boxTitle : styles16.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
|
|
1763
1872
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: itemStyle, children: [
|
|
1764
1873
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1765
1874
|
reactNative.Pressable,
|
|
@@ -1776,7 +1885,7 @@ var AccordionItem = ({
|
|
|
1776
1885
|
onPress: handlePress,
|
|
1777
1886
|
...keyboardProps,
|
|
1778
1887
|
children: [
|
|
1779
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
1888
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles16.headerLeft, boxed ? styles16.headerLeftRow : null], children: [
|
|
1780
1889
|
boxed ? (
|
|
1781
1890
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1782
1891
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1785,15 +1894,15 @@ var AccordionItem = ({
|
|
|
1785
1894
|
accessibilityElementsHidden: true,
|
|
1786
1895
|
"aria-hidden": true,
|
|
1787
1896
|
importantForAccessibility: "no-hide-descendants",
|
|
1788
|
-
style: [
|
|
1897
|
+
style: [styles16.marker, { transform: [{ rotate }] }],
|
|
1789
1898
|
testID: chevronTestID,
|
|
1790
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1899
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1791
1900
|
}
|
|
1792
1901
|
)
|
|
1793
1902
|
) : null,
|
|
1794
1903
|
titleNode
|
|
1795
1904
|
] }),
|
|
1796
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1905
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.headerRight, children: [
|
|
1797
1906
|
right,
|
|
1798
1907
|
boxed ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1799
1908
|
reactNative.Animated.View,
|
|
@@ -1801,7 +1910,7 @@ var AccordionItem = ({
|
|
|
1801
1910
|
accessibilityElementsHidden: true,
|
|
1802
1911
|
"aria-hidden": true,
|
|
1803
1912
|
importantForAccessibility: "no-hide-descendants",
|
|
1804
|
-
style: [
|
|
1913
|
+
style: [styles16.chevron, { transform: [{ rotate }] }],
|
|
1805
1914
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1806
1915
|
}
|
|
1807
1916
|
)
|
|
@@ -1815,7 +1924,7 @@ var AccordionItem = ({
|
|
|
1815
1924
|
accessibilityLabel: resolvedLabel,
|
|
1816
1925
|
nativeID: bodyTestID,
|
|
1817
1926
|
role: ROLE_REGION,
|
|
1818
|
-
style: boxed ?
|
|
1927
|
+
style: boxed ? styles16.boxBody : styles16.body,
|
|
1819
1928
|
testID: bodyTestID,
|
|
1820
1929
|
children
|
|
1821
1930
|
}
|
|
@@ -1853,14 +1962,14 @@ function measureParentInnerWidth(node) {
|
|
|
1853
1962
|
return Math.max(UNMEASURED, parent.clientWidth - padding);
|
|
1854
1963
|
}
|
|
1855
1964
|
function useAvailableWidth() {
|
|
1856
|
-
const [width, setWidth] =
|
|
1857
|
-
const nodeRef =
|
|
1858
|
-
const measureRef =
|
|
1965
|
+
const [width, setWidth] = React11.useState(UNMEASURED);
|
|
1966
|
+
const nodeRef = React11.useRef(null);
|
|
1967
|
+
const measureRef = React11.useCallback((node) => {
|
|
1859
1968
|
if (!IS_WEB3) return;
|
|
1860
1969
|
nodeRef.current = node;
|
|
1861
1970
|
if (nodeRef.current !== null) setWidth(measureParentInnerWidth(nodeRef.current));
|
|
1862
1971
|
}, []);
|
|
1863
|
-
|
|
1972
|
+
React11.useEffect(() => {
|
|
1864
1973
|
if (!IS_WEB3) return void 0;
|
|
1865
1974
|
const remeasure = () => {
|
|
1866
1975
|
const node = nodeRef.current;
|
|
@@ -1869,7 +1978,7 @@ function useAvailableWidth() {
|
|
|
1869
1978
|
window.addEventListener("resize", remeasure);
|
|
1870
1979
|
return () => window.removeEventListener("resize", remeasure);
|
|
1871
1980
|
}, []);
|
|
1872
|
-
const onLayout =
|
|
1981
|
+
const onLayout = React11.useCallback((event) => {
|
|
1873
1982
|
if (IS_WEB3) return;
|
|
1874
1983
|
setWidth(event.nativeEvent.layout.width);
|
|
1875
1984
|
}, []);
|
|
@@ -1878,7 +1987,7 @@ function useAvailableWidth() {
|
|
|
1878
1987
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
1879
1988
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
1880
1989
|
var UNMEASURED2 = 0;
|
|
1881
|
-
var
|
|
1990
|
+
var styles17 = reactNative.StyleSheet.create({
|
|
1882
1991
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
1883
1992
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
1884
1993
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -1898,8 +2007,8 @@ var TruncatedText = ({
|
|
|
1898
2007
|
accessibilityHint
|
|
1899
2008
|
}) => {
|
|
1900
2009
|
const { width, measureRef, onLayout } = useAvailableWidth();
|
|
1901
|
-
const hostRef =
|
|
1902
|
-
const attachRef =
|
|
2010
|
+
const hostRef = React11.useRef(null);
|
|
2011
|
+
const attachRef = React11.useCallback(
|
|
1903
2012
|
(node) => {
|
|
1904
2013
|
hostRef.current = node;
|
|
1905
2014
|
measureRef(node);
|
|
@@ -1908,12 +2017,12 @@ var TruncatedText = ({
|
|
|
1908
2017
|
},
|
|
1909
2018
|
[value, measureRef]
|
|
1910
2019
|
);
|
|
1911
|
-
const flatStyle =
|
|
1912
|
-
() => reactNative.StyleSheet.flatten([
|
|
2020
|
+
const flatStyle = React11.useMemo(
|
|
2021
|
+
() => reactNative.StyleSheet.flatten([styles17.base, style]),
|
|
1913
2022
|
[style]
|
|
1914
2023
|
);
|
|
1915
2024
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
1916
|
-
const display =
|
|
2025
|
+
const display = React11.useMemo(() => {
|
|
1917
2026
|
const source = isUrl ? formatUrlForDisplay(value) : value;
|
|
1918
2027
|
const budget = charBudget(width, fontSize);
|
|
1919
2028
|
return budget === UNMEASURED2 ? source : truncateMiddle(source, budget);
|
|
@@ -1924,7 +2033,7 @@ var TruncatedText = ({
|
|
|
1924
2033
|
ref: attachRef,
|
|
1925
2034
|
onLayout,
|
|
1926
2035
|
numberOfLines: 1,
|
|
1927
|
-
style: [
|
|
2036
|
+
style: [styles17.base, styles17.fill, style],
|
|
1928
2037
|
testID,
|
|
1929
2038
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
1930
2039
|
accessibilityLabel,
|
|
@@ -1995,17 +2104,17 @@ async function copyText(value, writer) {
|
|
|
1995
2104
|
// src/CopyableId/useCopyToClipboard.ts
|
|
1996
2105
|
var COPY_FEEDBACK_MS = 2e3;
|
|
1997
2106
|
function useCopyToClipboard(value, writer) {
|
|
1998
|
-
const [status, setStatus] =
|
|
1999
|
-
const timerRef =
|
|
2000
|
-
const mountedRef =
|
|
2001
|
-
|
|
2107
|
+
const [status, setStatus] = React11.useState("idle" /* Idle */);
|
|
2108
|
+
const timerRef = React11.useRef(null);
|
|
2109
|
+
const mountedRef = React11.useRef(true);
|
|
2110
|
+
React11.useEffect(() => {
|
|
2002
2111
|
mountedRef.current = true;
|
|
2003
2112
|
return () => {
|
|
2004
2113
|
mountedRef.current = false;
|
|
2005
2114
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
2006
2115
|
};
|
|
2007
2116
|
}, []);
|
|
2008
|
-
const copy =
|
|
2117
|
+
const copy = React11.useCallback(() => {
|
|
2009
2118
|
void (async () => {
|
|
2010
2119
|
const ok = await copyText(value, writer);
|
|
2011
2120
|
if (!mountedRef.current) return;
|
|
@@ -2027,7 +2136,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
2027
2136
|
var ACTION_PADDING_H = 6;
|
|
2028
2137
|
var ACTION_PADDING_V = 2;
|
|
2029
2138
|
var ACTION_RADIUS = 6;
|
|
2030
|
-
var
|
|
2139
|
+
var styles18 = reactNative.StyleSheet.create({
|
|
2031
2140
|
cell: { gap: CELL_GAP },
|
|
2032
2141
|
label: {
|
|
2033
2142
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -2069,7 +2178,7 @@ var styles17 = reactNative.StyleSheet.create({
|
|
|
2069
2178
|
var TONE_STEP = "500";
|
|
2070
2179
|
function useActionState(status) {
|
|
2071
2180
|
const { theme } = uiFeedback.useUi();
|
|
2072
|
-
return
|
|
2181
|
+
return React11.useMemo(() => {
|
|
2073
2182
|
const primary = theme.palette.primary[TONE_STEP];
|
|
2074
2183
|
if (status === "copied" /* Copied */) {
|
|
2075
2184
|
return { key: LAYOUT_I18N.copied, color: theme.semantic.success?.[TONE_STEP] ?? primary };
|
|
@@ -2092,14 +2201,14 @@ var CopyableId = ({
|
|
|
2092
2201
|
const { colors } = theme;
|
|
2093
2202
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
2094
2203
|
const action = useActionState(status);
|
|
2095
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2096
|
-
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2097
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2098
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2204
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles18.cell, style], testID, children: [
|
|
2205
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles18.label, { color: colors.textSecondary }], children: label }),
|
|
2206
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles18.row, children: [
|
|
2207
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles18.valueWrap, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2099
2208
|
TruncatedText,
|
|
2100
2209
|
{
|
|
2101
2210
|
value,
|
|
2102
|
-
style: [
|
|
2211
|
+
style: [styles18.value, { color: colors.text }],
|
|
2103
2212
|
testID: `${testID}-value`,
|
|
2104
2213
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
2105
2214
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -2113,7 +2222,7 @@ var CopyableId = ({
|
|
|
2113
2222
|
accessibilityLabel: t(action.key),
|
|
2114
2223
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
2115
2224
|
testID: `${testID}-copy`,
|
|
2116
|
-
style: [
|
|
2225
|
+
style: [styles18.action, { color: action.color }],
|
|
2117
2226
|
children: t(action.key)
|
|
2118
2227
|
}
|
|
2119
2228
|
)
|
|
@@ -2138,15 +2247,15 @@ function formatBuildInfo(buildVersion, apiCommit) {
|
|
|
2138
2247
|
return `${base}${API_COMMIT_SEPARATOR}${shortenCommit(commit)}`;
|
|
2139
2248
|
}
|
|
2140
2249
|
function useApiCommit(apiBaseUrl, fetchImpl) {
|
|
2141
|
-
const [commit, setCommit] =
|
|
2142
|
-
const mountedRef =
|
|
2143
|
-
|
|
2250
|
+
const [commit, setCommit] = React11.useState(void 0);
|
|
2251
|
+
const mountedRef = React11.useRef(true);
|
|
2252
|
+
React11.useEffect(() => {
|
|
2144
2253
|
mountedRef.current = true;
|
|
2145
2254
|
return () => {
|
|
2146
2255
|
mountedRef.current = false;
|
|
2147
2256
|
};
|
|
2148
2257
|
}, []);
|
|
2149
|
-
|
|
2258
|
+
React11.useEffect(() => {
|
|
2150
2259
|
if (apiBaseUrl === void 0 || apiBaseUrl === "") return;
|
|
2151
2260
|
const doFetch = fetchImpl ?? (typeof fetch !== "undefined" ? fetch : void 0);
|
|
2152
2261
|
if (doFetch === void 0) return;
|
|
@@ -2168,7 +2277,7 @@ var FOOTER_PADDING_V = 6;
|
|
|
2168
2277
|
var FOOTER_PADDING_H = 12;
|
|
2169
2278
|
var FOOTER_FONT_SIZE = 11;
|
|
2170
2279
|
var FOOTER_OPACITY = 0.75;
|
|
2171
|
-
var
|
|
2280
|
+
var styles19 = reactNative.StyleSheet.create({
|
|
2172
2281
|
footer: {
|
|
2173
2282
|
paddingVertical: FOOTER_PADDING_V,
|
|
2174
2283
|
paddingHorizontal: FOOTER_PADDING_H,
|
|
@@ -2193,8 +2302,8 @@ var BuildInfoFooter = ({
|
|
|
2193
2302
|
const fetchedCommit = useApiCommit(apiCommit === void 0 ? apiBaseUrl : void 0, fetchImpl);
|
|
2194
2303
|
const commit = apiCommit ?? fetchedCommit;
|
|
2195
2304
|
const label = formatBuildInfo(buildVersion, commit);
|
|
2196
|
-
const textStyle =
|
|
2197
|
-
() => [
|
|
2305
|
+
const textStyle = React11.useMemo(
|
|
2306
|
+
() => [styles19.text, { color: theme.colors.textSecondary }],
|
|
2198
2307
|
[theme.colors.textSecondary]
|
|
2199
2308
|
);
|
|
2200
2309
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2202,7 +2311,7 @@ var BuildInfoFooter = ({
|
|
|
2202
2311
|
{
|
|
2203
2312
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
2204
2313
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
|
|
2205
|
-
style: [
|
|
2314
|
+
style: [styles19.footer, style],
|
|
2206
2315
|
testID,
|
|
2207
2316
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label })
|
|
2208
2317
|
}
|
|
@@ -2233,6 +2342,7 @@ exports.Section = Section;
|
|
|
2233
2342
|
exports.SegmentedControl = SegmentedControl;
|
|
2234
2343
|
exports.SelectedMarker = SelectedMarker;
|
|
2235
2344
|
exports.StatusBadge = StatusBadge;
|
|
2345
|
+
exports.StickyPreview = StickyPreview;
|
|
2236
2346
|
exports.TYPE_SCALE_BREAKPOINT = TYPE_SCALE_BREAKPOINT;
|
|
2237
2347
|
exports.Tabs = Tabs;
|
|
2238
2348
|
exports.TabsCollapsedTrigger = TabsCollapsedTrigger;
|
|
@@ -2241,6 +2351,7 @@ exports.UpgradePrompt = UpgradePrompt;
|
|
|
2241
2351
|
exports.copyText = copyText;
|
|
2242
2352
|
exports.formatBuildInfo = formatBuildInfo;
|
|
2243
2353
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
2354
|
+
exports.isKeyboardOpen = isKeyboardOpen;
|
|
2244
2355
|
exports.isWideWebViewport = isWideWebViewport;
|
|
2245
2356
|
exports.shortenCommit = shortenCommit;
|
|
2246
2357
|
exports.trimTrailingSlash = trimTrailingSlash;
|
|
@@ -2248,5 +2359,6 @@ exports.truncateMiddle = truncateMiddle;
|
|
|
2248
2359
|
exports.useApiCommit = useApiCommit;
|
|
2249
2360
|
exports.useCopyToClipboard = useCopyToClipboard;
|
|
2250
2361
|
exports.useFocusTrap = useFocusTrap;
|
|
2362
|
+
exports.useVisibleViewport = useVisibleViewport;
|
|
2251
2363
|
//# sourceMappingURL=index.js.map
|
|
2252
2364
|
//# sourceMappingURL=index.js.map
|