@dloizides/ui-layout 1.3.0 → 1.5.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 +27 -0
- package/dist/index.d.mts +69 -5
- package/dist/index.d.ts +69 -5
- package/dist/index.js +176 -48
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +177 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -91,6 +91,93 @@ var StatusBadge = ({
|
|
|
91
91
|
}
|
|
92
92
|
);
|
|
93
93
|
};
|
|
94
|
+
var TRACK_PADDING = 3;
|
|
95
|
+
var TRACK_RADIUS = 999;
|
|
96
|
+
var SEGMENT_RADIUS = 999;
|
|
97
|
+
var SEGMENT_PAD_H = 15;
|
|
98
|
+
var SEGMENT_PAD_V = 7;
|
|
99
|
+
var SEGMENT_FONT = 14;
|
|
100
|
+
var SEGMENT_WEIGHT = "600";
|
|
101
|
+
var BORDER_WIDTH = 1;
|
|
102
|
+
var SHADOW_COLOR = "#141e32";
|
|
103
|
+
var SHADOW_OPACITY = 0.1;
|
|
104
|
+
var SHADOW_RADIUS = 3;
|
|
105
|
+
var SHADOW_OFFSET = { width: 0, height: 1 };
|
|
106
|
+
var SHADOW_ELEVATION = 2;
|
|
107
|
+
var TRANSPARENT = "transparent";
|
|
108
|
+
var styles4 = reactNative.StyleSheet.create({
|
|
109
|
+
track: {
|
|
110
|
+
flexDirection: "row",
|
|
111
|
+
alignSelf: "flex-start",
|
|
112
|
+
alignItems: "center",
|
|
113
|
+
gap: TRACK_PADDING + 1,
|
|
114
|
+
padding: TRACK_PADDING,
|
|
115
|
+
borderRadius: TRACK_RADIUS,
|
|
116
|
+
borderWidth: BORDER_WIDTH
|
|
117
|
+
},
|
|
118
|
+
segment: {
|
|
119
|
+
paddingHorizontal: SEGMENT_PAD_H,
|
|
120
|
+
paddingVertical: SEGMENT_PAD_V,
|
|
121
|
+
borderRadius: SEGMENT_RADIUS
|
|
122
|
+
},
|
|
123
|
+
segmentSelected: {
|
|
124
|
+
shadowColor: SHADOW_COLOR,
|
|
125
|
+
shadowOpacity: SHADOW_OPACITY,
|
|
126
|
+
shadowRadius: SHADOW_RADIUS,
|
|
127
|
+
shadowOffset: SHADOW_OFFSET,
|
|
128
|
+
elevation: SHADOW_ELEVATION
|
|
129
|
+
},
|
|
130
|
+
label: {
|
|
131
|
+
fontSize: SEGMENT_FONT,
|
|
132
|
+
fontWeight: SEGMENT_WEIGHT,
|
|
133
|
+
textAlign: "center"
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
function ariaSelectedProps(selected) {
|
|
137
|
+
return { "aria-selected": selected };
|
|
138
|
+
}
|
|
139
|
+
function SegmentedControl({
|
|
140
|
+
options,
|
|
141
|
+
value,
|
|
142
|
+
onChange,
|
|
143
|
+
accessibilityLabel,
|
|
144
|
+
style,
|
|
145
|
+
testID
|
|
146
|
+
}) {
|
|
147
|
+
const { theme } = uiFeedback.useUi();
|
|
148
|
+
const { colors } = theme;
|
|
149
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
150
|
+
reactNative.View,
|
|
151
|
+
{
|
|
152
|
+
accessibilityRole: "tablist",
|
|
153
|
+
"aria-label": accessibilityLabel,
|
|
154
|
+
style: [styles4.track, { backgroundColor: colors.background, borderColor: colors.border }, style],
|
|
155
|
+
testID,
|
|
156
|
+
children: options.map((opt) => {
|
|
157
|
+
const selected = opt.value === value;
|
|
158
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
159
|
+
reactNative.Pressable,
|
|
160
|
+
{
|
|
161
|
+
accessibilityRole: "tab",
|
|
162
|
+
accessibilityState: { selected },
|
|
163
|
+
accessibilityLabel: opt.accessibilityLabel ?? opt.label,
|
|
164
|
+
accessibilityHint: opt.accessibilityHint,
|
|
165
|
+
onPress: () => onChange(opt.value),
|
|
166
|
+
style: [
|
|
167
|
+
styles4.segment,
|
|
168
|
+
selected ? styles4.segmentSelected : null,
|
|
169
|
+
{ backgroundColor: selected ? colors.surface : TRANSPARENT }
|
|
170
|
+
],
|
|
171
|
+
testID: opt.testID,
|
|
172
|
+
...ariaSelectedProps(selected),
|
|
173
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles4.label, { color: selected ? colors.text : colors.textSecondary }], children: opt.label })
|
|
174
|
+
},
|
|
175
|
+
opt.value
|
|
176
|
+
);
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
94
181
|
var PROMPT_PADDING = 20;
|
|
95
182
|
var PROMPT_BORDER_RADIUS = 12;
|
|
96
183
|
var PROMPT_BORDER_WIDTH = 1;
|
|
@@ -103,7 +190,7 @@ var DISMISS_FONT_SIZE = 13;
|
|
|
103
190
|
var TITLE_MARGIN_BOTTOM = 8;
|
|
104
191
|
var MESSAGE_MARGIN_BOTTOM = 16;
|
|
105
192
|
var CTA_MARGIN_BOTTOM = 8;
|
|
106
|
-
var
|
|
193
|
+
var styles5 = reactNative.StyleSheet.create({
|
|
107
194
|
container: {
|
|
108
195
|
padding: PROMPT_PADDING,
|
|
109
196
|
borderRadius: PROMPT_BORDER_RADIUS,
|
|
@@ -131,21 +218,21 @@ var UpgradePrompt = ({
|
|
|
131
218
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
132
219
|
reactNative.View,
|
|
133
220
|
{
|
|
134
|
-
style: [
|
|
221
|
+
style: [styles5.container, { borderColor: primary, backgroundColor: colors.surface }],
|
|
135
222
|
testID: LAYOUT_TEST_IDS.upgradePrompt,
|
|
136
223
|
children: [
|
|
137
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
138
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
224
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.title, { color: colors.text }], children: t("settings.billing.upgradePrompt.title") }),
|
|
225
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.message, { color: colors.textSecondary }], children: t("settings.billing.upgradePrompt.message", requiredTier, currentTier) }),
|
|
139
226
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
140
227
|
reactNative.TouchableOpacity,
|
|
141
228
|
{
|
|
142
229
|
accessibilityHint: t("settings.billing.upgradePrompt.ctaHint"),
|
|
143
230
|
accessibilityLabel: t("settings.billing.upgradePrompt.cta"),
|
|
144
231
|
accessibilityRole: "button",
|
|
145
|
-
style: [
|
|
232
|
+
style: [styles5.cta, { backgroundColor: primary }],
|
|
146
233
|
testID: LAYOUT_TEST_IDS.upgradePromptCta,
|
|
147
234
|
onPress: handleUpgradePress,
|
|
148
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
235
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.ctaText, { color: colors.surface }], children: t("settings.billing.upgradePrompt.cta") })
|
|
149
236
|
}
|
|
150
237
|
),
|
|
151
238
|
onDismiss ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -154,10 +241,10 @@ var UpgradePrompt = ({
|
|
|
154
241
|
accessibilityHint: t("settings.billing.upgradePrompt.dismissHint"),
|
|
155
242
|
accessibilityLabel: t("settings.billing.upgradePrompt.dismiss"),
|
|
156
243
|
accessibilityRole: "button",
|
|
157
|
-
style:
|
|
244
|
+
style: styles5.dismiss,
|
|
158
245
|
testID: LAYOUT_TEST_IDS.upgradePromptDismiss,
|
|
159
246
|
onPress: onDismiss,
|
|
160
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
247
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles5.dismissText, { color: colors.textSecondary }], children: t("settings.billing.upgradePrompt.dismiss") })
|
|
161
248
|
}
|
|
162
249
|
) : null
|
|
163
250
|
]
|
|
@@ -229,7 +316,7 @@ var BODY_FONT_SIZE = 14;
|
|
|
229
316
|
var SELECTED_FONT_WEIGHT = "600";
|
|
230
317
|
var OPTION_PADDING_H = 16;
|
|
231
318
|
var OPTION_PADDING_V = 12;
|
|
232
|
-
var
|
|
319
|
+
var styles6 = reactNative.StyleSheet.create({
|
|
233
320
|
option: {
|
|
234
321
|
paddingHorizontal: OPTION_PADDING_H,
|
|
235
322
|
paddingVertical: OPTION_PADDING_V,
|
|
@@ -251,8 +338,8 @@ var OptionRow = ({
|
|
|
251
338
|
onSelect();
|
|
252
339
|
}, [onSelect]);
|
|
253
340
|
const isActive = isSelected || isHighlighted;
|
|
254
|
-
const rowStyle = [
|
|
255
|
-
const textStyle = [
|
|
341
|
+
const rowStyle = [styles6.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];
|
|
342
|
+
const textStyle = [styles6.optionText, { color: colors.text }, isSelected ? styles6.selectedText : null];
|
|
256
343
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
257
344
|
reactNative.TouchableOpacity,
|
|
258
345
|
{
|
|
@@ -324,14 +411,14 @@ function useMenuKeyboard(params) {
|
|
|
324
411
|
}, [containerRef, enabled, onClose, params]);
|
|
325
412
|
}
|
|
326
413
|
var BORDER_RADIUS = 8;
|
|
327
|
-
var
|
|
414
|
+
var BORDER_WIDTH2 = 1;
|
|
328
415
|
var MENU_PADDING = 4;
|
|
329
416
|
var MENU_MAX_HEIGHT = 300;
|
|
330
417
|
var MENU_TOP_GAP = 4;
|
|
331
418
|
var MENU_Z_INDEX = 1e3;
|
|
332
419
|
var MENU_ELEVATION = 8;
|
|
333
420
|
var MENU_BOX_SHADOW = "0px 2px 8px rgba(0, 0, 0, 0.15)";
|
|
334
|
-
var
|
|
421
|
+
var styles7 = reactNative.StyleSheet.create({
|
|
335
422
|
popover: {
|
|
336
423
|
position: "absolute",
|
|
337
424
|
top: "100%",
|
|
@@ -339,7 +426,7 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
339
426
|
right: 0,
|
|
340
427
|
marginTop: MENU_TOP_GAP,
|
|
341
428
|
zIndex: MENU_Z_INDEX,
|
|
342
|
-
borderWidth:
|
|
429
|
+
borderWidth: BORDER_WIDTH2,
|
|
343
430
|
borderRadius: BORDER_RADIUS,
|
|
344
431
|
padding: MENU_PADDING,
|
|
345
432
|
maxHeight: MENU_MAX_HEIGHT,
|
|
@@ -385,7 +472,7 @@ var InlineMenu = ({
|
|
|
385
472
|
onClose
|
|
386
473
|
});
|
|
387
474
|
const popoverStyle = React8.useMemo(
|
|
388
|
-
() => [
|
|
475
|
+
() => [styles7.popover, { borderColor: colors.border, backgroundColor: colors.surface }],
|
|
389
476
|
[colors.border, colors.surface]
|
|
390
477
|
);
|
|
391
478
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -421,17 +508,17 @@ function useResolvedDropdownVariant(explicit) {
|
|
|
421
508
|
return resolveDropdownVariant(explicit, width, reactNative.Platform.OS);
|
|
422
509
|
}
|
|
423
510
|
var BORDER_RADIUS2 = 8;
|
|
424
|
-
var
|
|
511
|
+
var BORDER_WIDTH3 = 1;
|
|
425
512
|
var BODY_FONT_SIZE2 = 14;
|
|
426
513
|
var MODAL_PADDING = 8;
|
|
427
514
|
var MODAL_MIN_WIDTH = 200;
|
|
428
515
|
var MODAL_MAX_HEIGHT = 300;
|
|
429
516
|
var CONTAINER_PADDING_H = 12;
|
|
430
517
|
var CONTAINER_PADDING_V = 10;
|
|
431
|
-
var
|
|
518
|
+
var styles8 = reactNative.StyleSheet.create({
|
|
432
519
|
anchor: { position: "relative" },
|
|
433
520
|
container: {
|
|
434
|
-
borderWidth:
|
|
521
|
+
borderWidth: BORDER_WIDTH3,
|
|
435
522
|
borderRadius: BORDER_RADIUS2,
|
|
436
523
|
paddingHorizontal: CONTAINER_PADDING_H,
|
|
437
524
|
paddingVertical: CONTAINER_PADDING_V
|
|
@@ -485,11 +572,11 @@ var ModalDropdown = ({
|
|
|
485
572
|
[onChange]
|
|
486
573
|
);
|
|
487
574
|
const containerStyle = React8.useMemo(
|
|
488
|
-
() => [
|
|
575
|
+
() => [styles8.container, { borderColor: colors.border, backgroundColor: colors.surface }],
|
|
489
576
|
[colors.border, colors.surface]
|
|
490
577
|
);
|
|
491
578
|
const modalContentStyle = React8.useMemo(
|
|
492
|
-
() => [
|
|
579
|
+
() => [styles8.modalContent, { backgroundColor: colors.surface }],
|
|
493
580
|
[colors.surface]
|
|
494
581
|
);
|
|
495
582
|
const renderModalOption = React8.useCallback(
|
|
@@ -505,7 +592,7 @@ var ModalDropdown = ({
|
|
|
505
592
|
[handleSelect, testID, value]
|
|
506
593
|
);
|
|
507
594
|
const keyExtractor = React8.useCallback((item) => String(item.value), []);
|
|
508
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style:
|
|
595
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: anchorRef, style: styles8.anchor, children: [
|
|
509
596
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
510
597
|
reactNative.TouchableOpacity,
|
|
511
598
|
{
|
|
@@ -517,7 +604,7 @@ var ModalDropdown = ({
|
|
|
517
604
|
style: containerStyle,
|
|
518
605
|
testID,
|
|
519
606
|
onPress: handleToggle,
|
|
520
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [
|
|
607
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles8.selectedText, { color: colors.text }], children: selectedLabel })
|
|
521
608
|
}
|
|
522
609
|
),
|
|
523
610
|
isMenu && isOpen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -540,7 +627,7 @@ var ModalDropdown = ({
|
|
|
540
627
|
accessibilityLabel: t("common.dismissDropdown"),
|
|
541
628
|
accessibilityRole: "button",
|
|
542
629
|
activeOpacity: 1,
|
|
543
|
-
style:
|
|
630
|
+
style: styles8.modalOverlay,
|
|
544
631
|
testID: `${testID}-backdrop`,
|
|
545
632
|
onPress: handleClose,
|
|
546
633
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -559,7 +646,7 @@ var ModalDropdown = ({
|
|
|
559
646
|
] });
|
|
560
647
|
};
|
|
561
648
|
var CLOSE_ICON_SIZE = 18;
|
|
562
|
-
var
|
|
649
|
+
var styles9 = reactNative.StyleSheet.create({
|
|
563
650
|
container: {
|
|
564
651
|
flex: 1,
|
|
565
652
|
padding: 16
|
|
@@ -584,7 +671,7 @@ var ModalShell = ({
|
|
|
584
671
|
}) => {
|
|
585
672
|
const { theme, t } = uiFeedback.useUi();
|
|
586
673
|
const containerStyle = React8__default.default.useMemo(
|
|
587
|
-
() => [
|
|
674
|
+
() => [styles9.container, { backgroundColor: theme.colors.background }, contentStyle],
|
|
588
675
|
[theme.colors.background, contentStyle]
|
|
589
676
|
);
|
|
590
677
|
const closeA11yLabel = t("quizTemplates.cancel");
|
|
@@ -604,7 +691,7 @@ var ModalShell = ({
|
|
|
604
691
|
role: "dialog",
|
|
605
692
|
style: containerStyle,
|
|
606
693
|
children: [
|
|
607
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
694
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles9.headerRow, children: [
|
|
608
695
|
/* @__PURE__ */ jsxRuntime.jsx(Heading, { children: title ?? t("close") }),
|
|
609
696
|
showClose ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
610
697
|
reactNative.TouchableOpacity,
|
|
@@ -612,7 +699,7 @@ var ModalShell = ({
|
|
|
612
699
|
accessibilityHint: t("common.closeDialogHint"),
|
|
613
700
|
accessibilityLabel: closeA11yLabel,
|
|
614
701
|
accessibilityRole: "button",
|
|
615
|
-
style:
|
|
702
|
+
style: styles9.closeButton,
|
|
616
703
|
testID: LAYOUT_TEST_IDS.modalShellClose,
|
|
617
704
|
onPress: onCancel,
|
|
618
705
|
children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: theme.colors.textSecondary, name: "close", size: CLOSE_ICON_SIZE })
|
|
@@ -653,8 +740,10 @@ function animateNextLayout() {
|
|
|
653
740
|
} catch {
|
|
654
741
|
}
|
|
655
742
|
}
|
|
656
|
-
var
|
|
657
|
-
|
|
743
|
+
var BOXED_GAP = 12;
|
|
744
|
+
var styles10 = reactNative.StyleSheet.create({
|
|
745
|
+
container: { alignSelf: "stretch" },
|
|
746
|
+
boxed: { gap: BOXED_GAP }
|
|
658
747
|
});
|
|
659
748
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
660
749
|
const ids = new Set(defaultOpenIds ?? []);
|
|
@@ -677,6 +766,7 @@ var Accordion = ({
|
|
|
677
766
|
defaultOpenIds,
|
|
678
767
|
onOpenChange,
|
|
679
768
|
allowMultiple = true,
|
|
769
|
+
variant = "plain",
|
|
680
770
|
testID = "accordion",
|
|
681
771
|
style
|
|
682
772
|
}) => {
|
|
@@ -705,13 +795,14 @@ var Accordion = ({
|
|
|
705
795
|
[allowMultiple, isControlled, onOpenChange, openSet]
|
|
706
796
|
);
|
|
707
797
|
const contextValue = React8.useMemo(
|
|
708
|
-
() => ({ openIds: openSet, toggle, allowMultiple }),
|
|
709
|
-
[openSet, toggle, allowMultiple]
|
|
710
|
-
);
|
|
711
|
-
const containerStyle = React8.useMemo(
|
|
712
|
-
() => style === void 0 ? [styles9.container] : [styles9.container, ...Array.isArray(style) ? style : [style]],
|
|
713
|
-
[style]
|
|
798
|
+
() => ({ openIds: openSet, toggle, allowMultiple, variant }),
|
|
799
|
+
[openSet, toggle, allowMultiple, variant]
|
|
714
800
|
);
|
|
801
|
+
const containerStyle = React8.useMemo(() => {
|
|
802
|
+
const base = variant === "boxed" ? [styles10.container, styles10.boxed] : [styles10.container];
|
|
803
|
+
if (style === void 0) return base;
|
|
804
|
+
return [...base, ...Array.isArray(style) ? style : [style]];
|
|
805
|
+
}, [style, variant]);
|
|
715
806
|
return /* @__PURE__ */ jsxRuntime.jsx(AccordionContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: containerStyle, testID, children }) });
|
|
716
807
|
};
|
|
717
808
|
var HEADER_PADDING_H = 16;
|
|
@@ -726,12 +817,23 @@ var ROTATE_DURATION_MS = 160;
|
|
|
726
817
|
var ROTATE_COLLAPSED = 0;
|
|
727
818
|
var ROTATE_EXPANDED = 1;
|
|
728
819
|
var COLLAPSED_DEG = "0deg";
|
|
729
|
-
var
|
|
820
|
+
var PLAIN_EXPANDED_DEG = "180deg";
|
|
821
|
+
var BOXED_EXPANDED_DEG = "90deg";
|
|
730
822
|
var DISABLED_OPACITY = 0.5;
|
|
731
823
|
var FULL_OPACITY = 1;
|
|
732
824
|
var ROLE_REGION = "region";
|
|
733
|
-
var
|
|
825
|
+
var BOX_BORDER_RADIUS = 10;
|
|
826
|
+
var BOX_PADDING_H = 14;
|
|
827
|
+
var BOX_HEADER_PADDING_V = 8;
|
|
828
|
+
var BOX_BODY_PADDING_BOTTOM = 10;
|
|
829
|
+
var BOX_BODY_PADDING_TOP = 2;
|
|
830
|
+
var BOX_TITLE_FONT_SIZE = 14;
|
|
831
|
+
var BOX_MARKER_FONT_SIZE = 13;
|
|
832
|
+
var BOX_MARKER_GAP = 6;
|
|
833
|
+
var BOX_MARKER = "\u25B8";
|
|
834
|
+
var styles11 = reactNative.StyleSheet.create({
|
|
734
835
|
item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
836
|
+
boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },
|
|
735
837
|
header: {
|
|
736
838
|
flexDirection: "row",
|
|
737
839
|
alignItems: "center",
|
|
@@ -739,11 +841,17 @@ var styles10 = reactNative.StyleSheet.create({
|
|
|
739
841
|
paddingHorizontal: HEADER_PADDING_H,
|
|
740
842
|
paddingVertical: HEADER_PADDING_V
|
|
741
843
|
},
|
|
844
|
+
boxHeader: { paddingHorizontal: 0, paddingVertical: BOX_HEADER_PADDING_V },
|
|
742
845
|
headerLeft: { flexShrink: 1, flexGrow: 1 },
|
|
846
|
+
headerLeftRow: { flexDirection: "row", alignItems: "center" },
|
|
743
847
|
headerRight: { flexDirection: "row", alignItems: "center", marginLeft: HEADER_GAP },
|
|
744
848
|
title: { fontSize: TITLE_FONT_SIZE2, fontWeight: TITLE_FONT_WEIGHT },
|
|
849
|
+
boxTitle: { fontSize: BOX_TITLE_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },
|
|
745
850
|
chevron: { marginLeft: HEADER_GAP },
|
|
746
|
-
|
|
851
|
+
marker: { marginRight: BOX_MARKER_GAP },
|
|
852
|
+
markerText: { fontSize: BOX_MARKER_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },
|
|
853
|
+
body: { paddingHorizontal: BODY_PADDING_H, paddingBottom: BODY_PADDING_V },
|
|
854
|
+
boxBody: { paddingHorizontal: 0, paddingBottom: BOX_BODY_PADDING_BOTTOM, paddingTop: BOX_BODY_PADDING_TOP }
|
|
747
855
|
});
|
|
748
856
|
var ACTIVATION_KEYS = ["Enter", " ", "Spacebar"];
|
|
749
857
|
var AccordionItem = ({
|
|
@@ -760,7 +868,8 @@ var AccordionItem = ({
|
|
|
760
868
|
}) => {
|
|
761
869
|
const { theme, t } = uiFeedback.useUi();
|
|
762
870
|
const { colors } = theme;
|
|
763
|
-
const { openIds, toggle } = useAccordionContext();
|
|
871
|
+
const { openIds, toggle, variant } = useAccordionContext();
|
|
872
|
+
const boxed = variant === "boxed";
|
|
764
873
|
const expanded = openIds.has(id);
|
|
765
874
|
const headerTestID = testID ?? `accordion-item-${id}`;
|
|
766
875
|
const bodyTestID = `${headerTestID}-body`;
|
|
@@ -776,7 +885,7 @@ var AccordionItem = ({
|
|
|
776
885
|
}, [expanded, rotation]);
|
|
777
886
|
const rotate = rotation.interpolate({
|
|
778
887
|
inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],
|
|
779
|
-
outputRange: [COLLAPSED_DEG,
|
|
888
|
+
outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG]
|
|
780
889
|
});
|
|
781
890
|
const handlePress = React8.useCallback(() => {
|
|
782
891
|
if (!disabled) toggle(id);
|
|
@@ -794,14 +903,19 @@ var AccordionItem = ({
|
|
|
794
903
|
);
|
|
795
904
|
const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
796
905
|
const itemStyle = React8.useMemo(
|
|
797
|
-
() => [
|
|
798
|
-
[colors.border]
|
|
906
|
+
() => boxed ? [styles11.boxItem, { borderColor: colors.border }] : [styles11.item, { borderTopColor: colors.border }],
|
|
907
|
+
[boxed, colors.border]
|
|
799
908
|
);
|
|
800
909
|
const headerStyle = React8.useMemo(
|
|
801
|
-
() => [
|
|
802
|
-
|
|
910
|
+
() => [
|
|
911
|
+
styles11.header,
|
|
912
|
+
...boxed ? [styles11.boxHeader] : [],
|
|
913
|
+
{ opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }
|
|
914
|
+
],
|
|
915
|
+
[boxed, disabled]
|
|
803
916
|
);
|
|
804
917
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
918
|
+
const titleNode = typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [boxed ? styles11.boxTitle : styles11.title, { color: boxed ? colors.textSecondary : colors.text }], children: title }) : title;
|
|
805
919
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: itemStyle, children: [
|
|
806
920
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
807
921
|
reactNative.Pressable,
|
|
@@ -818,15 +932,28 @@ var AccordionItem = ({
|
|
|
818
932
|
onPress: handlePress,
|
|
819
933
|
...keyboardProps,
|
|
820
934
|
children: [
|
|
821
|
-
/* @__PURE__ */ jsxRuntime.
|
|
822
|
-
|
|
935
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles11.headerLeft, boxed ? styles11.headerLeftRow : null], children: [
|
|
936
|
+
boxed ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles11.marker, { transform: [{ rotate }] }], testID: chevronTestID, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.markerText, { color: colors.textSecondary }], children: BOX_MARKER }) }) : null,
|
|
937
|
+
titleNode
|
|
938
|
+
] }),
|
|
939
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles11.headerRight, children: [
|
|
823
940
|
right,
|
|
824
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [
|
|
941
|
+
boxed ? null : /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles11.chevron, { transform: [{ rotate }] }], children: /* @__PURE__ */ jsxRuntime.jsx(uiIcons.SvgIcon, { color: colors.textSecondary, name: "chevronDown", size: CHEVRON_SIZE, testID: chevronTestID }) })
|
|
825
942
|
] })
|
|
826
943
|
]
|
|
827
944
|
}
|
|
828
945
|
),
|
|
829
|
-
expanded ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
946
|
+
expanded ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
947
|
+
reactNative.View,
|
|
948
|
+
{
|
|
949
|
+
accessibilityLabel: resolvedLabel,
|
|
950
|
+
nativeID: bodyTestID,
|
|
951
|
+
role: ROLE_REGION,
|
|
952
|
+
style: boxed ? styles11.boxBody : styles11.body,
|
|
953
|
+
testID: bodyTestID,
|
|
954
|
+
children
|
|
955
|
+
}
|
|
956
|
+
) : null
|
|
830
957
|
] });
|
|
831
958
|
};
|
|
832
959
|
|
|
@@ -839,6 +966,7 @@ exports.LAYOUT_TEST_IDS = LAYOUT_TEST_IDS;
|
|
|
839
966
|
exports.ModalDropdown = ModalDropdown;
|
|
840
967
|
exports.ModalShell = ModalShell;
|
|
841
968
|
exports.Section = Section;
|
|
969
|
+
exports.SegmentedControl = SegmentedControl;
|
|
842
970
|
exports.StatusBadge = StatusBadge;
|
|
843
971
|
exports.UpgradePrompt = UpgradePrompt;
|
|
844
972
|
exports.useFocusTrap = useFocusTrap;
|