@dloizides/ui-layout 1.43.0 → 1.45.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 +67 -7
- package/dist/index.d.ts +67 -7
- package/dist/index.js +379 -237
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +273 -138
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React16 = 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');
|
|
7
|
+
var designTokens = require('@dloizides/design-tokens');
|
|
7
8
|
var uiButtons = require('@dloizides/ui-buttons');
|
|
8
9
|
var uiIcons = require('@dloizides/ui-icons');
|
|
9
10
|
var uiMotion = require('@dloizides/ui-motion');
|
|
10
11
|
var a11y = require('@dloizides/a11y');
|
|
11
12
|
var reactDom = require('react-dom');
|
|
12
|
-
var designTokens = require('@dloizides/design-tokens');
|
|
13
13
|
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 React16__default = /*#__PURE__*/_interopDefault(React16);
|
|
18
18
|
|
|
19
19
|
// src/Section/Section.tsx
|
|
20
20
|
|
|
@@ -44,7 +44,7 @@ var Section = ({
|
|
|
44
44
|
const { theme } = uiFeedback.useUi();
|
|
45
45
|
const isCard = variant === "card" /* Card */;
|
|
46
46
|
const fill = isCard ? theme.colors.background : theme.colors.surface;
|
|
47
|
-
const containerStyle =
|
|
47
|
+
const containerStyle = React16__default.default.useMemo(
|
|
48
48
|
() => [styles.card, isCard ? styles.raised : null, { borderColor: theme.colors.border, backgroundColor: fill }, style],
|
|
49
49
|
[theme.colors.border, fill, isCard, style]
|
|
50
50
|
);
|
|
@@ -96,6 +96,8 @@ var AppText = ({
|
|
|
96
96
|
var LAYOUT_TEST_IDS = {
|
|
97
97
|
headingText: "heading-text",
|
|
98
98
|
statusLabel: "status-label",
|
|
99
|
+
countBadge: "count-badge",
|
|
100
|
+
splitPanes: "split-panes",
|
|
99
101
|
stickyPreview: "sticky-preview",
|
|
100
102
|
pageFrame: "page-frame",
|
|
101
103
|
upgradePrompt: "upgrade-prompt",
|
|
@@ -134,6 +136,7 @@ var LAYOUT_I18N = {
|
|
|
134
136
|
accordionToggleHint: "common.accordionToggleHint",
|
|
135
137
|
/** Default accessible hint on a `StatusBadge` when the caller supplies none. */
|
|
136
138
|
statusBadgeHint: "common.statusBadgeHint",
|
|
139
|
+
countBadgeLabel: "common.countBadgeLabel",
|
|
137
140
|
/** `ModalShell`: accessible name of the dialog when its title is not a plain string. */
|
|
138
141
|
dialog: "common.dialog",
|
|
139
142
|
/** `ModalShell`: accessible hint on the close button. */
|
|
@@ -221,7 +224,7 @@ var Heading = ({
|
|
|
221
224
|
testID
|
|
222
225
|
}) => {
|
|
223
226
|
const { theme } = uiFeedback.useUi();
|
|
224
|
-
const headingStyle =
|
|
227
|
+
const headingStyle = React16__default.default.useMemo(
|
|
225
228
|
() => [styles3.heading, { color: theme.colors.text }, style],
|
|
226
229
|
[theme.colors.text, style]
|
|
227
230
|
);
|
|
@@ -236,6 +239,40 @@ var Heading = ({
|
|
|
236
239
|
}
|
|
237
240
|
);
|
|
238
241
|
};
|
|
242
|
+
|
|
243
|
+
// src/StatusBadge/BadgeTone.ts
|
|
244
|
+
var BadgeTone = /* @__PURE__ */ ((BadgeTone2) => {
|
|
245
|
+
BadgeTone2["Neutral"] = "neutral";
|
|
246
|
+
BadgeTone2["Info"] = "info";
|
|
247
|
+
BadgeTone2["Success"] = "success";
|
|
248
|
+
BadgeTone2["Warning"] = "warning";
|
|
249
|
+
BadgeTone2["Danger"] = "danger";
|
|
250
|
+
return BadgeTone2;
|
|
251
|
+
})(BadgeTone || {});
|
|
252
|
+
function scaleFor(theme, tone) {
|
|
253
|
+
const semantic = theme.semantic;
|
|
254
|
+
if (tone === "danger" /* Danger */) return theme.semantic.error;
|
|
255
|
+
if (tone === "success" /* Success */) return semantic.success;
|
|
256
|
+
if (tone === "warning" /* Warning */) return semantic.warning;
|
|
257
|
+
if (tone === "info" /* Info */) return semantic.info ?? theme.palette.primary;
|
|
258
|
+
return void 0;
|
|
259
|
+
}
|
|
260
|
+
function readableInk(fill) {
|
|
261
|
+
if (fill === void 0 || !designTokens.isHexColor(fill) || !designTokens.canCarryAccessibleInk(fill)) return null;
|
|
262
|
+
return designTokens.resolveOnBrand(fill);
|
|
263
|
+
}
|
|
264
|
+
function neutralColors(colors) {
|
|
265
|
+
return { color: colors.text, backgroundColor: colors.surfaceElevated };
|
|
266
|
+
}
|
|
267
|
+
function resolveToneColors(theme, tone) {
|
|
268
|
+
const scale = scaleFor(theme, tone);
|
|
269
|
+
if (scale === void 0) return neutralColors(theme.colors);
|
|
270
|
+
for (const fill of [scale[designTokens.UI_MAIN_STEP], scale[designTokens.UI_DEEP_STEP]]) {
|
|
271
|
+
const ink = readableInk(fill);
|
|
272
|
+
if (ink !== null && fill !== void 0) return { color: ink, backgroundColor: fill };
|
|
273
|
+
}
|
|
274
|
+
return neutralColors(theme.colors);
|
|
275
|
+
}
|
|
239
276
|
var DEFAULT_PADDING_H = 10;
|
|
240
277
|
var DEFAULT_PADDING_V = 4;
|
|
241
278
|
var DEFAULT_BORDER_RADIUS = 12;
|
|
@@ -267,18 +304,22 @@ var styles4 = reactNative.StyleSheet.create({
|
|
|
267
304
|
});
|
|
268
305
|
var StatusBadge = ({
|
|
269
306
|
label,
|
|
270
|
-
|
|
271
|
-
|
|
307
|
+
tone = "neutral" /* Neutral */,
|
|
308
|
+
color: rawColor,
|
|
309
|
+
backgroundColor: rawBackground,
|
|
272
310
|
icon,
|
|
273
311
|
dashed = false,
|
|
274
312
|
testID = LAYOUT_TEST_IDS.statusLabel,
|
|
275
313
|
accessibilityLabel,
|
|
276
314
|
accessibilityHint
|
|
277
315
|
}) => {
|
|
278
|
-
const { t } = uiFeedback.useUi();
|
|
279
|
-
const
|
|
280
|
-
const
|
|
281
|
-
const
|
|
316
|
+
const { t, theme } = uiFeedback.useUi();
|
|
317
|
+
const toned = React16.useMemo(() => resolveToneColors(theme, tone), [theme, tone]);
|
|
318
|
+
const color = rawColor ?? toned.color;
|
|
319
|
+
const backgroundColor = rawBackground ?? toned.backgroundColor;
|
|
320
|
+
const dynamicBadge = React16.useMemo(() => ({ backgroundColor }), [backgroundColor]);
|
|
321
|
+
const dashedColor = React16.useMemo(() => ({ borderColor: color }), [color]);
|
|
322
|
+
const dynamicText = React16.useMemo(() => ({ color }), [color]);
|
|
282
323
|
const hasIcon = icon !== void 0 && icon !== null;
|
|
283
324
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
284
325
|
reactNative.View,
|
|
@@ -294,13 +335,105 @@ var StatusBadge = ({
|
|
|
294
335
|
}
|
|
295
336
|
);
|
|
296
337
|
};
|
|
338
|
+
|
|
339
|
+
// src/CountBadge/formatCount.ts
|
|
340
|
+
var OVERFLOW_SUFFIX = "+";
|
|
341
|
+
function formatCount(count, max) {
|
|
342
|
+
const whole = Math.max(0, Math.floor(count));
|
|
343
|
+
if (whole > max) return `${String(max)}${OVERFLOW_SUFFIX}`;
|
|
344
|
+
return String(whole);
|
|
345
|
+
}
|
|
346
|
+
var DEFAULT_MAX = 99;
|
|
347
|
+
var BADGE_SIZE = 20;
|
|
348
|
+
var BADGE_PADDING_H = 6;
|
|
349
|
+
var BADGE_FONT_SIZE = 12;
|
|
350
|
+
var styles5 = reactNative.StyleSheet.create({
|
|
351
|
+
badge: {
|
|
352
|
+
minWidth: BADGE_SIZE,
|
|
353
|
+
height: BADGE_SIZE,
|
|
354
|
+
borderRadius: BADGE_SIZE / 2,
|
|
355
|
+
paddingHorizontal: BADGE_PADDING_H,
|
|
356
|
+
alignItems: "center",
|
|
357
|
+
justifyContent: "center",
|
|
358
|
+
alignSelf: "flex-start"
|
|
359
|
+
},
|
|
360
|
+
text: { fontSize: BADGE_FONT_SIZE, fontWeight: "700" }
|
|
361
|
+
});
|
|
362
|
+
var CountBadge = ({
|
|
363
|
+
count,
|
|
364
|
+
max = DEFAULT_MAX,
|
|
365
|
+
tone = "neutral" /* Neutral */,
|
|
366
|
+
showZero = false,
|
|
367
|
+
testID = LAYOUT_TEST_IDS.countBadge,
|
|
368
|
+
accessibilityLabel
|
|
369
|
+
}) => {
|
|
370
|
+
const { theme, t } = uiFeedback.useUi();
|
|
371
|
+
const toned = React16.useMemo(() => resolveToneColors(theme, tone), [theme, tone]);
|
|
372
|
+
const badgeStyle = React16.useMemo(() => [styles5.badge, { backgroundColor: toned.backgroundColor }], [toned.backgroundColor]);
|
|
373
|
+
const textStyle = React16.useMemo(() => [styles5.text, { color: toned.color }], [toned.color]);
|
|
374
|
+
const text = formatCount(count, max);
|
|
375
|
+
const isHidden = text === "0" && !showZero;
|
|
376
|
+
if (isHidden) return null;
|
|
377
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
378
|
+
reactNative.View,
|
|
379
|
+
{
|
|
380
|
+
accessibilityLabel: accessibilityLabel ?? t(LAYOUT_I18N.countBadgeLabel, text),
|
|
381
|
+
style: badgeStyle,
|
|
382
|
+
testID,
|
|
383
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: text })
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// src/SplitPanes/SplitLayout.ts
|
|
389
|
+
var SplitLayout = /* @__PURE__ */ ((SplitLayout2) => {
|
|
390
|
+
SplitLayout2["Auto"] = "auto";
|
|
391
|
+
SplitLayout2["Stack"] = "stack";
|
|
392
|
+
SplitLayout2["Side"] = "side";
|
|
393
|
+
return SplitLayout2;
|
|
394
|
+
})(SplitLayout || {});
|
|
395
|
+
|
|
396
|
+
// src/SplitPanes/isSplitSideBySide.ts
|
|
397
|
+
function isSplitSideBySide(layout, width, breakpoint) {
|
|
398
|
+
if (layout === "side" /* Side */) return true;
|
|
399
|
+
if (layout === "stack" /* Stack */) return false;
|
|
400
|
+
return width >= breakpoint;
|
|
401
|
+
}
|
|
402
|
+
var DEFAULT_GAP = 12;
|
|
403
|
+
var DEFAULT_WEIGHT = 1;
|
|
404
|
+
var styles6 = reactNative.StyleSheet.create({
|
|
405
|
+
row: { flexDirection: "row", alignItems: "flex-start", width: "100%" },
|
|
406
|
+
column: { flexDirection: "column", width: "100%" },
|
|
407
|
+
sidePane: { flexBasis: 0, flexShrink: 1, minWidth: 0 },
|
|
408
|
+
stackPane: { width: "100%", minWidth: 0 }
|
|
409
|
+
});
|
|
410
|
+
var SplitPanes = ({
|
|
411
|
+
start,
|
|
412
|
+
end,
|
|
413
|
+
layout = "auto" /* Auto */,
|
|
414
|
+
startWeight = DEFAULT_WEIGHT,
|
|
415
|
+
endWeight = DEFAULT_WEIGHT,
|
|
416
|
+
gap = DEFAULT_GAP,
|
|
417
|
+
breakpoint = LAYOUT_COLLAPSE_BREAKPOINT,
|
|
418
|
+
testID = LAYOUT_TEST_IDS.splitPanes
|
|
419
|
+
}) => {
|
|
420
|
+
const { width } = reactNative.useWindowDimensions();
|
|
421
|
+
const isSide = isSplitSideBySide(layout, width, breakpoint);
|
|
422
|
+
const container = React16.useMemo(() => [isSide ? styles6.row : styles6.column, { gap }], [isSide, gap]);
|
|
423
|
+
const startStyle = isSide ? [styles6.sidePane, { flexGrow: startWeight }] : styles6.stackPane;
|
|
424
|
+
const endStyle = isSide ? [styles6.sidePane, { flexGrow: endWeight }] : styles6.stackPane;
|
|
425
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: container, testID, children: [
|
|
426
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: startStyle, testID: `${testID}-start`, children: start }),
|
|
427
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: endStyle, testID: `${testID}-end`, children: end })
|
|
428
|
+
] });
|
|
429
|
+
};
|
|
297
430
|
function isPastStickyLine(sentinelTop, isIntersecting, topOffset) {
|
|
298
431
|
return !isIntersecting && sentinelTop < topOffset;
|
|
299
432
|
}
|
|
300
433
|
function useStuckSentinel(topOffset) {
|
|
301
|
-
const sentinelRef =
|
|
302
|
-
const [isStuck, setIsStuck] =
|
|
303
|
-
|
|
434
|
+
const sentinelRef = React16.useRef(null);
|
|
435
|
+
const [isStuck, setIsStuck] = React16.useState(false);
|
|
436
|
+
React16.useEffect(() => {
|
|
304
437
|
const node = sentinelRef.current;
|
|
305
438
|
if (node === null || typeof IntersectionObserver === "undefined") return void 0;
|
|
306
439
|
const observer = new IntersectionObserver(
|
|
@@ -321,9 +454,9 @@ function isKeyboardOpen(visibleHeight, tallestHeight) {
|
|
|
321
454
|
return visibleHeight < tallestHeight * KEYBOARD_HEIGHT_RATIO;
|
|
322
455
|
}
|
|
323
456
|
function useVisibleViewport() {
|
|
324
|
-
const [state, setState] =
|
|
325
|
-
const tallest =
|
|
326
|
-
|
|
457
|
+
const [state, setState] = React16.useState(INITIAL);
|
|
458
|
+
const tallest = React16.useRef({ width: 0, height: 0 });
|
|
459
|
+
React16.useEffect(() => {
|
|
327
460
|
const viewport = typeof window === "undefined" ? void 0 : window.visualViewport;
|
|
328
461
|
if (viewport === void 0 || viewport === null) return void 0;
|
|
329
462
|
const read = () => {
|
|
@@ -349,7 +482,7 @@ function useVisibleViewport() {
|
|
|
349
482
|
return state;
|
|
350
483
|
}
|
|
351
484
|
var STICKY_Z_INDEX = 5;
|
|
352
|
-
var
|
|
485
|
+
var styles7 = reactNative.StyleSheet.create({
|
|
353
486
|
sentinel: { height: 1, marginBottom: -1 },
|
|
354
487
|
compact: { borderBottomWidth: 1 }
|
|
355
488
|
});
|
|
@@ -366,12 +499,12 @@ var StickyPreview = ({
|
|
|
366
499
|
const { offsetTop, keyboardOpen } = useVisibleViewport();
|
|
367
500
|
const { sentinelRef, isStuck } = useStuckSentinel(topOffset);
|
|
368
501
|
const isCompact = forceCompact || isStuck || keyboardOpen;
|
|
369
|
-
const pinned =
|
|
502
|
+
const pinned = React16.useMemo(() => {
|
|
370
503
|
const web = { position: "sticky", top: topOffset + offsetTop, zIndex: STICKY_Z_INDEX };
|
|
371
504
|
return reactNative.Platform.OS === WEB_PLATFORM ? web : {};
|
|
372
505
|
}, [offsetTop, topOffset]);
|
|
373
506
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
374
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, ref: sentinelRef, style:
|
|
507
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, ref: sentinelRef, style: styles7.sentinel }),
|
|
375
508
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
376
509
|
reactNative.View,
|
|
377
510
|
{
|
|
@@ -381,7 +514,7 @@ var StickyPreview = ({
|
|
|
381
514
|
style: [
|
|
382
515
|
pinned,
|
|
383
516
|
{ backgroundColor: theme.colors.background, borderColor: theme.colors.border },
|
|
384
|
-
isCompact &&
|
|
517
|
+
isCompact && styles7.compact
|
|
385
518
|
],
|
|
386
519
|
testID,
|
|
387
520
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID: `${testID}-${isCompact ? "compact" : "full"}`, children: isCompact ? compact : full })
|
|
@@ -395,8 +528,8 @@ function isInsideOpenMenu(target) {
|
|
|
395
528
|
return target instanceof Element && target.closest(OPEN_MENU_SELECTOR) !== null;
|
|
396
529
|
}
|
|
397
530
|
function useEscapeKey(enabled, onClose) {
|
|
398
|
-
const isEscapeForMenu =
|
|
399
|
-
|
|
531
|
+
const isEscapeForMenu = React16.useRef(false);
|
|
532
|
+
React16.useEffect(() => {
|
|
400
533
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
401
534
|
const onKeyDownCapture = (event) => {
|
|
402
535
|
if (event.key === ESCAPE_KEY) isEscapeForMenu.current = isInsideOpenMenu(event.target);
|
|
@@ -464,8 +597,8 @@ function handleKeyDown(domNode, event) {
|
|
|
464
597
|
}
|
|
465
598
|
}
|
|
466
599
|
function useFocusTrap(containerRef, enabled, initialFocusTestID) {
|
|
467
|
-
const previousFocusRef =
|
|
468
|
-
|
|
600
|
+
const previousFocusRef = React16.useRef(null);
|
|
601
|
+
React16.useEffect(() => {
|
|
469
602
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
470
603
|
let domNode = null;
|
|
471
604
|
let frame = 0;
|
|
@@ -496,7 +629,7 @@ function useFocusTrap(containerRef, enabled, initialFocusTestID) {
|
|
|
496
629
|
}, [containerRef, enabled, initialFocusTestID]);
|
|
497
630
|
}
|
|
498
631
|
function useScrollLock(enabled) {
|
|
499
|
-
|
|
632
|
+
React16.useEffect(() => {
|
|
500
633
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
501
634
|
const { body } = document;
|
|
502
635
|
const previousOverflow = body.style.overflow;
|
|
@@ -516,7 +649,7 @@ var HEADER_MARGIN = 12;
|
|
|
516
649
|
var DIALOG_MAX_HEIGHT = "90%";
|
|
517
650
|
var PANEL_ENTER_SCALE = 0.96;
|
|
518
651
|
var SIZE_MAX_WIDTH = { sm: 360, md: 480, lg: 640, xl: 880 };
|
|
519
|
-
var
|
|
652
|
+
var styles8 = reactNative.StyleSheet.create({
|
|
520
653
|
overlay: {
|
|
521
654
|
flex: 1,
|
|
522
655
|
justifyContent: "center",
|
|
@@ -563,7 +696,7 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
563
696
|
});
|
|
564
697
|
var ModalFooter = ({ children, testID }) => {
|
|
565
698
|
const { width } = reactNative.useWindowDimensions();
|
|
566
|
-
const style = isModalFooterStacked(width) ?
|
|
699
|
+
const style = isModalFooterStacked(width) ? styles8.footerStack : styles8.footerRow;
|
|
567
700
|
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style, testID, children });
|
|
568
701
|
};
|
|
569
702
|
var Modal = ({
|
|
@@ -579,7 +712,7 @@ var Modal = ({
|
|
|
579
712
|
initialFocusTestID
|
|
580
713
|
}) => {
|
|
581
714
|
const { theme, t } = uiFeedback.useUi();
|
|
582
|
-
const dialogRef =
|
|
715
|
+
const dialogRef = React16.useRef(null);
|
|
583
716
|
const backdrop = uiMotion.useEnterExit({ visible });
|
|
584
717
|
const panel = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });
|
|
585
718
|
const mounted = panel.mounted || backdrop.mounted;
|
|
@@ -588,18 +721,18 @@ var Modal = ({
|
|
|
588
721
|
useScrollLock(visible);
|
|
589
722
|
const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);
|
|
590
723
|
const closeLabel = t(LAYOUT_I18N.dialogClose);
|
|
591
|
-
const dialogStyle =
|
|
592
|
-
() => [
|
|
724
|
+
const dialogStyle = React16.useMemo(
|
|
725
|
+
() => [styles8.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],
|
|
593
726
|
[theme.colors.surface, size]
|
|
594
727
|
);
|
|
595
728
|
const hasHeader = title !== void 0 || showClose;
|
|
596
729
|
const focusesDialog = initialFocusTestID === testID;
|
|
597
730
|
const hardwareBackClose = reactNative.Platform.OS === "web" ? void 0 : onClose;
|
|
598
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: hardwareBackClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
731
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: mounted, onRequestClose: hardwareBackClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles8.overlay, children: [
|
|
599
732
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
600
733
|
reactNative.Animated.View,
|
|
601
734
|
{
|
|
602
|
-
style: [reactNative.StyleSheet.absoluteFill,
|
|
735
|
+
style: [reactNative.StyleSheet.absoluteFill, styles8.scrim, { opacity: backdrop.style.opacity }]
|
|
603
736
|
}
|
|
604
737
|
),
|
|
605
738
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -613,8 +746,8 @@ var Modal = ({
|
|
|
613
746
|
tabIndex: focusesDialog ? -1 : void 0,
|
|
614
747
|
testID,
|
|
615
748
|
children: [
|
|
616
|
-
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
617
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
749
|
+
hasHeader ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles8.headerRow, children: [
|
|
750
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles8.titleWrap, children: title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title }) : null }),
|
|
618
751
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
619
752
|
uiButtons.IconButton,
|
|
620
753
|
{
|
|
@@ -643,7 +776,7 @@ var Modal = ({
|
|
|
643
776
|
accessibilityLabel: t(LAYOUT_I18N.dismissDropdown),
|
|
644
777
|
accessibilityRole: "button",
|
|
645
778
|
activeOpacity: 1,
|
|
646
|
-
style: [reactNative.StyleSheet.absoluteFill,
|
|
779
|
+
style: [reactNative.StyleSheet.absoluteFill, styles8.backdrop],
|
|
647
780
|
focusable: false,
|
|
648
781
|
testID: `${testID}-backdrop`,
|
|
649
782
|
onPress: onClose
|
|
@@ -680,7 +813,7 @@ var scaledFrame = (containerWidth, page) => {
|
|
|
680
813
|
offsetY: (scale - 1) * page.height / HALF
|
|
681
814
|
};
|
|
682
815
|
};
|
|
683
|
-
var
|
|
816
|
+
var styles9 = reactNative.StyleSheet.create({
|
|
684
817
|
outer: { width: "100%", overflow: "hidden" },
|
|
685
818
|
page: { position: "absolute", top: 0, left: 0 },
|
|
686
819
|
trigger: { width: "100%", cursor: "pointer" }
|
|
@@ -692,19 +825,19 @@ var PageFrame = ({
|
|
|
692
825
|
enlargeable = false
|
|
693
826
|
}) => {
|
|
694
827
|
const { t } = uiFeedback.useUi();
|
|
695
|
-
const [containerWidth, setContainerWidth] =
|
|
696
|
-
const [enlarged, setEnlarged] =
|
|
697
|
-
const onLayout =
|
|
828
|
+
const [containerWidth, setContainerWidth] = React16.useState(0);
|
|
829
|
+
const [enlarged, setEnlarged] = React16.useState(false);
|
|
830
|
+
const onLayout = React16.useCallback((event) => {
|
|
698
831
|
setContainerWidth(event.nativeEvent.layout.width);
|
|
699
832
|
}, []);
|
|
700
|
-
const open =
|
|
701
|
-
const close =
|
|
833
|
+
const open = React16.useCallback(() => setEnlarged(true), []);
|
|
834
|
+
const close = React16.useCallback(() => setEnlarged(false), []);
|
|
702
835
|
const frame = scaledFrame(containerWidth, pageSize);
|
|
703
|
-
const preview = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [
|
|
836
|
+
const preview = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles9.outer, { height: frame.height }], testID, onLayout, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
704
837
|
reactNative.View,
|
|
705
838
|
{
|
|
706
839
|
style: [
|
|
707
|
-
|
|
840
|
+
styles9.page,
|
|
708
841
|
{
|
|
709
842
|
width: pageSize.width,
|
|
710
843
|
height: pageSize.height,
|
|
@@ -722,7 +855,7 @@ var PageFrame = ({
|
|
|
722
855
|
accessibilityHint: t(LAYOUT_I18N.pageEnlargeHint),
|
|
723
856
|
accessibilityLabel: t(LAYOUT_I18N.pageEnlarge),
|
|
724
857
|
accessibilityRole: "button",
|
|
725
|
-
style:
|
|
858
|
+
style: styles9.trigger,
|
|
726
859
|
testID: `${testID}-enlarge`,
|
|
727
860
|
onPress: open,
|
|
728
861
|
children: preview
|
|
@@ -742,7 +875,7 @@ var BORDER_WIDTH = 1;
|
|
|
742
875
|
var SEGMENT_BOX_SHADOW = "0px 1px 3px rgba(20, 30, 50, 0.1)";
|
|
743
876
|
var SHADOW_ELEVATION = 2;
|
|
744
877
|
var TRANSPARENT = "transparent";
|
|
745
|
-
var
|
|
878
|
+
var styles10 = reactNative.StyleSheet.create({
|
|
746
879
|
track: {
|
|
747
880
|
flexDirection: "row",
|
|
748
881
|
alignSelf: "flex-start",
|
|
@@ -787,7 +920,7 @@ function SegmentedControl({
|
|
|
787
920
|
{
|
|
788
921
|
accessibilityRole: "tablist",
|
|
789
922
|
"aria-label": accessibilityLabel,
|
|
790
|
-
style: [
|
|
923
|
+
style: [styles10.track, { backgroundColor: colors.background, borderColor: colors.border }, style],
|
|
791
924
|
testID,
|
|
792
925
|
children: options.map((opt) => {
|
|
793
926
|
const selected = opt.value === value;
|
|
@@ -800,13 +933,13 @@ function SegmentedControl({
|
|
|
800
933
|
accessibilityHint: opt.accessibilityHint,
|
|
801
934
|
onPress: () => onChange(opt.value),
|
|
802
935
|
style: [
|
|
803
|
-
|
|
804
|
-
selected ?
|
|
936
|
+
styles10.segment,
|
|
937
|
+
selected ? styles10.segmentSelected : null,
|
|
805
938
|
{ backgroundColor: selected ? colors.surface : TRANSPARENT }
|
|
806
939
|
],
|
|
807
940
|
testID: opt.testID,
|
|
808
941
|
...ariaSelectedProps(selected),
|
|
809
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
942
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.label, { color: selected ? colors.text : colors.textSecondary }], children: opt.label })
|
|
810
943
|
},
|
|
811
944
|
opt.value
|
|
812
945
|
);
|
|
@@ -898,7 +1031,7 @@ var HEADING_PADDING_H = 16;
|
|
|
898
1031
|
var HEADING_PADDING_TOP = 8;
|
|
899
1032
|
var HEADING_PADDING_BOTTOM = 4;
|
|
900
1033
|
var HEADING_LETTER_SPACING = 0.5;
|
|
901
|
-
var
|
|
1034
|
+
var styles11 = reactNative.StyleSheet.create({
|
|
902
1035
|
heading: {
|
|
903
1036
|
fontSize: HEADING_FONT_SIZE,
|
|
904
1037
|
fontWeight: HEADING_FONT_WEIGHT,
|
|
@@ -914,7 +1047,7 @@ var MenuHeading = ({ testID, text }) => {
|
|
|
914
1047
|
reactNative.Text,
|
|
915
1048
|
{
|
|
916
1049
|
accessibilityRole: "header",
|
|
917
|
-
style: [
|
|
1050
|
+
style: [styles11.heading, { color: theme.colors.textSecondary }],
|
|
918
1051
|
testID: `${testID}-menu-heading`,
|
|
919
1052
|
children: text
|
|
920
1053
|
}
|
|
@@ -935,7 +1068,7 @@ var OPTION_PADDING_V = 12;
|
|
|
935
1068
|
var ACCENT_BAR_WIDTH = 3;
|
|
936
1069
|
var CHECK_GAP = 8;
|
|
937
1070
|
var CHECK_GLYPH = "\u2713";
|
|
938
|
-
var
|
|
1071
|
+
var styles12 = reactNative.StyleSheet.create({
|
|
939
1072
|
option: {
|
|
940
1073
|
paddingHorizontal: OPTION_PADDING_H,
|
|
941
1074
|
paddingVertical: OPTION_PADDING_V,
|
|
@@ -967,23 +1100,23 @@ var OptionRow = ({
|
|
|
967
1100
|
}) => {
|
|
968
1101
|
const { theme, t } = uiFeedback.useUi();
|
|
969
1102
|
const { colors } = theme;
|
|
970
|
-
const handlePress =
|
|
1103
|
+
const handlePress = React16.useCallback(() => {
|
|
971
1104
|
onSelect();
|
|
972
1105
|
}, [onSelect]);
|
|
973
1106
|
const accentColor = theme.palette.primary["500"];
|
|
974
1107
|
const isMarked = selectedMarker === "accent-check" /* AccentCheck */;
|
|
975
1108
|
const isActive = isSelected || isHighlighted;
|
|
976
1109
|
const rowStyle = [
|
|
977
|
-
|
|
978
|
-
isMarked ?
|
|
1110
|
+
styles12.option,
|
|
1111
|
+
isMarked ? styles12.markedRow : null,
|
|
979
1112
|
isActive ? { backgroundColor: colors.surfaceElevated } : null,
|
|
980
1113
|
isMarked && isSelected ? { borderLeftColor: accentColor } : null
|
|
981
1114
|
];
|
|
982
1115
|
const textStyle = [
|
|
983
|
-
|
|
1116
|
+
styles12.optionText,
|
|
984
1117
|
{ color: colors.text },
|
|
985
|
-
isSelected ?
|
|
986
|
-
isMarked ?
|
|
1118
|
+
isSelected ? styles12.selectedText : null,
|
|
1119
|
+
isMarked ? styles12.markedText : null
|
|
987
1120
|
];
|
|
988
1121
|
const selectionProps = asMenuItem ? { "aria-current": isSelected ? "true" : void 0 } : { "aria-selected": isSelected };
|
|
989
1122
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -999,7 +1132,7 @@ var OptionRow = ({
|
|
|
999
1132
|
onPress: handlePress,
|
|
1000
1133
|
children: [
|
|
1001
1134
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label }),
|
|
1002
|
-
isMarked && isSelected ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, testID: `${testID}-check`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1135
|
+
isMarked && isSelected ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { "aria-hidden": true, testID: `${testID}-check`, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles12.selectedText, { color: accentColor }], children: CHECK_GLYPH }) }) : null
|
|
1003
1136
|
]
|
|
1004
1137
|
}
|
|
1005
1138
|
);
|
|
@@ -1056,8 +1189,8 @@ function isSameRect(a, b) {
|
|
|
1056
1189
|
return a.top === b.top && a.left === b.left && a.width === b.width && a.bottom === b.bottom;
|
|
1057
1190
|
}
|
|
1058
1191
|
function useAnchorTracking(containerRef, onOutOfView) {
|
|
1059
|
-
const [rect, setRect] =
|
|
1060
|
-
|
|
1192
|
+
const [rect, setRect] = React16.useState(() => readAnchorRect(containerRef));
|
|
1193
|
+
React16.useLayoutEffect(() => {
|
|
1061
1194
|
if (!IS_WEB) return void 0;
|
|
1062
1195
|
let frame = null;
|
|
1063
1196
|
let isDisposed = false;
|
|
@@ -1136,7 +1269,7 @@ function buildKeyHandler(params) {
|
|
|
1136
1269
|
}
|
|
1137
1270
|
function useMenuKeyboard(params) {
|
|
1138
1271
|
const { containerRef, menuRef, enabled, onClose } = params;
|
|
1139
|
-
|
|
1272
|
+
React16.useEffect(() => {
|
|
1140
1273
|
if (reactNative.Platform.OS !== "web" || !enabled) return;
|
|
1141
1274
|
const onKeyDown = buildKeyHandler(params);
|
|
1142
1275
|
const onMouseDown = (event) => {
|
|
@@ -1159,19 +1292,19 @@ function readViewportHeight() {
|
|
|
1159
1292
|
return IS_WEB2 && typeof window !== "undefined" ? window.innerHeight : 0;
|
|
1160
1293
|
}
|
|
1161
1294
|
function useMenuPlacement(rect, menuRef, itemCount) {
|
|
1162
|
-
const [menuHeight, setMenuHeight] =
|
|
1163
|
-
const [viewportHeight, setViewportHeight] =
|
|
1164
|
-
|
|
1295
|
+
const [menuHeight, setMenuHeight] = React16.useState(MENU_MAX_HEIGHT);
|
|
1296
|
+
const [viewportHeight, setViewportHeight] = React16.useState(readViewportHeight);
|
|
1297
|
+
React16.useLayoutEffect(() => {
|
|
1165
1298
|
const measured = toDomNode(menuRef)?.offsetHeight ?? 0;
|
|
1166
1299
|
if (measured > 0) setMenuHeight(measured);
|
|
1167
1300
|
}, [menuRef, itemCount]);
|
|
1168
|
-
|
|
1301
|
+
React16.useLayoutEffect(() => {
|
|
1169
1302
|
if (!IS_WEB2) return void 0;
|
|
1170
1303
|
const onResize = () => setViewportHeight(readViewportHeight());
|
|
1171
1304
|
window.addEventListener("resize", onResize);
|
|
1172
1305
|
return () => window.removeEventListener("resize", onResize);
|
|
1173
1306
|
}, []);
|
|
1174
|
-
return
|
|
1307
|
+
return React16.useMemo(
|
|
1175
1308
|
() => resolveMenuPlacement(rect ?? UNMEASURED_RECT, viewportHeight, menuHeight),
|
|
1176
1309
|
[rect, viewportHeight, menuHeight]
|
|
1177
1310
|
);
|
|
@@ -1180,7 +1313,7 @@ var IS_WEB3 = reactNative.Platform.OS === "web";
|
|
|
1180
1313
|
var BORDER_RADIUS2 = 8;
|
|
1181
1314
|
var BORDER_WIDTH3 = 1;
|
|
1182
1315
|
var MENU_PADDING2 = 4;
|
|
1183
|
-
var
|
|
1316
|
+
var styles13 = reactNative.StyleSheet.create({
|
|
1184
1317
|
/** Native (in-tree) popover — anchored absolutely just under the trigger. */
|
|
1185
1318
|
popover: {
|
|
1186
1319
|
position: "absolute",
|
|
@@ -1224,29 +1357,29 @@ var InlineMenu = ({
|
|
|
1224
1357
|
}) => {
|
|
1225
1358
|
const { theme } = uiFeedback.useUi();
|
|
1226
1359
|
const { colors } = theme;
|
|
1227
|
-
const menuRef =
|
|
1360
|
+
const menuRef = React16.useRef(null);
|
|
1228
1361
|
const rect = useAnchorTracking(containerRef, onClose);
|
|
1229
1362
|
const placement = useMenuPlacement(rect, menuRef, options.length);
|
|
1230
1363
|
const opensAbove = placement.bottom !== void 0;
|
|
1231
|
-
const selectedIndex =
|
|
1364
|
+
const selectedIndex = React16.useMemo(
|
|
1232
1365
|
() => Math.max(0, options.findIndex((opt) => opt.value === value)),
|
|
1233
1366
|
[options, value]
|
|
1234
1367
|
);
|
|
1235
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
1236
|
-
const handleSelect =
|
|
1368
|
+
const [highlightedIndex, setHighlightedIndex] = React16.useState(() => selectedIndex);
|
|
1369
|
+
const handleSelect = React16.useCallback(
|
|
1237
1370
|
(optionValue) => {
|
|
1238
1371
|
if (isOpen) onSelect(optionValue);
|
|
1239
1372
|
},
|
|
1240
1373
|
[isOpen, onSelect]
|
|
1241
1374
|
);
|
|
1242
|
-
const selectAt =
|
|
1375
|
+
const selectAt = React16.useCallback(
|
|
1243
1376
|
(index) => {
|
|
1244
1377
|
const option = options[index];
|
|
1245
1378
|
if (option !== void 0) handleSelect(option.value);
|
|
1246
1379
|
},
|
|
1247
1380
|
[options, handleSelect]
|
|
1248
1381
|
);
|
|
1249
|
-
const selectHighlighted =
|
|
1382
|
+
const selectHighlighted = React16.useCallback(
|
|
1250
1383
|
() => {
|
|
1251
1384
|
selectAt(highlightedIndex);
|
|
1252
1385
|
},
|
|
@@ -1261,7 +1394,7 @@ var InlineMenu = ({
|
|
|
1261
1394
|
onSelectHighlighted: selectHighlighted,
|
|
1262
1395
|
onClose
|
|
1263
1396
|
});
|
|
1264
|
-
const popoverStyle =
|
|
1397
|
+
const popoverStyle = React16.useMemo(() => {
|
|
1265
1398
|
const themed = { borderColor: colors.border, backgroundColor: colors.surface };
|
|
1266
1399
|
if (IS_WEB3) {
|
|
1267
1400
|
const viewportWidth = typeof window !== "undefined" ? window.innerWidth : 0;
|
|
@@ -1270,9 +1403,9 @@ var InlineMenu = ({
|
|
|
1270
1403
|
themed
|
|
1271
1404
|
];
|
|
1272
1405
|
}
|
|
1273
|
-
return [
|
|
1406
|
+
return [styles13.popover, { minWidth: menuMinWidth }, themed];
|
|
1274
1407
|
}, [colors.border, colors.surface, menuMinWidth, placement, rect]);
|
|
1275
|
-
const scrollStyle = IS_WEB3 ? { maxHeight: menuScrollMaxHeight(placement.maxHeight) } :
|
|
1408
|
+
const scrollStyle = IS_WEB3 ? { maxHeight: menuScrollMaxHeight(placement.maxHeight) } : styles13.scroll;
|
|
1276
1409
|
const menu = /* @__PURE__ */ jsxRuntime.jsx(
|
|
1277
1410
|
reactNative.View,
|
|
1278
1411
|
{
|
|
@@ -1286,7 +1419,7 @@ var InlineMenu = ({
|
|
|
1286
1419
|
reactNative.Animated.View,
|
|
1287
1420
|
{
|
|
1288
1421
|
pointerEvents: isOpen ? "auto" : "none",
|
|
1289
|
-
style: [
|
|
1422
|
+
style: [styles13.animated, opensAbove ? styles13.animatedAbove : null, animatedStyle, isOpen ? null : styles13.inert],
|
|
1290
1423
|
children: [
|
|
1291
1424
|
menuHeading !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(MenuHeading, { testID, text: menuHeading }) : null,
|
|
1292
1425
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style: scrollStyle, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1337,7 +1470,7 @@ var CARET_OPEN_ROTATION = "180deg";
|
|
|
1337
1470
|
var CARET_CLOSED_ROTATION = "0deg";
|
|
1338
1471
|
var POPOVER_ENTER_SCALE = 0.96;
|
|
1339
1472
|
var POPOVER_MOTION_MS = 120;
|
|
1340
|
-
var
|
|
1473
|
+
var styles14 = reactNative.StyleSheet.create({
|
|
1341
1474
|
anchor: { position: "relative" },
|
|
1342
1475
|
container: {
|
|
1343
1476
|
borderWidth: BORDER_WIDTH4,
|
|
@@ -1407,7 +1540,7 @@ var ModalDropdown = ({
|
|
|
1407
1540
|
const { colors } = theme;
|
|
1408
1541
|
const resolvedVariant = useResolvedDropdownVariant(variant);
|
|
1409
1542
|
const isMenu = resolvedVariant === "menu" /* Menu */;
|
|
1410
|
-
const [isOpen, setIsOpen] =
|
|
1543
|
+
const [isOpen, setIsOpen] = React16.useState(false);
|
|
1411
1544
|
const { a11yProps, hintNode } = a11y.useA11y({
|
|
1412
1545
|
label: accessibilityLabel,
|
|
1413
1546
|
hint: accessibilityHint,
|
|
@@ -1415,10 +1548,10 @@ var ModalDropdown = ({
|
|
|
1415
1548
|
state: { expanded: isOpen },
|
|
1416
1549
|
testID
|
|
1417
1550
|
});
|
|
1418
|
-
const anchorRef =
|
|
1419
|
-
const triggerRef =
|
|
1551
|
+
const anchorRef = React16.useRef(null);
|
|
1552
|
+
const triggerRef = React16.useRef(null);
|
|
1420
1553
|
const popupProps = { "aria-haspopup": isMenu ? "menu" : "dialog" };
|
|
1421
|
-
const dialogRef =
|
|
1554
|
+
const dialogRef = React16.useRef(null);
|
|
1422
1555
|
useFocusTrap(dialogRef, isOpen && !isMenu);
|
|
1423
1556
|
const menuAnim = uiMotion.useEnterExit({
|
|
1424
1557
|
visible: isMenu && isOpen,
|
|
@@ -1430,17 +1563,17 @@ var ModalDropdown = ({
|
|
|
1430
1563
|
fromScale: POPOVER_ENTER_SCALE,
|
|
1431
1564
|
duration: POPOVER_MOTION_MS
|
|
1432
1565
|
});
|
|
1433
|
-
const selectedLabel =
|
|
1566
|
+
const selectedLabel = React16.useMemo(() => {
|
|
1434
1567
|
const found = options.find((opt) => opt.value === value);
|
|
1435
1568
|
return found?.label ?? t(LAYOUT_I18N.selectPlaceholder);
|
|
1436
1569
|
}, [options, value, t]);
|
|
1437
|
-
const handleToggle =
|
|
1570
|
+
const handleToggle = React16.useCallback(() => {
|
|
1438
1571
|
setIsOpen((prev) => !prev);
|
|
1439
1572
|
}, []);
|
|
1440
|
-
const handleClose =
|
|
1573
|
+
const handleClose = React16.useCallback(() => {
|
|
1441
1574
|
setIsOpen(false);
|
|
1442
1575
|
}, []);
|
|
1443
|
-
const handleSelect =
|
|
1576
|
+
const handleSelect = React16.useCallback(
|
|
1444
1577
|
(optionValue) => {
|
|
1445
1578
|
onChange(optionValue);
|
|
1446
1579
|
setIsOpen(false);
|
|
@@ -1450,38 +1583,38 @@ var ModalDropdown = ({
|
|
|
1450
1583
|
);
|
|
1451
1584
|
const isHamburger = showHamburger;
|
|
1452
1585
|
const isCaret = showCaret && !isHamburger;
|
|
1453
|
-
const containerStyle =
|
|
1586
|
+
const containerStyle = React16.useMemo(
|
|
1454
1587
|
() => renderTrigger !== void 0 ? void 0 : [
|
|
1455
|
-
|
|
1456
|
-
isHamburger ?
|
|
1588
|
+
styles14.container,
|
|
1589
|
+
isHamburger ? styles14.containerHamburger : isCaret ? styles14.containerMenu : null,
|
|
1457
1590
|
{ borderColor: colors.border, backgroundColor: colors.surface }
|
|
1458
1591
|
],
|
|
1459
1592
|
[colors.border, colors.surface, renderTrigger, isHamburger, isCaret]
|
|
1460
1593
|
);
|
|
1461
|
-
const hamburgerStyle =
|
|
1462
|
-
() => [
|
|
1594
|
+
const hamburgerStyle = React16.useMemo(
|
|
1595
|
+
() => [styles14.hamburger, { color: colors.textSecondary }],
|
|
1463
1596
|
[colors.textSecondary]
|
|
1464
1597
|
);
|
|
1465
|
-
const caretStyle =
|
|
1598
|
+
const caretStyle = React16.useMemo(
|
|
1466
1599
|
() => [
|
|
1467
|
-
|
|
1600
|
+
styles14.caret,
|
|
1468
1601
|
{ color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] }
|
|
1469
1602
|
],
|
|
1470
1603
|
[colors.textSecondary, isOpen]
|
|
1471
1604
|
);
|
|
1472
|
-
const optionTestIDFor =
|
|
1605
|
+
const optionTestIDFor = React16.useCallback(
|
|
1473
1606
|
(optionValue) => optionTestID !== void 0 ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,
|
|
1474
1607
|
[optionTestID, testID]
|
|
1475
1608
|
);
|
|
1476
|
-
const anchorStyle =
|
|
1477
|
-
() => [
|
|
1609
|
+
const anchorStyle = React16.useMemo(
|
|
1610
|
+
() => [styles14.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
1478
1611
|
[isMenu, isOpen]
|
|
1479
1612
|
);
|
|
1480
|
-
const modalContentStyle =
|
|
1481
|
-
() => [
|
|
1613
|
+
const modalContentStyle = React16.useMemo(
|
|
1614
|
+
() => [styles14.modalContent, { backgroundColor: colors.surface }],
|
|
1482
1615
|
[colors.surface]
|
|
1483
1616
|
);
|
|
1484
|
-
const renderModalOption =
|
|
1617
|
+
const renderModalOption = React16.useCallback(
|
|
1485
1618
|
({ item }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1486
1619
|
OptionRow,
|
|
1487
1620
|
{
|
|
@@ -1494,16 +1627,16 @@ var ModalDropdown = ({
|
|
|
1494
1627
|
),
|
|
1495
1628
|
[handleSelect, optionTestIDFor, selectedMarker, value]
|
|
1496
1629
|
);
|
|
1497
|
-
const keyExtractor =
|
|
1630
|
+
const keyExtractor = React16.useCallback((item) => String(item.value), []);
|
|
1498
1631
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: anchorStyle, children: [
|
|
1499
1632
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.TouchableOpacity, { ...a11yProps, ...popupProps, ref: triggerRef, style: containerStyle, onPress: handleToggle, children: [
|
|
1500
1633
|
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : isHamburger ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1501
1634
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: hamburgerStyle, children: HAMBURGER_GLYPH }),
|
|
1502
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [
|
|
1635
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles14.selectedText, styles14.selectedTextMenu, { color: colors.text }], children: selectedLabel })
|
|
1503
1636
|
] }) : isCaret ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1504
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [
|
|
1637
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { numberOfLines: 1, style: [styles14.selectedText, styles14.selectedTextMenu, { color: colors.text }], children: selectedLabel }),
|
|
1505
1638
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: caretStyle, children: CARET_GLYPH })
|
|
1506
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1639
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles14.selectedText, { color: colors.text }], children: selectedLabel }),
|
|
1507
1640
|
hintNode
|
|
1508
1641
|
] }),
|
|
1509
1642
|
isMenu && menuAnim.mounted ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1524,7 +1657,7 @@ var ModalDropdown = ({
|
|
|
1524
1657
|
onSelect: handleSelect
|
|
1525
1658
|
}
|
|
1526
1659
|
) : null,
|
|
1527
|
-
!isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1660
|
+
!isMenu ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: modalAnim.mounted, onRequestClose: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles14.modalOverlay, children: [
|
|
1528
1661
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1529
1662
|
reactNative.TouchableOpacity,
|
|
1530
1663
|
{
|
|
@@ -1570,11 +1703,11 @@ var TabsMenu = ({
|
|
|
1570
1703
|
collapsedTrigger = "caret" /* Caret */
|
|
1571
1704
|
}) => {
|
|
1572
1705
|
const { t } = uiFeedback.useUi();
|
|
1573
|
-
const options =
|
|
1706
|
+
const options = React16.useMemo(
|
|
1574
1707
|
() => tabs.map((tab) => ({ label: tab.label, value: tab.key })),
|
|
1575
1708
|
[tabs]
|
|
1576
1709
|
);
|
|
1577
|
-
const optionTestID =
|
|
1710
|
+
const optionTestID = React16.useCallback(
|
|
1578
1711
|
(key) => {
|
|
1579
1712
|
const found = tabs.find((tab) => tab.key === key);
|
|
1580
1713
|
return found?.testID ?? `${idPrefix}-tab-${key}`;
|
|
@@ -1617,7 +1750,7 @@ var ROW_PAD_V = 8;
|
|
|
1617
1750
|
var PANEL_PAD_TOP = 16;
|
|
1618
1751
|
var BORDER_WIDTH5 = 1;
|
|
1619
1752
|
var TEXT_ON_PRIMARY = "#ffffff";
|
|
1620
|
-
var
|
|
1753
|
+
var styles15 = reactNative.StyleSheet.create({
|
|
1621
1754
|
root: {
|
|
1622
1755
|
width: "100%"
|
|
1623
1756
|
},
|
|
@@ -1671,7 +1804,7 @@ var WideTabStrip = ({
|
|
|
1671
1804
|
textSecondary,
|
|
1672
1805
|
surfaceElevated,
|
|
1673
1806
|
stripStyle
|
|
1674
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [
|
|
1807
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles15.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: [styles15.strip, stripStyle], children: tabs.map((tab) => {
|
|
1675
1808
|
const selected = tab.key === activeKey;
|
|
1676
1809
|
const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;
|
|
1677
1810
|
const pillColor = selected ? primaryColor : surfaceElevated;
|
|
@@ -1685,10 +1818,10 @@ var WideTabStrip = ({
|
|
|
1685
1818
|
accessibilityLabel: tab.accessibilityLabel ?? tab.label,
|
|
1686
1819
|
accessibilityHint: tab.accessibilityHint,
|
|
1687
1820
|
onPress: () => onChange(tab.key),
|
|
1688
|
-
style: [
|
|
1821
|
+
style: [styles15.pill, { backgroundColor: pillColor }],
|
|
1689
1822
|
testID: tab.testID,
|
|
1690
1823
|
...ariaTabProps(selected, panelId, tabId),
|
|
1691
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1824
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles15.pillText, { color: textColor }], children: tab.label })
|
|
1692
1825
|
},
|
|
1693
1826
|
tab.key
|
|
1694
1827
|
);
|
|
@@ -1713,7 +1846,7 @@ var Tabs = ({
|
|
|
1713
1846
|
const activePanelId = `${idPrefix}-panel-${activeKey}`;
|
|
1714
1847
|
const activeTabId = `${idPrefix}-tab-${activeKey}`;
|
|
1715
1848
|
const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
|
|
1716
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
1849
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles15.root, style], testID, children: [
|
|
1717
1850
|
collapsed ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1718
1851
|
TabsMenu,
|
|
1719
1852
|
{
|
|
@@ -1740,7 +1873,7 @@ var Tabs = ({
|
|
|
1740
1873
|
onChange
|
|
1741
1874
|
}
|
|
1742
1875
|
),
|
|
1743
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [
|
|
1876
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "none", style: [styles15.panel, panelStyle], ...panelAria, children })
|
|
1744
1877
|
] });
|
|
1745
1878
|
};
|
|
1746
1879
|
var PROMPT_PADDING = 20;
|
|
@@ -1755,7 +1888,7 @@ var DISMISS_FONT_SIZE = 13;
|
|
|
1755
1888
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
1756
1889
|
var MESSAGE_MARGIN_BOTTOM = 16;
|
|
1757
1890
|
var CTA_MARGIN_BOTTOM = 8;
|
|
1758
|
-
var
|
|
1891
|
+
var styles16 = reactNative.StyleSheet.create({
|
|
1759
1892
|
container: {
|
|
1760
1893
|
padding: PROMPT_PADDING,
|
|
1761
1894
|
borderRadius: PROMPT_BORDER_RADIUS,
|
|
@@ -1790,21 +1923,21 @@ var UpgradePrompt = ({
|
|
|
1790
1923
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1791
1924
|
reactNative.View,
|
|
1792
1925
|
{
|
|
1793
|
-
style: [
|
|
1926
|
+
style: [styles16.container, { borderColor: primary, backgroundColor: colors.surface }],
|
|
1794
1927
|
testID: LAYOUT_TEST_IDS.upgradePrompt,
|
|
1795
1928
|
children: [
|
|
1796
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1797
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1929
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
|
|
1930
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
|
|
1798
1931
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1799
1932
|
reactNative.TouchableOpacity,
|
|
1800
1933
|
{
|
|
1801
1934
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
|
|
1802
1935
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
|
|
1803
1936
|
accessibilityRole: "button",
|
|
1804
|
-
style: [
|
|
1937
|
+
style: [styles16.cta, { backgroundColor: primary }],
|
|
1805
1938
|
testID: LAYOUT_TEST_IDS.upgradePromptCta,
|
|
1806
1939
|
onPress: handleUpgradePress,
|
|
1807
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1940
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
|
|
1808
1941
|
}
|
|
1809
1942
|
),
|
|
1810
1943
|
onDismiss ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1813,10 +1946,10 @@ var UpgradePrompt = ({
|
|
|
1813
1946
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
|
|
1814
1947
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
|
|
1815
1948
|
accessibilityRole: "button",
|
|
1816
|
-
style:
|
|
1949
|
+
style: styles16.dismiss,
|
|
1817
1950
|
testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
|
|
1818
1951
|
onPress: onDismiss,
|
|
1819
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
1952
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles16.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
|
|
1820
1953
|
}
|
|
1821
1954
|
) : null
|
|
1822
1955
|
]
|
|
@@ -1825,7 +1958,7 @@ var UpgradePrompt = ({
|
|
|
1825
1958
|
};
|
|
1826
1959
|
var CLOSE_ICON_SIZE = 18;
|
|
1827
1960
|
var PANEL_ENTER_SCALE2 = 0.96;
|
|
1828
|
-
var
|
|
1961
|
+
var styles17 = reactNative.StyleSheet.create({
|
|
1829
1962
|
animatedFill: { flex: 1 },
|
|
1830
1963
|
container: {
|
|
1831
1964
|
flex: 1,
|
|
@@ -1854,8 +1987,8 @@ var ModalShell = ({
|
|
|
1854
1987
|
}) => {
|
|
1855
1988
|
const { theme, t } = uiFeedback.useUi();
|
|
1856
1989
|
const { style: sheetStyle, mounted } = uiMotion.useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE2 });
|
|
1857
|
-
const containerStyle =
|
|
1858
|
-
() => [
|
|
1990
|
+
const containerStyle = React16__default.default.useMemo(
|
|
1991
|
+
() => [styles17.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
1859
1992
|
[theme.colors.background, contentStyle]
|
|
1860
1993
|
);
|
|
1861
1994
|
const closeA11yLabel = t(LAYOUT_I18N.close);
|
|
@@ -1867,7 +2000,7 @@ var ModalShell = ({
|
|
|
1867
2000
|
testID: LAYOUT_TEST_IDS.modalShell,
|
|
1868
2001
|
visible: mounted,
|
|
1869
2002
|
onRequestClose: onCancel,
|
|
1870
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [
|
|
2003
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles17.animatedFill, sheetStyle], children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1871
2004
|
reactNative.ScrollView,
|
|
1872
2005
|
{
|
|
1873
2006
|
accessibilityViewIsModal: true,
|
|
@@ -1875,7 +2008,7 @@ var ModalShell = ({
|
|
|
1875
2008
|
role: "dialog",
|
|
1876
2009
|
style: containerStyle,
|
|
1877
2010
|
children: [
|
|
1878
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2011
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles17.headerRow, children: [
|
|
1879
2012
|
/* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
|
|
1880
2013
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1881
2014
|
reactNative.TouchableOpacity,
|
|
@@ -1883,7 +2016,7 @@ var ModalShell = ({
|
|
|
1883
2016
|
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
1884
2017
|
accessibilityLabel: closeA11yLabel,
|
|
1885
2018
|
accessibilityRole: "button",
|
|
1886
|
-
style:
|
|
2019
|
+
style: styles17.closeButton,
|
|
1887
2020
|
testID: LAYOUT_TEST_IDS.modalShellClose,
|
|
1888
2021
|
onPress: onCancel,
|
|
1889
2022
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
|
|
@@ -1900,7 +2033,7 @@ var ModalShell = ({
|
|
|
1900
2033
|
var SHEET_WIDTH = 560;
|
|
1901
2034
|
var PHONE_CORNER = 16;
|
|
1902
2035
|
var PHONE_ENTER_OFFSET = 24;
|
|
1903
|
-
var
|
|
2036
|
+
var styles18 = reactNative.StyleSheet.create({
|
|
1904
2037
|
root: { flex: 1 },
|
|
1905
2038
|
scrim: { backgroundColor: uiFeedback.MODAL_OVERLAY_COLOR, pointerEvents: "none" },
|
|
1906
2039
|
sheet: { position: "absolute", bottom: 0, overflow: "hidden" },
|
|
@@ -1929,7 +2062,7 @@ var SideSheet = ({
|
|
|
1929
2062
|
}) => {
|
|
1930
2063
|
const { theme, t } = uiFeedback.useUi();
|
|
1931
2064
|
const isWide = useIsWideViewport();
|
|
1932
|
-
const sheetRef =
|
|
2065
|
+
const sheetRef = React16.useRef(null);
|
|
1933
2066
|
const backdrop = uiMotion.useEnterExit({ visible });
|
|
1934
2067
|
const panel = uiMotion.useEnterExit({ visible, translateY: isWide ? 0 : PHONE_ENTER_OFFSET });
|
|
1935
2068
|
const edges = { borderColor: theme.colors.border };
|
|
@@ -1937,8 +2070,8 @@ var SideSheet = ({
|
|
|
1937
2070
|
useEscapeKey(visible, onClose);
|
|
1938
2071
|
useScrollLock(visible);
|
|
1939
2072
|
const hardwareBackClose = reactNative.Platform.OS === "web" ? void 0 : onClose;
|
|
1940
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: panel.mounted || backdrop.mounted, onRequestClose: hardwareBackClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
1941
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [reactNative.StyleSheet.absoluteFill,
|
|
2073
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: panel.mounted || backdrop.mounted, onRequestClose: hardwareBackClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles18.root, children: [
|
|
2074
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [reactNative.StyleSheet.absoluteFill, styles18.scrim, { opacity: backdrop.style.opacity }] }),
|
|
1942
2075
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1943
2076
|
reactNative.Pressable,
|
|
1944
2077
|
{
|
|
@@ -1959,17 +2092,17 @@ var SideSheet = ({
|
|
|
1959
2092
|
"aria-label": accessibilityLabel ?? title,
|
|
1960
2093
|
role: "dialog",
|
|
1961
2094
|
style: [
|
|
1962
|
-
|
|
1963
|
-
isWide ?
|
|
2095
|
+
styles18.sheet,
|
|
2096
|
+
isWide ? styles18.wide : styles18.phone,
|
|
1964
2097
|
edges,
|
|
1965
2098
|
{ backgroundColor: theme.colors.surface },
|
|
1966
2099
|
panel.style
|
|
1967
2100
|
],
|
|
1968
2101
|
testID,
|
|
1969
2102
|
children: [
|
|
1970
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
1971
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { contentContainerStyle:
|
|
1972
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [
|
|
2103
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles18.title, children: /* @__PURE__ */ jsxRuntime.jsx(AppText, { kind: "title" /* Title */, children: title }) }),
|
|
2104
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { contentContainerStyle: styles18.content, style: styles18.scroll, children }),
|
|
2105
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles18.bar, edges], children: footer })
|
|
1973
2106
|
]
|
|
1974
2107
|
}
|
|
1975
2108
|
)
|
|
@@ -1981,7 +2114,7 @@ var WIDE_MAX_WIDTH = 560;
|
|
|
1981
2114
|
var TOP_CORNER = 16;
|
|
1982
2115
|
var ENTER_OFFSET = 24;
|
|
1983
2116
|
var CLOSE_ICON_SIZE2 = 18;
|
|
1984
|
-
var
|
|
2117
|
+
var styles19 = reactNative.StyleSheet.create({
|
|
1985
2118
|
root: { flex: 1 },
|
|
1986
2119
|
backdrop: { backgroundColor: uiFeedback.MODAL_OVERLAY_COLOR, pointerEvents: "none" },
|
|
1987
2120
|
panel: {
|
|
@@ -2014,7 +2147,7 @@ var BottomSheet = ({
|
|
|
2014
2147
|
}) => {
|
|
2015
2148
|
const { theme, t } = uiFeedback.useUi();
|
|
2016
2149
|
const isWide = useIsWideViewport();
|
|
2017
|
-
const panelRef =
|
|
2150
|
+
const panelRef = React16.useRef(null);
|
|
2018
2151
|
const backdrop = uiMotion.useEnterExit({ visible });
|
|
2019
2152
|
const panel = uiMotion.useEnterExit({ visible, translateY: ENTER_OFFSET });
|
|
2020
2153
|
const hasFooter = footer !== void 0 && footer !== null;
|
|
@@ -2023,8 +2156,8 @@ var BottomSheet = ({
|
|
|
2023
2156
|
useEscapeKey(visible, onClose);
|
|
2024
2157
|
useScrollLock(visible);
|
|
2025
2158
|
const hardwareBackClose = reactNative.Platform.OS === "web" ? void 0 : onClose;
|
|
2026
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: panel.mounted || backdrop.mounted, onRequestClose: hardwareBackClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2027
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [reactNative.StyleSheet.absoluteFill,
|
|
2159
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Modal, { transparent: true, visible: panel.mounted || backdrop.mounted, onRequestClose: hardwareBackClose, children: /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles19.root, children: [
|
|
2160
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [reactNative.StyleSheet.absoluteFill, styles19.backdrop, { opacity: backdrop.style.opacity }] }),
|
|
2028
2161
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2029
2162
|
reactNative.Pressable,
|
|
2030
2163
|
{
|
|
@@ -2045,31 +2178,31 @@ var BottomSheet = ({
|
|
|
2045
2178
|
"aria-label": accessibilityLabel ?? title,
|
|
2046
2179
|
role: "dialog",
|
|
2047
2180
|
style: [
|
|
2048
|
-
|
|
2049
|
-
isWide ?
|
|
2181
|
+
styles19.panel,
|
|
2182
|
+
isWide ? styles19.wide : null,
|
|
2050
2183
|
panelSize,
|
|
2051
2184
|
{ backgroundColor: theme.colors.surface },
|
|
2052
2185
|
panel.style
|
|
2053
2186
|
],
|
|
2054
2187
|
testID,
|
|
2055
2188
|
children: [
|
|
2056
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2057
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2189
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles19.header, children: [
|
|
2190
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles19.title, children: /* @__PURE__ */ jsxRuntime.jsx(AppText, { kind: "title" /* Title */, children: title }) }),
|
|
2058
2191
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2059
2192
|
reactNative.TouchableOpacity,
|
|
2060
2193
|
{
|
|
2061
2194
|
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
2062
2195
|
accessibilityLabel: t(LAYOUT_I18N.dialogClose),
|
|
2063
2196
|
accessibilityRole: "button",
|
|
2064
|
-
style:
|
|
2197
|
+
style: styles19.close,
|
|
2065
2198
|
testID: `${testID}-close`,
|
|
2066
2199
|
onPress: onClose,
|
|
2067
2200
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE2 })
|
|
2068
2201
|
}
|
|
2069
2202
|
)
|
|
2070
2203
|
] }),
|
|
2071
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { contentContainerStyle:
|
|
2072
|
-
hasFooter ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [
|
|
2204
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { contentContainerStyle: styles19.content, style: styles19.body, children }),
|
|
2205
|
+
hasFooter ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles19.footer, { borderColor: theme.colors.border }], testID: `${testID}-footer`, children: footer }) : null
|
|
2073
2206
|
]
|
|
2074
2207
|
}
|
|
2075
2208
|
)
|
|
@@ -2085,7 +2218,7 @@ var ConfirmDialogFocus = /* @__PURE__ */ ((ConfirmDialogFocus2) => {
|
|
|
2085
2218
|
})(ConfirmDialogFocus || {});
|
|
2086
2219
|
var MESSAGE_FONT_SIZE2 = 14;
|
|
2087
2220
|
var MESSAGE_LINE_HEIGHT = 20;
|
|
2088
|
-
var
|
|
2221
|
+
var styles20 = reactNative.StyleSheet.create({
|
|
2089
2222
|
message: { fontSize: MESSAGE_FONT_SIZE2, lineHeight: MESSAGE_LINE_HEIGHT }
|
|
2090
2223
|
});
|
|
2091
2224
|
var ConfirmDialog = ({
|
|
@@ -2099,14 +2232,16 @@ var ConfirmDialog = ({
|
|
|
2099
2232
|
onCancel,
|
|
2100
2233
|
busy = false,
|
|
2101
2234
|
initialFocus = "cancel" /* Cancel */,
|
|
2102
|
-
testID = LAYOUT_TEST_IDS.confirmDialog
|
|
2235
|
+
testID = LAYOUT_TEST_IDS.confirmDialog,
|
|
2236
|
+
confirmTestID = `${testID}-confirm`,
|
|
2237
|
+
cancelTestID = `${testID}-cancel`
|
|
2103
2238
|
}) => {
|
|
2104
2239
|
const { theme, t } = uiFeedback.useUi();
|
|
2105
2240
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
2106
2241
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
2107
2242
|
const focusTestID = {
|
|
2108
|
-
["cancel" /* Cancel */]:
|
|
2109
|
-
["confirm" /* Confirm */]:
|
|
2243
|
+
["cancel" /* Cancel */]: cancelTestID,
|
|
2244
|
+
["confirm" /* Confirm */]: confirmTestID,
|
|
2110
2245
|
["none" /* None */]: testID
|
|
2111
2246
|
};
|
|
2112
2247
|
const footer = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -2117,7 +2252,7 @@ var ConfirmDialog = ({
|
|
|
2117
2252
|
accessibilityLabel: resolvedCancel,
|
|
2118
2253
|
disabled: busy,
|
|
2119
2254
|
label: resolvedCancel,
|
|
2120
|
-
testID:
|
|
2255
|
+
testID: cancelTestID,
|
|
2121
2256
|
variant: "secondary",
|
|
2122
2257
|
onPress: onCancel
|
|
2123
2258
|
}
|
|
@@ -2129,7 +2264,7 @@ var ConfirmDialog = ({
|
|
|
2129
2264
|
accessibilityLabel: resolvedConfirm,
|
|
2130
2265
|
label: resolvedConfirm,
|
|
2131
2266
|
loading: busy,
|
|
2132
|
-
testID:
|
|
2267
|
+
testID: confirmTestID,
|
|
2133
2268
|
variant: destructive ? "danger" : "primary",
|
|
2134
2269
|
onPress: onConfirm
|
|
2135
2270
|
}
|
|
@@ -2146,19 +2281,19 @@ var ConfirmDialog = ({
|
|
|
2146
2281
|
title,
|
|
2147
2282
|
visible,
|
|
2148
2283
|
onClose: onCancel,
|
|
2149
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2284
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles20.message, { color: theme.colors.text }], testID: `${testID}-message`, children: message })
|
|
2150
2285
|
}
|
|
2151
2286
|
);
|
|
2152
2287
|
};
|
|
2153
2288
|
var FIELD_SELECTOR = "input:not([disabled]), textarea:not([disabled]), select:not([disabled])";
|
|
2154
2289
|
var FORM_STYLE = { display: "contents" };
|
|
2155
2290
|
var WebFormBody = ({ children, visible, onSubmit }) => {
|
|
2156
|
-
const formRef =
|
|
2157
|
-
|
|
2291
|
+
const formRef = React16.useRef(null);
|
|
2292
|
+
React16.useEffect(() => {
|
|
2158
2293
|
if (reactNative.Platform.OS !== "web" || !visible) return;
|
|
2159
2294
|
formRef.current?.querySelector(FIELD_SELECTOR)?.focus();
|
|
2160
2295
|
}, [visible]);
|
|
2161
|
-
const handleSubmit =
|
|
2296
|
+
const handleSubmit = React16.useCallback(
|
|
2162
2297
|
(event) => {
|
|
2163
2298
|
event.preventDefault();
|
|
2164
2299
|
onSubmit();
|
|
@@ -2166,11 +2301,11 @@ var WebFormBody = ({ children, visible, onSubmit }) => {
|
|
|
2166
2301
|
[onSubmit]
|
|
2167
2302
|
);
|
|
2168
2303
|
if (reactNative.Platform.OS !== "web") return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
2169
|
-
return
|
|
2304
|
+
return React16__default.default.createElement(
|
|
2170
2305
|
"form",
|
|
2171
2306
|
{ ref: formRef, noValidate: true, style: FORM_STYLE, onSubmit: handleSubmit },
|
|
2172
2307
|
children,
|
|
2173
|
-
|
|
2308
|
+
React16__default.default.createElement("button", { type: "submit", hidden: true, tabIndex: -1, "aria-hidden": true })
|
|
2174
2309
|
);
|
|
2175
2310
|
};
|
|
2176
2311
|
var FormDialogActions = (props) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -2213,7 +2348,7 @@ var FormDialog = ({
|
|
|
2213
2348
|
testID = LAYOUT_TEST_IDS.formDialog
|
|
2214
2349
|
}) => {
|
|
2215
2350
|
const { t } = uiFeedback.useUi();
|
|
2216
|
-
const submit =
|
|
2351
|
+
const submit = React16.useCallback(() => {
|
|
2217
2352
|
if (!loading) onSubmit();
|
|
2218
2353
|
}, [loading, onSubmit]);
|
|
2219
2354
|
const footer = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2231,23 +2366,23 @@ var FormDialog = ({
|
|
|
2231
2366
|
);
|
|
2232
2367
|
return /* @__PURE__ */ jsxRuntime.jsx(Modal, { footer, size, testID: `${testID}-dialog`, title, visible, onClose: onCancel, children: /* @__PURE__ */ jsxRuntime.jsx(WebFormBody, { visible, onSubmit: submit, children }) });
|
|
2233
2368
|
};
|
|
2234
|
-
var AccordionContext =
|
|
2369
|
+
var AccordionContext = React16.createContext(null);
|
|
2235
2370
|
function useAccordionContext() {
|
|
2236
|
-
const value =
|
|
2371
|
+
const value = React16.useContext(AccordionContext);
|
|
2237
2372
|
if (value === null) {
|
|
2238
2373
|
throw new Error("AccordionItem must be rendered inside an <Accordion>.");
|
|
2239
2374
|
}
|
|
2240
2375
|
return value;
|
|
2241
2376
|
}
|
|
2242
2377
|
var BOXED_GAP = 12;
|
|
2243
|
-
var
|
|
2378
|
+
var styles21 = reactNative.StyleSheet.create({
|
|
2244
2379
|
container: { alignSelf: "stretch" },
|
|
2245
2380
|
boxed: { gap: BOXED_GAP }
|
|
2246
2381
|
});
|
|
2247
2382
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
2248
2383
|
const ids = new Set(defaultOpenIds ?? []);
|
|
2249
|
-
|
|
2250
|
-
if (!
|
|
2384
|
+
React16__default.default.Children.forEach(children, (child) => {
|
|
2385
|
+
if (!React16__default.default.isValidElement(child)) return;
|
|
2251
2386
|
const props = child.props;
|
|
2252
2387
|
if (props.defaultOpen === true && typeof props.id === "string") {
|
|
2253
2388
|
ids.add(props.id);
|
|
@@ -2270,14 +2405,14 @@ var Accordion = ({
|
|
|
2270
2405
|
style
|
|
2271
2406
|
}) => {
|
|
2272
2407
|
const isControlled = openIds !== void 0;
|
|
2273
|
-
const [internalOpen, setInternalOpen] =
|
|
2408
|
+
const [internalOpen, setInternalOpen] = React16.useState(
|
|
2274
2409
|
() => computeInitialOpen(children, defaultOpenIds, allowMultiple)
|
|
2275
2410
|
);
|
|
2276
|
-
const openSet =
|
|
2411
|
+
const openSet = React16.useMemo(
|
|
2277
2412
|
() => isControlled ? new Set(openIds) : internalOpen,
|
|
2278
2413
|
[isControlled, openIds, internalOpen]
|
|
2279
2414
|
);
|
|
2280
|
-
const toggle =
|
|
2415
|
+
const toggle = React16.useCallback(
|
|
2281
2416
|
(id) => {
|
|
2282
2417
|
const next = new Set(openSet);
|
|
2283
2418
|
const willOpen = !next.has(id);
|
|
@@ -2292,12 +2427,12 @@ var Accordion = ({
|
|
|
2292
2427
|
},
|
|
2293
2428
|
[allowMultiple, isControlled, onOpenChange, openSet]
|
|
2294
2429
|
);
|
|
2295
|
-
const contextValue =
|
|
2430
|
+
const contextValue = React16.useMemo(
|
|
2296
2431
|
() => ({ openIds: openSet, toggle, allowMultiple, variant }),
|
|
2297
2432
|
[openSet, toggle, allowMultiple, variant]
|
|
2298
2433
|
);
|
|
2299
|
-
const containerStyle =
|
|
2300
|
-
const base = variant === "boxed" ? [
|
|
2434
|
+
const containerStyle = React16.useMemo(() => {
|
|
2435
|
+
const base = variant === "boxed" ? [styles21.container, styles21.boxed] : [styles21.container];
|
|
2301
2436
|
if (style === void 0) return base;
|
|
2302
2437
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
2303
2438
|
}, [style, variant]);
|
|
@@ -2329,7 +2464,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
2329
2464
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
2330
2465
|
var BOX_MARKER_GAP = 6;
|
|
2331
2466
|
var BOX_MARKER = "\u25B8";
|
|
2332
|
-
var
|
|
2467
|
+
var styles22 = reactNative.StyleSheet.create({
|
|
2333
2468
|
item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
2334
2469
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
2335
2470
|
header: {
|
|
@@ -2375,9 +2510,9 @@ var AccordionItem = ({
|
|
|
2375
2510
|
const headerTestID = testID ?? `accordion-item-${id}`;
|
|
2376
2511
|
const bodyTestID = `${headerTestID}-body`;
|
|
2377
2512
|
const chevronTestID = `${headerTestID}-chevron`;
|
|
2378
|
-
const [rotation] =
|
|
2513
|
+
const [rotation] = React16.useState(() => new reactNative.Animated.Value(expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED));
|
|
2379
2514
|
const reducedMotion = rnWebHooks.useReducedMotion();
|
|
2380
|
-
|
|
2515
|
+
React16.useEffect(() => {
|
|
2381
2516
|
reactNative.Animated.timing(rotation, {
|
|
2382
2517
|
toValue: expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED,
|
|
2383
2518
|
duration: reducedMotion ? INSTANT_DURATION_MS : ROTATE_DURATION_MS,
|
|
@@ -2389,10 +2524,10 @@ var AccordionItem = ({
|
|
|
2389
2524
|
inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],
|
|
2390
2525
|
outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG]
|
|
2391
2526
|
});
|
|
2392
|
-
const handlePress =
|
|
2527
|
+
const handlePress = React16.useCallback(() => {
|
|
2393
2528
|
if (!disabled) toggle(id);
|
|
2394
2529
|
}, [disabled, id, toggle]);
|
|
2395
|
-
const handleKeyDown2 =
|
|
2530
|
+
const handleKeyDown2 = React16.useCallback(
|
|
2396
2531
|
(event) => {
|
|
2397
2532
|
if (disabled) return;
|
|
2398
2533
|
const key = event.key ?? "";
|
|
@@ -2404,20 +2539,20 @@ var AccordionItem = ({
|
|
|
2404
2539
|
[disabled, id, toggle]
|
|
2405
2540
|
);
|
|
2406
2541
|
const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
2407
|
-
const itemStyle =
|
|
2408
|
-
() => boxed ? [
|
|
2542
|
+
const itemStyle = React16.useMemo(
|
|
2543
|
+
() => boxed ? [styles22.boxItem, { borderColor: colors.border }] : [styles22.item, { borderTopColor: colors.border }],
|
|
2409
2544
|
[boxed, colors.border]
|
|
2410
2545
|
);
|
|
2411
|
-
const headerStyle =
|
|
2546
|
+
const headerStyle = React16.useMemo(
|
|
2412
2547
|
() => [
|
|
2413
|
-
|
|
2414
|
-
...boxed ? [
|
|
2548
|
+
styles22.header,
|
|
2549
|
+
...boxed ? [styles22.boxHeader] : [],
|
|
2415
2550
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
2416
2551
|
],
|
|
2417
2552
|
[boxed, disabled]
|
|
2418
2553
|
);
|
|
2419
2554
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
2420
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ?
|
|
2555
|
+
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ? styles22.boxTitle : styles22.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
|
|
2421
2556
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: itemStyle, children: [
|
|
2422
2557
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2423
2558
|
reactNative.Pressable,
|
|
@@ -2434,7 +2569,7 @@ var AccordionItem = ({
|
|
|
2434
2569
|
onPress: handlePress,
|
|
2435
2570
|
...keyboardProps,
|
|
2436
2571
|
children: [
|
|
2437
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2572
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles22.headerLeft, boxed ? styles22.headerLeftRow : null], children: [
|
|
2438
2573
|
boxed ? (
|
|
2439
2574
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
2440
2575
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2443,15 +2578,15 @@ var AccordionItem = ({
|
|
|
2443
2578
|
accessibilityElementsHidden: true,
|
|
2444
2579
|
"aria-hidden": true,
|
|
2445
2580
|
importantForAccessibility: "no-hide-descendants",
|
|
2446
|
-
style: [
|
|
2581
|
+
style: [styles22.marker, { transform: [{ rotate }] }],
|
|
2447
2582
|
testID: chevronTestID,
|
|
2448
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2583
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles22.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
2449
2584
|
}
|
|
2450
2585
|
)
|
|
2451
2586
|
) : null,
|
|
2452
2587
|
titleNode
|
|
2453
2588
|
] }),
|
|
2454
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2589
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles22.headerRight, children: [
|
|
2455
2590
|
right,
|
|
2456
2591
|
boxed ? null : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2457
2592
|
reactNative.Animated.View,
|
|
@@ -2459,7 +2594,7 @@ var AccordionItem = ({
|
|
|
2459
2594
|
accessibilityElementsHidden: true,
|
|
2460
2595
|
"aria-hidden": true,
|
|
2461
2596
|
importantForAccessibility: "no-hide-descendants",
|
|
2462
|
-
style: [
|
|
2597
|
+
style: [styles22.chevron, { transform: [{ rotate }] }],
|
|
2463
2598
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
2464
2599
|
}
|
|
2465
2600
|
)
|
|
@@ -2473,7 +2608,7 @@ var AccordionItem = ({
|
|
|
2473
2608
|
accessibilityLabel: resolvedLabel,
|
|
2474
2609
|
nativeID: bodyTestID,
|
|
2475
2610
|
role: ROLE_REGION,
|
|
2476
|
-
style: boxed ?
|
|
2611
|
+
style: boxed ? styles22.boxBody : styles22.body,
|
|
2477
2612
|
testID: bodyTestID,
|
|
2478
2613
|
children
|
|
2479
2614
|
}
|
|
@@ -2511,14 +2646,14 @@ function measureParentInnerWidth(node) {
|
|
|
2511
2646
|
return Math.max(UNMEASURED, parent.clientWidth - padding);
|
|
2512
2647
|
}
|
|
2513
2648
|
function useAvailableWidth() {
|
|
2514
|
-
const [width, setWidth] =
|
|
2515
|
-
const nodeRef =
|
|
2516
|
-
const measureRef =
|
|
2649
|
+
const [width, setWidth] = React16.useState(UNMEASURED);
|
|
2650
|
+
const nodeRef = React16.useRef(null);
|
|
2651
|
+
const measureRef = React16.useCallback((node) => {
|
|
2517
2652
|
if (!IS_WEB4) return;
|
|
2518
2653
|
nodeRef.current = node;
|
|
2519
2654
|
if (nodeRef.current !== null) setWidth(measureParentInnerWidth(nodeRef.current));
|
|
2520
2655
|
}, []);
|
|
2521
|
-
|
|
2656
|
+
React16.useEffect(() => {
|
|
2522
2657
|
if (!IS_WEB4) return void 0;
|
|
2523
2658
|
const remeasure = () => {
|
|
2524
2659
|
const node = nodeRef.current;
|
|
@@ -2527,7 +2662,7 @@ function useAvailableWidth() {
|
|
|
2527
2662
|
window.addEventListener("resize", remeasure);
|
|
2528
2663
|
return () => window.removeEventListener("resize", remeasure);
|
|
2529
2664
|
}, []);
|
|
2530
|
-
const onLayout =
|
|
2665
|
+
const onLayout = React16.useCallback((event) => {
|
|
2531
2666
|
if (IS_WEB4) return;
|
|
2532
2667
|
setWidth(event.nativeEvent.layout.width);
|
|
2533
2668
|
}, []);
|
|
@@ -2536,7 +2671,7 @@ function useAvailableWidth() {
|
|
|
2536
2671
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
2537
2672
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
2538
2673
|
var UNMEASURED2 = 0;
|
|
2539
|
-
var
|
|
2674
|
+
var styles23 = reactNative.StyleSheet.create({
|
|
2540
2675
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
2541
2676
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
2542
2677
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -2556,8 +2691,8 @@ var TruncatedText = ({
|
|
|
2556
2691
|
accessibilityHint
|
|
2557
2692
|
}) => {
|
|
2558
2693
|
const { width, measureRef, onLayout } = useAvailableWidth();
|
|
2559
|
-
const hostRef =
|
|
2560
|
-
const attachRef =
|
|
2694
|
+
const hostRef = React16.useRef(null);
|
|
2695
|
+
const attachRef = React16.useCallback(
|
|
2561
2696
|
(node) => {
|
|
2562
2697
|
hostRef.current = node;
|
|
2563
2698
|
measureRef(node);
|
|
@@ -2566,12 +2701,12 @@ var TruncatedText = ({
|
|
|
2566
2701
|
},
|
|
2567
2702
|
[value, measureRef]
|
|
2568
2703
|
);
|
|
2569
|
-
const flatStyle =
|
|
2570
|
-
() => reactNative.StyleSheet.flatten([
|
|
2704
|
+
const flatStyle = React16.useMemo(
|
|
2705
|
+
() => reactNative.StyleSheet.flatten([styles23.base, style]),
|
|
2571
2706
|
[style]
|
|
2572
2707
|
);
|
|
2573
2708
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
2574
|
-
const display =
|
|
2709
|
+
const display = React16.useMemo(() => {
|
|
2575
2710
|
const source = isUrl ? formatUrlForDisplay(value) : value;
|
|
2576
2711
|
const budget = charBudget(width, fontSize);
|
|
2577
2712
|
return budget === UNMEASURED2 ? source : truncateMiddle(source, budget);
|
|
@@ -2582,7 +2717,7 @@ var TruncatedText = ({
|
|
|
2582
2717
|
ref: attachRef,
|
|
2583
2718
|
onLayout,
|
|
2584
2719
|
numberOfLines: 1,
|
|
2585
|
-
style: [
|
|
2720
|
+
style: [styles23.base, styles23.fill, style],
|
|
2586
2721
|
testID,
|
|
2587
2722
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
2588
2723
|
accessibilityLabel,
|
|
@@ -2653,17 +2788,17 @@ async function copyText(value, writer) {
|
|
|
2653
2788
|
// src/CopyableId/useCopyToClipboard.ts
|
|
2654
2789
|
var COPY_FEEDBACK_MS = 2e3;
|
|
2655
2790
|
function useCopyToClipboard(value, writer) {
|
|
2656
|
-
const [status, setStatus] =
|
|
2657
|
-
const timerRef =
|
|
2658
|
-
const mountedRef =
|
|
2659
|
-
|
|
2791
|
+
const [status, setStatus] = React16.useState("idle" /* Idle */);
|
|
2792
|
+
const timerRef = React16.useRef(null);
|
|
2793
|
+
const mountedRef = React16.useRef(true);
|
|
2794
|
+
React16.useEffect(() => {
|
|
2660
2795
|
mountedRef.current = true;
|
|
2661
2796
|
return () => {
|
|
2662
2797
|
mountedRef.current = false;
|
|
2663
2798
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
2664
2799
|
};
|
|
2665
2800
|
}, []);
|
|
2666
|
-
const copy =
|
|
2801
|
+
const copy = React16.useCallback(() => {
|
|
2667
2802
|
void (async () => {
|
|
2668
2803
|
const ok = await copyText(value, writer);
|
|
2669
2804
|
if (!mountedRef.current) return;
|
|
@@ -2685,7 +2820,7 @@ var LABEL_LETTER_SPACING = 0.4;
|
|
|
2685
2820
|
var ACTION_PADDING_H = 6;
|
|
2686
2821
|
var ACTION_PADDING_V = 2;
|
|
2687
2822
|
var ACTION_RADIUS = 6;
|
|
2688
|
-
var
|
|
2823
|
+
var styles24 = reactNative.StyleSheet.create({
|
|
2689
2824
|
cell: { gap: CELL_GAP },
|
|
2690
2825
|
label: {
|
|
2691
2826
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -2727,7 +2862,7 @@ var styles22 = reactNative.StyleSheet.create({
|
|
|
2727
2862
|
var TONE_STEP = "500";
|
|
2728
2863
|
function useActionState(status) {
|
|
2729
2864
|
const { theme } = uiFeedback.useUi();
|
|
2730
|
-
return
|
|
2865
|
+
return React16.useMemo(() => {
|
|
2731
2866
|
const primary = theme.palette.primary[TONE_STEP];
|
|
2732
2867
|
if (status === "copied" /* Copied */) {
|
|
2733
2868
|
return { key: LAYOUT_I18N.copied, color: theme.semantic.success?.[TONE_STEP] ?? primary };
|
|
@@ -2750,14 +2885,14 @@ var CopyableId = ({
|
|
|
2750
2885
|
const { colors } = theme;
|
|
2751
2886
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
2752
2887
|
const action = useActionState(status);
|
|
2753
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [
|
|
2754
|
-
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
2755
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
2756
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
2888
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles24.cell, style], testID, children: [
|
|
2889
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles24.label, { color: colors.textSecondary }], children: label }),
|
|
2890
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles24.row, children: [
|
|
2891
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles24.valueWrap, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2757
2892
|
TruncatedText,
|
|
2758
2893
|
{
|
|
2759
2894
|
value,
|
|
2760
|
-
style: [
|
|
2895
|
+
style: [styles24.value, { color: colors.text }],
|
|
2761
2896
|
testID: `${testID}-value`,
|
|
2762
2897
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
2763
2898
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -2771,7 +2906,7 @@ var CopyableId = ({
|
|
|
2771
2906
|
accessibilityLabel: t(action.key),
|
|
2772
2907
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
2773
2908
|
testID: `${testID}-copy`,
|
|
2774
|
-
style: [
|
|
2909
|
+
style: [styles24.action, { color: action.color }],
|
|
2775
2910
|
children: t(action.key)
|
|
2776
2911
|
}
|
|
2777
2912
|
)
|
|
@@ -2796,15 +2931,15 @@ function formatBuildInfo(buildVersion, apiCommit) {
|
|
|
2796
2931
|
return `${base}${API_COMMIT_SEPARATOR}${shortenCommit(commit)}`;
|
|
2797
2932
|
}
|
|
2798
2933
|
function useApiCommit(apiBaseUrl, fetchImpl) {
|
|
2799
|
-
const [commit, setCommit] =
|
|
2800
|
-
const mountedRef =
|
|
2801
|
-
|
|
2934
|
+
const [commit, setCommit] = React16.useState(void 0);
|
|
2935
|
+
const mountedRef = React16.useRef(true);
|
|
2936
|
+
React16.useEffect(() => {
|
|
2802
2937
|
mountedRef.current = true;
|
|
2803
2938
|
return () => {
|
|
2804
2939
|
mountedRef.current = false;
|
|
2805
2940
|
};
|
|
2806
2941
|
}, []);
|
|
2807
|
-
|
|
2942
|
+
React16.useEffect(() => {
|
|
2808
2943
|
if (apiBaseUrl === void 0 || apiBaseUrl === "") return;
|
|
2809
2944
|
const doFetch = fetchImpl ?? (typeof fetch !== "undefined" ? fetch : void 0);
|
|
2810
2945
|
if (doFetch === void 0) return;
|
|
@@ -2826,7 +2961,7 @@ var FOOTER_PADDING_V = 6;
|
|
|
2826
2961
|
var FOOTER_PADDING_H = 12;
|
|
2827
2962
|
var FOOTER_FONT_SIZE = 11;
|
|
2828
2963
|
var FOOTER_OPACITY = 0.75;
|
|
2829
|
-
var
|
|
2964
|
+
var styles25 = reactNative.StyleSheet.create({
|
|
2830
2965
|
footer: {
|
|
2831
2966
|
paddingVertical: FOOTER_PADDING_V,
|
|
2832
2967
|
paddingHorizontal: FOOTER_PADDING_H,
|
|
@@ -2851,8 +2986,8 @@ var BuildInfoFooter = ({
|
|
|
2851
2986
|
const fetchedCommit = useApiCommit(apiCommit === void 0 ? apiBaseUrl : void 0, fetchImpl);
|
|
2852
2987
|
const commit = apiCommit ?? fetchedCommit;
|
|
2853
2988
|
const label = formatBuildInfo(buildVersion, commit);
|
|
2854
|
-
const textStyle =
|
|
2855
|
-
() => [
|
|
2989
|
+
const textStyle = React16.useMemo(
|
|
2990
|
+
() => [styles25.text, { color: theme.colors.textSecondary }],
|
|
2856
2991
|
[theme.colors.textSecondary]
|
|
2857
2992
|
);
|
|
2858
2993
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2860,7 +2995,7 @@ var BuildInfoFooter = ({
|
|
|
2860
2995
|
{
|
|
2861
2996
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
2862
2997
|
accessibilityHint: accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint),
|
|
2863
|
-
style: [
|
|
2998
|
+
style: [styles25.footer, style],
|
|
2864
2999
|
testID,
|
|
2865
3000
|
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: textStyle, children: label })
|
|
2866
3001
|
}
|
|
@@ -2871,7 +3006,7 @@ var BORDER = 2;
|
|
|
2871
3006
|
var GLYPH_SIZE = 14;
|
|
2872
3007
|
var GLYPH_LINE = 16;
|
|
2873
3008
|
var TICK = "\u2713";
|
|
2874
|
-
var
|
|
3009
|
+
var styles26 = reactNative.StyleSheet.create({
|
|
2875
3010
|
circle: {
|
|
2876
3011
|
width: SIZE,
|
|
2877
3012
|
height: SIZE,
|
|
@@ -2888,14 +3023,14 @@ var CheckMark = ({ filled, accent, ring, glyphColor, testID }) => /* @__PURE__ *
|
|
|
2888
3023
|
"aria-hidden": true,
|
|
2889
3024
|
accessibilityElementsHidden: true,
|
|
2890
3025
|
importantForAccessibility: "no-hide-descendants",
|
|
2891
|
-
style: [
|
|
3026
|
+
style: [styles26.circle, { borderColor: filled ? accent : ring, backgroundColor: filled ? accent : void 0 }],
|
|
2892
3027
|
testID,
|
|
2893
|
-
children: filled ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
3028
|
+
children: filled ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles26.glyph, { color: glyphColor }], children: TICK }) : null
|
|
2894
3029
|
}
|
|
2895
3030
|
);
|
|
2896
|
-
var ListRowToneContext =
|
|
3031
|
+
var ListRowToneContext = React16.createContext(null);
|
|
2897
3032
|
function useListRowTone() {
|
|
2898
|
-
return
|
|
3033
|
+
return React16.useContext(ListRowToneContext);
|
|
2899
3034
|
}
|
|
2900
3035
|
function useRowPalette() {
|
|
2901
3036
|
const { colors, palette, semantic } = uiFeedback.useUi().theme;
|
|
@@ -3013,7 +3148,7 @@ var PAD_V = 12;
|
|
|
3013
3148
|
var GAP = 4;
|
|
3014
3149
|
var MARK_GAP = 12;
|
|
3015
3150
|
var LINE_GAP = 8;
|
|
3016
|
-
var
|
|
3151
|
+
var styles27 = reactNative.StyleSheet.create({
|
|
3017
3152
|
row: {
|
|
3018
3153
|
flexDirection: "row",
|
|
3019
3154
|
alignItems: "center",
|
|
@@ -3037,7 +3172,7 @@ function focusTarget(event) {
|
|
|
3037
3172
|
}
|
|
3038
3173
|
function slot(node, color, strong) {
|
|
3039
3174
|
if (typeof node !== "string") return node;
|
|
3040
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
3175
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles27.shrink, strong ? styles27.strong : null, { color }], children: node });
|
|
3041
3176
|
}
|
|
3042
3177
|
var ListRow = ({
|
|
3043
3178
|
title,
|
|
@@ -3054,9 +3189,9 @@ var ListRow = ({
|
|
|
3054
3189
|
}) => {
|
|
3055
3190
|
const palette = useRowPalette();
|
|
3056
3191
|
const { colors } = uiFeedback.useUi().theme;
|
|
3057
|
-
const [focused, setFocused] =
|
|
3192
|
+
const [focused, setFocused] = React16.useState(false);
|
|
3058
3193
|
const rest = resolveRowLook(selectedStyle, { selected, hovered: false, pressed: false, focused }, palette);
|
|
3059
|
-
const tone =
|
|
3194
|
+
const tone = React16.useMemo(() => ({ textColor: rest.textColor, inverse: rest.inverse }), [rest.textColor, rest.inverse]);
|
|
3060
3195
|
const checkTestId = testID === void 0 ? void 0 : `${testID}-check`;
|
|
3061
3196
|
return /* @__PURE__ */ jsxRuntime.jsxs(ListRowToneContext.Provider, { value: tone, children: [
|
|
3062
3197
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3069,7 +3204,7 @@ var ListRow = ({
|
|
|
3069
3204
|
style: (state) => {
|
|
3070
3205
|
const { pressed, hovered } = state;
|
|
3071
3206
|
const look = resolveRowLook(selectedStyle, { selected, pressed, focused, hovered: hovered === true }, palette);
|
|
3072
|
-
return [
|
|
3207
|
+
return [styles27.row, { borderTopColor: colors.border }, look.container];
|
|
3073
3208
|
},
|
|
3074
3209
|
testID,
|
|
3075
3210
|
onBlur: () => {
|
|
@@ -3082,14 +3217,14 @@ var ListRow = ({
|
|
|
3082
3217
|
...pressedProps(selected),
|
|
3083
3218
|
children: [
|
|
3084
3219
|
rest.showCheck ? /* @__PURE__ */ jsxRuntime.jsx(CheckMark, { accent: palette.accent, filled: rest.checkFilled, glyphColor: palette.background, ring: palette.border, testID: checkTestId }) : null,
|
|
3085
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
3086
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
3220
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles27.body, children: [
|
|
3221
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles27.line, children: [
|
|
3087
3222
|
slot(title, rest.titleColor, true),
|
|
3088
3223
|
slot(trailing, rest.textColor, true)
|
|
3089
3224
|
] }),
|
|
3090
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
3091
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
3092
|
-
badges === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
3225
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles27.line, children: [
|
|
3226
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles27.shrink, children: slot(meta, rest.textColor, false) }),
|
|
3227
|
+
badges === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles27.badges, children: badges })
|
|
3093
3228
|
] })
|
|
3094
3229
|
] })
|
|
3095
3230
|
]
|
|
@@ -3105,6 +3240,7 @@ exports.Accordion = Accordion;
|
|
|
3105
3240
|
exports.AccordionItem = AccordionItem;
|
|
3106
3241
|
exports.AppText = AppText;
|
|
3107
3242
|
exports.BUILD_INFO_PREFIX = BUILD_INFO_PREFIX;
|
|
3243
|
+
exports.BadgeTone = BadgeTone;
|
|
3108
3244
|
exports.BottomSheet = BottomSheet;
|
|
3109
3245
|
exports.BuildInfoFooter = BuildInfoFooter;
|
|
3110
3246
|
exports.COPY_FEEDBACK_MS = COPY_FEEDBACK_MS;
|
|
@@ -3112,6 +3248,7 @@ exports.ConfirmDialog = ConfirmDialog;
|
|
|
3112
3248
|
exports.ConfirmDialogFocus = ConfirmDialogFocus;
|
|
3113
3249
|
exports.CopyStatus = CopyStatus;
|
|
3114
3250
|
exports.CopyableId = CopyableId;
|
|
3251
|
+
exports.CountBadge = CountBadge;
|
|
3115
3252
|
exports.DEFAULT_BILLING_ROUTE = DEFAULT_BILLING_ROUTE;
|
|
3116
3253
|
exports.DropdownVariant = DropdownVariant;
|
|
3117
3254
|
exports.ELLIPSIS = ELLIPSIS;
|
|
@@ -3135,6 +3272,8 @@ exports.SectionVariant = SectionVariant;
|
|
|
3135
3272
|
exports.SegmentedControl = SegmentedControl;
|
|
3136
3273
|
exports.SelectedMarker = SelectedMarker;
|
|
3137
3274
|
exports.SideSheet = SideSheet;
|
|
3275
|
+
exports.SplitLayout = SplitLayout;
|
|
3276
|
+
exports.SplitPanes = SplitPanes;
|
|
3138
3277
|
exports.StatusBadge = StatusBadge;
|
|
3139
3278
|
exports.StickyPreview = StickyPreview;
|
|
3140
3279
|
exports.TYPE_SCALE_BREAKPOINT = TYPE_SCALE_BREAKPOINT;
|
|
@@ -3145,12 +3284,15 @@ exports.TruncatedText = TruncatedText;
|
|
|
3145
3284
|
exports.UpgradePrompt = UpgradePrompt;
|
|
3146
3285
|
exports.copyText = copyText;
|
|
3147
3286
|
exports.formatBuildInfo = formatBuildInfo;
|
|
3287
|
+
exports.formatCount = formatCount;
|
|
3148
3288
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
3149
3289
|
exports.isKeyboardOpen = isKeyboardOpen;
|
|
3150
3290
|
exports.isModalFooterStacked = isModalFooterStacked;
|
|
3291
|
+
exports.isSplitSideBySide = isSplitSideBySide;
|
|
3151
3292
|
exports.isWideWebViewport = isWideWebViewport;
|
|
3152
3293
|
exports.pageScale = pageScale;
|
|
3153
3294
|
exports.resolveRowLook = resolveRowLook;
|
|
3295
|
+
exports.resolveToneColors = resolveToneColors;
|
|
3154
3296
|
exports.scaledFrame = scaledFrame;
|
|
3155
3297
|
exports.shortenCommit = shortenCommit;
|
|
3156
3298
|
exports.trimTrailingSlash = trimTrailingSlash;
|