@xemahq/ui-kernel 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +19 -0
  2. package/dist/lib/biome-host/index.d.ts +2 -0
  3. package/dist/lib/biome-host/index.d.ts.map +1 -1
  4. package/dist/lib/biome-host/index.js +2 -0
  5. package/dist/lib/biome-host/index.js.map +1 -1
  6. package/dist/lib/biome-host/use-mutation-with-error-toast.d.ts +10 -0
  7. package/dist/lib/biome-host/use-mutation-with-error-toast.d.ts.map +1 -0
  8. package/dist/lib/biome-host/use-mutation-with-error-toast.js +35 -0
  9. package/dist/lib/biome-host/use-mutation-with-error-toast.js.map +1 -0
  10. package/dist/lib/biome-host/use-page-state.d.ts +4 -0
  11. package/dist/lib/biome-host/use-page-state.d.ts.map +1 -0
  12. package/dist/lib/biome-host/use-page-state.js +140 -0
  13. package/dist/lib/biome-host/use-page-state.js.map +1 -0
  14. package/dist/ui/chrome/confirm-delete-dialog.d.ts +11 -0
  15. package/dist/ui/chrome/confirm-delete-dialog.d.ts.map +1 -0
  16. package/dist/ui/chrome/confirm-delete-dialog.js +10 -0
  17. package/dist/ui/chrome/confirm-delete-dialog.js.map +1 -0
  18. package/dist/ui/chrome/page-shell.d.ts +27 -0
  19. package/dist/ui/chrome/page-shell.d.ts.map +1 -0
  20. package/dist/ui/chrome/page-shell.js +19 -0
  21. package/dist/ui/chrome/page-shell.js.map +1 -0
  22. package/dist/ui/chrome/scope-badge.d.ts +9 -0
  23. package/dist/ui/chrome/scope-badge.d.ts.map +1 -0
  24. package/dist/ui/chrome/scope-badge.js +10 -0
  25. package/dist/ui/chrome/scope-badge.js.map +1 -0
  26. package/dist/ui/chrome/status-badge.d.ts +11 -0
  27. package/dist/ui/chrome/status-badge.d.ts.map +1 -0
  28. package/dist/ui/chrome/status-badge.js +30 -0
  29. package/dist/ui/chrome/status-badge.js.map +1 -0
  30. package/dist/ui/design-tokens.d.ts +72 -0
  31. package/dist/ui/design-tokens.d.ts.map +1 -0
  32. package/dist/ui/design-tokens.js +251 -0
  33. package/dist/ui/design-tokens.js.map +1 -0
  34. package/dist/ui/hooks/use-debounced-value.d.ts +2 -0
  35. package/dist/ui/hooks/use-debounced-value.d.ts.map +1 -0
  36. package/dist/ui/hooks/use-debounced-value.js +13 -0
  37. package/dist/ui/hooks/use-debounced-value.js.map +1 -0
  38. package/dist/ui/index.d.ts +8 -0
  39. package/dist/ui/index.d.ts.map +1 -1
  40. package/dist/ui/index.js +14 -1
  41. package/dist/ui/index.js.map +1 -1
  42. package/dist/ui/primitives/async-combobox.d.ts +19 -0
  43. package/dist/ui/primitives/async-combobox.d.ts.map +1 -0
  44. package/dist/ui/primitives/async-combobox.js +42 -0
  45. package/dist/ui/primitives/async-combobox.js.map +1 -0
  46. package/dist/ui/primitives/form-stepper.d.ts +19 -0
  47. package/dist/ui/primitives/form-stepper.d.ts.map +1 -0
  48. package/dist/ui/primitives/form-stepper.js +23 -0
  49. package/dist/ui/primitives/form-stepper.js.map +1 -0
  50. package/package.json +1 -1
  51. package/src/lib/biome-host/index.ts +2 -0
  52. package/src/lib/biome-host/use-mutation-with-error-toast.ts +88 -0
  53. package/src/lib/biome-host/use-page-state.ts +231 -0
  54. package/src/ui/chrome/confirm-delete-dialog.tsx +59 -0
  55. package/src/ui/chrome/page-shell.tsx +165 -0
  56. package/src/ui/chrome/scope-badge.tsx +40 -0
  57. package/src/ui/chrome/status-badge.tsx +75 -0
  58. package/src/ui/design-tokens.ts +346 -0
  59. package/src/ui/hooks/use-debounced-value.ts +16 -0
  60. package/src/ui/index.ts +15 -0
  61. package/src/ui/primitives/async-combobox.tsx +178 -0
  62. package/src/ui/primitives/form-stepper.tsx +109 -0
