@dloizides/ui-layout 1.31.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 +24 -2
- package/dist/index.d.ts +24 -2
- package/dist/index.js +278 -172
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +205 -102
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React11 = require('react');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
var uiFeedback = require('@dloizides/ui-feedback');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -14,7 +14,7 @@ var rnWebHooks = require('@dloizides/rn-web-hooks');
|
|
|
14
14
|
|
|
15
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var React11__default = /*#__PURE__*/_interopDefault(React11);
|
|
18
18
|
|
|
19
19
|
// src/Section/Section.tsx
|
|
20
20
|
var styles = reactNative.StyleSheet.create({
|
|
@@ -26,7 +26,7 @@ var styles = reactNative.StyleSheet.create({
|
|
|
26
26
|
});
|
|
27
27
|
var Section = ({ children, style }) => {
|
|
28
28
|
const { theme } = uiFeedback.useUi();
|
|
29
|
-
const containerStyle =
|
|
29
|
+
const containerStyle = React11__default.default.useMemo(
|
|
30
30
|
() => [styles.card, { borderColor: theme.colors.border, backgroundColor: theme.colors.surface }, style],
|
|
31
31
|
[theme.colors.border, theme.colors.surface, style]
|
|
32
32
|
);
|
|
@@ -37,6 +37,7 @@ var Section = ({ children, style }) => {
|
|
|
37
37
|
var LAYOUT_TEST_IDS = {
|
|
38
38
|
headingText: "heading-text",
|
|
39
39
|
statusLabel: "status-label",
|
|
40
|
+
stickyPreview: "sticky-preview",
|
|
40
41
|
upgradePrompt: "upgrade-prompt",
|
|
41
42
|
upgradePromptCta: "upgrade-prompt-cta",
|
|
42
43
|
upgradePromptDismiss: "upgrade-prompt-dismiss",
|
|
@@ -124,7 +125,7 @@ var Heading = ({
|
|
|
124
125
|
testID
|
|
125
126
|
}) => {
|
|
126
127
|
const { theme } = uiFeedback.useUi();
|
|
127
|
-
const headingStyle =
|
|
128
|
+
const headingStyle = React11__default.default.useMemo(
|
|
128
129
|
() => [styles2.heading, { color: theme.colors.text }, style],
|
|
129
130
|
[theme.colors.text, style]
|
|
130
131
|
);
|
|
@@ -143,6 +144,7 @@ var DEFAULT_PADDING_H = 10;
|
|
|
143
144
|
var DEFAULT_PADDING_V = 4;
|
|
144
145
|
var DEFAULT_BORDER_RADIUS = 12;
|
|
145
146
|
var DEFAULT_FONT_SIZE = 12;
|
|
147
|
+
var ICON_GAP = 4;
|
|
146
148
|
var styles3 = reactNative.StyleSheet.create({
|
|
147
149
|
badge: {
|
|
148
150
|
paddingHorizontal: DEFAULT_PADDING_H,
|
|
@@ -152,6 +154,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,7 +519,7 @@ 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
|
}
|
|
@@ -429,7 +540,7 @@ var OPTION_PADDING_V = 12;
|
|
|
429
540
|
var ACCENT_BAR_WIDTH = 3;
|
|
430
541
|
var CHECK_GAP = 8;
|
|
431
542
|
var CHECK_GLYPH = "\u2713";
|
|
432
|
-
var
|
|
543
|
+
var styles7 = reactNative.StyleSheet.create({
|
|
433
544
|
option: {
|
|
434
545
|
paddingHorizontal: OPTION_PADDING_H,
|
|
435
546
|
paddingVertical: OPTION_PADDING_V,
|
|
@@ -461,23 +572,23 @@ var OptionRow = ({
|
|
|
461
572
|
}) => {
|
|
462
573
|
const { theme, t } = uiFeedback.useUi();
|
|
463
574
|
const { colors } = theme;
|
|
464
|
-
const handlePress =
|
|
575
|
+
const handlePress = React11.useCallback(() => {
|
|
465
576
|
onSelect();
|
|
466
577
|
}, [onSelect]);
|
|
467
578
|
const accentColor = theme.palette.primary["500"];
|
|
468
579
|
const isMarked = selectedMarker === "accent-check" /* AccentCheck */;
|
|
469
580
|
const isActive = isSelected || isHighlighted;
|
|
470
581
|
const rowStyle = [
|
|
471
|
-
|
|
472
|
-
isMarked ?
|
|
582
|
+
styles7.option,
|
|
583
|
+
isMarked ? styles7.markedRow : null,
|
|
473
584
|
isActive ? { backgroundColor: colors.surfaceElevated } : null,
|
|
474
585
|
isMarked && isSelected ? { borderLeftColor: accentColor } : null
|
|
475
586
|
];
|
|
476
587
|
const textStyle = [
|
|
477
|
-
|
|
588
|
+
styles7.optionText,
|
|
478
589
|
{ color: colors.text },
|
|
479
|
-
isSelected ?
|
|
480
|
-
isMarked ?
|
|
590
|
+
isSelected ? styles7.selectedText : null,
|
|
591
|
+
isMarked ? styles7.markedText : null
|
|
481
592
|
];
|
|
482
593
|
const selectionProps = asMenuItem ? { "aria-current": isSelected ? "true" : void 0 } : { "aria-selected": isSelected };
|
|
483
594
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -493,7 +604,7 @@ var OptionRow = ({
|
|
|
493
604
|
onPress: handlePress,
|
|
494
605
|
children: [
|
|
495
606
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label }),
|
|
496
|
-
isMarked && isSelected ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, testID: `${testID}-check`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
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
|
|
497
608
|
]
|
|
498
609
|
}
|
|
499
610
|
);
|
|
@@ -550,8 +661,8 @@ function isSameRect(a, b) {
|
|
|
550
661
|
return a.top === b.top && a.left === b.left && a.width === b.width && a.bottom === b.bottom;
|
|
551
662
|
}
|
|
552
663
|
function useAnchorTracking(containerRef, onOutOfView) {
|
|
553
|
-
const [rect, setRect] =
|
|
554
|
-
|
|
664
|
+
const [rect, setRect] = React11.useState(() => readAnchorRect(containerRef));
|
|
665
|
+
React11.useLayoutEffect(() => {
|
|
555
666
|
if (!IS_WEB) return void 0;
|
|
556
667
|
let frame = null;
|
|
557
668
|
let isDisposed = false;
|
|
@@ -630,7 +741,7 @@ function buildKeyHandler(params) {
|
|
|
630
741
|
}
|
|
631
742
|
function useMenuKeyboard(params) {
|
|
632
743
|
const { containerRef, menuRef, enabled, onClose } = params;
|
|
633
|
-
|
|
744
|
+
React11.useEffect(() => {
|
|
634
745
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
635
746
|
const onKeyDown = buildKeyHandler(params);
|
|
636
747
|
const onMouseDown = (event) => {
|
|
@@ -651,7 +762,7 @@ var IS_WEB2 = reactNative.Platform.OS === "web";
|
|
|
651
762
|
var BORDER_RADIUS2 = 8;
|
|
652
763
|
var BORDER_WIDTH3 = 1;
|
|
653
764
|
var MENU_PADDING2 = 4;
|
|
654
|
-
var
|
|
765
|
+
var styles8 = reactNative.StyleSheet.create({
|
|
655
766
|
/** Native (in-tree) popover — anchored absolutely just under the trigger. */
|
|
656
767
|
popover: {
|
|
657
768
|
position: "absolute",
|
|
@@ -694,27 +805,27 @@ var InlineMenu = ({
|
|
|
694
805
|
}) => {
|
|
695
806
|
const { theme } = uiFeedback.useUi();
|
|
696
807
|
const { colors } = theme;
|
|
697
|
-
const menuRef =
|
|
808
|
+
const menuRef = React11.useRef(null);
|
|
698
809
|
const rect = useAnchorTracking(containerRef, onClose);
|
|
699
|
-
const selectedIndex =
|
|
810
|
+
const selectedIndex = React11.useMemo(
|
|
700
811
|
() => Math.max(0, options.findIndex((opt) => opt.value === value)),
|
|
701
812
|
[options, value]
|
|
702
813
|
);
|
|
703
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
704
|
-
const handleSelect =
|
|
814
|
+
const [highlightedIndex, setHighlightedIndex] = React11.useState(() => selectedIndex);
|
|
815
|
+
const handleSelect = React11.useCallback(
|
|
705
816
|
(optionValue) => {
|
|
706
817
|
if (isOpen) onSelect(optionValue);
|
|
707
818
|
},
|
|
708
819
|
[isOpen, onSelect]
|
|
709
820
|
);
|
|
710
|
-
const selectAt =
|
|
821
|
+
const selectAt = React11.useCallback(
|
|
711
822
|
(index) => {
|
|
712
823
|
const option = options[index];
|
|
713
824
|
if (option !== void 0) handleSelect(option.value);
|
|
714
825
|
},
|
|
715
826
|
[options, handleSelect]
|
|
716
827
|
);
|
|
717
|
-
const selectHighlighted =
|
|
828
|
+
const selectHighlighted = React11.useCallback(
|
|
718
829
|
() => {
|
|
719
830
|
selectAt(highlightedIndex);
|
|
720
831
|
},
|
|
@@ -729,7 +840,7 @@ var InlineMenu = ({
|
|
|
729
840
|
onSelectHighlighted: selectHighlighted,
|
|
730
841
|
onClose
|
|
731
842
|
});
|
|
732
|
-
const popoverStyle =
|
|
843
|
+
const popoverStyle = React11.useMemo(() => {
|
|
733
844
|
const themed = { borderColor: colors.border, backgroundColor: colors.surface };
|
|
734
845
|
if (IS_WEB2) {
|
|
735
846
|
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 0;
|
|
@@ -738,7 +849,7 @@ var InlineMenu = ({
|
|
|
738
849
|
themed
|
|
739
850
|
];
|
|
740
851
|
}
|
|
741
|
-
return [
|
|
852
|
+
return [styles8.popover, { minWidth: menuMinWidth }, themed];
|
|
742
853
|
}, [colors.border, colors.surface, menuMinWidth, rect]);
|
|
743
854
|
const menu = /* @__PURE__ */ jsxRuntime.jsx(
|
|
744
855
|
reactNative.View,
|
|
@@ -753,10 +864,10 @@ var InlineMenu = ({
|
|
|
753
864
|
reactNative.Animated.View,
|
|
754
865
|
{
|
|
755
866
|
pointerEvents: isOpen ? "auto" : "none",
|
|
756
|
-
style: [
|
|
867
|
+
style: [styles8.animated, animatedStyle, isOpen ? null : styles8.inert],
|
|
757
868
|
children: [
|
|
758
869
|
menuHeading !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MenuHeading, { testID, text: menuHeading }) : null,
|
|
759
|
-
/* @__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(
|
|
760
871
|
OptionRow,
|
|
761
872
|
{
|
|
762
873
|
asMenuItem: true,
|
|
@@ -777,14 +888,6 @@ var InlineMenu = ({
|
|
|
777
888
|
if (IS_WEB2) return reactDom.createPortal(menu, document.body);
|
|
778
889
|
return menu;
|
|
779
890
|
};
|
|
780
|
-
|
|
781
|
-
// src/responsive.ts
|
|
782
|
-
var WEB_PLATFORM = "web";
|
|
783
|
-
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
784
|
-
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
// src/ModalDropdown/resolveDropdownVariant.ts
|
|
788
891
|
var MENU_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;
|
|
789
892
|
function resolveDropdownVariant(explicit, width, platformOS) {
|
|
790
893
|
if (explicit !== void 0) return explicit;
|
|
@@ -812,7 +915,7 @@ var CARET_OPEN_ROTATION = "180deg";
|
|
|
812
915
|
var CARET_CLOSED_ROTATION = "0deg";
|
|
813
916
|
var POPOVER_ENTER_SCALE = 0.96;
|
|
814
917
|
var POPOVER_MOTION_MS = 120;
|
|
815
|
-
var
|
|
918
|
+
var styles9 = reactNative.StyleSheet.create({
|
|
816
919
|
anchor: { position: "relative" },
|
|
817
920
|
container: {
|
|
818
921
|
borderWidth: BORDER_WIDTH4,
|
|
@@ -882,7 +985,7 @@ var ModalDropdown = ({
|
|
|
882
985
|
const { colors } = theme;
|
|
883
986
|
const resolvedVariant = useResolvedDropdownVariant(variant);
|
|
884
987
|
const isMenu = resolvedVariant === "menu" /* Menu */;
|
|
885
|
-
const [isOpen, setIsOpen] =
|
|
988
|
+
const [isOpen, setIsOpen] = React11.useState(false);
|
|
886
989
|
const { a11yProps, hintNode } = a11y.useA11y({
|
|
887
990
|
label: accessibilityLabel,
|
|
888
991
|
hint: accessibilityHint,
|
|
@@ -890,10 +993,10 @@ var ModalDropdown = ({
|
|
|
890
993
|
state: { expanded: isOpen },
|
|
891
994
|
testID
|
|
892
995
|
});
|
|
893
|
-
const anchorRef =
|
|
894
|
-
const triggerRef =
|
|
996
|
+
const anchorRef = React11.useRef(null);
|
|
997
|
+
const triggerRef = React11.useRef(null);
|
|
895
998
|
const popupProps = { "aria-haspopup": isMenu ? "menu" : "dialog" };
|
|
896
|
-
const dialogRef =
|
|
999
|
+
const dialogRef = React11.useRef(null);
|
|
897
1000
|
useFocusTrap(dialogRef, isOpen && !isMenu);
|
|
898
1001
|
const menuAnim = uiMotion.useEnterExit({
|
|
899
1002
|
visible: isMenu && isOpen,
|
|
@@ -905,17 +1008,17 @@ var ModalDropdown = ({
|
|
|
905
1008
|
fromScale: POPOVER_ENTER_SCALE,
|
|
906
1009
|
duration: POPOVER_MOTION_MS
|
|
907
1010
|
});
|
|
908
|
-
const selectedLabel =
|
|
1011
|
+
const selectedLabel = React11.useMemo(() => {
|
|
909
1012
|
const found = options.find((opt) => opt.value === value);
|
|
910
1013
|
return found?.label ?? t(LAYOUT_I18N.selectPlaceholder);
|
|
911
1014
|
}, [options, value, t]);
|
|
912
|
-
const handleToggle =
|
|
1015
|
+
const handleToggle = React11.useCallback(() => {
|
|
913
1016
|
setIsOpen((prev) => !prev);
|
|
914
1017
|
}, []);
|
|
915
|
-
const handleClose =
|
|
1018
|
+
const handleClose = React11.useCallback(() => {
|
|
916
1019
|
setIsOpen(false);
|
|
917
1020
|
}, []);
|
|
918
|
-
const handleSelect =
|
|
1021
|
+
const handleSelect = React11.useCallback(
|
|
919
1022
|
(optionValue) => {
|
|
920
1023
|
onChange(optionValue);
|
|
921
1024
|
setIsOpen(false);
|
|
@@ -925,38 +1028,38 @@ var ModalDropdown = ({
|
|
|
925
1028
|
);
|
|
926
1029
|
const isHamburger = showHamburger;
|
|
927
1030
|
const isCaret = showCaret && !isHamburger;
|
|
928
|
-
const containerStyle =
|
|
1031
|
+
const containerStyle = React11.useMemo(
|
|
929
1032
|
() => renderTrigger !== void 0 ? void 0 : [
|
|
930
|
-
|
|
931
|
-
isHamburger ?
|
|
1033
|
+
styles9.container,
|
|
1034
|
+
isHamburger ? styles9.containerHamburger : isCaret ? styles9.containerMenu : null,
|
|
932
1035
|
{ borderColor: colors.border, backgroundColor: colors.surface }
|
|
933
1036
|
],
|
|
934
1037
|
[colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
|
|
935
1038
|
);
|
|
936
|
-
const hamburgerStyle =
|
|
937
|
-
() => [
|
|
1039
|
+
const hamburgerStyle = React11.useMemo(
|
|
1040
|
+
() => [styles9.hamburger, { color: colors.textSecondary }],
|
|
938
1041
|
[colors.textSecondary]
|
|
939
1042
|
);
|
|
940
|
-
const caretStyle =
|
|
1043
|
+
const caretStyle = React11.useMemo(
|
|
941
1044
|
() => [
|
|
942
|
-
|
|
1045
|
+
styles9.caret,
|
|
943
1046
|
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
944
1047
|
],
|
|
945
1048
|
[colors.textSecondary, isOpen]
|
|
946
1049
|
);
|
|
947
|
-
const optionTestIDFor =
|
|
1050
|
+
const optionTestIDFor = React11.useCallback(
|
|
948
1051
|
(optionValue) => optionTestID !== void 0 ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,
|
|
949
1052
|
[optionTestID, testID]
|
|
950
1053
|
);
|
|
951
|
-
const anchorStyle =
|
|
952
|
-
() => [
|
|
1054
|
+
const anchorStyle = React11.useMemo(
|
|
1055
|
+
() => [styles9.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
953
1056
|
[isMenu, isOpen]
|
|
954
1057
|
);
|
|
955
|
-
const modalContentStyle =
|
|
956
|
-
() => [
|
|
1058
|
+
const modalContentStyle = React11.useMemo(
|
|
1059
|
+
() => [styles9.modalContent, { backgroundColor: colors.surface }],
|
|
957
1060
|
[colors.surface]
|
|
958
1061
|
);
|
|
959
|
-
const renderModalOption =
|
|
1062
|
+
const renderModalOption = React11.useCallback(
|
|
960
1063
|
({ item }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
961
1064
|
OptionRow,
|
|
962
1065
|
{
|
|
@@ -969,16 +1072,16 @@ var ModalDropdown = ({
|
|
|
969
1072
|
),
|
|
970
1073
|
[handleSelect, optionTestIDFor, selectedMarker, value]
|
|
971
1074
|
);
|
|
972
|
-
const keyExtractor =
|
|
1075
|
+
const keyExtractor = React11.useCallback((item) => String(item.value), []);
|
|
973
1076
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: anchorStyle, children: [
|
|
974
1077
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, ...popupProps, ref: triggerRef, style: containerStyle, onPress: handleToggle, children: [
|
|
975
1078
|
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
976
1079
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: hamburgerStyle, children: HAMBURGER_GLYPH }),
|
|
977
|
-
/* @__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 })
|
|
978
1081
|
] }) : isCaret ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
979
|
-
/* @__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 }),
|
|
980
1083
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: caretStyle, children: CARET_GLYPH })
|
|
981
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1084
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles9.selectedText, { color: colors.text }], children: selectedLabel }),
|
|
982
1085
|
hintNode
|
|
983
1086
|
] }),
|
|
984
1087
|
isMenu && menuAnim.mounted ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -999,7 +1102,7 @@ var ModalDropdown = ({
|
|
|
999
1102
|
onSelect: handleSelect
|
|
1000
1103
|
}
|
|
1001
1104
|
) : null,
|
|
1002
|
-
!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: [
|
|
1003
1106
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
1107
|
reactNative.TouchableOpacity,
|
|
1005
1108
|
{
|
|
@@ -1045,11 +1148,11 @@ var TabsMenu = ({
|
|
|
1045
1148
|
collapsedTrigger = "caret" /* Caret */
|
|
1046
1149
|
}) => {
|
|
1047
1150
|
const { t } = uiFeedback.useUi();
|
|
1048
|
-
const options =
|
|
1151
|
+
const options = React11.useMemo(
|
|
1049
1152
|
() => tabs.map((tab) => ({ label: tab.label, value: tab.key })),
|
|
1050
1153
|
[tabs]
|
|
1051
1154
|
);
|
|
1052
|
-
const optionTestID =
|
|
1155
|
+
const optionTestID = React11.useCallback(
|
|
1053
1156
|
(key) => {
|
|
1054
1157
|
const found = tabs.find((tab) => tab.key === key);
|
|
1055
1158
|
return found?.testID ?? `${idPrefix}-tab-${key}`;
|
|
@@ -1092,7 +1195,7 @@ var ROW_PAD_V = 8;
|
|
|
1092
1195
|
var PANEL_PAD_TOP = 16;
|
|
1093
1196
|
var BORDER_WIDTH5 = 1;
|
|
1094
1197
|
var TEXT_ON_PRIMARY = "#ffffff";
|
|
1095
|
-
var
|
|
1198
|
+
var styles10 = reactNative.StyleSheet.create({
|
|
1096
1199
|
root: {
|
|
1097
1200
|
width: "100%"
|
|
1098
1201
|
},
|
|
@@ -1146,7 +1249,7 @@ var WideTabStrip = ({
|
|
|
1146
1249
|
textSecondary,
|
|
1147
1250
|
surfaceElevated,
|
|
1148
1251
|
stripStyle
|
|
1149
|
-
}) => /* @__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) => {
|
|
1150
1253
|
const selected = tab.key === activeKey;
|
|
1151
1254
|
const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;
|
|
1152
1255
|
const pillColor = selected ? primaryColor : surfaceElevated;
|
|
@@ -1160,10 +1263,10 @@ var WideTabStrip = ({
|
|
|
1160
1263
|
accessibilityLabel: tab.accessibilityLabel ?? tab.label,
|
|
1161
1264
|
accessibilityHint: tab.accessibilityHint,
|
|
1162
1265
|
onPress: () => onChange(tab.key),
|
|
1163
|
-
style: [
|
|
1266
|
+
style: [styles10.pill, { backgroundColor: pillColor }],
|
|
1164
1267
|
testID: tab.testID,
|
|
1165
1268
|
...ariaTabProps(selected, panelId, tabId),
|
|
1166
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1269
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.pillText, { color: textColor }], children: tab.label })
|
|
1167
1270
|
},
|
|
1168
1271
|
tab.key
|
|
1169
1272
|
);
|
|
@@ -1188,7 +1291,7 @@ var Tabs = ({
|
|
|
1188
1291
|
const activePanelId = `${idPrefix}-panel-${activeKey}`;
|
|
1189
1292
|
const activeTabId = `${idPrefix}-tab-${activeKey}`;
|
|
1190
1293
|
const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
|
|
1191
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
1294
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles10.root, style], testID, children: [
|
|
1192
1295
|
collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1193
1296
|
TabsMenu,
|
|
1194
1297
|
{
|
|
@@ -1215,7 +1318,7 @@ var Tabs = ({
|
|
|
1215
1318
|
onChange
|
|
1216
1319
|
}
|
|
1217
1320
|
),
|
|
1218
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [
|
|
1321
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [styles10.panel, panelStyle], ...panelAria, children })
|
|
1219
1322
|
] });
|
|
1220
1323
|
};
|
|
1221
1324
|
var PROMPT_PADDING = 20;
|
|
@@ -1230,7 +1333,7 @@ var DISMISS_FONT_SIZE = 13;
|
|
|
1230
1333
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
1231
1334
|
var MESSAGE_MARGIN_BOTTOM = 16;
|
|
1232
1335
|
var CTA_MARGIN_BOTTOM = 8;
|
|
1233
|
-
var
|
|
1336
|
+
var styles11 = reactNative.StyleSheet.create({
|
|
1234
1337
|
container: {
|
|
1235
1338
|
padding: PROMPT_PADDING,
|
|
1236
1339
|
borderRadius: PROMPT_BORDER_RADIUS,
|
|
@@ -1265,21 +1368,21 @@ var UpgradePrompt = ({
|
|
|
1265
1368
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1266
1369
|
reactNative.View,
|
|
1267
1370
|
{
|
|
1268
|
-
style: [
|
|
1371
|
+
style: [styles11.container, { borderColor: primary, backgroundColor: colors.surface }],
|
|
1269
1372
|
testID: LAYOUT_TEST_IDS.upgradePrompt,
|
|
1270
1373
|
children: [
|
|
1271
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1272
|
-
/* @__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) }),
|
|
1273
1376
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1274
1377
|
reactNative.TouchableOpacity,
|
|
1275
1378
|
{
|
|
1276
1379
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
|
|
1277
1380
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
|
|
1278
1381
|
accessibilityRole: "button",
|
|
1279
|
-
style: [
|
|
1382
|
+
style: [styles11.cta, { backgroundColor: primary }],
|
|
1280
1383
|
testID: LAYOUT_TEST_IDS.upgradePromptCta,
|
|
1281
1384
|
onPress: handleUpgradePress,
|
|
1282
|
-
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) })
|
|
1283
1386
|
}
|
|
1284
1387
|
),
|
|
1285
1388
|
onDismiss ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1288,10 +1391,10 @@ var UpgradePrompt = ({
|
|
|
1288
1391
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
|
|
1289
1392
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
|
|
1290
1393
|
accessibilityRole: "button",
|
|
1291
|
-
style:
|
|
1394
|
+
style: styles11.dismiss,
|
|
1292
1395
|
testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
|
|
1293
1396
|
onPress: onDismiss,
|
|
1294
|
-
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) })
|
|
1295
1398
|
}
|
|
1296
1399
|
) : null
|
|
1297
1400
|
]
|
|
@@ -1300,7 +1403,7 @@ var UpgradePrompt = ({
|
|
|
1300
1403
|
};
|
|
1301
1404
|
var CLOSE_ICON_SIZE = 18;
|
|
1302
1405
|
var PANEL_ENTER_SCALE = 0.96;
|
|
1303
|
-
var
|
|
1406
|
+
var styles12 = reactNative.StyleSheet.create({
|
|
1304
1407
|
animatedFill: { flex: 1 },
|
|
1305
1408
|
container: {
|
|
1306
1409
|
flex: 1,
|
|
@@ -1326,8 +1429,8 @@ var ModalShell = ({
|
|
|
1326
1429
|
}) => {
|
|
1327
1430
|
const { theme, t } = uiFeedback.useUi();
|
|
1328
1431
|
const { style: sheetStyle, mounted } = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });
|
|
1329
|
-
const containerStyle =
|
|
1330
|
-
() => [
|
|
1432
|
+
const containerStyle = React11__default.default.useMemo(
|
|
1433
|
+
() => [styles12.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1331
1434
|
[theme.colors.background, contentStyle]
|
|
1332
1435
|
);
|
|
1333
1436
|
const closeA11yLabel = t(LAYOUT_I18N.close);
|
|
@@ -1339,7 +1442,7 @@ var ModalShell = ({
|
|
|
1339
1442
|
testID: LAYOUT_TEST_IDS.modalShell,
|
|
1340
1443
|
visible: mounted,
|
|
1341
1444
|
onRequestClose: onCancel,
|
|
1342
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [
|
|
1445
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles12.animatedFill, sheetStyle], children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1343
1446
|
reactNative.ScrollView,
|
|
1344
1447
|
{
|
|
1345
1448
|
accessibilityViewIsModal: true,
|
|
@@ -1347,7 +1450,7 @@ var ModalShell = ({
|
|
|
1347
1450
|
role: "dialog",
|
|
1348
1451
|
style: containerStyle,
|
|
1349
1452
|
children: [
|
|
1350
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1453
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles12.headerRow, children: [
|
|
1351
1454
|
/* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
|
|
1352
1455
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1353
1456
|
reactNative.TouchableOpacity,
|
|
@@ -1355,7 +1458,7 @@ var ModalShell = ({
|
|
|
1355
1458
|
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1356
1459
|
accessibilityLabel: closeA11yLabel,
|
|
1357
1460
|
accessibilityRole: "button",
|
|
1358
|
-
style:
|
|
1461
|
+
style: styles12.closeButton,
|
|
1359
1462
|
testID: LAYOUT_TEST_IDS.modalShellClose,
|
|
1360
1463
|
onPress: onCancel,
|
|
1361
1464
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
|
|
@@ -1370,7 +1473,7 @@ var ModalShell = ({
|
|
|
1370
1473
|
);
|
|
1371
1474
|
};
|
|
1372
1475
|
function useEscapeKey(enabled, onClose) {
|
|
1373
|
-
|
|
1476
|
+
React11.useEffect(() => {
|
|
1374
1477
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1375
1478
|
const onKeyDown = (event) => {
|
|
1376
1479
|
if (event.key === "Escape") onClose();
|
|
@@ -1382,7 +1485,7 @@ function useEscapeKey(enabled, onClose) {
|
|
|
1382
1485
|
}, [enabled, onClose]);
|
|
1383
1486
|
}
|
|
1384
1487
|
function useScrollLock(enabled) {
|
|
1385
|
-
|
|
1488
|
+
React11.useEffect(() => {
|
|
1386
1489
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1387
1490
|
const { body } = document;
|
|
1388
1491
|
const previousOverflow = body.style.overflow;
|
|
@@ -1401,7 +1504,7 @@ var HEADER_MARGIN = 12;
|
|
|
1401
1504
|
var DIALOG_MAX_HEIGHT = "90%";
|
|
1402
1505
|
var PANEL_ENTER_SCALE2 = 0.96;
|
|
1403
1506
|
var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640 };
|
|
1404
|
-
var
|
|
1507
|
+
var styles13 = reactNative.StyleSheet.create({
|
|
1405
1508
|
overlay: {
|
|
1406
1509
|
flex: 1,
|
|
1407
1510
|
justifyContent: "center",
|
|
@@ -1443,7 +1546,7 @@ var Modal3 = ({
|
|
|
1443
1546
|
initialFocusTestID
|
|
1444
1547
|
}) => {
|
|
1445
1548
|
const { theme, t } = uiFeedback.useUi();
|
|
1446
|
-
const dialogRef =
|
|
1549
|
+
const dialogRef = React11.useRef(null);
|
|
1447
1550
|
const backdrop = uiMotion.useEnterExit({ visible });
|
|
1448
1551
|
const panel = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE2 });
|
|
1449
1552
|
const mounted = panel.mounted || backdrop.mounted;
|
|
@@ -1452,16 +1555,16 @@ var Modal3 = ({
|
|
|
1452
1555
|
useScrollLock(visible);
|
|
1453
1556
|
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
1454
1557
|
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
1455
|
-
const dialogStyle =
|
|
1456
|
-
() => [
|
|
1558
|
+
const dialogStyle = React11.useMemo(
|
|
1559
|
+
() => [styles13.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
1457
1560
|
[theme.colors.surface, size]
|
|
1458
1561
|
);
|
|
1459
1562
|
const hasHeader = title !== void 0 || showClose;
|
|
1460
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1563
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles13.overlay, children: [
|
|
1461
1564
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1462
1565
|
reactNative.Animated.View,
|
|
1463
1566
|
{
|
|
1464
|
-
style: [reactNative.StyleSheet.absoluteFill,
|
|
1567
|
+
style: [reactNative.StyleSheet.absoluteFill, styles13.scrim, { opacity: backdrop.style.opacity }]
|
|
1465
1568
|
}
|
|
1466
1569
|
),
|
|
1467
1570
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1487,8 +1590,8 @@ var Modal3 = ({
|
|
|
1487
1590
|
style: [dialogStyle, panel.style],
|
|
1488
1591
|
testID,
|
|
1489
1592
|
children: [
|
|
1490
|
-
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1491
|
-
/* @__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 }),
|
|
1492
1595
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1493
1596
|
uiButtons.IconButton,
|
|
1494
1597
|
{
|
|
@@ -1505,7 +1608,7 @@ var Modal3 = ({
|
|
|
1505
1608
|
) : null
|
|
1506
1609
|
] }) : null,
|
|
1507
1610
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { children }),
|
|
1508
|
-
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
1611
|
+
footer !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles13.footer, children: footer }) : null
|
|
1509
1612
|
]
|
|
1510
1613
|
}
|
|
1511
1614
|
)
|
|
@@ -1514,7 +1617,7 @@ var Modal3 = ({
|
|
|
1514
1617
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
1515
1618
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
1516
1619
|
var BUTTON_GAP = 12;
|
|
1517
|
-
var
|
|
1620
|
+
var styles14 = reactNative.StyleSheet.create({
|
|
1518
1621
|
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT },
|
|
1519
1622
|
footer: { flexDirection: "row", justifyContent: "flex-end", columnGap: BUTTON_GAP }
|
|
1520
1623
|
});
|
|
@@ -1533,7 +1636,7 @@ var ConfirmDialog = ({
|
|
|
1533
1636
|
const { theme, t } = uiFeedback.useUi();
|
|
1534
1637
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
1535
1638
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
1536
|
-
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1639
|
+
const footer = /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.footer, children: [
|
|
1537
1640
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1538
1641
|
uiButtons.Button,
|
|
1539
1642
|
{
|
|
@@ -1569,27 +1672,27 @@ var ConfirmDialog = ({
|
|
|
1569
1672
|
title,
|
|
1570
1673
|
visible,
|
|
1571
1674
|
onClose: onCancel,
|
|
1572
|
-
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 })
|
|
1573
1676
|
}
|
|
1574
1677
|
);
|
|
1575
1678
|
};
|
|
1576
|
-
var AccordionContext =
|
|
1679
|
+
var AccordionContext = React11.createContext(null);
|
|
1577
1680
|
function useAccordionContext() {
|
|
1578
|
-
const value =
|
|
1681
|
+
const value = React11.useContext(AccordionContext);
|
|
1579
1682
|
if (value === null) {
|
|
1580
1683
|
throw new Error("AccordionItem must be rendered inside an <Accordion>.");
|
|
1581
1684
|
}
|
|
1582
1685
|
return value;
|
|
1583
1686
|
}
|
|
1584
1687
|
var BOXED_GAP = 12;
|
|
1585
|
-
var
|
|
1688
|
+
var styles15 = reactNative.StyleSheet.create({
|
|
1586
1689
|
container: { alignSelf: "stretch" },
|
|
1587
1690
|
boxed: { gap: BOXED_GAP }
|
|
1588
1691
|
});
|
|
1589
1692
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
1590
1693
|
const ids = new Set(defaultOpenIds ?? []);
|
|
1591
|
-
|
|
1592
|
-
if (!
|
|
1694
|
+
React11__default.default.Children.forEach(children, (child) => {
|
|
1695
|
+
if (!React11__default.default.isValidElement(child)) return;
|
|
1593
1696
|
const props = child.props;
|
|
1594
1697
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
1595
1698
|
ids.add(props.id);
|
|
@@ -1612,14 +1715,14 @@ var Accordion = ({
|
|
|
1612
1715
|
style
|
|
1613
1716
|
}) => {
|
|
1614
1717
|
const isControlled = openIds !== void 0;
|
|
1615
|
-
const [internalOpen, setInternalOpen] =
|
|
1718
|
+
const [internalOpen, setInternalOpen] = React11.useState(
|
|
1616
1719
|
() => computeInitialOpen(children, defaultOpenIds, allowMultiple)
|
|
1617
1720
|
);
|
|
1618
|
-
const openSet =
|
|
1721
|
+
const openSet = React11.useMemo(
|
|
1619
1722
|
() => isControlled ? new Set(openIds) : internalOpen,
|
|
1620
1723
|
[isControlled, openIds, internalOpen]
|
|
1621
1724
|
);
|
|
1622
|
-
const toggle =
|
|
1725
|
+
const toggle = React11.useCallback(
|
|
1623
1726
|
(id) => {
|
|
1624
1727
|
const next = new Set(openSet);
|
|
1625
1728
|
const willOpen = !next.has(id);
|
|
@@ -1634,12 +1737,12 @@ var Accordion = ({
|
|
|
1634
1737
|
},
|
|
1635
1738
|
[allowMultiple, isControlled, onOpenChange, openSet]
|
|
1636
1739
|
);
|
|
1637
|
-
const contextValue =
|
|
1740
|
+
const contextValue = React11.useMemo(
|
|
1638
1741
|
() => ({ openIds: openSet, toggle, allowMultiple, variant }),
|
|
1639
1742
|
[openSet, toggle, allowMultiple, variant]
|
|
1640
1743
|
);
|
|
1641
|
-
const containerStyle =
|
|
1642
|
-
const base = variant === "boxed" ? [
|
|
1744
|
+
const containerStyle = React11.useMemo(() => {
|
|
1745
|
+
const base = variant === "boxed" ? [styles15.container, styles15.boxed] : [styles15.container];
|
|
1643
1746
|
if (style === void 0) return base;
|
|
1644
1747
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1645
1748
|
}, [style, variant]);
|
|
@@ -1671,7 +1774,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1671
1774
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1672
1775
|
var BOX_MARKER_GAP = 6;
|
|
1673
1776
|
var BOX_MARKER = "\u25B8";
|
|
1674
|
-
var
|
|
1777
|
+
var styles16 = reactNative.StyleSheet.create({
|
|
1675
1778
|
item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
1676
1779
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1677
1780
|
header: {
|
|
@@ -1717,9 +1820,9 @@ var AccordionItem = ({
|
|
|
1717
1820
|
const headerTestID = testID ?? `accordion-item-${id}`;
|
|
1718
1821
|
const bodyTestID = `${headerTestID}-body`;
|
|
1719
1822
|
const chevronTestID = `${headerTestID}-chevron`;
|
|
1720
|
-
const [rotation] =
|
|
1823
|
+
const [rotation] = React11.useState(() => new reactNative.Animated.Value(expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED));
|
|
1721
1824
|
const reducedMotion = rnWebHooks.useReducedMotion();
|
|
1722
|
-
|
|
1825
|
+
React11.useEffect(() => {
|
|
1723
1826
|
reactNative.Animated.timing(rotation, {
|
|
1724
1827
|
toValue: expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED,
|
|
1725
1828
|
duration: reducedMotion ? INSTANT_DURATION_MS : ROTATE_DURATION_MS,
|
|
@@ -1731,10 +1834,10 @@ var AccordionItem = ({
|
|
|
1731
1834
|
inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],
|
|
1732
1835
|
outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG]
|
|
1733
1836
|
});
|
|
1734
|
-
const handlePress =
|
|
1837
|
+
const handlePress = React11.useCallback(() => {
|
|
1735
1838
|
if (!disabled) toggle(id);
|
|
1736
1839
|
}, [disabled, id, toggle]);
|
|
1737
|
-
const handleKeyDown2 =
|
|
1840
|
+
const handleKeyDown2 = React11.useCallback(
|
|
1738
1841
|
(event) => {
|
|
1739
1842
|
if (disabled) return;
|
|
1740
1843
|
const key = event.key ?? "";
|
|
@@ -1746,20 +1849,20 @@ var AccordionItem = ({
|
|
|
1746
1849
|
[disabled, id, toggle]
|
|
1747
1850
|
);
|
|
1748
1851
|
const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1749
|
-
const itemStyle =
|
|
1750
|
-
() => boxed ? [
|
|
1852
|
+
const itemStyle = React11.useMemo(
|
|
1853
|
+
() => boxed ? [styles16.boxItem, { borderColor: colors.border }] : [styles16.item, { borderTopColor: colors.border }],
|
|
1751
1854
|
[boxed, colors.border]
|
|
1752
1855
|
);
|
|
1753
|
-
const headerStyle =
|
|
1856
|
+
const headerStyle = React11.useMemo(
|
|
1754
1857
|
() => [
|
|
1755
|
-
|
|
1756
|
-
...boxed ? [
|
|
1858
|
+
styles16.header,
|
|
1859
|
+
...boxed ? [styles16.boxHeader] : [],
|
|
1757
1860
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1758
1861
|
],
|
|
1759
1862
|
[boxed, disabled]
|
|
1760
1863
|
);
|
|
1761
1864
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1762
|
-
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;
|
|
1763
1866
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: itemStyle, children: [
|
|
1764
1867
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1765
1868
|
reactNative.Pressable,
|
|
@@ -1776,7 +1879,7 @@ var AccordionItem = ({
|
|
|
1776
1879
|
onPress: handlePress,
|
|
1777
1880
|
...keyboardProps,
|
|
1778
1881
|
children: [
|
|
1779
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
1882
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles16.headerLeft, boxed ? styles16.headerLeftRow : null], children: [
|
|
1780
1883
|
boxed ? (
|
|
1781
1884
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1782
1885
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1785,15 +1888,15 @@ var AccordionItem = ({
|
|
|
1785
1888
|
accessibilityElementsHidden: true,
|
|
1786
1889
|
"aria-hidden": true,
|
|
1787
1890
|
importantForAccessibility: "no-hide-descendants",
|
|
1788
|
-
style: [
|
|
1891
|
+
style: [styles16.marker, { transform: [{ rotate }] }],
|
|
1789
1892
|
testID: chevronTestID,
|
|
1790
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1893
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1791
1894
|
}
|
|
1792
1895
|
)
|
|
1793
1896
|
) : null,
|
|
1794
1897
|
titleNode
|
|
1795
1898
|
] }),
|
|
1796
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1899
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles16.headerRight, children: [
|
|
1797
1900
|
right,
|
|
1798
1901
|
boxed ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1799
1902
|
reactNative.Animated.View,
|
|
@@ -1801,7 +1904,7 @@ var AccordionItem = ({
|
|
|
1801
1904
|
accessibilityElementsHidden: true,
|
|
1802
1905
|
"aria-hidden": true,
|
|
1803
1906
|
importantForAccessibility: "no-hide-descendants",
|
|
1804
|
-
style: [
|
|
1907
|
+
style: [styles16.chevron, { transform: [{ rotate }] }],
|
|
1805
1908
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1806
1909
|
}
|
|
1807
1910
|
)
|
|
@@ -1815,7 +1918,7 @@ var AccordionItem = ({
|
|
|
1815
1918
|
accessibilityLabel: resolvedLabel,
|
|
1816
1919
|
nativeID: bodyTestID,
|
|
1817
1920
|
role: ROLE_REGION,
|
|
1818
|
-
style: boxed ?
|
|
1921
|
+
style: boxed ? styles16.boxBody : styles16.body,
|
|
1819
1922
|
testID: bodyTestID,
|
|
1820
1923
|
children
|
|
1821
1924
|
}
|
|
@@ -1853,14 +1956,14 @@ function measureParentInnerWidth(node) {
|
|
|
1853
1956
|
return Math.max(UNMEASURED, parent.clientWidth - padding);
|
|
1854
1957
|
}
|
|
1855
1958
|
function useAvailableWidth() {
|
|
1856
|
-
const [width, setWidth] =
|
|
1857
|
-
const nodeRef =
|
|
1858
|
-
const measureRef =
|
|
1959
|
+
const [width, setWidth] = React11.useState(UNMEASURED);
|
|
1960
|
+
const nodeRef = React11.useRef(null);
|
|
1961
|
+
const measureRef = React11.useCallback((node) => {
|
|
1859
1962
|
if (!IS_WEB3) return;
|
|
1860
1963
|
nodeRef.current = node;
|
|
1861
1964
|
if (nodeRef.current !== null) setWidth(measureParentInnerWidth(nodeRef.current));
|
|
1862
1965
|
}, []);
|
|
1863
|
-
|
|
1966
|
+
React11.useEffect(() => {
|
|
1864
1967
|
if (!IS_WEB3) return void 0;
|
|
1865
1968
|
const remeasure = () => {
|
|
1866
1969
|
const node = nodeRef.current;
|
|
@@ -1869,7 +1972,7 @@ function useAvailableWidth() {
|
|
|
1869
1972
|
window.addEventListener("resize", remeasure);
|
|
1870
1973
|
return () => window.removeEventListener("resize", remeasure);
|
|
1871
1974
|
}, []);
|
|
1872
|
-
const onLayout =
|
|
1975
|
+
const onLayout = React11.useCallback((event) => {
|
|
1873
1976
|
if (IS_WEB3) return;
|
|
1874
1977
|
setWidth(event.nativeEvent.layout.width);
|
|
1875
1978
|
}, []);
|
|
@@ -1878,7 +1981,7 @@ function useAvailableWidth() {
|
|
|
1878
1981
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
1879
1982
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
1880
1983
|
var UNMEASURED2 = 0;
|
|
1881
|
-
var
|
|
1984
|
+
var styles17 = reactNative.StyleSheet.create({
|
|
1882
1985
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
1883
1986
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
1884
1987
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -1898,8 +2001,8 @@ var TruncatedText = ({
|
|
|
1898
2001
|
accessibilityHint
|
|
1899
2002
|
}) => {
|
|
1900
2003
|
const { width, measureRef, onLayout } = useAvailableWidth();
|
|
1901
|
-
const hostRef =
|
|
1902
|
-
const attachRef =
|
|
2004
|
+
const hostRef = React11.useRef(null);
|
|
2005
|
+
const attachRef = React11.useCallback(
|
|
1903
2006
|
(node) => {
|
|
1904
2007
|
hostRef.current = node;
|
|
1905
2008
|
measureRef(node);
|
|
@@ -1908,12 +2011,12 @@ var TruncatedText = ({
|
|
|
1908
2011
|
},
|
|
1909
2012
|
[value, measureRef]
|
|
1910
2013
|
);
|
|
1911
|
-
const flatStyle =
|
|
1912
|
-
() => reactNative.StyleSheet.flatten([
|
|
2014
|
+
const flatStyle = React11.useMemo(
|
|
2015
|
+
() => reactNative.StyleSheet.flatten([styles17.base, style]),
|
|
1913
2016
|
[style]
|
|
1914
2017
|
);
|
|
1915
2018
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
1916
|
-
const display =
|
|
2019
|
+
const display = React11.useMemo(() => {
|
|
1917
2020
|
const source = isUrl ? formatUrlForDisplay(value) : value;
|
|
1918
2021
|
const budget = charBudget(width, fontSize);
|
|
1919
2022
|
return budget === UNMEASURED2 ? source : truncateMiddle(source, budget);
|
|
@@ -1924,7 +2027,7 @@ var TruncatedText = ({
|
|
|
1924
2027
|
ref: attachRef,
|
|
1925
2028
|
onLayout,
|
|
1926
2029
|
numberOfLines: 1,
|
|
1927
|
-
style: [
|
|
2030
|
+
style: [styles17.base, styles17.fill, style],
|
|
1928
2031
|
testID,
|
|
1929
2032
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
1930
2033
|
accessibilityLabel,
|
|
@@ -1995,17 +2098,17 @@ async function copyText(value, writer) {
|
|
|
1995
2098
|
// src/CopyableId/useCopyToClipboard.ts
|
|
1996
2099
|
var COPY_FEEDBACK_MS = 2e3;
|
|
1997
2100
|
function useCopyToClipboard(value, writer) {
|
|
1998
|
-
const [status, setStatus] =
|
|
1999
|
-
const timerRef =
|
|
2000
|
-
const mountedRef =
|
|
2001
|
-
|
|
2101
|
+
const [status, setStatus] = React11.useState("idle" /* Idle */);
|
|
2102
|
+
const timerRef = React11.useRef(null);
|
|
2103
|
+
const mountedRef = React11.useRef(true);
|
|
2104
|
+
React11.useEffect(() => {
|
|
2002
2105
|
mountedRef.current = true;
|
|
2003
2106
|
return () => {
|
|
2004
2107
|
mountedRef.current = false;
|
|
2005
2108
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
2006
2109
|
};
|
|
2007
2110
|
}, []);
|
|
2008
|
-
const copy =
|
|
2111
|
+
const copy = React11.useCallback(() => {
|
|
2009
2112
|
void (async () => {
|
|
2010
2113
|
const ok = await copyText(value, writer);
|
|
2011
2114
|
if (!mountedRef.current) return;
|
|
@@ -2027,7 +2130,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
2027
2130
|
var ACTION_PADDING_H = 6;
|
|
2028
2131
|
var ACTION_PADDING_V = 2;
|
|
2029
2132
|
var ACTION_RADIUS = 6;
|
|
2030
|
-
var
|
|
2133
|
+
var styles18 = reactNative.StyleSheet.create({
|
|
2031
2134
|
cell: { gap: CELL_GAP },
|
|
2032
2135
|
label: {
|
|
2033
2136
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -2069,7 +2172,7 @@ var styles17 = reactNative.StyleSheet.create({
|
|
|
2069
2172
|
var TONE_STEP = "500";
|
|
2070
2173
|
function useActionState(status) {
|
|
2071
2174
|
const { theme } = uiFeedback.useUi();
|
|
2072
|
-
return
|
|
2175
|
+
return React11.useMemo(() => {
|
|
2073
2176
|
const primary = theme.palette.primary[TONE_STEP];
|
|
2074
2177
|
if (status === "copied" /* Copied */) {
|
|
2075
2178
|
return { key: LAYOUT_I18N.copied, color: theme.semantic.success?.[TONE_STEP] ?? primary };
|
|
@@ -2092,14 +2195,14 @@ var CopyableId = ({
|
|
|
2092
2195
|
const { colors } = theme;
|
|
2093
2196
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
2094
2197
|
const action = useActionState(status);
|
|
2095
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2096
|
-
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2097
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2098
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
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(
|
|
2099
2202
|
TruncatedText,
|
|
2100
2203
|
{
|
|
2101
2204
|
value,
|
|
2102
|
-
style: [
|
|
2205
|
+
style: [styles18.value, { color: colors.text }],
|
|
2103
2206
|
testID: `${testID}-value`,
|
|
2104
2207
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
2105
2208
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -2113,7 +2216,7 @@ var CopyableId = ({
|
|
|
2113
2216
|
accessibilityLabel: t(action.key),
|
|
2114
2217
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
2115
2218
|
testID: `${testID}-copy`,
|
|
2116
|
-
style: [
|
|
2219
|
+
style: [styles18.action, { color: action.color }],
|
|
2117
2220
|
children: t(action.key)
|
|
2118
2221
|
}
|
|
2119
2222
|
)
|
|
@@ -2138,15 +2241,15 @@ function formatBuildInfo(buildVersion, apiCommit) {
|
|
|
2138
2241
|
return `${base}${API_COMMIT_SEPARATOR}${shortenCommit(commit)}`;
|
|
2139
2242
|
}
|
|
2140
2243
|
function useApiCommit(apiBaseUrl, fetchImpl) {
|
|
2141
|
-
const [commit, setCommit] =
|
|
2142
|
-
const mountedRef =
|
|
2143
|
-
|
|
2244
|
+
const [commit, setCommit] = React11.useState(void 0);
|
|
2245
|
+
const mountedRef = React11.useRef(true);
|
|
2246
|
+
React11.useEffect(() => {
|
|
2144
2247
|
mountedRef.current = true;
|
|
2145
2248
|
return () => {
|
|
2146
2249
|
mountedRef.current = false;
|
|
2147
2250
|
};
|
|
2148
2251
|
}, []);
|
|
2149
|
-
|
|
2252
|
+
React11.useEffect(() => {
|
|
2150
2253
|
if (apiBaseUrl === void 0 || apiBaseUrl === "") return;
|
|
2151
2254
|
const doFetch = fetchImpl ?? (typeof fetch !== "undefined" ? fetch : void 0);
|
|
2152
2255
|
if (doFetch === void 0) return;
|
|
@@ -2168,7 +2271,7 @@ var FOOTER_PADDING_V = 6;
|
|
|
2168
2271
|
var FOOTER_PADDING_H = 12;
|
|
2169
2272
|
var FOOTER_FONT_SIZE = 11;
|
|
2170
2273
|
var FOOTER_OPACITY = 0.75;
|
|
2171
|
-
var
|
|
2274
|
+
var styles19 = reactNative.StyleSheet.create({
|
|
2172
2275
|
footer: {
|
|
2173
2276
|
paddingVertical: FOOTER_PADDING_V,
|
|
2174
2277
|
paddingHorizontal: FOOTER_PADDING_H,
|
|
@@ -2193,8 +2296,8 @@ var BuildInfoFooter = ({
|
|
|
2193
2296
|
const fetchedCommit = useApiCommit(apiCommit === void 0 ? apiBaseUrl : void 0, fetchImpl);
|
|
2194
2297
|
const commit = apiCommit ?? fetchedCommit;
|
|
2195
2298
|
const label = formatBuildInfo(buildVersion, commit);
|
|
2196
|
-
const textStyle =
|
|
2197
|
-
() => [
|
|
2299
|
+
const textStyle = React11.useMemo(
|
|
2300
|
+
() => [styles19.text, { color: theme.colors.textSecondary }],
|
|
2198
2301
|
[theme.colors.textSecondary]
|
|
2199
2302
|
);
|
|
2200
2303
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2202,7 +2305,7 @@ var BuildInfoFooter = ({
|
|
|
2202
2305
|
{
|
|
2203
2306
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
2204
2307
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
|
|
2205
|
-
style: [
|
|
2308
|
+
style: [styles19.footer, style],
|
|
2206
2309
|
testID,
|
|
2207
2310
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label })
|
|
2208
2311
|
}
|
|
@@ -2233,6 +2336,7 @@ exports.Section = Section;
|
|
|
2233
2336
|
exports.SegmentedControl = SegmentedControl;
|
|
2234
2337
|
exports.SelectedMarker = SelectedMarker;
|
|
2235
2338
|
exports.StatusBadge = StatusBadge;
|
|
2339
|
+
exports.StickyPreview = StickyPreview;
|
|
2236
2340
|
exports.TYPE_SCALE_BREAKPOINT = TYPE_SCALE_BREAKPOINT;
|
|
2237
2341
|
exports.Tabs = Tabs;
|
|
2238
2342
|
exports.TabsCollapsedTrigger = TabsCollapsedTrigger;
|
|
@@ -2241,6 +2345,7 @@ exports.UpgradePrompt = UpgradePrompt;
|
|
|
2241
2345
|
exports.copyText = copyText;
|
|
2242
2346
|
exports.formatBuildInfo = formatBuildInfo;
|
|
2243
2347
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
2348
|
+
exports.isKeyboardOpen = isKeyboardOpen;
|
|
2244
2349
|
exports.isWideWebViewport = isWideWebViewport;
|
|
2245
2350
|
exports.shortenCommit = shortenCommit;
|
|
2246
2351
|
exports.trimTrailingSlash = trimTrailingSlash;
|
|
@@ -2248,5 +2353,6 @@ exports.truncateMiddle = truncateMiddle;
|
|
|
2248
2353
|
exports.useApiCommit = useApiCommit;
|
|
2249
2354
|
exports.useCopyToClipboard = useCopyToClipboard;
|
|
2250
2355
|
exports.useFocusTrap = useFocusTrap;
|
|
2356
|
+
exports.useVisibleViewport = useVisibleViewport;
|
|
2251
2357
|
//# sourceMappingURL=index.js.map
|
|
2252
2358
|
//# sourceMappingURL=index.js.map
|