@dloizides/ui-layout 1.30.0 → 1.32.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 +33 -3
- package/dist/index.d.ts +33 -3
- package/dist/index.js +330 -176
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +257 -107
- 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,11 @@ 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
|
+
},
|
|
155
162
|
text: {
|
|
156
163
|
fontSize: DEFAULT_FONT_SIZE,
|
|
157
164
|
fontWeight: "600",
|
|
@@ -162,24 +169,128 @@ var StatusBadge = ({
|
|
|
162
169
|
label,
|
|
163
170
|
color,
|
|
164
171
|
backgroundColor,
|
|
172
|
+
icon,
|
|
165
173
|
testID = LAYOUT_TEST_IDS.statusLabel,
|
|
166
174
|
accessibilityLabel,
|
|
167
175
|
accessibilityHint
|
|
168
176
|
}) => {
|
|
169
177
|
const { t } = uiFeedback.useUi();
|
|
170
|
-
const dynamicBadge =
|
|
171
|
-
const dynamicText =
|
|
172
|
-
|
|
178
|
+
const dynamicBadge = React11.useMemo(() => ({ backgroundColor }), [backgroundColor]);
|
|
179
|
+
const dynamicText = React11.useMemo(() => ({ color }), [color]);
|
|
180
|
+
const hasIcon = icon !== void 0 && icon !== null;
|
|
181
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
173
182
|
reactNative.View,
|
|
174
183
|
{
|
|
175
184
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.statusBadgeHint),
|
|
176
185
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
177
|
-
style: [styles3.badge, dynamicBadge],
|
|
186
|
+
style: [styles3.badge, hasIcon && styles3.badgeWithIcon, dynamicBadge],
|
|
178
187
|
testID,
|
|
179
|
-
children:
|
|
188
|
+
children: [
|
|
189
|
+
hasIcon ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, children: icon }) : null,
|
|
190
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles3.text, dynamicText], children: label })
|
|
191
|
+
]
|
|
180
192
|
}
|
|
181
193
|
);
|
|
182
194
|
};
|
|
195
|
+
|
|
196
|
+
// src/responsive.ts
|
|
197
|
+
var WEB_PLATFORM = "web";
|
|
198
|
+
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
199
|
+
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
200
|
+
}
|
|
201
|
+
function isPastStickyLine(sentinelTop, isIntersecting, topOffset) {
|
|
202
|
+
return !isIntersecting && sentinelTop < topOffset;
|
|
203
|
+
}
|
|
204
|
+
function useStuckSentinel(topOffset) {
|
|
205
|
+
const sentinelRef = React11.useRef(null);
|
|
206
|
+
const [isStuck, setIsStuck] = React11.useState(false);
|
|
207
|
+
React11.useEffect(() => {
|
|
208
|
+
const node = sentinelRef.current;
|
|
209
|
+
if (node === null || typeof IntersectionObserver === "undefined") return void 0;
|
|
210
|
+
const observer = new IntersectionObserver(
|
|
211
|
+
(entries) => {
|
|
212
|
+
const entry = entries[entries.length - 1];
|
|
213
|
+
if (entry !== void 0) setIsStuck(isPastStickyLine(entry.boundingClientRect.top, entry.isIntersecting, topOffset));
|
|
214
|
+
},
|
|
215
|
+
{ rootMargin: `-${topOffset}px 0px 0px 0px` }
|
|
216
|
+
);
|
|
217
|
+
observer.observe(node);
|
|
218
|
+
return () => observer.disconnect();
|
|
219
|
+
}, [topOffset]);
|
|
220
|
+
return { sentinelRef, isStuck };
|
|
221
|
+
}
|
|
222
|
+
var KEYBOARD_HEIGHT_RATIO = 0.75;
|
|
223
|
+
var INITIAL = { offsetTop: 0, keyboardOpen: false };
|
|
224
|
+
function isKeyboardOpen(visibleHeight, tallestHeight) {
|
|
225
|
+
return visibleHeight < tallestHeight * KEYBOARD_HEIGHT_RATIO;
|
|
226
|
+
}
|
|
227
|
+
function useVisibleViewport() {
|
|
228
|
+
const [state, setState] = React11.useState(INITIAL);
|
|
229
|
+
const tallest = React11.useRef({ width: 0, height: 0 });
|
|
230
|
+
React11.useEffect(() => {
|
|
231
|
+
const viewport = typeof window === "undefined" ? void 0 : window.visualViewport;
|
|
232
|
+
if (viewport === void 0 || viewport === null) return void 0;
|
|
233
|
+
const read = () => {
|
|
234
|
+
const unzoomedHeight = viewport.height * viewport.scale;
|
|
235
|
+
const unzoomedWidth = viewport.width * viewport.scale;
|
|
236
|
+
const widthChanged = tallest.current.width !== unzoomedWidth;
|
|
237
|
+
const height = widthChanged ? unzoomedHeight : Math.max(tallest.current.height, unzoomedHeight);
|
|
238
|
+
tallest.current = { width: unzoomedWidth, height };
|
|
239
|
+
const offsetTop = viewport.offsetTop;
|
|
240
|
+
const keyboardOpen = isKeyboardOpen(unzoomedHeight, height);
|
|
241
|
+
setState(
|
|
242
|
+
(previous) => previous.offsetTop === offsetTop && previous.keyboardOpen === keyboardOpen ? previous : { offsetTop, keyboardOpen }
|
|
243
|
+
);
|
|
244
|
+
};
|
|
245
|
+
read();
|
|
246
|
+
viewport.addEventListener("resize", read);
|
|
247
|
+
viewport.addEventListener("scroll", read);
|
|
248
|
+
return () => {
|
|
249
|
+
viewport.removeEventListener("resize", read);
|
|
250
|
+
viewport.removeEventListener("scroll", read);
|
|
251
|
+
};
|
|
252
|
+
}, []);
|
|
253
|
+
return state;
|
|
254
|
+
}
|
|
255
|
+
var STICKY_Z_INDEX = 5;
|
|
256
|
+
var styles4 = reactNative.StyleSheet.create({
|
|
257
|
+
sentinel: { height: 1, marginBottom: -1 },
|
|
258
|
+
compact: { borderBottomWidth: 1 }
|
|
259
|
+
});
|
|
260
|
+
var StickyPreview = ({
|
|
261
|
+
full,
|
|
262
|
+
compact,
|
|
263
|
+
forceCompact = false,
|
|
264
|
+
topOffset = 0,
|
|
265
|
+
accessibilityLabel,
|
|
266
|
+
testID = LAYOUT_TEST_IDS.stickyPreview
|
|
267
|
+
}) => {
|
|
268
|
+
const { theme } = uiFeedback.useUi();
|
|
269
|
+
const { offsetTop, keyboardOpen } = useVisibleViewport();
|
|
270
|
+
const { sentinelRef, isStuck } = useStuckSentinel(topOffset);
|
|
271
|
+
const isCompact = forceCompact || isStuck || keyboardOpen;
|
|
272
|
+
const pinned = React11.useMemo(() => {
|
|
273
|
+
const web = { position: "sticky", top: topOffset + offsetTop, zIndex: STICKY_Z_INDEX };
|
|
274
|
+
return reactNative.Platform.OS === WEB_PLATFORM ? web : {};
|
|
275
|
+
}, [offsetTop, topOffset]);
|
|
276
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
277
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, ref: sentinelRef, style: styles4.sentinel }),
|
|
278
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
279
|
+
reactNative.View,
|
|
280
|
+
{
|
|
281
|
+
accessibilityLabel,
|
|
282
|
+
role: "region",
|
|
283
|
+
style: [
|
|
284
|
+
pinned,
|
|
285
|
+
{ backgroundColor: theme.colors.background, borderColor: theme.colors.border },
|
|
286
|
+
isCompact && styles4.compact
|
|
287
|
+
],
|
|
288
|
+
testID,
|
|
289
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID: `${testID}-${isCompact ? "compact" : "full"}`, children: isCompact ? compact : full })
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
] });
|
|
293
|
+
};
|
|
183
294
|
var TRACK_PADDING = 3;
|
|
184
295
|
var TRACK_RADIUS = 999;
|
|
185
296
|
var SEGMENT_RADIUS = 999;
|
|
@@ -191,7 +302,7 @@ var BORDER_WIDTH = 1;
|
|
|
191
302
|
var SEGMENT_BOX_SHADOW = "0px 1px 3px rgba(20, 30, 50, 0.1)";
|
|
192
303
|
var SHADOW_ELEVATION = 2;
|
|
193
304
|
var TRANSPARENT = "transparent";
|
|
194
|
-
var
|
|
305
|
+
var styles5 = reactNative.StyleSheet.create({
|
|
195
306
|
track: {
|
|
196
307
|
flexDirection: "row",
|
|
197
308
|
alignSelf: "flex-start",
|
|
@@ -236,7 +347,7 @@ function SegmentedControl({
|
|
|
236
347
|
{
|
|
237
348
|
accessibilityRole: "tablist",
|
|
238
349
|
"aria-label": accessibilityLabel,
|
|
239
|
-
style: [
|
|
350
|
+
style: [styles5.track, { backgroundColor: colors.background, borderColor: colors.border }, style],
|
|
240
351
|
testID,
|
|
241
352
|
children: options.map((opt) => {
|
|
242
353
|
const selected = opt.value === value;
|
|
@@ -249,13 +360,13 @@ function SegmentedControl({
|
|
|
249
360
|
accessibilityHint: opt.accessibilityHint,
|
|
250
361
|
onPress: () => onChange(opt.value),
|
|
251
362
|
style: [
|
|
252
|
-
|
|
253
|
-
selected ?
|
|
363
|
+
styles5.segment,
|
|
364
|
+
selected ? styles5.segmentSelected : null,
|
|
254
365
|
{ backgroundColor: selected ? colors.surface : TRANSPARENT }
|
|
255
366
|
],
|
|
256
367
|
testID: opt.testID,
|
|
257
368
|
...ariaSelectedProps(selected),
|
|
258
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
369
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.label, { color: selected ? colors.text : colors.textSecondary }], children: opt.label })
|
|
259
370
|
},
|
|
260
371
|
opt.value
|
|
261
372
|
);
|
|
@@ -316,8 +427,8 @@ function handleKeyDown(domNode, event) {
|
|
|
316
427
|
}
|
|
317
428
|
}
|
|
318
429
|
function useFocusTrap(containerRef, enabled, initialFocusTestID) {
|
|
319
|
-
const previousFocusRef =
|
|
320
|
-
|
|
430
|
+
const previousFocusRef = React11.useRef(null);
|
|
431
|
+
React11.useEffect(() => {
|
|
321
432
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
322
433
|
const domNode = containerRef.current;
|
|
323
434
|
if (!domNode) return;
|
|
@@ -392,7 +503,7 @@ var HEADING_PADDING_H = 16;
|
|
|
392
503
|
var HEADING_PADDING_TOP = 8;
|
|
393
504
|
var HEADING_PADDING_BOTTOM = 4;
|
|
394
505
|
var HEADING_LETTER_SPACING = 0.5;
|
|
395
|
-
var
|
|
506
|
+
var styles6 = reactNative.StyleSheet.create({
|
|
396
507
|
heading: {
|
|
397
508
|
fontSize: HEADING_FONT_SIZE,
|
|
398
509
|
fontWeight: HEADING_FONT_WEIGHT,
|
|
@@ -408,18 +519,28 @@ var MenuHeading = ({ testID, text }) => {
|
|
|
408
519
|
reactNative.Text,
|
|
409
520
|
{
|
|
410
521
|
accessibilityRole: "header",
|
|
411
|
-
style: [
|
|
522
|
+
style: [styles6.heading, { color: theme.colors.textSecondary }],
|
|
412
523
|
testID: `${testID}-menu-heading`,
|
|
413
524
|
children: text
|
|
414
525
|
}
|
|
415
526
|
);
|
|
416
527
|
};
|
|
528
|
+
|
|
529
|
+
// src/ModalDropdown/SelectedMarker.ts
|
|
530
|
+
var SelectedMarker = /* @__PURE__ */ ((SelectedMarker2) => {
|
|
531
|
+
SelectedMarker2["Bold"] = "bold";
|
|
532
|
+
SelectedMarker2["AccentCheck"] = "accent-check";
|
|
533
|
+
return SelectedMarker2;
|
|
534
|
+
})(SelectedMarker || {});
|
|
417
535
|
var OPTION_BORDER_RADIUS = 4;
|
|
418
536
|
var BODY_FONT_SIZE = 14;
|
|
419
537
|
var SELECTED_FONT_WEIGHT = "600";
|
|
420
538
|
var OPTION_PADDING_H = 16;
|
|
421
539
|
var OPTION_PADDING_V = 12;
|
|
422
|
-
var
|
|
540
|
+
var ACCENT_BAR_WIDTH = 3;
|
|
541
|
+
var CHECK_GAP = 8;
|
|
542
|
+
var CHECK_GLYPH = "\u2713";
|
|
543
|
+
var styles7 = reactNative.StyleSheet.create({
|
|
423
544
|
option: {
|
|
424
545
|
paddingHorizontal: OPTION_PADDING_H,
|
|
425
546
|
paddingVertical: OPTION_PADDING_V,
|
|
@@ -428,35 +549,63 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
428
549
|
borderRadius: OPTION_BORDER_RADIUS
|
|
429
550
|
},
|
|
430
551
|
optionText: { fontSize: BODY_FONT_SIZE },
|
|
431
|
-
selectedText: { fontWeight: SELECTED_FONT_WEIGHT }
|
|
552
|
+
selectedText: { fontWeight: SELECTED_FONT_WEIGHT },
|
|
553
|
+
markedRow: {
|
|
554
|
+
flexDirection: "row",
|
|
555
|
+
alignItems: "center",
|
|
556
|
+
justifyContent: "space-between",
|
|
557
|
+
columnGap: CHECK_GAP,
|
|
558
|
+
borderLeftWidth: ACCENT_BAR_WIDTH,
|
|
559
|
+
borderLeftColor: "transparent",
|
|
560
|
+
paddingLeft: OPTION_PADDING_H - ACCENT_BAR_WIDTH
|
|
561
|
+
},
|
|
562
|
+
markedText: { flexShrink: 1 }
|
|
432
563
|
});
|
|
433
564
|
var OptionRow = ({
|
|
434
565
|
testID,
|
|
435
566
|
label,
|
|
436
567
|
isSelected,
|
|
437
568
|
isHighlighted = false,
|
|
438
|
-
onSelect
|
|
569
|
+
onSelect,
|
|
570
|
+
selectedMarker = "bold" /* Bold */,
|
|
571
|
+
asMenuItem = false
|
|
439
572
|
}) => {
|
|
440
573
|
const { theme, t } = uiFeedback.useUi();
|
|
441
574
|
const { colors } = theme;
|
|
442
|
-
const handlePress =
|
|
575
|
+
const handlePress = React11.useCallback(() => {
|
|
443
576
|
onSelect();
|
|
444
577
|
}, [onSelect]);
|
|
578
|
+
const accentColor = theme.palette.primary["500"];
|
|
579
|
+
const isMarked = selectedMarker === "accent-check" /* AccentCheck */;
|
|
445
580
|
const isActive = isSelected || isHighlighted;
|
|
446
|
-
const rowStyle = [
|
|
447
|
-
|
|
448
|
-
|
|
581
|
+
const rowStyle = [
|
|
582
|
+
styles7.option,
|
|
583
|
+
isMarked ? styles7.markedRow : null,
|
|
584
|
+
isActive ? { backgroundColor: colors.surfaceElevated } : null,
|
|
585
|
+
isMarked && isSelected ? { borderLeftColor: accentColor } : null
|
|
586
|
+
];
|
|
587
|
+
const textStyle = [
|
|
588
|
+
styles7.optionText,
|
|
589
|
+
{ color: colors.text },
|
|
590
|
+
isSelected ? styles7.selectedText : null,
|
|
591
|
+
isMarked ? styles7.markedText : null
|
|
592
|
+
];
|
|
593
|
+
const selectionProps = asMenuItem ? { "aria-current": isSelected ? "true" : void 0 } : { "aria-selected": isSelected };
|
|
594
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
449
595
|
reactNative.TouchableOpacity,
|
|
450
596
|
{
|
|
451
597
|
accessible: true,
|
|
452
598
|
accessibilityHint: t(LAYOUT_I18N.selectOptionHint),
|
|
453
599
|
accessibilityLabel: label,
|
|
454
|
-
accessibilityRole: "button",
|
|
455
|
-
|
|
600
|
+
accessibilityRole: asMenuItem ? "menuitem" : "button",
|
|
601
|
+
...selectionProps,
|
|
456
602
|
style: rowStyle,
|
|
457
603
|
testID,
|
|
458
604
|
onPress: handlePress,
|
|
459
|
-
children:
|
|
605
|
+
children: [
|
|
606
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label }),
|
|
607
|
+
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
|
|
608
|
+
]
|
|
460
609
|
}
|
|
461
610
|
);
|
|
462
611
|
};
|
|
@@ -512,8 +661,8 @@ function isSameRect(a, b) {
|
|
|
512
661
|
return a.top === b.top && a.left === b.left && a.width === b.width && a.bottom === b.bottom;
|
|
513
662
|
}
|
|
514
663
|
function useAnchorTracking(containerRef, onOutOfView) {
|
|
515
|
-
const [rect, setRect] =
|
|
516
|
-
|
|
664
|
+
const [rect, setRect] = React11.useState(() => readAnchorRect(containerRef));
|
|
665
|
+
React11.useLayoutEffect(() => {
|
|
517
666
|
if (!IS_WEB) return void 0;
|
|
518
667
|
let frame = null;
|
|
519
668
|
let isDisposed = false;
|
|
@@ -592,7 +741,7 @@ function buildKeyHandler(params) {
|
|
|
592
741
|
}
|
|
593
742
|
function useMenuKeyboard(params) {
|
|
594
743
|
const { containerRef, menuRef, enabled, onClose } = params;
|
|
595
|
-
|
|
744
|
+
React11.useEffect(() => {
|
|
596
745
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
597
746
|
const onKeyDown = buildKeyHandler(params);
|
|
598
747
|
const onMouseDown = (event) => {
|
|
@@ -613,7 +762,7 @@ var IS_WEB2 = reactNative.Platform.OS === "web";
|
|
|
613
762
|
var BORDER_RADIUS2 = 8;
|
|
614
763
|
var BORDER_WIDTH3 = 1;
|
|
615
764
|
var MENU_PADDING2 = 4;
|
|
616
|
-
var
|
|
765
|
+
var styles8 = reactNative.StyleSheet.create({
|
|
617
766
|
/** Native (in-tree) popover — anchored absolutely just under the trigger. */
|
|
618
767
|
popover: {
|
|
619
768
|
position: "absolute",
|
|
@@ -650,32 +799,33 @@ var InlineMenu = ({
|
|
|
650
799
|
menuMinWidth = 0,
|
|
651
800
|
menuHeading,
|
|
652
801
|
animatedStyle,
|
|
802
|
+
selectedMarker,
|
|
653
803
|
onSelect,
|
|
654
804
|
onClose
|
|
655
805
|
}) => {
|
|
656
806
|
const { theme } = uiFeedback.useUi();
|
|
657
807
|
const { colors } = theme;
|
|
658
|
-
const menuRef =
|
|
808
|
+
const menuRef = React11.useRef(null);
|
|
659
809
|
const rect = useAnchorTracking(containerRef, onClose);
|
|
660
|
-
const selectedIndex =
|
|
810
|
+
const selectedIndex = React11.useMemo(
|
|
661
811
|
() => Math.max(0, options.findIndex((opt) => opt.value === value)),
|
|
662
812
|
[options, value]
|
|
663
813
|
);
|
|
664
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
665
|
-
const handleSelect =
|
|
814
|
+
const [highlightedIndex, setHighlightedIndex] = React11.useState(() => selectedIndex);
|
|
815
|
+
const handleSelect = React11.useCallback(
|
|
666
816
|
(optionValue) => {
|
|
667
817
|
if (isOpen) onSelect(optionValue);
|
|
668
818
|
},
|
|
669
819
|
[isOpen, onSelect]
|
|
670
820
|
);
|
|
671
|
-
const selectAt =
|
|
821
|
+
const selectAt = React11.useCallback(
|
|
672
822
|
(index) => {
|
|
673
823
|
const option = options[index];
|
|
674
824
|
if (option !== void 0) handleSelect(option.value);
|
|
675
825
|
},
|
|
676
826
|
[options, handleSelect]
|
|
677
827
|
);
|
|
678
|
-
const selectHighlighted =
|
|
828
|
+
const selectHighlighted = React11.useCallback(
|
|
679
829
|
() => {
|
|
680
830
|
selectAt(highlightedIndex);
|
|
681
831
|
},
|
|
@@ -690,7 +840,7 @@ var InlineMenu = ({
|
|
|
690
840
|
onSelectHighlighted: selectHighlighted,
|
|
691
841
|
onClose
|
|
692
842
|
});
|
|
693
|
-
const popoverStyle =
|
|
843
|
+
const popoverStyle = React11.useMemo(() => {
|
|
694
844
|
const themed = { borderColor: colors.border, backgroundColor: colors.surface };
|
|
695
845
|
if (IS_WEB2) {
|
|
696
846
|
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 0;
|
|
@@ -699,7 +849,7 @@ var InlineMenu = ({
|
|
|
699
849
|
themed
|
|
700
850
|
];
|
|
701
851
|
}
|
|
702
|
-
return [
|
|
852
|
+
return [styles8.popover, { minWidth: menuMinWidth }, themed];
|
|
703
853
|
}, [colors.border, colors.surface, menuMinWidth, rect]);
|
|
704
854
|
const menu = /* @__PURE__ */ jsxRuntime.jsx(
|
|
705
855
|
reactNative.View,
|
|
@@ -714,15 +864,17 @@ var InlineMenu = ({
|
|
|
714
864
|
reactNative.Animated.View,
|
|
715
865
|
{
|
|
716
866
|
pointerEvents: isOpen ? "auto" : "none",
|
|
717
|
-
style: [
|
|
867
|
+
style: [styles8.animated, animatedStyle, isOpen ? null : styles8.inert],
|
|
718
868
|
children: [
|
|
719
869
|
menuHeading !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MenuHeading, { testID, text: menuHeading }) : null,
|
|
720
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style:
|
|
870
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style: styles8.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
721
871
|
OptionRow,
|
|
722
872
|
{
|
|
873
|
+
asMenuItem: true,
|
|
723
874
|
isHighlighted: index === highlightedIndex,
|
|
724
875
|
isSelected: option.value === value,
|
|
725
876
|
label: option.label,
|
|
877
|
+
selectedMarker,
|
|
726
878
|
testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
|
|
727
879
|
onSelect: () => handleSelect(option.value)
|
|
728
880
|
},
|
|
@@ -736,14 +888,6 @@ var InlineMenu = ({
|
|
|
736
888
|
if (IS_WEB2) return reactDom.createPortal(menu, document.body);
|
|
737
889
|
return menu;
|
|
738
890
|
};
|
|
739
|
-
|
|
740
|
-
// src/responsive.ts
|
|
741
|
-
var WEB_PLATFORM = "web";
|
|
742
|
-
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
743
|
-
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
// src/ModalDropdown/resolveDropdownVariant.ts
|
|
747
891
|
var MENU_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
748
892
|
function resolveDropdownVariant(explicit, width, platformOS) {
|
|
749
893
|
if (explicit !== void 0) return explicit;
|
|
@@ -771,7 +915,7 @@ var CARET_OPEN_ROTATION = "180deg";
|
|
|
771
915
|
var CARET_CLOSED_ROTATION = "0deg";
|
|
772
916
|
var POPOVER_ENTER_SCALE = 0.96;
|
|
773
917
|
var POPOVER_MOTION_MS = 120;
|
|
774
|
-
var
|
|
918
|
+
var styles9 = reactNative.StyleSheet.create({
|
|
775
919
|
anchor: { position: "relative" },
|
|
776
920
|
container: {
|
|
777
921
|
borderWidth: BORDER_WIDTH4,
|
|
@@ -834,13 +978,14 @@ var ModalDropdown = ({
|
|
|
834
978
|
menuMinWidth,
|
|
835
979
|
showCaret = false,
|
|
836
980
|
showHamburger = false,
|
|
837
|
-
menuHeading
|
|
981
|
+
menuHeading,
|
|
982
|
+
selectedMarker
|
|
838
983
|
}) => {
|
|
839
984
|
const { theme, t } = uiFeedback.useUi();
|
|
840
985
|
const { colors } = theme;
|
|
841
986
|
const resolvedVariant = useResolvedDropdownVariant(variant);
|
|
842
987
|
const isMenu = resolvedVariant === "menu" /* Menu */;
|
|
843
|
-
const [isOpen, setIsOpen] =
|
|
988
|
+
const [isOpen, setIsOpen] = React11.useState(false);
|
|
844
989
|
const { a11yProps, hintNode } = a11y.useA11y({
|
|
845
990
|
label: accessibilityLabel,
|
|
846
991
|
hint: accessibilityHint,
|
|
@@ -848,8 +993,10 @@ var ModalDropdown = ({
|
|
|
848
993
|
state: { expanded: isOpen },
|
|
849
994
|
testID
|
|
850
995
|
});
|
|
851
|
-
const anchorRef =
|
|
852
|
-
const
|
|
996
|
+
const anchorRef = React11.useRef(null);
|
|
997
|
+
const triggerRef = React11.useRef(null);
|
|
998
|
+
const popupProps = { "aria-haspopup": isMenu ? "menu" : "dialog" };
|
|
999
|
+
const dialogRef = React11.useRef(null);
|
|
853
1000
|
useFocusTrap(dialogRef, isOpen && !isMenu);
|
|
854
1001
|
const menuAnim = uiMotion.useEnterExit({
|
|
855
1002
|
visible: isMenu && isOpen,
|
|
@@ -861,78 +1008,80 @@ var ModalDropdown = ({
|
|
|
861
1008
|
fromScale: POPOVER_ENTER_SCALE,
|
|
862
1009
|
duration: POPOVER_MOTION_MS
|
|
863
1010
|
});
|
|
864
|
-
const selectedLabel =
|
|
1011
|
+
const selectedLabel = React11.useMemo(() => {
|
|
865
1012
|
const found = options.find((opt) => opt.value === value);
|
|
866
1013
|
return found?.label ?? t(LAYOUT_I18N.selectPlaceholder);
|
|
867
1014
|
}, [options, value, t]);
|
|
868
|
-
const handleToggle =
|
|
1015
|
+
const handleToggle = React11.useCallback(() => {
|
|
869
1016
|
setIsOpen((prev) => !prev);
|
|
870
1017
|
}, []);
|
|
871
|
-
const handleClose =
|
|
1018
|
+
const handleClose = React11.useCallback(() => {
|
|
872
1019
|
setIsOpen(false);
|
|
873
1020
|
}, []);
|
|
874
|
-
const handleSelect =
|
|
1021
|
+
const handleSelect = React11.useCallback(
|
|
875
1022
|
(optionValue) => {
|
|
876
1023
|
onChange(optionValue);
|
|
877
1024
|
setIsOpen(false);
|
|
1025
|
+
triggerRef.current?.focus();
|
|
878
1026
|
},
|
|
879
1027
|
[onChange]
|
|
880
1028
|
);
|
|
881
1029
|
const isHamburger = showHamburger;
|
|
882
1030
|
const isCaret = showCaret && !isHamburger;
|
|
883
|
-
const containerStyle =
|
|
1031
|
+
const containerStyle = React11.useMemo(
|
|
884
1032
|
() => renderTrigger !== void 0 ? void 0 : [
|
|
885
|
-
|
|
886
|
-
isHamburger ?
|
|
1033
|
+
styles9.container,
|
|
1034
|
+
isHamburger ? styles9.containerHamburger : isCaret ? styles9.containerMenu : null,
|
|
887
1035
|
{ borderColor: colors.border, backgroundColor: colors.surface }
|
|
888
1036
|
],
|
|
889
1037
|
[colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
|
|
890
1038
|
);
|
|
891
|
-
const hamburgerStyle =
|
|
892
|
-
() => [
|
|
1039
|
+
const hamburgerStyle = React11.useMemo(
|
|
1040
|
+
() => [styles9.hamburger, { color: colors.textSecondary }],
|
|
893
1041
|
[colors.textSecondary]
|
|
894
1042
|
);
|
|
895
|
-
const caretStyle =
|
|
1043
|
+
const caretStyle = React11.useMemo(
|
|
896
1044
|
() => [
|
|
897
|
-
|
|
1045
|
+
styles9.caret,
|
|
898
1046
|
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
899
1047
|
],
|
|
900
1048
|
[colors.textSecondary, isOpen]
|
|
901
1049
|
);
|
|
902
|
-
const optionTestIDFor =
|
|
1050
|
+
const optionTestIDFor = React11.useCallback(
|
|
903
1051
|
(optionValue) => optionTestID !== void 0 ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,
|
|
904
1052
|
[optionTestID, testID]
|
|
905
1053
|
);
|
|
906
|
-
const anchorStyle =
|
|
907
|
-
() => [
|
|
1054
|
+
const anchorStyle = React11.useMemo(
|
|
1055
|
+
() => [styles9.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
908
1056
|
[isMenu, isOpen]
|
|
909
1057
|
);
|
|
910
|
-
const modalContentStyle =
|
|
911
|
-
() => [
|
|
1058
|
+
const modalContentStyle = React11.useMemo(
|
|
1059
|
+
() => [styles9.modalContent, { backgroundColor: colors.surface }],
|
|
912
1060
|
[colors.surface]
|
|
913
1061
|
);
|
|
914
|
-
const renderModalOption =
|
|
1062
|
+
const renderModalOption = React11.useCallback(
|
|
915
1063
|
({ item }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
916
1064
|
OptionRow,
|
|
917
1065
|
{
|
|
918
1066
|
isSelected: item.value === value,
|
|
919
1067
|
label: item.label,
|
|
1068
|
+
selectedMarker,
|
|
920
1069
|
testID: optionTestIDFor(item.value),
|
|
921
1070
|
onSelect: () => handleSelect(item.value)
|
|
922
1071
|
}
|
|
923
1072
|
),
|
|
924
|
-
[handleSelect, optionTestIDFor, value]
|
|
1073
|
+
[handleSelect, optionTestIDFor, selectedMarker, value]
|
|
925
1074
|
);
|
|
926
|
-
const keyExtractor =
|
|
1075
|
+
const keyExtractor = React11.useCallback((item) => String(item.value), []);
|
|
927
1076
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: anchorStyle, children: [
|
|
928
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
|
|
1077
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, ...popupProps, ref: triggerRef, style: containerStyle, onPress: handleToggle, children: [
|
|
929
1078
|
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
930
1079
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: hamburgerStyle, children: HAMBURGER_GLYPH }),
|
|
931
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [
|
|
1080
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles9.selectedText, styles9.selectedTextMenu, { color: colors.text }], children: selectedLabel })
|
|
932
1081
|
] }) : isCaret ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
933
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [
|
|
1082
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles9.selectedText, styles9.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
|
|
934
1083
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: caretStyle, children: CARET_GLYPH })
|
|
935
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1084
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.selectedText, { color: colors.text }], children: selectedLabel }),
|
|
936
1085
|
hintNode
|
|
937
1086
|
] }),
|
|
938
1087
|
isMenu && menuAnim.mounted ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -946,13 +1095,14 @@ var ModalDropdown = ({
|
|
|
946
1095
|
menuMinWidth,
|
|
947
1096
|
optionTestID: optionTestIDFor,
|
|
948
1097
|
options,
|
|
1098
|
+
selectedMarker,
|
|
949
1099
|
testID,
|
|
950
1100
|
value,
|
|
951
1101
|
onClose: handleClose,
|
|
952
1102
|
onSelect: handleSelect
|
|
953
1103
|
}
|
|
954
1104
|
) : null,
|
|
955
|
-
!isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1105
|
+
!isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles9.modalOverlay, children: [
|
|
956
1106
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
957
1107
|
reactNative.TouchableOpacity,
|
|
958
1108
|
{
|
|
@@ -998,11 +1148,11 @@ var TabsMenu = ({
|
|
|
998
1148
|
collapsedTrigger = "caret" /* Caret */
|
|
999
1149
|
}) => {
|
|
1000
1150
|
const { t } = uiFeedback.useUi();
|
|
1001
|
-
const options =
|
|
1151
|
+
const options = React11.useMemo(
|
|
1002
1152
|
() => tabs.map((tab) => ({ label: tab.label, value: tab.key })),
|
|
1003
1153
|
[tabs]
|
|
1004
1154
|
);
|
|
1005
|
-
const optionTestID =
|
|
1155
|
+
const optionTestID = React11.useCallback(
|
|
1006
1156
|
(key) => {
|
|
1007
1157
|
const found = tabs.find((tab) => tab.key === key);
|
|
1008
1158
|
return found?.testID ?? `${idPrefix}-tab-${key}`;
|
|
@@ -1045,7 +1195,7 @@ var ROW_PAD_V = 8;
|
|
|
1045
1195
|
var PANEL_PAD_TOP = 16;
|
|
1046
1196
|
var BORDER_WIDTH5 = 1;
|
|
1047
1197
|
var TEXT_ON_PRIMARY = "#ffffff";
|
|
1048
|
-
var
|
|
1198
|
+
var styles10 = reactNative.StyleSheet.create({
|
|
1049
1199
|
root: {
|
|
1050
1200
|
width: "100%"
|
|
1051
1201
|
},
|
|
@@ -1099,7 +1249,7 @@ var WideTabStrip = ({
|
|
|
1099
1249
|
textSecondary,
|
|
1100
1250
|
surfaceElevated,
|
|
1101
1251
|
stripStyle
|
|
1102
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [
|
|
1252
|
+
}) => /* @__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) => {
|
|
1103
1253
|
const selected = tab.key === activeKey;
|
|
1104
1254
|
const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;
|
|
1105
1255
|
const pillColor = selected ? primaryColor : surfaceElevated;
|
|
@@ -1113,10 +1263,10 @@ var WideTabStrip = ({
|
|
|
1113
1263
|
accessibilityLabel: tab.accessibilityLabel ?? tab.label,
|
|
1114
1264
|
accessibilityHint: tab.accessibilityHint,
|
|
1115
1265
|
onPress: () => onChange(tab.key),
|
|
1116
|
-
style: [
|
|
1266
|
+
style: [styles10.pill, { backgroundColor: pillColor }],
|
|
1117
1267
|
testID: tab.testID,
|
|
1118
1268
|
...ariaTabProps(selected, panelId, tabId),
|
|
1119
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1269
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.pillText, { color: textColor }], children: tab.label })
|
|
1120
1270
|
},
|
|
1121
1271
|
tab.key
|
|
1122
1272
|
);
|
|
@@ -1141,7 +1291,7 @@ var Tabs = ({
|
|
|
1141
1291
|
const activePanelId = `${idPrefix}-panel-${activeKey}`;
|
|
1142
1292
|
const activeTabId = `${idPrefix}-tab-${activeKey}`;
|
|
1143
1293
|
const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
|
|
1144
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
1294
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles10.root, style], testID, children: [
|
|
1145
1295
|
collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1146
1296
|
TabsMenu,
|
|
1147
1297
|
{
|
|
@@ -1168,7 +1318,7 @@ var Tabs = ({
|
|
|
1168
1318
|
onChange
|
|
1169
1319
|
}
|
|
1170
1320
|
),
|
|
1171
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [
|
|
1321
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [styles10.panel, panelStyle], ...panelAria, children })
|
|
1172
1322
|
] });
|
|
1173
1323
|
};
|
|
1174
1324
|
var PROMPT_PADDING = 20;
|
|
@@ -1183,7 +1333,7 @@ var DISMISS_FONT_SIZE = 13;
|
|
|
1183
1333
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
1184
1334
|
var MESSAGE_MARGIN_BOTTOM = 16;
|
|
1185
1335
|
var CTA_MARGIN_BOTTOM = 8;
|
|
1186
|
-
var
|
|
1336
|
+
var styles11 = reactNative.StyleSheet.create({
|
|
1187
1337
|
container: {
|
|
1188
1338
|
padding: PROMPT_PADDING,
|
|
1189
1339
|
borderRadius: PROMPT_BORDER_RADIUS,
|
|
@@ -1218,21 +1368,21 @@ var UpgradePrompt = ({
|
|
|
1218
1368
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1219
1369
|
reactNative.View,
|
|
1220
1370
|
{
|
|
1221
|
-
style: [
|
|
1371
|
+
style: [styles11.container, { borderColor: primary, backgroundColor: colors.surface }],
|
|
1222
1372
|
testID: LAYOUT_TEST_IDS.upgradePrompt,
|
|
1223
1373
|
children: [
|
|
1224
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1225
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1374
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
|
|
1375
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
|
|
1226
1376
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1227
1377
|
reactNative.TouchableOpacity,
|
|
1228
1378
|
{
|
|
1229
1379
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
|
|
1230
1380
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
|
|
1231
1381
|
accessibilityRole: "button",
|
|
1232
|
-
style: [
|
|
1382
|
+
style: [styles11.cta, { backgroundColor: primary }],
|
|
1233
1383
|
testID: LAYOUT_TEST_IDS.upgradePromptCta,
|
|
1234
1384
|
onPress: handleUpgradePress,
|
|
1235
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1385
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
|
|
1236
1386
|
}
|
|
1237
1387
|
),
|
|
1238
1388
|
onDismiss ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1241,10 +1391,10 @@ var UpgradePrompt = ({
|
|
|
1241
1391
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
|
|
1242
1392
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
|
|
1243
1393
|
accessibilityRole: "button",
|
|
1244
|
-
style:
|
|
1394
|
+
style: styles11.dismiss,
|
|
1245
1395
|
testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
|
|
1246
1396
|
onPress: onDismiss,
|
|
1247
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1397
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
|
|
1248
1398
|
}
|
|
1249
1399
|
) : null
|
|
1250
1400
|
]
|
|
@@ -1253,7 +1403,7 @@ var UpgradePrompt = ({
|
|
|
1253
1403
|
};
|
|
1254
1404
|
var CLOSE_ICON_SIZE = 18;
|
|
1255
1405
|
var PANEL_ENTER_SCALE = 0.96;
|
|
1256
|
-
var
|
|
1406
|
+
var styles12 = reactNative.StyleSheet.create({
|
|
1257
1407
|
animatedFill: { flex: 1 },
|
|
1258
1408
|
container: {
|
|
1259
1409
|
flex: 1,
|
|
@@ -1279,8 +1429,8 @@ var ModalShell = ({
|
|
|
1279
1429
|
}) => {
|
|
1280
1430
|
const { theme, t } = uiFeedback.useUi();
|
|
1281
1431
|
const { style: sheetStyle, mounted } = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });
|
|
1282
|
-
const containerStyle =
|
|
1283
|
-
() => [
|
|
1432
|
+
const containerStyle = React11__default.default.useMemo(
|
|
1433
|
+
() => [styles12.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1284
1434
|
[theme.colors.background, contentStyle]
|
|
1285
1435
|
);
|
|
1286
1436
|
const closeA11yLabel = t(LAYOUT_I18N.close);
|
|
@@ -1292,7 +1442,7 @@ var ModalShell = ({
|
|
|
1292
1442
|
testID: LAYOUT_TEST_IDS.modalShell,
|
|
1293
1443
|
visible: mounted,
|
|
1294
1444
|
onRequestClose: onCancel,
|
|
1295
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [
|
|
1445
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles12.animatedFill, sheetStyle], children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1296
1446
|
reactNative.ScrollView,
|
|
1297
1447
|
{
|
|
1298
1448
|
accessibilityViewIsModal: true,
|
|
@@ -1300,7 +1450,7 @@ var ModalShell = ({
|
|
|
1300
1450
|
role: "dialog",
|
|
1301
1451
|
style: containerStyle,
|
|
1302
1452
|
children: [
|
|
1303
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1453
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles12.headerRow, children: [
|
|
1304
1454
|
/* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
|
|
1305
1455
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1306
1456
|
reactNative.TouchableOpacity,
|
|
@@ -1308,7 +1458,7 @@ var ModalShell = ({
|
|
|
1308
1458
|
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1309
1459
|
accessibilityLabel: closeA11yLabel,
|
|
1310
1460
|
accessibilityRole: "button",
|
|
1311
|
-
style:
|
|
1461
|
+
style: styles12.closeButton,
|
|
1312
1462
|
testID: LAYOUT_TEST_IDS.modalShellClose,
|
|
1313
1463
|
onPress: onCancel,
|
|
1314
1464
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
|
|
@@ -1323,7 +1473,7 @@ var ModalShell = ({
|
|
|
1323
1473
|
);
|
|
1324
1474
|
};
|
|
1325
1475
|
function useEscapeKey(enabled, onClose) {
|
|
1326
|
-
|
|
1476
|
+
React11.useEffect(() => {
|
|
1327
1477
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1328
1478
|
const onKeyDown = (event) => {
|
|
1329
1479
|
if (event.key === "Escape") onClose();
|
|
@@ -1335,7 +1485,7 @@ function useEscapeKey(enabled, onClose) {
|
|
|
1335
1485
|
}, [enabled, onClose]);
|
|
1336
1486
|
}
|
|
1337
1487
|
function useScrollLock(enabled) {
|
|
1338
|
-
|
|
1488
|
+
React11.useEffect(() => {
|
|
1339
1489
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1340
1490
|
const { body } = document;
|
|
1341
1491
|
const previousOverflow = body.style.overflow;
|
|
@@ -1354,7 +1504,7 @@ var HEADER_MARGIN = 12;
|
|
|
1354
1504
|
var DIALOG_MAX_HEIGHT = "90%";
|
|
1355
1505
|
var PANEL_ENTER_SCALE2 = 0.96;
|
|
1356
1506
|
var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640 };
|
|
1357
|
-
var
|
|
1507
|
+
var styles13 = reactNative.StyleSheet.create({
|
|
1358
1508
|
overlay: {
|
|
1359
1509
|
flex: 1,
|
|
1360
1510
|
justifyContent: "center",
|
|
@@ -1396,7 +1546,7 @@ var Modal3 = ({
|
|
|
1396
1546
|
initialFocusTestID
|
|
1397
1547
|
}) => {
|
|
1398
1548
|
const { theme, t } = uiFeedback.useUi();
|
|
1399
|
-
const dialogRef =
|
|
1549
|
+
const dialogRef = React11.useRef(null);
|
|
1400
1550
|
const backdrop = uiMotion.useEnterExit({ visible });
|
|
1401
1551
|
const panel = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE2 });
|
|
1402
1552
|
const mounted = panel.mounted || backdrop.mounted;
|
|
@@ -1405,16 +1555,16 @@ var Modal3 = ({
|
|
|
1405
1555
|
useScrollLock(visible);
|
|
1406
1556
|
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
1407
1557
|
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
1408
|
-
const dialogStyle =
|
|
1409
|
-
() => [
|
|
1558
|
+
const dialogStyle = React11.useMemo(
|
|
1559
|
+
() => [styles13.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
1410
1560
|
[theme.colors.surface, size]
|
|
1411
1561
|
);
|
|
1412
1562
|
const hasHeader = title !== void 0 || showClose;
|
|
1413
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1563
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles13.overlay, children: [
|
|
1414
1564
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1415
1565
|
reactNative.Animated.View,
|
|
1416
1566
|
{
|
|
1417
|
-
style: [reactNative.StyleSheet.absoluteFill,
|
|
1567
|
+
style: [reactNative.StyleSheet.absoluteFill, styles13.scrim, { opacity: backdrop.style.opacity }]
|
|
1418
1568
|
}
|
|
1419
1569
|
),
|
|
1420
1570
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1440,8 +1590,8 @@ var Modal3 = ({
|
|
|
1440
1590
|
style: [dialogStyle, panel.style],
|
|
1441
1591
|
testID,
|
|
1442
1592
|
children: [
|
|
1443
|
-
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1444
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
1593
|
+
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles13.headerRow, children: [
|
|
1594
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles13.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title }) : null }),
|
|
1445
1595
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1446
1596
|
uiButtons.IconButton,
|
|
1447
1597
|
{
|
|
@@ -1458,7 +1608,7 @@ var Modal3 = ({
|
|
|
1458
1608
|
) : null
|
|
1459
1609
|
] }) : null,
|
|
1460
1610
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children }),
|
|
1461
|
-
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
1611
|
+
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles13.footer, children: footer }) : null
|
|
1462
1612
|
]
|
|
1463
1613
|
}
|
|
1464
1614
|
)
|
|
@@ -1467,7 +1617,7 @@ var Modal3 = ({
|
|
|
1467
1617
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
1468
1618
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
1469
1619
|
var BUTTON_GAP = 12;
|
|
1470
|
-
var
|
|
1620
|
+
var styles14 = reactNative.StyleSheet.create({
|
|
1471
1621
|
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
|
|
1472
1622
|
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
1473
1623
|
});
|
|
@@ -1486,7 +1636,7 @@ var ConfirmDialog = ({
|
|
|
1486
1636
|
const { theme, t } = uiFeedback.useUi();
|
|
1487
1637
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
1488
1638
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
1489
|
-
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1639
|
+
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.footer, children: [
|
|
1490
1640
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1491
1641
|
uiButtons.Button,
|
|
1492
1642
|
{
|
|
@@ -1522,27 +1672,27 @@ var ConfirmDialog = ({
|
|
|
1522
1672
|
title,
|
|
1523
1673
|
visible,
|
|
1524
1674
|
onClose: onCancel,
|
|
1525
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1675
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
|
|
1526
1676
|
}
|
|
1527
1677
|
);
|
|
1528
1678
|
};
|
|
1529
|
-
var AccordionContext =
|
|
1679
|
+
var AccordionContext = React11.createContext(null);
|
|
1530
1680
|
function useAccordionContext() {
|
|
1531
|
-
const value =
|
|
1681
|
+
const value = React11.useContext(AccordionContext);
|
|
1532
1682
|
if (value === null) {
|
|
1533
1683
|
throw new Error("AccordionItem must be rendered inside an <Accordion>.");
|
|
1534
1684
|
}
|
|
1535
1685
|
return value;
|
|
1536
1686
|
}
|
|
1537
1687
|
var BOXED_GAP = 12;
|
|
1538
|
-
var
|
|
1688
|
+
var styles15 = reactNative.StyleSheet.create({
|
|
1539
1689
|
container: { alignSelf: "stretch" },
|
|
1540
1690
|
boxed: { gap: BOXED_GAP }
|
|
1541
1691
|
});
|
|
1542
1692
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
1543
1693
|
const ids = new Set(defaultOpenIds ?? []);
|
|
1544
|
-
|
|
1545
|
-
if (!
|
|
1694
|
+
React11__default.default.Children.forEach(children, (child) => {
|
|
1695
|
+
if (!React11__default.default.isValidElement(child)) return;
|
|
1546
1696
|
const props = child.props;
|
|
1547
1697
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
1548
1698
|
ids.add(props.id);
|
|
@@ -1565,14 +1715,14 @@ var Accordion = ({
|
|
|
1565
1715
|
style
|
|
1566
1716
|
}) => {
|
|
1567
1717
|
const isControlled = openIds !== void 0;
|
|
1568
|
-
const [internalOpen, setInternalOpen] =
|
|
1718
|
+
const [internalOpen, setInternalOpen] = React11.useState(
|
|
1569
1719
|
() => computeInitialOpen(children, defaultOpenIds, allowMultiple)
|
|
1570
1720
|
);
|
|
1571
|
-
const openSet =
|
|
1721
|
+
const openSet = React11.useMemo(
|
|
1572
1722
|
() => isControlled ? new Set(openIds) : internalOpen,
|
|
1573
1723
|
[isControlled, openIds, internalOpen]
|
|
1574
1724
|
);
|
|
1575
|
-
const toggle =
|
|
1725
|
+
const toggle = React11.useCallback(
|
|
1576
1726
|
(id) => {
|
|
1577
1727
|
const next = new Set(openSet);
|
|
1578
1728
|
const willOpen = !next.has(id);
|
|
@@ -1587,12 +1737,12 @@ var Accordion = ({
|
|
|
1587
1737
|
},
|
|
1588
1738
|
[allowMultiple, isControlled, onOpenChange, openSet]
|
|
1589
1739
|
);
|
|
1590
|
-
const contextValue =
|
|
1740
|
+
const contextValue = React11.useMemo(
|
|
1591
1741
|
() => ({ openIds: openSet, toggle, allowMultiple, variant }),
|
|
1592
1742
|
[openSet, toggle, allowMultiple, variant]
|
|
1593
1743
|
);
|
|
1594
|
-
const containerStyle =
|
|
1595
|
-
const base = variant === "boxed" ? [
|
|
1744
|
+
const containerStyle = React11.useMemo(() => {
|
|
1745
|
+
const base = variant === "boxed" ? [styles15.container, styles15.boxed] : [styles15.container];
|
|
1596
1746
|
if (style === void 0) return base;
|
|
1597
1747
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1598
1748
|
}, [style, variant]);
|
|
@@ -1624,7 +1774,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1624
1774
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1625
1775
|
var BOX_MARKER_GAP = 6;
|
|
1626
1776
|
var BOX_MARKER = "\u25B8";
|
|
1627
|
-
var
|
|
1777
|
+
var styles16 = reactNative.StyleSheet.create({
|
|
1628
1778
|
item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
1629
1779
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1630
1780
|
header: {
|
|
@@ -1670,9 +1820,9 @@ var AccordionItem = ({
|
|
|
1670
1820
|
const headerTestID = testID ?? `accordion-item-${id}`;
|
|
1671
1821
|
const bodyTestID = `${headerTestID}-body`;
|
|
1672
1822
|
const chevronTestID = `${headerTestID}-chevron`;
|
|
1673
|
-
const [rotation] =
|
|
1823
|
+
const [rotation] = React11.useState(() => new reactNative.Animated.Value(expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED));
|
|
1674
1824
|
const reducedMotion = rnWebHooks.useReducedMotion();
|
|
1675
|
-
|
|
1825
|
+
React11.useEffect(() => {
|
|
1676
1826
|
reactNative.Animated.timing(rotation, {
|
|
1677
1827
|
toValue: expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED,
|
|
1678
1828
|
duration: reducedMotion ? INSTANT_DURATION_MS : ROTATE_DURATION_MS,
|
|
@@ -1684,10 +1834,10 @@ var AccordionItem = ({
|
|
|
1684
1834
|
inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],
|
|
1685
1835
|
outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG]
|
|
1686
1836
|
});
|
|
1687
|
-
const handlePress =
|
|
1837
|
+
const handlePress = React11.useCallback(() => {
|
|
1688
1838
|
if (!disabled) toggle(id);
|
|
1689
1839
|
}, [disabled, id, toggle]);
|
|
1690
|
-
const handleKeyDown2 =
|
|
1840
|
+
const handleKeyDown2 = React11.useCallback(
|
|
1691
1841
|
(event) => {
|
|
1692
1842
|
if (disabled) return;
|
|
1693
1843
|
const key = event.key ?? "";
|
|
@@ -1699,20 +1849,20 @@ var AccordionItem = ({
|
|
|
1699
1849
|
[disabled, id, toggle]
|
|
1700
1850
|
);
|
|
1701
1851
|
const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1702
|
-
const itemStyle =
|
|
1703
|
-
() => boxed ? [
|
|
1852
|
+
const itemStyle = React11.useMemo(
|
|
1853
|
+
() => boxed ? [styles16.boxItem, { borderColor: colors.border }] : [styles16.item, { borderTopColor: colors.border }],
|
|
1704
1854
|
[boxed, colors.border]
|
|
1705
1855
|
);
|
|
1706
|
-
const headerStyle =
|
|
1856
|
+
const headerStyle = React11.useMemo(
|
|
1707
1857
|
() => [
|
|
1708
|
-
|
|
1709
|
-
...boxed ? [
|
|
1858
|
+
styles16.header,
|
|
1859
|
+
...boxed ? [styles16.boxHeader] : [],
|
|
1710
1860
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1711
1861
|
],
|
|
1712
1862
|
[boxed, disabled]
|
|
1713
1863
|
);
|
|
1714
1864
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1715
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ?
|
|
1865
|
+
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;
|
|
1716
1866
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: itemStyle, children: [
|
|
1717
1867
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1718
1868
|
reactNative.Pressable,
|
|
@@ -1729,7 +1879,7 @@ var AccordionItem = ({
|
|
|
1729
1879
|
onPress: handlePress,
|
|
1730
1880
|
...keyboardProps,
|
|
1731
1881
|
children: [
|
|
1732
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
1882
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles16.headerLeft, boxed ? styles16.headerLeftRow : null], children: [
|
|
1733
1883
|
boxed ? (
|
|
1734
1884
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1735
1885
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1738,15 +1888,15 @@ var AccordionItem = ({
|
|
|
1738
1888
|
accessibilityElementsHidden: true,
|
|
1739
1889
|
"aria-hidden": true,
|
|
1740
1890
|
importantForAccessibility: "no-hide-descendants",
|
|
1741
|
-
style: [
|
|
1891
|
+
style: [styles16.marker, { transform: [{ rotate }] }],
|
|
1742
1892
|
testID: chevronTestID,
|
|
1743
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1893
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1744
1894
|
}
|
|
1745
1895
|
)
|
|
1746
1896
|
) : null,
|
|
1747
1897
|
titleNode
|
|
1748
1898
|
] }),
|
|
1749
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1899
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.headerRight, children: [
|
|
1750
1900
|
right,
|
|
1751
1901
|
boxed ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1752
1902
|
reactNative.Animated.View,
|
|
@@ -1754,7 +1904,7 @@ var AccordionItem = ({
|
|
|
1754
1904
|
accessibilityElementsHidden: true,
|
|
1755
1905
|
"aria-hidden": true,
|
|
1756
1906
|
importantForAccessibility: "no-hide-descendants",
|
|
1757
|
-
style: [
|
|
1907
|
+
style: [styles16.chevron, { transform: [{ rotate }] }],
|
|
1758
1908
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1759
1909
|
}
|
|
1760
1910
|
)
|
|
@@ -1768,7 +1918,7 @@ var AccordionItem = ({
|
|
|
1768
1918
|
accessibilityLabel: resolvedLabel,
|
|
1769
1919
|
nativeID: bodyTestID,
|
|
1770
1920
|
role: ROLE_REGION,
|
|
1771
|
-
style: boxed ?
|
|
1921
|
+
style: boxed ? styles16.boxBody : styles16.body,
|
|
1772
1922
|
testID: bodyTestID,
|
|
1773
1923
|
children
|
|
1774
1924
|
}
|
|
@@ -1806,14 +1956,14 @@ function measureParentInnerWidth(node) {
|
|
|
1806
1956
|
return Math.max(UNMEASURED, parent.clientWidth - padding);
|
|
1807
1957
|
}
|
|
1808
1958
|
function useAvailableWidth() {
|
|
1809
|
-
const [width, setWidth] =
|
|
1810
|
-
const nodeRef =
|
|
1811
|
-
const measureRef =
|
|
1959
|
+
const [width, setWidth] = React11.useState(UNMEASURED);
|
|
1960
|
+
const nodeRef = React11.useRef(null);
|
|
1961
|
+
const measureRef = React11.useCallback((node) => {
|
|
1812
1962
|
if (!IS_WEB3) return;
|
|
1813
1963
|
nodeRef.current = node;
|
|
1814
1964
|
if (nodeRef.current !== null) setWidth(measureParentInnerWidth(nodeRef.current));
|
|
1815
1965
|
}, []);
|
|
1816
|
-
|
|
1966
|
+
React11.useEffect(() => {
|
|
1817
1967
|
if (!IS_WEB3) return void 0;
|
|
1818
1968
|
const remeasure = () => {
|
|
1819
1969
|
const node = nodeRef.current;
|
|
@@ -1822,7 +1972,7 @@ function useAvailableWidth() {
|
|
|
1822
1972
|
window.addEventListener("resize", remeasure);
|
|
1823
1973
|
return () => window.removeEventListener("resize", remeasure);
|
|
1824
1974
|
}, []);
|
|
1825
|
-
const onLayout =
|
|
1975
|
+
const onLayout = React11.useCallback((event) => {
|
|
1826
1976
|
if (IS_WEB3) return;
|
|
1827
1977
|
setWidth(event.nativeEvent.layout.width);
|
|
1828
1978
|
}, []);
|
|
@@ -1831,7 +1981,7 @@ function useAvailableWidth() {
|
|
|
1831
1981
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
1832
1982
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
1833
1983
|
var UNMEASURED2 = 0;
|
|
1834
|
-
var
|
|
1984
|
+
var styles17 = reactNative.StyleSheet.create({
|
|
1835
1985
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
1836
1986
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
1837
1987
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -1851,8 +2001,8 @@ var TruncatedText = ({
|
|
|
1851
2001
|
accessibilityHint
|
|
1852
2002
|
}) => {
|
|
1853
2003
|
const { width, measureRef, onLayout } = useAvailableWidth();
|
|
1854
|
-
const hostRef =
|
|
1855
|
-
const attachRef =
|
|
2004
|
+
const hostRef = React11.useRef(null);
|
|
2005
|
+
const attachRef = React11.useCallback(
|
|
1856
2006
|
(node) => {
|
|
1857
2007
|
hostRef.current = node;
|
|
1858
2008
|
measureRef(node);
|
|
@@ -1861,12 +2011,12 @@ var TruncatedText = ({
|
|
|
1861
2011
|
},
|
|
1862
2012
|
[value, measureRef]
|
|
1863
2013
|
);
|
|
1864
|
-
const flatStyle =
|
|
1865
|
-
() => reactNative.StyleSheet.flatten([
|
|
2014
|
+
const flatStyle = React11.useMemo(
|
|
2015
|
+
() => reactNative.StyleSheet.flatten([styles17.base, style]),
|
|
1866
2016
|
[style]
|
|
1867
2017
|
);
|
|
1868
2018
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
1869
|
-
const display =
|
|
2019
|
+
const display = React11.useMemo(() => {
|
|
1870
2020
|
const source = isUrl ? formatUrlForDisplay(value) : value;
|
|
1871
2021
|
const budget = charBudget(width, fontSize);
|
|
1872
2022
|
return budget === UNMEASURED2 ? source : truncateMiddle(source, budget);
|
|
@@ -1877,7 +2027,7 @@ var TruncatedText = ({
|
|
|
1877
2027
|
ref: attachRef,
|
|
1878
2028
|
onLayout,
|
|
1879
2029
|
numberOfLines: 1,
|
|
1880
|
-
style: [
|
|
2030
|
+
style: [styles17.base, styles17.fill, style],
|
|
1881
2031
|
testID,
|
|
1882
2032
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
1883
2033
|
accessibilityLabel,
|
|
@@ -1948,17 +2098,17 @@ async function copyText(value, writer) {
|
|
|
1948
2098
|
// src/CopyableId/useCopyToClipboard.ts
|
|
1949
2099
|
var COPY_FEEDBACK_MS = 2e3;
|
|
1950
2100
|
function useCopyToClipboard(value, writer) {
|
|
1951
|
-
const [status, setStatus] =
|
|
1952
|
-
const timerRef =
|
|
1953
|
-
const mountedRef =
|
|
1954
|
-
|
|
2101
|
+
const [status, setStatus] = React11.useState("idle" /* Idle */);
|
|
2102
|
+
const timerRef = React11.useRef(null);
|
|
2103
|
+
const mountedRef = React11.useRef(true);
|
|
2104
|
+
React11.useEffect(() => {
|
|
1955
2105
|
mountedRef.current = true;
|
|
1956
2106
|
return () => {
|
|
1957
2107
|
mountedRef.current = false;
|
|
1958
2108
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
1959
2109
|
};
|
|
1960
2110
|
}, []);
|
|
1961
|
-
const copy =
|
|
2111
|
+
const copy = React11.useCallback(() => {
|
|
1962
2112
|
void (async () => {
|
|
1963
2113
|
const ok = await copyText(value, writer);
|
|
1964
2114
|
if (!mountedRef.current) return;
|
|
@@ -1980,7 +2130,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
1980
2130
|
var ACTION_PADDING_H = 6;
|
|
1981
2131
|
var ACTION_PADDING_V = 2;
|
|
1982
2132
|
var ACTION_RADIUS = 6;
|
|
1983
|
-
var
|
|
2133
|
+
var styles18 = reactNative.StyleSheet.create({
|
|
1984
2134
|
cell: { gap: CELL_GAP },
|
|
1985
2135
|
label: {
|
|
1986
2136
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -2022,7 +2172,7 @@ var styles17 = reactNative.StyleSheet.create({
|
|
|
2022
2172
|
var TONE_STEP = "500";
|
|
2023
2173
|
function useActionState(status) {
|
|
2024
2174
|
const { theme } = uiFeedback.useUi();
|
|
2025
|
-
return
|
|
2175
|
+
return React11.useMemo(() => {
|
|
2026
2176
|
const primary = theme.palette.primary[TONE_STEP];
|
|
2027
2177
|
if (status === "copied" /* Copied */) {
|
|
2028
2178
|
return { key: LAYOUT_I18N.copied, color: theme.semantic.success?.[TONE_STEP] ?? primary };
|
|
@@ -2045,14 +2195,14 @@ var CopyableId = ({
|
|
|
2045
2195
|
const { colors } = theme;
|
|
2046
2196
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
2047
2197
|
const action = useActionState(status);
|
|
2048
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2049
|
-
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2050
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2051
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2198
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles18.cell, style], testID, children: [
|
|
2199
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles18.label, { color: colors.textSecondary }], children: label }),
|
|
2200
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles18.row, children: [
|
|
2201
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles18.valueWrap, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2052
2202
|
TruncatedText,
|
|
2053
2203
|
{
|
|
2054
2204
|
value,
|
|
2055
|
-
style: [
|
|
2205
|
+
style: [styles18.value, { color: colors.text }],
|
|
2056
2206
|
testID: `${testID}-value`,
|
|
2057
2207
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
2058
2208
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -2066,7 +2216,7 @@ var CopyableId = ({
|
|
|
2066
2216
|
accessibilityLabel: t(action.key),
|
|
2067
2217
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
2068
2218
|
testID: `${testID}-copy`,
|
|
2069
|
-
style: [
|
|
2219
|
+
style: [styles18.action, { color: action.color }],
|
|
2070
2220
|
children: t(action.key)
|
|
2071
2221
|
}
|
|
2072
2222
|
)
|
|
@@ -2091,15 +2241,15 @@ function formatBuildInfo(buildVersion, apiCommit) {
|
|
|
2091
2241
|
return `${base}${API_COMMIT_SEPARATOR}${shortenCommit(commit)}`;
|
|
2092
2242
|
}
|
|
2093
2243
|
function useApiCommit(apiBaseUrl, fetchImpl) {
|
|
2094
|
-
const [commit, setCommit] =
|
|
2095
|
-
const mountedRef =
|
|
2096
|
-
|
|
2244
|
+
const [commit, setCommit] = React11.useState(void 0);
|
|
2245
|
+
const mountedRef = React11.useRef(true);
|
|
2246
|
+
React11.useEffect(() => {
|
|
2097
2247
|
mountedRef.current = true;
|
|
2098
2248
|
return () => {
|
|
2099
2249
|
mountedRef.current = false;
|
|
2100
2250
|
};
|
|
2101
2251
|
}, []);
|
|
2102
|
-
|
|
2252
|
+
React11.useEffect(() => {
|
|
2103
2253
|
if (apiBaseUrl === void 0 || apiBaseUrl === "") return;
|
|
2104
2254
|
const doFetch = fetchImpl ?? (typeof fetch !== "undefined" ? fetch : void 0);
|
|
2105
2255
|
if (doFetch === void 0) return;
|
|
@@ -2121,7 +2271,7 @@ var FOOTER_PADDING_V = 6;
|
|
|
2121
2271
|
var FOOTER_PADDING_H = 12;
|
|
2122
2272
|
var FOOTER_FONT_SIZE = 11;
|
|
2123
2273
|
var FOOTER_OPACITY = 0.75;
|
|
2124
|
-
var
|
|
2274
|
+
var styles19 = reactNative.StyleSheet.create({
|
|
2125
2275
|
footer: {
|
|
2126
2276
|
paddingVertical: FOOTER_PADDING_V,
|
|
2127
2277
|
paddingHorizontal: FOOTER_PADDING_H,
|
|
@@ -2146,8 +2296,8 @@ var BuildInfoFooter = ({
|
|
|
2146
2296
|
const fetchedCommit = useApiCommit(apiCommit === void 0 ? apiBaseUrl : void 0, fetchImpl);
|
|
2147
2297
|
const commit = apiCommit ?? fetchedCommit;
|
|
2148
2298
|
const label = formatBuildInfo(buildVersion, commit);
|
|
2149
|
-
const textStyle =
|
|
2150
|
-
() => [
|
|
2299
|
+
const textStyle = React11.useMemo(
|
|
2300
|
+
() => [styles19.text, { color: theme.colors.textSecondary }],
|
|
2151
2301
|
[theme.colors.textSecondary]
|
|
2152
2302
|
);
|
|
2153
2303
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2155,7 +2305,7 @@ var BuildInfoFooter = ({
|
|
|
2155
2305
|
{
|
|
2156
2306
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
2157
2307
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
|
|
2158
|
-
style: [
|
|
2308
|
+
style: [styles19.footer, style],
|
|
2159
2309
|
testID,
|
|
2160
2310
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label })
|
|
2161
2311
|
}
|
|
@@ -2184,7 +2334,9 @@ exports.ModalDropdown = ModalDropdown;
|
|
|
2184
2334
|
exports.ModalShell = ModalShell;
|
|
2185
2335
|
exports.Section = Section;
|
|
2186
2336
|
exports.SegmentedControl = SegmentedControl;
|
|
2337
|
+
exports.SelectedMarker = SelectedMarker;
|
|
2187
2338
|
exports.StatusBadge = StatusBadge;
|
|
2339
|
+
exports.StickyPreview = StickyPreview;
|
|
2188
2340
|
exports.TYPE_SCALE_BREAKPOINT = TYPE_SCALE_BREAKPOINT;
|
|
2189
2341
|
exports.Tabs = Tabs;
|
|
2190
2342
|
exports.TabsCollapsedTrigger = TabsCollapsedTrigger;
|
|
@@ -2193,6 +2345,7 @@ exports.UpgradePrompt = UpgradePrompt;
|
|
|
2193
2345
|
exports.copyText = copyText;
|
|
2194
2346
|
exports.formatBuildInfo = formatBuildInfo;
|
|
2195
2347
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
2348
|
+
exports.isKeyboardOpen = isKeyboardOpen;
|
|
2196
2349
|
exports.isWideWebViewport = isWideWebViewport;
|
|
2197
2350
|
exports.shortenCommit = shortenCommit;
|
|
2198
2351
|
exports.trimTrailingSlash = trimTrailingSlash;
|
|
@@ -2200,5 +2353,6 @@ exports.truncateMiddle = truncateMiddle;
|
|
|
2200
2353
|
exports.useApiCommit = useApiCommit;
|
|
2201
2354
|
exports.useCopyToClipboard = useCopyToClipboard;
|
|
2202
2355
|
exports.useFocusTrap = useFocusTrap;
|
|
2356
|
+
exports.useVisibleViewport = useVisibleViewport;
|
|
2203
2357
|
//# sourceMappingURL=index.js.map
|
|
2204
2358
|
//# sourceMappingURL=index.js.map
|