@@ -0,0 +1,251 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ORIGIN_STYLES = exports.STATE_STYLES = exports.KIND_STYLES = exports.AGENT_SOURCE_STYLES = exports.RISK_LEVEL_STYLES = exports.IMPORTANCE_STYLES = exports.SECTION_STYLES = exports.CARD_STYLES = exports.TYPE_STYLES = exports.SEVERITY_STYLES = exports.PRIORITY_STYLES = exports.STATUS_STYLES = exports.TONE_STYLES = void 0;
4
+ exports.getStatusStyle = getStatusStyle;
5
+ exports.getPriorityStyle = getPriorityStyle;
6
+ exports.getSeverityStyle = getSeverityStyle;
7
+ exports.getRiskLevelStyle = getRiskLevelStyle;
8
+ const SUCCESS_STYLE = {
9
+ badge: 'bg-success/15 text-success dark:text-success border-success/30',
10
+ dot: 'bg-success',
11
+ text: 'text-success dark:text-success',
12
+ bg: 'bg-success/10',
13
+ border: 'border-success/30',
14
+ icon: 'text-success',
15
+ };
16
+ const WARNING_STYLE = {
17
+ badge: 'bg-warning/15 text-warning dark:text-warning border-warning/30',
18
+ dot: 'bg-warning',
19
+ text: 'text-warning dark:text-warning',
20
+ bg: 'bg-warning/10',
21
+ border: 'border-warning/30',
22
+ icon: 'text-warning',
23
+ };
24
+ const INFO_STYLE = {
25
+ badge: 'bg-info/15 text-info dark:text-info border-info/30',
26
+ dot: 'bg-info',
27
+ text: 'text-info dark:text-info',
28
+ bg: 'bg-info/10',
29
+ border: 'border-info/30',
30
+ icon: 'text-info',
31
+ };
32
+ const PRIMARY_STYLE = {
33
+ badge: 'bg-primary/15 text-primary dark:text-primary border-primary/30',
34
+ dot: 'bg-primary',
35
+ text: 'text-primary dark:text-primary',
36
+ bg: 'bg-primary/10',
37
+ border: 'border-primary/30',
38
+ icon: 'text-primary',
39
+ };
40
+ const DESTRUCTIVE_STYLE = {
41
+ badge: 'bg-destructive/15 text-destructive dark:text-destructive border-destructive/30',
42
+ dot: 'bg-destructive',
43
+ text: 'text-destructive dark:text-destructive',
44
+ bg: 'bg-destructive/10',
45
+ border: 'border-destructive/30',
46
+ icon: 'text-destructive',
47
+ };
48
+ const NEUTRAL_STYLE = {
49
+ badge: 'bg-paper-elev text-ink-3 border-border',
50
+ dot: 'bg-muted-foreground/40',
51
+ text: 'text-ink-3',
52
+ bg: 'bg-muted/30',
53
+ border: 'border-border',
54
+ icon: 'text-ink-3',
55
+ };
56
+ exports.TONE_STYLES = {
57
+ neutral: 'bg-paper-elev text-ink-3 border-border',
58
+ primary: 'bg-primary/10 text-primary border-primary/20',
59
+ info: 'bg-info/15 text-info dark:text-info border-info/20',
60
+ success: 'bg-success/15 text-success dark:text-success border-success/20',
61
+ warning: 'bg-warning/15 text-warning dark:text-warning border-warning/20',
62
+ danger: 'bg-destructive/15 text-destructive dark:text-destructive border-destructive/20',
63
+ accent: 'bg-amber-500/15 text-amber-700 dark:text-amber-400 border-amber-500/20',
64
+ };
65
+ exports.STATUS_STYLES = {
66
+ pending: INFO_STYLE,
67
+ running: WARNING_STYLE,
68
+ waiting_on_approval: WARNING_STYLE,
69
+ waiting_on_human: WARNING_STYLE,
70
+ succeeded: SUCCESS_STYLE,
71
+ failed: DESTRUCTIVE_STYLE,
72
+ cancelled: NEUTRAL_STYLE,
73
+ aborted_for_migration: NEUTRAL_STYLE,
74
+ completed: SUCCESS_STYLE,
75
+ stopped: WARNING_STYLE,
76
+ undone: PRIMARY_STYLE,
77
+ skipped: NEUTRAL_STYLE,
78
+ creating: PRIMARY_STYLE,
79
+ provisioning: PRIMARY_STYLE,
80
+ active: SUCCESS_STYLE,
81
+ paused: WARNING_STYLE,
82
+ recovering: WARNING_STYLE,
83
+ completing: PRIMARY_STYLE,
84
+ archived: NEUTRAL_STYLE,
85
+ todo: NEUTRAL_STYLE,
86
+ in_progress: INFO_STYLE,
87
+ in_review: WARNING_STYLE,
88
+ done: SUCCESS_STYLE,
89
+ blocked: DESTRUCTIVE_STYLE,
90
+ open: INFO_STYLE,
91
+ exploring: WARNING_STYLE,
92
+ proposed: PRIMARY_STYLE,
93
+ accepted: SUCCESS_STYLE,
94
+ rejected: DESTRUCTIVE_STYLE,
95
+ merged: NEUTRAL_STYLE,
96
+ draft: NEUTRAL_STYLE,
97
+ approved: SUCCESS_STYLE,
98
+ manual_review: WARNING_STYLE,
99
+ };
100
+ function getStatusStyle(status) {
101
+ return exports.STATUS_STYLES[status] ?? exports.STATUS_STYLES.pending;
102
+ }
103
+ exports.PRIORITY_STYLES = {
104
+ p0: {
105
+ badge: 'bg-destructive text-white border-destructive',
106
+ text: 'text-destructive dark:text-destructive',
107
+ bg: 'bg-destructive/10',
108
+ border: 'border-destructive/30',
109
+ label: 'Critical',
110
+ },
111
+ p1: {
112
+ badge: 'bg-warning text-white border-warning',
113
+ text: 'text-warning dark:text-warning',
114
+ bg: 'bg-warning/10',
115
+ border: 'border-warning/30',
116
+ label: 'High',
117
+ },
118
+ p2: {
119
+ badge: 'bg-warning text-white border-warning',
120
+ text: 'text-warning dark:text-warning',
121
+ bg: 'bg-warning/10',
122
+ border: 'border-warning/30',
123
+ label: 'Medium',
124
+ },
125
+ p3: {
126
+ badge: 'bg-paper-elev text-ink-3 border-border',
127
+ text: 'text-ink-3',
128
+ bg: 'bg-muted/30',
129
+ border: 'border-border',
130
+ label: 'Low',
131
+ },
132
+ };
133
+ function getPriorityStyle(priority) {
134
+ return exports.PRIORITY_STYLES[priority] ?? exports.PRIORITY_STYLES.p3;
135
+ }
136
+ exports.SEVERITY_STYLES = {
137
+ critical: {
138
+ badge: 'bg-destructive text-white border-destructive',
139
+ text: 'text-destructive dark:text-destructive',
140
+ bg: 'bg-destructive/10',
141
+ border: 'border-destructive/30',
142
+ },
143
+ error: {
144
+ badge: 'bg-destructive text-white border-destructive',
145
+ text: 'text-destructive dark:text-destructive',
146
+ bg: 'bg-destructive/10',
147
+ border: 'border-destructive/30',
148
+ },
149
+ major: {
150
+ badge: 'bg-warning text-white border-warning',
151
+ text: 'text-warning dark:text-warning',
152
+ bg: 'bg-warning/10',
153
+ border: 'border-warning/30',
154
+ },
155
+ warning: {
156
+ badge: 'bg-warning text-white border-warning',
157
+ text: 'text-warning dark:text-warning',
158
+ bg: 'bg-warning/10',
159
+ border: 'border-warning/30',
160
+ },
161
+ minor: {
162
+ badge: 'bg-info/15 text-info dark:text-info border-info/30',
163
+ text: 'text-info dark:text-info',
164
+ bg: 'bg-info/10',
165
+ border: 'border-info/30',
166
+ },
167
+ info: {
168
+ badge: 'bg-info/15 text-info dark:text-info border-info/30',
169
+ text: 'text-info dark:text-info',
170
+ bg: 'bg-info/10',
171
+ border: 'border-info/30',
172
+ },
173
+ };
174
+ function getSeverityStyle(severity) {
175
+ const s = severity.toLowerCase();
176
+ return exports.SEVERITY_STYLES[s] ?? { badge: 'bg-paper-elev text-ink-3 border-border', text: 'text-ink-3', bg: 'bg-muted/30', border: 'border-border' };
177
+ }
178
+ exports.TYPE_STYLES = {
179
+ epic: { badge: 'bg-primary/15 text-primary dark:text-primary border-primary/30', text: 'text-primary dark:text-primary', border: 'border-l-purple-600' },
180
+ story: { badge: 'bg-info/15 text-info dark:text-info border-info/30', text: 'text-info dark:text-info', border: 'border-l-blue-600' },
181
+ task: { badge: 'bg-success/15 text-success dark:text-success border-success/30', text: 'text-success dark:text-success', border: 'border-l-green-600' },
182
+ bug: { badge: 'bg-destructive/15 text-destructive dark:text-destructive border-destructive/30', text: 'text-destructive dark:text-destructive', border: 'border-l-red-600' },
183
+ };
184
+ exports.CARD_STYLES = {
185
+ default: 'bg-card border border-border/50 rounded-xl shadow-[var(--shadow-2)]',
186
+ elevated: 'bg-card border border-border/40 rounded-xl shadow-[var(--shadow-8)]',
187
+ dark: 'bg-foreground text-background rounded-xl shadow-[var(--shadow-16)]',
188
+ accent: 'bg-primary/5 border border-primary/15 rounded-xl',
189
+ empty: 'border-2 border-dashed border-border/50 rounded-xl',
190
+ };
191
+ exports.SECTION_STYLES = {
192
+ pageTitle: 'text-lg sm:text-xl font-semibold tracking-tight text-ink',
193
+ sectionHeader: 'text-sm font-semibold text-ink',
194
+ cardLabel: 'text-[11px] font-semibold uppercase tracking-wider text-ink-3',
195
+ description: 'text-sm text-ink-3',
196
+ metricValue: 'text-xl sm:text-2xl font-semibold tabular-nums text-ink',
197
+ metricLabel: 'text-sm text-ink-3',
198
+ };
199
+ exports.IMPORTANCE_STYLES = {
200
+ 1: { badge: 'bg-paper-elev text-ink-3 border-border', label: 'Low', star: 'text-ink-3' },
201
+ 2: { badge: 'bg-info/15 text-info dark:text-info border-info/30', label: 'Normal', star: 'text-info' },
202
+ 3: { badge: 'bg-warning/15 text-warning dark:text-warning border-warning/30', label: 'High', star: 'text-warning' },
203
+ 4: { badge: 'bg-destructive/15 text-destructive dark:text-destructive border-destructive/30', label: 'Critical', star: 'text-destructive' },
204
+ };
205
+ exports.RISK_LEVEL_STYLES = {
206
+ low: { badge: 'bg-success/15 text-success dark:text-success border-success/30', text: 'text-success dark:text-success' },
207
+ medium: { badge: 'bg-warning/15 text-warning dark:text-warning border-warning/30', text: 'text-warning dark:text-warning' },
208
+ high: { badge: 'bg-warning/15 text-warning dark:text-warning border-warning/30', text: 'text-warning dark:text-warning' },
209
+ critical: { badge: 'bg-destructive/15 text-destructive dark:text-destructive border-destructive/30', text: 'text-destructive dark:text-destructive' },
210
+ };
211
+ function getRiskLevelStyle(level) {
212
+ return exports.RISK_LEVEL_STYLES[level] ?? exports.RISK_LEVEL_STYLES.low;
213
+ }
214
+ exports.AGENT_SOURCE_STYLES = {
215
+ dynamic: {
216
+ border: 'border-warning/30',
217
+ bg: 'bg-warning/5',
218
+ icon: 'text-warning',
219
+ iconBg: 'bg-warning/10',
220
+ },
221
+ predefined: {
222
+ border: 'border-border',
223
+ bg: 'bg-muted/20',
224
+ icon: 'text-primary',
225
+ iconBg: 'bg-primary/10',
226
+ },
227
+ };
228
+ exports.KIND_STYLES = {
229
+ LESSON: 'bg-info/15 text-info dark:text-info border-info/30',
230
+ PATTERN: 'bg-primary/15 text-primary dark:text-primary border-primary/30',
231
+ CORRECTION: 'bg-destructive/15 text-destructive dark:text-destructive border-destructive/30',
232
+ PREFERENCE: 'bg-success/15 text-success dark:text-success border-success/30',
233
+ };
234
+ exports.STATE_STYLES = {
235
+ CANDIDATE: 'bg-paper-elev text-ink-3 border-border',
236
+ ACTIVE: 'bg-success/15 text-success dark:text-success border-success/30',
237
+ SUPERSEDED: 'bg-paper-elev text-ink-3 border-border line-through',
238
+ CONTRADICTED: 'bg-destructive/15 text-destructive dark:text-destructive border-destructive/30 line-through',
239
+ REVIEW_REQUIRED: 'bg-warning/15 text-warning dark:text-warning border-warning/30',
240
+ ARCHIVED: 'bg-paper-elev text-ink-3 border-border opacity-60',
241
+ };
242
+ exports.ORIGIN_STYLES = {
243
+ GATE_REJECTION: 'bg-destructive/15 text-destructive dark:text-destructive border-destructive/30',
244
+ GATE_APPROVAL: 'bg-success/15 text-success dark:text-success border-success/30',
245
+ USER_CORRECTION: 'bg-warning/15 text-warning dark:text-warning border-warning/30',
246
+ MANUAL_OVERRIDE: 'bg-destructive/15 text-destructive dark:text-destructive border-destructive/30',
247
+ REVIEW_FINDING: 'bg-warning/15 text-warning dark:text-warning border-warning/30',
248
+ PATTERN_DETECTION: 'bg-primary/15 text-primary dark:text-primary border-primary/30',
249
+ USER_CREATED: 'bg-info/15 text-info dark:text-info border-info/30',
250
+ };
251
+ //# sourceMappingURL=design-tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design-tokens.js","sourceRoot":"","sources":["../../src/ui/design-tokens.ts"],"names":[],"mappings":";;;AAgJA,wCAEC;AA2CD,4CAEC;AAkDD,4CAGC;AAkDD,8CAEC;AA7QD,MAAM,aAAa,GAAgB;IACjC,KAAK,EAAE,gEAAgE;IACvE,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,gCAAgC;IACtC,EAAE,EAAE,eAAe;IACnB,MAAM,EAAE,mBAAmB;IAC3B,IAAI,EAAE,cAAc;CACrB,CAAC;AACF,MAAM,aAAa,GAAgB;IACjC,KAAK,EAAE,gEAAgE;IACvE,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,gCAAgC;IACtC,EAAE,EAAE,eAAe;IACnB,MAAM,EAAE,mBAAmB;IAC3B,IAAI,EAAE,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;CAC9D,CAAC;AAIW,QAAA,aAAa,GAA2B;IACnD,cAAc,EAAE,gFAAgF;IAChG,aAAa,EAAE,gEAAgE;IAC/E,eAAe,EAAE,gEAAgE;IACjF,eAAe,EAAE,gFAAgF;IACjG,cAAc,EAAE,gEAAgE;IAChF,iBAAiB,EAAE,gEAAgE;IACnF,YAAY,EAAE,oDAAoD;CACnE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function useDebouncedValue<T>(value: T, delayMs?: number): T;
2
+ //# sourceMappingURL=use-debounced-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-debounced-value.d.ts","sourceRoot":"","sources":["../../../src/ui/hooks/use-debounced-value.ts"],"names":[],"mappings":"AAMA,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,SAAM,GAAG,CAAC,CAS/D"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDebouncedValue = useDebouncedValue;
4
+ const react_1 = require("react");
5
+ function useDebouncedValue(value, delayMs = 300) {
6
+ const [debounced, setDebounced] = (0, react_1.useState)(value);
7
+ (0, react_1.useEffect)(() => {
8
+ const timer = setTimeout(() => setDebounced(value), delayMs);
9
+ return () => clearTimeout(timer);
10
+ }, [value, delayMs]);
11
+ return debounced;
12
+ }
13
+ //# sourceMappingURL=use-debounced-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-debounced-value.js","sourceRoot":"","sources":["../../../src/ui/hooks/use-debounced-value.ts"],"names":[],"mappings":";;AAMA,8CASC;AAfD,iCAA4C;AAM5C,SAAgB,iBAAiB,CAAI,KAAQ,EAAE,OAAO,GAAG,GAAG;IAC1D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAElD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;QAC7D,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAErB,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export { cn } from './cn';
2
+ export * from './design-tokens';
3
+ export { useDebouncedValue } from './hooks/use-debounced-value';
2
4
  export * from './primitives/button';
