@thanhphi/unistyles-ui 0.0.0-stage → 0.2.7
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/LICENSE +21 -0
- package/README.md +384 -2
- package/dist/choices.d.ts +52 -0
- package/dist/choices.js +143 -0
- package/dist/colors/index.d.ts +79 -0
- package/dist/colors/index.js +2 -0
- package/dist/date.d.ts +40 -0
- package/dist/date.js +153 -0
- package/dist/fields.d.ts +140 -0
- package/dist/fields.js +233 -0
- package/dist/form/index.d.ts +14 -0
- package/dist/form/index.js +68 -0
- package/dist/icons.d.ts +10 -0
- package/dist/icons.js +52 -0
- package/dist/image.d.ts +20 -0
- package/dist/image.js +34 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +33 -0
- package/dist/list-picker.d.ts +45 -0
- package/dist/list-picker.js +76 -0
- package/dist/module/choices.js +135 -0
- package/dist/module/colors/index.js +1 -0
- package/dist/module/colors/package.json +1 -0
- package/dist/module/date.js +145 -0
- package/dist/module/fields.js +225 -0
- package/dist/module/form/index.js +62 -0
- package/dist/module/form/package.json +1 -0
- package/dist/module/icons.js +16 -0
- package/dist/module/image.js +31 -0
- package/dist/module/index.js +13 -0
- package/dist/module/list-picker.js +70 -0
- package/dist/module/overlays.js +138 -0
- package/dist/module/package.json +1 -0
- package/dist/module/primitives.js +432 -0
- package/dist/module/process-graph.js +125 -0
- package/dist/module/rich-html/html-styles.js +55 -0
- package/dist/module/rich-html/image-renderers.js +141 -0
- package/dist/module/rich-html/index.js +54 -0
- package/dist/module/rich-html/normalize-inline-colors.js +93 -0
- package/dist/module/rich-html/package.json +1 -0
- package/dist/module/rich-html/rich-html.js +118 -0
- package/dist/module/search.js +88 -0
- package/dist/module/theme.js +62 -0
- package/dist/module/toast.js +30 -0
- package/dist/module/ui-modal.js +145 -0
- package/dist/overlays.d.ts +72 -0
- package/dist/overlays.js +146 -0
- package/dist/primitives.d.ts +157 -0
- package/dist/primitives.js +480 -0
- package/dist/process-graph.d.ts +33 -0
- package/dist/process-graph.js +161 -0
- package/dist/rich-html/html-styles.d.ts +23 -0
- package/dist/rich-html/html-styles.js +63 -0
- package/dist/rich-html/image-renderers.d.ts +12 -0
- package/dist/rich-html/image-renderers.js +144 -0
- package/dist/rich-html/index.d.ts +18 -0
- package/dist/rich-html/index.js +92 -0
- package/dist/rich-html/normalize-inline-colors.d.ts +8 -0
- package/dist/rich-html/normalize-inline-colors.js +99 -0
- package/dist/rich-html/rich-html.d.ts +7 -0
- package/dist/rich-html/rich-html.js +123 -0
- package/dist/search.d.ts +27 -0
- package/dist/search.js +91 -0
- package/dist/theme.d.ts +67 -0
- package/dist/theme.js +68 -0
- package/dist/toast.d.ts +3 -0
- package/dist/toast.js +69 -0
- package/dist/ui-modal.d.ts +17 -0
- package/dist/ui-modal.js +151 -0
- package/package.json +35 -4
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ImageSourcePropType, PressableProps, StyleProp, TextProps, TextStyle, ViewProps, ViewStyle } from "react-native";
|
|
3
|
+
import { UIColors } from "./theme";
|
|
4
|
+
export interface UITextProps extends TextProps {
|
|
5
|
+
variant?: "caption" | "label" | "body" | "subtitle" | "title";
|
|
6
|
+
color?: keyof UIColors;
|
|
7
|
+
weight?: TextStyle["fontWeight"];
|
|
8
|
+
}
|
|
9
|
+
export declare function UIText({ variant, color, weight, style, ...props }: UITextProps): React.JSX.Element;
|
|
10
|
+
export interface ButtonProps extends Omit<PressableProps, "children" | "style"> {
|
|
11
|
+
label?: string;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
variant?: "primary" | "outline" | "ghost" | "danger";
|
|
14
|
+
size?: "small" | "normal";
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
/** Optional shared cooldown for press/long press; no throttle by default. */
|
|
17
|
+
throttleMs?: number;
|
|
18
|
+
leading?: React.ReactNode;
|
|
19
|
+
trailing?: React.ReactNode;
|
|
20
|
+
style?: StyleProp<ViewStyle>;
|
|
21
|
+
textStyle?: StyleProp<TextStyle>;
|
|
22
|
+
}
|
|
23
|
+
export declare function Button({ label, children, variant, size, loading, throttleMs, leading, trailing, disabled, style, textStyle, accessibilityLabel, accessibilityState, onPress, onLongPress, onPressIn, onPressOut, ...props }: ButtonProps): React.JSX.Element;
|
|
24
|
+
export interface HeaderActionProps extends Omit<PressableProps, "children" | "style"> {
|
|
25
|
+
accessibilityLabel: string;
|
|
26
|
+
icon?: React.ReactNode | ((props: {
|
|
27
|
+
color: string;
|
|
28
|
+
size: number;
|
|
29
|
+
}) => React.ReactNode);
|
|
30
|
+
label?: string;
|
|
31
|
+
active?: boolean;
|
|
32
|
+
indicator?: boolean;
|
|
33
|
+
style?: StyleProp<ViewStyle>;
|
|
34
|
+
}
|
|
35
|
+
/** A header action with shared geometry, feedback, and active-state colors. */
|
|
36
|
+
export declare function HeaderAction({ icon, label, active, indicator, disabled, accessibilityLabel, accessibilityState, hitSlop, style, ...props }: HeaderActionProps): React.JSX.Element;
|
|
37
|
+
export interface ScreenHeaderSearchProps {
|
|
38
|
+
active: boolean;
|
|
39
|
+
value: string;
|
|
40
|
+
onChangeText: (value: string) => void;
|
|
41
|
+
onSubmit?: (value: string) => void;
|
|
42
|
+
onClear?: () => void;
|
|
43
|
+
onCancel: () => void;
|
|
44
|
+
placeholder?: string;
|
|
45
|
+
cancelLabel?: string;
|
|
46
|
+
cancelIcon?: React.ReactNode;
|
|
47
|
+
leading?: React.ReactNode;
|
|
48
|
+
autoFocus?: boolean;
|
|
49
|
+
clearAccessibilityLabel?: string;
|
|
50
|
+
cancelAccessibilityLabel?: string;
|
|
51
|
+
accessibilityLabel?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface ScreenHeaderProps {
|
|
54
|
+
title: string;
|
|
55
|
+
variant?: "default" | "onAccent" | "surface";
|
|
56
|
+
onBack?: () => void;
|
|
57
|
+
backIcon?: React.ReactNode;
|
|
58
|
+
backAccessibilityLabel?: string;
|
|
59
|
+
leading?: React.ReactNode;
|
|
60
|
+
trailing?: React.ReactNode;
|
|
61
|
+
safeArea?: boolean;
|
|
62
|
+
style?: StyleProp<ViewStyle>;
|
|
63
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
64
|
+
titleWeight?: TextStyle["fontWeight"] | "platform";
|
|
65
|
+
search?: ScreenHeaderSearchProps;
|
|
66
|
+
}
|
|
67
|
+
export declare function ScreenHeader({ title, variant, onBack, backIcon, backAccessibilityLabel, leading, trailing, safeArea, style, titleStyle, titleWeight, search, }: ScreenHeaderProps): React.JSX.Element;
|
|
68
|
+
/** Header for an app-owned form sheet. Labels and callbacks belong to the app. */
|
|
69
|
+
export interface FormHeaderProps extends Omit<ViewProps, "children"> {
|
|
70
|
+
title: string;
|
|
71
|
+
cancelText: string;
|
|
72
|
+
confirmText: string;
|
|
73
|
+
onCancel: () => void;
|
|
74
|
+
onConfirm: () => void;
|
|
75
|
+
confirmDisabled?: boolean;
|
|
76
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
77
|
+
actionTextStyle?: StyleProp<TextStyle>;
|
|
78
|
+
disabledActionTextStyle?: StyleProp<TextStyle>;
|
|
79
|
+
cancelTestID?: string;
|
|
80
|
+
confirmTestID?: string;
|
|
81
|
+
}
|
|
82
|
+
export declare function FormHeader({ title, cancelText, confirmText, onCancel, onConfirm, confirmDisabled, style, titleStyle, actionTextStyle, disabledActionTextStyle, testID, cancelTestID, confirmTestID, ...props }: FormHeaderProps): React.JSX.Element;
|
|
83
|
+
export interface SkeletonProps extends ViewProps {
|
|
84
|
+
width?: ViewStyle["width"];
|
|
85
|
+
height?: number;
|
|
86
|
+
animated?: boolean;
|
|
87
|
+
variant?: "pulse" | "shimmer";
|
|
88
|
+
animationType?: "overlay" | "fade";
|
|
89
|
+
duration?: number;
|
|
90
|
+
primaryColor?: string;
|
|
91
|
+
secondaryColor?: string;
|
|
92
|
+
}
|
|
93
|
+
export declare function Skeleton({ width, height, animated, variant, animationType, duration, primaryColor, secondaryColor, style, onLayout, ...props }: SkeletonProps): React.JSX.Element;
|
|
94
|
+
export interface TextOrSkeletonProps extends Omit<UITextProps, "children"> {
|
|
95
|
+
showSkeleton: boolean;
|
|
96
|
+
value?: React.ReactNode;
|
|
97
|
+
textStyle?: StyleProp<TextStyle>;
|
|
98
|
+
skeletonStyle?: StyleProp<ViewStyle>;
|
|
99
|
+
skeletonProps?: SkeletonProps;
|
|
100
|
+
}
|
|
101
|
+
export declare function TextOrSkeleton({ showSkeleton, value, textStyle, skeletonStyle, skeletonProps, ...props }: TextOrSkeletonProps): React.JSX.Element;
|
|
102
|
+
export interface InfoRowProps {
|
|
103
|
+
label: React.ReactNode;
|
|
104
|
+
value?: React.ReactNode;
|
|
105
|
+
variant?: "detail" | "summary";
|
|
106
|
+
loading?: boolean;
|
|
107
|
+
divider?: boolean;
|
|
108
|
+
labelWidth?: number;
|
|
109
|
+
valueNumberOfLines?: number;
|
|
110
|
+
style?: StyleProp<ViewStyle>;
|
|
111
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
112
|
+
valueStyle?: StyleProp<TextStyle>;
|
|
113
|
+
}
|
|
114
|
+
export declare function InfoRow({ label, value, variant, loading, divider, labelWidth, valueNumberOfLines, style, labelStyle, valueStyle, }: InfoRowProps): React.JSX.Element;
|
|
115
|
+
export interface EmptyStateProps extends ViewProps {
|
|
116
|
+
variant?: "default" | "illustrated";
|
|
117
|
+
title?: string;
|
|
118
|
+
description?: string;
|
|
119
|
+
image?: ImageSourcePropType;
|
|
120
|
+
illustration?: React.ReactNode;
|
|
121
|
+
illustrationSize?: number;
|
|
122
|
+
/** Width divided by height, as in React Native aspectRatio. */
|
|
123
|
+
illustrationAspectRatio?: number;
|
|
124
|
+
action?: React.ReactNode;
|
|
125
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
126
|
+
descriptionStyle?: StyleProp<TextStyle>;
|
|
127
|
+
}
|
|
128
|
+
export declare function EmptyState({ variant, title, description, image, illustration, illustrationSize, illustrationAspectRatio, action, titleStyle, descriptionStyle, style, onLayout, ...props }: EmptyStateProps): React.JSX.Element;
|
|
129
|
+
export declare function Card({ style, ...props }: ViewProps): React.JSX.Element;
|
|
130
|
+
export interface CollapsibleSectionProps {
|
|
131
|
+
variant?: "default" | "bordered";
|
|
132
|
+
title: React.ReactNode;
|
|
133
|
+
children?: React.ReactNode;
|
|
134
|
+
expanded?: boolean;
|
|
135
|
+
defaultExpanded?: boolean;
|
|
136
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
137
|
+
trailing?: React.ReactNode;
|
|
138
|
+
style?: StyleProp<ViewStyle>;
|
|
139
|
+
headerStyle?: StyleProp<ViewStyle>;
|
|
140
|
+
testID?: string;
|
|
141
|
+
toggleTestID?: string;
|
|
142
|
+
contentTestID?: string;
|
|
143
|
+
}
|
|
144
|
+
export declare function CollapsibleSection({ variant, title, children, expanded, defaultExpanded, onExpandedChange, trailing, style, headerStyle, testID, toggleTestID, contentTestID, }: CollapsibleSectionProps): React.JSX.Element;
|
|
145
|
+
export interface BadgeProps {
|
|
146
|
+
children: React.ReactNode;
|
|
147
|
+
tone?: "accent" | "success" | "warning" | "danger" | "neutral";
|
|
148
|
+
color?: string;
|
|
149
|
+
backgroundColor?: string;
|
|
150
|
+
style?: StyleProp<ViewStyle>;
|
|
151
|
+
textStyle?: StyleProp<TextStyle>;
|
|
152
|
+
}
|
|
153
|
+
export declare function Badge({ children, tone, color, backgroundColor, style, textStyle, }: BadgeProps): React.JSX.Element;
|
|
154
|
+
export interface ActionBarProps extends ViewProps {
|
|
155
|
+
safeArea?: boolean;
|
|
156
|
+
}
|
|
157
|
+
export declare function ActionBar({ children, safeArea, style, ...props }: ActionBarProps): React.JSX.Element;
|
|
@@ -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
|
+
});
|