@dloizides/ui-layout 1.15.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 +31 -0
- package/dist/index.d.mts +91 -4
- package/dist/index.d.ts +91 -4
- package/dist/index.js +173 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +174 -60
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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';
|
|
@@ -82,13 +82,29 @@ var styles2 = StyleSheet.create({
|
|
|
82
82
|
fontSize: 16
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
var
|
|
85
|
+
var DEFAULT_HEADING_LEVEL = 2;
|
|
86
|
+
var Heading = ({
|
|
87
|
+
text,
|
|
88
|
+
children,
|
|
89
|
+
level = DEFAULT_HEADING_LEVEL,
|
|
90
|
+
style,
|
|
91
|
+
testID
|
|
92
|
+
}) => {
|
|
86
93
|
const { theme } = useUi();
|
|
87
94
|
const headingStyle = React8.useMemo(
|
|
88
|
-
() => [styles2.heading, { color: theme.colors.text }],
|
|
89
|
-
[theme.colors.text]
|
|
95
|
+
() => [styles2.heading, { color: theme.colors.text }, style],
|
|
96
|
+
[theme.colors.text, style]
|
|
97
|
+
);
|
|
98
|
+
return /* @__PURE__ */ jsx(
|
|
99
|
+
Text,
|
|
100
|
+
{
|
|
101
|
+
accessibilityRole: "header",
|
|
102
|
+
"aria-level": level,
|
|
103
|
+
style: headingStyle,
|
|
104
|
+
testID: testID ?? LAYOUT_TEST_IDS.headingText,
|
|
105
|
+
children: text ?? children
|
|
106
|
+
}
|
|
90
107
|
);
|
|
91
|
-
return /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: headingStyle, testID: LAYOUT_TEST_IDS.headingText, children: text ?? children });
|
|
92
108
|
};
|
|
93
109
|
var DEFAULT_PADDING_H = 10;
|
|
94
110
|
var DEFAULT_PADDING_V = 4;
|
|
@@ -209,6 +225,104 @@ function SegmentedControl({
|
|
|
209
225
|
}
|
|
210
226
|
);
|
|
211
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
|
+
};
|
|
212
326
|
var PROMPT_PADDING = 20;
|
|
213
327
|
var PROMPT_BORDER_RADIUS = 12;
|
|
214
328
|
var PROMPT_BORDER_WIDTH = 1;
|
|
@@ -221,7 +335,7 @@ var DISMISS_FONT_SIZE = 13;
|
|
|
221
335
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
222
336
|
var MESSAGE_MARGIN_BOTTOM = 16;
|
|
223
337
|
var CTA_MARGIN_BOTTOM = 8;
|
|
224
|
-
var
|
|
338
|
+
var styles6 = StyleSheet.create({
|
|
225
339
|
container: {
|
|
226
340
|
padding: PROMPT_PADDING,
|
|
227
341
|
borderRadius: PROMPT_BORDER_RADIUS,
|
|
@@ -249,21 +363,21 @@ var UpgradePrompt = ({
|
|
|
249
363
|
return /* @__PURE__ */ jsxs(
|
|
250
364
|
View,
|
|
251
365
|
{
|
|
252
|
-
style: [
|
|
366
|
+
style: [styles6.container, { borderColor: primary, backgroundColor: colors.surface }],
|
|
253
367
|
testID: LAYOUT_TEST_IDS.upgradePrompt,
|
|
254
368
|
children: [
|
|
255
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
256
|
-
/* @__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) }),
|
|
257
371
|
/* @__PURE__ */ jsx(
|
|
258
372
|
TouchableOpacity,
|
|
259
373
|
{
|
|
260
374
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
|
|
261
375
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
|
|
262
376
|
accessibilityRole: "button",
|
|
263
|
-
style: [
|
|
377
|
+
style: [styles6.cta, { backgroundColor: primary }],
|
|
264
378
|
testID: LAYOUT_TEST_IDS.upgradePromptCta,
|
|
265
379
|
onPress: handleUpgradePress,
|
|
266
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
380
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles6.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
|
|
267
381
|
}
|
|
268
382
|
),
|
|
269
383
|
onDismiss ? /* @__PURE__ */ jsx(
|
|
@@ -272,10 +386,10 @@ var UpgradePrompt = ({
|
|
|
272
386
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
|
|
273
387
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
|
|
274
388
|
accessibilityRole: "button",
|
|
275
|
-
style:
|
|
389
|
+
style: styles6.dismiss,
|
|
276
390
|
testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
|
|
277
391
|
onPress: onDismiss,
|
|
278
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
392
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles6.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
|
|
279
393
|
}
|
|
280
394
|
) : null
|
|
281
395
|
]
|
|
@@ -350,7 +464,7 @@ var MENU_ELEVATION = 8;
|
|
|
350
464
|
var MENU_TOP_GAP = 4;
|
|
351
465
|
var MENU_MAX_HEIGHT = 300;
|
|
352
466
|
var BORDER_RADIUS = 8;
|
|
353
|
-
var
|
|
467
|
+
var BORDER_WIDTH3 = 1;
|
|
354
468
|
var MENU_PADDING = 4;
|
|
355
469
|
var MENU_BOX_SHADOW = "0px 2px 8px rgba(0, 0, 0, 0.15)";
|
|
356
470
|
function buildPortalPopoverStyle(rect, minWidth = 0) {
|
|
@@ -362,7 +476,7 @@ function buildPortalPopoverStyle(rect, minWidth = 0) {
|
|
|
362
476
|
left: rect.left,
|
|
363
477
|
width: Math.max(rect.width, minWidth),
|
|
364
478
|
zIndex: MENU_Z_INDEX,
|
|
365
|
-
borderWidth:
|
|
479
|
+
borderWidth: BORDER_WIDTH3,
|
|
366
480
|
borderRadius: BORDER_RADIUS,
|
|
367
481
|
padding: MENU_PADDING,
|
|
368
482
|
maxHeight: MENU_MAX_HEIGHT,
|
|
@@ -387,7 +501,7 @@ var BODY_FONT_SIZE = 14;
|
|
|
387
501
|
var SELECTED_FONT_WEIGHT = "600";
|
|
388
502
|
var OPTION_PADDING_H = 16;
|
|
389
503
|
var OPTION_PADDING_V = 12;
|
|
390
|
-
var
|
|
504
|
+
var styles7 = StyleSheet.create({
|
|
391
505
|
option: {
|
|
392
506
|
paddingHorizontal: OPTION_PADDING_H,
|
|
393
507
|
paddingVertical: OPTION_PADDING_V,
|
|
@@ -409,8 +523,8 @@ var OptionRow = ({
|
|
|
409
523
|
onSelect();
|
|
410
524
|
}, [onSelect]);
|
|
411
525
|
const isActive = isSelected || isHighlighted;
|
|
412
|
-
const rowStyle = [
|
|
413
|
-
const textStyle = [
|
|
526
|
+
const rowStyle = [styles7.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];
|
|
527
|
+
const textStyle = [styles7.optionText, { color: colors.text }, isSelected ? styles7.selectedText : null];
|
|
414
528
|
return /* @__PURE__ */ jsx(
|
|
415
529
|
TouchableOpacity,
|
|
416
530
|
{
|
|
@@ -573,9 +687,9 @@ function useMenuKeyboard(params) {
|
|
|
573
687
|
}
|
|
574
688
|
var IS_WEB2 = Platform.OS === "web";
|
|
575
689
|
var BORDER_RADIUS2 = 8;
|
|
576
|
-
var
|
|
690
|
+
var BORDER_WIDTH4 = 1;
|
|
577
691
|
var MENU_PADDING2 = 4;
|
|
578
|
-
var
|
|
692
|
+
var styles8 = StyleSheet.create({
|
|
579
693
|
/** Native (in-tree) popover — anchored absolutely just under the trigger. */
|
|
580
694
|
popover: {
|
|
581
695
|
position: "absolute",
|
|
@@ -584,7 +698,7 @@ var styles7 = StyleSheet.create({
|
|
|
584
698
|
right: 0,
|
|
585
699
|
marginTop: MENU_TOP_GAP,
|
|
586
700
|
zIndex: MENU_Z_INDEX,
|
|
587
|
-
borderWidth:
|
|
701
|
+
borderWidth: BORDER_WIDTH4,
|
|
588
702
|
borderRadius: BORDER_RADIUS2,
|
|
589
703
|
padding: MENU_PADDING2,
|
|
590
704
|
maxHeight: MENU_MAX_HEIGHT,
|
|
@@ -641,7 +755,7 @@ var InlineMenu = ({
|
|
|
641
755
|
buildPortalPopoverStyle(rect ?? { left: 0, width: 0, bottom: 0 }, menuMinWidth),
|
|
642
756
|
themed
|
|
643
757
|
];
|
|
644
|
-
return [
|
|
758
|
+
return [styles8.popover, { minWidth: menuMinWidth }, themed];
|
|
645
759
|
}, [colors.border, colors.surface, menuMinWidth, rect]);
|
|
646
760
|
const menu = /* @__PURE__ */ jsx(
|
|
647
761
|
View,
|
|
@@ -679,17 +793,17 @@ function useResolvedDropdownVariant(explicit) {
|
|
|
679
793
|
return resolveDropdownVariant(explicit, width, Platform.OS);
|
|
680
794
|
}
|
|
681
795
|
var BORDER_RADIUS3 = 8;
|
|
682
|
-
var
|
|
796
|
+
var BORDER_WIDTH5 = 1;
|
|
683
797
|
var BODY_FONT_SIZE2 = 14;
|
|
684
798
|
var MODAL_PADDING = 8;
|
|
685
799
|
var MODAL_MIN_WIDTH = 200;
|
|
686
800
|
var MODAL_MAX_HEIGHT = 300;
|
|
687
801
|
var CONTAINER_PADDING_H = 12;
|
|
688
802
|
var CONTAINER_PADDING_V = 10;
|
|
689
|
-
var
|
|
803
|
+
var styles9 = StyleSheet.create({
|
|
690
804
|
anchor: { position: "relative" },
|
|
691
805
|
container: {
|
|
692
|
-
borderWidth:
|
|
806
|
+
borderWidth: BORDER_WIDTH5,
|
|
693
807
|
borderRadius: BORDER_RADIUS3,
|
|
694
808
|
paddingHorizontal: CONTAINER_PADDING_H,
|
|
695
809
|
paddingVertical: CONTAINER_PADDING_V
|
|
@@ -753,7 +867,7 @@ var ModalDropdown = ({
|
|
|
753
867
|
[onChange]
|
|
754
868
|
);
|
|
755
869
|
const containerStyle = useMemo(
|
|
756
|
-
() => renderTrigger !== void 0 ? void 0 : [
|
|
870
|
+
() => renderTrigger !== void 0 ? void 0 : [styles9.container, { borderColor: colors.border, backgroundColor: colors.surface }],
|
|
757
871
|
[colors.border, colors.surface, renderTrigger]
|
|
758
872
|
);
|
|
759
873
|
const optionTestIDFor = useCallback(
|
|
@@ -761,11 +875,11 @@ var ModalDropdown = ({
|
|
|
761
875
|
[optionTestID, testID]
|
|
762
876
|
);
|
|
763
877
|
const anchorStyle = useMemo(
|
|
764
|
-
() => [
|
|
878
|
+
() => [styles9.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
765
879
|
[isMenu, isOpen]
|
|
766
880
|
);
|
|
767
881
|
const modalContentStyle = useMemo(
|
|
768
|
-
() => [
|
|
882
|
+
() => [styles9.modalContent, { backgroundColor: colors.surface }],
|
|
769
883
|
[colors.surface]
|
|
770
884
|
);
|
|
771
885
|
const renderModalOption = useCallback(
|
|
@@ -783,7 +897,7 @@ var ModalDropdown = ({
|
|
|
783
897
|
const keyExtractor = useCallback((item) => String(item.value), []);
|
|
784
898
|
return /* @__PURE__ */ jsxs(View, { ref: anchorRef, style: anchorStyle, children: [
|
|
785
899
|
/* @__PURE__ */ jsxs(TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
|
|
786
|
-
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 }),
|
|
787
901
|
hintNode
|
|
788
902
|
] }),
|
|
789
903
|
isMenu && isOpen ? /* @__PURE__ */ jsx(
|
|
@@ -800,7 +914,7 @@ var ModalDropdown = ({
|
|
|
800
914
|
onSelect: handleSelect
|
|
801
915
|
}
|
|
802
916
|
) : null,
|
|
803
|
-
!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: [
|
|
804
918
|
/* @__PURE__ */ jsx(
|
|
805
919
|
TouchableOpacity,
|
|
806
920
|
{
|
|
@@ -829,7 +943,7 @@ var ModalDropdown = ({
|
|
|
829
943
|
] });
|
|
830
944
|
};
|
|
831
945
|
var CLOSE_ICON_SIZE = 18;
|
|
832
|
-
var
|
|
946
|
+
var styles10 = StyleSheet.create({
|
|
833
947
|
container: {
|
|
834
948
|
flex: 1,
|
|
835
949
|
padding: 16
|
|
@@ -854,7 +968,7 @@ var ModalShell = ({
|
|
|
854
968
|
}) => {
|
|
855
969
|
const { theme, t } = useUi();
|
|
856
970
|
const containerStyle = React8.useMemo(
|
|
857
|
-
() => [
|
|
971
|
+
() => [styles10.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
858
972
|
[theme.colors.background, contentStyle]
|
|
859
973
|
);
|
|
860
974
|
const closeA11yLabel = t(LAYOUT_I18N.close);
|
|
@@ -874,7 +988,7 @@ var ModalShell = ({
|
|
|
874
988
|
role: "dialog",
|
|
875
989
|
style: containerStyle,
|
|
876
990
|
children: [
|
|
877
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
991
|
+
/* @__PURE__ */ jsxs(View, { style: styles10.headerRow, children: [
|
|
878
992
|
/* @__PURE__ */ jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
|
|
879
993
|
showClose ? /* @__PURE__ */ jsx(
|
|
880
994
|
TouchableOpacity,
|
|
@@ -882,7 +996,7 @@ var ModalShell = ({
|
|
|
882
996
|
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
883
997
|
accessibilityLabel: closeA11yLabel,
|
|
884
998
|
accessibilityRole: "button",
|
|
885
|
-
style:
|
|
999
|
+
style: styles10.closeButton,
|
|
886
1000
|
testID: LAYOUT_TEST_IDS.modalShellClose,
|
|
887
1001
|
onPress: onCancel,
|
|
888
1002
|
children: /* @__PURE__ */ jsx(SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
|
|
@@ -925,7 +1039,7 @@ function animateNextLayout() {
|
|
|
925
1039
|
}
|
|
926
1040
|
}
|
|
927
1041
|
var BOXED_GAP = 12;
|
|
928
|
-
var
|
|
1042
|
+
var styles11 = StyleSheet.create({
|
|
929
1043
|
container: { alignSelf: "stretch" },
|
|
930
1044
|
boxed: { gap: BOXED_GAP }
|
|
931
1045
|
});
|
|
@@ -983,7 +1097,7 @@ var Accordion = ({
|
|
|
983
1097
|
[openSet, toggle, allowMultiple, variant]
|
|
984
1098
|
);
|
|
985
1099
|
const containerStyle = useMemo(() => {
|
|
986
|
-
const base = variant === "boxed" ? [
|
|
1100
|
+
const base = variant === "boxed" ? [styles11.container, styles11.boxed] : [styles11.container];
|
|
987
1101
|
if (style === void 0) return base;
|
|
988
1102
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
989
1103
|
}, [style, variant]);
|
|
@@ -1015,7 +1129,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1015
1129
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1016
1130
|
var BOX_MARKER_GAP = 6;
|
|
1017
1131
|
var BOX_MARKER = "\u25B8";
|
|
1018
|
-
var
|
|
1132
|
+
var styles12 = StyleSheet.create({
|
|
1019
1133
|
item: { borderTopWidth: StyleSheet.hairlineWidth },
|
|
1020
1134
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1021
1135
|
header: {
|
|
@@ -1089,19 +1203,19 @@ var AccordionItem = ({
|
|
|
1089
1203
|
);
|
|
1090
1204
|
const keyboardProps = Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1091
1205
|
const itemStyle = useMemo(
|
|
1092
|
-
() => boxed ? [
|
|
1206
|
+
() => boxed ? [styles12.boxItem, { borderColor: colors.border }] : [styles12.item, { borderTopColor: colors.border }],
|
|
1093
1207
|
[boxed, colors.border]
|
|
1094
1208
|
);
|
|
1095
1209
|
const headerStyle = useMemo(
|
|
1096
1210
|
() => [
|
|
1097
|
-
|
|
1098
|
-
...boxed ? [
|
|
1211
|
+
styles12.header,
|
|
1212
|
+
...boxed ? [styles12.boxHeader] : [],
|
|
1099
1213
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1100
1214
|
],
|
|
1101
1215
|
[boxed, disabled]
|
|
1102
1216
|
);
|
|
1103
1217
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1104
|
-
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;
|
|
1105
1219
|
return /* @__PURE__ */ jsxs(View, { style: itemStyle, children: [
|
|
1106
1220
|
/* @__PURE__ */ jsxs(
|
|
1107
1221
|
Pressable,
|
|
@@ -1118,7 +1232,7 @@ var AccordionItem = ({
|
|
|
1118
1232
|
onPress: handlePress,
|
|
1119
1233
|
...keyboardProps,
|
|
1120
1234
|
children: [
|
|
1121
|
-
/* @__PURE__ */ jsxs(View, { style: [
|
|
1235
|
+
/* @__PURE__ */ jsxs(View, { style: [styles12.headerLeft, boxed ? styles12.headerLeftRow : null], children: [
|
|
1122
1236
|
boxed ? (
|
|
1123
1237
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1124
1238
|
/* @__PURE__ */ jsx(
|
|
@@ -1127,15 +1241,15 @@ var AccordionItem = ({
|
|
|
1127
1241
|
accessibilityElementsHidden: true,
|
|
1128
1242
|
"aria-hidden": true,
|
|
1129
1243
|
importantForAccessibility: "no-hide-descendants",
|
|
1130
|
-
style: [
|
|
1244
|
+
style: [styles12.marker, { transform: [{ rotate }] }],
|
|
1131
1245
|
testID: chevronTestID,
|
|
1132
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1246
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles12.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1133
1247
|
}
|
|
1134
1248
|
)
|
|
1135
1249
|
) : null,
|
|
1136
1250
|
titleNode
|
|
1137
1251
|
] }),
|
|
1138
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1252
|
+
/* @__PURE__ */ jsxs(View, { style: styles12.headerRight, children: [
|
|
1139
1253
|
right,
|
|
1140
1254
|
boxed ? null : /* @__PURE__ */ jsx(
|
|
1141
1255
|
Animated.View,
|
|
@@ -1143,7 +1257,7 @@ var AccordionItem = ({
|
|
|
1143
1257
|
accessibilityElementsHidden: true,
|
|
1144
1258
|
"aria-hidden": true,
|
|
1145
1259
|
importantForAccessibility: "no-hide-descendants",
|
|
1146
|
-
style: [
|
|
1260
|
+
style: [styles12.chevron, { transform: [{ rotate }] }],
|
|
1147
1261
|
children: /* @__PURE__ */ jsx(SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1148
1262
|
}
|
|
1149
1263
|
)
|
|
@@ -1157,7 +1271,7 @@ var AccordionItem = ({
|
|
|
1157
1271
|
accessibilityLabel: resolvedLabel,
|
|
1158
1272
|
nativeID: bodyTestID,
|
|
1159
1273
|
role: ROLE_REGION,
|
|
1160
|
-
style: boxed ?
|
|
1274
|
+
style: boxed ? styles12.boxBody : styles12.body,
|
|
1161
1275
|
testID: bodyTestID,
|
|
1162
1276
|
children
|
|
1163
1277
|
}
|
|
@@ -1220,7 +1334,7 @@ function useAvailableWidth() {
|
|
|
1220
1334
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
1221
1335
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
1222
1336
|
var UNMEASURED2 = 0;
|
|
1223
|
-
var
|
|
1337
|
+
var styles13 = StyleSheet.create({
|
|
1224
1338
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
1225
1339
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
1226
1340
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -1251,7 +1365,7 @@ var TruncatedText = ({
|
|
|
1251
1365
|
[value, measureRef]
|
|
1252
1366
|
);
|
|
1253
1367
|
const flatStyle = useMemo(
|
|
1254
|
-
() => StyleSheet.flatten([
|
|
1368
|
+
() => StyleSheet.flatten([styles13.base, style]),
|
|
1255
1369
|
[style]
|
|
1256
1370
|
);
|
|
1257
1371
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
@@ -1266,7 +1380,7 @@ var TruncatedText = ({
|
|
|
1266
1380
|
ref: attachRef,
|
|
1267
1381
|
onLayout,
|
|
1268
1382
|
numberOfLines: 1,
|
|
1269
|
-
style: [
|
|
1383
|
+
style: [styles13.base, styles13.fill, style],
|
|
1270
1384
|
testID,
|
|
1271
1385
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
1272
1386
|
accessibilityLabel,
|
|
@@ -1363,13 +1477,13 @@ function useCopyToClipboard(value, writer) {
|
|
|
1363
1477
|
var LABEL_FONT_SIZE = 11;
|
|
1364
1478
|
var VALUE_FONT_SIZE = 12;
|
|
1365
1479
|
var ACTION_FONT_SIZE = 12;
|
|
1366
|
-
var
|
|
1480
|
+
var ROW_GAP2 = 8;
|
|
1367
1481
|
var CELL_GAP = 2;
|
|
1368
1482
|
var LABEL_LETTER_SPACING = 0.4;
|
|
1369
1483
|
var ACTION_PADDING_H = 6;
|
|
1370
1484
|
var ACTION_PADDING_V = 2;
|
|
1371
1485
|
var ACTION_RADIUS = 6;
|
|
1372
|
-
var
|
|
1486
|
+
var styles14 = StyleSheet.create({
|
|
1373
1487
|
cell: { gap: CELL_GAP },
|
|
1374
1488
|
label: {
|
|
1375
1489
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -1377,7 +1491,7 @@ var styles13 = StyleSheet.create({
|
|
|
1377
1491
|
letterSpacing: LABEL_LETTER_SPACING,
|
|
1378
1492
|
textTransform: "uppercase"
|
|
1379
1493
|
},
|
|
1380
|
-
row: { flexDirection: "row", alignItems: "center", gap:
|
|
1494
|
+
row: { flexDirection: "row", alignItems: "center", gap: ROW_GAP2 },
|
|
1381
1495
|
/**
|
|
1382
1496
|
* The truncation width comes from this wrapper, not from the row: `TruncatedText` measures its
|
|
1383
1497
|
* PARENT (see `useAvailableWidth`), and the row also holds the copy button.
|
|
@@ -1428,14 +1542,14 @@ var CopyableId = ({
|
|
|
1428
1542
|
const { colors } = theme;
|
|
1429
1543
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
1430
1544
|
const action = useActionState(status);
|
|
1431
|
-
return /* @__PURE__ */ jsxs(View, { style: [
|
|
1432
|
-
label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [
|
|
1433
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1434
|
-
/* @__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(
|
|
1435
1549
|
TruncatedText,
|
|
1436
1550
|
{
|
|
1437
1551
|
value,
|
|
1438
|
-
style: [
|
|
1552
|
+
style: [styles14.value, { color: colors.text }],
|
|
1439
1553
|
testID: `${testID}-value`,
|
|
1440
1554
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
1441
1555
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -1449,7 +1563,7 @@ var CopyableId = ({
|
|
|
1449
1563
|
accessibilityLabel: t(action.key),
|
|
1450
1564
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
1451
1565
|
testID: `${testID}-copy`,
|
|
1452
|
-
style: [
|
|
1566
|
+
style: [styles14.action, { color: action.color }],
|
|
1453
1567
|
children: t(action.key)
|
|
1454
1568
|
}
|
|
1455
1569
|
)
|
|
@@ -1457,6 +1571,6 @@ var CopyableId = ({
|
|
|
1457
1571
|
] });
|
|
1458
1572
|
};
|
|
1459
1573
|
|
|
1460
|
-
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 };
|
|
1461
1575
|
//# sourceMappingURL=index.mjs.map
|
|
1462
1576
|
//# sourceMappingURL=index.mjs.map
|