3
5
  export * from './primitives/badge';
4
6
  export * from './primitives/input';
@@ -24,7 +26,13 @@ export * from './primitives/radio-group';
24
26
  export * from './primitives/overflow-tabs';
25
27
  export * from './primitives/tag-multi-select';
26
28
  export * from './primitives/sheet';
29
+ export * from './primitives/form-stepper';
30
+ export * from './primitives/async-combobox';
27
31
  export { default as ErrorCard, type ErrorMessageFormatter } from './chrome/ErrorCard';
32
+ export { default as StatusBadge, type StatusBadgeProps, type StatusBadgeSize } from './chrome/status-badge';
33
+ export { default as ScopeBadge, type ScopeBadgeProps } from './chrome/scope-badge';
34
+ export { default as ConfirmDeleteDialog, type ConfirmDeleteDialogProps, } from './chrome/confirm-delete-dialog';
35
+ export { default as PageShell } from './chrome/page-shell';
28
36
  export { default as EmptyState, type EmptyStateVariant, type EmptyStateSize, type EmptyStateLinkComponent, } from './chrome/EmptyState';
29
37
  export { StateCard } from './chrome/StateCard';
30
38
  export { default as PageHeader, PageToolbar } from './chrome/PageHeader';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAG1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC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,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/ui/index.js CHANGED
