@agimon-ai/po-native-components 0.0.0-alpha.193 → 0.0.0-alpha.194
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/dist/components/EmptyState.d.mts +31 -3
- package/dist/components/EmptyState.d.mts.map +1 -1
- package/dist/components/EmptyState.mjs +293 -29
- package/dist/components/EmptyState.mjs.map +1 -1
- package/dist/components/FileList.d.mts +1 -1
- package/dist/components/FileList.d.mts.map +1 -1
- package/dist/components/FileList.mjs +29 -7
- package/dist/components/FileList.mjs.map +1 -1
- package/dist/components/LinkText.d.mts +11 -0
- package/dist/components/LinkText.d.mts.map +1 -0
- package/dist/components/LinkText.mjs +32 -0
- package/dist/components/LinkText.mjs.map +1 -0
- package/dist/icons/IconColorContext.d.mts +2 -1
- package/dist/icons/IconColorContext.d.mts.map +1 -1
- package/dist/icons/IconColorContext.mjs.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +2 -1
- package/dist/lib/markdown.mjs +98 -5
- package/dist/lib/markdown.mjs.map +1 -1
- package/dist/po-runtime-identity.json +1 -1
- package/package.json +5 -5
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
import { StyleProp, ViewStyle } from "react-native";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
//#region src/components/EmptyState.d.ts
|
|
4
|
+
/** One button an empty state offers: the next step that fills the surface. */
|
|
5
|
+
export interface EmptyStateAction {
|
|
6
|
+
label: string;
|
|
7
|
+
onAction: () => void;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
testId?: string;
|
|
11
|
+
}
|
|
12
|
+
export type EmptyStateSize = 'page' | 'panel' | 'compact' | 'inline';
|
|
4
13
|
export interface EmptyStateProps {
|
|
5
14
|
title: ReactNode;
|
|
15
|
+
/** Guidance: why the surface is empty and what fills it. */
|
|
6
16
|
description?: ReactNode;
|
|
7
|
-
/**
|
|
17
|
+
/** A glyph from the icon set, drawn in a quiet badge above the title (beside it when compact). Defaults to an alert glyph when `tone` is `error`. */
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
/** The one primary step. Filled jade on page and panel, outline when compact. */
|
|
20
|
+
action?: EmptyStateAction;
|
|
21
|
+
/** A quieter second step, such as clearing a filter or retrying. */
|
|
22
|
+
secondaryAction?: EmptyStateAction;
|
|
23
|
+
/**
|
|
24
|
+
* page: a whole screen. panel: a dock or tab (the default).
|
|
25
|
+
* compact: a list row; left-aligned and never takes `flex: 1`.
|
|
26
|
+
* inline: one quiet line under a header that already names the surface, such as an activity card.
|
|
27
|
+
* Drops the icon and frame; `surface` does not apply.
|
|
28
|
+
*/
|
|
29
|
+
size?: EmptyStateSize;
|
|
30
|
+
/** `plain` drops the card border when the empty state already sits inside a card. */
|
|
31
|
+
surface?: 'card' | 'plain';
|
|
32
|
+
/** `error` announces the state as an alert and tints only the icon red. */
|
|
33
|
+
tone?: 'neutral' | 'error';
|
|
34
|
+
/** Anything under the actions: a hint, a status line. */
|
|
8
35
|
children?: ReactNode;
|
|
9
36
|
style?: StyleProp<ViewStyle>;
|
|
37
|
+
testID?: string;
|
|
10
38
|
}
|
|
11
|
-
/** The
|
|
12
|
-
export declare function EmptyState({ title, description, children, style }: EmptyStateProps): import("react").JSX.Element;
|
|
39
|
+
/** The card every empty screen and panel shares: icon, title, guidance and, when the person can act, the next step. */
|
|
40
|
+
export declare function EmptyState({ title, description, icon, action, secondaryAction, size, surface, tone, children, style, testID }: EmptyStateProps): import("react").JSX.Element;
|
|
13
41
|
//#endregion
|
|
14
42
|
//# sourceMappingURL=EmptyState.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.d.mts","names":[],"sources":["../../src/components/EmptyState.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmptyState.d.mts","names":[],"sources":["../../src/components/EmptyState.tsx"],"mappings":";;;;iBAWiB;EACf;EACA;EACA;EACA;EACA;;YAGU;iBAEK;EACf,OAAO;;EAEP,cAAc;;EAEd,OAAO;;EAEP,SAAS;;EAET,kBAAkB;;;;;;;EAOlB,OAAO;;EAEP;;EAEA;;EAEA,WAAW;EACX,QAAQ,UAAU;EAClB;;;wBAIc,aACd,OACA,aACA,MACA,QACA,iBACA,MACA,SACA,MACA,UACA,OACA,UACC,kCAAe,IAAA"}
|
|
@@ -1,61 +1,325 @@
|
|
|
1
1
|
import { fontOf } from "../lib/fonts.mjs";
|
|
2
2
|
import { wrapText } from "../lib/wrapText.mjs";
|
|
3
|
+
import { Button } from "./Button.mjs";
|
|
4
|
+
import { AlertIcon } from "../icons/icons.mjs";
|
|
3
5
|
import { View } from "react-native-unistyles/components/native/View";
|
|
6
|
+
import { Text } from "react-native-unistyles/components/native/Text";
|
|
4
7
|
import { StyleSheet } from "react-native-unistyles";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { IconColorContext } from "@agimon-ai/po-native-components/shell";
|
|
6
10
|
|
|
7
11
|
//#region src/components/EmptyState.tsx
|
|
8
|
-
/** The
|
|
9
|
-
function EmptyState({ title, description, children, style }) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/** The card every empty screen and panel shares: icon, title, guidance and, when the person can act, the next step. */
|
|
13
|
+
function EmptyState({ title, description, icon, action, secondaryAction, size = "panel", surface = "card", tone = "neutral", children, style, testID }) {
|
|
14
|
+
const _styles = styles;
|
|
15
|
+
{
|
|
16
|
+
const styles = _styles.useVariants({ size: size === "inline" ? "compact" : size });
|
|
17
|
+
const compact = size === "compact";
|
|
18
|
+
const error = tone === "error";
|
|
19
|
+
if (size === "inline") return /* @__PURE__ */ jsxs(View, {
|
|
20
|
+
testID,
|
|
21
|
+
accessibilityRole: error ? "alert" : void 0,
|
|
22
|
+
accessibilityLiveRegion: error ? "polite" : void 0,
|
|
23
|
+
style: [styles.inline, style],
|
|
14
24
|
children: [
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
|
|
17
|
-
children:
|
|
25
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
26
|
+
style: [styles.inlineText, error && styles.inlineError],
|
|
27
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
28
|
+
style: styles.inlineTitle,
|
|
29
|
+
children: title
|
|
30
|
+
}), description ? /* @__PURE__ */ jsxs(Fragment, { children: [" · ", description] }) : null]
|
|
18
31
|
}),
|
|
19
|
-
|
|
32
|
+
action || secondaryAction ? /* @__PURE__ */ jsxs(View, {
|
|
33
|
+
style: styles.actions,
|
|
34
|
+
children: [action ? /* @__PURE__ */ jsx(Button, {
|
|
35
|
+
variant: "outline",
|
|
36
|
+
size: "sm",
|
|
37
|
+
loading: action.loading,
|
|
38
|
+
disabled: action.disabled,
|
|
39
|
+
testID: action.testId,
|
|
40
|
+
onPress: action.onAction,
|
|
41
|
+
children: action.label
|
|
42
|
+
}) : null, secondaryAction ? /* @__PURE__ */ jsx(Button, {
|
|
43
|
+
variant: "ghost",
|
|
44
|
+
size: "sm",
|
|
45
|
+
loading: secondaryAction.loading,
|
|
46
|
+
disabled: secondaryAction.disabled,
|
|
47
|
+
testID: secondaryAction.testId,
|
|
48
|
+
onPress: secondaryAction.onAction,
|
|
49
|
+
children: secondaryAction.label
|
|
50
|
+
}) : null]
|
|
51
|
+
}) : null,
|
|
20
52
|
children
|
|
21
53
|
]
|
|
22
|
-
})
|
|
23
|
-
|
|
54
|
+
});
|
|
55
|
+
const glyph = icon ?? (error ? /* @__PURE__ */ jsx(AlertIcon, { size: ICON_SIZE[size] }) : null);
|
|
56
|
+
return /* @__PURE__ */ jsx(View, {
|
|
57
|
+
testID,
|
|
58
|
+
accessibilityRole: error ? "alert" : void 0,
|
|
59
|
+
accessibilityLiveRegion: error ? "polite" : void 0,
|
|
60
|
+
style: [styles.frame, style],
|
|
61
|
+
children: /* @__PURE__ */ jsxs(View, {
|
|
62
|
+
style: [styles.card, surface === "card" && styles.surface],
|
|
63
|
+
children: [glyph ? /* @__PURE__ */ jsx(View, {
|
|
64
|
+
accessible: false,
|
|
65
|
+
importantForAccessibility: "no-hide-descendants",
|
|
66
|
+
style: [styles.icon, !compact && (error ? styles.iconEdgeError : styles.iconEdge)],
|
|
67
|
+
children: /* @__PURE__ */ jsx(IconColorContext.Provider, {
|
|
68
|
+
value: error ? "red" : "dim",
|
|
69
|
+
children: glyph
|
|
70
|
+
})
|
|
71
|
+
}) : null, /* @__PURE__ */ jsxs(View, {
|
|
72
|
+
style: styles.content,
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsxs(View, {
|
|
75
|
+
style: styles.copy,
|
|
76
|
+
children: [/* @__PURE__ */ jsx(View, {
|
|
77
|
+
accessibilityRole: "header",
|
|
78
|
+
children: wrapText(title, styles.title)
|
|
79
|
+
}), description ? wrapText(description, styles.description) : null]
|
|
80
|
+
}),
|
|
81
|
+
action || secondaryAction ? /* @__PURE__ */ jsxs(View, {
|
|
82
|
+
style: styles.actions,
|
|
83
|
+
children: [action ? /* @__PURE__ */ jsx(Button, {
|
|
84
|
+
variant: compact ? "outline" : "primary",
|
|
85
|
+
size: BUTTON_SIZE[size],
|
|
86
|
+
loading: action.loading,
|
|
87
|
+
disabled: action.disabled,
|
|
88
|
+
testID: action.testId,
|
|
89
|
+
onPress: action.onAction,
|
|
90
|
+
children: action.label
|
|
91
|
+
}) : null, secondaryAction ? /* @__PURE__ */ jsx(Button, {
|
|
92
|
+
variant: compact ? "ghost" : "outline",
|
|
93
|
+
size: BUTTON_SIZE[size],
|
|
94
|
+
loading: secondaryAction.loading,
|
|
95
|
+
disabled: secondaryAction.disabled,
|
|
96
|
+
testID: secondaryAction.testId,
|
|
97
|
+
onPress: secondaryAction.onAction,
|
|
98
|
+
children: secondaryAction.label
|
|
99
|
+
}) : null]
|
|
100
|
+
}) : null,
|
|
101
|
+
children
|
|
102
|
+
]
|
|
103
|
+
})]
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
}
|
|
24
107
|
}
|
|
108
|
+
const BUTTON_SIZE = {
|
|
109
|
+
page: "lg",
|
|
110
|
+
panel: "md",
|
|
111
|
+
compact: "sm"
|
|
112
|
+
};
|
|
113
|
+
const ICON_SIZE = {
|
|
114
|
+
page: 24,
|
|
115
|
+
panel: 20,
|
|
116
|
+
compact: 16
|
|
117
|
+
};
|
|
25
118
|
const styles = StyleSheet.create((theme) => ({
|
|
119
|
+
inline: {
|
|
120
|
+
alignSelf: "stretch",
|
|
121
|
+
minWidth: 0,
|
|
122
|
+
alignItems: "flex-start",
|
|
123
|
+
gap: theme.spacing(2),
|
|
124
|
+
uni__dependencies: [0]
|
|
125
|
+
},
|
|
126
|
+
inlineText: {
|
|
127
|
+
color: theme.colors.dim,
|
|
128
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
129
|
+
fontSize: theme.fontSize.sm,
|
|
130
|
+
lineHeight: theme.lineHeight.sm,
|
|
131
|
+
uni__dependencies: [0]
|
|
132
|
+
},
|
|
133
|
+
inlineTitle: {
|
|
134
|
+
fontWeight: theme.fontWeight.medium,
|
|
135
|
+
uni__dependencies: [0]
|
|
136
|
+
},
|
|
137
|
+
inlineError: {
|
|
138
|
+
color: theme.colors.red,
|
|
139
|
+
uni__dependencies: [0]
|
|
140
|
+
},
|
|
26
141
|
frame: {
|
|
27
|
-
flex: 1,
|
|
28
142
|
minWidth: 0,
|
|
143
|
+
variants: { size: {
|
|
144
|
+
page: {
|
|
145
|
+
flex: 1,
|
|
146
|
+
alignItems: "center",
|
|
147
|
+
justifyContent: "center",
|
|
148
|
+
paddingHorizontal: theme.spacing(3),
|
|
149
|
+
paddingVertical: theme.spacing(6)
|
|
150
|
+
},
|
|
151
|
+
panel: {
|
|
152
|
+
flex: 1,
|
|
153
|
+
alignItems: "center",
|
|
154
|
+
justifyContent: "center",
|
|
155
|
+
paddingHorizontal: theme.spacing(3),
|
|
156
|
+
paddingVertical: theme.spacing(4)
|
|
157
|
+
},
|
|
158
|
+
compact: { alignSelf: "stretch" }
|
|
159
|
+
} },
|
|
160
|
+
uni__dependencies: [0, 4]
|
|
161
|
+
},
|
|
162
|
+
card: {
|
|
163
|
+
width: "100%",
|
|
164
|
+
minWidth: 0,
|
|
165
|
+
variants: { size: {
|
|
166
|
+
page: {
|
|
167
|
+
maxWidth: 520,
|
|
168
|
+
alignItems: "center",
|
|
169
|
+
gap: theme.spacing(3),
|
|
170
|
+
padding: theme.spacing(6)
|
|
171
|
+
},
|
|
172
|
+
panel: {
|
|
173
|
+
maxWidth: 520,
|
|
174
|
+
alignItems: "center",
|
|
175
|
+
gap: theme.spacing(3),
|
|
176
|
+
padding: theme.spacing(5)
|
|
177
|
+
},
|
|
178
|
+
compact: {
|
|
179
|
+
flexDirection: "row",
|
|
180
|
+
alignItems: "flex-start",
|
|
181
|
+
gap: theme.spacing(2.5),
|
|
182
|
+
padding: theme.spacing(3)
|
|
183
|
+
}
|
|
184
|
+
} },
|
|
185
|
+
uni__dependencies: [0, 4]
|
|
186
|
+
},
|
|
187
|
+
surface: {
|
|
188
|
+
borderRadius: theme.borderRadius.md,
|
|
189
|
+
borderWidth: 1,
|
|
190
|
+
borderColor: theme.colors["border-soft"],
|
|
191
|
+
backgroundColor: theme.colors.panel,
|
|
192
|
+
uni__dependencies: [0]
|
|
193
|
+
},
|
|
194
|
+
icon: {
|
|
29
195
|
alignItems: "center",
|
|
30
196
|
justifyContent: "center",
|
|
31
|
-
|
|
32
|
-
|
|
197
|
+
variants: { size: {
|
|
198
|
+
page: {
|
|
199
|
+
width: 48,
|
|
200
|
+
height: 48,
|
|
201
|
+
borderRadius: 24,
|
|
202
|
+
backgroundColor: theme.colors.deep
|
|
203
|
+
},
|
|
204
|
+
panel: {
|
|
205
|
+
width: 40,
|
|
206
|
+
height: 40,
|
|
207
|
+
borderRadius: 20,
|
|
208
|
+
backgroundColor: theme.colors.deep
|
|
209
|
+
},
|
|
210
|
+
compact: {
|
|
211
|
+
width: 20,
|
|
212
|
+
height: theme.lineHeight.base
|
|
213
|
+
}
|
|
214
|
+
} },
|
|
215
|
+
uni__dependencies: [0, 4]
|
|
216
|
+
},
|
|
217
|
+
iconEdge: {
|
|
218
|
+
borderWidth: 1,
|
|
219
|
+
borderColor: theme.colors["border-soft"],
|
|
33
220
|
uni__dependencies: [0]
|
|
34
221
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
222
|
+
iconEdgeError: {
|
|
223
|
+
borderWidth: 1,
|
|
224
|
+
borderColor: theme.colors["edge-red"],
|
|
225
|
+
uni__dependencies: [0]
|
|
226
|
+
},
|
|
227
|
+
content: {
|
|
228
|
+
minWidth: 0,
|
|
229
|
+
variants: { size: {
|
|
230
|
+
page: {
|
|
231
|
+
alignSelf: "stretch",
|
|
232
|
+
alignItems: "center",
|
|
233
|
+
gap: theme.spacing(4)
|
|
234
|
+
},
|
|
235
|
+
panel: {
|
|
236
|
+
alignSelf: "stretch",
|
|
237
|
+
alignItems: "center",
|
|
238
|
+
gap: theme.spacing(4)
|
|
239
|
+
},
|
|
240
|
+
compact: {
|
|
241
|
+
flex: 1,
|
|
242
|
+
alignItems: "flex-start",
|
|
243
|
+
gap: theme.spacing(2)
|
|
244
|
+
}
|
|
245
|
+
} },
|
|
246
|
+
uni__dependencies: [0, 4]
|
|
247
|
+
},
|
|
248
|
+
copy: {
|
|
38
249
|
minWidth: 0,
|
|
250
|
+
variants: { size: {
|
|
251
|
+
page: {
|
|
252
|
+
alignItems: "center",
|
|
253
|
+
gap: theme.spacing(1.5)
|
|
254
|
+
},
|
|
255
|
+
panel: {
|
|
256
|
+
alignItems: "center",
|
|
257
|
+
gap: theme.spacing(1.5)
|
|
258
|
+
},
|
|
259
|
+
compact: {
|
|
260
|
+
alignSelf: "stretch",
|
|
261
|
+
gap: theme.spacing(.5)
|
|
262
|
+
}
|
|
263
|
+
} },
|
|
264
|
+
uni__dependencies: [0, 4]
|
|
265
|
+
},
|
|
266
|
+
actions: {
|
|
267
|
+
flexDirection: "row",
|
|
268
|
+
flexWrap: "wrap",
|
|
39
269
|
alignItems: "center",
|
|
40
|
-
gap: theme.spacing(
|
|
41
|
-
|
|
270
|
+
gap: theme.spacing(2),
|
|
271
|
+
variants: { size: {
|
|
272
|
+
page: { justifyContent: "center" },
|
|
273
|
+
panel: { justifyContent: "center" },
|
|
274
|
+
compact: { justifyContent: "flex-start" }
|
|
275
|
+
} },
|
|
276
|
+
uni__dependencies: [0, 4]
|
|
42
277
|
},
|
|
43
278
|
title: {
|
|
44
279
|
color: theme.colors.hi,
|
|
45
280
|
fontFamily: fontOf(theme.fontFamily.sans),
|
|
46
|
-
fontSize: theme.fontSize.lg,
|
|
47
|
-
lineHeight: theme.lineHeight.lg,
|
|
48
281
|
fontWeight: theme.fontWeight.semibold,
|
|
49
|
-
|
|
50
|
-
|
|
282
|
+
variants: { size: {
|
|
283
|
+
page: {
|
|
284
|
+
fontSize: theme.fontSize.xl,
|
|
285
|
+
lineHeight: theme.lineHeight.xl,
|
|
286
|
+
letterSpacing: theme.letterSpacing.xl,
|
|
287
|
+
textAlign: "center"
|
|
288
|
+
},
|
|
289
|
+
panel: {
|
|
290
|
+
fontSize: theme.fontSize.lg,
|
|
291
|
+
lineHeight: theme.lineHeight.lg,
|
|
292
|
+
textAlign: "center"
|
|
293
|
+
},
|
|
294
|
+
compact: {
|
|
295
|
+
fontSize: theme.fontSize.base,
|
|
296
|
+
lineHeight: theme.lineHeight.base
|
|
297
|
+
}
|
|
298
|
+
} },
|
|
299
|
+
uni__dependencies: [0, 4]
|
|
51
300
|
},
|
|
52
301
|
description: {
|
|
53
302
|
color: theme.colors.dim,
|
|
54
303
|
fontFamily: fontOf(theme.fontFamily.sans),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
304
|
+
variants: { size: {
|
|
305
|
+
page: {
|
|
306
|
+
maxWidth: 360,
|
|
307
|
+
fontSize: theme.fontSize.base,
|
|
308
|
+
lineHeight: theme.lineHeightRelaxed.base,
|
|
309
|
+
textAlign: "center"
|
|
310
|
+
},
|
|
311
|
+
panel: {
|
|
312
|
+
maxWidth: 360,
|
|
313
|
+
fontSize: theme.fontSize.base,
|
|
314
|
+
lineHeight: theme.lineHeightRelaxed.base,
|
|
315
|
+
textAlign: "center"
|
|
316
|
+
},
|
|
317
|
+
compact: {
|
|
318
|
+
fontSize: theme.fontSize.sm,
|
|
319
|
+
lineHeight: theme.lineHeight.sm
|
|
320
|
+
}
|
|
321
|
+
} },
|
|
322
|
+
uni__dependencies: [0, 4]
|
|
59
323
|
}
|
|
60
324
|
}));
|
|
61
325
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState.mjs","names":["ReactNode","StyleProp","ViewStyle","StyleSheet","fontOf","wrapText","EmptyStateProps","title","description","children","style","EmptyState","styles","frame","column","create","theme","flex","minWidth","alignItems","justifyContent","paddingHorizontal","spacing","paddingVertical","uni__dependencies","width","maxWidth","gap","color","colors","hi","fontFamily","sans","fontSize","lg","lineHeight","fontWeight","semibold","textAlign","dim","base","lineHeightRelaxed"],"sources":["../../src/components/EmptyState.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { fontOf } from '../lib/fonts';\nimport { wrapText } from '../lib/wrapText';\n\nexport interface EmptyStateProps {\n title: ReactNode;\n description?: ReactNode;\n /** Optional calls to action under the copy. */\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n}\n\n/** The centred \"nothing here yet\" block every empty screen and panel shares. */\nexport function EmptyState({ title, description, children, style }: EmptyStateProps) {\n return (\n <View style={[styles.frame, style]}>\n <View style={styles.column}>\n <View accessibilityRole=\"header\">{wrapText(title, styles.title)}</View>\n {description ? wrapText(description, styles.description) : null}\n {children}\n </View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme) => ({\n frame: {\n flex: 1,\n minWidth: 0,\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: theme.spacing(3),\n paddingVertical: theme.spacing(4),\n },\n column: {\n width: '100%',\n maxWidth: 520,\n minWidth: 0,\n alignItems: 'center',\n gap: theme.spacing(3),\n },\n title: {\n color: theme.colors.hi,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.lg,\n lineHeight: theme.lineHeight.lg,\n fontWeight: theme.fontWeight.semibold,\n textAlign: 'center',\n },\n description: {\n color: theme.colors.dim,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeightRelaxed.base,\n textAlign: 'center',\n },\n}));\n"],"mappings":";;;;;;;;AAgBA,SAAgBW,WAAW,EAAEJ,OAAOC,aAAaC,UAAUC,SAA0B;CACnF,OACE,oBAAC,MAAD;EAAM,OAAO,CAACE,OAAOC,OAAOH,KAAK;YAC/B,qBAAC,MAAD;GAAM,OAAOE,OAAOE;aAApB;IACE,oBAAC,MAAD;KAAM,mBAAkB;eAAUT,SAASE,OAAOK,OAAOL,KAAK;IAAQ;IACrEC,cAAcH,SAASG,aAAaI,OAAOJ,WAAW,IAAI;IAC1DC;GACG;;CACF;AAEV;AAEA,MAAMG,SAAST,WAAWY,QAAQC,WAAW;CAC3CH,OAAO;EACLI,MAAM;EACNC,UAAU;EACVC,YAAY;EACZC,gBAAgB;EAChBC,mBAAmBL,MAAMM,QAAQ,CAAC;EAClCC,iBAAiBP,MAAMM,QAAQ,CAAC;EAACE,mBAAA,CAAA,CAAA;CACnC;CACAV,QAAQ;EACNW,OAAO;EACPC,UAAU;EACVR,UAAU;EACVC,YAAY;EACZQ,KAAKX,MAAMM,QAAQ,CAAC;EAACE,mBAAA,CAAA,CAAA;CACvB;CACAjB,OAAO;EACLqB,OAAOZ,MAAMa,OAAOC;EACpBC,YAAY3B,OAAOY,MAAMe,WAAWC,IAAI;EACxCC,UAAUjB,MAAMiB,SAASC;EACzBC,YAAYnB,MAAMmB,WAAWD;EAC7BE,YAAYpB,MAAMoB,WAAWC;EAC7BC,WAAW;EAAQd,mBAAA,CAAA,CAAA;CACrB;CACAhB,aAAa;EACXoB,OAAOZ,MAAMa,OAAOU;EACpBR,YAAY3B,OAAOY,MAAMe,WAAWC,IAAI;EACxCC,UAAUjB,MAAMiB,SAASO;EACzBL,YAAYnB,MAAMyB,kBAAkBD;EACpCF,WAAW;EAAQd,mBAAA,CAAA,CAAA;CACrB;AACF,EAAE"}
|
|
1
|
+
{"version":3,"file":"EmptyState.mjs","names":["IconColorContext","ReactNode","StyleProp","ViewStyle","StyleSheet","AlertIcon","fontOf","wrapText","Button","EmptyStateAction","label","onAction","loading","disabled","testId","EmptyStateSize","EmptyStateProps","title","description","icon","action","secondaryAction","size","surface","tone","children","style","testID","EmptyState","_styles","styles","useVariants","compact","error","undefined","inline","inlineText","inlineError","inlineTitle","actions","glyph","ICON_SIZE","frame","card","iconEdgeError","iconEdge","content","copy","BUTTON_SIZE","page","panel","const","create","theme","alignSelf","minWidth","alignItems","gap","spacing","uni__dependencies","color","colors","dim","fontFamily","sans","fontSize","sm","lineHeight","fontWeight","medium","red","variants","flex","justifyContent","paddingHorizontal","paddingVertical","width","maxWidth","padding","flexDirection","borderRadius","md","borderWidth","borderColor","backgroundColor","height","deep","base","flexWrap","hi","semibold","xl","letterSpacing","textAlign","lg","lineHeightRelaxed"],"sources":["../../src/components/EmptyState.tsx"],"sourcesContent":["import { IconColorContext } from '@agimon-ai/po-native-components/shell';\nimport type { ReactNode } from 'react';\nimport { type StyleProp, Text, View, type ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { AlertIcon } from '../icons/icons';\nimport { fontOf } from '../lib/fonts';\nimport { wrapText } from '../lib/wrapText';\nimport { Button } from './Button';\n\n/** One button an empty state offers: the next step that fills the surface. */\nexport interface EmptyStateAction {\n label: string;\n onAction: () => void;\n loading?: boolean;\n disabled?: boolean;\n testId?: string;\n}\n\nexport type EmptyStateSize = 'page' | 'panel' | 'compact' | 'inline';\n\nexport interface EmptyStateProps {\n title: ReactNode;\n /** Guidance: why the surface is empty and what fills it. */\n description?: ReactNode;\n /** A glyph from the icon set, drawn in a quiet badge above the title (beside it when compact). Defaults to an alert glyph when `tone` is `error`. */\n icon?: ReactNode;\n /** The one primary step. Filled jade on page and panel, outline when compact. */\n action?: EmptyStateAction;\n /** A quieter second step, such as clearing a filter or retrying. */\n secondaryAction?: EmptyStateAction;\n /**\n * page: a whole screen. panel: a dock or tab (the default).\n * compact: a list row; left-aligned and never takes `flex: 1`.\n * inline: one quiet line under a header that already names the surface, such as an activity card.\n * Drops the icon and frame; `surface` does not apply.\n */\n size?: EmptyStateSize;\n /** `plain` drops the card border when the empty state already sits inside a card. */\n surface?: 'card' | 'plain';\n /** `error` announces the state as an alert and tints only the icon red. */\n tone?: 'neutral' | 'error';\n /** Anything under the actions: a hint, a status line. */\n children?: ReactNode;\n style?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\n/** The card every empty screen and panel shares: icon, title, guidance and, when the person can act, the next step. */\nexport function EmptyState({\n title,\n description,\n icon,\n action,\n secondaryAction,\n size = 'panel',\n surface = 'card',\n tone = 'neutral',\n children,\n style,\n testID,\n}: EmptyStateProps) {\n // Inline has no variant styles of its own; hooks still run on every render.\n styles.useVariants({ size: size === 'inline' ? 'compact' : size });\n const compact = size === 'compact';\n const error = tone === 'error';\n if (size === 'inline') {\n return (\n <View\n testID={testID}\n accessibilityRole={error ? 'alert' : undefined}\n accessibilityLiveRegion={error ? 'polite' : undefined}\n style={[styles.inline, style]}\n >\n <Text style={[styles.inlineText, error && styles.inlineError]}>\n <Text style={styles.inlineTitle}>{title}</Text>\n {description ? <> · {description}</> : null}\n </Text>\n {action || secondaryAction ? (\n <View style={styles.actions}>\n {action ? (\n <Button\n variant=\"outline\"\n size=\"sm\"\n loading={action.loading}\n disabled={action.disabled}\n testID={action.testId}\n onPress={action.onAction}\n >\n {action.label}\n </Button>\n ) : null}\n {secondaryAction ? (\n <Button\n variant=\"ghost\"\n size=\"sm\"\n loading={secondaryAction.loading}\n disabled={secondaryAction.disabled}\n testID={secondaryAction.testId}\n onPress={secondaryAction.onAction}\n >\n {secondaryAction.label}\n </Button>\n ) : null}\n </View>\n ) : null}\n {children}\n </View>\n );\n }\n const glyph = icon ?? (error ? <AlertIcon size={ICON_SIZE[size]} /> : null);\n return (\n <View\n testID={testID}\n accessibilityRole={error ? 'alert' : undefined}\n accessibilityLiveRegion={error ? 'polite' : undefined}\n style={[styles.frame, style]}\n >\n <View style={[styles.card, surface === 'card' && styles.surface]}>\n {glyph ? (\n <View\n accessible={false}\n importantForAccessibility=\"no-hide-descendants\"\n style={[styles.icon, !compact && (error ? styles.iconEdgeError : styles.iconEdge)]}\n >\n <IconColorContext.Provider value={error ? 'red' : 'dim'}>{glyph}</IconColorContext.Provider>\n </View>\n ) : null}\n <View style={styles.content}>\n <View style={styles.copy}>\n <View accessibilityRole=\"header\">{wrapText(title, styles.title)}</View>\n {description ? wrapText(description, styles.description) : null}\n </View>\n {action || secondaryAction ? (\n <View style={styles.actions}>\n {action ? (\n <Button\n variant={compact ? 'outline' : 'primary'}\n size={BUTTON_SIZE[size]}\n loading={action.loading}\n disabled={action.disabled}\n testID={action.testId}\n onPress={action.onAction}\n >\n {action.label}\n </Button>\n ) : null}\n {secondaryAction ? (\n <Button\n variant={compact ? 'ghost' : 'outline'}\n size={BUTTON_SIZE[size]}\n loading={secondaryAction.loading}\n disabled={secondaryAction.disabled}\n testID={secondaryAction.testId}\n onPress={secondaryAction.onAction}\n >\n {secondaryAction.label}\n </Button>\n ) : null}\n </View>\n ) : null}\n {children}\n </View>\n </View>\n </View>\n );\n}\n\nconst BUTTON_SIZE = { page: 'lg', panel: 'md', compact: 'sm' } as const;\nconst ICON_SIZE = { page: 24, panel: 20, compact: 16 } as const;\nconst styles = StyleSheet.create((theme) => ({\n inline: { alignSelf: 'stretch', minWidth: 0, alignItems: 'flex-start', gap: theme.spacing(2) },\n inlineText: {\n color: theme.colors.dim,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n inlineTitle: { fontWeight: theme.fontWeight.medium },\n inlineError: { color: theme.colors.red },\n frame: {\n minWidth: 0,\n variants: {\n size: {\n page: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: theme.spacing(3),\n paddingVertical: theme.spacing(6),\n },\n panel: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n paddingHorizontal: theme.spacing(3),\n paddingVertical: theme.spacing(4),\n },\n compact: { alignSelf: 'stretch' },\n },\n },\n },\n card: {\n width: '100%',\n minWidth: 0,\n variants: {\n size: {\n page: { maxWidth: 520, alignItems: 'center', gap: theme.spacing(3), padding: theme.spacing(6) },\n panel: { maxWidth: 520, alignItems: 'center', gap: theme.spacing(3), padding: theme.spacing(5) },\n compact: { flexDirection: 'row', alignItems: 'flex-start', gap: theme.spacing(2.5), padding: theme.spacing(3) },\n },\n },\n },\n surface: {\n borderRadius: theme.borderRadius.md,\n borderWidth: 1,\n borderColor: theme.colors['border-soft'],\n backgroundColor: theme.colors.panel,\n },\n icon: {\n alignItems: 'center',\n justifyContent: 'center',\n variants: {\n size: {\n page: { width: 48, height: 48, borderRadius: 24, backgroundColor: theme.colors.deep },\n panel: { width: 40, height: 40, borderRadius: 20, backgroundColor: theme.colors.deep },\n compact: { width: 20, height: theme.lineHeight.base },\n },\n },\n },\n iconEdge: { borderWidth: 1, borderColor: theme.colors['border-soft'] },\n iconEdgeError: { borderWidth: 1, borderColor: theme.colors['edge-red'] },\n content: {\n minWidth: 0,\n variants: {\n size: {\n page: { alignSelf: 'stretch', alignItems: 'center', gap: theme.spacing(4) },\n panel: { alignSelf: 'stretch', alignItems: 'center', gap: theme.spacing(4) },\n compact: { flex: 1, alignItems: 'flex-start', gap: theme.spacing(2) },\n },\n },\n },\n copy: {\n minWidth: 0,\n variants: {\n size: {\n page: { alignItems: 'center', gap: theme.spacing(1.5) },\n panel: { alignItems: 'center', gap: theme.spacing(1.5) },\n compact: { alignSelf: 'stretch', gap: theme.spacing(0.5) },\n },\n },\n },\n actions: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n alignItems: 'center',\n gap: theme.spacing(2),\n variants: {\n size: {\n page: { justifyContent: 'center' },\n panel: { justifyContent: 'center' },\n compact: { justifyContent: 'flex-start' },\n },\n },\n },\n title: {\n color: theme.colors.hi,\n fontFamily: fontOf(theme.fontFamily.sans),\n fontWeight: theme.fontWeight.semibold,\n variants: {\n size: {\n page: {\n fontSize: theme.fontSize.xl,\n lineHeight: theme.lineHeight.xl,\n letterSpacing: theme.letterSpacing.xl,\n textAlign: 'center',\n },\n panel: { fontSize: theme.fontSize.lg, lineHeight: theme.lineHeight.lg, textAlign: 'center' },\n compact: { fontSize: theme.fontSize.base, lineHeight: theme.lineHeight.base },\n },\n },\n },\n description: {\n color: theme.colors.dim,\n fontFamily: fontOf(theme.fontFamily.sans),\n variants: {\n size: {\n page: {\n maxWidth: 360,\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeightRelaxed.base,\n textAlign: 'center',\n },\n panel: {\n maxWidth: 360,\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeightRelaxed.base,\n textAlign: 'center',\n },\n compact: { fontSize: theme.fontSize.sm, lineHeight: theme.lineHeight.sm },\n },\n },\n },\n}));\n"],"mappings":";;;;;;;;;;;;AAiDA,SAAgB4B,WAAW,EACzBX,OACAC,aACAC,MACAC,QACAC,iBACAC,OAAO,SACPC,UAAU,QACVC,OAAO,WACPC,UACAC,OACAC,UACkB;CAAA,MAAAE,UAAAC;CAAA;EAAA,MAAAA,SAAAD,QAAAE,YAEC,EAAET,MAAMA,SAAS,WAAW,YAAYA,KAAK,CAAC;EACjE,MAAMU,UAAUV,SAAS;EACzB,MAAMW,QAAQT,SAAS;EACvB,IAAIF,SAAS,UACX,OACE,qBAAC,MAAD;GACUK;GACR,mBAAmBM,QAAQ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gB,SAAS;GACjCvB,OAAO,EAAEuB,gBAAgB,SAAS;GAClCzC,SAAS,EAAEyC,gBAAgB,aAAa;EAC1C,EACF;EAACd,mBAAA,CAAA,GAAA,CAAA;CACH;CACA1C,OAAO;EACL2C,OAAOP,MAAMQ,OAAO4B;EACpB1B,YAAYzD,OAAO+C,MAAMU,WAAWC,IAAI;EACxCI,YAAYf,MAAMe,WAAWsB;EAC7BnB,UAAU,EACRjD,MAAM;GACJ2B,MAAM;IACJgB,UAAUZ,MAAMY,SAAS0B;IACzBxB,YAAYd,MAAMc,WAAWwB;IAC7BC,eAAevC,MAAMuC,cAAcD;IACnCE,WAAW;GACb;GACA3C,OAAO;IAAEe,UAAUZ,MAAMY,SAAS6B;IAAI3B,YAAYd,MAAMc,WAAW2B;IAAID,WAAW;GAAS;GAC3F7D,SAAS;IAAEiC,UAAUZ,MAAMY,SAASsB;IAAMpB,YAAYd,MAAMc,WAAWoB;GAAK;EAC9E,EACF;EAAC5B,mBAAA,CAAA,GAAA,CAAA;CACH;CACAzC,aAAa;EACX0C,OAAOP,MAAMQ,OAAOC;EACpBC,YAAYzD,OAAO+C,MAAMU,WAAWC,IAAI;EACxCO,UAAU,EACRjD,MAAM;GACJ2B,MAAM;IACJ4B,UAAU;IACVZ,UAAUZ,MAAMY,SAASsB;IACzBpB,YAAYd,MAAM0C,kBAAkBR;IACpCM,WAAW;GACb;GACA3C,OAAO;IACL2B,UAAU;IACVZ,UAAUZ,MAAMY,SAASsB;IACzBpB,YAAYd,MAAM0C,kBAAkBR;IACpCM,WAAW;GACb;GACA7D,SAAS;IAAEiC,UAAUZ,MAAMY,SAASC;IAAIC,YAAYd,MAAMc,WAAWD;GAAG;EAC1E,EACF;EAACP,mBAAA,CAAA,GAAA,CAAA;CACH;AACF,EAAE"}
|
|
@@ -35,7 +35,7 @@ export interface FileListProps {
|
|
|
35
35
|
error?: string;
|
|
36
36
|
/** Names the list for search and layout, such as "artifacts" or "Personal". */
|
|
37
37
|
label: string;
|
|
38
|
-
/**
|
|
38
|
+
/** Guidance under the empty card's title: why the list is empty and what fills it. */
|
|
39
39
|
emptyText: string;
|
|
40
40
|
grid?: boolean;
|
|
41
41
|
browser?: FileBrowserControls;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileList.d.mts","names":[],"sources":["../../src/components/FileList.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"FileList.d.mts","names":[],"sources":["../../src/components/FileList.tsx"],"mappings":";;;iBA0CiB;EACf,QAAQ;EACR,iBAAiB,QAAQ;EACzB;EACA,gBAAgB;EAChB,MAAM;EACN,eAAe,MAAM;EACrB,UAAU;EACV,mBAAmB,UAAU;EAC7B,MAAM;EACN,eAAe,MAAM;EACrB,WAAW;EACX,oBAAoB,WAAW;EAC/B,eAAe;EACf,oBAAoB;EACpB,WAAW;EACX,WAAW,MAAM;EACjB;EACA;EACA,0BAA0B;;EAE1B,eAAe,MAAM,UAAU,qBAAqB;;EAEpD,SAAS;;EAET;;iBAGe;EACf,gBAAgB;EAChB,SAAS;EACT;EACA;;EAEA;;EAEA;EACA;EACA,UAAU;;;wBAII,WAAW,OAAO,QAAQ,SAAS,OAAO,MAAc,SAAS,OAAO,aAAa,gCAAa,IAAA"}
|
|
@@ -2,6 +2,7 @@ import { fontOf } from "../lib/fonts.mjs";
|
|
|
2
2
|
import { Button } from "./Button.mjs";
|
|
3
3
|
import { ChevronDownIcon, ChevronRightIcon, CloseIcon, FileIcon, FolderIcon, ImageIcon, SearchIcon, SlidersIcon } from "../icons/icons.mjs";
|
|
4
4
|
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./DropdownMenu.mjs";
|
|
5
|
+
import { EmptyState } from "./EmptyState.mjs";
|
|
5
6
|
import { Input } from "./Input.mjs";
|
|
6
7
|
import { SegmentedControl } from "./SegmentedControl.mjs";
|
|
7
8
|
import { Sheet, SheetContent } from "./Sheet.mjs";
|
|
@@ -40,9 +41,12 @@ function FileList({ items, onOpen, loading, error, grid = false, browser, label,
|
|
|
40
41
|
style: styles.meta,
|
|
41
42
|
children: "Loading files..."
|
|
42
43
|
}) : null,
|
|
43
|
-
!loading && !error && items.length === 0 ? /* @__PURE__ */ jsx(
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
!loading && !error && items.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
45
|
+
size: "compact",
|
|
46
|
+
surface: "plain",
|
|
47
|
+
icon: /* @__PURE__ */ jsx(FolderIcon, { size: 16 }),
|
|
48
|
+
title: "Nothing here yet",
|
|
49
|
+
description: emptyText
|
|
46
50
|
}) : null,
|
|
47
51
|
items.map((item) => /* @__PURE__ */ jsxs(Button, {
|
|
48
52
|
variant: grid ? "outline" : "ghost",
|
|
@@ -261,10 +265,28 @@ function FileBrowserList({ items, onOpen, loading, error, browser: b, label, emp
|
|
|
261
265
|
}) : null
|
|
262
266
|
]
|
|
263
267
|
})] }),
|
|
264
|
-
ListEmptyComponent:
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
+
ListEmptyComponent: loading || error ? void 0 : b.totalCount ? /* @__PURE__ */ jsx(EmptyState, {
|
|
269
|
+
size: "compact",
|
|
270
|
+
surface: "plain",
|
|
271
|
+
icon: /* @__PURE__ */ jsx(SearchIcon, { size: 16 }),
|
|
272
|
+
title: "No files match",
|
|
273
|
+
secondaryAction: {
|
|
274
|
+
label: "Clear filters",
|
|
275
|
+
onAction: () => {
|
|
276
|
+
b.onQueryChange("");
|
|
277
|
+
b.onTypeChange("any");
|
|
278
|
+
b.onModifiedChange("any");
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
style: styles.inset
|
|
282
|
+
}) : /* @__PURE__ */ jsx(EmptyState, {
|
|
283
|
+
size: "compact",
|
|
284
|
+
surface: "plain",
|
|
285
|
+
icon: /* @__PURE__ */ jsx(FolderIcon, { size: 16 }),
|
|
286
|
+
title: "Nothing here yet",
|
|
287
|
+
description: emptyText,
|
|
288
|
+
style: styles.inset
|
|
289
|
+
}),
|
|
268
290
|
renderItem: ({ item: row }) => {
|
|
269
291
|
if (row.kind === "dir") return /* @__PURE__ */ jsxs(Button, {
|
|
270
292
|
variant: "ghost",
|