@dloizides/ui-layout 1.45.0 → 1.47.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 +156 -45
- package/dist/index.d.ts +156 -45
- package/dist/index.js +387 -128
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +377 -130
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React16, { createContext, useMemo, useState, useRef, useEffect, useCallback, useContext, useLayoutEffect } from 'react';
|
|
2
|
-
import { StyleSheet, Platform,
|
|
2
|
+
import { StyleSheet, Platform, Text, View, useWindowDimensions, Modal as Modal$1, Animated, ScrollView, TouchableOpacity, Pressable, FlatList, Easing } from 'react-native';
|
|
3
3
|
import { MODAL_OVERLAY_COLOR, useUi } from '@dloizides/ui-feedback';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { Z_INDEX, UI_MAIN_STEP, UI_DEEP_STEP, isHexColor, canCarryAccessibleInk, resolveOnBrand } from '@dloizides/design-tokens';
|
|
@@ -12,80 +12,6 @@ import { useReducedMotion } from '@dloizides/rn-web-hooks';
|
|
|
12
12
|
|
|
13
13
|
// src/Section/Section.tsx
|
|
14
14
|
|
|
15
|
-
// src/Section/SectionVariant.ts
|
|
16
|
-
var SectionVariant = /* @__PURE__ */ ((SectionVariant2) => {
|
|
17
|
-
SectionVariant2["Panel"] = "panel";
|
|
18
|
-
SectionVariant2["Card"] = "card";
|
|
19
|
-
return SectionVariant2;
|
|
20
|
-
})(SectionVariant || {});
|
|
21
|
-
var styles = StyleSheet.create({
|
|
22
|
-
card: {
|
|
23
|
-
padding: 16,
|
|
24
|
-
borderWidth: 1,
|
|
25
|
-
borderRadius: 6
|
|
26
|
-
},
|
|
27
|
-
raised: {
|
|
28
|
-
borderRadius: 12,
|
|
29
|
-
gap: 12
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
var Section = ({
|
|
33
|
-
children,
|
|
34
|
-
style,
|
|
35
|
-
variant = "panel" /* Panel */,
|
|
36
|
-
testID
|
|
37
|
-
}) => {
|
|
38
|
-
const { theme } = useUi();
|
|
39
|
-
const isCard = variant === "card" /* Card */;
|
|
40
|
-
const fill = isCard ? theme.colors.background : theme.colors.surface;
|
|
41
|
-
const containerStyle = React16.useMemo(
|
|
42
|
-
() => [styles.card, isCard ? styles.raised : null, { borderColor: theme.colors.border, backgroundColor: fill }, style],
|
|
43
|
-
[theme.colors.border, fill, isCard, style]
|
|
44
|
-
);
|
|
45
|
-
return /* @__PURE__ */ jsx(View, { style: containerStyle, testID, children });
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// src/AppText/TextKind.ts
|
|
49
|
-
var TextKind = /* @__PURE__ */ ((TextKind2) => {
|
|
50
|
-
TextKind2["Title"] = "title";
|
|
51
|
-
TextKind2["Heading"] = "heading";
|
|
52
|
-
TextKind2["Body"] = "body";
|
|
53
|
-
TextKind2["Strong"] = "strong";
|
|
54
|
-
TextKind2["Muted"] = "muted";
|
|
55
|
-
TextKind2["Small"] = "small";
|
|
56
|
-
return TextKind2;
|
|
57
|
-
})(TextKind || {});
|
|
58
|
-
var SIZES = {
|
|
59
|
-
["title" /* Title */]: { fontSize: 24, fontWeight: "700", lineHeight: 30 },
|
|
60
|
-
["heading" /* Heading */]: { fontSize: 17, fontWeight: "700", lineHeight: 24 },
|
|
61
|
-
["body" /* Body */]: { fontSize: 15, lineHeight: 22 },
|
|
62
|
-
["strong" /* Strong */]: { fontSize: 15, fontWeight: "700", lineHeight: 22 },
|
|
63
|
-
["muted" /* Muted */]: { fontSize: 14, lineHeight: 20 },
|
|
64
|
-
["small" /* Small */]: { fontSize: 12, lineHeight: 16 }
|
|
65
|
-
};
|
|
66
|
-
var AppText = ({
|
|
67
|
-
kind = "body" /* Body */,
|
|
68
|
-
color,
|
|
69
|
-
style,
|
|
70
|
-
testID,
|
|
71
|
-
children
|
|
72
|
-
}) => {
|
|
73
|
-
const { theme } = useUi();
|
|
74
|
-
const quiet = kind === "muted" /* Muted */ || kind === "small" /* Small */;
|
|
75
|
-
return /* @__PURE__ */ jsx(
|
|
76
|
-
Text,
|
|
77
|
-
{
|
|
78
|
-
style: [
|
|
79
|
-
SIZES[kind],
|
|
80
|
-
{ color: color ?? (quiet ? theme.colors.textSecondary : theme.colors.text) },
|
|
81
|
-
style
|
|
82
|
-
],
|
|
83
|
-
testID,
|
|
84
|
-
children
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
15
|
// src/constants.ts
|
|
90
16
|
var LAYOUT_TEST_IDS = {
|
|
91
17
|
headingText: "heading-text",
|
|
@@ -176,34 +102,7 @@ var TYPE_SCALE_BREAKPOINT = 600;
|
|
|
176
102
|
var LAYOUT_COLLAPSE_BREAKPOINT = 768;
|
|
177
103
|
var HEADER_STACK_BREAKPOINT = 400;
|
|
178
104
|
var MIN_TARGET_PX = 44;
|
|
179
|
-
|
|
180
|
-
// src/responsive.ts
|
|
181
|
-
var WEB_PLATFORM = "web";
|
|
182
|
-
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
183
|
-
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
184
|
-
}
|
|
185
|
-
function isModalFooterStacked(width) {
|
|
186
|
-
return width < MODAL_FOOTER_STACK_BELOW;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// src/hooks/useIsWideViewport.ts
|
|
190
|
-
function useIsWideViewport(breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
191
|
-
const { width } = useWindowDimensions();
|
|
192
|
-
return isWideWebViewport(width, Platform.OS, breakpoint);
|
|
193
|
-
}
|
|
194
|
-
var styles2 = StyleSheet.create({
|
|
195
|
-
outer: { alignItems: "center", width: "100%" },
|
|
196
|
-
column: { width: "100%", gap: 16 },
|
|
197
|
-
desktop: { paddingHorizontal: 32, paddingVertical: 24 },
|
|
198
|
-
mobile: { paddingHorizontal: 16, paddingVertical: 16 },
|
|
199
|
-
wide: { maxWidth: 1200 },
|
|
200
|
-
narrow: { maxWidth: 720 }
|
|
201
|
-
});
|
|
202
|
-
var ScreenColumn = ({ children, narrow = false }) => {
|
|
203
|
-
const isWide = useIsWideViewport();
|
|
204
|
-
return /* @__PURE__ */ jsx(View, { style: styles2.outer, children: /* @__PURE__ */ jsx(View, { style: [styles2.column, isWide ? styles2.desktop : styles2.mobile, narrow ? styles2.narrow : styles2.wide], children }) });
|
|
205
|
-
};
|
|
206
|
-
var styles3 = StyleSheet.create({
|
|
105
|
+
var styles = StyleSheet.create({
|
|
207
106
|
heading: {
|
|
208
107
|
fontWeight: "700",
|
|
209
108
|
fontSize: 16
|
|
@@ -219,7 +118,7 @@ var Heading = ({
|
|
|
219
118
|
}) => {
|
|
220
119
|
const { theme } = useUi();
|
|
221
120
|
const headingStyle = React16.useMemo(
|
|
222
|
-
() => [
|
|
121
|
+
() => [styles.heading, { color: theme.colors.text }, style],
|
|
223
122
|
[theme.colors.text, style]
|
|
224
123
|
);
|
|
225
124
|
return /* @__PURE__ */ jsx(
|
|
@@ -234,6 +133,115 @@ var Heading = ({
|
|
|
234
133
|
);
|
|
235
134
|
};
|
|
236
135
|
|
|
136
|
+
// src/Section/SectionVariant.ts
|
|
137
|
+
var SectionVariant = /* @__PURE__ */ ((SectionVariant2) => {
|
|
138
|
+
SectionVariant2["Panel"] = "panel";
|
|
139
|
+
SectionVariant2["Card"] = "card";
|
|
140
|
+
return SectionVariant2;
|
|
141
|
+
})(SectionVariant || {});
|
|
142
|
+
var styles2 = StyleSheet.create({
|
|
143
|
+
card: {
|
|
144
|
+
padding: 16,
|
|
145
|
+
borderWidth: 1,
|
|
146
|
+
borderRadius: 6
|
|
147
|
+
},
|
|
148
|
+
raised: {
|
|
149
|
+
borderRadius: 12,
|
|
150
|
+
gap: 12
|
|
151
|
+
},
|
|
152
|
+
titled: {
|
|
153
|
+
gap: 12
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
var Section = ({
|
|
157
|
+
children,
|
|
158
|
+
style,
|
|
159
|
+
variant = "panel" /* Panel */,
|
|
160
|
+
title,
|
|
161
|
+
titleLevel,
|
|
162
|
+
testID
|
|
163
|
+
}) => {
|
|
164
|
+
const { theme } = useUi();
|
|
165
|
+
const isCard = variant === "card" /* Card */;
|
|
166
|
+
const fill = isCard ? theme.colors.background : theme.colors.surface;
|
|
167
|
+
const containerStyle = React16.useMemo(
|
|
168
|
+
() => [styles2.card, isCard ? styles2.raised : null, title === void 0 ? null : styles2.titled, { borderColor: theme.colors.border, backgroundColor: fill }, style],
|
|
169
|
+
[theme.colors.border, fill, isCard, title, style]
|
|
170
|
+
);
|
|
171
|
+
return /* @__PURE__ */ jsxs(View, { style: containerStyle, testID, children: [
|
|
172
|
+
title === void 0 ? null : /* @__PURE__ */ jsx(Heading, { level: titleLevel, testID: testID === void 0 ? void 0 : `${testID}-title`, text: title }),
|
|
173
|
+
children
|
|
174
|
+
] });
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// src/AppText/TextKind.ts
|
|
178
|
+
var TextKind = /* @__PURE__ */ ((TextKind2) => {
|
|
179
|
+
TextKind2["Title"] = "title";
|
|
180
|
+
TextKind2["Heading"] = "heading";
|
|
181
|
+
TextKind2["Body"] = "body";
|
|
182
|
+
TextKind2["Strong"] = "strong";
|
|
183
|
+
TextKind2["Muted"] = "muted";
|
|
184
|
+
TextKind2["Small"] = "small";
|
|
185
|
+
return TextKind2;
|
|
186
|
+
})(TextKind || {});
|
|
187
|
+
var SIZES = {
|
|
188
|
+
["title" /* Title */]: { fontSize: 24, fontWeight: "700", lineHeight: 30 },
|
|
189
|
+
["heading" /* Heading */]: { fontSize: 17, fontWeight: "700", lineHeight: 24 },
|
|
190
|
+
["body" /* Body */]: { fontSize: 15, lineHeight: 22 },
|
|
191
|
+
["strong" /* Strong */]: { fontSize: 15, fontWeight: "700", lineHeight: 22 },
|
|
192
|
+
["muted" /* Muted */]: { fontSize: 14, lineHeight: 20 },
|
|
193
|
+
["small" /* Small */]: { fontSize: 12, lineHeight: 16 }
|
|
194
|
+
};
|
|
195
|
+
var AppText = ({
|
|
196
|
+
kind = "body" /* Body */,
|
|
197
|
+
color,
|
|
198
|
+
style,
|
|
199
|
+
testID,
|
|
200
|
+
children
|
|
201
|
+
}) => {
|
|
202
|
+
const { theme } = useUi();
|
|
203
|
+
const quiet = kind === "muted" /* Muted */ || kind === "small" /* Small */;
|
|
204
|
+
return /* @__PURE__ */ jsx(
|
|
205
|
+
Text,
|
|
206
|
+
{
|
|
207
|
+
style: [
|
|
208
|
+
SIZES[kind],
|
|
209
|
+
{ color: color ?? (quiet ? theme.colors.textSecondary : theme.colors.text) },
|
|
210
|
+
style
|
|
211
|
+
],
|
|
212
|
+
testID,
|
|
213
|
+
children
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
// src/responsive.ts
|
|
219
|
+
var WEB_PLATFORM = "web";
|
|
220
|
+
function isWideWebViewport(width, platformOS, breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
221
|
+
return platformOS === WEB_PLATFORM && width >= breakpoint;
|
|
222
|
+
}
|
|
223
|
+
function isModalFooterStacked(width) {
|
|
224
|
+
return width < MODAL_FOOTER_STACK_BELOW;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// src/hooks/useIsWideViewport.ts
|
|
228
|
+
function useIsWideViewport(breakpoint = LAYOUT_COLLAPSE_BREAKPOINT) {
|
|
229
|
+
const { width } = useWindowDimensions();
|
|
230
|
+
return isWideWebViewport(width, Platform.OS, breakpoint);
|
|
231
|
+
}
|
|
232
|
+
var styles3 = StyleSheet.create({
|
|
233
|
+
outer: { alignItems: "center", width: "100%" },
|
|
234
|
+
column: { width: "100%", gap: 16 },
|
|
235
|
+
desktop: { paddingHorizontal: 32, paddingVertical: 24 },
|
|
236
|
+
mobile: { paddingHorizontal: 16, paddingVertical: 16 },
|
|
237
|
+
wide: { maxWidth: 1200 },
|
|
238
|
+
narrow: { maxWidth: 720 }
|
|
239
|
+
});
|
|
240
|
+
var ScreenColumn = ({ children, narrow = false }) => {
|
|
241
|
+
const isWide = useIsWideViewport();
|
|
242
|
+
return /* @__PURE__ */ jsx(View, { style: styles3.outer, children: /* @__PURE__ */ jsx(View, { style: [styles3.column, isWide ? styles3.desktop : styles3.mobile, narrow ? styles3.narrow : styles3.wide], children }) });
|
|
243
|
+
};
|
|
244
|
+
|
|
237
245
|
// src/StatusBadge/BadgeTone.ts
|
|
238
246
|
var BadgeTone = /* @__PURE__ */ ((BadgeTone2) => {
|
|
239
247
|
BadgeTone2["Neutral"] = "neutral";
|
|
@@ -399,7 +407,8 @@ var styles6 = StyleSheet.create({
|
|
|
399
407
|
row: { flexDirection: "row", alignItems: "flex-start", width: "100%" },
|
|
400
408
|
column: { flexDirection: "column", width: "100%" },
|
|
401
409
|
sidePane: { flexBasis: 0, flexShrink: 1, minWidth: 0 },
|
|
402
|
-
stackPane: { width: "100%", minWidth: 0 }
|
|
410
|
+
stackPane: { width: "100%", minWidth: 0 },
|
|
411
|
+
fixedPane: { flexGrow: 0, flexShrink: 0, minWidth: 0 }
|
|
403
412
|
});
|
|
404
413
|
var SplitPanes = ({
|
|
405
414
|
start,
|
|
@@ -407,6 +416,7 @@ var SplitPanes = ({
|
|
|
407
416
|
layout = "auto" /* Auto */,
|
|
408
417
|
startWeight = DEFAULT_WEIGHT,
|
|
409
418
|
endWeight = DEFAULT_WEIGHT,
|
|
419
|
+
endWidth,
|
|
410
420
|
gap = DEFAULT_GAP,
|
|
411
421
|
breakpoint = LAYOUT_COLLAPSE_BREAKPOINT,
|
|
412
422
|
testID = LAYOUT_TEST_IDS.splitPanes
|
|
@@ -415,7 +425,8 @@ var SplitPanes = ({
|
|
|
415
425
|
const isSide = isSplitSideBySide(layout, width, breakpoint);
|
|
416
426
|
const container = useMemo(() => [isSide ? styles6.row : styles6.column, { gap }], [isSide, gap]);
|
|
417
427
|
const startStyle = isSide ? [styles6.sidePane, { flexGrow: startWeight }] : styles6.stackPane;
|
|
418
|
-
const
|
|
428
|
+
const sideEnd = endWidth === void 0 ? [styles6.sidePane, { flexGrow: endWeight }] : [styles6.fixedPane, { width: endWidth }];
|
|
429
|
+
const endStyle = isSide ? sideEnd : styles6.stackPane;
|
|
419
430
|
return /* @__PURE__ */ jsxs(View, { style: container, testID, children: [
|
|
420
431
|
/* @__PURE__ */ jsx(View, { style: startStyle, testID: `${testID}-start`, children: start }),
|
|
421
432
|
/* @__PURE__ */ jsx(View, { style: endStyle, testID: `${testID}-end`, children: end })
|
|
@@ -869,6 +880,7 @@ var BORDER_WIDTH = 1;
|
|
|
869
880
|
var SEGMENT_BOX_SHADOW = "0px 1px 3px rgba(20, 30, 50, 0.1)";
|
|
870
881
|
var SHADOW_ELEVATION = 2;
|
|
871
882
|
var TRANSPARENT = "transparent";
|
|
883
|
+
var HINT_ID_FALLBACK = "segmented-control";
|
|
872
884
|
var styles10 = StyleSheet.create({
|
|
873
885
|
track: {
|
|
874
886
|
flexDirection: "row",
|
|
@@ -904,40 +916,47 @@ function SegmentedControl({
|
|
|
904
916
|
value,
|
|
905
917
|
onChange,
|
|
906
918
|
accessibilityLabel,
|
|
919
|
+
accessibilityHint,
|
|
907
920
|
style,
|
|
908
921
|
testID
|
|
909
922
|
}) {
|
|
910
923
|
const { theme } = useUi();
|
|
911
924
|
const { colors } = theme;
|
|
912
|
-
|
|
925
|
+
const { a11yProps, hintNode } = useA11y({ label: accessibilityLabel, hint: accessibilityHint, testID: testID ?? HINT_ID_FALLBACK });
|
|
926
|
+
const describedBy = accessibilityHint === void 0 ? {} : { "aria-describedby": a11yProps["aria-describedby"] };
|
|
927
|
+
return /* @__PURE__ */ jsxs(
|
|
913
928
|
View,
|
|
914
929
|
{
|
|
915
930
|
accessibilityRole: "tablist",
|
|
916
931
|
"aria-label": accessibilityLabel,
|
|
932
|
+
...describedBy,
|
|
917
933
|
style: [styles10.track, { backgroundColor: colors.background, borderColor: colors.border }, style],
|
|
918
934
|
testID,
|
|
919
|
-
children:
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
935
|
+
children: [
|
|
936
|
+
options.map((opt) => {
|
|
937
|
+
const selected = opt.value === value;
|
|
938
|
+
return /* @__PURE__ */ jsx(
|
|
939
|
+
Pressable,
|
|
940
|
+
{
|
|
941
|
+
accessibilityRole: "tab",
|
|
942
|
+
accessibilityState: { selected },
|
|
943
|
+
accessibilityLabel: opt.accessibilityLabel ?? opt.label,
|
|
944
|
+
accessibilityHint: opt.accessibilityHint,
|
|
945
|
+
onPress: () => onChange(opt.value),
|
|
946
|
+
style: [
|
|
947
|
+
styles10.segment,
|
|
948
|
+
selected ? styles10.segmentSelected : null,
|
|
949
|
+
{ backgroundColor: selected ? colors.surface : TRANSPARENT }
|
|
950
|
+
],
|
|
951
|
+
testID: opt.testID,
|
|
952
|
+
...ariaSelectedProps(selected),
|
|
953
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles10.label, { color: selected ? colors.text : colors.textSecondary }], children: opt.label })
|
|
954
|
+
},
|
|
955
|
+
opt.value
|
|
956
|
+
);
|
|
957
|
+
}),
|
|
958
|
+
accessibilityHint === void 0 ? null : hintNode
|
|
959
|
+
]
|
|
941
960
|
}
|
|
942
961
|
);
|
|
943
962
|
}
|
|
@@ -3228,6 +3247,234 @@ var ListRow = ({
|
|
|
3228
3247
|
] });
|
|
3229
3248
|
};
|
|
3230
3249
|
|
|
3231
|
-
|
|
3250
|
+
// src/SectionIndexLayout/ChipOverflow.ts
|
|
3251
|
+
var ChipOverflow = /* @__PURE__ */ ((ChipOverflow2) => {
|
|
3252
|
+
ChipOverflow2["Wrap"] = "wrap";
|
|
3253
|
+
ChipOverflow2["Scroll"] = "scroll";
|
|
3254
|
+
return ChipOverflow2;
|
|
3255
|
+
})(ChipOverflow || {});
|
|
3256
|
+
var styles28 = StyleSheet.create({
|
|
3257
|
+
root: { flexDirection: "row", flexWrap: "wrap", gap: 8 },
|
|
3258
|
+
scrollRow: { flexDirection: "row", flexWrap: "nowrap", gap: 8 },
|
|
3259
|
+
chip: { minHeight: MIN_TARGET_PX, justifyContent: "center", paddingHorizontal: 14, borderRadius: 999, borderWidth: 1 },
|
|
3260
|
+
label: { fontSize: 14, fontWeight: "600" }
|
|
3261
|
+
});
|
|
3262
|
+
function ariaSelected(selected) {
|
|
3263
|
+
return { "aria-selected": selected };
|
|
3264
|
+
}
|
|
3265
|
+
var SectionChips = ({ sections, activeKey, groupLabel, itemHint, overflow = "wrap" /* Wrap */, onSelect, testID }) => {
|
|
3266
|
+
const { theme } = useUi();
|
|
3267
|
+
const { colors } = theme;
|
|
3268
|
+
const scroll = overflow === "scroll" /* Scroll */;
|
|
3269
|
+
const row = /* @__PURE__ */ jsx(View, { accessibilityRole: "tablist", accessibilityLabel: groupLabel, style: scroll ? styles28.scrollRow : styles28.root, testID: `${testID}-chips`, children: sections.map((entry) => {
|
|
3270
|
+
const active = entry.key === activeKey;
|
|
3271
|
+
return /* @__PURE__ */ jsx(
|
|
3272
|
+
Pressable,
|
|
3273
|
+
{
|
|
3274
|
+
...ariaSelected(active),
|
|
3275
|
+
accessibilityRole: "tab",
|
|
3276
|
+
accessibilityLabel: entry.title,
|
|
3277
|
+
accessibilityHint: itemHint,
|
|
3278
|
+
style: [styles28.chip, { borderColor: colors.border, backgroundColor: active ? colors.text : colors.background }],
|
|
3279
|
+
testID: `${testID}-chip-${entry.key}`,
|
|
3280
|
+
onPress: () => onSelect(entry.key),
|
|
3281
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles28.label, { color: active ? colors.background : colors.text }], children: entry.title })
|
|
3282
|
+
},
|
|
3283
|
+
entry.key
|
|
3284
|
+
);
|
|
3285
|
+
}) });
|
|
3286
|
+
return scroll ? /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, children: row }) : row;
|
|
3287
|
+
};
|
|
3288
|
+
|
|
3289
|
+
// src/SectionIndexLayout/SectionDensity.ts
|
|
3290
|
+
var SectionDensity = /* @__PURE__ */ ((SectionDensity2) => {
|
|
3291
|
+
SectionDensity2["Comfortable"] = "comfortable";
|
|
3292
|
+
SectionDensity2["Dense"] = "dense";
|
|
3293
|
+
return SectionDensity2;
|
|
3294
|
+
})(SectionDensity || {});
|
|
3295
|
+
var INDEX_WIDTH = 200;
|
|
3296
|
+
var ACTIVE_BAR = 3;
|
|
3297
|
+
var TRANSPARENT3 = "transparent";
|
|
3298
|
+
var styles29 = StyleSheet.create({
|
|
3299
|
+
root: { width: INDEX_WIDTH, flexShrink: 0, gap: 2, alignSelf: "flex-start" },
|
|
3300
|
+
heading: { fontSize: 12, fontWeight: "700", letterSpacing: 0.6, textTransform: "uppercase", paddingHorizontal: 10, paddingBottom: 6 },
|
|
3301
|
+
item: { minHeight: MIN_TARGET_PX, justifyContent: "center", paddingHorizontal: 10, borderLeftWidth: ACTIVE_BAR, borderRadius: 6 },
|
|
3302
|
+
label: { fontSize: 14 },
|
|
3303
|
+
labelActive: { fontWeight: "700" }
|
|
3304
|
+
});
|
|
3305
|
+
function ariaCurrent(active) {
|
|
3306
|
+
return active ? { "aria-current": "location" } : {};
|
|
3307
|
+
}
|
|
3308
|
+
var SectionIndex = ({ sections, activeKey, heading, itemHint, onSelect, testID }) => {
|
|
3309
|
+
const { theme } = useUi();
|
|
3310
|
+
const { colors } = theme;
|
|
3311
|
+
return /* @__PURE__ */ jsxs(View, { role: "navigation", accessibilityLabel: heading, style: styles29.root, testID: `${testID}-index`, children: [
|
|
3312
|
+
/* @__PURE__ */ jsx(Text, { style: [styles29.heading, { color: colors.textSecondary }], children: heading }),
|
|
3313
|
+
sections.map((entry) => {
|
|
3314
|
+
const active = entry.key === activeKey;
|
|
3315
|
+
return /* @__PURE__ */ jsx(
|
|
3316
|
+
Pressable,
|
|
3317
|
+
{
|
|
3318
|
+
...ariaCurrent(active),
|
|
3319
|
+
accessibilityRole: "link",
|
|
3320
|
+
accessibilityLabel: entry.title,
|
|
3321
|
+
accessibilityHint: itemHint,
|
|
3322
|
+
style: [styles29.item, { borderLeftColor: active ? colors.text : TRANSPARENT3, backgroundColor: active ? colors.surface : TRANSPARENT3 }],
|
|
3323
|
+
testID: `${testID}-index-${entry.key}`,
|
|
3324
|
+
onPress: () => onSelect(entry.key),
|
|
3325
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles29.label, active && styles29.labelActive, { color: active ? colors.text : colors.textSecondary }], children: entry.title })
|
|
3326
|
+
},
|
|
3327
|
+
entry.key
|
|
3328
|
+
);
|
|
3329
|
+
})
|
|
3330
|
+
] });
|
|
3331
|
+
};
|
|
3332
|
+
|
|
3333
|
+
// src/SectionIndexLayout/sectionKeys.ts
|
|
3334
|
+
var SECTION_INDEX_BREAKPOINT = 1024;
|
|
3335
|
+
function resolveActiveKey(sections, wanted) {
|
|
3336
|
+
const match = sections.find((entry) => entry.key === wanted);
|
|
3337
|
+
if (match !== void 0) return match.key;
|
|
3338
|
+
return sections[0]?.key ?? "";
|
|
3339
|
+
}
|
|
3340
|
+
function sectionAnchorId(testID, key) {
|
|
3341
|
+
return `${testID}-section-${key}`;
|
|
3342
|
+
}
|
|
3343
|
+
function scrollToSection(anchorId) {
|
|
3344
|
+
if (typeof document === "undefined") return;
|
|
3345
|
+
const target = document.getElementById(anchorId);
|
|
3346
|
+
target?.scrollIntoView?.({ behavior: "smooth", block: "start" });
|
|
3347
|
+
}
|
|
3348
|
+
var COMFORTABLE_GAP = 12;
|
|
3349
|
+
var DENSE_GAP = 8;
|
|
3350
|
+
var WEB_STICKY = { position: "sticky", top: 0 };
|
|
3351
|
+
var styles30 = StyleSheet.create({
|
|
3352
|
+
wide: { flexDirection: "row", alignItems: "flex-start", gap: 20 },
|
|
3353
|
+
column: { flex: 1, minWidth: 0 }
|
|
3354
|
+
});
|
|
3355
|
+
var SectionIndexLayout = ({
|
|
3356
|
+
sections,
|
|
3357
|
+
indexHeading,
|
|
3358
|
+
itemHint,
|
|
3359
|
+
initialKey,
|
|
3360
|
+
breakpoint = SECTION_INDEX_BREAKPOINT,
|
|
3361
|
+
density = "comfortable" /* Comfortable */,
|
|
3362
|
+
stickyIndex = false,
|
|
3363
|
+
chipOverflow = "wrap" /* Wrap */,
|
|
3364
|
+
testID = "section-index"
|
|
3365
|
+
}) => {
|
|
3366
|
+
const wide = useIsWideViewport(breakpoint);
|
|
3367
|
+
const [picked, setPicked] = useState(initialKey);
|
|
3368
|
+
const activeKey = resolveActiveKey(sections, picked);
|
|
3369
|
+
const gap = { gap: density === "dense" /* Dense */ ? DENSE_GAP : COMFORTABLE_GAP };
|
|
3370
|
+
if (sections.length < 2) return /* @__PURE__ */ jsx(View, { testID, children: sections[0]?.content });
|
|
3371
|
+
if (!wide) {
|
|
3372
|
+
const active = sections.find((entry) => entry.key === activeKey);
|
|
3373
|
+
return /* @__PURE__ */ jsxs(View, { style: gap, testID, children: [
|
|
3374
|
+
/* @__PURE__ */ jsx(
|
|
3375
|
+
SectionChips,
|
|
3376
|
+
{
|
|
3377
|
+
activeKey,
|
|
3378
|
+
groupLabel: indexHeading,
|
|
3379
|
+
itemHint,
|
|
3380
|
+
overflow: chipOverflow,
|
|
3381
|
+
sections,
|
|
3382
|
+
testID,
|
|
3383
|
+
onSelect: setPicked
|
|
3384
|
+
}
|
|
3385
|
+
),
|
|
3386
|
+
/* @__PURE__ */ jsx(View, { nativeID: sectionAnchorId(testID, activeKey), testID: sectionAnchorId(testID, activeKey), children: active?.content })
|
|
3387
|
+
] });
|
|
3388
|
+
}
|
|
3389
|
+
const select = (key) => {
|
|
3390
|
+
setPicked(key);
|
|
3391
|
+
scrollToSection(sectionAnchorId(testID, key));
|
|
3392
|
+
};
|
|
3393
|
+
const sticky = stickyIndex && Platform.OS === "web" ? WEB_STICKY : null;
|
|
3394
|
+
return /* @__PURE__ */ jsxs(View, { style: styles30.wide, testID, children: [
|
|
3395
|
+
/* @__PURE__ */ jsx(View, { style: sticky, children: /* @__PURE__ */ jsx(SectionIndex, { activeKey, heading: indexHeading, itemHint, sections, testID, onSelect: select }) }),
|
|
3396
|
+
/* @__PURE__ */ jsx(View, { style: [styles30.column, gap], children: sections.map((entry) => /* @__PURE__ */ jsx(View, { nativeID: sectionAnchorId(testID, entry.key), testID: sectionAnchorId(testID, entry.key), children: entry.content }, entry.key)) })
|
|
3397
|
+
] });
|
|
3398
|
+
};
|
|
3399
|
+
var PILL_RADIUS2 = 999;
|
|
3400
|
+
var styles31 = StyleSheet.create({
|
|
3401
|
+
body: { borderRadius: 8, borderWidth: 1, overflow: "hidden" },
|
|
3402
|
+
count: { borderRadius: PILL_RADIUS2, borderWidth: 1, fontSize: 12, fontWeight: "700", paddingHorizontal: 8 },
|
|
3403
|
+
head: { alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: 8 },
|
|
3404
|
+
label: { fontSize: 13, fontWeight: "600" },
|
|
3405
|
+
stack: { gap: 6 }
|
|
3406
|
+
});
|
|
3407
|
+
var DayCard = ({
|
|
3408
|
+
label,
|
|
3409
|
+
badge,
|
|
3410
|
+
count,
|
|
3411
|
+
accessibilityLabel,
|
|
3412
|
+
accessibilityHint,
|
|
3413
|
+
badgeTone = "warning" /* Warning */,
|
|
3414
|
+
testID,
|
|
3415
|
+
children
|
|
3416
|
+
}) => {
|
|
3417
|
+
const { theme } = useUi();
|
|
3418
|
+
const { colors } = theme;
|
|
3419
|
+
return /* @__PURE__ */ jsxs(View, { style: styles31.stack, testID, children: [
|
|
3420
|
+
/* @__PURE__ */ jsxs(View, { accessibilityHint, accessibilityLabel, accessibilityRole: "header", style: styles31.head, children: [
|
|
3421
|
+
/* @__PURE__ */ jsx(Text, { style: [styles31.label, { color: colors.text }], children: label }),
|
|
3422
|
+
/* @__PURE__ */ jsx(StatusBadge, { label: badge, tone: badgeTone }),
|
|
3423
|
+
/* @__PURE__ */ jsx(Text, { style: [styles31.count, { borderColor: colors.border, color: colors.textSecondary }], children: String(count) })
|
|
3424
|
+
] }),
|
|
3425
|
+
/* @__PURE__ */ jsx(View, { style: [styles31.body, { backgroundColor: colors.surface, borderColor: colors.border }], children })
|
|
3426
|
+
] });
|
|
3427
|
+
};
|
|
3428
|
+
var styles32 = StyleSheet.create({
|
|
3429
|
+
full: { flexBasis: "100%" },
|
|
3430
|
+
half: { flexBasis: "45%", flexGrow: 1, minWidth: 0 },
|
|
3431
|
+
strip: { flexDirection: "row", flexWrap: "wrap", gap: 12 }
|
|
3432
|
+
});
|
|
3433
|
+
function figureCell(wide, span = 1) {
|
|
3434
|
+
if (wide) return { flexBasis: 0, flexGrow: span, minWidth: 0 };
|
|
3435
|
+
return span > 1 ? styles32.full : styles32.half;
|
|
3436
|
+
}
|
|
3437
|
+
var FigureStrip = ({ children, testID }) => /* @__PURE__ */ jsx(View, { style: styles32.strip, testID, children });
|
|
3438
|
+
var styles33 = StyleSheet.create({
|
|
3439
|
+
stack: { gap: 12 }
|
|
3440
|
+
});
|
|
3441
|
+
var ToggleSection = ({ wide, title, toggleLabel, toggleHint, forceOpen = false, testID, children }) => {
|
|
3442
|
+
const [open, setOpen] = useState(false);
|
|
3443
|
+
if (wide) return /* @__PURE__ */ jsx(Section, { testID: `${testID}-card`, title, variant: "card" /* Card */, children });
|
|
3444
|
+
return /* @__PURE__ */ jsxs(View, { style: styles33.stack, children: [
|
|
3445
|
+
/* @__PURE__ */ jsx(Button, { accessibilityHint: toggleHint, accessibilityLabel: toggleLabel, label: toggleLabel, testID: `${testID}-toggle`, variant: "outline", onPress: () => setOpen((current) => !current) }),
|
|
3446
|
+
open || forceOpen ? children : null
|
|
3447
|
+
] });
|
|
3448
|
+
};
|
|
3449
|
+
var styles34 = StyleSheet.create({
|
|
3450
|
+
entry: { borderLeftWidth: 2, gap: 4, paddingBottom: 12, paddingLeft: 12 },
|
|
3451
|
+
head: { alignItems: "center", flexDirection: "row", flexWrap: "wrap", gap: 8 },
|
|
3452
|
+
time: { fontSize: 13 },
|
|
3453
|
+
title: { flexShrink: 1, fontSize: 15, fontWeight: "600" }
|
|
3454
|
+
});
|
|
3455
|
+
var entryTestId = (testID, key) => testID === void 0 ? void 0 : `${testID}-${key}`;
|
|
3456
|
+
var Timeline = ({ entries, accessibilityLabel, accessibilityHint, testID }) => {
|
|
3457
|
+
const { colors } = useUi().theme;
|
|
3458
|
+
return /* @__PURE__ */ jsx(View, { accessibilityHint, accessibilityLabel, role: "list", testID, children: entries.map((entry) => /* @__PURE__ */ jsxs(
|
|
3459
|
+
View,
|
|
3460
|
+
{
|
|
3461
|
+
accessibilityHint: entry.accessibilityHint,
|
|
3462
|
+
accessibilityLabel: entry.accessibilityLabel,
|
|
3463
|
+
role: "listitem",
|
|
3464
|
+
style: [styles34.entry, { borderLeftColor: colors.border }],
|
|
3465
|
+
testID: entryTestId(testID, entry.key),
|
|
3466
|
+
children: [
|
|
3467
|
+
entry.time === "" ? null : /* @__PURE__ */ jsx(Text, { style: [styles34.time, { color: colors.textSecondary }], children: entry.time }),
|
|
3468
|
+
/* @__PURE__ */ jsxs(View, { style: styles34.head, children: [
|
|
3469
|
+
/* @__PURE__ */ jsx(Text, { style: [styles34.title, { color: colors.text }], children: entry.title }),
|
|
3470
|
+
entry.status === void 0 || entry.status === "" ? null : /* @__PURE__ */ jsx(StatusBadge, { label: entry.status, tone: entry.tone ?? "neutral" /* Neutral */ })
|
|
3471
|
+
] })
|
|
3472
|
+
]
|
|
3473
|
+
},
|
|
3474
|
+
entry.key
|
|
3475
|
+
)) });
|
|
3476
|
+
};
|
|
3477
|
+
|
|
3478
|
+
export { A4_PAGE, API_COMMIT_SEPARATOR, Accordion, AccordionItem, AppText, BUILD_INFO_PREFIX, BadgeTone, BottomSheet, BuildInfoFooter, COPY_FEEDBACK_MS, ChipOverflow, ConfirmDialog, ConfirmDialogFocus, CopyStatus, CopyableId, CountBadge, DEFAULT_BILLING_ROUTE, DayCard, DropdownVariant, ELLIPSIS, FigureStrip, FormDialog, HEADER_STACK_BREAKPOINT, Heading, LAYOUT_COLLAPSE_BREAKPOINT, LAYOUT_I18N, LAYOUT_TEST_IDS, ListRow, MIN_TARGET_PX, MODAL_FOOTER_STACK_BELOW, Modal, ModalDropdown, ModalShell, PageFrame, RowSelectedStyle, SECTION_INDEX_BREAKPOINT, ScreenColumn, Section, SectionChips, SectionDensity, SectionIndex, SectionIndexLayout, SectionVariant, SegmentedControl, SelectedMarker, SideSheet, SplitLayout, SplitPanes, StatusBadge, StickyPreview, TYPE_SCALE_BREAKPOINT, Tabs, TabsCollapsedTrigger, TextKind, Timeline, ToggleSection, TruncatedText, UpgradePrompt, copyText, figureCell, formatBuildInfo, formatCount, formatUrlForDisplay, isKeyboardOpen, isModalFooterStacked, isSplitSideBySide, isWideWebViewport, pageScale, resolveActiveKey, resolveRowLook, resolveToneColors, scaledFrame, shortenCommit, trimTrailingSlash, truncateMiddle, useApiCommit, useCopyToClipboard, useFocusTrap, useIsWideViewport, useListRowTone, useVisibleViewport };
|
|
3232
3479
|
//# sourceMappingURL=index.mjs.map
|
|
3233
3480
|
//# sourceMappingURL=index.mjs.map
|