@dloizides/ui-layout 1.16.1 → 1.17.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 +16 -1
- package/dist/index.d.mts +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +153 -54
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +154 -56
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React8, { createContext, useMemo, useRef, useEffect, useState, useCallback, useContext, useLayoutEffect } from 'react';
|
|
2
|
-
import { StyleSheet, Platform, View, Text, Pressable, TouchableOpacity, Modal, FlatList,
|
|
2
|
+
import { StyleSheet, Platform, View, Text, Pressable, ScrollView, TouchableOpacity, Modal, FlatList, Animated, Easing, useWindowDimensions, LayoutAnimation, UIManager } from 'react-native';
|
|
3
3
|
import { MODAL_OVERLAY_COLOR, useUi } from '@dloizides/ui-feedback';
|
|
4
4
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
5
|
import { useA11y } from '@dloizides/a11y';
|
|
@@ -225,6 +225,104 @@ function SegmentedControl({
|
|
|
225
225
|
}
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
|
+
var PILL_RADIUS = 999;
|
|
229
|
+
var PILL_PAD_H = 16;
|
|
230
|
+
var PILL_PAD_V = 8;
|
|
231
|
+
var PILL_MIN_HEIGHT = 40;
|
|
232
|
+
var PILL_FONT = 14;
|
|
233
|
+
var PILL_WEIGHT = "600";
|
|
234
|
+
var ROW_GAP = 8;
|
|
235
|
+
var COLUMN_GAP = 8;
|
|
236
|
+
var ROW_PAD_V = 8;
|
|
237
|
+
var PANEL_PAD_TOP = 16;
|
|
238
|
+
var BORDER_WIDTH2 = 1;
|
|
239
|
+
var TEXT_ON_PRIMARY = "#ffffff";
|
|
240
|
+
var styles5 = StyleSheet.create({
|
|
241
|
+
root: {
|
|
242
|
+
width: "100%"
|
|
243
|
+
},
|
|
244
|
+
strip: {
|
|
245
|
+
flexDirection: "row",
|
|
246
|
+
flexWrap: "wrap",
|
|
247
|
+
alignItems: "center",
|
|
248
|
+
columnGap: COLUMN_GAP,
|
|
249
|
+
rowGap: ROW_GAP,
|
|
250
|
+
paddingVertical: ROW_PAD_V,
|
|
251
|
+
borderBottomWidth: BORDER_WIDTH2
|
|
252
|
+
},
|
|
253
|
+
pill: {
|
|
254
|
+
paddingHorizontal: PILL_PAD_H,
|
|
255
|
+
paddingVertical: PILL_PAD_V,
|
|
256
|
+
borderRadius: PILL_RADIUS,
|
|
257
|
+
minHeight: PILL_MIN_HEIGHT,
|
|
258
|
+
flexDirection: "row",
|
|
259
|
+
alignItems: "center",
|
|
260
|
+
justifyContent: "center"
|
|
261
|
+
},
|
|
262
|
+
pillText: {
|
|
263
|
+
fontSize: PILL_FONT,
|
|
264
|
+
fontWeight: PILL_WEIGHT,
|
|
265
|
+
textAlign: "center"
|
|
266
|
+
},
|
|
267
|
+
panel: {
|
|
268
|
+
paddingTop: PANEL_PAD_TOP
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
function ariaTabProps(selected, panelId, tabId) {
|
|
272
|
+
return { "aria-selected": selected, "aria-controls": panelId, id: tabId };
|
|
273
|
+
}
|
|
274
|
+
var Tabs = ({
|
|
275
|
+
tabs,
|
|
276
|
+
activeKey,
|
|
277
|
+
onChange,
|
|
278
|
+
accessibilityLabel,
|
|
279
|
+
children,
|
|
280
|
+
idPrefix = "tabs",
|
|
281
|
+
style,
|
|
282
|
+
stripStyle,
|
|
283
|
+
panelStyle,
|
|
284
|
+
testID
|
|
285
|
+
}) => {
|
|
286
|
+
const { theme } = useUi();
|
|
287
|
+
const { colors } = theme;
|
|
288
|
+
const primaryColor = theme.palette.primary["500"];
|
|
289
|
+
const activePanelId = `${idPrefix}-panel-${activeKey}`;
|
|
290
|
+
const activeTabId = `${idPrefix}-tab-${activeKey}`;
|
|
291
|
+
const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
|
|
292
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles5.root, style], testID, children: [
|
|
293
|
+
/* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsx(
|
|
294
|
+
View,
|
|
295
|
+
{
|
|
296
|
+
accessibilityRole: "tablist",
|
|
297
|
+
"aria-label": accessibilityLabel,
|
|
298
|
+
style: [styles5.strip, { borderBottomColor: colors.border }, stripStyle],
|
|
299
|
+
children: tabs.map((tab) => {
|
|
300
|
+
const selected = tab.key === activeKey;
|
|
301
|
+
const textColor = selected ? TEXT_ON_PRIMARY : colors.textSecondary;
|
|
302
|
+
const pillColor = selected ? primaryColor : colors.surfaceElevated;
|
|
303
|
+
const tabId = `${idPrefix}-tab-${tab.key}`;
|
|
304
|
+
const panelId = `${idPrefix}-panel-${tab.key}`;
|
|
305
|
+
return /* @__PURE__ */ jsx(
|
|
306
|
+
Pressable,
|
|
307
|
+
{
|
|
308
|
+
accessibilityRole: "tab",
|
|
309
|
+
accessibilityState: { selected },
|
|
310
|
+
accessibilityLabel: tab.accessibilityLabel ?? tab.label,
|
|
311
|
+
accessibilityHint: tab.accessibilityHint,
|
|
312
|
+
onPress: () => onChange(tab.key),
|
|
313
|
+
style: [styles5.pill, { backgroundColor: pillColor }],
|
|
314
|
+
testID: tab.testID,
|
|
315
|
+
...ariaTabProps(selected, panelId, tabId),
|
|
316
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles5.pillText, { color: textColor }], children: tab.label })
|
|
317
|
+
},
|
|
318
|
+
tab.key
|
|
319
|
+
);
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
) }),
|
|
323
|
+
/* @__PURE__ */ jsx(View, { accessibilityRole: "none", style: [styles5.panel, panelStyle], ...panelAria, children })
|
|
324
|
+
] });
|
|
325
|
+
};
|
|
228
326
|
var PROMPT_PADDING = 20;
|
|
229
327
|
var PROMPT_BORDER_RADIUS = 12;
|
|
230
328
|
var PROMPT_BORDER_WIDTH = 1;
|
|
@@ -237,7 +335,7 @@ var DISMISS_FONT_SIZE = 13;
|
|
|
237
335
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
238
336
|
var MESSAGE_MARGIN_BOTTOM = 16;
|
|
239
337
|
var CTA_MARGIN_BOTTOM = 8;
|
|
240
|
-
var
|
|
338
|
+
var styles6 = StyleSheet.create({
|
|
241
339
|
container: {
|
|
242
340
|
padding: PROMPT_PADDING,
|
|
243
341
|
borderRadius: PROMPT_BORDER_RADIUS,
|
|
@@ -265,21 +363,21 @@ var UpgradePrompt = ({
|
|
|
265
363
|
return /* @__PURE__ */ jsxs(
|
|
266
364
|
View,
|
|
267
365
|
{
|
|
268
|
-
style: [
|
|
366
|
+
style: [styles6.container, { borderColor: primary, backgroundColor: colors.surface }],
|
|
269
367
|
testID: LAYOUT_TEST_IDS.upgradePrompt,
|
|
270
368
|
children: [
|
|
271
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
272
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
369
|
+
/* @__PURE__ */ jsx(Text, { style: [styles6.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
|
|
370
|
+
/* @__PURE__ */ jsx(Text, { style: [styles6.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
|
|
273
371
|
/* @__PURE__ */ jsx(
|
|
274
372
|
TouchableOpacity,
|
|
275
373
|
{
|
|
276
374
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
|
|
277
375
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
|
|
278
376
|
accessibilityRole: "button",
|
|
279
|
-
style: [
|
|
377
|
+
style: [styles6.cta, { backgroundColor: primary }],
|
|
280
378
|
testID: LAYOUT_TEST_IDS.upgradePromptCta,
|
|
281
379
|
onPress: handleUpgradePress,
|
|
282
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
380
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles6.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
|
|
283
381
|
}
|
|
284
382
|
),
|
|
285
383
|
onDismiss ? /* @__PURE__ */ jsx(
|
|
@@ -288,10 +386,10 @@ var UpgradePrompt = ({
|
|
|
288
386
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
|
|
289
387
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
|
|
290
388
|
accessibilityRole: "button",
|
|
291
|
-
style:
|
|
389
|
+
style: styles6.dismiss,
|
|
292
390
|
testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
|
|
293
391
|
onPress: onDismiss,
|
|
294
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
392
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles6.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
|
|
295
393
|
}
|
|
296
394
|
) : null
|
|
297
395
|
]
|
|
@@ -366,7 +464,7 @@ var MENU_ELEVATION = 8;
|
|
|
366
464
|
var MENU_TOP_GAP = 4;
|
|
367
465
|
var MENU_MAX_HEIGHT = 300;
|
|
368
466
|
var BORDER_RADIUS = 8;
|
|
369
|
-
var
|
|
467
|
+
var BORDER_WIDTH3 = 1;
|
|
370
468
|
var MENU_PADDING = 4;
|
|
371
469
|
var MENU_BOX_SHADOW = "0px 2px 8px rgba(0, 0, 0, 0.15)";
|
|
372
470
|
function buildPortalPopoverStyle(rect, minWidth = 0) {
|
|
@@ -378,7 +476,7 @@ function buildPortalPopoverStyle(rect, minWidth = 0) {
|
|
|
378
476
|
left: rect.left,
|
|
379
477
|
width: Math.max(rect.width, minWidth),
|
|
380
478
|
zIndex: MENU_Z_INDEX,
|
|
381
|
-
borderWidth:
|
|
479
|
+
borderWidth: BORDER_WIDTH3,
|
|
382
480
|
borderRadius: BORDER_RADIUS,
|
|
383
481
|
padding: MENU_PADDING,
|
|
384
482
|
maxHeight: MENU_MAX_HEIGHT,
|
|
@@ -403,7 +501,7 @@ var BODY_FONT_SIZE = 14;
|
|
|
403
501
|
var SELECTED_FONT_WEIGHT = "600";
|
|
404
502
|
var OPTION_PADDING_H = 16;
|
|
405
503
|
var OPTION_PADDING_V = 12;
|
|
406
|
-
var
|
|
504
|
+
var styles7 = StyleSheet.create({
|
|
407
505
|
option: {
|
|
408
506
|
paddingHorizontal: OPTION_PADDING_H,
|
|
409
507
|
paddingVertical: OPTION_PADDING_V,
|
|
@@ -425,8 +523,8 @@ var OptionRow = ({
|
|
|
425
523
|
onSelect();
|
|
426
524
|
}, [onSelect]);
|
|
427
525
|
const isActive = isSelected || isHighlighted;
|
|
428
|
-
const rowStyle = [
|
|
429
|
-
const textStyle = [
|
|
526
|
+
const rowStyle = [styles7.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];
|
|
527
|
+
const textStyle = [styles7.optionText, { color: colors.text }, isSelected ? styles7.selectedText : null];
|
|
430
528
|
return /* @__PURE__ */ jsx(
|
|
431
529
|
TouchableOpacity,
|
|
432
530
|
{
|
|
@@ -589,9 +687,9 @@ function useMenuKeyboard(params) {
|
|
|
589
687
|
}
|
|
590
688
|
var IS_WEB2 = Platform.OS === "web";
|
|
591
689
|
var BORDER_RADIUS2 = 8;
|
|
592
|
-
var
|
|
690
|
+
var BORDER_WIDTH4 = 1;
|
|
593
691
|
var MENU_PADDING2 = 4;
|
|
594
|
-
var
|
|
692
|
+
var styles8 = StyleSheet.create({
|
|
595
693
|
/** Native (in-tree) popover — anchored absolutely just under the trigger. */
|
|
596
694
|
popover: {
|
|
597
695
|
position: "absolute",
|
|
@@ -600,7 +698,7 @@ var styles7 = StyleSheet.create({
|
|
|
600
698
|
right: 0,
|
|
601
699
|
marginTop: MENU_TOP_GAP,
|
|
602
700
|
zIndex: MENU_Z_INDEX,
|
|
603
|
-
borderWidth:
|
|
701
|
+
borderWidth: BORDER_WIDTH4,
|
|
604
702
|
borderRadius: BORDER_RADIUS2,
|
|
605
703
|
padding: MENU_PADDING2,
|
|
606
704
|
maxHeight: MENU_MAX_HEIGHT,
|
|
@@ -657,7 +755,7 @@ var InlineMenu = ({
|
|
|
657
755
|
buildPortalPopoverStyle(rect ?? { left: 0, width: 0, bottom: 0 }, menuMinWidth),
|
|
658
756
|
themed
|
|
659
757
|
];
|
|
660
|
-
return [
|
|
758
|
+
return [styles8.popover, { minWidth: menuMinWidth }, themed];
|
|
661
759
|
}, [colors.border, colors.surface, menuMinWidth, rect]);
|
|
662
760
|
const menu = /* @__PURE__ */ jsx(
|
|
663
761
|
View,
|
|
@@ -695,17 +793,17 @@ function useResolvedDropdownVariant(explicit) {
|
|
|
695
793
|
return resolveDropdownVariant(explicit, width, Platform.OS);
|
|
696
794
|
}
|
|
697
795
|
var BORDER_RADIUS3 = 8;
|
|
698
|
-
var
|
|
796
|
+
var BORDER_WIDTH5 = 1;
|
|
699
797
|
var BODY_FONT_SIZE2 = 14;
|
|
700
798
|
var MODAL_PADDING = 8;
|
|
701
799
|
var MODAL_MIN_WIDTH = 200;
|
|
702
800
|
var MODAL_MAX_HEIGHT = 300;
|
|
703
801
|
var CONTAINER_PADDING_H = 12;
|
|
704
802
|
var CONTAINER_PADDING_V = 10;
|
|
705
|
-
var
|
|
803
|
+
var styles9 = StyleSheet.create({
|
|
706
804
|
anchor: { position: "relative" },
|
|
707
805
|
container: {
|
|
708
|
-
borderWidth:
|
|
806
|
+
borderWidth: BORDER_WIDTH5,
|
|
709
807
|
borderRadius: BORDER_RADIUS3,
|
|
710
808
|
paddingHorizontal: CONTAINER_PADDING_H,
|
|
711
809
|
paddingVertical: CONTAINER_PADDING_V
|
|
@@ -769,7 +867,7 @@ var ModalDropdown = ({
|
|
|
769
867
|
[onChange]
|
|
770
868
|
);
|
|
771
869
|
const containerStyle = useMemo(
|
|
772
|
-
() => renderTrigger !== void 0 ? void 0 : [
|
|
870
|
+
() => renderTrigger !== void 0 ? void 0 : [styles9.container, { borderColor: colors.border, backgroundColor: colors.surface }],
|
|
773
871
|
[colors.border, colors.surface, renderTrigger]
|
|
774
872
|
);
|
|
775
873
|
const optionTestIDFor = useCallback(
|
|
@@ -777,11 +875,11 @@ var ModalDropdown = ({
|
|
|
777
875
|
[optionTestID, testID]
|
|
778
876
|
);
|
|
779
877
|
const anchorStyle = useMemo(
|
|
780
|
-
() => [
|
|
878
|
+
() => [styles9.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
781
879
|
[isMenu, isOpen]
|
|
782
880
|
);
|
|
783
881
|
const modalContentStyle = useMemo(
|
|
784
|
-
() => [
|
|
882
|
+
() => [styles9.modalContent, { backgroundColor: colors.surface }],
|
|
785
883
|
[colors.surface]
|
|
786
884
|
);
|
|
787
885
|
const renderModalOption = useCallback(
|
|
@@ -799,7 +897,7 @@ var ModalDropdown = ({
|
|
|
799
897
|
const keyExtractor = useCallback((item) => String(item.value), []);
|
|
800
898
|
return /* @__PURE__ */ jsxs(View, { ref: anchorRef, style: anchorStyle, children: [
|
|
801
899
|
/* @__PURE__ */ jsxs(TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
|
|
802
|
-
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : /* @__PURE__ */ jsx(Text, { style: [
|
|
900
|
+
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : /* @__PURE__ */ jsx(Text, { style: [styles9.selectedText, { color: colors.text }], children: selectedLabel }),
|
|
803
901
|
hintNode
|
|
804
902
|
] }),
|
|
805
903
|
isMenu && isOpen ? /* @__PURE__ */ jsx(
|
|
@@ -816,7 +914,7 @@ var ModalDropdown = ({
|
|
|
816
914
|
onSelect: handleSelect
|
|
817
915
|
}
|
|
818
916
|
) : null,
|
|
819
|
-
!isMenu ? /* @__PURE__ */ jsx(Modal, { transparent: true, animationType: "fade", visible: isOpen, onRequestClose: handleClose, children: /* @__PURE__ */ jsxs(View, { style:
|
|
917
|
+
!isMenu ? /* @__PURE__ */ jsx(Modal, { transparent: true, animationType: "fade", visible: isOpen, onRequestClose: handleClose, children: /* @__PURE__ */ jsxs(View, { style: styles9.modalOverlay, children: [
|
|
820
918
|
/* @__PURE__ */ jsx(
|
|
821
919
|
TouchableOpacity,
|
|
822
920
|
{
|
|
@@ -845,7 +943,7 @@ var ModalDropdown = ({
|
|
|
845
943
|
] });
|
|
846
944
|
};
|
|
847
945
|
var CLOSE_ICON_SIZE = 18;
|
|
848
|
-
var
|
|
946
|
+
var styles10 = StyleSheet.create({
|
|
849
947
|
container: {
|
|
850
948
|
flex: 1,
|
|
851
949
|
padding: 16
|
|
@@ -870,7 +968,7 @@ var ModalShell = ({
|
|
|
870
968
|
}) => {
|
|
871
969
|
const { theme, t } = useUi();
|
|
872
970
|
const containerStyle = React8.useMemo(
|
|
873
|
-
() => [
|
|
971
|
+
() => [styles10.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
874
972
|
[theme.colors.background, contentStyle]
|
|
875
973
|
);
|
|
876
974
|
const closeA11yLabel = t(LAYOUT_I18N.close);
|
|
@@ -890,7 +988,7 @@ var ModalShell = ({
|
|
|
890
988
|
role: "dialog",
|
|
891
989
|
style: containerStyle,
|
|
892
990
|
children: [
|
|
893
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
991
|
+
/* @__PURE__ */ jsxs(View, { style: styles10.headerRow, children: [
|
|
894
992
|
/* @__PURE__ */ jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
|
|
895
993
|
showClose ? /* @__PURE__ */ jsx(
|
|
896
994
|
TouchableOpacity,
|
|
@@ -898,7 +996,7 @@ var ModalShell = ({
|
|
|
898
996
|
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
899
997
|
accessibilityLabel: closeA11yLabel,
|
|
900
998
|
accessibilityRole: "button",
|
|
901
|
-
style:
|
|
999
|
+
style: styles10.closeButton,
|
|
902
1000
|
testID: LAYOUT_TEST_IDS.modalShellClose,
|
|
903
1001
|
onPress: onCancel,
|
|
904
1002
|
children: /* @__PURE__ */ jsx(SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
|
|
@@ -941,7 +1039,7 @@ function animateNextLayout() {
|
|
|
941
1039
|
}
|
|
942
1040
|
}
|
|
943
1041
|
var BOXED_GAP = 12;
|
|
944
|
-
var
|
|
1042
|
+
var styles11 = StyleSheet.create({
|
|
945
1043
|
container: { alignSelf: "stretch" },
|
|
946
1044
|
boxed: { gap: BOXED_GAP }
|
|
947
1045
|
});
|
|
@@ -999,7 +1097,7 @@ var Accordion = ({
|
|
|
999
1097
|
[openSet, toggle, allowMultiple, variant]
|
|
1000
1098
|
);
|
|
1001
1099
|
const containerStyle = useMemo(() => {
|
|
1002
|
-
const base = variant === "boxed" ? [
|
|
1100
|
+
const base = variant === "boxed" ? [styles11.container, styles11.boxed] : [styles11.container];
|
|
1003
1101
|
if (style === void 0) return base;
|
|
1004
1102
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1005
1103
|
}, [style, variant]);
|
|
@@ -1031,7 +1129,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1031
1129
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1032
1130
|
var BOX_MARKER_GAP = 6;
|
|
1033
1131
|
var BOX_MARKER = "\u25B8";
|
|
1034
|
-
var
|
|
1132
|
+
var styles12 = StyleSheet.create({
|
|
1035
1133
|
item: { borderTopWidth: StyleSheet.hairlineWidth },
|
|
1036
1134
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1037
1135
|
header: {
|
|
@@ -1105,19 +1203,19 @@ var AccordionItem = ({
|
|
|
1105
1203
|
);
|
|
1106
1204
|
const keyboardProps = Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1107
1205
|
const itemStyle = useMemo(
|
|
1108
|
-
() => boxed ? [
|
|
1206
|
+
() => boxed ? [styles12.boxItem, { borderColor: colors.border }] : [styles12.item, { borderTopColor: colors.border }],
|
|
1109
1207
|
[boxed, colors.border]
|
|
1110
1208
|
);
|
|
1111
1209
|
const headerStyle = useMemo(
|
|
1112
1210
|
() => [
|
|
1113
|
-
|
|
1114
|
-
...boxed ? [
|
|
1211
|
+
styles12.header,
|
|
1212
|
+
...boxed ? [styles12.boxHeader] : [],
|
|
1115
1213
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1116
1214
|
],
|
|
1117
1215
|
[boxed, disabled]
|
|
1118
1216
|
);
|
|
1119
1217
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1120
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ?
|
|
1218
|
+
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ? styles12.boxTitle : styles12.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
|
|
1121
1219
|
return /* @__PURE__ */ jsxs(View, { style: itemStyle, children: [
|
|
1122
1220
|
/* @__PURE__ */ jsxs(
|
|
1123
1221
|
Pressable,
|
|
@@ -1134,7 +1232,7 @@ var AccordionItem = ({
|
|
|
1134
1232
|
onPress: handlePress,
|
|
1135
1233
|
...keyboardProps,
|
|
1136
1234
|
children: [
|
|
1137
|
-
/* @__PURE__ */ jsxs(View, { style: [
|
|
1235
|
+
/* @__PURE__ */ jsxs(View, { style: [styles12.headerLeft, boxed ? styles12.headerLeftRow : null], children: [
|
|
1138
1236
|
boxed ? (
|
|
1139
1237
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1140
1238
|
/* @__PURE__ */ jsx(
|
|
@@ -1143,15 +1241,15 @@ var AccordionItem = ({
|
|
|
1143
1241
|
accessibilityElementsHidden: true,
|
|
1144
1242
|
"aria-hidden": true,
|
|
1145
1243
|
importantForAccessibility: "no-hide-descendants",
|
|
1146
|
-
style: [
|
|
1244
|
+
style: [styles12.marker, { transform: [{ rotate }] }],
|
|
1147
1245
|
testID: chevronTestID,
|
|
1148
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1246
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles12.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1149
1247
|
}
|
|
1150
1248
|
)
|
|
1151
1249
|
) : null,
|
|
1152
1250
|
titleNode
|
|
1153
1251
|
] }),
|
|
1154
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1252
|
+
/* @__PURE__ */ jsxs(View, { style: styles12.headerRight, children: [
|
|
1155
1253
|
right,
|
|
1156
1254
|
boxed ? null : /* @__PURE__ */ jsx(
|
|
1157
1255
|
Animated.View,
|
|
@@ -1159,7 +1257,7 @@ var AccordionItem = ({
|
|
|
1159
1257
|
accessibilityElementsHidden: true,
|
|
1160
1258
|
"aria-hidden": true,
|
|
1161
1259
|
importantForAccessibility: "no-hide-descendants",
|
|
1162
|
-
style: [
|
|
1260
|
+
style: [styles12.chevron, { transform: [{ rotate }] }],
|
|
1163
1261
|
children: /* @__PURE__ */ jsx(SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1164
1262
|
}
|
|
1165
1263
|
)
|
|
@@ -1173,7 +1271,7 @@ var AccordionItem = ({
|
|
|
1173
1271
|
accessibilityLabel: resolvedLabel,
|
|
1174
1272
|
nativeID: bodyTestID,
|
|
1175
1273
|
role: ROLE_REGION,
|
|
1176
|
-
style: boxed ?
|
|
1274
|
+
style: boxed ? styles12.boxBody : styles12.body,
|
|
1177
1275
|
testID: bodyTestID,
|
|
1178
1276
|
children
|
|
1179
1277
|
}
|
|
@@ -1236,7 +1334,7 @@ function useAvailableWidth() {
|
|
|
1236
1334
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
1237
1335
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
1238
1336
|
var UNMEASURED2 = 0;
|
|
1239
|
-
var
|
|
1337
|
+
var styles13 = StyleSheet.create({
|
|
1240
1338
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
1241
1339
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
1242
1340
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -1267,7 +1365,7 @@ var TruncatedText = ({
|
|
|
1267
1365
|
[value, measureRef]
|
|
1268
1366
|
);
|
|
1269
1367
|
const flatStyle = useMemo(
|
|
1270
|
-
() => StyleSheet.flatten([
|
|
1368
|
+
() => StyleSheet.flatten([styles13.base, style]),
|
|
1271
1369
|
[style]
|
|
1272
1370
|
);
|
|
1273
1371
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
@@ -1282,7 +1380,7 @@ var TruncatedText = ({
|
|
|
1282
1380
|
ref: attachRef,
|
|
1283
1381
|
onLayout,
|
|
1284
1382
|
numberOfLines: 1,
|
|
1285
|
-
style: [
|
|
1383
|
+
style: [styles13.base, styles13.fill, style],
|
|
1286
1384
|
testID,
|
|
1287
1385
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
1288
1386
|
accessibilityLabel,
|
|
@@ -1379,13 +1477,13 @@ function useCopyToClipboard(value, writer) {
|
|
|
1379
1477
|
var LABEL_FONT_SIZE = 11;
|
|
1380
1478
|
var VALUE_FONT_SIZE = 12;
|
|
1381
1479
|
var ACTION_FONT_SIZE = 12;
|
|
1382
|
-
var
|
|
1480
|
+
var ROW_GAP2 = 8;
|
|
1383
1481
|
var CELL_GAP = 2;
|
|
1384
1482
|
var LABEL_LETTER_SPACING = 0.4;
|
|
1385
1483
|
var ACTION_PADDING_H = 6;
|
|
1386
1484
|
var ACTION_PADDING_V = 2;
|
|
1387
1485
|
var ACTION_RADIUS = 6;
|
|
1388
|
-
var
|
|
1486
|
+
var styles14 = StyleSheet.create({
|
|
1389
1487
|
cell: { gap: CELL_GAP },
|
|
1390
1488
|
label: {
|
|
1391
1489
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -1393,7 +1491,7 @@ var styles13 = StyleSheet.create({
|
|
|
1393
1491
|
letterSpacing: LABEL_LETTER_SPACING,
|
|
1394
1492
|
textTransform: "uppercase"
|
|
1395
1493
|
},
|
|
1396
|
-
row: { flexDirection: "row", alignItems: "center", gap:
|
|
1494
|
+
row: { flexDirection: "row", alignItems: "center", gap: ROW_GAP2 },
|
|
1397
1495
|
/**
|
|
1398
1496
|
* The truncation width comes from this wrapper, not from the row: `TruncatedText` measures its
|
|
1399
1497
|
* PARENT (see `useAvailableWidth`), and the row also holds the copy button.
|
|
@@ -1444,14 +1542,14 @@ var CopyableId = ({
|
|
|
1444
1542
|
const { colors } = theme;
|
|
1445
1543
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
1446
1544
|
const action = useActionState(status);
|
|
1447
|
-
return /* @__PURE__ */ jsxs(View, { style: [
|
|
1448
|
-
label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [
|
|
1449
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1450
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
1545
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles14.cell, style], testID, children: [
|
|
1546
|
+
label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles14.label, { color: colors.textSecondary }], children: label }),
|
|
1547
|
+
/* @__PURE__ */ jsxs(View, { style: styles14.row, children: [
|
|
1548
|
+
/* @__PURE__ */ jsx(View, { style: styles14.valueWrap, children: /* @__PURE__ */ jsx(
|
|
1451
1549
|
TruncatedText,
|
|
1452
1550
|
{
|
|
1453
1551
|
value,
|
|
1454
|
-
style: [
|
|
1552
|
+
style: [styles14.value, { color: colors.text }],
|
|
1455
1553
|
testID: `${testID}-value`,
|
|
1456
1554
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
1457
1555
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -1465,7 +1563,7 @@ var CopyableId = ({
|
|
|
1465
1563
|
accessibilityLabel: t(action.key),
|
|
1466
1564
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
1467
1565
|
testID: `${testID}-copy`,
|
|
1468
|
-
style: [
|
|
1566
|
+
style: [styles14.action, { color: action.color }],
|
|
1469
1567
|
children: t(action.key)
|
|
1470
1568
|
}
|
|
1471
1569
|
)
|
|
@@ -1473,6 +1571,6 @@ var CopyableId = ({
|
|
|
1473
1571
|
] });
|
|
1474
1572
|
};
|
|
1475
1573
|
|
|
1476
|
-
export { Accordion, AccordionItem, COPY_FEEDBACK_MS, CopyStatus, CopyableId, DEFAULT_BILLING_ROUTE, DropdownVariant, ELLIPSIS, Heading, LAYOUT_I18N, LAYOUT_TEST_IDS, ModalDropdown, ModalShell, Section, SegmentedControl, StatusBadge, TruncatedText, UpgradePrompt, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
1574
|
+
export { Accordion, AccordionItem, COPY_FEEDBACK_MS, CopyStatus, CopyableId, DEFAULT_BILLING_ROUTE, DropdownVariant, ELLIPSIS, Heading, LAYOUT_I18N, LAYOUT_TEST_IDS, ModalDropdown, ModalShell, Section, SegmentedControl, StatusBadge, Tabs, TruncatedText, UpgradePrompt, copyText, formatUrlForDisplay, truncateMiddle, useCopyToClipboard, useFocusTrap };
|
|
1477
1575
|
//# sourceMappingURL=index.mjs.map
|
|
1478
1576
|
//# sourceMappingURL=index.mjs.map
|