@@ -17,9 +17,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.AsyncBoundary = exports.LoadingState = exports.PageToolbar = exports.PageHeader = exports.StateCard = exports.EmptyState = exports.ErrorCard = exports.cn = void 0;
20
+ exports.AsyncBoundary = exports.LoadingState = exports.PageToolbar = exports.PageHeader = exports.StateCard = exports.EmptyState = exports.PageShell = exports.ConfirmDeleteDialog = exports.ScopeBadge = exports.StatusBadge = exports.ErrorCard = exports.useDebouncedValue = exports.cn = void 0;
21
21
  var cn_1 = require("./cn");
22
22
  Object.defineProperty(exports, "cn", { enumerable: true, get: function () { return cn_1.cn; } });
23
+ __exportStar(require("./design-tokens"), exports);
24
+ var use_debounced_value_1 = require("./hooks/use-debounced-value");
25
+ Object.defineProperty(exports, "useDebouncedValue", { enumerable: true, get: function () { return use_debounced_value_1.useDebouncedValue; } });
23
26
  __exportStar(require("./primitives/button"), exports);
24
27
  __exportStar(require("./primitives/badge"), exports);
25
28
  __exportStar(require("./primitives/input"), exports);
@@ -45,8 +48,18 @@ __exportStar(require("./primitives/radio-group"), exports);
45
48
  __exportStar(require("./primitives/overflow-tabs"), exports);
