@dloizides/ui-layout 1.16.1 → 1.18.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 +68 -1
- package/dist/index.d.ts +68 -1
- package/dist/index.js +162 -54
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +163 -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,113 @@ 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
|
+
// The full-width rule under the row lives here (not on the strip) so it spans the
|
|
245
|
+
// whole width even when the tabs are narrower than the viewport (desktop) and is
|
|
246
|
+
// not clipped to the scroll content width.
|
|
247
|
+
stripOuter: {
|
|
248
|
+
width: "100%",
|
|
249
|
+
borderBottomWidth: BORDER_WIDTH2
|
|
250
|
+
},
|
|
251
|
+
strip: {
|
|
252
|
+
flexDirection: "row",
|
|
253
|
+
flexWrap: "nowrap",
|
|
254
|
+
alignItems: "center",
|
|
255
|
+
columnGap: COLUMN_GAP,
|
|
256
|
+
rowGap: ROW_GAP,
|
|
257
|
+
paddingVertical: ROW_PAD_V
|
|
258
|
+
},
|
|
259
|
+
pill: {
|
|
260
|
+
// Keep each pill at its natural size so the row scrolls instead of squashing
|
|
261
|
+
// the tabs when they don't all fit.
|
|
262
|
+
flexShrink: 0,
|
|
263
|
+
paddingHorizontal: PILL_PAD_H,
|
|
264
|
+
paddingVertical: PILL_PAD_V,
|
|
265
|
+
borderRadius: PILL_RADIUS,
|
|
266
|
+
minHeight: PILL_MIN_HEIGHT,
|
|
267
|
+
flexDirection: "row",
|
|
268
|
+
alignItems: "center",
|
|
269
|
+
justifyContent: "center"
|
|
270
|
+
},
|
|
271
|
+
pillText: {
|
|
272
|
+
fontSize: PILL_FONT,
|
|
273
|
+
fontWeight: PILL_WEIGHT,
|
|
274
|
+
textAlign: "center"
|
|
275
|
+
},
|
|
276
|
+
panel: {
|
|
277
|
+
paddingTop: PANEL_PAD_TOP
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
function ariaTabProps(selected, panelId, tabId) {
|
|
281
|
+
return { "aria-selected": selected, "aria-controls": panelId, id: tabId };
|
|
282
|
+
}
|
|
283
|
+
var Tabs = ({
|
|
284
|
+
tabs,
|
|
285
|
+
activeKey,
|
|
286
|
+
onChange,
|
|
287
|
+
accessibilityLabel,
|
|
288
|
+
children,
|
|
289
|
+
idPrefix = "tabs",
|
|
290
|
+
style,
|
|
291
|
+
stripStyle,
|
|
292
|
+
panelStyle,
|
|
293
|
+
testID
|
|
294
|
+
}) => {
|
|
295
|
+
const { theme } = useUi();
|
|
296
|
+
const { colors } = theme;
|
|
297
|
+
const primaryColor = theme.palette.primary["500"];
|
|
298
|
+
const activePanelId = `${idPrefix}-panel-${activeKey}`;
|
|
299
|
+
const activeTabId = `${idPrefix}-tab-${activeKey}`;
|
|
300
|
+
const panelAria = { "aria-labelledby": activeTabId, id: activePanelId };
|
|
301
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles5.root, style], testID, children: [
|
|
302
|
+
/* @__PURE__ */ jsx(View, { style: [styles5.stripOuter, { borderBottomColor: colors.border }], children: /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: /* @__PURE__ */ jsx(
|
|
303
|
+
View,
|
|
304
|
+
{
|
|
305
|
+
accessibilityRole: "tablist",
|
|
306
|
+
"aria-label": accessibilityLabel,
|
|
307
|
+
style: [styles5.strip, stripStyle],
|
|
308
|
+
children: tabs.map((tab) => {
|
|
309
|
+
const selected = tab.key === activeKey;
|
|
310
|
+
const textColor = selected ? TEXT_ON_PRIMARY : colors.textSecondary;
|
|
311
|
+
const pillColor = selected ? primaryColor : colors.surfaceElevated;
|
|
312
|
+
const tabId = `${idPrefix}-tab-${tab.key}`;
|
|
313
|
+
const panelId = `${idPrefix}-panel-${tab.key}`;
|
|
314
|
+
return /* @__PURE__ */ jsx(
|
|
315
|
+
Pressable,
|
|
316
|
+
{
|
|
317
|
+
accessibilityRole: "tab",
|
|
318
|
+
accessibilityState: { selected },
|
|
319
|
+
accessibilityLabel: tab.accessibilityLabel ?? tab.label,
|
|
320
|
+
accessibilityHint: tab.accessibilityHint,
|
|
321
|
+
onPress: () => onChange(tab.key),
|
|
322
|
+
style: [styles5.pill, { backgroundColor: pillColor }],
|
|
323
|
+
testID: tab.testID,
|
|
324
|
+
...ariaTabProps(selected, panelId, tabId),
|
|
325
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles5.pillText, { color: textColor }], children: tab.label })
|
|
326
|
+
},
|
|
327
|
+
tab.key
|
|
328
|
+
);
|
|
329
|
+
})
|
|
330
|
+
}
|
|
331
|
+
) }) }),
|
|
332
|
+
/* @__PURE__ */ jsx(View, { accessibilityRole: "none", style: [styles5.panel, panelStyle], ...panelAria, children })
|
|
333
|
+
] });
|
|
334
|
+
};
|
|
228
335
|
var PROMPT_PADDING = 20;
|
|
229
336
|
var PROMPT_BORDER_RADIUS = 12;
|
|
230
337
|
var PROMPT_BORDER_WIDTH = 1;
|
|
@@ -237,7 +344,7 @@ var DISMISS_FONT_SIZE = 13;
|
|
|
237
344
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
238
345
|
var MESSAGE_MARGIN_BOTTOM = 16;
|
|
239
346
|
var CTA_MARGIN_BOTTOM = 8;
|
|
240
|
-
var
|
|
347
|
+
var styles6 = StyleSheet.create({
|
|
241
348
|
container: {
|
|
242
349
|
padding: PROMPT_PADDING,
|
|
243
350
|
borderRadius: PROMPT_BORDER_RADIUS,
|
|
@@ -265,21 +372,21 @@ var UpgradePrompt = ({
|
|
|
265
372
|
return /* @__PURE__ */ jsxs(
|
|
266
373
|
View,
|
|
267
374
|
{
|
|
268
|
-
style: [
|
|
375
|
+
style: [styles6.container, { borderColor: primary, backgroundColor: colors.surface }],
|
|
269
376
|
testID: LAYOUT_TEST_IDS.upgradePrompt,
|
|
270
377
|
children: [
|
|
271
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
272
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
378
|
+
/* @__PURE__ */ jsx(Text, { style: [styles6.title, { color: colors.text }], children: t(LAYOUT_I18N.upgradePromptTitle) }),
|
|
379
|
+
/* @__PURE__ */ jsx(Text, { style: [styles6.message, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier) }),
|
|
273
380
|
/* @__PURE__ */ jsx(
|
|
274
381
|
TouchableOpacity,
|
|
275
382
|
{
|
|
276
383
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptCtaHint),
|
|
277
384
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptCta),
|
|
278
385
|
accessibilityRole: "button",
|
|
279
|
-
style: [
|
|
386
|
+
style: [styles6.cta, { backgroundColor: primary }],
|
|
280
387
|
testID: LAYOUT_TEST_IDS.upgradePromptCta,
|
|
281
388
|
onPress: handleUpgradePress,
|
|
282
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
389
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles6.ctaText, { color: colors.surface }], children: t(LAYOUT_I18N.upgradePromptCta) })
|
|
283
390
|
}
|
|
284
391
|
),
|
|
285
392
|
onDismiss ? /* @__PURE__ */ jsx(
|
|
@@ -288,10 +395,10 @@ var UpgradePrompt = ({
|
|
|
288
395
|
accessibilityHint: t(LAYOUT_I18N.upgradePromptDismissHint),
|
|
289
396
|
accessibilityLabel: t(LAYOUT_I18N.upgradePromptDismiss),
|
|
290
397
|
accessibilityRole: "button",
|
|
291
|
-
style:
|
|
398
|
+
style: styles6.dismiss,
|
|
292
399
|
testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
|
|
293
400
|
onPress: onDismiss,
|
|
294
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
401
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles6.dismissText, { color: colors.textSecondary }], children: t(LAYOUT_I18N.upgradePromptDismiss) })
|
|
295
402
|
}
|
|
296
403
|
) : null
|
|
297
404
|
]
|
|
@@ -366,7 +473,7 @@ var MENU_ELEVATION = 8;
|
|
|
366
473
|
var MENU_TOP_GAP = 4;
|
|
367
474
|
var MENU_MAX_HEIGHT = 300;
|
|
368
475
|
var BORDER_RADIUS = 8;
|
|
369
|
-
var
|
|
476
|
+
var BORDER_WIDTH3 = 1;
|
|
370
477
|
var MENU_PADDING = 4;
|
|
371
478
|
var MENU_BOX_SHADOW = "0px 2px 8px rgba(0, 0, 0, 0.15)";
|
|
372
479
|
function buildPortalPopoverStyle(rect, minWidth = 0) {
|
|
@@ -378,7 +485,7 @@ function buildPortalPopoverStyle(rect, minWidth = 0) {
|
|
|
378
485
|
left: rect.left,
|
|
379
486
|
width: Math.max(rect.width, minWidth),
|
|
380
487
|
zIndex: MENU_Z_INDEX,
|
|
381
|
-
borderWidth:
|
|
488
|
+
borderWidth: BORDER_WIDTH3,
|
|
382
489
|
borderRadius: BORDER_RADIUS,
|
|
383
490
|
padding: MENU_PADDING,
|
|
384
491
|
maxHeight: MENU_MAX_HEIGHT,
|
|
@@ -403,7 +510,7 @@ var BODY_FONT_SIZE = 14;
|
|
|
403
510
|
var SELECTED_FONT_WEIGHT = "600";
|
|
404
511
|
var OPTION_PADDING_H = 16;
|
|
405
512
|
var OPTION_PADDING_V = 12;
|
|
406
|
-
var
|
|
513
|
+
var styles7 = StyleSheet.create({
|
|
407
514
|
option: {
|
|
408
515
|
paddingHorizontal: OPTION_PADDING_H,
|
|
409
516
|
paddingVertical: OPTION_PADDING_V,
|
|
@@ -425,8 +532,8 @@ var OptionRow = ({
|
|
|
425
532
|
onSelect();
|
|
426
533
|
}, [onSelect]);
|
|
427
534
|
const isActive = isSelected || isHighlighted;
|
|
428
|
-
const rowStyle = [
|
|
429
|
-
const textStyle = [
|
|
535
|
+
const rowStyle = [styles7.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];
|
|
536
|
+
const textStyle = [styles7.optionText, { color: colors.text }, isSelected ? styles7.selectedText : null];
|
|
430
537
|
return /* @__PURE__ */ jsx(
|
|
431
538
|
TouchableOpacity,
|
|
432
539
|
{
|
|
@@ -589,9 +696,9 @@ function useMenuKeyboard(params) {
|
|
|
589
696
|
}
|
|
590
697
|
var IS_WEB2 = Platform.OS === "web";
|
|
591
698
|
var BORDER_RADIUS2 = 8;
|
|
592
|
-
var
|
|
699
|
+
var BORDER_WIDTH4 = 1;
|
|
593
700
|
var MENU_PADDING2 = 4;
|
|
594
|
-
var
|
|
701
|
+
var styles8 = StyleSheet.create({
|
|
595
702
|
/** Native (in-tree) popover — anchored absolutely just under the trigger. */
|
|
596
703
|
popover: {
|
|
597
704
|
position: "absolute",
|
|
@@ -600,7 +707,7 @@ var styles7 = StyleSheet.create({
|
|
|
600
707
|
right: 0,
|
|
601
708
|
marginTop: MENU_TOP_GAP,
|
|
602
709
|
zIndex: MENU_Z_INDEX,
|
|
603
|
-
borderWidth:
|
|
710
|
+
borderWidth: BORDER_WIDTH4,
|
|
604
711
|
borderRadius: BORDER_RADIUS2,
|
|
605
712
|
padding: MENU_PADDING2,
|
|
606
713
|
maxHeight: MENU_MAX_HEIGHT,
|
|
@@ -657,7 +764,7 @@ var InlineMenu = ({
|
|
|
657
764
|
buildPortalPopoverStyle(rect ?? { left: 0, width: 0, bottom: 0 }, menuMinWidth),
|
|
658
765
|
themed
|
|
659
766
|
];
|
|
660
|
-
return [
|
|
767
|
+
return [styles8.popover, { minWidth: menuMinWidth }, themed];
|
|
661
768
|
}, [colors.border, colors.surface, menuMinWidth, rect]);
|
|
662
769
|
const menu = /* @__PURE__ */ jsx(
|
|
663
770
|
View,
|
|
@@ -695,17 +802,17 @@ function useResolvedDropdownVariant(explicit) {
|
|
|
695
802
|
return resolveDropdownVariant(explicit, width, Platform.OS);
|
|
696
803
|
}
|
|
697
804
|
var BORDER_RADIUS3 = 8;
|
|
698
|
-
var
|
|
805
|
+
var BORDER_WIDTH5 = 1;
|
|
699
806
|
var BODY_FONT_SIZE2 = 14;
|
|
700
807
|
var MODAL_PADDING = 8;
|
|
701
808
|
var MODAL_MIN_WIDTH = 200;
|
|
702
809
|
var MODAL_MAX_HEIGHT = 300;
|
|
703
810
|
var CONTAINER_PADDING_H = 12;
|
|
704
811
|
var CONTAINER_PADDING_V = 10;
|
|
705
|
-
var
|
|
812
|
+
var styles9 = StyleSheet.create({
|
|
706
813
|
anchor: { position: "relative" },
|
|
707
814
|
container: {
|
|
708
|
-
borderWidth:
|
|
815
|
+
borderWidth: BORDER_WIDTH5,
|
|
709
816
|
borderRadius: BORDER_RADIUS3,
|
|
710
817
|
paddingHorizontal: CONTAINER_PADDING_H,
|
|
711
818
|
paddingVertical: CONTAINER_PADDING_V
|
|
@@ -769,7 +876,7 @@ var ModalDropdown = ({
|
|
|
769
876
|
[onChange]
|
|
770
877
|
);
|
|
771
878
|
const containerStyle = useMemo(
|
|
772
|
-
() => renderTrigger !== void 0 ? void 0 : [
|
|
879
|
+
() => renderTrigger !== void 0 ? void 0 : [styles9.container, { borderColor: colors.border, backgroundColor: colors.surface }],
|
|
773
880
|
[colors.border, colors.surface, renderTrigger]
|
|
774
881
|
);
|
|
775
882
|
const optionTestIDFor = useCallback(
|
|
@@ -777,11 +884,11 @@ var ModalDropdown = ({
|
|
|
777
884
|
[optionTestID, testID]
|
|
778
885
|
);
|
|
779
886
|
const anchorStyle = useMemo(
|
|
780
|
-
() => [
|
|
887
|
+
() => [styles9.anchor, buildAnchorStackStyle(isMenu && isOpen)],
|
|
781
888
|
[isMenu, isOpen]
|
|
782
889
|
);
|
|
783
890
|
const modalContentStyle = useMemo(
|
|
784
|
-
() => [
|
|
891
|
+
() => [styles9.modalContent, { backgroundColor: colors.surface }],
|
|
785
892
|
[colors.surface]
|
|
786
893
|
);
|
|
787
894
|
const renderModalOption = useCallback(
|
|
@@ -799,7 +906,7 @@ var ModalDropdown = ({
|
|
|
799
906
|
const keyExtractor = useCallback((item) => String(item.value), []);
|
|
800
907
|
return /* @__PURE__ */ jsxs(View, { ref: anchorRef, style: anchorStyle, children: [
|
|
801
908
|
/* @__PURE__ */ jsxs(TouchableOpacity, { ...a11yProps, style: containerStyle, onPress: handleToggle, children: [
|
|
802
|
-
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : /* @__PURE__ */ jsx(Text, { style: [
|
|
909
|
+
renderTrigger !== void 0 ? renderTrigger({ label: selectedLabel, isOpen }) : /* @__PURE__ */ jsx(Text, { style: [styles9.selectedText, { color: colors.text }], children: selectedLabel }),
|
|
803
910
|
hintNode
|
|
804
911
|
] }),
|
|
805
912
|
isMenu && isOpen ? /* @__PURE__ */ jsx(
|
|
@@ -816,7 +923,7 @@ var ModalDropdown = ({
|
|
|
816
923
|
onSelect: handleSelect
|
|
817
924
|
}
|
|
818
925
|
) : null,
|
|
819
|
-
!isMenu ? /* @__PURE__ */ jsx(Modal, { transparent: true, animationType: "fade", visible: isOpen, onRequestClose: handleClose, children: /* @__PURE__ */ jsxs(View, { style:
|
|
926
|
+
!isMenu ? /* @__PURE__ */ jsx(Modal, { transparent: true, animationType: "fade", visible: isOpen, onRequestClose: handleClose, children: /* @__PURE__ */ jsxs(View, { style: styles9.modalOverlay, children: [
|
|
820
927
|
/* @__PURE__ */ jsx(
|
|
821
928
|
TouchableOpacity,
|
|
822
929
|
{
|
|
@@ -845,7 +952,7 @@ var ModalDropdown = ({
|
|
|
845
952
|
] });
|
|
846
953
|
};
|
|
847
954
|
var CLOSE_ICON_SIZE = 18;
|
|
848
|
-
var
|
|
955
|
+
var styles10 = StyleSheet.create({
|
|
849
956
|
container: {
|
|
850
957
|
flex: 1,
|
|
851
958
|
padding: 16
|
|
@@ -870,7 +977,7 @@ var ModalShell = ({
|
|
|
870
977
|
}) => {
|
|
871
978
|
const { theme, t } = useUi();
|
|
872
979
|
const containerStyle = React8.useMemo(
|
|
873
|
-
() => [
|
|
980
|
+
() => [styles10.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
874
981
|
[theme.colors.background, contentStyle]
|
|
875
982
|
);
|
|
876
983
|
const closeA11yLabel = t(LAYOUT_I18N.close);
|
|
@@ -890,7 +997,7 @@ var ModalShell = ({
|
|
|
890
997
|
role: "dialog",
|
|
891
998
|
style: containerStyle,
|
|
892
999
|
children: [
|
|
893
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1000
|
+
/* @__PURE__ */ jsxs(View, { style: styles10.headerRow, children: [
|
|
894
1001
|
/* @__PURE__ */ jsx(Heading, { children: title ?? t(LAYOUT_I18N.closeHeading) }),
|
|
895
1002
|
showClose ? /* @__PURE__ */ jsx(
|
|
896
1003
|
TouchableOpacity,
|
|
@@ -898,7 +1005,7 @@ var ModalShell = ({
|
|
|
898
1005
|
accessibilityHint: t(LAYOUT_I18N.closeDialogHint),
|
|
899
1006
|
accessibilityLabel: closeA11yLabel,
|
|
900
1007
|
accessibilityRole: "button",
|
|
901
|
-
style:
|
|
1008
|
+
style: styles10.closeButton,
|
|
902
1009
|
testID: LAYOUT_TEST_IDS.modalShellClose,
|
|
903
1010
|
onPress: onCancel,
|
|
904
1011
|
children: /* @__PURE__ */ jsx(SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
|
|
@@ -941,7 +1048,7 @@ function animateNextLayout() {
|
|
|
941
1048
|
}
|
|
942
1049
|
}
|
|
943
1050
|
var BOXED_GAP = 12;
|
|
944
|
-
var
|
|
1051
|
+
var styles11 = StyleSheet.create({
|
|
945
1052
|
container: { alignSelf: "stretch" },
|
|
946
1053
|
boxed: { gap: BOXED_GAP }
|
|
947
1054
|
});
|
|
@@ -999,7 +1106,7 @@ var Accordion = ({
|
|
|
999
1106
|
[openSet, toggle, allowMultiple, variant]
|
|
1000
1107
|
);
|
|
1001
1108
|
const containerStyle = useMemo(() => {
|
|
1002
|
-
const base = variant === "boxed" ? [
|
|
1109
|
+
const base = variant === "boxed" ? [styles11.container, styles11.boxed] : [styles11.container];
|
|
1003
1110
|
if (style === void 0) return base;
|
|
1004
1111
|
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
1005
1112
|
}, [style, variant]);
|
|
@@ -1031,7 +1138,7 @@ var BOX_TITLE_FONT_SIZE = 14;
|
|
|
1031
1138
|
var BOX_MARKER_FONT_SIZE = 13;
|
|
1032
1139
|
var BOX_MARKER_GAP = 6;
|
|
1033
1140
|
var BOX_MARKER = "\u25B8";
|
|
1034
|
-
var
|
|
1141
|
+
var styles12 = StyleSheet.create({
|
|
1035
1142
|
item: { borderTopWidth: StyleSheet.hairlineWidth },
|
|
1036
1143
|
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
1037
1144
|
header: {
|
|
@@ -1105,19 +1212,19 @@ var AccordionItem = ({
|
|
|
1105
1212
|
);
|
|
1106
1213
|
const keyboardProps = Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
1107
1214
|
const itemStyle = useMemo(
|
|
1108
|
-
() => boxed ? [
|
|
1215
|
+
() => boxed ? [styles12.boxItem, { borderColor: colors.border }] : [styles12.item, { borderTopColor: colors.border }],
|
|
1109
1216
|
[boxed, colors.border]
|
|
1110
1217
|
);
|
|
1111
1218
|
const headerStyle = useMemo(
|
|
1112
1219
|
() => [
|
|
1113
|
-
|
|
1114
|
-
...boxed ? [
|
|
1220
|
+
styles12.header,
|
|
1221
|
+
...boxed ? [styles12.boxHeader] : [],
|
|
1115
1222
|
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
1116
1223
|
],
|
|
1117
1224
|
[boxed, disabled]
|
|
1118
1225
|
);
|
|
1119
1226
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
1120
|
-
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ?
|
|
1227
|
+
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Text, { style: [boxed ? styles12.boxTitle : styles12.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
|
|
1121
1228
|
return /* @__PURE__ */ jsxs(View, { style: itemStyle, children: [
|
|
1122
1229
|
/* @__PURE__ */ jsxs(
|
|
1123
1230
|
Pressable,
|
|
@@ -1134,7 +1241,7 @@ var AccordionItem = ({
|
|
|
1134
1241
|
onPress: handlePress,
|
|
1135
1242
|
...keyboardProps,
|
|
1136
1243
|
children: [
|
|
1137
|
-
/* @__PURE__ */ jsxs(View, { style: [
|
|
1244
|
+
/* @__PURE__ */ jsxs(View, { style: [styles12.headerLeft, boxed ? styles12.headerLeftRow : null], children: [
|
|
1138
1245
|
boxed ? (
|
|
1139
1246
|
// Decorative — the open/closed state is already conveyed by aria-expanded on the header.
|
|
1140
1247
|
/* @__PURE__ */ jsx(
|
|
@@ -1143,15 +1250,15 @@ var AccordionItem = ({
|
|
|
1143
1250
|
accessibilityElementsHidden: true,
|
|
1144
1251
|
"aria-hidden": true,
|
|
1145
1252
|
importantForAccessibility: "no-hide-descendants",
|
|
1146
|
-
style: [
|
|
1253
|
+
style: [styles12.marker, { transform: [{ rotate }] }],
|
|
1147
1254
|
testID: chevronTestID,
|
|
1148
|
-
children: /* @__PURE__ */ jsx(Text, { style: [
|
|
1255
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles12.markerText, { color: colors.textSecondary }], children: BOX_MARKER })
|
|
1149
1256
|
}
|
|
1150
1257
|
)
|
|
1151
1258
|
) : null,
|
|
1152
1259
|
titleNode
|
|
1153
1260
|
] }),
|
|
1154
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1261
|
+
/* @__PURE__ */ jsxs(View, { style: styles12.headerRight, children: [
|
|
1155
1262
|
right,
|
|
1156
1263
|
boxed ? null : /* @__PURE__ */ jsx(
|
|
1157
1264
|
Animated.View,
|
|
@@ -1159,7 +1266,7 @@ var AccordionItem = ({
|
|
|
1159
1266
|
accessibilityElementsHidden: true,
|
|
1160
1267
|
"aria-hidden": true,
|
|
1161
1268
|
importantForAccessibility: "no-hide-descendants",
|
|
1162
|
-
style: [
|
|
1269
|
+
style: [styles12.chevron, { transform: [{ rotate }] }],
|
|
1163
1270
|
children: /* @__PURE__ */ jsx(SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID })
|
|
1164
1271
|
}
|
|
1165
1272
|
)
|
|
@@ -1173,7 +1280,7 @@ var AccordionItem = ({
|
|
|
1173
1280
|
accessibilityLabel: resolvedLabel,
|
|
1174
1281
|
nativeID: bodyTestID,
|
|
1175
1282
|
role: ROLE_REGION,
|
|
1176
|
-
style: boxed ?
|
|
1283
|
+
style: boxed ? styles12.boxBody : styles12.body,
|
|
1177
1284
|
testID: bodyTestID,
|
|
1178
1285
|
children
|
|
1179
1286
|
}
|
|
@@ -1236,7 +1343,7 @@ function useAvailableWidth() {
|
|
|
1236
1343
|
var AVG_CHAR_WIDTH_RATIO = 0.58;
|
|
1237
1344
|
var DEFAULT_FONT_SIZE2 = 13;
|
|
1238
1345
|
var UNMEASURED2 = 0;
|
|
1239
|
-
var
|
|
1346
|
+
var styles13 = StyleSheet.create({
|
|
1240
1347
|
base: { fontSize: DEFAULT_FONT_SIZE2 },
|
|
1241
1348
|
/** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */
|
|
1242
1349
|
fill: { flexShrink: 1, minWidth: 0 }
|
|
@@ -1267,7 +1374,7 @@ var TruncatedText = ({
|
|
|
1267
1374
|
[value, measureRef]
|
|
1268
1375
|
);
|
|
1269
1376
|
const flatStyle = useMemo(
|
|
1270
|
-
() => StyleSheet.flatten([
|
|
1377
|
+
() => StyleSheet.flatten([styles13.base, style]),
|
|
1271
1378
|
[style]
|
|
1272
1379
|
);
|
|
1273
1380
|
const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE2;
|
|
@@ -1282,7 +1389,7 @@ var TruncatedText = ({
|
|
|
1282
1389
|
ref: attachRef,
|
|
1283
1390
|
onLayout,
|
|
1284
1391
|
numberOfLines: 1,
|
|
1285
|
-
style: [
|
|
1392
|
+
style: [styles13.base, styles13.fill, style],
|
|
1286
1393
|
testID,
|
|
1287
1394
|
accessibilityRole: onPress !== void 0 || href !== void 0 ? "link" : "text",
|
|
1288
1395
|
accessibilityLabel,
|
|
@@ -1379,13 +1486,13 @@ function useCopyToClipboard(value, writer) {
|
|
|
1379
1486
|
var LABEL_FONT_SIZE = 11;
|
|
1380
1487
|
var VALUE_FONT_SIZE = 12;
|
|
1381
1488
|
var ACTION_FONT_SIZE = 12;
|
|
1382
|
-
var
|
|
1489
|
+
var ROW_GAP2 = 8;
|
|
1383
1490
|
var CELL_GAP = 2;
|
|
1384
1491
|
var LABEL_LETTER_SPACING = 0.4;
|
|
1385
1492
|
var ACTION_PADDING_H = 6;
|
|
1386
1493
|
var ACTION_PADDING_V = 2;
|
|
1387
1494
|
var ACTION_RADIUS = 6;
|
|
1388
|
-
var
|
|
1495
|
+
var styles14 = StyleSheet.create({
|
|
1389
1496
|
cell: { gap: CELL_GAP },
|
|
1390
1497
|
label: {
|
|
1391
1498
|
fontSize: LABEL_FONT_SIZE,
|
|
@@ -1393,7 +1500,7 @@ var styles13 = StyleSheet.create({
|
|
|
1393
1500
|
letterSpacing: LABEL_LETTER_SPACING,
|
|
1394
1501
|
textTransform: "uppercase"
|
|
1395
1502
|
},
|
|
1396
|
-
row: { flexDirection: "row", alignItems: "center", gap:
|
|
1503
|
+
row: { flexDirection: "row", alignItems: "center", gap: ROW_GAP2 },
|
|
1397
1504
|
/**
|
|
1398
1505
|
* The truncation width comes from this wrapper, not from the row: `TruncatedText` measures its
|
|
1399
1506
|
* PARENT (see `useAvailableWidth`), and the row also holds the copy button.
|
|
@@ -1444,14 +1551,14 @@ var CopyableId = ({
|
|
|
1444
1551
|
const { colors } = theme;
|
|
1445
1552
|
const { status, copy } = useCopyToClipboard(value, writer);
|
|
1446
1553
|
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:
|
|
1554
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles14.cell, style], testID, children: [
|
|
1555
|
+
label !== void 0 && /* @__PURE__ */ jsx(Text, { style: [styles14.label, { color: colors.textSecondary }], children: label }),
|
|
1556
|
+
/* @__PURE__ */ jsxs(View, { style: styles14.row, children: [
|
|
1557
|
+
/* @__PURE__ */ jsx(View, { style: styles14.valueWrap, children: /* @__PURE__ */ jsx(
|
|
1451
1558
|
TruncatedText,
|
|
1452
1559
|
{
|
|
1453
1560
|
value,
|
|
1454
|
-
style: [
|
|
1561
|
+
style: [styles14.value, { color: colors.text }],
|
|
1455
1562
|
testID: `${testID}-value`,
|
|
1456
1563
|
accessibilityLabel: accessibilityLabel ?? value,
|
|
1457
1564
|
accessibilityHint: t(LAYOUT_I18N.copyableIdHint)
|
|
@@ -1465,7 +1572,7 @@ var CopyableId = ({
|
|
|
1465
1572
|
accessibilityLabel: t(action.key),
|
|
1466
1573
|
accessibilityHint: t(LAYOUT_I18N.copyHint),
|
|
1467
1574
|
testID: `${testID}-copy`,
|
|
1468
|
-
style: [
|
|
1575
|
+
style: [styles14.action, { color: action.color }],
|
|
1469
1576
|
children: t(action.key)
|
|
1470
1577
|
}
|
|
1471
1578
|
)
|
|
@@ -1473,6 +1580,6 @@ var CopyableId = ({
|
|
|
1473
1580
|
] });
|
|
1474
1581
|
};
|
|
1475
1582
|
|
|
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 };
|
|
1583
|
+
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
1584
|
//# sourceMappingURL=index.mjs.map
|
|
1478
1585
|
//# sourceMappingURL=index.mjs.map
|