@thanhphi/unistyles-ui 0.0.0-stage → 0.2.6

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.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +374 -2
  3. package/dist/choices.d.ts +52 -0
  4. package/dist/choices.js +143 -0
  5. package/dist/colors/index.d.ts +79 -0
  6. package/dist/colors/index.js +2 -0
  7. package/dist/date.d.ts +40 -0
  8. package/dist/date.js +153 -0
  9. package/dist/fields.d.ts +138 -0
  10. package/dist/fields.js +240 -0
  11. package/dist/form/index.d.ts +14 -0
  12. package/dist/form/index.js +68 -0
  13. package/dist/icons.d.ts +10 -0
  14. package/dist/icons.js +51 -0
  15. package/dist/image.d.ts +20 -0
  16. package/dist/image.js +34 -0
  17. package/dist/index.d.ts +12 -0
  18. package/dist/index.js +30 -0
  19. package/dist/module/choices.js +135 -0
  20. package/dist/module/colors/index.js +1 -0
  21. package/dist/module/colors/package.json +1 -0
  22. package/dist/module/date.js +145 -0
  23. package/dist/module/fields.js +232 -0
  24. package/dist/module/form/index.js +62 -0
  25. package/dist/module/form/package.json +1 -0
  26. package/dist/module/icons.js +15 -0
  27. package/dist/module/image.js +31 -0
  28. package/dist/module/index.js +10 -0
  29. package/dist/module/overlays.js +102 -0
  30. package/dist/module/package.json +1 -0
  31. package/dist/module/primitives.js +432 -0
  32. package/dist/module/process-graph.js +125 -0
  33. package/dist/module/rich-html/html-styles.js +55 -0
  34. package/dist/module/rich-html/image-renderers.js +141 -0
  35. package/dist/module/rich-html/index.js +54 -0
  36. package/dist/module/rich-html/normalize-inline-colors.js +93 -0
  37. package/dist/module/rich-html/package.json +1 -0
  38. package/dist/module/rich-html/rich-html.js +118 -0
  39. package/dist/module/theme.js +62 -0
  40. package/dist/module/toast.js +30 -0
  41. package/dist/overlays.d.ts +52 -0
  42. package/dist/overlays.js +109 -0
  43. package/dist/primitives.d.ts +157 -0
  44. package/dist/primitives.js +480 -0
  45. package/dist/process-graph.d.ts +33 -0
  46. package/dist/process-graph.js +161 -0
  47. package/dist/rich-html/html-styles.d.ts +23 -0
  48. package/dist/rich-html/html-styles.js +63 -0
  49. package/dist/rich-html/image-renderers.d.ts +12 -0
  50. package/dist/rich-html/image-renderers.js +144 -0
  51. package/dist/rich-html/index.d.ts +18 -0
  52. package/dist/rich-html/index.js +92 -0
  53. package/dist/rich-html/normalize-inline-colors.d.ts +8 -0
  54. package/dist/rich-html/normalize-inline-colors.js +99 -0
  55. package/dist/rich-html/rich-html.d.ts +7 -0
  56. package/dist/rich-html/rich-html.js +123 -0
  57. package/dist/theme.d.ts +67 -0
  58. package/dist/theme.js +68 -0
  59. package/dist/toast.d.ts +3 -0
  60. package/dist/toast.js +69 -0
  61. package/package.json +35 -4
