@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.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React11, { createContext, useMemo, useState, useRef, useEffect, useCallback, useContext, useLayoutEffect } from 'react';
|
|
2
2
|
import { StyleSheet, Platform, View, Text, Pressable, TouchableOpacity, Modal, Animated, FlatList, ScrollView, Easing, useWindowDimensions } from 'react-native';
|
|
3
3
|
import { MODAL_OVERLAY_COLOR, useUi } from '@dloizides/ui-feedback';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -20,7 +20,7 @@ var styles = StyleSheet.create({
|
|
|
20
20
|
});
|
|
21
21
|
var Section = ({ children, style }) => {
|
|
22
22
|
const { theme } = useUi();
|
|
23
|
-
const containerStyle =
|
|
23
|
+
const containerStyle = React11.useMemo(
|
|
24
24
|
() => [styles.card, { borderColor: theme.colors.border, backgroundColor: theme.colors.surface }, style],
|
|
25
25
|
[theme.colors.border, theme.colors.surface, style]
|
|
26
26
|
);
|
|
@@ -31,6 +31,7 @@ var Section = ({ children, style }) => {
|
|
|
31
31
|
var LAYOUT_TEST_IDS = {
|
|
32
32
|
headingText: "heading-text",
|
|
33
33
|
statusLabel: "status-label",
|
|
34
|
+
stickyPreview: "sticky-preview",
|
|
34
35
|
upgradePrompt: "upgrade-prompt",
|
|
35
36
|
upgradePromptCta: "upgrade-prompt-cta",
|
|
36
37
|
upgradePromptDismiss: "upgrade-prompt-dismiss",
|
|
@@ -118,7 +119,7 @@ var Heading = ({
|
|
|
118
119
|
testID
|
|
119
120
|
}) => {
|
|
120
121
|
const { theme } = useUi();
|
|
121
|
-
const headingStyle =
|
|
122
|
+
const headingStyle = React11.useMemo(
|
|
122
123
|
() => [styles2.heading, { color: theme.colors.text }, style],
|
|
123
124
|
[theme.colors.text, style]
|
|
124
125
|
);
|
|
@@ -137,6 +138,7 @@ var DEFAULT_PADDING_H = 10;
|
|
|
137
138
|
var DEFAULT_PADDING_V = 4;
|
|
138
139
|
var DEFAULT_BORDER_RADIUS = 12;
|
|
139
140
|
var DEFAULT_FONT_SIZE = 12;
|
|
141
|
+
var ICON_GAP = 4;
|
|
140
142
|
var styles3 = StyleSheet.create({
|
|
141
143
|
badge: {
|
|
142
144
|
paddingHorizontal: DEFAULT_PADDING_H,
|
|
@@ -146,6 +148,11 @@ var styles3 = StyleSheet.create({
|
|
|
146
148
|
// Never wider than the container: a long label wraps inside the pill instead of being clipped.
|
|
147
149
|
maxWidth: "100%"
|
|
148
150
|
},
|
|
151
|
+
badgeWithIcon: {
|
|
152
|
+
flexDirection: "row",
|
|
153
|
+
alignItems: "center",
|
|
154
|
+
gap: ICON_GAP
|
|
155
|
+
},
|
|
149
156
|
text: {
|
|
150
157
|
fontSize: DEFAULT_FONT_SIZE,
|
|
151
158
|
fontWeight: "600",
|
|
@@ -156,6 +163,7 @@ var StatusBadge = ({
|
|
|
156
163
|
label,
|
|
157
164
|
color,
|
|
158
165
|
backgroundColor,
|
|
166
|
+
icon,
|
|
159
167
|
testID = LAYOUT_TEST_IDS.statusLabel,
|
|
160
168
|
accessibilityLabel,
|
|
161
169
|
accessibilityHint
|
|
@@ -163,17 +171,120 @@ var StatusBadge = ({
|
|
|
163
171
|
const { t } = useUi();
|
|
164
172
|
const dynamicBadge = useMemo(() => ({ backgroundColor }), [backgroundColor]);
|
|
165
173
|
const dynamicText = useMemo(() => ({ color }), [color]);
|
|
166
|
-
|
|
174
|
+
const hasIcon = icon !== void 0 && icon !== null;
|
|
175
|
+
return /* @__PURE__ */ jsxs(
|
|
167
176
|
View,
|
|
168
177
|
{
|
|
169
178
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.statusBadgeHint),
|
|
170
179
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
171
|
-
style: [styles3.badge, dynamicBadge],
|
|
180
|
+
style: [styles3.badge, hasIcon && styles3.badgeWithIcon, dynamicBadge],
|
|
172
181
|
testID,
|
|
173
|
-
children:
|
|
182
|
+
children: [
|
|
183
|
+
hasIcon ? /* @__PURE__ */ jsx(View, { "aria-hidden": true, children: icon }) : null,
|
|
184
|
+
/* @__PURE__ */ jsx(Text, { style: [styles3.text, dynamicText], children: label })
|
|
185
|
+
]
|
|
174
186
|
}
|
|
175
187
|
);
|
|
176
188
|
};
|
|
189
|
+
|
|
190
|
+
// src/responsive.ts
|
|
191
|
+
var WEB_PLATFORM = "web";
|
|
192
|
+
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
193
|
+
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
194
|
+
}
|
|
195
|
+
function isPastStickyLine(sentinelTop, isIntersecting, topOffset) {
|
|
196
|
+
return !isIntersecting && sentinelTop < topOffset;
|
|
197
|
+
}
|
|
198
|
+
function useStuckSentinel(topOffset) {
|
|
199
|
+
const sentinelRef = useRef(null);
|
|
200
|
+
const [isStuck, setIsStuck] = useState(false);
|
|
201
|
+
useEffect(() => {
|
|
202
|
+
const node = sentinelRef.current;
|
|
203
|
+
if (node === null || typeof IntersectionObserver === "undefined") return void 0;
|
|
204
|
+
const observer = new IntersectionObserver(
|
|
205
|
+
(entries) => {
|
|
206
|
+
const entry = entries[entries.length - 1];
|
|
207
|
+
if (entry !== void 0) setIsStuck(isPastStickyLine(entry.boundingClientRect.top, entry.isIntersecting, topOffset));
|
|
208
|
+
},
|
|
209
|
+
{ rootMargin: `-${topOffset}px 0px 0px 0px` }
|
|
210
|
+
);
|
|
211
|
+
observer.observe(node);
|
|
212
|
+
return () => observer.disconnect();
|
|
213
|
+
}, [topOffset]);
|
|
214
|
+
return { sentinelRef, isStuck };
|
|
215
|
+
}
|
|
216
|
+
var KEYBOARD_HEIGHT_RATIO = 0.75;
|
|
217
|
+
var INITIAL = { offsetTop: 0, keyboardOpen: false };
|
|
218
|
+
function isKeyboardOpen(visibleHeight, tallestHeight) {
|
|
219
|
+
return visibleHeight < tallestHeight * KEYBOARD_HEIGHT_RATIO;
|
|
220
|
+
}
|
|
221
|
+
function useVisibleViewport() {
|
|
222
|
+
const [state, setState] = useState(INITIAL);
|
|
223
|
+
const tallest = useRef({ width: 0, height: 0 });
|
|
224
|
+
useEffect(() => {
|
|
225
|
+
const viewport = typeof window === "undefined" ? void 0 : window.visualViewport;
|
|
226
|
+
if (viewport === void 0 || viewport === null) return void 0;
|
|
227
|
+
const read = () => {
|
|
228
|
+
const unzoomedHeight = viewport.height * viewport.scale;
|
|
229
|
+
const unzoomedWidth = viewport.width * viewport.scale;
|
|
230
|
+
const widthChanged = tallest.current.width !== unzoomedWidth;
|
|
231
|
+
const height = widthChanged ? unzoomedHeight : Math.max(tallest.current.height, unzoomedHeight);
|
|
232
|
+
tallest.current = { width: unzoomedWidth, height };
|
|
233
|
+
const offsetTop = viewport.offsetTop;
|
|
234
|
+
const keyboardOpen = isKeyboardOpen(unzoomedHeight, height);
|
|
235
|
+
setState(
|
|
236
|
+
(previous) => previous.offsetTop === offsetTop && previous.keyboardOpen === keyboardOpen ? previous : { offsetTop, keyboardOpen }
|
|
237
|
+
);
|
|
238
|
+
};
|
|
239
|
+
read();
|
|
240
|
+
viewport.addEventListener("resize", read);
|
|
241
|
+
viewport.addEventListener("scroll", read);
|
|
242
|
+
return () => {
|
|
243
|
+
viewport.removeEventListener("resize", read);
|
|
244
|
+
viewport.removeEventListener("scroll", read);
|
|
245
|
+
};
|
|
246
|
+
}, []);
|
|
247
|
+
return state;
|
|
248
|
+
}
|
|
249
|
+
var STICKY_Z_INDEX = 5;
|
|
250
|
+
var styles4 = StyleSheet.create({
|
|
251
|
+
sentinel: { height: 1, marginBottom: -1 },
|
|
252
|
+
compact: { borderBottomWidth: 1 }
|
|
253
|
+
});
|
|
254
|
+
var StickyPreview = ({
|
|
255
|
+
full,
|
|
256
|
+
compact,
|
|
257
|
+
forceCompact = false,
|
|
258
|
+
topOffset = 0,
|
|
259
|
+
accessibilityLabel,
|
|
260
|
+
testID = LAYOUT_TEST_IDS.stickyPreview
|
|
261
|
+
}) => {
|
|
262
|
+
const { theme } = useUi();
|
|
263
|
+
const { offsetTop, keyboardOpen } = useVisibleViewport();
|
|
264
|
+
const { sentinelRef, isStuck } = useStuckSentinel(topOffset);
|
|
265
|
+
const isCompact = forceCompact || isStuck || keyboardOpen;
|
|
266
|
+
const pinned = useMemo(() => {
|
|
267
|
+
const web = { position: "sticky", top: topOffset + offsetTop, zIndex: STICKY_Z_INDEX };
|
|
268
|
+
return Platform.OS === WEB_PLATFORM ? web : {};
|
|
269
|
+
}, [offsetTop, topOffset]);
|
|
270
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
271
|
+
/* @__PURE__ */ jsx(View, { "aria-hidden": true, ref: sentinelRef, style: styles4.sentinel }),
|
|
272
|
+
/* @__PURE__ */ jsx(
|
|
273
|
+
View,
|
|
274
|
+
{
|
|
275
|
+
accessibilityLabel,
|
|
276
|
+
role: "region",
|
|
277
|
+
style: [
|
|
278
|
+
pinned,
|
|
279
|
+
{ backgroundColor: theme.colors.background, borderColor: theme.colors.border },
|
|
280
|
+
isCompact && styles4.compact
|
|
281
|
+
],
|
|
282
|
+
testID,
|
|
283
|
+
children: /* @__PURE__ */ jsx(View, { testID: `${testID}-${isCompact ? "compact" : "full"}`, children: isCompact ? compact : full })
|
|
284
|
+
}
|
|
285
|
+
)
|
|
286
|
+
] });
|
|
287
|
+
};
|
|
177
288
|
var TRACK_PADDING = 3;
|
|
178
289
|
var TRACK_RADIUS = 999;
|
|
179
290
|
var SEGMENT_RADIUS = 999;
|
|
@@ -185,7 +296,7 @@ var BORDER_WIDTH = 1;
|
|
|
185
296
|
var SEGMENT_BOX_SHADOW = "0px 1px 3px rgba(20, 30, 50, 0.1)";
|
|
186
297
|
var SHADOW_ELEVATION = 2;
|
|
187
298
|
var TRANSPARENT = "transparent";
|
|
188
|
-
var
|
|
299
|
+
var styles5 = StyleSheet.create({
|
|
189
300
|
track: {
|
|
190
301
|
flexDirection: "row",
|
|
191
302
|
alignSelf: "flex-start",
|
|
@@ -230,7 +341,7 @@ function SegmentedControl({
|
|
|
230
341
|
{
|
|
231
342
|
accessibilityRole: "tablist",
|
|
232
343
|
"aria-label": accessibilityLabel,
|
|
233
|
-
style: [
|
|
344
|
+
style: [styles5.track, { backgroundColor: colors.background, borderColor: colors.border }, style],
|
|
234
345
|
testID,
|
|
235
346
|
children: options.map((opt) => {
|
|
236
347
|
const selected = opt.value === value;
|
|
@@ -243,13 +354,13 @@ function SegmentedControl({
|
|
|
243
354
|
accessibilityHint: opt.accessibilityHint,
|
|
244
355
|
onPress: () => onChange(opt.value),
|
|
245
356
|
style: [
|
|
246
|
-
|
|
247
|
-
selected ?
|
|
357
|
+
styles5.segment,
|
|
358
|
+
selected ? styles5.segmentSelected : null,
|
|
248
359
|
{ backgroundColor: selected ? colors.surface : TRANSPARENT }
|
|
249
360
|
],
|
|
250
361
|
testID: opt.testID,
|
|
251
362
|
...ariaSelectedProps(selected),
|
|
252
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
363
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles5.label, { color: selected ? colors.text : colors.textSecondary }], children: opt.label })
|
|
253
364
|
},
|
|
254
365
|
opt.value
|
|
255
366
|
);
|
|
@@ -386,7 +497,7 @@ var HEADING_PADDING_H = 16;
|
|
|
386
497
|
var HEADING_PADDING_TOP = 8;
|
|
387
498
|
var HEADING_PADDING_BOTTOM = 4;
|
|
388
499
|
var HEADING_LETTER_SPACING = 0.5;
|
|
389
|
-
var
|
|
500
|
+
var styles6 = StyleSheet.create({
|
|
390
501
|
heading: {
|
|
391
502
|
fontSize: HEADING_FONT_SIZE,
|
|
392
503
|
fontWeight: HEADING_FONT_WEIGHT,
|
|
@@ -402,18 +513,28 @@ var MenuHeading = ({ testID, text }) => {
|
|
|
402
513
|
Text,
|
|
403
514
|
{
|
|
404
515
|
accessibilityRole: "header",
|
|
405
|
-
style: [
|
|
516
|
+
style: [styles6.heading, { color: theme.colors.textSecondary }],
|
|
406
517
|
testID: `${testID}-menu-heading`,
|
|
407
518
|
children: text
|
|
408
519
|
}
|
|
409
520
|
);
|
|
410
521
|
};
|
|
522
|
+
|
|
523
|
+
// src/ModalDropdown/SelectedMarker.ts
|
|
524
|
+
var SelectedMarker = /* @__PURE__ */ ((SelectedMarker2) => {
|
|
525
|
+
SelectedMarker2["Bold"] = "bold";
|
|
526
|
+
SelectedMarker2["AccentCheck"] = "accent-check";
|
|
527
|
+
return SelectedMarker2;
|
|
528
|
+
})(SelectedMarker || {});
|
|
411
529
|
var OPTION_BORDER_RADIUS = 4;
|
|
412
530
|
var BODY_FONT_SIZE = 14;
|
|
413
531
|
var SELECTED_FONT_WEIGHT = "600";
|
|
414
532
|
var OPTION_PADDING_H = 16;
|
|
415
533
|
var OPTION_PADDING_V = 12;
|
|
416
|
-
var
|
|
534
|
+
var ACCENT_BAR_WIDTH = 3;
|
|
535
|
+
var CHECK_GAP = 8;
|
|
536
|
+
var CHECK_GLYPH = "\u2713";
|
|
537
|
+
var styles7 = StyleSheet.create({
|
|
417
538
|
option: {
|
|
418
539
|
paddingHorizontal: OPTION_PADDING_H,
|
|
419
540
|
paddingVertical: OPTION_PADDING_V,
|
|
@@ -422,35 +543,63 @@ var styles6 = StyleSheet.create({
|
|
|
422
543
|
borderRadius: OPTION_BORDER_RADIUS
|
|
423
544
|
},
|
|
424
545
|
optionText: { fontSize: BODY_FONT_SIZE },
|
|
425
|
-
selectedText: { fontWeight: SELECTED_FONT_WEIGHT }
|
|
546
|
+
selectedText: { fontWeight: SELECTED_FONT_WEIGHT },
|
|
547
|
+
markedRow: {
|
|
548
|
+
flexDirection: "row",
|
|
549
|
+
alignItems: "center",
|
|
550
|
+
justifyContent: "space-between",
|
|
551
|
+
columnGap: CHECK_GAP,
|
|
552
|
+
borderLeftWidth: ACCENT_BAR_WIDTH,
|
|
553
|
+
borderLeftColor: "transparent",
|
|
554
|
+
paddingLeft: OPTION_PADDING_H - ACCENT_BAR_WIDTH
|
|
555
|
+
},
|
|
556
|
+
markedText: { flexShrink: 1 }
|
|
426
557
|
});
|
|
427
558
|
var OptionRow = ({
|
|
428
559
|
testID,
|
|
429
560
|
label,
|
|
430
561
|
isSelected,
|
|
431
562
|
isHighlighted = false,
|
|
432
|
-
onSelect
|
|
563
|
+
onSelect,
|
|
564
|
+
selectedMarker = "bold" /* Bold */,
|
|
565
|
+
asMenuItem = false
|
|
433
566
|
}) => {
|
|
434
567
|
const { theme, t } = useUi();
|
|
435
568
|
const { colors } = theme;
|
|
436
569
|
const handlePress = useCallback(() => {
|
|
437
570
|
onSelect();
|
|
438
571
|
}, [onSelect]);
|
|
572
|
+
const accentColor = theme.palette.primary["500"];
|
|
573
|
+
const isMarked = selectedMarker === "accent-check" /* AccentCheck */;
|
|
439
574
|
const isActive = isSelected || isHighlighted;
|
|
440
|
-
const rowStyle = [
|
|
441
|
-
|
|
442
|
-
|
|
575
|
+
const rowStyle = [
|
|
576
|
+
styles7.option,
|
|
577
|
+
isMarked ? styles7.markedRow : null,
|
|
578
|
+
isActive ? { backgroundColor: colors.surfaceElevated } : null,
|
|
579
|
+
isMarked && isSelected ? { borderLeftColor: accentColor } : null
|
|
580
|
+
];
|
|
581
|
+
const textStyle = [
|
|
582
|
+
styles7.optionText,
|
|
583
|
+
{ color: colors.text },
|
|
584
|
+
isSelected ? styles7.selectedText : null,
|
|
585
|
+
isMarked ? styles7.markedText : null
|
|
586
|
+
];
|
|
587
|
+
const selectionProps = asMenuItem ? { "aria-current": isSelected ? "true" : void 0 } : { "aria-selected": isSelected };
|
|
588
|
+
return /* @__PURE__ */ jsxs(
|
|
443
589
|
TouchableOpacity,
|
|
444
590
|
{
|
|
445
591
|
accessible: true,
|
|
446
592
|
accessibilityHint: t(LAYOUT_I18N.selectOptionHint),
|
|
447
593
|
accessibilityLabel: label,
|
|
448
|
-
accessibilityRole: "button",
|
|
449
|
-
|
|
594
|
+
accessibilityRole: asMenuItem ? "menuitem" : "button",
|
|
595
|
+
...selectionProps,
|
|
450
596
|
style: rowStyle,
|
|
451
597
|
testID,
|
|
452
598
|
onPress: handlePress,
|
|
453
|
-
children:
|
|
599
|
+
children: [
|
|
600
|
+
/* @__PURE__ */ jsx(Text, { style: textStyle, children: label }),
|
|
601
|
+
isMarked && isSelected ? /* @__PURE__ */ jsx(View, { "aria-hidden": true, testID: `${testID}-check`, children: /* @__PURE__ */ jsx(Text, { style: [styles7.selectedText, { color: accentColor }], children: CHECK_GLYPH }) }) : null
|
|
602
|
+
]
|
|
454
603
|
}
|
|
455
604
|
);
|
|
456
605
|
};
|
|
@@ -607,7 +756,7 @@ var IS_WEB2 = Platform.OS === "web";
|
|
|
607
756
|
var BORDER_RADIUS2 = 8;
|
|
608
757
|
var BORDER_WIDTH3 = 1;
|
|
609
758
|
var MENU_PADDING2 = 4;
|
|
610
|
-
var
|
|
759
|
+
var styles8 = StyleSheet.create({
|
|
611
760
|
/** Native (in-tree) popover — anchored absolutely just under the trigger. */
|
|
612
761
|
popover: {
|
|
613
762
|
position: "absolute",
|
|
@@ -644,6 +793,7 @@ var InlineMenu = ({
|
|
|
644
793
|
menuMinWidth = 0,
|
|
645
794
|
menuHeading,
|
|
646
795
|
animatedStyle,
|
|
796
|
+
selectedMarker,
|
|
647
797
|
onSelect,
|
|
648
798
|
onClose
|
|
649
799
|
}) => {
|
|
@@ -693,7 +843,7 @@ var InlineMenu = ({
|
|
|
693
843
|
themed
|
|
694
844
|
];
|
|
695
845
|
}
|
|
696
|
-
return [
|
|
846
|
+
return [styles8.popover, { minWidth: menuMinWidth }, themed];
|
|
697
847
|
}, [colors.border, colors.surface, menuMinWidth, rect]);
|
|
698
848
|
const menu = /* @__PURE__ */ jsx(
|
|
699
849
|
View,
|
|
@@ -708,15 +858,17 @@ var InlineMenu = ({
|
|
|
708
858
|
Animated.View,
|
|
709
859
|
{
|
|
710
860
|
pointerEvents: isOpen ? "auto" : "none",
|
|
711
|
-
style: [
|
|
861
|
+
style: [styles8.animated, animatedStyle, isOpen ? null : styles8.inert],
|
|
712
862
|
children: [
|
|
713
863
|
menuHeading !== void 0 ? /* @__PURE__ */ jsx(MenuHeading, { testID, text: menuHeading }) : null,
|
|
714
|
-
/* @__PURE__ */ jsx(ScrollView, { style:
|
|
864
|
+
/* @__PURE__ */ jsx(ScrollView, { style: styles8.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsx(
|
|
715
865
|
OptionRow,
|
|
716
866
|
{
|
|
867
|
+
asMenuItem: true,
|
|
717
868
|
isHighlighted: index === highlightedIndex,
|
|
718
869
|
isSelected: option.value === value,
|
|
719
870
|
label: option.label,
|
|
871
|
+
selectedMarker,
|
|
720
872
|
testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
|
|
721
873
|
onSelect: () => handleSelect(option.value)
|
|
722
874
|
},
|
|
@@ -730,14 +882,6 @@ var InlineMenu = ({
|
|
|
730
882
|
if (IS_WEB2) return createPortal(menu, document.body);
|
|
731
883
|
return menu;
|
|
732
884
|
};
|
|
733
|
-
|
|
734
|
-
// src/responsive.ts
|
|
735
|
-
var WEB_PLATFORM = "web";
|
|
736
|
-
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
737
|
-
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
// src/ModalDropdown/resolveDropdownVariant.ts
|
|
741
885
|
var MENU_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
742
886
|
function resolveDropdownVariant(explicit, width, platformOS) {
|
|
743
887
|
if (explicit !== void 0) return explicit;
|
|
@@ -765,7 +909,7 @@ var CARET_OPEN_ROTATION = "180deg";
|
|
|
765
909
|
var CARET_CLOSED_ROTATION = "0deg";
|
|
766
910
|
var POPOVER_ENTER_SCALE = 0.96;
|
|
767
911
|
var POPOVER_MOTION_MS = 120;
|
|
768
|
-
var
|
|
912
|
+
var styles9 = StyleSheet.create({
|
|
769
913
|
anchor: { position: "relative" },
|
|
770
914
|
container: {
|
|
771
915
|
borderWidth: BORDER_WIDTH4,
|
|
@@ -828,7 +972,8 @@ var ModalDropdown = ({
|
|
|
828
972
|
menuMinWidth,
|
|
829
973
|
showCaret = false,
|
|
830
974
|
showHamburger = false,
|
|
831
|
-
menuHeading
|
|
975
|
+
menuHeading,
|
|
976
|
+
selectedMarker
|
|
832
977
|
}) => {
|
|
833
978
|
const { theme, t } = useUi();
|
|
834
979
|
const { colors } = theme;
|
|
@@ -843,6 +988,8 @@ var ModalDropdown = ({
|
|
|
843
988
|
testID
|
|
844
989
|
});
|
|
845
990
|
const anchorRef = useRef(null);
|
|
991
|
+
const triggerRef = useRef(null);
|
|
992
|
+
const popupProps = { "aria-haspopup": isMenu ? "menu" : "dialog" };
|
|
846
993
|
const dialogRef = useRef(null);
|
|
847
994
|
useFocusTrap(dialogRef, isOpen && !isMenu);
|
|
848
995
|
const menuAnim = useEnterExit({
|
|
@@ -869,6 +1016,7 @@ var ModalDropdown = ({
|
|
|
869
1016
|
(optionValue) => {
|
|
870
1017
|
onChange(optionValue);
|
|
871
1018
|
setIsOpen(false);
|
|
1019
|
+
triggerRef.current?.focus();
|
|
872
1020
|
},
|
|
873
1021
|
[onChange]
|
|
874
1022
|
);
|
|
@@ -876,19 +1024,19 @@ var ModalDropdown = ({
|
|
|
876
1024
|
const isCaret = showCaret && !isHamburger;
|
|
877
1025
|
const containerStyle = useMemo(
|
|
878
1026
|
() => renderTrigger !== void 0 ? void 0 : [
|
|
879
|
-
|
|
880
|
-
isHamburger ?
|
|
1027
|
+
styles9.container,
|
|
1028
|
+
isHamburger ? styles9.containerHamburger : isCaret ? styles9.containerMenu : null,
|
|
881
1029
|
{ borderColor: colors.border, backgroundColor: colors.surface }
|
|
882
1030
|
],
|
|
883
1031
|
[colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
|
|
884
1032
|
);
|
|
885
1033
|
const hamburgerStyle = useMemo(
|
|
886
|
-
() => [
|
|
1034
|
+
() => [styles9.hamburger, { color: colors.textSecondary }],
|
|
887
1035
|
[colors.textSecondary]
|
|
888
1036
|
);
|
|
889
1037
|
const caretStyle = useMemo(
|
|
890
1038
|
() => [
|
|
891
|
-
|
|
1039
|
+
styles9.caret,
|
|
892
1040
|
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
893
1041
|
],
|
|
894
1042
|
[colors.textSecondary, isOpen]
|
|
@@ -898,11 +1046,11 @@ var ModalDropdown = ({
|
|
|
898
1046
|
[optionTestID, testID]
|
|
899
1047
|
);
|
|
900
1048
|
const anchorStyle = useMemo(
|
|
901
|
-
() => [
|
|
1049
|
+
() => [styles9.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
902
1050
|
[isMenu, isOpen]
|
|
903
1051
|
);
|
|
904
1052
|
const modalContentStyle = useMemo(
|
|
905
|
-
() => [
|
|
1053
|
+
() => [styles9.modalContent, { backgroundColor: colors.surface }],
|
|
906
1054
|
[colors.surface]
|
|
907
1055
|
);
|
|
908
1056
|
const renderModalOption = useCallback(
|
|
@@ -911,22 +1059,23 @@ var ModalDropdown = ({
|
|
|
911
1059
|
{
|
|
912
1060
|
isSelected: item.value === value,
|
|
913
1061
|
label: item.label,
|
|
1062
|
+
selectedMarker,
|
|
914
1063
|
testID: optionTestIDFor(item.value),
|
|
915
1064
|
onSelect: () => handleSelect(item.value)
|
|
916
1065
|
}
|
|
917
1066
|
),
|
|
918
|
-
[handleSelect, optionTestIDFor, value]
|
|
1067
|
+
[handleSelect, optionTestIDFor, selectedMarker, value]
|
|
919
1068
|
);
|
|
920
1069
|
const keyExtractor = useCallback((item) => String(item.value), []);
|
|
921
1070
|
return /* @__PURE__ */ jsxs(View, { ref: anchorRef, style: anchorStyle, children: [
|
|
922
|
-
/* @__PURE__ */ jsxs(TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
|
|
1071
|
+
/* @__PURE__ */ jsxs(TouchableOpacity, { ...a11yProps, ...popupProps, ref: triggerRef, style: containerStyle, onPress: handleToggle, children: [
|
|
923
1072
|
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
924
1073
|
/* @__PURE__ */ jsx(Text, { style: hamburgerStyle, children: HAMBURGER_GLYPH }),
|
|
925
|
-
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [
|
|
1074
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles9.selectedText, styles9.selectedTextMenu, { color: colors.text }], children: selectedLabel })
|
|
926
1075
|
] }) : isCaret ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
927
|
-
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [
|
|
1076
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: [styles9.selectedText, styles9.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
|
|
928
1077
|
/* @__PURE__ */ jsx(Text, { style: caretStyle, children: CARET_GLYPH })
|
|
929
|
-
] }) : /* @__PURE__ */ jsx(Text, { style: [
|
|
1078
|
+
] }) : /* @__PURE__ */ jsx(Text, { style: [styles9.selectedText, { color: colors.text }], children: selectedLabel }),
|
|
930
1079
|
hintNode
|
|
931
1080
|
] }),
|
|
932
1081
|
isMenu && menuAnim.mounted ? /* @__PURE__ */ jsx(
|
|
@@ -940,13 +1089,14 @@ var ModalDropdown = ({
|
|
|
940
1089
|
menuMinWidth,
|
|
941
1090
|
optionTestID: optionTestIDFor,
|
|
942
1091
|
options,
|
|
1092
|
+
selectedMarker,
|
|
943
1093
|
testID,
|
|
944
1094
|
value,
|
|
945
1095
|
onClose: handleClose,
|
|
946
1096
|
onSelect: handleSelect
|
|
947
1097
|
}
|
|
948
1098
|
) : null,
|
|
949
|
-
!isMenu ? /* @__PURE__ */ jsx(Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxs(View, { style:
|
|
1099
|
+
!isMenu ? /* @__PURE__ */ jsx(Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxs(View, { style: styles9.modalOverlay, children: [
|
|
950
1100
|
/* @__PURE__ */ jsx(
|
|
951
1101
|
TouchableOpacity,
|
|
952
1102
|
{
|
|
@@ -1039,7 +1189,7 @@ var ROW_PAD_V = 8;
|
|
|
1039
1189
|
var PANEL_PAD_TOP = 16;
|
|
1040
1190
|
var BORDER_WIDTH5 = 1;
|
|
1041
1191
|
var TEXT_ON_PRIMARY = "#ffffff";
|
|
1042
|
-
var
|
|
1192
|
+
var styles10 = StyleSheet.create({
|
|
1043
1193
|
root: {
|
|
1044
1194
|
width: "100%"
|
|
1045
1195
|
},
|
|
@@ -1093,7 +1243,7 @@ var WideTabStrip = ({
|
|
|
1093
1243
|
textSecondary,
|
|
1094
1244
|
surfaceElevated,
|
|
1095
1245
|
stripStyle
|
|
1096
|
-
}) => /* @__PURE__ */ jsx(View, { style: [
|
|
1246
|
+
}) => /* @__PURE__ */ jsx(View, { style: [styles10.stripOuter, { borderBottomColor: borderColor }], children: /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsx(View, { accessibilityRole: "tablist", "aria-label": accessibilityLabel, style: [styles10.strip, stripStyle], children: tabs.map((tab) => {
|
|
1097
1247
|
const selected = tab.key === activeKey;
|
|
1098
1248
|
const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;
|
|
1099
1249
|
const pillColor = selected ? primaryColor : surfaceElevated;
|
|
@@ -1107,10 +1257,10 @@ var WideTabStrip = ({
|
|
|
1107
1257
|
accessibilityLabel: tab.accessibilityLabel ?? tab.label,
|
|
1108
1258
|
accessibilityHint: tab.accessibilityHint,
|
|
1109
1259
|
onPress: () => onChange(tab.key),
|
|
1110
|
-
style: [
|
|
1260
|
+
style: [styles10.pill, { backgroundColor: pillColor }],
|
|
1111
1261
|
testID: tab.testID,
|
|
1112
1262
|
...ariaTabProps(selected, panelId, tabId),
|
|
1113
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1263
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles10.pillText, { color: textColor }], children: tab.label })
|
|
1114
1264
|
},
|
|
1115
1265
|
tab.key
|
|
1116
1266
|
);
|
|
@@ -1135,7 +1285,7 @@ var Tabs = ({
|
|
|
1135
1285
|
const activePanelId = `${idPrefix}-panel-${activeKey}`;
|
|
1136
1286
|
const activeTabId = `${idPrefix}-tab-${activeKey}`;
|
|
1137
1287
|
const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
|
|
1138
|
-
return /* @__PURE__ */ jsxs(View, { style: [
|
|
1288
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles10.root, style], testID, children: [
|
|
1139
1289
|
collapsed ? /* @__PURE__ */ jsx(
|
|
1140
1290
|
TabsMenu,
|
|
1141
1291
|
{
|
|
@@ -1162,7 +1312,7 @@ var Tabs = ({
|
|
|
1162
1312
|
onChange
|
|
1163
1313
|
}
|
|
1164
1314
|
),
|
|
1165
|
-
/* @__PURE__ */ jsx(View, { accessibilityRole: "none", style: [
|
|
1315
|
+
/* @__PURE__ */ jsx(View, { accessibilityRole: "none", style: [styles10.panel, panelStyle], ...panelAria, children })
|
|
1166
1316
|
] });
|
|
1167
1317
|
};
|
|
1168
1318
|
var PROMPT_PADDING = 20;
|
|
@@ -1177,7 +1327,7 @@ var DISMISS_FONT_SIZE = 13;
|
|
|
1177
1327
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
1178
1328
|
var MESSAGE_MARGIN_BOTTOM = 16;
|
|
1179
1329
|
var CTA_MARGIN_BOTTOM = 8;
|
|
1180
|
-
var
|
|
1330
|
+
var styles11 = StyleSheet.create({
|
|
1181
1331
|
container: {
|
|
1182
1332
|
padding: PROMPT_PADDING,
|
|
1183
1333
|
borderRadius: PROMPT_BORDER_RADIUS,
|
|
@@ -1212,21 +1362,21 @@ var UpgradePrompt = ({
|
|
|
1212
1362
|
return /* @__PURE__ */ jsxs(
|
|
1213
1363
|
View,
|
|
1214
1364
|
{
|
|
1215
|
-
style: [
|
|
1365
|
+
style: [styles11.container, { borderColor: primary, backgroundColor: colors.surface }],
|
|
1216
1366
|
testID: LAYOUT_TEST_IDS.upgradePrompt,
|
|
1217
1367
|
children: [
|
|
1218
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
1219
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
1368
|
+
/* @__PURE__ */ jsx(Text, { style: [styles11.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
|
|
1369
|
+
/* @__PURE__ */ jsx(Text, { style: [styles11.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
|
|
1220
1370
|
/* @__PURE__ */ jsx(
|
|
1221
1371
|
TouchableOpacity,
|
|
1222
1372
|
{
|
|
1223
1373
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
|
|
1224
1374
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
|
|
1225
1375
|
accessibilityRole: "button",
|
|
1226
|
-
style: [
|
|
1376
|
+
style: [styles11.cta, { backgroundColor: primary }],
|
|
1227
1377
|
testID: LAYOUT_TEST_IDS.upgradePromptCta,
|
|
1228
1378
|
onPress: handleUpgradePress,
|
|
1229
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1379
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles11.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
|
|
1230
1380
|
}
|
|
1231
1381
|
),
|
|
1232
1382
|
onDismiss ? /* @__PURE__ */ jsx(
|
|
@@ -1235,10 +1385,10 @@ var UpgradePrompt = ({
|
|
|
1235
1385
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
|
|
1236
1386
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
|
|
1237
1387
|
accessibilityRole: "button",
|
|
1238
|
-
style:
|
|
1388
|
+
style: styles11.dismiss,
|
|
1239
1389
|
testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
|
|
1240
1390
|
onPress: onDismiss,
|
|
1241
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1391
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles11.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
|
|
1242
1392
|
}
|
|
1243
1393
|
) : null
|
|
1244
1394
|
]
|
|
@@ -1247,7 +1397,7 @@ var UpgradePrompt = ({
|
|
|
1247
1397
|
};
|
|
1248
1398
|
var CLOSE_ICON_SIZE = 18;
|
|
1249
1399
|
var PANEL_ENTER_SCALE = 0.96;
|
|
1250
|
-
var
|
|
1400
|
+
var styles12 = StyleSheet.create({
|
|
1251
1401
|
animatedFill: { flex: 1 },
|
|
1252
1402
|
container: {
|
|
1253
1403
|
flex: 1,
|
|
@@ -1273,8 +1423,8 @@ var ModalShell = ({
|
|
|
1273
1423
|
}) => {
|
|
1274
1424
|
const { theme, t } = useUi();
|
|
1275
1425
|
const { style: sheetStyle, mounted } = useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });
|
|
1276
|
-
const containerStyle =
|
|
1277
|
-
() => [
|
|
1426
|
+
const containerStyle = React11.useMemo(
|
|
1427
|
+
() => [styles12.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1278
1428
|
[theme.colors.background, contentStyle]
|
|
1279
1429
|
);
|
|
1280
1430
|
const closeA11yLabel = t(LAYOUT_I18N.close);
|
|
@@ -1286,7 +1436,7 @@ var ModalShell = ({
|
|
|
1286
1436
|
testID: LAYOUT_TEST_IDS.modalShell,
|
|
1287
1437
|
visible: mounted,
|
|
1288
1438
|
onRequestClose: onCancel,
|
|
1289
|
-
children: /* @__PURE__ */ jsx(Animated.View, { style: [
|
|
1439
|
+
children: /* @__PURE__ */ jsx(Animated.View, { style: [styles12.animatedFill, sheetStyle], children: /* @__PURE__ */ jsxs(
|
|
1290
1440
|
ScrollView,
|
|
1291
1441
|
{
|
|
1292
1442
|
accessibilityViewIsModal: true,
|
|
@@ -1294,7 +1444,7 @@ var ModalShell = ({
|
|
|
1294
1444
|
role: "dialog",
|
|
1295
1445
|
style: containerStyle,
|
|
1296
1446
|
children: [
|
|
1297
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1447
|
+
/* @__PURE__ */ jsxs(View, { style: styles12.headerRow, children: [
|
|
1298
1448
|
/* @__PURE__ */ jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
|
|
1299
1449
|
showClose ? /* @__PURE__ */ jsx(
|
|
1300
1450
|
TouchableOpacity,
|
|
@@ -1302,7 +1452,7 @@ var ModalShell = ({
|
|
|
1302
1452
|
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1303
1453
|
accessibilityLabel: closeA11yLabel,
|
|
1304
1454
|
accessibilityRole: "button",
|
|
1305
|
-
style:
|
|
1455
|
+
style: styles12.closeButton,
|
|
1306
1456
|
testID: LAYOUT_TEST_IDS.modalShellClose,
|
|
1307
1457
|
onPress: onCancel,
|
|
1308
1458
|
children: /* @__PURE__ */ jsx(SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
|
|
@@ -1348,7 +1498,7 @@ var HEADER_MARGIN = 12;
|
|
|
1348
1498
|
var DIALOG_MAX_HEIGHT = "90%";
|
|
1349
1499
|
var PANEL_ENTER_SCALE2 = 0.96;
|
|
1350
1500
|
var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640 };
|
|
1351
|
-
var
|
|
1501
|
+
var styles13 = StyleSheet.create({
|
|
1352
1502
|
overlay: {
|
|
1353
1503
|
flex: 1,
|
|
1354
1504
|
justifyContent: "center",
|
|
@@ -1400,15 +1550,15 @@ var Modal3 = ({
|
|
|
1400
1550
|
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
1401
1551
|
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
1402
1552
|
const dialogStyle = useMemo(
|
|
1403
|
-
() => [
|
|
1553
|
+
() => [styles13.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
1404
1554
|
[theme.colors.surface, size]
|
|
1405
1555
|
);
|
|
1406
1556
|
const hasHeader = title !== void 0 || showClose;
|
|
1407
|
-
return /* @__PURE__ */ jsx(Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxs(View, { style:
|
|
1557
|
+
return /* @__PURE__ */ jsx(Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxs(View, { style: styles13.overlay, children: [
|
|
1408
1558
|
/* @__PURE__ */ jsx(
|
|
1409
1559
|
Animated.View,
|
|
1410
1560
|
{
|
|
1411
|
-
style: [StyleSheet.absoluteFill,
|
|
1561
|
+
style: [StyleSheet.absoluteFill, styles13.scrim, { opacity: backdrop.style.opacity }]
|
|
1412
1562
|
}
|
|
1413
1563
|
),
|
|
1414
1564
|
/* @__PURE__ */ jsx(
|
|
@@ -1434,8 +1584,8 @@ var Modal3 = ({
|
|
|
1434
1584
|
style: [dialogStyle, panel.style],
|
|
1435
1585
|
testID,
|
|
1436
1586
|
children: [
|
|
1437
|
-
hasHeader ? /* @__PURE__ */ jsxs(View, { style:
|
|
1438
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
1587
|
+
hasHeader ? /* @__PURE__ */ jsxs(View, { style: styles13.headerRow, children: [
|
|
1588
|
+
/* @__PURE__ */ jsx(View, { style: styles13.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsx(Heading, { children: title }) : null }),
|
|
1439
1589
|
showClose ? /* @__PURE__ */ jsx(
|
|
1440
1590
|
IconButton,
|
|
1441
1591
|
{
|
|
@@ -1452,7 +1602,7 @@ var Modal3 = ({
|
|
|
1452
1602
|
) : null
|
|
1453
1603
|
] }) : null,
|
|
1454
1604
|
/* @__PURE__ */ jsx(ScrollView, { children }),
|
|
1455
|
-
footer !== void 0 ? /* @__PURE__ */ jsx(View, { style:
|
|
1605
|
+
footer !== void 0 ? /* @__PURE__ */ jsx(View, { style: styles13.footer, children: footer }) : null
|
|
1456
1606
|
]
|
|
1457
1607
|
}
|
|
1458
1608
|
)
|
|
@@ -1461,7 +1611,7 @@ var Modal3 = ({
|
|
|
1461
1611
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
1462
1612
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
1463
1613
|
var BUTTON_GAP = 12;
|
|
1464
|
-
var
|
|
1614
|
+
var styles14 = StyleSheet.create({
|
|
1465
1615
|
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
|
|
1466
1616
|
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
1467
1617
|
});
|
|
@@ -1480,7 +1630,7 @@ var ConfirmDialog = ({
|
|
|
1480
1630
|
const { theme, t } = useUi();
|
|
1481
1631
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
1482
1632
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
1483
|
-
const footer = /* @__PURE__ */ jsxs(View, { style:
|
|
1633
|
+
const footer = /* @__PURE__ */ jsxs(View, { style: styles14.footer, children: [
|
|
1484
1634
|
/* @__PURE__ */ jsx(
|
|
1485
1635
|
Button,
|
|
1486
1636
|
{
|
|
@@ -1516,7 +1666,7 @@ var ConfirmDialog = ({
|
|
|
1516
1666
|
title,
|
|
1517
1667
|
visible,
|
|
1518
1668
|
onClose: onCancel,
|
|
1519
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1669
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles14.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
|
|
1520
1670
|
}
|
|
1521
1671
|
);
|
|
1522
1672
|
};
|
|
@@ -1529,14 +1679,14 @@ function useAccordionContext() {
|
|
|
1529
1679
|
return value;
|
|
1530
1680
|
}
|
|
1531
1681
|
var BOXED_GAP = 12;
|
|
1532
|
-
var
|
|
1682
|
+
var styles15 = StyleSheet.create({
|
|
1533
1683
|
container: { alignSelf: "stretch" },
|
|
1534
1684
|
boxed: { gap: BOXED_GAP }
|
|
1535
1685
|
});
|
|
1536
1686
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
1537
1687
|
const ids = new Set(defaultOpenIds ?? []);
|
|
1538
|
-
|
|
1539
|
-
if (!
|
|
1688
|
+
React11.Children.forEach(children, (child) => {
|
|
1689
|
+
if (!React11.isValidElement(child)) return;
|
|
1540
1690
|
const props = child.props;
|
|
1541
1691
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
1542
1692
|
ids.add(props.id);
|
|
@@ -1586,7 +1736,7 @@ var Accordion = ({
|
|
|
1586
1736
|
[openSet, toggle, allowMultiple, variant]
|
|
1587
1737
|
);
|
|
1588
1738
|
const containerStyle = useMemo(() => {
|
|
1589
|
-
const base = variant === "boxed" ? [
|
|
1739
|
+
const base = variant === "boxed" ? [styles15.container, styles15.boxed] : [styles15.container];
|
|
1590
1740
|
if (style === void 0) return base;
|
|
1591
1741
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1592
1742
|
}, [style, variant]);
|
|
@@ -1618,7 +1768,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1618
1768
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1619
1769
|
var BOX_MARKER_GAP = 6;
|
|
1620
1770
|
var BOX_MARKER = "\u25B8";
|
|
1621
|
-
var
|
|
1771
|
+
var styles16 = StyleSheet.create({
|
|
1622
1772
|
item: { borderTopWidth: StyleSheet.hairlineWidth },
|
|
1623
1773
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1624
1774
|
header: {
|
|
@@ -1694,19 +1844,19 @@ var AccordionItem = ({
|
|
|
1694
1844
|
);
|
|
1695
1845
|
const keyboardProps = Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1696
1846
|
const itemStyle = useMemo(
|
|
1697
|
-
() => boxed ? [
|
|
1847
|
+
() => boxed ? [styles16.boxItem, { borderColor: colors.border }] : [styles16.item, { borderTopColor: colors.border }],
|
|
1698
1848
|
[boxed, colors.border]
|
|
1699
1849
|
);
|
|
1700
1850
|
const headerStyle = useMemo(
|
|
1701
1851
|
() => [
|
|
1702
|
-
|
|
1703
|
-
...boxed ? [
|
|
1852
|
+
styles16.header,
|
|
1853
|
+
...boxed ? [styles16.boxHeader] : [],
|
|
1704
1854
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1705
1855
|
],
|
|
1706
1856
|
[boxed, disabled]
|
|
1707
1857
|
);
|
|
1708
1858
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1709
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ?
|
|
1859
|
+
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ? styles16.boxTitle : styles16.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
|
|
1710
1860
|
return /* @__PURE__ */ jsxs(View, { style: itemStyle, children: [
|
|
1711
1861
|
/* @__PURE__ */ jsxs(
|
|
1712
1862
|
Pressable,
|
|
@@ -1723,7 +1873,7 @@ var AccordionItem = ({
|
|
|
1723
1873
|
onPress: handlePress,
|
|
1724
1874
|
...keyboardProps,
|
|
1725
1875
|
children: [
|
|
1726
|
-
/* @__PURE__ */ jsxs(View, { style: [
|
|
1876
|
+
/* @__PURE__ */ jsxs(View, { style: [styles16.headerLeft, boxed ? styles16.headerLeftRow : null], children: [
|
|
1727
1877
|
boxed ? (
|
|
1728
1878
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1729
1879
|
/* @__PURE__ */ jsx(
|
|
@@ -1732,15 +1882,15 @@ var AccordionItem = ({
|
|
|
1732
1882
|
accessibilityElementsHidden: true,
|
|
1733
1883
|
"aria-hidden": true,
|
|
1734
1884
|
importantForAccessibility: "no-hide-descendants",
|
|
1735
|
-
style: [
|
|
1885
|
+
style: [styles16.marker, { transform: [{ rotate }] }],
|
|
1736
1886
|
testID: chevronTestID,
|
|
1737
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1887
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles16.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1738
1888
|
}
|
|
1739
1889
|
)
|
|
1740
1890
|
) : null,
|
|
1741
1891
|
titleNode
|
|
1742
1892
|
] }),
|
|
1743
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1893
|
+
/* @__PURE__ */ jsxs(View, { style: styles16.headerRight, children: [
|
|
1744
1894
|
right,
|
|
1745
1895
|
boxed ? null : /* @__PURE__ */ jsx(
|
|
1746
1896
|
Animated.View,
|
|
@@ -1748,7 +1898,7 @@ var AccordionItem = ({
|
|
|
1748
1898
|
accessibilityElementsHidden: true,
|
|
1749
1899
|
"aria-hidden": true,
|
|
1750
1900
|
importantForAccessibility: "no-hide-descendants",
|
|
1751
|
-
style: [
|
|
1901
|
+
style: [styles16.chevron, { transform: [{ rotate }] }],
|
|
1752
1902
|
children: /* @__PURE__ */ jsx(SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1753
1903
|
}
|
|
1754
1904
|
)
|
|
@@ -1762,7 +1912,7 @@ var AccordionItem = ({
|
|
|
1762
1912
|
accessibilityLabel: resolvedLabel,
|
|
1763
1913
|
nativeID: bodyTestID,
|
|
1764
1914
|
role: ROLE_REGION,
|
|
1765
|
-
style: boxed ?
|
|
1915
|
+
style: boxed ? styles16.boxBody : styles16.body,
|
|
1766
1916
|
testID: bodyTestID,
|
|
1767
1917
|
children
|
|
1768
1918
|
}
|
|
@@ -1825,7 +1975,7 @@ function useAvailableWidth() {
|
|
|
1825
1975
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
1826
1976
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
1827
1977
|
var UNMEASURED2 = 0;
|
|
1828
|
-
var
|
|
1978
|
+
var styles17 = StyleSheet.create({
|
|
1829
1979
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
1830
1980
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
1831
1981
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -1856,7 +2006,7 @@ var TruncatedText = ({
|
|
|
1856
2006
|
[value, measureRef]
|
|
1857
2007
|
);
|
|
1858
2008
|
const flatStyle = useMemo(
|
|
1859
|
-
() => StyleSheet.flatten([
|
|
2009
|
+
() => StyleSheet.flatten([styles17.base, style]),
|
|
1860
2010
|
[style]
|
|
1861
2011
|
);
|
|
1862
2012
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
@@ -1871,7 +2021,7 @@ var TruncatedText = ({
|
|
|
1871
2021
|
ref: attachRef,
|
|
1872
2022
|
onLayout,
|
|
1873
2023
|
numberOfLines: 1,
|
|
1874
|
-
style: [
|
|
2024
|
+
style: [styles17.base, styles17.fill, style],
|
|
1875
2025
|
testID,
|
|
1876
2026
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
1877
2027
|
accessibilityLabel,
|
|
@@ -1974,7 +2124,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
1974
2124
|
var ACTION_PADDING_H = 6;
|
|
1975
2125
|
var ACTION_PADDING_V = 2;
|
|
1976
2126
|
var ACTION_RADIUS = 6;
|
|
1977
|
-
var
|
|
2127
|
+
var styles18 = StyleSheet.create({
|
|
1978
2128
|
cell: { gap: CELL_GAP },
|
|
1979
2129
|
label: {
|
|
1980
2130
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -2039,14 +2189,14 @@ var CopyableId = ({
|
|
|
2039
2189
|
const { colors } = theme;
|
|
2040
2190
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
2041
2191
|
const action = useActionState(status);
|
|
2042
|
-
return /* @__PURE__ */ jsxs(View, { style: [
|
|
2043
|
-
label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [
|
|
2044
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
2045
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
2192
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles18.cell, style], testID, children: [
|
|
2193
|
+
label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles18.label, { color: colors.textSecondary }], children: label }),
|
|
2194
|
+
/* @__PURE__ */ jsxs(View, { style: styles18.row, children: [
|
|
2195
|
+
/* @__PURE__ */ jsx(View, { style: styles18.valueWrap, children: /* @__PURE__ */ jsx(
|
|
2046
2196
|
TruncatedText,
|
|
2047
2197
|
{
|
|
2048
2198
|
value,
|
|
2049
|
-
style: [
|
|
2199
|
+
style: [styles18.value, { color: colors.text }],
|
|
2050
2200
|
testID: `${testID}-value`,
|
|
2051
2201
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
2052
2202
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -2060,7 +2210,7 @@ var CopyableId = ({
|
|
|
2060
2210
|
accessibilityLabel: t(action.key),
|
|
2061
2211
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
2062
2212
|
testID: `${testID}-copy`,
|
|
2063
|
-
style: [
|
|
2213
|
+
style: [styles18.action, { color: action.color }],
|
|
2064
2214
|
children: t(action.key)
|
|
2065
2215
|
}
|
|
2066
2216
|
)
|
|
@@ -2115,7 +2265,7 @@ var FOOTER_PADDING_V = 6;
|
|
|
2115
2265
|
var FOOTER_PADDING_H = 12;
|
|
2116
2266
|
var FOOTER_FONT_SIZE = 11;
|
|
2117
2267
|
var FOOTER_OPACITY = 0.75;
|
|
2118
|
-
var
|
|
2268
|
+
var styles19 = StyleSheet.create({
|
|
2119
2269
|
footer: {
|
|
2120
2270
|
paddingVertical: FOOTER_PADDING_V,
|
|
2121
2271
|
paddingHorizontal: FOOTER_PADDING_H,
|
|
@@ -2141,7 +2291,7 @@ var BuildInfoFooter = ({
|
|
|
2141
2291
|
const commit = apiCommit ?? fetchedCommit;
|
|
2142
2292
|
const label = formatBuildInfo(buildVersion, commit);
|
|
2143
2293
|
const textStyle = useMemo(
|
|
2144
|
-
() => [
|
|
2294
|
+
() => [styles19.text, { color: theme.colors.textSecondary }],
|
|
2145
2295
|
[theme.colors.textSecondary]
|
|
2146
2296
|
);
|
|
2147
2297
|
return /* @__PURE__ */ jsx(
|
|
@@ -2149,13 +2299,13 @@ var BuildInfoFooter = ({
|
|
|
2149
2299
|
{
|
|
2150
2300
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
2151
2301
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
|
|
2152
|
-
style: [
|
|
2302
|
+
style: [styles19.footer, style],
|
|
2153
2303
|
testID,
|
|
2154
2304
|
children: /* @__PURE__ */ jsx(Text, { style: textStyle, children: label })
|
|
2155
2305
|
}
|
|
2156
2306
|
);
|
|
2157
2307
|
};
|
|
2158
2308
|
|
|
2159
|
-
export { API_COMMIT_SEPARATOR, Accordion, AccordionItem, BUILD_INFO_PREFIX, BuildInfoFooter, COPY_FEEDBACK_MS, ConfirmDialog, CopyStatus, CopyableId, DEFAULT_BILLING_ROUTE, DropdownVariant, ELLIPSIS, Heading, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, MIN_TARGET_PX, Modal3 as Modal, ModalDropdown, ModalShell, Section, SegmentedControl, StatusBadge, TYPE_SCALE_BREAKPOINT, Tabs, TabsCollapsedTrigger, TruncatedText, UpgradePrompt, copyText, formatBuildInfo, formatUrlForDisplay, isWideWebViewport, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap };
|
|
2309
|
+
export { API_COMMIT_SEPARATOR, Accordion, AccordionItem, BUILD_INFO_PREFIX, BuildInfoFooter, COPY_FEEDBACK_MS, ConfirmDialog, CopyStatus, CopyableId, DEFAULT_BILLING_ROUTE, DropdownVariant, ELLIPSIS, Heading, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, MIN_TARGET_PX, Modal3 as Modal, ModalDropdown, ModalShell, Section, SegmentedControl, SelectedMarker, StatusBadge, StickyPreview, TYPE_SCALE_BREAKPOINT, Tabs, TabsCollapsedTrigger, TruncatedText, UpgradePrompt, copyText, formatBuildInfo, formatUrlForDisplay, isKeyboardOpen, isWideWebViewport, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useVisibleViewport };
|
|
2160
2310
|
//# sourceMappingURL=index.mjs.map
|
|
2161
2311
|
//# sourceMappingURL=index.mjs.map
|