@brett_lamy/ui 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/animated-height.d.ts +3 -1
- package/dist/components/animated-height.d.ts.map +1 -1
- package/dist/components/animated-height.js +11 -11
- package/dist/components/artifact-chat-container.d.ts.map +1 -1
- package/dist/components/artifact-chat-container.js +81 -82
- package/dist/components/button.d.ts +4 -3
- package/dist/components/button.d.ts.map +1 -1
- package/dist/components/button.js +22 -9
- package/dist/components/canvas.d.ts +91 -0
- package/dist/components/canvas.d.ts.map +1 -0
- package/dist/components/canvas.js +296 -0
- package/dist/components/composer/composer-cards.d.ts +55 -0
- package/dist/components/composer/composer-cards.d.ts.map +1 -0
- package/dist/components/composer/composer-cards.js +351 -0
- package/dist/components/composer/composer.d.ts +9 -1
- package/dist/components/composer/composer.d.ts.map +1 -1
- package/dist/components/composer/composer.js +179 -154
- package/dist/components/context-menu.d.ts +25 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +127 -0
- package/dist/components/credenza.d.ts.map +1 -1
- package/dist/components/credenza.js +52 -92
- package/dist/components/cron-editor.d.ts +47 -0
- package/dist/components/cron-editor.d.ts.map +1 -0
- package/dist/components/cron-editor.js +297 -0
- package/dist/components/dropdown-menu.d.ts +3 -1
- package/dist/components/dropdown-menu.d.ts.map +1 -1
- package/dist/components/dropdown-menu.js +5 -5
- package/dist/components/edge-drawer.d.ts.map +1 -1
- package/dist/components/edge-drawer.js +1 -0
- package/dist/components/file-upload.d.ts +121 -0
- package/dist/components/file-upload.d.ts.map +1 -0
- package/dist/components/file-upload.js +405 -0
- package/dist/components/filter-input.d.ts +22 -0
- package/dist/components/filter-input.d.ts.map +1 -0
- package/dist/components/filter-input.js +126 -0
- package/dist/components/filter.d.ts +154 -0
- package/dist/components/filter.d.ts.map +1 -0
- package/dist/components/filter.js +815 -0
- package/dist/components/floating-chat.d.ts.map +1 -1
- package/dist/components/floating-chat.js +71 -88
- package/dist/components/floating-sheet.d.ts.map +1 -1
- package/dist/components/floating-sheet.js +93 -104
- package/dist/components/markdown-editor.d.ts +2 -0
- package/dist/components/markdown-editor.d.ts.map +1 -1
- package/dist/components/markdown-editor.js +46 -45
- package/dist/components/markdown-view.d.ts +6 -1
- package/dist/components/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view.js +13 -11
- package/dist/components/navigation-stack.d.ts +3 -5
- package/dist/components/navigation-stack.d.ts.map +1 -1
- package/dist/components/navigation-stack.js +212 -382
- package/dist/components/passkey-enroll-dialog.d.ts +36 -0
- package/dist/components/passkey-enroll-dialog.d.ts.map +1 -0
- package/dist/components/passkey-enroll-dialog.js +234 -0
- package/dist/components/result-table.d.ts +38 -0
- package/dist/components/result-table.d.ts.map +1 -0
- package/dist/components/result-table.js +161 -0
- package/dist/components/schema-tree.d.ts +19 -0
- package/dist/components/schema-tree.d.ts.map +1 -0
- package/dist/components/schema-tree.js +172 -0
- package/dist/components/side-drawer.d.ts.map +1 -1
- package/dist/components/side-drawer.js +117 -143
- package/dist/components/slider.d.ts.map +1 -1
- package/dist/components/slider.js +4 -1
- package/dist/components/spinner-shapes.d.ts +263 -0
- package/dist/components/spinner-shapes.d.ts.map +1 -0
- package/dist/components/spinner-shapes.js +771 -0
- package/dist/components/spinner.d.ts +133 -3
- package/dist/components/spinner.d.ts.map +1 -1
- package/dist/components/spinner.js +445 -29
- package/dist/components/sql-console.d.ts +28 -0
- package/dist/components/sql-console.d.ts.map +1 -0
- package/dist/components/sql-console.js +348 -0
- package/dist/components/sql-editor.d.ts +47 -0
- package/dist/components/sql-editor.d.ts.map +1 -0
- package/dist/components/sql-editor.js +170 -0
- package/dist/components/tab-view.d.ts +2 -2
- package/dist/components/tab-view.d.ts.map +1 -1
- package/dist/components/tab-view.js +63 -49
- package/dist/components/tailscale-login-button.d.ts +53 -0
- package/dist/components/tailscale-login-button.d.ts.map +1 -0
- package/dist/components/tailscale-login-button.js +197 -0
- package/dist/components/time-input.d.ts +46 -0
- package/dist/components/time-input.d.ts.map +1 -0
- package/dist/components/time-input.js +258 -0
- package/dist/components/toast.d.ts +5 -2
- package/dist/components/toast.d.ts.map +1 -1
- package/dist/components/toast.js +249 -125
- package/dist/components/vault-gate.d.ts +60 -0
- package/dist/components/vault-gate.d.ts.map +1 -0
- package/dist/components/vault-gate.js +382 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +85 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +129 -83
- package/dist/lib/back-history.d.ts +5 -0
- package/dist/lib/back-history.d.ts.map +1 -0
- package/dist/lib/back-history.js +44 -0
- package/dist/lib/canvas-math.d.ts +82 -0
- package/dist/lib/canvas-math.d.ts.map +1 -0
- package/dist/lib/canvas-math.js +226 -0
- package/dist/lib/controllable-state.d.ts +4 -0
- package/dist/lib/controllable-state.d.ts.map +1 -0
- package/dist/lib/controllable-state.js +11 -0
- package/dist/lib/cron.d.ts +55 -0
- package/dist/lib/cron.d.ts.map +1 -0
- package/dist/lib/cron.js +269 -0
- package/dist/lib/edge-swipe.d.ts +36 -0
- package/dist/lib/edge-swipe.d.ts.map +1 -0
- package/dist/lib/edge-swipe.js +73 -0
- package/dist/lib/file-upload.d.ts +187 -0
- package/dist/lib/file-upload.d.ts.map +1 -0
- package/dist/lib/file-upload.js +349 -0
- package/dist/lib/filter-query.d.ts +90 -0
- package/dist/lib/filter-query.d.ts.map +1 -0
- package/dist/lib/filter-query.js +459 -0
- package/dist/lib/filter.d.ts +120 -0
- package/dist/lib/filter.d.ts.map +1 -0
- package/dist/lib/filter.js +399 -0
- package/dist/lib/format-bytes.d.ts +3 -0
- package/dist/lib/format-bytes.d.ts.map +1 -0
- package/dist/lib/format-bytes.js +16 -0
- package/dist/lib/gpu-cron.d.ts +51 -0
- package/dist/lib/gpu-cron.d.ts.map +1 -0
- package/dist/lib/gpu-cron.js +81 -0
- package/dist/lib/gpu-query/featurize.d.ts +19 -0
- package/dist/lib/gpu-query/featurize.d.ts.map +1 -0
- package/dist/lib/gpu-query/featurize.js +88 -0
- package/dist/lib/gpu-query/index.d.ts +73 -0
- package/dist/lib/gpu-query/index.d.ts.map +1 -0
- package/dist/lib/gpu-query/index.js +117 -0
- package/dist/lib/gpu-query/kernel.wgsl.d.ts +30 -0
- package/dist/lib/gpu-query/kernel.wgsl.d.ts.map +1 -0
- package/dist/lib/gpu-query/model.d.ts +8 -0
- package/dist/lib/gpu-query/model.d.ts.map +1 -0
- package/dist/lib/gpu-query/model.js +91 -0
- package/dist/lib/gpu-query/schema.d.ts +40 -0
- package/dist/lib/gpu-query/schema.d.ts.map +1 -0
- package/dist/lib/gpu-query/schema.js +0 -0
- package/dist/lib/gpu-query/webgpu.d.ts +12 -0
- package/dist/lib/gpu-query/webgpu.d.ts.map +1 -0
- package/dist/lib/gpu-query/weights.d.ts +17 -0
- package/dist/lib/gpu-query/weights.d.ts.map +1 -0
- package/dist/lib/gpu-query/weights.js +40 -0
- package/dist/lib/gpu-query/weights.json.d.ts +3 -0
- package/dist/lib/gpu-query/weights2.js +25 -0
- package/dist/lib/gpu-time.d.ts +77 -0
- package/dist/lib/gpu-time.d.ts.map +1 -0
- package/dist/lib/gpu-time.js +260 -0
- package/dist/lib/morph-path.d.ts +22 -0
- package/dist/lib/morph-path.d.ts.map +1 -0
- package/dist/lib/morph-path.js +42 -0
- package/dist/lib/passkey.d.ts +120 -0
- package/dist/lib/passkey.d.ts.map +1 -0
- package/dist/lib/passkey.js +186 -0
- package/dist/lib/persistent-state.d.ts +9 -0
- package/dist/lib/persistent-state.d.ts.map +1 -0
- package/dist/lib/persistent-state.js +37 -0
- package/dist/lib/pglite-core.d.ts +219 -0
- package/dist/lib/pglite-core.d.ts.map +1 -0
- package/dist/lib/pglite-core.js +273 -0
- package/dist/lib/pglite-files.d.ts +7 -0
- package/dist/lib/pglite-files.d.ts.map +1 -0
- package/dist/lib/pglite-files.js +17 -0
- package/dist/lib/pglite-schema.d.ts +58 -0
- package/dist/lib/pglite-schema.d.ts.map +1 -0
- package/dist/lib/pglite-schema.js +105 -0
- package/dist/lib/pglite-storage.d.ts +33 -0
- package/dist/lib/pglite-storage.d.ts.map +1 -0
- package/dist/lib/pglite-storage.js +55 -0
- package/dist/lib/pglite-transfer.d.ts +53 -0
- package/dist/lib/pglite-transfer.d.ts.map +1 -0
- package/dist/lib/pglite-transfer.js +126 -0
- package/dist/lib/pglite.d.ts +106 -0
- package/dist/lib/pglite.d.ts.map +1 -0
- package/dist/lib/pglite.js +298 -0
- package/dist/lib/pull-to-refresh.d.ts +24 -0
- package/dist/lib/pull-to-refresh.d.ts.map +1 -0
- package/dist/lib/pull-to-refresh.js +74 -0
- package/dist/lib/scroll-hidden.d.ts +6 -0
- package/dist/lib/scroll-hidden.d.ts.map +1 -0
- package/dist/lib/scroll-hidden.js +21 -0
- package/dist/lib/sql-format.d.ts +62 -0
- package/dist/lib/sql-format.d.ts.map +1 -0
- package/dist/lib/sql-format.js +175 -0
- package/dist/lib/sql-lex.d.ts +25 -0
- package/dist/lib/sql-lex.d.ts.map +1 -0
- package/dist/lib/sql-lex.js +135 -0
- package/dist/lib/tab-lock.d.ts +28 -0
- package/dist/lib/tab-lock.d.ts.map +1 -0
- package/dist/lib/tab-lock.js +80 -0
- package/dist/lib/tailscale-connect.d.ts +56 -0
- package/dist/lib/tailscale-connect.d.ts.map +1 -0
- package/dist/lib/tailscale-connect.js +99 -0
- package/dist/lib/tailscale-fake.d.ts +33 -0
- package/dist/lib/tailscale-fake.d.ts.map +1 -0
- package/dist/lib/tailscale-fake.js +80 -0
- package/dist/lib/tailscale-policy.d.ts +71 -0
- package/dist/lib/tailscale-policy.d.ts.map +1 -0
- package/dist/lib/tailscale-policy.js +244 -0
- package/dist/lib/tailscale-react.d.ts +20 -0
- package/dist/lib/tailscale-react.d.ts.map +1 -0
- package/dist/lib/tailscale-react.js +37 -0
- package/dist/lib/tailscale-router/bridge.d.ts +60 -0
- package/dist/lib/tailscale-router/bridge.d.ts.map +1 -0
- package/dist/lib/tailscale-router/bridge.js +198 -0
- package/dist/lib/tailscale-router/react.d.ts +19 -0
- package/dist/lib/tailscale-router/react.d.ts.map +1 -0
- package/dist/lib/tailscale-router/react.js +52 -0
- package/dist/lib/tailscale.d.ts +204 -0
- package/dist/lib/tailscale.d.ts.map +1 -0
- package/dist/lib/tailscale.js +443 -0
- package/dist/lib/title-flight.d.ts +34 -0
- package/dist/lib/title-flight.d.ts.map +1 -0
- package/dist/lib/title-flight.js +123 -0
- package/dist/lib/vault-react.d.ts +49 -0
- package/dist/lib/vault-react.d.ts.map +1 -0
- package/dist/lib/vault-react.js +196 -0
- package/dist/lib/vault-storage.d.ts +30 -0
- package/dist/lib/vault-storage.d.ts.map +1 -0
- package/dist/lib/vault-storage.js +105 -0
- package/dist/lib/vault.d.ts +200 -0
- package/dist/lib/vault.d.ts.map +1 -0
- package/dist/lib/vault.js +641 -0
- package/dist/tailscale-sw.js +332 -0
- package/package.json +35 -5
- package/dist/components/icon-button.d.ts +0 -19
- package/dist/components/icon-button.d.ts.map +0 -1
- package/dist/components/icon-button.js +0 -31
- package/dist/components/measure-h.d.ts +0 -7
- package/dist/components/measure-h.d.ts.map +0 -1
- package/dist/components/measure-h.js +0 -20
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { Icon as t } from "../lib/icon.js";
|
|
4
|
+
import { Label as n } from "./label.js";
|
|
5
|
+
import { Input as r } from "./input.js";
|
|
6
|
+
import { FieldDescription as i, FieldError as a, TextField as o } from "./text-field.js";
|
|
7
|
+
import { Toggle as s } from "./toggle.js";
|
|
8
|
+
import { CRON_FIELDS as c, cronProblems as l, describeCron as u, isValidTimeZone as d, localTimeZone as f, nextCronRuns as p, validateCron as m } from "../lib/cron.js";
|
|
9
|
+
import { describeCronError as h, useCronParse as g } from "../lib/gpu-cron.js";
|
|
10
|
+
import { useEffect as _, useId as v, useMemo as y, useState as b } from "react";
|
|
11
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
12
|
+
import { cva as w } from "class-variance-authority";
|
|
13
|
+
//#region src/components/cron-editor.tsx
|
|
14
|
+
var T = "text-foreground/70";
|
|
15
|
+
function E({ children: e }) {
|
|
16
|
+
return /* @__PURE__ */ C("span", {
|
|
17
|
+
className: "flex items-start gap-1.5",
|
|
18
|
+
children: [/* @__PURE__ */ S(t, {
|
|
19
|
+
name: "exclamation-circle",
|
|
20
|
+
size: 14,
|
|
21
|
+
className: "mt-[3px] shrink-0 text-destructive"
|
|
22
|
+
}), /* @__PURE__ */ S("span", { children: e })]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
var D = w("flex min-w-0 flex-col gap-3 text-footnote", {
|
|
26
|
+
variants: { variant: {
|
|
27
|
+
card: "[&_[data-surface]]:rounded-panel [&_[data-surface]]:bg-secondary [&_[data-surface]]:p-3",
|
|
28
|
+
plain: "[&_[data-surface]]:px-1"
|
|
29
|
+
} },
|
|
30
|
+
defaultVariants: { variant: "card" }
|
|
31
|
+
}), O = [
|
|
32
|
+
{
|
|
33
|
+
label: "Every minute",
|
|
34
|
+
value: "* * * * *"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "Hourly",
|
|
38
|
+
value: "0 * * * *"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: "Daily at 9:00",
|
|
42
|
+
value: "0 9 * * *"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "Weekdays at 9:00",
|
|
46
|
+
value: "0 9 * * 1-5"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: "Mondays at 9:00",
|
|
50
|
+
value: "0 9 * * 1"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: "First of the month",
|
|
54
|
+
value: "0 0 1 * *"
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
function k(e, t) {
|
|
58
|
+
let n = e.slice(0, t).trimStart().split(/\s+/).length - 1;
|
|
59
|
+
return n < 5 ? n : null;
|
|
60
|
+
}
|
|
61
|
+
function ee(e) {
|
|
62
|
+
let [t, n] = b(null);
|
|
63
|
+
return _(() => {
|
|
64
|
+
let t = !0;
|
|
65
|
+
return u(e).then((r) => {
|
|
66
|
+
t && n({
|
|
67
|
+
expression: e,
|
|
68
|
+
text: r
|
|
69
|
+
});
|
|
70
|
+
}, () => {
|
|
71
|
+
t && n({
|
|
72
|
+
expression: e,
|
|
73
|
+
text: null
|
|
74
|
+
});
|
|
75
|
+
}), () => {
|
|
76
|
+
t = !1;
|
|
77
|
+
};
|
|
78
|
+
}, [e]), t?.expression === e ? t.text : null;
|
|
79
|
+
}
|
|
80
|
+
function A(e, t = 3e4) {
|
|
81
|
+
let [n, r] = b(null);
|
|
82
|
+
return _(() => {
|
|
83
|
+
if (e !== void 0) return;
|
|
84
|
+
r(Date.now());
|
|
85
|
+
let n = setInterval(() => r(Date.now()), t);
|
|
86
|
+
return () => clearInterval(n);
|
|
87
|
+
}, [e, t]), e === void 0 ? n : new Date(e).getTime();
|
|
88
|
+
}
|
|
89
|
+
function j({ value: u, defaultValue: h = "", onValueChange: g, label: _ = "Cron expression", description: w, name: j, timeZone: N, from: P, nextRunCount: F = 5, presets: I = O, naturalLanguage: L = !0, naturalLanguageLabel: R = "Describe the schedule", locale: z, debounceMs: te, isDisabled: B, variant: ne, className: re, ...ie }) {
|
|
90
|
+
let [ae, V] = b(h), H = u ?? ae, U = (e) => {
|
|
91
|
+
u === void 0 && V(e), g?.(e);
|
|
92
|
+
}, W = y(() => m(H), [H]), G = y(() => l(W), [W]), K = H.trim() === "", q = ee(H), [oe, J] = b(null), Y = y(() => N ?? f(), [N]), X = A(P), Z = y(() => {
|
|
93
|
+
if (X === null || !W.valid) return null;
|
|
94
|
+
try {
|
|
95
|
+
return p(H, {
|
|
96
|
+
from: X,
|
|
97
|
+
count: F,
|
|
98
|
+
timeZone: Y
|
|
99
|
+
});
|
|
100
|
+
} catch {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}, [
|
|
104
|
+
H,
|
|
105
|
+
W.valid,
|
|
106
|
+
X,
|
|
107
|
+
F,
|
|
108
|
+
Y
|
|
109
|
+
]), Q = y(() => {
|
|
110
|
+
try {
|
|
111
|
+
return new Intl.DateTimeFormat(z, {
|
|
112
|
+
timeZone: Y,
|
|
113
|
+
weekday: "short",
|
|
114
|
+
year: "numeric",
|
|
115
|
+
month: "short",
|
|
116
|
+
day: "numeric",
|
|
117
|
+
hour: "numeric",
|
|
118
|
+
minute: "2-digit"
|
|
119
|
+
});
|
|
120
|
+
} catch {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}, [z, Y]), $ = v(), se = d(Y), [ce, le] = b(null), ue = L && !B && ce !== !1;
|
|
124
|
+
return /* @__PURE__ */ C("div", {
|
|
125
|
+
"data-slot": "cron-editor",
|
|
126
|
+
className: e(D({ variant: ne }), re),
|
|
127
|
+
...ie,
|
|
128
|
+
children: [
|
|
129
|
+
L ? /* @__PURE__ */ S(M, {
|
|
130
|
+
label: R,
|
|
131
|
+
current: H,
|
|
132
|
+
onUse: U,
|
|
133
|
+
onSupport: le,
|
|
134
|
+
debounceMs: te,
|
|
135
|
+
isDisabled: B
|
|
136
|
+
}) : null,
|
|
137
|
+
ue ? null : /* @__PURE__ */ C(x, { children: [
|
|
138
|
+
/* @__PURE__ */ C(o, {
|
|
139
|
+
value: H,
|
|
140
|
+
onChange: U,
|
|
141
|
+
name: j,
|
|
142
|
+
isDisabled: B,
|
|
143
|
+
isInvalid: !K && !W.valid,
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ S(n, {
|
|
146
|
+
variant: "field",
|
|
147
|
+
className: T,
|
|
148
|
+
children: _
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ S(r, {
|
|
151
|
+
className: "[font-family:var(--font-mono)]",
|
|
152
|
+
placeholder: "0 9 * * 1-5",
|
|
153
|
+
autoComplete: "off",
|
|
154
|
+
autoCapitalize: "off",
|
|
155
|
+
autoCorrect: "off",
|
|
156
|
+
spellCheck: !1,
|
|
157
|
+
onSelect: (e) => J(k(e.currentTarget.value, e.currentTarget.selectionStart ?? e.currentTarget.value.length)),
|
|
158
|
+
onBlur: () => J(null)
|
|
159
|
+
}),
|
|
160
|
+
/* @__PURE__ */ S(i, {
|
|
161
|
+
className: T,
|
|
162
|
+
children: w ?? "Five fields, separated by spaces."
|
|
163
|
+
}),
|
|
164
|
+
/* @__PURE__ */ S(a, {
|
|
165
|
+
className: "text-foreground",
|
|
166
|
+
children: G.map((e) => /* @__PURE__ */ S(E, { children: e.message }, `${e.field}-${e.message}`))
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
}),
|
|
170
|
+
/* @__PURE__ */ S("dl", {
|
|
171
|
+
"data-slot": "cron-editor-fields",
|
|
172
|
+
className: "m-0 grid grid-cols-5 gap-1.5",
|
|
173
|
+
children: c.map((t, n) => {
|
|
174
|
+
let r = W.fields[t.name], i = W.parts[n];
|
|
175
|
+
return /* @__PURE__ */ C("div", {
|
|
176
|
+
"data-field": t.name,
|
|
177
|
+
"data-active": oe === n ? "" : void 0,
|
|
178
|
+
"data-invalid": r ? "" : void 0,
|
|
179
|
+
className: "flex min-w-0 flex-col-reverse items-center justify-end gap-0.5 rounded-ctl bg-secondary px-1 py-1.5 text-center ring-primary data-active:ring-2 data-invalid:ring-2 data-invalid:ring-destructive",
|
|
180
|
+
children: [/* @__PURE__ */ S("dt", {
|
|
181
|
+
className: "text-caption2 leading-tight text-foreground/70",
|
|
182
|
+
children: t.label
|
|
183
|
+
}), /* @__PURE__ */ S("dd", {
|
|
184
|
+
className: e("m-0 max-w-full truncate font-mono text-subhead leading-tight text-foreground", i === void 0 && "text-foreground/70"),
|
|
185
|
+
children: i ?? "–"
|
|
186
|
+
})]
|
|
187
|
+
}, t.name);
|
|
188
|
+
})
|
|
189
|
+
}),
|
|
190
|
+
/* @__PURE__ */ S("p", {
|
|
191
|
+
"data-slot": "cron-editor-description",
|
|
192
|
+
className: "m-0 min-h-[18px] px-1 text-detail text-foreground",
|
|
193
|
+
children: W.valid ? q : null
|
|
194
|
+
}),
|
|
195
|
+
I && I.length ? /* @__PURE__ */ S("div", {
|
|
196
|
+
"data-slot": "cron-editor-presets",
|
|
197
|
+
role: "group",
|
|
198
|
+
"aria-label": "Presets",
|
|
199
|
+
className: "flex flex-wrap gap-1.5",
|
|
200
|
+
children: I.map((e) => /* @__PURE__ */ S(s, {
|
|
201
|
+
variant: "filled",
|
|
202
|
+
size: "sm",
|
|
203
|
+
isSelected: H.trim() === e.value,
|
|
204
|
+
onChange: () => U(e.value),
|
|
205
|
+
isDisabled: B,
|
|
206
|
+
className: "data-selected:text-foreground",
|
|
207
|
+
children: e.label
|
|
208
|
+
}, e.value))
|
|
209
|
+
}) : null
|
|
210
|
+
] }),
|
|
211
|
+
/* @__PURE__ */ C("section", {
|
|
212
|
+
"data-slot": "cron-editor-next",
|
|
213
|
+
"data-surface": "",
|
|
214
|
+
"aria-labelledby": $,
|
|
215
|
+
className: "flex flex-col gap-1.5",
|
|
216
|
+
children: [
|
|
217
|
+
/* @__PURE__ */ S("p", {
|
|
218
|
+
id: $,
|
|
219
|
+
className: "m-0 text-caption font-semibold text-foreground/70",
|
|
220
|
+
children: "Next runs"
|
|
221
|
+
}),
|
|
222
|
+
Z && Z.length && Q ? /* @__PURE__ */ S("ol", {
|
|
223
|
+
className: "m-0 flex list-none flex-col gap-1 p-0 text-foreground tabular-nums",
|
|
224
|
+
children: Z.map((e) => /* @__PURE__ */ C("li", {
|
|
225
|
+
className: "flex items-center gap-2",
|
|
226
|
+
children: [/* @__PURE__ */ S(t, {
|
|
227
|
+
name: "clock",
|
|
228
|
+
size: 14,
|
|
229
|
+
className: "text-foreground/70"
|
|
230
|
+
}), /* @__PURE__ */ S("time", {
|
|
231
|
+
dateTime: e.toISOString(),
|
|
232
|
+
children: Q.format(e)
|
|
233
|
+
})]
|
|
234
|
+
}, e.getTime()))
|
|
235
|
+
}) : /* @__PURE__ */ S("p", {
|
|
236
|
+
className: "m-0 text-foreground/70",
|
|
237
|
+
children: se ? K ? "Enter an expression to see when it runs." : W.valid ? Z === null ? "" : "This expression never matches a real date (31 February, say)." : "Fix the expression to see when it runs." : `“${Y}” is not a time zone this browser knows.`
|
|
238
|
+
}),
|
|
239
|
+
/* @__PURE__ */ C("p", {
|
|
240
|
+
className: "m-0 text-caption text-foreground/70",
|
|
241
|
+
children: [
|
|
242
|
+
"Times in ",
|
|
243
|
+
Y,
|
|
244
|
+
N === void 0 ? " (this device’s time zone)" : "",
|
|
245
|
+
". Weekdays and dates follow that zone."
|
|
246
|
+
]
|
|
247
|
+
})
|
|
248
|
+
]
|
|
249
|
+
})
|
|
250
|
+
]
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function M({ label: e, current: i, onUse: s, onSupport: c, debounceMs: l = 0, isDisabled: u }) {
|
|
254
|
+
let [d, f] = b(""), { result: p, error: m, supported: v, parsedText: y } = g(d, {
|
|
255
|
+
debounceMs: l,
|
|
256
|
+
enabled: !u
|
|
257
|
+
}), x = p && y === d ? p.expression : null;
|
|
258
|
+
return _(() => c(v), [v, c]), _(() => {
|
|
259
|
+
x !== null && x !== i.trim() && s(x);
|
|
260
|
+
}, [x]), v === !1 ? /* @__PURE__ */ C("p", {
|
|
261
|
+
"data-slot": "cron-editor-note",
|
|
262
|
+
className: "m-0 flex items-start gap-1.5 text-foreground/70",
|
|
263
|
+
children: [/* @__PURE__ */ S(t, {
|
|
264
|
+
name: "info",
|
|
265
|
+
size: 14,
|
|
266
|
+
className: "mt-[3px]"
|
|
267
|
+
}), /* @__PURE__ */ S("span", { children: "Describing a schedule in words needs WebGPU, which this browser does not offer. Type the expression below instead." })]
|
|
268
|
+
}) : /* @__PURE__ */ S("div", {
|
|
269
|
+
"data-slot": "cron-editor-natural",
|
|
270
|
+
"data-supported": v ?? void 0,
|
|
271
|
+
className: "flex flex-col gap-2",
|
|
272
|
+
children: /* @__PURE__ */ C(o, {
|
|
273
|
+
value: d,
|
|
274
|
+
onChange: f,
|
|
275
|
+
isDisabled: u || v === null,
|
|
276
|
+
isInvalid: m !== null,
|
|
277
|
+
children: [
|
|
278
|
+
/* @__PURE__ */ S(n, {
|
|
279
|
+
variant: "field",
|
|
280
|
+
className: T,
|
|
281
|
+
children: e
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ S(r, {
|
|
284
|
+
placeholder: v === null && !u ? "Checking for WebGPU…" : "e.g. every weekday at 9am",
|
|
285
|
+
autoComplete: "off",
|
|
286
|
+
spellCheck: !1
|
|
287
|
+
}),
|
|
288
|
+
/* @__PURE__ */ S(a, {
|
|
289
|
+
className: "text-foreground",
|
|
290
|
+
children: m ? /* @__PURE__ */ S(E, { children: h(m) }) : null
|
|
291
|
+
})
|
|
292
|
+
]
|
|
293
|
+
})
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
//#endregion
|
|
297
|
+
export { O as CRON_PRESETS, j as CronEditor, D as cronEditorVariants };
|
|
@@ -5,9 +5,11 @@ import { PopoverProps } from './popover';
|
|
|
5
5
|
export declare function DropdownMenu(props: MenuTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export interface DropdownMenuContentProps<T> extends MenuProps<T> {
|
|
7
7
|
placement?: PopoverProps['placement'];
|
|
8
|
+
/** Gap between the trigger and the menu, px. Default 8 (a submenu overlaps its parent row by 6). */
|
|
9
|
+
offset?: number;
|
|
8
10
|
popoverClassName?: string;
|
|
9
11
|
}
|
|
10
|
-
export declare function DropdownMenuContent<T extends object>({ className, placement, popoverClassName, ...props }: DropdownMenuContentProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function DropdownMenuContent<T extends object>({ className, placement, offset, popoverClassName, ...props }: DropdownMenuContentProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export declare const dropdownMenuItemVariants: (props?: ({
|
|
12
14
|
variant?: "destructive" | "default" | null | undefined;
|
|
13
15
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../src/components/dropdown-menu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAEL,MAAM,EACA,KAAK,SAAS,EACV,KAAK,aAAa,EACf,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAEvB,KAAK,cAAc,EACd,KAAK,mBAAmB,EAGzC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAcrE,wBAAgB,YAAY,CAAC,KAAK,EAAE,gBAAgB,2CAEnD;AAED,MAAM,WAAW,wBAAwB,CAAC,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAC/D,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAAE,EACpD,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../src/components/dropdown-menu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAEL,MAAM,EACA,KAAK,SAAS,EACV,KAAK,aAAa,EACf,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAEvB,KAAK,cAAc,EACd,KAAK,mBAAmB,EAGzC,MAAM,uBAAuB,CAAC;AAC/B,OAA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AAS,MAAM,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC,2CAOjI;AAED,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,2CAQvF;AAED,0DAA0D;AAC1D,wBAAgB,qBAAqB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAE5E;AAED,wBAAgB,oBAAoB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,MAAM,CAAC,2CAEnF;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,KAAK,EAAE,mBAAmB,2CAEzD"}
|
|
@@ -9,17 +9,17 @@ import { cva as _ } from "class-variance-authority";
|
|
|
9
9
|
function v(e) {
|
|
10
10
|
return /* @__PURE__ */ i(d, { ...e });
|
|
11
11
|
}
|
|
12
|
-
function y({ className: t, placement: r,
|
|
13
|
-
let
|
|
12
|
+
function y({ className: t, placement: r, offset: a, popoverClassName: o, ...s }) {
|
|
13
|
+
let l = g(f)?.trigger === "SubmenuTrigger";
|
|
14
14
|
return /* @__PURE__ */ i(n, {
|
|
15
15
|
"data-slot": "dropdown-menu",
|
|
16
16
|
placement: r,
|
|
17
|
-
offset:
|
|
18
|
-
className: e("min-w-[230px]",
|
|
17
|
+
offset: a ?? (l ? -6 : 8),
|
|
18
|
+
className: e("min-w-[230px]", o),
|
|
19
19
|
children: /* @__PURE__ */ i(c, {
|
|
20
20
|
"data-slot": "dropdown-menu-content",
|
|
21
21
|
className: e("bl-scroll box-border max-h-[inherit] overflow-y-auto py-1 outline-none", t),
|
|
22
|
-
...
|
|
22
|
+
...s
|
|
23
23
|
})
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-drawer.d.ts","sourceRoot":"","sources":["../../src/components/edge-drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQlE,4GAA4G;AAC5G,eAAO,MAAM,kBAAkB;;;;8EAgB9B,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5F,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;oCACgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAID,wBAAgB,UAAU,CAAC,EACzB,IAAa,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAW,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EACzF,QAAQ,EAAE,SAAS,EAAE,KAAK,GAC3B,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"edge-drawer.d.ts","sourceRoot":"","sources":["../../src/components/edge-drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQlE,4GAA4G;AAC5G,eAAO,MAAM,kBAAkB;;;;8EAgB9B,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5F,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;oCACgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAID,wBAAgB,UAAU,CAAC,EACzB,IAAa,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAW,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EACzF,QAAQ,EAAE,SAAS,EAAE,KAAK,GAC3B,EAAE,eAAe,2CAyCjB"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { DropZoneProps, DropZoneRenderProps } from 'react-aria-components';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { ButtonProps } from './button';
|
|
5
|
+
import { IconName } from '../lib/icon';
|
|
6
|
+
import { FileEntry, FileRules, FileUploadState, UploadFile, UseFileUploadOptions } from '../lib/file-upload';
|
|
7
|
+
export interface FilesInfo {
|
|
8
|
+
/** How the files arrived. */
|
|
9
|
+
source: 'drop' | 'browse' | 'paste';
|
|
10
|
+
/** A dropped folder held more files than were read. */
|
|
11
|
+
truncated: boolean;
|
|
12
|
+
/** Dropped folders that were skipped because the target doesn't take folders. */
|
|
13
|
+
skippedFolders: number;
|
|
14
|
+
}
|
|
15
|
+
type OnFiles = (entries: FileEntry[], info: FilesInfo) => void;
|
|
16
|
+
export interface FileUploadContextValue extends FileUploadState {
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
multiple: boolean;
|
|
19
|
+
acceptDirectory: boolean;
|
|
20
|
+
defaultCamera?: 'user' | 'environment';
|
|
21
|
+
pasteable: boolean;
|
|
22
|
+
/** A message about the last drop that isn't a per-file rejection (folders skipped, a folder cut short). */
|
|
23
|
+
notice: string | null;
|
|
24
|
+
/** Adds files from the zone or button (validates, announces). */
|
|
25
|
+
addFiles: OnFiles;
|
|
26
|
+
/** Removes a row and moves focus to its neighbor (the rows' Remove button uses it). */
|
|
27
|
+
dismiss: (id: string) => void;
|
|
28
|
+
}
|
|
29
|
+
/** The nearest FileUpload's state and settings, or null outside one. */
|
|
30
|
+
export declare function useFileUploadContext(): FileUploadContextValue | null;
|
|
31
|
+
export interface FileUploadProps extends UseFileUploadOptions {
|
|
32
|
+
/** Bring your own `useFileUpload` (to call `uploadAll()` or read the list outside); the rule props here are then ignored. */
|
|
33
|
+
state?: FileUploadState;
|
|
34
|
+
/** Whether several files can be chosen at once. Default: unless `maxFiles` is 1. */
|
|
35
|
+
multiple?: boolean;
|
|
36
|
+
/** Choose and read whole folders. Dropped and picked files keep their relative paths. */
|
|
37
|
+
acceptDirectory?: boolean;
|
|
38
|
+
/** Open the camera directly on phones (`user` front, `environment` rear). */
|
|
39
|
+
defaultCamera?: 'user' | 'environment';
|
|
40
|
+
/** Take files pasted while the zone's buttons are focused. */
|
|
41
|
+
pasteable?: boolean;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/** Default: a `FileDropZone` and a `FileList`. A function receives the context. */
|
|
44
|
+
children?: ReactNode | ((api: FileUploadContextValue) => ReactNode);
|
|
45
|
+
className?: string;
|
|
46
|
+
style?: CSSProperties;
|
|
47
|
+
}
|
|
48
|
+
export declare function FileUpload({ state, children, className, style, multiple, acceptDirectory, defaultCamera, pasteable, disabled, ...options }: FileUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare const fileDropZoneVariants: (props?: ({
|
|
50
|
+
size?: "default" | "compact" | null | undefined;
|
|
51
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
52
|
+
type ZoneRules = Pick<FileRules, 'accept' | 'maxSize' | 'minSize' | 'maxFiles'>;
|
|
53
|
+
export interface FileDropZoneProps extends Omit<DropZoneProps, 'children' | 'className' | 'onDrop' | 'isDisabled'>, VariantProps<typeof fileDropZoneVariants> {
|
|
54
|
+
/** Called with the chosen, dropped or pasted files. Inside a `FileUpload` the default adds them to its list. */
|
|
55
|
+
onFiles?: OnFiles;
|
|
56
|
+
/** What the zone takes: sets the chooser's filter and the hint under the title. Defaults to the `FileUpload`'s rules. */
|
|
57
|
+
rules?: ZoneRules;
|
|
58
|
+
/** The line under the title; default is built from the rules ("Images and PDFs · up to 5 MB each"). */
|
|
59
|
+
hint?: ReactNode;
|
|
60
|
+
/** Title while idle (default "Drag files here"). */
|
|
61
|
+
title?: ReactNode;
|
|
62
|
+
/** An Icon name or any node (default an upward arrow). */
|
|
63
|
+
icon?: IconName | ReactNode;
|
|
64
|
+
/** The button's text (default "Browse files"). */
|
|
65
|
+
browseLabel?: string;
|
|
66
|
+
multiple?: boolean;
|
|
67
|
+
acceptDirectory?: boolean;
|
|
68
|
+
defaultCamera?: 'user' | 'environment';
|
|
69
|
+
/** Take files pasted while the zone or its button has focus (⌘V / Ctrl+V). Default false. */
|
|
70
|
+
pasteable?: boolean;
|
|
71
|
+
/** Red outline and the `error` message (with an icon, so color isn't the only signal). */
|
|
72
|
+
isInvalid?: boolean;
|
|
73
|
+
error?: ReactNode;
|
|
74
|
+
isDisabled?: boolean;
|
|
75
|
+
/** Replace the contents; a function receives react-aria's render state (`isDropTarget`, `isFocusVisible`…). */
|
|
76
|
+
children?: ReactNode | ((state: DropZoneRenderProps) => ReactNode);
|
|
77
|
+
className?: string | ((state: DropZoneRenderProps) => string);
|
|
78
|
+
}
|
|
79
|
+
export declare function FileDropZone({ className, size, onFiles, rules, hint, title, icon, browseLabel, multiple, acceptDirectory, defaultCamera, pasteable, isInvalid, error, isDisabled, children, ...props }: FileDropZoneProps): import("react/jsx-runtime").JSX.Element;
|
|
80
|
+
export interface FileUploadButtonProps extends ButtonProps {
|
|
81
|
+
onFiles?: OnFiles;
|
|
82
|
+
accept?: readonly string[];
|
|
83
|
+
multiple?: boolean;
|
|
84
|
+
acceptDirectory?: boolean;
|
|
85
|
+
defaultCamera?: 'user' | 'environment';
|
|
86
|
+
}
|
|
87
|
+
/** A Button that opens the file chooser — a react-aria FileTrigger around our Button. */
|
|
88
|
+
export declare function FileUploadButton({ onFiles, accept, multiple, acceptDirectory, defaultCamera, children, isDisabled, ...props }: FileUploadButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
89
|
+
/** The row's leading tile: an image's own thumbnail (object URL, revoked when the row goes), else an icon for its kind. */
|
|
90
|
+
export declare function FileThumbnail({ file, disabled, className }: {
|
|
91
|
+
file: File;
|
|
92
|
+
disabled?: boolean;
|
|
93
|
+
className?: string;
|
|
94
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
95
|
+
export declare const fileItemVariants: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
96
|
+
export interface FileItemProps {
|
|
97
|
+
item: UploadFile;
|
|
98
|
+
/** Default: the context's `dismiss` (removes the row, moves focus). */
|
|
99
|
+
onRemove?: (item: UploadFile) => void;
|
|
100
|
+
/** Default: the context's `retry`. */
|
|
101
|
+
onRetry?: (item: UploadFile) => void;
|
|
102
|
+
/** Replaces the row's contents (the labelled group and its status stay). */
|
|
103
|
+
children?: ReactNode | ((item: UploadFile) => ReactNode);
|
|
104
|
+
className?: string;
|
|
105
|
+
style?: CSSProperties;
|
|
106
|
+
}
|
|
107
|
+
/** One file: thumbnail, name, size, status, a progress bar while sending, Retry on failure and Remove. A labelled group. */
|
|
108
|
+
export declare function FileItem({ item, onRemove, onRetry, children, className, style }: FileItemProps): import("react/jsx-runtime").JSX.Element;
|
|
109
|
+
export interface FileListProps {
|
|
110
|
+
/** Default: the context's files. */
|
|
111
|
+
files?: readonly UploadFile[];
|
|
112
|
+
/** Render a row yourself; default `<FileItem item={…} />`. */
|
|
113
|
+
children?: (item: UploadFile) => ReactNode;
|
|
114
|
+
'aria-label'?: string;
|
|
115
|
+
className?: string;
|
|
116
|
+
style?: CSSProperties;
|
|
117
|
+
}
|
|
118
|
+
/** The files as a list of `FileItem`s. Renders nothing while it is empty. */
|
|
119
|
+
export declare function FileList({ files, children, className, style, 'aria-label': ariaLabel }: FileListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
120
|
+
export {};
|
|
121
|
+
//# sourceMappingURL=file-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload.d.ts","sourceRoot":"","sources":["../../src/components/file-upload.tsx"],"names":[],"mappings":"AACA,OAAO,EAA0D,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnH,OAAO,EAEU,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAC5D,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,EAAQ,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EAEL,KAAK,SAAS,EAAiB,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,oBAAoB,EAChH,MAAM,mBAAmB,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