@dloizides/ui-layout 1.44.0 → 1.46.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 +6 -0
- package/dist/index.d.mts +143 -46
- package/dist/index.d.ts +143 -46
- package/dist/index.js +365 -133
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +356 -135
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18,80 +18,6 @@ var React16__default = /*#__PURE__*/_interopDefault(React16);
|
|
|
18
18
|
|
|
19
19
|
// src/Section/Section.tsx
|
|
20
20
|
|
|
21
|
-
// src/Section/SectionVariant.ts
|
|
22
|
-
var SectionVariant = /* @__PURE__ */ ((SectionVariant2) => {
|
|
23
|
-
SectionVariant2["Panel"] = "panel";
|
|
24
|
-
SectionVariant2["Card"] = "card";
|
|
25
|
-
return SectionVariant2;
|
|
26
|
-
})(SectionVariant || {});
|
|
27
|
-
var styles = reactNative.StyleSheet.create({
|
|
28
|
-
card: {
|
|
29
|
-
padding: 16,
|
|
30
|
-
borderWidth: 1,
|
|
31
|
-
borderRadius: 6
|
|
32
|
-
},
|
|
33
|
-
raised: {
|
|
34
|
-
borderRadius: 12,
|
|
35
|
-
gap: 12
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
var Section = ({
|
|
39
|
-
children,
|
|
40
|
-
style,
|
|
41
|
-
variant = "panel" /* Panel */,
|
|
42
|
-
testID
|
|
43
|
-
}) => {
|
|
44
|
-
const { theme } = uiFeedback.useUi();
|
|
45
|
-
const isCard = variant === "card" /* Card */;
|
|
46
|
-
const fill = isCard ? theme.colors.background : theme.colors.surface;
|
|
47
|
-
const containerStyle = React16__default.default.useMemo(
|
|
48
|
-
() => [styles.card, isCard ? styles.raised : null, { borderColor: theme.colors.border, backgroundColor: fill }, style],
|
|
49
|
-
[theme.colors.border, fill, isCard, style]
|
|
50
|
-
);
|
|
51
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: containerStyle, testID, children });
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// src/AppText/TextKind.ts
|
|
55
|
-
var TextKind = /* @__PURE__ */ ((TextKind2) => {
|
|
56
|
-
TextKind2["Title"] = "title";
|
|
57
|
-
TextKind2["Heading"] = "heading";
|
|
58
|
-
TextKind2["Body"] = "body";
|
|
59
|
-
TextKind2["Strong"] = "strong";
|
|
60
|
-
TextKind2["Muted"] = "muted";
|
|
61
|
-
TextKind2["Small"] = "small";
|
|
62
|
-
return TextKind2;
|
|
63
|
-
})(TextKind || {});
|
|
64
|
-
var SIZES = {
|
|
65
|
-
["title" /* Title */]: { fontSize: 24, fontWeight: "700", lineHeight: 30 },
|
|
66
|
-
["heading" /* Heading */]: { fontSize: 17, fontWeight: "700", lineHeight: 24 },
|
|
67
|
-
["body" /* Body */]: { fontSize: 15, lineHeight: 22 },
|
|
68
|
-
["strong" /* Strong */]: { fontSize: 15, fontWeight: "700", lineHeight: 22 },
|
|
69
|
-
["muted" /* Muted */]: { fontSize: 14, lineHeight: 20 },
|
|
70
|
-
["small" /* Small */]: { fontSize: 12, lineHeight: 16 }
|
|
71
|
-
};
|
|
72
|
-
var AppText = ({
|
|
73
|
-
kind = "body" /* Body */,
|
|
74
|
-
color,
|
|
75
|
-
style,
|
|
76
|
-
testID,
|
|
77
|
-
children
|
|
78
|
-
}) => {
|
|
79
|
-
const { theme } = uiFeedback.useUi();
|
|
80
|
-
const quiet = kind === "muted" /* Muted */ || kind === "small" /* Small */;
|
|
81
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
82
|
-
reactNative.Text,
|
|
83
|
-
{
|
|
84
|
-
style: [
|
|
85
|
-
SIZES[kind],
|
|
86
|
-
{ color: color ?? (quiet ? theme.colors.textSecondary : theme.colors.text) },
|
|
87
|
-
style
|
|
88
|
-
],
|
|
89
|
-
testID,
|
|
90
|
-
children
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
21
|
// src/constants.ts
|
|
96
22
|
var LAYOUT_TEST_IDS = {
|
|
97
23
|
headingText: "heading-text",
|
|
@@ -182,34 +108,7 @@ var TYPE_SCALE_BREAKPOINT = 600;
|
|
|
182
108
|
var LAYOUT_COLLAPSE_BREAKPOINT = 768;
|
|
183
109
|
var HEADER_STACK_BREAKPOINT = 400;
|
|
184
110
|
var MIN_TARGET_PX = 44;
|
|
185
|
-
|
|
186
|
-
// src/responsive.ts
|
|
187
|
-
var WEB_PLATFORM = "web";
|
|
188
|
-
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
189
|
-
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
190
|
-
}
|
|
191
|
-
function isModalFooterStacked(width) {
|
|
192
|
-
return width < MODAL_FOOTER_STACK_BELOW;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// src/hooks/useIsWideViewport.ts
|
|
196
|
-
function useIsWideViewport(breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
197
|
-
const { width } = reactNative.useWindowDimensions();
|
|
198
|
-
return isWideWebViewport(width, reactNative.Platform.OS, breakpoint);
|
|
199
|
-
}
|
|
200
|
-
var styles2 = reactNative.StyleSheet.create({
|
|
201
|
-
outer: { alignItems: "center", width: "100%" },
|
|
202
|
-
column: { width: "100%", gap: 16 },
|
|
203
|
-
desktop: { paddingHorizontal: 32, paddingVertical: 24 },
|
|
204
|
-
mobile: { paddingHorizontal: 16, paddingVertical: 16 },
|
|
205
|
-
wide: { maxWidth: 1200 },
|
|
206
|
-
narrow: { maxWidth: 720 }
|
|
207
|
-
});
|
|
208
|
-
var ScreenColumn = ({ children, narrow = false }) => {
|
|
209
|
-
const isWide = useIsWideViewport();
|
|
210
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles2.outer, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles2.column, isWide ? styles2.desktop : styles2.mobile, narrow ? styles2.narrow : styles2.wide], children }) });
|
|
211
|
-
};
|
|
212
|
-
var styles3 = reactNative.StyleSheet.create({
|
|
111
|
+
var styles = reactNative.StyleSheet.create({
|
|
213
112
|
heading: {
|
|
214
113
|
fontWeight: "700",
|
|
215
114
|
fontSize: 16
|
|
@@ -225,7 +124,7 @@ var Heading = ({
|
|
|
225
124
|
}) => {
|
|
226
125
|
const { theme } = uiFeedback.useUi();
|
|
227
126
|
const headingStyle = React16__default.default.useMemo(
|
|
228
|
-
() => [
|
|
127
|
+
() => [styles.heading, { color: theme.colors.text }, style],
|
|
229
128
|
[theme.colors.text, style]
|
|
230
129
|
);
|
|
231
130
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -240,6 +139,115 @@ var Heading = ({
|
|
|
240
139
|
);
|
|
241
140
|
};
|
|
242
141
|
|
|
142
|
+
// src/Section/SectionVariant.ts
|
|
143
|
+
var SectionVariant = /* @__PURE__ */ ((SectionVariant2) => {
|
|
144
|
+
SectionVariant2["Panel"] = "panel";
|
|
145
|
+
SectionVariant2["Card"] = "card";
|
|
146
|
+
return SectionVariant2;
|
|
147
|
+
})(SectionVariant || {});
|
|
148
|
+
var styles2 = reactNative.StyleSheet.create({
|
|
149
|
+
card: {
|
|
150
|
+
padding: 16,
|
|
151
|
+
borderWidth: 1,
|
|
152
|
+
borderRadius: 6
|
|
153
|
+
},
|
|
154
|
+
raised: {
|
|
155
|
+
borderRadius: 12,
|
|
156
|
+
gap: 12
|
|
157
|
+
},
|
|
158
|
+
titled: {
|
|
159
|
+
gap: 12
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
var Section = ({
|
|
163
|
+
children,
|
|
164
|
+
style,
|
|
165
|
+
variant = "panel" /* Panel */,
|
|
166
|
+
title,
|
|
167
|
+
titleLevel,
|
|
168
|
+
testID
|
|
169
|
+
}) => {
|
|
170
|
+
const { theme } = uiFeedback.useUi();
|
|
171
|
+
const isCard = variant === "card" /* Card */;
|
|
172
|
+
const fill = isCard ? theme.colors.background : theme.colors.surface;
|
|
173
|
+
const containerStyle = React16__default.default.useMemo(
|
|
174
|
+
() => [styles2.card, isCard ? styles2.raised : null, title === void 0 ? null : styles2.titled, { borderColor: theme.colors.border, backgroundColor: fill }, style],
|
|
175
|
+
[theme.colors.border, fill, isCard, title, style]
|
|
176
|
+
);
|
|
177
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: containerStyle, testID, children: [
|
|
178
|
+
title === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(Heading, { level: titleLevel, testID: testID === void 0 ? void 0 : `${testID}-title`, text: title }),
|
|
179
|
+
children
|
|
180
|
+
] });
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
// src/AppText/TextKind.ts
|
|
184
|
+
var TextKind = /* @__PURE__ */ ((TextKind2) => {
|
|
185
|
+
TextKind2["Title"] = "title";
|
|
186
|
+
TextKind2["Heading"] = "heading";
|
|
187
|
+
TextKind2["Body"] = "body";
|
|
188
|
+
TextKind2["Strong"] = "strong";
|
|
189
|
+
TextKind2["Muted"] = "muted";
|
|
190
|
+
TextKind2["Small"] = "small";
|
|
191
|
+
return TextKind2;
|
|
192
|
+
})(TextKind || {});
|
|
193
|
+
var SIZES = {
|
|
194
|
+
["title" /* Title */]: { fontSize: 24, fontWeight: "700", lineHeight: 30 },
|
|
195
|
+
["heading" /* Heading */]: { fontSize: 17, fontWeight: "700", lineHeight: 24 },
|
|
196
|
+
["body" /* Body */]: { fontSize: 15, lineHeight: 22 },
|
|
197
|
+
["strong" /* Strong */]: { fontSize: 15, fontWeight: "700", lineHeight: 22 },
|
|
198
|
+
["muted" /* Muted */]: { fontSize: 14, lineHeight: 20 },
|
|
199
|
+
["small" /* Small */]: { fontSize: 12, lineHeight: 16 }
|
|
200
|
+
};
|
|
201
|
+
var AppText = ({
|
|
202
|
+
kind = "body" /* Body */,
|
|
203
|
+
color,
|
|
204
|
+
style,
|
|
205
|
+
testID,
|
|
206
|
+
children
|
|
207
|
+
}) => {
|
|
208
|
+
const { theme } = uiFeedback.useUi();
|
|
209
|
+
const quiet = kind === "muted" /* Muted */ || kind === "small" /* Small */;
|
|
210
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
211
|
+
reactNative.Text,
|
|
212
|
+
{
|
|
213
|
+
style: [
|
|
214
|
+
SIZES[kind],
|
|
215
|
+
{ color: color ?? (quiet ? theme.colors.textSecondary : theme.colors.text) },
|
|
216
|
+
style
|
|
217
|
+
],
|
|
218
|
+
testID,
|
|
219
|
+
children
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// src/responsive.ts
|
|
225
|
+
var WEB_PLATFORM = "web";
|
|
226
|
+
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
227
|
+
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
228
|
+
}
|
|
229
|
+
function isModalFooterStacked(width) {
|
|
230
|
+
return width < MODAL_FOOTER_STACK_BELOW;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// src/hooks/useIsWideViewport.ts
|
|
234
|
+
function useIsWideViewport(breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
235
|
+
const { width } = reactNative.useWindowDimensions();
|
|
236
|
+
return isWideWebViewport(width, reactNative.Platform.OS, breakpoint);
|
|
237
|
+
}
|
|
238
|
+
var styles3 = reactNative.StyleSheet.create({
|
|
239
|
+
outer: { alignItems: "center", width: "100%" },
|
|
240
|
+
column: { width: "100%", gap: 16 },
|
|
241
|
+
desktop: { paddingHorizontal: 32, paddingVertical: 24 },
|
|
242
|
+
mobile: { paddingHorizontal: 16, paddingVertical: 16 },
|
|
243
|
+
wide: { maxWidth: 1200 },
|
|
244
|
+
narrow: { maxWidth: 720 }
|
|
245
|
+
});
|
|
246
|
+
var ScreenColumn = ({ children, narrow = false }) => {
|
|
247
|
+
const isWide = useIsWideViewport();
|
|
248
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles3.outer, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles3.column, isWide ? styles3.desktop : styles3.mobile, narrow ? styles3.narrow : styles3.wide], children }) });
|
|
249
|
+
};
|
|
250
|
+
|
|
243
251
|
// src/StatusBadge/BadgeTone.ts
|
|
244
252
|
var BadgeTone = /* @__PURE__ */ ((BadgeTone2) => {
|
|
245
253
|
BadgeTone2["Neutral"] = "neutral";
|
|
@@ -405,7 +413,8 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
405
413
|
row: { flexDirection: "row", alignItems: "flex-start", width: "100%" },
|
|
406
414
|
column: { flexDirection: "column", width: "100%" },
|
|
407
415
|
sidePane: { flexBasis: 0, flexShrink: 1, minWidth: 0 },
|
|
408
|
-
stackPane: { width: "100%", minWidth: 0 }
|
|
416
|
+
stackPane: { width: "100%", minWidth: 0 },
|
|
417
|
+
fixedPane: { flexGrow: 0, flexShrink: 0, minWidth: 0 }
|
|
409
418
|
});
|
|
410
419
|
var SplitPanes = ({
|
|
411
420
|
start,
|
|
@@ -413,6 +422,7 @@ var SplitPanes = ({
|
|
|
413
422
|
layout = "auto" /* Auto */,
|
|
414
423
|
startWeight = DEFAULT_WEIGHT,
|
|
415
424
|
endWeight = DEFAULT_WEIGHT,
|
|
425
|
+
endWidth,
|
|
416
426
|
gap = DEFAULT_GAP,
|
|
417
427
|
breakpoint = LAYOUT_COLLAPSE_BREAKPOINT,
|
|
418
428
|
testID = LAYOUT_TEST_IDS.splitPanes
|
|
@@ -421,7 +431,8 @@ var SplitPanes = ({
|
|
|
421
431
|
const isSide = isSplitSideBySide(layout, width, breakpoint);
|
|
422
432
|
const container = React16.useMemo(() => [isSide ? styles6.row : styles6.column, { gap }], [isSide, gap]);
|
|
423
433
|
const startStyle = isSide ? [styles6.sidePane, { flexGrow: startWeight }] : styles6.stackPane;
|
|
424
|
-
const
|
|
434
|
+
const sideEnd = endWidth === void 0 ? [styles6.sidePane, { flexGrow: endWeight }] : [styles6.fixedPane, { width: endWidth }];
|
|
435
|
+
const endStyle = isSide ? sideEnd : styles6.stackPane;
|
|
425
436
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: container, testID, children: [
|
|
426
437
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: startStyle, testID: `${testID}-start`, children: start }),
|
|
427
438
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: endStyle, testID: `${testID}-end`, children: end })
|
|
@@ -875,6 +886,7 @@ var BORDER_WIDTH = 1;
|
|
|
875
886
|
var SEGMENT_BOX_SHADOW = "0px 1px 3px rgba(20, 30, 50, 0.1)";
|
|
876
887
|
var SHADOW_ELEVATION = 2;
|
|
877
888
|
var TRANSPARENT = "transparent";
|
|
889
|
+
var HINT_ID_FALLBACK = "segmented-control";
|
|
878
890
|
var styles10 = reactNative.StyleSheet.create({
|
|
879
891
|
track: {
|
|
880
892
|
flexDirection: "row",
|
|
@@ -910,40 +922,47 @@ function SegmentedControl({
|
|
|
910
922
|
value,
|
|
911
923
|
onChange,
|
|
912
924
|
accessibilityLabel,
|
|
925
|
+
accessibilityHint,
|
|
913
926
|
style,
|
|
914
927
|
testID
|
|
915
928
|
}) {
|
|
916
929
|
const { theme } = uiFeedback.useUi();
|
|
917
930
|
const { colors } = theme;
|
|
918
|
-
|
|
931
|
+
const { a11yProps, hintNode } = a11y.useA11y({ label: accessibilityLabel, hint: accessibilityHint, testID: testID ?? HINT_ID_FALLBACK });
|
|
932
|
+
const describedBy = accessibilityHint === void 0 ? {} : { "aria-describedby": a11yProps["aria-describedby"] };
|
|
933
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
919
934
|
reactNative.View,
|
|
920
935
|
{
|
|
921
936
|
accessibilityRole: "tablist",
|
|
922
937
|
"aria-label": accessibilityLabel,
|
|
938
|
+
...describedBy,
|
|
923
939
|
style: [styles10.track, { backgroundColor: colors.background, borderColor: colors.border }, style],
|
|
924
940
|
testID,
|
|
925
|
-
children:
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
941
|
+
children: [
|
|
942
|
+
options.map((opt) => {
|
|
943
|
+
const selected = opt.value === value;
|
|
944
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
945
|
+
reactNative.Pressable,
|
|
946
|
+
{
|
|
947
|
+
accessibilityRole: "tab",
|
|
948
|
+
accessibilityState: { selected },
|
|
949
|
+
accessibilityLabel: opt.accessibilityLabel ?? opt.label,
|
|
950
|
+
accessibilityHint: opt.accessibilityHint,
|
|
951
|
+
onPress: () => onChange(opt.value),
|
|
952
|
+
style: [
|
|
953
|
+
styles10.segment,
|
|
954
|
+
selected ? styles10.segmentSelected : null,
|
|
955
|
+
{ backgroundColor: selected ? colors.surface : TRANSPARENT }
|
|
956
|
+
],
|
|
957
|
+
testID: opt.testID,
|
|
958
|
+
...ariaSelectedProps(selected),
|
|
959
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles10.label, { color: selected ? colors.text : colors.textSecondary }], children: opt.label })
|
|
960
|
+
},
|
|
961
|
+
opt.value
|
|
962
|
+
);
|
|
963
|
+
}),
|
|
964
|
+
accessibilityHint === void 0 ? null : hintNode
|
|
965
|
+
]
|
|
947
966
|
}
|
|
948
967
|
);
|
|
949
968
|
}
|
|
@@ -2232,14 +2251,16 @@ var ConfirmDialog = ({
|
|
|
2232
2251
|
onCancel,
|
|
2233
2252
|
busy = false,
|
|
2234
2253
|
initialFocus = "cancel" /* Cancel */,
|
|
2235
|
-
testID = LAYOUT_TEST_IDS.confirmDialog
|
|
2254
|
+
testID = LAYOUT_TEST_IDS.confirmDialog,
|
|
2255
|
+
confirmTestID = `${testID}-confirm`,
|
|
2256
|
+
cancelTestID = `${testID}-cancel`
|
|
2236
2257
|
}) => {
|
|
2237
2258
|
const { theme, t } = uiFeedback.useUi();
|
|
2238
2259
|
const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);
|
|
2239
2260
|
const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);
|
|
2240
2261
|
const focusTestID = {
|
|
2241
|
-
["cancel" /* Cancel */]:
|
|
2242
|
-
["confirm" /* Confirm */]:
|
|
2262
|
+
["cancel" /* Cancel */]: cancelTestID,
|
|
2263
|
+
["confirm" /* Confirm */]: confirmTestID,
|
|
2243
2264
|
["none" /* None */]: testID
|
|
2244
2265
|
};
|
|
2245
2266
|
const footer = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -2250,7 +2271,7 @@ var ConfirmDialog = ({
|
|
|
2250
2271
|
accessibilityLabel: resolvedCancel,
|
|
2251
2272
|
disabled: busy,
|
|
2252
2273
|
label: resolvedCancel,
|
|
2253
|
-
testID:
|
|
2274
|
+
testID: cancelTestID,
|
|
2254
2275
|
variant: "secondary",
|
|
2255
2276
|
onPress: onCancel
|
|
2256
2277
|
}
|
|
@@ -2262,7 +2283,7 @@ var ConfirmDialog = ({
|
|
|
2262
2283
|
accessibilityLabel: resolvedConfirm,
|
|
2263
2284
|
label: resolvedConfirm,
|
|
2264
2285
|
loading: busy,
|
|
2265
|
-
testID:
|
|
2286
|
+
testID: confirmTestID,
|
|
2266
2287
|
variant: destructive ? "danger" : "primary",
|
|
2267
2288
|
onPress: onConfirm
|
|
2268
2289
|
}
|
|
@@ -3232,6 +3253,206 @@ var ListRow = ({
|
|
|
3232
3253
|
] });
|
|
3233
3254
|
};
|
|
3234
3255
|
|
|
3256
|
+
// src/SectionIndexLayout/ChipOverflow.ts
|
|
3257
|
+
var ChipOverflow = /* @__PURE__ */ ((ChipOverflow2) => {
|
|
3258
|
+
ChipOverflow2["Wrap"] = "wrap";
|
|
3259
|
+
ChipOverflow2["Scroll"] = "scroll";
|
|
3260
|
+
return ChipOverflow2;
|
|
3261
|
+
})(ChipOverflow || {});
|
|
3262
|
+
var styles28 = reactNative.StyleSheet.create({
|
|
3263
|
+
root: { flexDirection: "row", flexWrap: "wrap", gap: 8 },
|
|
3264
|
+
scrollRow: { flexDirection: "row", flexWrap: "nowrap", gap: 8 },
|
|
3265
|
+
chip: { minHeight: MIN_TARGET_PX, justifyContent: "center", paddingHorizontal: 14, borderRadius: 999, borderWidth: 1 },
|
|
3266
|
+
label: { fontSize: 14, fontWeight: "600" }
|
|
3267
|
+
});
|
|
3268
|
+
function ariaSelected(selected) {
|
|
3269
|
+
return { "aria-selected": selected };
|
|
3270
|
+
}
|
|
3271
|
+
var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wrap" /* Wrap */, onSelect, testID }) => {
|
|
3272
|
+
const { theme } = uiFeedback.useUi();
|
|
3273
|
+
const { colors } = theme;
|
|
3274
|
+
const scroll = overflow === "scroll" /* Scroll */;
|
|
3275
|
+
const row = /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { accessibilityRole: "tablist", accessibilityLabel: groupLabel, style: scroll ? styles28.scrollRow : styles28.root, testID: `${testID}-chips`, children: sections.map((entry) => {
|
|
3276
|
+
const active = entry.key === activeKey;
|
|
3277
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3278
|
+
reactNative.Pressable,
|
|
3279
|
+
{
|
|
3280
|
+
...ariaSelected(active),
|
|
3281
|
+
accessibilityRole: "tab",
|
|
3282
|
+
accessibilityLabel: entry.title,
|
|
3283
|
+
accessibilityHint: itemHint,
|
|
3284
|
+
style: [styles28.chip, { borderColor: colors.border, backgroundColor: active ? colors.text : colors.background }],
|
|
3285
|
+
testID: `${testID}-chip-${entry.key}`,
|
|
3286
|
+
onPress: () => onSelect(entry.key),
|
|
3287
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles28.label, { color: active ? colors.background : colors.text }], children: entry.title })
|
|
3288
|
+
},
|
|
3289
|
+
entry.key
|
|
3290
|
+
);
|
|
3291
|
+
}) });
|
|
3292
|
+
return scroll ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: row }) : row;
|
|
3293
|
+
};
|
|
3294
|
+
|
|
3295
|
+
// src/SectionIndexLayout/SectionDensity.ts
|
|
3296
|
+
var SectionDensity = /* @__PURE__ */ ((SectionDensity2) => {
|
|
3297
|
+
SectionDensity2["Comfortable"] = "comfortable";
|
|
3298
|
+
SectionDensity2["Dense"] = "dense";
|
|
3299
|
+
return SectionDensity2;
|
|
3300
|
+
})(SectionDensity || {});
|
|
3301
|
+
var INDEX_WIDTH = 200;
|
|
3302
|
+
var ACTIVE_BAR = 3;
|
|
3303
|
+
var TRANSPARENT3 = "transparent";
|
|
3304
|
+
var styles29 = reactNative.StyleSheet.create({
|
|
3305
|
+
root: { width: INDEX_WIDTH, flexShrink: 0, gap: 2, alignSelf: "flex-start" },
|
|
3306
|
+
heading: { fontSize: 12, fontWeight: "700", letterSpacing: 0.6, textTransform: "uppercase", paddingHorizontal: 10, paddingBottom: 6 },
|
|
3307
|
+
item: { minHeight: MIN_TARGET_PX, justifyContent: "center", paddingHorizontal: 10, borderLeftWidth: ACTIVE_BAR, borderRadius: 6 },
|
|
3308
|
+
label: { fontSize: 14 },
|
|
3309
|
+
labelActive: { fontWeight: "700" }
|
|
3310
|
+
});
|
|
3311
|
+
function ariaCurrent(active) {
|
|
3312
|
+
return active ? { "aria-current": "location" } : {};
|
|
3313
|
+
}
|
|
3314
|
+
var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID }) => {
|
|
3315
|
+
const { theme } = uiFeedback.useUi();
|
|
3316
|
+
const { colors } = theme;
|
|
3317
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { role: "navigation", accessibilityLabel: heading, style: styles29.root, testID: `${testID}-index`, children: [
|
|
3318
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles29.heading, { color: colors.textSecondary }], children: heading }),
|
|
3319
|
+
sections.map((entry) => {
|
|
3320
|
+
const active = entry.key === activeKey;
|
|
3321
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3322
|
+
reactNative.Pressable,
|
|
3323
|
+
{
|
|
3324
|
+
...ariaCurrent(active),
|
|
3325
|
+
accessibilityRole: "link",
|
|
3326
|
+
accessibilityLabel: entry.title,
|
|
3327
|
+
accessibilityHint: itemHint,
|
|
3328
|
+
style: [styles29.item, { borderLeftColor: active ? colors.text : TRANSPARENT3, backgroundColor: active ? colors.surface : TRANSPARENT3 }],
|
|
3329
|
+
testID: `${testID}-index-${entry.key}`,
|
|
3330
|
+
onPress: () => onSelect(entry.key),
|
|
3331
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles29.label, active && styles29.labelActive, { color: active ? colors.text : colors.textSecondary }], children: entry.title })
|
|
3332
|
+
},
|
|
3333
|
+
entry.key
|
|
3334
|
+
);
|
|
3335
|
+
})
|
|
3336
|
+
] });
|
|
3337
|
+
};
|
|
3338
|
+
|
|
3339
|
+
// src/SectionIndexLayout/sectionKeys.ts
|
|
3340
|
+
var SECTION_INDEX_BREAKPOINT = 1024;
|
|
3341
|
+
function resolveActiveKey(sections, wanted) {
|
|
3342
|
+
const match = sections.find((entry) => entry.key === wanted);
|
|
3343
|
+
if (match !== void 0) return match.key;
|
|
3344
|
+
return sections[0]?.key ?? "";
|
|
3345
|
+
}
|
|
3346
|
+
function sectionAnchorId(testID, key) {
|
|
3347
|
+
return `${testID}-section-${key}`;
|
|
3348
|
+
}
|
|
3349
|
+
function scrollToSection(anchorId) {
|
|
3350
|
+
if (typeof document === "undefined") return;
|
|
3351
|
+
const target = document.getElementById(anchorId);
|
|
3352
|
+
target?.scrollIntoView?.({ behavior: "smooth", block: "start" });
|
|
3353
|
+
}
|
|
3354
|
+
var COMFORTABLE_GAP = 12;
|
|
3355
|
+
var DENSE_GAP = 8;
|
|
3356
|
+
var WEB_STICKY = { position: "sticky", top: 0 };
|
|
3357
|
+
var styles30 = reactNative.StyleSheet.create({
|
|
3358
|
+
wide: { flexDirection: "row", alignItems: "flex-start", gap: 20 },
|
|
3359
|
+
column: { flex: 1, minWidth: 0 }
|
|
3360
|
+
});
|
|
3361
|
+
var SectionIndexLayout = ({
|
|
3362
|
+
sections,
|
|
3363
|
+
indexHeading,
|
|
3364
|
+
itemHint,
|
|
3365
|
+
initialKey,
|
|
3366
|
+
breakpoint = SECTION_INDEX_BREAKPOINT,
|
|
3367
|
+
density = "comfortable" /* Comfortable */,
|
|
3368
|
+
stickyIndex = false,
|
|
3369
|
+
chipOverflow = "wrap" /* Wrap */,
|
|
3370
|
+
testID = "section-index"
|
|
3371
|
+
}) => {
|
|
3372
|
+
const wide = useIsWideViewport(breakpoint);
|
|
3373
|
+
const [picked, setPicked] = React16.useState(initialKey);
|
|
3374
|
+
const activeKey = resolveActiveKey(sections, picked);
|
|
3375
|
+
const gap = { gap: density === "dense" /* Dense */ ? DENSE_GAP : COMFORTABLE_GAP };
|
|
3376
|
+
if (sections.length < 2) return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { testID, children: sections[0]?.content });
|
|
3377
|
+
if (!wide) {
|
|
3378
|
+
const active = sections.find((entry) => entry.key === activeKey);
|
|
3379
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: gap, testID, children: [
|
|
3380
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3381
|
+
SectionChips,
|
|
3382
|
+
{
|
|
3383
|
+
activeKey,
|
|
3384
|
+
groupLabel: indexHeading,
|
|
3385
|
+
itemHint,
|
|
3386
|
+
overflow: chipOverflow,
|
|
3387
|
+
sections,
|
|
3388
|
+
testID,
|
|
3389
|
+
onSelect: setPicked
|
|
3390
|
+
}
|
|
3391
|
+
),
|
|
3392
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { nativeID: sectionAnchorId(testID, activeKey), testID: sectionAnchorId(testID, activeKey), children: active?.content })
|
|
3393
|
+
] });
|
|
3394
|
+
}
|
|
3395
|
+
const select = (key) => {
|
|
3396
|
+
setPicked(key);
|
|
3397
|
+
scrollToSection(sectionAnchorId(testID, key));
|
|
3398
|
+
};
|
|
3399
|
+
const sticky = stickyIndex && reactNative.Platform.OS === "web" ? WEB_STICKY : null;
|
|
3400
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles30.wide, testID, children: [
|
|
3401
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: sticky, children: /* @__PURE__ */ jsxRuntime.jsx(SectionIndex, { activeKey, heading: indexHeading, itemHint, sections, testID, onSelect: select }) }),
|
|
3402
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles30.column, gap], children: sections.map((entry) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { nativeID: sectionAnchorId(testID, entry.key), testID: sectionAnchorId(testID, entry.key), children: entry.content }, entry.key)) })
|
|
3403
|
+
] });
|
|
3404
|
+
};
|
|
3405
|
+
var PILL_RADIUS2 = 999;
|
|
3406
|
+
var styles31 = reactNative.StyleSheet.create({
|
|
3407
|
+
body: { borderRadius: 8, borderWidth: 1, overflow: "hidden" },
|
|
3408
|
+
count: { borderRadius: PILL_RADIUS2, borderWidth: 1, fontSize: 12, fontWeight: "700", paddingHorizontal: 8 },
|
|
3409
|
+
head: { alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: 8 },
|
|
3410
|
+
label: { fontSize: 13, fontWeight: "600" },
|
|
3411
|
+
stack: { gap: 6 }
|
|
3412
|
+
});
|
|
3413
|
+
var DayCard = ({
|
|
3414
|
+
label,
|
|
3415
|
+
badge,
|
|
3416
|
+
count,
|
|
3417
|
+
accessibilityLabel,
|
|
3418
|
+
accessibilityHint,
|
|
3419
|
+
badgeTone = "warning" /* Warning */,
|
|
3420
|
+
testID,
|
|
3421
|
+
children
|
|
3422
|
+
}) => {
|
|
3423
|
+
const { theme } = uiFeedback.useUi();
|
|
3424
|
+
const { colors } = theme;
|
|
3425
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles31.stack, testID, children: [
|
|
3426
|
+
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { accessibilityHint, accessibilityLabel, accessibilityRole: "header", style: styles31.head, children: [
|
|
3427
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles31.label, { color: colors.text }], children: label }),
|
|
3428
|
+
/* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { label: badge, tone: badgeTone }),
|
|
3429
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles31.count, { borderColor: colors.border, color: colors.textSecondary }], children: String(count) })
|
|
3430
|
+
] }),
|
|
3431
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles31.body, { backgroundColor: colors.surface, borderColor: colors.border }], children })
|
|
3432
|
+
] });
|
|
3433
|
+
};
|
|
3434
|
+
var styles32 = reactNative.StyleSheet.create({
|
|
3435
|
+
full: { flexBasis: "100%" },
|
|
3436
|
+
half: { flexBasis: "45%", flexGrow: 1, minWidth: 0 },
|
|
3437
|
+
strip: { flexDirection: "row", flexWrap: "wrap", gap: 12 }
|
|
3438
|
+
});
|
|
3439
|
+
function figureCell(wide, span = 1) {
|
|
3440
|
+
if (wide) return { flexBasis: 0, flexGrow: span, minWidth: 0 };
|
|
3441
|
+
return span > 1 ? styles32.full : styles32.half;
|
|
3442
|
+
}
|
|
3443
|
+
var FigureStrip = ({ children, testID }) => /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles32.strip, testID, children });
|
|
3444
|
+
var styles33 = reactNative.StyleSheet.create({
|
|
3445
|
+
stack: { gap: 12 }
|
|
3446
|
+
});
|
|
3447
|
+
var ToggleSection = ({ wide, title, toggleLabel, toggleHint, forceOpen = false, testID, children }) => {
|
|
3448
|
+
const [open, setOpen] = React16.useState(false);
|
|
3449
|
+
if (wide) return /* @__PURE__ */ jsxRuntime.jsx(Section, { testID: `${testID}-card`, title, variant: "card" /* Card */, children });
|
|
3450
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles33.stack, children: [
|
|
3451
|
+
/* @__PURE__ */ jsxRuntime.jsx(uiButtons.Button, { accessibilityHint: toggleHint, accessibilityLabel: toggleLabel, label: toggleLabel, testID: `${testID}-toggle`, variant: "outline", onPress: () => setOpen((current) => !current) }),
|
|
3452
|
+
open || forceOpen ? children : null
|
|
3453
|
+
] });
|
|
3454
|
+
};
|
|
3455
|
+
|
|
3235
3456
|
exports.A4_PAGE = A4_PAGE;
|
|
3236
3457
|
exports.API_COMMIT_SEPARATOR = API_COMMIT_SEPARATOR;
|
|
3237
3458
|
exports.Accordion = Accordion;
|
|
@@ -3242,14 +3463,17 @@ exports.BadgeTone = BadgeTone;
|
|
|
3242
3463
|
exports.BottomSheet = BottomSheet;
|
|
3243
3464
|
exports.BuildInfoFooter = BuildInfoFooter;
|
|
3244
3465
|
exports.COPY_FEEDBACK_MS = COPY_FEEDBACK_MS;
|
|
3466
|
+
exports.ChipOverflow = ChipOverflow;
|
|
3245
3467
|
exports.ConfirmDialog = ConfirmDialog;
|
|
3246
3468
|
exports.ConfirmDialogFocus = ConfirmDialogFocus;
|
|
3247
3469
|
exports.CopyStatus = CopyStatus;
|
|
3248
3470
|
exports.CopyableId = CopyableId;
|
|
3249
3471
|
exports.CountBadge = CountBadge;
|
|
3250
3472
|
exports.DEFAULT_BILLING_ROUTE = DEFAULT_BILLING_ROUTE;
|
|
3473
|
+
exports.DayCard = DayCard;
|
|
3251
3474
|
exports.DropdownVariant = DropdownVariant;
|
|
3252
3475
|
exports.ELLIPSIS = ELLIPSIS;
|
|
3476
|
+
exports.FigureStrip = FigureStrip;
|
|
3253
3477
|
exports.FormDialog = FormDialog;
|
|
3254
3478
|
exports.HEADER_STACK_BREAKPOINT = HEADER_STACK_BREAKPOINT;
|
|
3255
3479
|
exports.Heading = Heading;
|
|
@@ -3264,8 +3488,13 @@ exports.ModalDropdown = ModalDropdown;
|
|
|
3264
3488
|
exports.ModalShell = ModalShell;
|
|
3265
3489
|
exports.PageFrame = PageFrame;
|
|
3266
3490
|
exports.RowSelectedStyle = RowSelectedStyle;
|
|
3491
|
+
exports.SECTION_INDEX_BREAKPOINT = SECTION_INDEX_BREAKPOINT;
|
|
3267
3492
|
exports.ScreenColumn = ScreenColumn;
|
|
3268
3493
|
exports.Section = Section;
|
|
3494
|
+
exports.SectionChips = SectionChips;
|
|
3495
|
+
exports.SectionDensity = SectionDensity;
|
|
3496
|
+
exports.SectionIndex = SectionIndex;
|
|
3497
|
+
exports.SectionIndexLayout = SectionIndexLayout;
|
|
3269
3498
|
exports.SectionVariant = SectionVariant;
|
|
3270
3499
|
exports.SegmentedControl = SegmentedControl;
|
|
3271
3500
|
exports.SelectedMarker = SelectedMarker;
|
|
@@ -3278,9 +3507,11 @@ exports.TYPE_SCALE_BREAKPOINT = TYPE_SCALE_BREAKPOINT;
|
|
|
3278
3507
|
exports.Tabs = Tabs;
|
|
3279
3508
|
exports.TabsCollapsedTrigger = TabsCollapsedTrigger;
|
|
3280
3509
|
exports.TextKind = TextKind;
|
|
3510
|
+
exports.ToggleSection = ToggleSection;
|
|
3281
3511
|
exports.TruncatedText = TruncatedText;
|
|
3282
3512
|
exports.UpgradePrompt = UpgradePrompt;
|
|
3283
3513
|
exports.copyText = copyText;
|
|
3514
|
+
exports.figureCell = figureCell;
|
|
3284
3515
|
exports.formatBuildInfo = formatBuildInfo;
|
|
3285
3516
|
exports.formatCount = formatCount;
|
|
3286
3517
|
exports.formatUrlForDisplay = formatUrlForDisplay;
|
|
@@ -3289,6 +3520,7 @@ exports.isModalFooterStacked = isModalFooterStacked;
|
|
|
3289
3520
|
exports.isSplitSideBySide = isSplitSideBySide;
|
|
3290
3521
|
exports.isWideWebViewport = isWideWebViewport;
|
|
3291
3522
|
exports.pageScale = pageScale;
|
|
3523
|
+
exports.resolveActiveKey = resolveActiveKey;
|
|
3292
3524
|
exports.resolveRowLook = resolveRowLook;
|
|
3293
3525
|
exports.resolveToneColors = resolveToneColors;
|
|
3294
3526
|
exports.scaledFrame = scaledFrame;
|