46
49
  __exportStar(require("./primitives/tag-multi-select"), exports);
47
50
  __exportStar(require("./primitives/sheet"), exports);
51
+ __exportStar(require("./primitives/form-stepper"), exports);
52
+ __exportStar(require("./primitives/async-combobox"), exports);
48
53
  var ErrorCard_1 = require("./chrome/ErrorCard");
49
54
  Object.defineProperty(exports, "ErrorCard", { enumerable: true, get: function () { return __importDefault(ErrorCard_1).default; } });
55
+ var status_badge_1 = require("./chrome/status-badge");
56
+ Object.defineProperty(exports, "StatusBadge", { enumerable: true, get: function () { return __importDefault(status_badge_1).default; } });
57
+ var scope_badge_1 = require("./chrome/scope-badge");
58
+ Object.defineProperty(exports, "ScopeBadge", { enumerable: true, get: function () { return __importDefault(scope_badge_1).default; } });
59
+ var confirm_delete_dialog_1 = require("./chrome/confirm-delete-dialog");
60
+ Object.defineProperty(exports, "ConfirmDeleteDialog", { enumerable: true, get: function () { return __importDefault(confirm_delete_dialog_1).default; } });
61
+ var page_shell_1 = require("./chrome/page-shell");
62
+ Object.defineProperty(exports, "PageShell", { enumerable: true, get: function () { return __importDefault(page_shell_1).default; } });
50
63
  var EmptyState_1 = require("./chrome/EmptyState");
51
64
  Object.defineProperty(exports, "EmptyState", { enumerable: true, get: function () { return __importDefault(EmptyState_1).default; } });
52
65
  var StateCard_1 = require("./chrome/StateCard");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAYA,2BAA0B;AAAjB,wFAAA,EAAE,OAAA;AAGX,sDAAoC;AACpC,qDAAmC;AACnC,qDAAmC;AACnC,qDAAmC;AACnC,sDAAoC;AACpC,sDAAoC;AACpC,oDAAkC;AAClC,wDAAsC;AACtC,oDAAkC;AAClC,6DAA2C;AAC3C,wDAAsC;AACtC,wDAAsC;AACtC,qDAAmC;AACnC,uDAAqC;AACrC,sDAAoC;AACpC,yDAAuC;AACvC,2DAAyC;AACzC,4DAA0C;AAC1C,uDAAqC;AACrC,2DAAyC;AACzC,yDAAuC;AACvC,2DAAyC;AACzC,6DAA2C;AAC3C,gEAA8C;AAC9C,qDAAmC;AAGnC,gDAAsF;AAA7E,uHAAA,OAAO,OAAa;AAC7B,kDAK6B;AAJ3B,yHAA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OAAO,OAAiB"}
