@dloizides/ui-layout 1.3.0 → 1.4.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 +17 -0
- package/dist/index.d.mts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +124 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +125 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
- Add **`SegmentedControl`** — a single rounded pill *track* holding N mutually-exclusive
|
|
6
|
+
segments (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised
|
|
7
|
+
surface (`colors.surface`) with a subtle shadow; the rest stay transparent over the soft
|
|
8
|
+
track (`colors.background`). Promoted from the v1 AML console's `.lf-mode` mode switch so
|
|
9
|
+
erevna/katalogos/kefi share ONE toggle instead of hand-rolling two primary/ghost buttons.
|
|
10
|
+
- **Generic over the value union** (`SegmentedControl<'peps' | 'leaders'>`) for a typed
|
|
11
|
+
`onChange`; each segment carries its own `label` / `value` / optional `testID` +
|
|
12
|
+
`accessibilityLabel` / `accessibilityHint`.
|
|
13
|
+
- **a11y**: the group renders as a `tablist`, each segment as a `tab` with
|
|
14
|
+
`accessibilityState={{ selected }}` (react-native-web forwards `role` + `aria-selected`).
|
|
15
|
+
- **Themed** entirely from the `@dloizides/ui-feedback` theme (surface / background / border /
|
|
16
|
+
text colours); no colour literal except the selected-segment drop shadow.
|
|
17
|
+
- **Additive / backward-compatible**: purely new exports (`SegmentedControl`,
|
|
18
|
+
`SegmentedControlProps`, `SegmentedOption`). Existing consumers are unaffected.
|
|
19
|
+
|
|
3
20
|
## 1.3.0
|
|
4
21
|
|
|
5
22
|
- Add **`Accordion`** + **`AccordionItem`** — a themed expand/collapse disclosure group that
|
package/dist/index.d.mts
CHANGED
|
@@ -36,6 +36,47 @@ interface StatusBadgeProps {
|
|
|
36
36
|
}
|
|
37
37
|
declare const StatusBadge: ({ label, color, backgroundColor, testID, accessibilityLabel, accessibilityHint, }: StatusBadgeProps) => React.ReactElement;
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* SegmentedControl — a single rounded pill *track* holding N mutually-exclusive segments
|
|
41
|
+
* (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised surface
|
|
42
|
+
* with a subtle shadow; the rest stay transparent. Promoted from the v1 AML console's
|
|
43
|
+
* `.lf-mode` mode switch so erevna/katalogos/kefi can share ONE toggle instead of
|
|
44
|
+
* hand-rolling two primary/ghost buttons.
|
|
45
|
+
*
|
|
46
|
+
* Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM/router/store/icon
|
|
47
|
+
* imports. Labels are pre-localized strings; every colour is read from the
|
|
48
|
+
* `@dloizides/ui-feedback` UiProvider theme, so it re-skins on tenant swap. Renders as a
|
|
49
|
+
* `tablist` of `tab`s (`accessibilityRole` + `accessibilityState.selected`, which
|
|
50
|
+
* react-native-web forwards to `role`/`aria-selected` on the DOM).
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/** One selectable segment. `value` is what `onChange` emits when it's pressed. */
|
|
54
|
+
interface SegmentedOption<V extends string = string> {
|
|
55
|
+
label: string;
|
|
56
|
+
value: V;
|
|
57
|
+
testID?: string;
|
|
58
|
+
accessibilityLabel?: string;
|
|
59
|
+
accessibilityHint?: string;
|
|
60
|
+
}
|
|
61
|
+
interface SegmentedControlProps<V extends string = string> {
|
|
62
|
+
/** The segments, left → right. */
|
|
63
|
+
options: ReadonlyArray<SegmentedOption<V>>;
|
|
64
|
+
/** The currently-selected value. */
|
|
65
|
+
value: V;
|
|
66
|
+
/** Fired with a segment's `value` when it is pressed. */
|
|
67
|
+
onChange: (value: V) => void;
|
|
68
|
+
/** Accessible name for the whole group (the `tablist`). */
|
|
69
|
+
accessibilityLabel: string;
|
|
70
|
+
/** Optional style override merged LAST onto the track. */
|
|
71
|
+
style?: StyleProp<ViewStyle>;
|
|
72
|
+
testID?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A segmented toggle. Generic over the value union so callers get a typed `onChange`
|
|
76
|
+
* (e.g. `SegmentedControl<'peps' | 'leaders'>`).
|
|
77
|
+
*/
|
|
78
|
+
declare function SegmentedControl<V extends string = string>({ options, value, onChange, accessibilityLabel, style, testID, }: SegmentedControlProps<V>): React.ReactElement;
|
|
79
|
+
|
|
39
80
|
/**
|
|
40
81
|
* UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the
|
|
41
82
|
* billing route via the injected navigate (default route overridable).
|
|
@@ -190,4 +231,4 @@ declare const LAYOUT_TEST_IDS: {
|
|
|
190
231
|
/** Route the UpgradePrompt CTA navigates to by default (the apps' billing settings path). */
|
|
191
232
|
declare const DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
192
233
|
|
|
193
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, DEFAULT_BILLING_ROUTE, type DropdownOption, DropdownVariant, Heading, type HeadingProps, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, StatusBadge, type StatusBadgeProps, UpgradePrompt, type UpgradePromptProps, useFocusTrap };
|
|
234
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, DEFAULT_BILLING_ROUTE, type DropdownOption, DropdownVariant, Heading, type HeadingProps, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, UpgradePrompt, type UpgradePromptProps, useFocusTrap };
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,47 @@ interface StatusBadgeProps {
|
|
|
36
36
|
}
|
|
37
37
|
declare const StatusBadge: ({ label, color, backgroundColor, testID, accessibilityLabel, accessibilityHint, }: StatusBadgeProps) => React.ReactElement;
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* SegmentedControl — a single rounded pill *track* holding N mutually-exclusive segments
|
|
41
|
+
* (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised surface
|
|
42
|
+
* with a subtle shadow; the rest stay transparent. Promoted from the v1 AML console's
|
|
43
|
+
* `.lf-mode` mode switch so erevna/katalogos/kefi can share ONE toggle instead of
|
|
44
|
+
* hand-rolling two primary/ghost buttons.
|
|
45
|
+
*
|
|
46
|
+
* Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM/router/store/icon
|
|
47
|
+
* imports. Labels are pre-localized strings; every colour is read from the
|
|
48
|
+
* `@dloizides/ui-feedback` UiProvider theme, so it re-skins on tenant swap. Renders as a
|
|
49
|
+
* `tablist` of `tab`s (`accessibilityRole` + `accessibilityState.selected`, which
|
|
50
|
+
* react-native-web forwards to `role`/`aria-selected` on the DOM).
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/** One selectable segment. `value` is what `onChange` emits when it's pressed. */
|
|
54
|
+
interface SegmentedOption<V extends string = string> {
|
|
55
|
+
label: string;
|
|
56
|
+
value: V;
|
|
57
|
+
testID?: string;
|
|
58
|
+
accessibilityLabel?: string;
|
|
59
|
+
accessibilityHint?: string;
|
|
60
|
+
}
|
|
61
|
+
interface SegmentedControlProps<V extends string = string> {
|
|
62
|
+
/** The segments, left → right. */
|
|
63
|
+
options: ReadonlyArray<SegmentedOption<V>>;
|
|
64
|
+
/** The currently-selected value. */
|
|
65
|
+
value: V;
|
|
66
|
+
/** Fired with a segment's `value` when it is pressed. */
|
|
67
|
+
onChange: (value: V) => void;
|
|
68
|
+
/** Accessible name for the whole group (the `tablist`). */
|
|
69
|
+
accessibilityLabel: string;
|
|
70
|
+
/** Optional style override merged LAST onto the track. */
|
|
71
|
+
style?: StyleProp<ViewStyle>;
|
|
72
|
+
testID?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A segmented toggle. Generic over the value union so callers get a typed `onChange`
|
|
76
|
+
* (e.g. `SegmentedControl<'peps' | 'leaders'>`).
|
|
77
|
+
*/
|
|
78
|
+
declare function SegmentedControl<V extends string = string>({ options, value, onChange, accessibilityLabel, style, testID, }: SegmentedControlProps<V>): React.ReactElement;
|
|
79
|
+
|
|
39
80
|
/**
|
|
40
81
|
* UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the
|
|
41
82
|
* billing route via the injected navigate (default route overridable).
|
|
@@ -190,4 +231,4 @@ declare const LAYOUT_TEST_IDS: {
|
|
|
190
231
|
/** Route the UpgradePrompt CTA navigates to by default (the apps' billing settings path). */
|
|
191
232
|
declare const DEFAULT_BILLING_ROUTE = "/settings/billing";
|
|
192
233
|
|
|
193
|
-
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, DEFAULT_BILLING_ROUTE, type DropdownOption, DropdownVariant, Heading, type HeadingProps, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, StatusBadge, type StatusBadgeProps, UpgradePrompt, type UpgradePromptProps, useFocusTrap };
|
|
234
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, DEFAULT_BILLING_ROUTE, type DropdownOption, DropdownVariant, Heading, type HeadingProps, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, UpgradePrompt, type UpgradePromptProps, useFocusTrap };
|
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,7 +740,7 @@ function animateNextLayout() {
|
|
|
653
740
|
} catch {
|
|
654
741
|
}
|
|
655
742
|
}
|
|
656
|
-
var
|
|
743
|
+
var styles10 = reactNative.StyleSheet.create({
|
|
657
744
|
container: { alignSelf: "stretch" }
|
|
658
745
|
});
|
|
659
746
|
function computeInitialOpen(children, defaultOpenIds, allowMultiple) {
|
|
@@ -709,7 +796,7 @@ var Accordion = ({
|
|
|
709
796
|
[openSet, toggle, allowMultiple]
|
|
710
797
|
);
|
|
711
798
|
const containerStyle = React8.useMemo(
|
|
712
|
-
() => style === void 0 ? [
|
|
799
|
+
() => style === void 0 ? [styles10.container] : [styles10.container, ...Array.isArray(style) ? style : [style]],
|
|
713
800
|
[style]
|
|
714
801
|
);
|
|
715
802
|
return /* @__PURE__ */ jsxRuntime.jsx(AccordionContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: containerStyle, testID, children }) });
|
|
@@ -730,7 +817,7 @@ var EXPANDED_DEG = "180deg";
|
|
|
730
817
|
var DISABLED_OPACITY = 0.5;
|
|
731
818
|
var FULL_OPACITY = 1;
|
|
732
819
|
var ROLE_REGION = "region";
|
|
733
|
-
var
|
|
820
|
+
var styles11 = reactNative.StyleSheet.create({
|
|
734
821
|
item: { borderTopWidth: reactNative.StyleSheet.hairlineWidth },
|
|
735
822
|
header: {
|
|
736
823
|
flexDirection: "row",
|
|
@@ -794,11 +881,11 @@ var AccordionItem = ({
|
|
|
794
881
|
);
|
|
795
882
|
const keyboardProps = reactNative.Platform.OS === "web" ? { onKeyDown: handleKeyDown2 } : {};
|
|
796
883
|
const itemStyle = React8.useMemo(
|
|
797
|
-
() => [
|
|
884
|
+
() => [styles11.item, { borderTopColor: colors.border }],
|
|
798
885
|
[colors.border]
|
|
799
886
|
);
|
|
800
887
|
const headerStyle = React8.useMemo(
|
|
801
|
-
() => [
|
|
888
|
+
() => [styles11.header, { opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY }],
|
|
802
889
|
[disabled]
|
|
803
890
|
);
|
|
804
891
|
const resolvedLabel = accessibilityLabel ?? (typeof title === "string" ? title : void 0);
|
|
@@ -818,15 +905,15 @@ var AccordionItem = ({
|
|
|
818
905
|
onPress: handlePress,
|
|
819
906
|
...keyboardProps,
|
|
820
907
|
children: [
|
|
821
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style:
|
|
822
|
-
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style:
|
|
908
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles11.headerLeft, children: typeof title === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles11.title, { color: colors.text }], children: title }) : title }),
|
|
909
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles11.headerRight, children: [
|
|
823
910
|
right,
|
|
824
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [
|
|
911
|
+
/* @__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
912
|
] })
|
|
826
913
|
]
|
|
827
914
|
}
|
|
828
915
|
),
|
|
829
|
-
expanded ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityLabel: resolvedLabel, nativeID: bodyTestID, role: ROLE_REGION, style:
|
|
916
|
+
expanded ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityLabel: resolvedLabel, nativeID: bodyTestID, role: ROLE_REGION, style: styles11.body, testID: bodyTestID, children }) : null
|
|
830
917
|
] });
|
|
831
918
|
};
|
|
832
919
|
|
|
@@ -839,6 +926,7 @@ exports.LAYOUT_TEST_IDS = LAYOUT_TEST_IDS;
|
|
|
839
926
|
exports.ModalDropdown = ModalDropdown;
|
|
840
927
|
exports.ModalShell = ModalShell;
|
|
841
928
|
exports.Section = Section;
|
|
929
|
+
exports.SegmentedControl = SegmentedControl;
|
|
842
930
|
exports.StatusBadge = StatusBadge;
|
|
843
931
|
exports.UpgradePrompt = UpgradePrompt;
|
|
844
932
|
exports.useFocusTrap = useFocusTrap;
|