@@ -0,0 +1,480 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.UIText = UIText;
37
+ exports.Button = Button;
38
+ exports.HeaderAction = HeaderAction;
39
+ exports.ScreenHeader = ScreenHeader;
40
+ exports.FormHeader = FormHeader;
41
+ exports.Skeleton = Skeleton;
42
+ exports.TextOrSkeleton = TextOrSkeleton;
43
+ exports.InfoRow = InfoRow;
44
+ exports.EmptyState = EmptyState;
45
+ exports.Card = Card;
46
+ exports.CollapsibleSection = CollapsibleSection;
47
+ exports.Badge = Badge;
48
+ exports.ActionBar = ActionBar;
49
+ const jsx_runtime_1 = require("react/jsx-runtime");
50
+ const react_1 = require("react");
51
+ const react_native_1 = require("react-native");
52
+ const react_native_safe_area_context_1 = require("react-native-safe-area-context");
53
+ const react_native_svg_1 = __importStar(require("react-native-svg"));
54
+ const theme_1 = require("./theme");
55
+ const icons_1 = require("./icons");
56
+ function UIText({ variant = "body", color = "content1", weight, style, ...props }) {
57
+ const theme = (0, theme_1.useUITheme)();
58
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ...props, style: [
59
+ {
60
+ color: theme.colors[color],
61
+ fontFamily: theme.typography.fontFamily,
62
+ fontSize: theme.typography[variant],
63
+ fontWeight: weight,
64
+ },
65
+ style,
66
+ ] }));
67
+ }
68
+ function Button({ label, children, variant = "primary", size = "normal", loading = false, throttleMs, leading, trailing, disabled, style, textStyle, accessibilityLabel, accessibilityState, onPress, onLongPress, onPressIn, onPressOut, ...props }) {
69
+ const { colors: c, radius: r, spacing: s, typography: t } = (0, theme_1.useUITheme)();
70
+ const solid = variant === "primary" || variant === "danger";
71
+ const tint = variant === "danger" ? c.danger : c.primary500;
72
+ const fg = solid ? c.textPrimary : tint;
73
+ const enabledAt = (0, react_1.useRef)(0);
74
+ const runPress = (handler, event, startsCooldown) => {
75
+ if (!handler)
76
+ return;
77
+ const throttled = typeof throttleMs === "number" &&
78
+ Number.isFinite(throttleMs) &&
79
+ throttleMs > 0;
80
+ const now = Date.now();
81
+ if (throttled && now < enabledAt.current)
82
+ return;
83
+ if (throttled && startsCooldown)
84
+ enabledAt.current = now + throttleMs;
85
+ handler(event);
86
+ };
87
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { ...props, onPress: onPress ? (event) => runPress(onPress, event, true) : undefined, onLongPress: onLongPress ? (event) => runPress(onLongPress, event, true) : undefined, onPressIn: onPressIn ? (event) => runPress(onPressIn, event, false) : undefined, onPressOut: onPressOut ? (event) => runPress(onPressOut, event, false) : undefined, disabled: disabled || loading, accessibilityRole: "button", accessibilityLabel: accessibilityLabel ?? label, accessibilityState: {
88
+ ...accessibilityState,
89
+ disabled: !!disabled || loading,
90
+ busy: loading,
91
+ }, style: ({ pressed }) => [
92
+ styles.button,
93
+ {
94
+ minHeight: size === "small" ? s.xxl + s.md : s.xxl + s.xl,
95
+ paddingHorizontal: s.lg,
96
+ paddingVertical: size === "small" ? s.sm : s.md,
97
+ gap: s.sm,
98
+ borderRadius: r.lg,
99
+ borderWidth: variant === "outline" ? 1 : 0,
100
+ borderColor: disabled ? c.content4 : tint,
101
+ backgroundColor: solid
102
+ ? disabled
103
+ ? c.content4
104
+ : tint
105
+ : "transparent",
106
+ opacity: pressed ? 0.75 : 1,
107
+ },
108
+ style,
109
+ ], children: [loading ? (0, jsx_runtime_1.jsx)(react_native_1.ActivityIndicator, { color: fg, size: "small" }) : leading, label != null ? ((0, jsx_runtime_1.jsx)(UIText, { weight: "600", style: [
110
+ { color: disabled && !solid ? c.content3 : fg, fontSize: t.body },
111
+ textStyle,
112
+ ], children: label })) : typeof children === "string" || typeof children === "number" ? ((0, jsx_runtime_1.jsx)(UIText, { weight: "600", style: [{ color: fg }, textStyle], children: children })) : (children), trailing] }));
113
+ }
114
+ /** A header action with shared geometry, feedback, and active-state colors. */
115
+ function HeaderAction({ icon, label, active = false, indicator = false, disabled, accessibilityLabel, accessibilityState, hitSlop, style, ...props }) {
116
+ const { colors: c, spacing: s, radius: r, typography: t } = (0, theme_1.useUITheme)();
117
+ const color = disabled ? c.content3 : active ? c.primary500 : c.content1;
118
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { ...props, disabled: disabled, accessibilityRole: "button", accessibilityLabel: accessibilityLabel, accessibilityState: { ...accessibilityState, disabled: !!disabled }, hitSlop: hitSlop ?? s.sm - s.xs / 2, style: ({ pressed }) => [
119
+ styles.headerAction,
120
+ {
121
+ minWidth: s.xxl + s.sm,
122
+ minHeight: s.xxl + s.sm,
123
+ paddingHorizontal: label ? s.sm : 0,
124
+ gap: s.xs,
125
+ borderRadius: r.md,
126
+ backgroundColor: active ? c.primary50 : "transparent",
127
+ opacity: disabled ? 0.45 : pressed ? 0.6 : 1,
128
+ },
129
+ style,
130
+ ], children: [typeof icon === "function" ? icon({ color, size: s.xxl }) : icon, label != null && ((0, jsx_runtime_1.jsx)(UIText, { weight: "500", style: { color, fontSize: t.body }, children: label })), indicator && ((0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "none", style: [
131
+ styles.headerActionIndicator,
132
+ {
133
+ width: s.sm - s.xs / 2,
134
+ height: s.sm - s.xs / 2,
135
+ top: s.xs / 2,
136
+ right: s.xs / 2,
137
+ borderRadius: r.full,
138
+ backgroundColor: c.danger,
139
+ },
140
+ ] }))] }));
141
+ }
142
+ function ScreenHeader({ title, variant = "default", onBack, backIcon, backAccessibilityLabel = "Back", leading, trailing, safeArea = true, style, titleStyle, titleWeight = "600", search, }) {
143
+ const { colors: c, spacing: s, radius: r, typography: t } = (0, theme_1.useUITheme)();
144
+ const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
145
+ const inputRef = (0, react_1.useRef)(null);
146
+ const [headerWidth, setHeaderWidth] = (0, react_1.useState)();
147
+ const [leadingWidth, setLeadingWidth] = (0, react_1.useState)(0);
148
+ const [trailingWidth, setTrailingWidth] = (0, react_1.useState)(0);
149
+ const searchActive = !!search?.active;
150
+ const foreground = variant === "onAccent" ? c.textPrimary : c.content1;
151
+ const overrides = react_native_1.StyleSheet.flatten(style);
152
+ const horizontalPadding = typeof overrides?.paddingHorizontal === "number"
153
+ ? overrides.paddingHorizontal
154
+ : s.xxl;
155
+ const leftPadding = typeof overrides?.paddingLeft === "number"
156
+ ? overrides.paddingLeft
157
+ : horizontalPadding;
158
+ const rightPadding = typeof overrides?.paddingRight === "number"
159
+ ? overrides.paddingRight
160
+ : horizontalPadding;
161
+ const topPadding = typeof overrides?.paddingTop === "number"
162
+ ? overrides.paddingTop
163
+ : safeArea ? insets.top : 0;
164
+ const leadingContent = leading ??
165
+ (onBack ? ((0, jsx_runtime_1.jsx)(HeaderAction, { accessibilityLabel: backAccessibilityLabel, onPress: onBack, icon: backIcon ?? (0, jsx_runtime_1.jsx)(icons_1.UIIcon, { name: "back", color: foreground, size: s.xxl }) })) : null);
166
+ const hasActions = leadingContent != null || trailing != null;
167
+ const naturalSideWidth = hasActions
168
+ ? Math.max(s.xxl + s.sm, leadingContent != null ? leadingWidth : 0, trailing != null ? trailingWidth : 0)
169
+ : 0;
170
+ const sideWidth = headerWidth == null
171
+ ? naturalSideWidth
172
+ : Math.min(naturalSideWidth, Math.max(0, (headerWidth - leftPadding - rightPadding) / 2));
173
+ const measureWidth = (update) => (event) => update(event.nativeEvent.layout.width);
174
+ (0, react_1.useEffect)(() => {
175
+ if (searchActive && search?.autoFocus !== false)
176
+ inputRef.current?.focus();
177
+ }, [searchActive, search?.autoFocus]);
178
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { onLayout: measureWidth(setHeaderWidth), style: [
179
+ styles.header,
180
+ {
181
+ minHeight: s.xxl * 2 + s.sm + (safeArea ? insets.top : 0),
182
+ paddingTop: safeArea ? insets.top : 0,
183
+ paddingHorizontal: s.xxl,
184
+ ...(variant === "surface"
185
+ ? {
186
+ backgroundColor: c.background,
187
+ borderBottomWidth: 1,
188
+ borderBottomColor: c.divider,
189
+ }
190
+ : {}),
191
+ },
192
+ style,
193
+ ], children: searchActive && search ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [search.leading != null && ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.headerActionRow, { marginRight: s.sm }], children: search.leading })), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
194
+ styles.headerSearch,
195
+ {
196
+ height: s.xxl + s.md,
197
+ paddingHorizontal: s.sm,
198
+ gap: s.sm,
199
+ borderRadius: r.md,
200
+ backgroundColor: c.gray50,
201
+ },
202
+ ], children: [(0, jsx_runtime_1.jsx)(icons_1.UIIcon, { name: "search", color: c.content3, size: t.subtitle }), (0, jsx_runtime_1.jsx)(react_native_1.TextInput, { ref: inputRef, value: search.value, onChangeText: search.onChangeText, onSubmitEditing: () => search.onSubmit?.(search.value), placeholder: search.placeholder, placeholderTextColor: c.content3, accessibilityLabel: search.accessibilityLabel ?? search.placeholder ?? title, returnKeyType: "search", style: [
203
+ styles.headerSearchInput,
204
+ {
205
+ color: c.content1,
206
+ fontFamily: t.fontFamily,
207
+ fontSize: t.body,
208
+ },
209
+ ] }), search.value.length > 0 && ((0, jsx_runtime_1.jsx)(HeaderAction, { accessibilityLabel: search.clearAccessibilityLabel ?? "Clear search", onPress: () => {
210
+ search.onChangeText("");
211
+ search.onClear?.();
212
+ }, icon: ({ color }) => ((0, jsx_runtime_1.jsx)(icons_1.UIIcon, { name: "close", color: color, size: t.subtitle })) }))] }), (0, jsx_runtime_1.jsx)(HeaderAction, { accessibilityLabel: search.cancelAccessibilityLabel ?? search.cancelLabel ?? "Cancel search", icon: search.cancelIcon, label: search.cancelIcon ? undefined : search.cancelLabel ?? "Cancel", style: { marginLeft: s.sm }, onPress: () => {
213
+ react_native_1.Keyboard.dismiss();
214
+ search.onCancel();
215
+ } })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.headerSide, { width: sideWidth }] }), (0, jsx_runtime_1.jsx)(UIText, { variant: "title", color: variant === "onAccent" ? "textPrimary" : "content1", weight: titleWeight === "platform"
216
+ ? react_native_1.Platform.OS === "ios"
217
+ ? "600"
218
+ : "bold"
219
+ : titleWeight, style: [styles.headerTitle, { fontSize: t.title }, titleStyle], numberOfLines: 1, ellipsizeMode: "tail", children: title }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [styles.headerSide, { width: sideWidth }] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { onLayout: measureWidth(setLeadingWidth), style: [
220
+ styles.headerActionsOverlay,
221
+ { gap: s.sm, left: leftPadding, top: topPadding },
222
+ ], children: leadingContent }), (0, jsx_runtime_1.jsx)(react_native_1.View, { onLayout: measureWidth(setTrailingWidth), style: [
223
+ styles.headerActionsOverlay,
224
+ { gap: s.sm, right: rightPadding, top: topPadding },
225
+ ], children: trailing })] })) }));
226
+ }
227
+ function FormHeader({ title, cancelText, confirmText, onCancel, onConfirm, confirmDisabled = false, style, titleStyle, actionTextStyle, disabledActionTextStyle, testID = "bottom-sheet-header", cancelTestID = "bottom-sheet-header-cancel", confirmTestID = "bottom-sheet-header-confirm", ...props }) {
228
+ const { colors: c, spacing: s, typography: t } = (0, theme_1.useUITheme)();
229
+ const actionStyle = [
230
+ { fontSize: t.body, fontWeight: "600", color: c.primary500 },
231
+ actionTextStyle,
232
+ ];
233
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { ...props, collapsable: false, testID: testID, style: [
234
+ {
235
+ position: "absolute",
236
+ top: 0,
237
+ left: 0,
238
+ right: 0,
239
+ height: s.xxl * 2 + s.xs,
240
+ flexDirection: "row",
241
+ alignItems: "center",
242
+ justifyContent: "space-between",
243
+ paddingHorizontal: s.xl,
244
+ borderBottomWidth: 1,
245
+ borderBottomColor: c.divider,
246
+ backgroundColor: c.background,
247
+ zIndex: 10,
248
+ },
249
+ style,
250
+ ], children: [(0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: onCancel, hitSlop: 8, testID: cancelTestID, accessibilityRole: "button", accessibilityLabel: cancelText, style: ({ pressed }) => ({ opacity: pressed ? 0.2 : 1 }), children: (0, jsx_runtime_1.jsx)(UIText, { style: actionStyle, children: cancelText }) }), (0, jsx_runtime_1.jsx)(UIText, { numberOfLines: 1, weight: "700", style: [
251
+ {
252
+ flex: 1,
253
+ marginHorizontal: s.md,
254
+ textAlign: "center",
255
+ fontSize: t.subtitle,
256
+ },
257
+ titleStyle,
258
+ ], children: title }), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: onConfirm, disabled: confirmDisabled, hitSlop: 8, testID: confirmTestID, accessibilityRole: "button", accessibilityLabel: confirmText, accessibilityState: { disabled: confirmDisabled }, style: ({ pressed }) => ({ opacity: pressed ? 0.2 : 1 }), children: (0, jsx_runtime_1.jsx)(UIText, { style: [
259
+ actionStyle,
260
+ confirmDisabled && [{ color: c.content4 }, disabledActionTextStyle],
261
+ ], children: confirmText }) })] }));
262
+ }
263
+ function Skeleton({ width = "100%", height = 14, animated = true, variant = "shimmer", animationType = "overlay", duration, primaryColor, secondaryColor, style, onLayout, ...props }) {
264
+ const theme = (0, theme_1.useUITheme)();
265
+ const opacity = (0, react_1.useRef)(new react_native_1.Animated.Value(1)).current;
266
+ const progress = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current;
267
+ const [measuredWidth, setMeasuredWidth] = (0, react_1.useState)(0);
268
+ const gradientId = `skeleton-${(0, react_1.useId)().replace(/:/g, "")}`;
269
+ const primary = primaryColor ?? theme.colors.gray200;
270
+ const secondary = secondaryColor ?? theme.colors.gray50;
271
+ (0, react_1.useEffect)(() => {
272
+ opacity.setValue(1);
273
+ progress.setValue(0);
274
+ if (!animated) {
275
+ return;
276
+ }
277
+ const animationDuration = duration ?? (variant === "shimmer" ? 800 : 750);
278
+ const shimmerTiming = (toValue) => react_native_1.Animated.timing(progress, {
279
+ toValue,
280
+ duration: animationDuration,
281
+ easing: react_native_1.Easing.inOut(react_native_1.Easing.ease),
282
+ useNativeDriver: true,
283
+ isInteraction: false,
284
+ });
285
+ const animation = react_native_1.Animated.loop(variant === "shimmer"
286
+ ? animationType === "overlay"
287
+ ? shimmerTiming(1)
288
+ : react_native_1.Animated.sequence([shimmerTiming(1), shimmerTiming(0)])
289
+ : react_native_1.Animated.sequence([
290
+ react_native_1.Animated.timing(opacity, {
291
+ toValue: 0.45,
292
+ duration: animationDuration,
293
+ useNativeDriver: true,
294
+ isInteraction: false,
295
+ }),
296
+ react_native_1.Animated.timing(opacity, {
297
+ toValue: 1,
298
+ duration: animationDuration,
299
+ useNativeDriver: true,
300
+ isInteraction: false,
301
+ }),
302
+ ]));
303
+ animation.start();
304
+ return () => animation.stop();
305
+ }, [animated, variant, animationType, duration, opacity, progress]);
306
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { ...props, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", onLayout: (event) => {
307
+ if (variant === "shimmer")
308
+ setMeasuredWidth(event.nativeEvent.layout.width);
309
+ onLayout?.(event);
310
+ }, style: [
311
+ {
312
+ width,
313
+ height,
314
+ opacity: variant === "pulse" ? opacity : 1,
315
+ borderRadius: variant === "shimmer" ? 0 : theme.radius.md,
316
+ backgroundColor: primary,
317
+ overflow: "hidden",
318
+ },
319
+ style,
320
+ ], children: variant === "shimmer" && animated && ((0, jsx_runtime_1.jsx)(react_native_1.Animated.View, { pointerEvents: "none", style: [
321
+ react_native_1.StyleSheet.absoluteFillObject,
322
+ animationType === "overlay"
323
+ ? {
324
+ transform: [
325
+ {
326
+ translateX: progress.interpolate({
327
+ inputRange: [0, 1],
328
+ outputRange: [-measuredWidth, measuredWidth],
329
+ }),
330
+ },
331
+ ],
332
+ }
333
+ : { opacity: progress },
334
+ ], children: (0, jsx_runtime_1.jsxs)(react_native_svg_1.default, { width: "100%", height: "100%", children: [animationType === "overlay" && ((0, jsx_runtime_1.jsx)(react_native_svg_1.Defs, { children: (0, jsx_runtime_1.jsxs)(react_native_svg_1.LinearGradient, { id: gradientId, x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [(0, jsx_runtime_1.jsx)(react_native_svg_1.Stop, { offset: "0%", stopColor: primary }), (0, jsx_runtime_1.jsx)(react_native_svg_1.Stop, { offset: "50%", stopColor: secondary }), (0, jsx_runtime_1.jsx)(react_native_svg_1.Stop, { offset: "100%", stopColor: primary })] }) })), (0, jsx_runtime_1.jsx)(react_native_svg_1.Rect, { width: "100%", height: "100%", fill: animationType === "overlay" ? `url(#${gradientId})` : secondary })] }) })) }));
335
+ }
336
+ function TextOrSkeleton({ showSkeleton, value, textStyle, skeletonStyle, skeletonProps, ...props }) {
337
+ return showSkeleton ? ((0, jsx_runtime_1.jsx)(Skeleton, { ...skeletonProps, style: [skeletonProps?.style, skeletonStyle] })) : ((0, jsx_runtime_1.jsx)(UIText, { ...props, style: [props.style, textStyle], children: value }));
338
+ }
339
+ function InfoRow({ label, value, variant = "detail", loading = false, divider = false, labelWidth, valueNumberOfLines, style, labelStyle, valueStyle, }) {
340
+ const { spacing: s, colors: c, typography: t } = (0, theme_1.useUITheme)();
341
+ const summary = variant === "summary";
342
+ const valueIsText = value == null || typeof value === "string" || typeof value === "number";
343
+ const typography = { fontSize: summary ? t.body : (t.body + t.label) / 2 };
344
+ const valueLayout = summary
345
+ ? { flexShrink: 1, maxWidth: "55%" }
346
+ : { flex: 1 };
347
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
348
+ styles.infoRow,
349
+ {
350
+ gap: s.md,
351
+ ...(summary
352
+ ? { paddingVertical: s.md, alignItems: "center" }
353
+ : { marginBottom: s.md + s.xs / 2 }),
354
+ ...(divider
355
+ ? { borderBottomWidth: 1, borderBottomColor: c.divider }
356
+ : {}),
357
+ },
358
+ style,
359
+ ], children: [(0, jsx_runtime_1.jsx)(UIText, { color: summary ? "content2" : "content3", style: [
360
+ typography,
361
+ summary ? { flex: 1 } : { width: labelWidth ?? s.xxl * 5 },
362
+ labelStyle,
363
+ ], children: label }), loading ? ((0, jsx_runtime_1.jsx)(Skeleton, { width: summary ? "55%" : undefined, style: valueLayout, height: t.body })) : valueIsText ? ((0, jsx_runtime_1.jsx)(UIText, { weight: "500", numberOfLines: valueNumberOfLines ?? (summary ? 2 : 4), style: [
364
+ valueLayout,
365
+ typography,
366
+ { textAlign: summary ? "right" : "left" },
367
+ valueStyle,
368
+ ], children: value === "" || value == null ? "-" : value })) : ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: valueLayout, children: value }))] }));
369
+ }
370
+ function EmptyState({ variant = "default", title, description, image, illustration, illustrationSize, illustrationAspectRatio = 1, action, titleStyle, descriptionStyle, style, onLayout, ...props }) {
371
+ const { spacing: s, colors: c } = (0, theme_1.useUITheme)();
372
+ const [containerWidth, setContainerWidth] = (0, react_1.useState)(0);
373
+ const illustrated = variant === "illustrated";
374
+ const imageSize = illustrationSize ??
375
+ (illustrated
376
+ ? containerWidth > 0
377
+ ? Math.min(containerWidth * (containerWidth < 380 ? 0.6 : 0.4), 320)
378
+ : 0
379
+ : 160);
380
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { ...props, onLayout: (event) => {
381
+ if (illustrated)
382
+ setContainerWidth(event.nativeEvent.layout.width);
383
+ onLayout?.(event);
384
+ }, style: [
385
+ styles.empty,
386
+ { padding: s.xxl, gap: s.md },
387
+ illustrated && { width: "100%", paddingHorizontal: 0 },
388
+ style,
389
+ ], children: [illustration ??
390
+ (image && imageSize > 0 ? ((0, jsx_runtime_1.jsx)(react_native_1.Image, { source: image, resizeMode: "contain", style: {
391
+ width: imageSize,
392
+ height: imageSize / illustrationAspectRatio,
393
+ } })) : null), title != null && ((0, jsx_runtime_1.jsx)(UIText, { variant: "subtitle", color: "content2", style: [
394
+ styles.center,
395
+ illustrated && {
396
+ paddingTop: s.lg,
397
+ color: c.content1,
398
+ fontWeight: "600",
399
+ },
400
+ titleStyle,
401
+ ], children: title })), description != null && ((0, jsx_runtime_1.jsx)(UIText, { color: "content3", style: [styles.center, descriptionStyle], children: description })), action] }));
402
+ }
403
+ function Card({ style, ...props }) {
404
+ const { colors: c, radius: r, spacing: s } = (0, theme_1.useUITheme)();
405
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ...props, style: [
406
+ { backgroundColor: c.background, borderRadius: r.lg, padding: s.lg },
407
+ style,
408
+ ] }));
409
+ }
410
+ function CollapsibleSection({ variant = "default", title, children, expanded, defaultExpanded = true, onExpandedChange, trailing, style, headerStyle, testID, toggleTestID, contentTestID, }) {
411
+ const [internalExpanded, setInternalExpanded] = (0, react_1.useState)(defaultExpanded);
412
+ const open = expanded ?? internalExpanded;
413
+ const { spacing: s, colors: c } = (0, theme_1.useUITheme)();
414
+ const toggle = () => {
415
+ if (expanded === undefined)
416
+ setInternalExpanded(!open);
417
+ onExpandedChange?.(!open);
418
+ };
419
+ return ((0, jsx_runtime_1.jsxs)(Card, { style: [
420
+ variant === "bordered" && {
421
+ borderWidth: 1,
422
+ borderColor: c.divider,
423
+ paddingVertical: s.md,
424
+ },
425
+ style,
426
+ ], testID: testID, children: [(0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { testID: toggleTestID, onPress: toggle, accessibilityRole: "button", accessibilityState: { expanded: open }, style: [styles.sectionHeader, headerStyle], children: [typeof title === "string" ? ((0, jsx_runtime_1.jsx)(UIText, { variant: "subtitle", weight: "600", style: styles.flex, children: title })) : (title), trailing, (0, jsx_runtime_1.jsx)(react_native_1.View, { style: { transform: [{ rotate: open ? "180deg" : "0deg" }] }, children: (0, jsx_runtime_1.jsx)(icons_1.UIIcon, { name: "chevron", color: c.content2, size: 18 }) })] }), open && ((0, jsx_runtime_1.jsx)(react_native_1.View, { testID: contentTestID, style: { paddingTop: s.md }, children: children }))] }));
427
+ }
428
+ function Badge({ children, tone = "accent", color, backgroundColor, style, textStyle, }) {
429
+ const { colors: c, spacing: s, radius: r } = (0, theme_1.useUITheme)();
430
+ const fg = color ?? (tone === "neutral" ? c.content2 : tone === "accent" ? c.primary500 : c[tone]);
431
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
432
+ {
433
+ alignSelf: "flex-start",
434
+ paddingVertical: s.xs,
435
+ paddingHorizontal: s.sm,
436
+ borderRadius: r.sm,
437
+ backgroundColor: backgroundColor ??
438
+ (tone === "accent" ? c.primary50 : c.gray50),
439
+ },
440
+ style,
441
+ ], children: (0, jsx_runtime_1.jsx)(UIText, { variant: "label", weight: "500", style: [{ color: fg }, textStyle], children: children }) }));
442
+ }
443
+ function ActionBar({ children, safeArea = true, style, ...props }) {
444
+ const { colors: c, spacing: s } = (0, theme_1.useUITheme)();
445
+ const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
446
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ...props, style: [
447
+ {
448
+ flexDirection: "row",
449
+ gap: s.md,
450
+ backgroundColor: c.background,
451
+ borderTopWidth: 1,
452
+ borderTopColor: c.divider,
453
+ paddingHorizontal: s.lg,
454
+ paddingTop: s.md,
455
+ paddingBottom: Math.max(s.md, safeArea ? insets.bottom : 0),
456
+ },
457
+ style,
458
+ ], children: children }));
459
+ }
460
+ const styles = react_native_1.StyleSheet.create({
461
+ button: {
462
+ flexDirection: "row",
463
+ alignItems: "center",
464
+ justifyContent: "center",
465
+ },
466
+ header: { flexDirection: "row", alignItems: "center" },
467
+ headerSide: { flexDirection: "row", alignItems: "center", flexShrink: 1 },
468
+ headerActionRow: { flexDirection: "row", alignItems: "center", flexShrink: 0 },
469
+ headerActionsOverlay: { position: "absolute", bottom: 0, flexDirection: "row", alignItems: "center" },
470
+ headerAction: { flexDirection: "row", alignItems: "center", justifyContent: "center" },
471
+ headerActionIndicator: { position: "absolute" },
472
+ headerTitle: { flex: 1, minWidth: 0, textAlign: "center" },
473
+ headerSearch: { flex: 1, minWidth: 0, flexDirection: "row", alignItems: "center" },
474
+ headerSearchInput: { flex: 1, minWidth: 0, padding: 0 },
475
+ infoRow: { flexDirection: "row" },
476
+ empty: { alignItems: "center", justifyContent: "center" },
477
+ center: { textAlign: "center" },
478
+ flex: { flex: 1 },
479
+ sectionHeader: { flexDirection: "row", alignItems: "center", gap: 8 },
480
+ });
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ export type ProcessGraphTone = "success" | "warning" | "danger" | "accent" | "neutral";
4
+ export interface ProcessGraphPerson {
5
+ id: string;
6
+ label: string;
7
+ statusLabel?: string;
8
+ tone?: ProcessGraphTone;
9
+ }
10
+ export interface ProcessGraphNode {
11
+ id: string;
12
+ title: string;
13
+ statusLabel: string;
14
+ tone: ProcessGraphTone;
15
+ people: ProcessGraphPerson[];
16
+ }
17
+ export interface ProcessGraphToneColors {
18
+ dot: string;
19
+ background: string;
20
+ border: string;
21
+ text: string;
22
+ }
23
+ export interface ProcessGraphProps {
24
+ /** Already ordered by the app. Repeated stages retain distinct node IDs. */
25
+ nodes: ProcessGraphNode[];
26
+ startAdornment?: React.ReactNode;
27
+ connector?: React.ReactNode;
28
+ tones?: Partial<Record<ProcessGraphTone, ProcessGraphToneColors>>;
29
+ style?: StyleProp<ViewStyle>;
30
+ accessibilityLabel?: string;
31
+ }
32
+ /** Pure presentation: apps own loading, workflow permissions, statuses and people. */
33
+ export declare function ProcessGraph({ nodes, startAdornment, connector, tones, style, accessibilityLabel, }: ProcessGraphProps): React.JSX.Element;