@@ -0,0 +1,19 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface AsyncComboboxProps<T> {
3
+ queryKeyPrefix?: string;
4
+ value: T | null;
5
+ displayValue?: string;
6
+ placeholder?: string;
7
+ searchPlaceholder?: string;
8
+ emptyMessage?: string;
9
+ onSearch: (query: string) => Promise<readonly T[]> | readonly T[];
10
+ minSearchLength?: number;
11
+ debounceMs?: number;
12
+ renderItem: (item: T) => ReactNode;
13
+ getItemKey: (item: T) => string;
14
+ onSelect: (item: T) => void;
15
+ disabled?: boolean;
16
+ triggerClassName?: string;
17
+ }
18
+ export declare function AsyncCombobox<T>({ queryKeyPrefix, value, displayValue, placeholder, searchPlaceholder, emptyMessage, onSearch, minSearchLength, debounceMs, renderItem, getItemKey, onSelect, disabled, triggerClassName, }: Readonly<AsyncComboboxProps<T>>): import("react").JSX.Element;
19
+ //# sourceMappingURL=async-combobox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-combobox.d.ts","sourceRoot":"","sources":["../../../src/ui/primitives/async-combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAQpE,MAAM,WAAW,kBAAkB,CAAC,CAAC;IAEnC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAEhB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;IAOlE,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,CAAC;IAEnC,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAEhC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAE5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAUD,wBAAgB,aAAa,CAAC,CAAC,EAAE,EAC/B,cAA0B,EAC1B,KAAK,EACL,YAAY,EACZ,WAAuB,EACvB,iBAA6B,EAC7B,YAAiC,EACjC,QAAQ,EACR,eAAmB,EACnB,UAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,gBAAgB,GACjB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,+BA4GjC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncCombobox = AsyncCombobox;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_query_1 = require("@tanstack/react-query");
6
+ const lucide_react_1 = require("lucide-react");
7
+ const react_1 = require("react");
8
+ const cn_1 = require("../cn");
9
+ const use_debounced_value_1 = require("../hooks/use-debounced-value");
10
+ const button_1 = require("./button");
11
+ const input_1 = require("./input");
12
+ const popover_1 = require("./popover");
13
+ function AsyncCombobox({ queryKeyPrefix = 'default', value, displayValue, placeholder = 'Select…', searchPlaceholder = 'Search…', emptyMessage = 'No results found', onSearch, minSearchLength = 0, debounceMs = 300, renderItem, getItemKey, onSelect, disabled, triggerClassName, }) {
14
+ const [open, setOpen] = (0, react_1.useState)(false);
15
+ const [search, setSearch] = (0, react_1.useState)('');
16
+ const inputRef = (0, react_1.useRef)(null);
17
+ const debouncedSearch = (0, use_debounced_value_1.useDebouncedValue)(search, debounceMs);
18
+ const searchEnabled = open && debouncedSearch.length >= minSearchLength;
19
+ const { data: results = [], isLoading } = (0, react_query_1.useQuery)({
20
+ queryKey: ['async-combobox', queryKeyPrefix, debouncedSearch],
21
+ queryFn: () => onSearch(debouncedSearch),
22
+ enabled: searchEnabled,
23
+ staleTime: 30_000,
24
+ });
25
+ (0, react_1.useEffect)(() => {
26
+ if (open) {
27
+ const timer = setTimeout(() => inputRef.current?.focus(), 50);
28
+ return () => clearTimeout(timer);
29
+ }
30
+ setSearch('');
31
+ return undefined;
32
+ }, [open]);
33
+ const handleSelect = (item) => {
34
+ onSelect(item);
35
+ setOpen(false);
36
+ };
37
+ const showTypeToSearchHint = !isLoading && minSearchLength > 0 && debouncedSearch.length < minSearchLength;
38
+ const showEmptyMessage = !isLoading && searchEnabled && results.length === 0;
39
+ return ((0, jsx_runtime_1.jsxs)(popover_1.Popover, { open: open, onOpenChange: setOpen, children: [(0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(button_1.Button, { variant: "outline", role: "combobox", "aria-expanded": open, disabled: disabled, className: (0, cn_1.cn)('w-full justify-between font-normal', !value && 'text-ink-3', triggerClassName), children: [(0, jsx_runtime_1.jsx)("span", { className: "truncate", children: value ? (displayValue ?? placeholder) : placeholder }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })] }) }), (0, jsx_runtime_1.jsxs)(popover_1.PopoverContent, { className: "w-[--radix-popover-trigger-width] min-w-[18rem] p-0", align: "start", onOpenAutoFocus: (e) => e.preventDefault(), children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative border-b", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Search, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-ink-3" }), (0, jsx_runtime_1.jsx)(input_1.Input, { ref: inputRef, value: search, onChange: (e) => setSearch(e.target.value), placeholder: searchPlaceholder, className: "h-9 text-body-1 pl-8 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0" })] }), (0, jsx_runtime_1.jsx)("div", { className: "max-h-80 overflow-y-auto overscroll-contain", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-1", children: [isLoading && ((0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center py-4", children: (0, jsx_runtime_1.jsx)(lucide_react_1.Loader2, { className: "h-4 w-4 animate-spin text-ink-3" }) })), showTypeToSearchHint && ((0, jsx_runtime_1.jsxs)("p", { className: "text-body-1 text-ink-3 text-center py-4", children: ["Type ", minSearchLength, "+ characters to search"] })), showEmptyMessage && ((0, jsx_runtime_1.jsx)("p", { className: "text-body-1 text-ink-3 text-center py-4", children: emptyMessage })), !isLoading &&
40
+ results.map((item) => ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "w-full text-left text-body-1 px-2 py-1.5 rounded hover:bg-paper-elev transition-colors flex items-center gap-2", onClick: () => handleSelect(item), children: renderItem(item) }, getItemKey(item))))] }) })] })] }));
41
+ }
42
+ //# sourceMappingURL=async-combobox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-combobox.js","sourceRoot":"","sources":["../../../src/ui/primitives/async-combobox.tsx"],"names":[],"mappings":";;AAsDA,sCA2HC;;AAjLD,uDAAiD;AACjD,+CAA+D;AAC/D,iCAAoE;AAEpE,8BAA2B;AAC3B,sEAAiE;AACjE,qCAAkC;AAClC,mCAAgC;AAChC,uCAAoE;AA8CpE,SAAgB,aAAa,CAAI,EAC/B,cAAc,GAAG,SAAS,EAC1B,KAAK,EACL,YAAY,EACZ,WAAW,GAAG,SAAS,EACvB,iBAAiB,GAAG,SAAS,EAC7B,YAAY,GAAG,kBAAkB,EACjC,QAAQ,EACR,eAAe,GAAG,CAAC,EACnB,UAAU,GAAG,GAAG,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,gBAAgB,GACgB;IAChC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,MAAM,EAAE,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CACL,EAEA,gBAAgB,IAAI,CACnB,8BAAG,SAAS,EAAC,yCAAyC,YAAE,YAAY,GAAK,CAC1E,EAEA,CAAC,SAAS;oCACT,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACpB,mCAEE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,gHAAgH,EAC1H,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,YAEhC,UAAU,CAAC,IAAI,CAAC,IALZ,UAAU,CAAC,IAAI,CAAC,CAMd,CACV,CAAC,IACA,GACF,IACS,IACT,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare enum FormStepStatus {
3
+ PENDING = "pending",
4
+ ACTIVE = "active",
5
+ DONE = "done"
6
+ }
7
+ export interface FormStep {
8
+ readonly key: string;
9
+ readonly label: string;
10
+ readonly hint?: string;
11
+ readonly status: FormStepStatus;
12
+ readonly children: ReactNode;
13
+ }
14
+ interface FormStepperProps {
15
+ readonly steps: readonly FormStep[];
16
+ }
17
+ export declare function FormStepper({ steps }: FormStepperProps): import("react").JSX.Element;
18
+ export {};
19
+ //# sourceMappingURL=form-stepper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-stepper.d.ts","sourceRoot":"","sources":["../../../src/ui/primitives/form-stepper.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED,UAAU,gBAAgB;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;CACrC;AAQD,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,gBAAgB,+BAatD"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormStepStatus = void 0;
4
+ exports.FormStepper = FormStepper;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const lucide_react_1 = require("lucide-react");
7
+ const cn_1 = require("../cn");
8
+ var FormStepStatus;
9
+ (function (FormStepStatus) {
10
+ FormStepStatus["PENDING"] = "pending";
11
+ FormStepStatus["ACTIVE"] = "active";
12
+ FormStepStatus["DONE"] = "done";
13
+ })(FormStepStatus || (exports.FormStepStatus = FormStepStatus = {}));
14
+ function FormStepper({ steps }) {
15
+ return ((0, jsx_runtime_1.jsx)("ol", { className: "space-y-4", children: steps.map((step, index) => ((0, jsx_runtime_1.jsx)(FormStepperItem, { step: step, stepNumber: index + 1, isLast: index === steps.length - 1 }, step.key))) }));
16
+ }
17
+ function FormStepperItem({ step, stepNumber, isLast }) {
18
+ const isPending = step.status === FormStepStatus.PENDING;
19
+ const isDone = step.status === FormStepStatus.DONE;
20
+ const isActive = step.status === FormStepStatus.ACTIVE;
21
+ return ((0, jsx_runtime_1.jsxs)("li", { className: "relative flex gap-3", children: [!isLast && ((0, jsx_runtime_1.jsx)("span", { "aria-hidden": true, className: (0, cn_1.cn)('absolute left-3.5 top-8 bottom-0 w-px -translate-x-1/2', isDone ? 'bg-primary/30' : 'bg-rule') })), (0, jsx_runtime_1.jsx)("span", { className: (0, cn_1.cn)('relative z-[1] mt-0.5 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border text-caption font-semibold', isDone && 'border-primary/40 bg-primary/15 text-primary', isActive && 'border-primary bg-primary text-primary-foreground', isPending && 'border-rule bg-paper-elev text-ink-3'), children: isDone ? (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "h-3.5 w-3.5", strokeWidth: 2.5 }) : stepNumber }), (0, jsx_runtime_1.jsxs)("div", { className: (0, cn_1.cn)('flex-1 min-w-0 rounded-lg border bg-card p-4 transition-opacity', isActive && 'border-primary/40 shadow-sm', isDone && 'border-rule', isPending && 'border-rule opacity-60'), children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-3 space-y-0.5", children: [(0, jsx_runtime_1.jsx)("p", { className: (0, cn_1.cn)('text-body-1 font-medium', isPending ? 'text-ink-3' : 'text-foreground'), children: step.label }), step.hint && (0, jsx_runtime_1.jsx)("p", { className: "text-caption text-ink-3", children: step.hint })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)(isPending && 'pointer-events-none select-none'), children: step.children })] })] }));
22
+ }
23
+ //# sourceMappingURL=form-stepper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-stepper.js","sourceRoot":"","sources":["../../../src/ui/primitives/form-stepper.tsx"],"names":[],"mappings":";;;AA8BA,kCAaC;;AA3CD,+CAAqC;AAIrC,8BAA2B;AAE3B,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;IACjB,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAoBD,SAAgB,WAAW,CAAC,EAAE,KAAK,EAAoB;IACrD,OAAO,CACL,+BAAI,SAAS,EAAC,WAAW,YACtB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,uBAAC,eAAe,IAEd,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,KAAK,GAAG,CAAC,EACrB,MAAM,EAAE,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,IAH7B,IAAI,CAAC,GAAG,CAIb,CACH,CAAC,GACC,CACN,CAAC;AACJ,CAAC;AAQD,SAAS,eAAe,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,GACV,IACF,IACH,CACN,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/ui-kernel",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Host-framework-agnostic UI kernel for the Xema OS. Defines the SystemBus orchestration contract (capability.invoke, cross-biome intents, command palette, xema:// deeplinks, window manager) AND the biome-host contract surface (FrontendBiome/FrontendBiomeFactory, HostBridge, the singleton biomeRegistry, session contributions) that every frontend biome composes against. No Vite, Next.js, or React-Router — React itself IS allowed as the shared component model (the contracts traffic in ReactNode/ComponentType and a React context). Concrete host adapters (router/auth/toast wiring) live in separate packages that consume this kernel. The SystemBus is pure orchestration: it never authorizes, the backend capability-router enforces all policy.",
5
5
  "keywords": [
6
6
  "xema",
@@ -31,3 +31,5 @@ export * from './realtime-port';
31
31
  export * from './realtime-hooks';
32
32
  export * from './errors';
33
33
  export * from './response-envelope';
34
+ export * from './use-mutation-with-error-toast';
35
+ export * from './use-page-state';
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Unified mutation hook with automatic success/error toast notifications.
3
+ *
4
+ * Rebuilt on the {@link HostBridge}: toasts route through `bridge.toast` and
5
+ * error copy is decoded by the bridge's error decoder (falling back to the
6
+ * kernel {@link getUserFacingErrorMessage}). Biome code stays decoupled from
7
+ * any particular toast library or error-envelope shape.
8
+ *
9
+ * Requires `@tanstack/react-query` (an optional peer of the kernel) and a
10
+ * `QueryClientProvider` mounted above.
11
+ *
12
+ * Usage:
13
+ * const mutation = useMutationWithErrorToast(
14
+ * { mutationFn: (vars) => apiFn(vars), onSuccess: () => invalidate() },
15
+ * { successTitle: 'Saved', errorTitle: 'Save failed' },
16
+ * );
17
+ */
18
+ import { useMutation, type UseMutationOptions } from '@tanstack/react-query';
19
+
20
+ import { getUserFacingErrorMessage } from './errors';
21
+ import { useHostBridge } from './host-bridge';
22
+
23
+ export type MutationCoreOptions<
24
+ TData = unknown,
25
+ TError = Error,
26
+ TVariables = unknown,
27
+ TContext = unknown,
28
+ > = Omit<UseMutationOptions<TData, TError, TVariables, TContext>, 'onError'>;
29
+
30
+ export interface MutationToastOptions<TError = Error> {
31
+ /** Title for the success toast. Omit or pass null to suppress the success toast. */
32
+ successTitle?: string | null;
33
+ /** Optional description for the success toast. */
34
+ successDescription?: string;
35
+ /** Title for the error toast. Omit to suppress the error toast. */
36
+ errorTitle?: string;
37
+ /**
38
+ * Custom error side-effect. Called before the auto-error-toast.
39
+ * Return `true` to suppress the automatic toast.
40
+ */
41
+ onError?: (error: TError) => boolean | void;
42
+ }
43
+
44
+ export function useMutationWithErrorToast<
45
+ TData = unknown,
46
+ TError extends Error = Error,
47
+ TVariables = unknown,
48
+ TContext = unknown,
49
+ >(
50
+ mutationOptions: MutationCoreOptions<TData, TError, TVariables, TContext>,
51
+ toastOptions?: MutationToastOptions<TError>,
52
+ ) {
53
+ const bridge = useHostBridge();
54
+ const decodeError =
55
+ bridge.errors?.getUserFacingErrorMessage ?? getUserFacingErrorMessage;
56
+
57
+ const { onSuccess: userOnSuccess, ...coreMutationOptions } = mutationOptions;
58
+ const {
59
+ successTitle,
60
+ successDescription,
61
+ errorTitle,
62
+ onError: customOnError,
63
+ } = toastOptions ?? {};
64
+
65
+ return useMutation({
66
+ ...coreMutationOptions,
67
+ onSuccess: (data, variables, context, mutation) => {
68
+ if (successTitle !== null && successTitle !== undefined) {
69
+ bridge.toast.success(successTitle, successDescription);
70
+ }
71
+ if (userOnSuccess) userOnSuccess(data, variables, context, mutation);
72
+ },
73
+ onError: (error: TError) => {
74
+ if (errorTitle !== null && errorTitle !== undefined) {
75
+ const shouldSuppressToast = customOnError?.(error) === true;
76
+ if (!shouldSuppressToast) {
77
+ const errorMessage = decodeError(
78
+ error,
79
+ 'Unable to complete this action.',
80
+ );
81
+ bridge.toast.error(errorTitle, errorMessage);
82
+ }
83
+ } else {
84
+ customOnError?.(error);
85
+ }
86
+ },
87
+ });
88
+ }