@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,405 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { Icon as t } from "../lib/icon.js";
|
|
4
|
+
import { Button as n } from "./button.js";
|
|
5
|
+
import { Progress as r } from "./progress.js";
|
|
6
|
+
import { formatBytes as i } from "../lib/format-bytes.js";
|
|
7
|
+
import { describeRules as a, entriesFromFileList as o, fileKind as s, readDropItems as c, useFilePreview as l, useFileUpload as u } from "../lib/file-upload.js";
|
|
8
|
+
import { createContext as d, use as f, useEffect as p, useId as m, useRef as h, useState as g } from "react";
|
|
9
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
10
|
+
import { DropZone as b, FileTrigger as x, Text as S, composeRenderProps as C } from "react-aria-components";
|
|
11
|
+
import { cva as w } from "class-variance-authority";
|
|
12
|
+
import { useClipboard as T } from "react-aria/useClipboard";
|
|
13
|
+
//#region src/components/file-upload.tsx
|
|
14
|
+
var E = d(null);
|
|
15
|
+
function D() {
|
|
16
|
+
return f(E);
|
|
17
|
+
}
|
|
18
|
+
var O = () => ({
|
|
19
|
+
added: 0,
|
|
20
|
+
rejected: [],
|
|
21
|
+
removed: [],
|
|
22
|
+
failed: [],
|
|
23
|
+
done: [],
|
|
24
|
+
notes: []
|
|
25
|
+
}), k = (e, t, n) => e === 1 ? t : n;
|
|
26
|
+
function A(e) {
|
|
27
|
+
let [t, n] = g(""), r = h(null), i = h(O()), a = h(void 0), o = h(!1), s = () => {
|
|
28
|
+
clearTimeout(a.current), a.current = setTimeout(() => {
|
|
29
|
+
let e = i.current;
|
|
30
|
+
i.current = O();
|
|
31
|
+
let t = [];
|
|
32
|
+
e.added && t.push(k(e.added, "1 file added", `${e.added} files added`)), e.rejected.length && t.push(e.rejected.length === 1 ? `${e.rejected[0].file.name} rejected. ${e.rejected[0].error ?? ""}`.trim() : `${e.rejected.length} files rejected`), e.done.length && t.push(e.done.length === 1 ? `${e.done[0]} uploaded` : `${e.done.length} files uploaded`), e.failed.length && t.push(e.failed.length === 1 ? `${e.failed[0]} failed to upload` : `${e.failed.length} uploads failed`), e.removed.length && t.push(e.removed.length === 1 ? `${e.removed[0]} removed` : `${e.removed.length} files removed`), t.push(...e.notes), t.length && (o.current = !o.current, n(t.join(". ").replace(/\.$/, "") + "." + (o.current ? "" : "\xA0")));
|
|
33
|
+
}, 300);
|
|
34
|
+
};
|
|
35
|
+
return p(() => {
|
|
36
|
+
let t = new Map(e.map((e) => [e.id, {
|
|
37
|
+
name: e.file.name,
|
|
38
|
+
status: e.status
|
|
39
|
+
}])), n = r.current;
|
|
40
|
+
if (r.current = t, !n) return;
|
|
41
|
+
let a = i.current, o = !1;
|
|
42
|
+
for (let t of e) {
|
|
43
|
+
let e = n.get(t.id);
|
|
44
|
+
if (!e) t.status === "rejected" ? a.rejected.push(t) : a.added++, o = !0;
|
|
45
|
+
else if (e.status !== t.status) {
|
|
46
|
+
if (t.status === "done") a.done.push(t.file.name);
|
|
47
|
+
else if (t.status === "error") a.failed.push(t.file.name);
|
|
48
|
+
else continue;
|
|
49
|
+
o = !0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for (let [e, r] of n) t.has(e) || (a.removed.push(r.name), o = !0);
|
|
53
|
+
o && s();
|
|
54
|
+
}, [e]), p(() => () => clearTimeout(a.current), []), {
|
|
55
|
+
message: t,
|
|
56
|
+
note: (e) => {
|
|
57
|
+
i.current.notes.push(e), s();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function j({ state: e, children: t, className: n, style: r, multiple: i, acceptDirectory: a = !1, defaultCamera: o, pasteable: s = !1, disabled: c = !1, ...l }) {
|
|
62
|
+
let d = u(e ? {} : l);
|
|
63
|
+
return /* @__PURE__ */ v(M, {
|
|
64
|
+
api: e ?? d,
|
|
65
|
+
multiple: i ?? (e ? e.rules.maxFiles !== 1 : l.maxFiles !== 1),
|
|
66
|
+
acceptDirectory: a,
|
|
67
|
+
defaultCamera: o,
|
|
68
|
+
pasteable: s,
|
|
69
|
+
disabled: c,
|
|
70
|
+
className: n,
|
|
71
|
+
style: r,
|
|
72
|
+
children: t
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function M({ api: t, children: n, className: r, style: i, multiple: a, acceptDirectory: o, defaultCamera: s, pasteable: c, disabled: l }) {
|
|
76
|
+
let u = h(null), { message: d, note: f } = A(t.files), [m, b] = g(null), x = h(null), S = (e) => {
|
|
77
|
+
let n = Array.from(u.current?.querySelectorAll("[data-slot=file-item]") ?? []), r = n.findIndex((t) => t.dataset.fileId === e), i = n[r + 1] ?? n[r - 1];
|
|
78
|
+
x.current = i?.dataset.fileId ?? "trigger", t.remove(e);
|
|
79
|
+
};
|
|
80
|
+
p(() => {
|
|
81
|
+
let e = x.current;
|
|
82
|
+
if (!e) return;
|
|
83
|
+
x.current = null;
|
|
84
|
+
let t = u.current;
|
|
85
|
+
(e === "trigger" ? t?.querySelector("[data-file-trigger]") : Array.from(t?.querySelectorAll("[data-slot=file-item]") ?? []).find((t) => t.dataset.fileId === e)?.querySelector("[data-slot=file-item-remove]") ?? t?.querySelector("[data-file-trigger]"))?.focus();
|
|
86
|
+
}, [t.files]);
|
|
87
|
+
let C = (e, n) => {
|
|
88
|
+
if (l) return;
|
|
89
|
+
let r = [];
|
|
90
|
+
n.skippedFolders && r.push("Folders can’t be added here. Choose files instead."), n.truncated && r.push("The folder was too large to read in full. Only the first files were added."), b(r.join(" ") || null);
|
|
91
|
+
for (let e of r) f(e);
|
|
92
|
+
e.length && t.add(e);
|
|
93
|
+
}, w = {
|
|
94
|
+
...t,
|
|
95
|
+
disabled: l,
|
|
96
|
+
multiple: a,
|
|
97
|
+
acceptDirectory: o,
|
|
98
|
+
defaultCamera: s,
|
|
99
|
+
pasteable: c,
|
|
100
|
+
notice: m,
|
|
101
|
+
addFiles: C,
|
|
102
|
+
dismiss: S
|
|
103
|
+
};
|
|
104
|
+
return /* @__PURE__ */ v(E, {
|
|
105
|
+
value: w,
|
|
106
|
+
children: /* @__PURE__ */ y("div", {
|
|
107
|
+
ref: u,
|
|
108
|
+
"data-slot": "file-upload",
|
|
109
|
+
className: e("flex w-full flex-col gap-3", r),
|
|
110
|
+
style: i,
|
|
111
|
+
children: [typeof n == "function" ? n(w) : n ?? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(F, {}), /* @__PURE__ */ v(V, {})] }), /* @__PURE__ */ v("div", {
|
|
112
|
+
"data-slot": "file-upload-status",
|
|
113
|
+
role: "status",
|
|
114
|
+
"aria-live": "polite",
|
|
115
|
+
"aria-atomic": "true",
|
|
116
|
+
className: "sr-only",
|
|
117
|
+
children: d
|
|
118
|
+
})]
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
async function N(e, t, n, r, i = []) {
|
|
123
|
+
let a = await c(e, { directories: n }), o = a.entries.length || a.skippedFolders ? a.entries : i.map((e) => ({
|
|
124
|
+
file: e,
|
|
125
|
+
path: e.name
|
|
126
|
+
}));
|
|
127
|
+
!o.length && !a.skippedFolders || r(o, {
|
|
128
|
+
source: t,
|
|
129
|
+
truncated: a.truncated,
|
|
130
|
+
skippedFolders: a.skippedFolders
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
var P = w("group/zone relative box-border flex border-2 border-dashed border-border text-center outline-none transition-[border-color,background-color,box-shadow,opacity] duration-spring-snappy motion-reduce:transition-none data-drop-target:border-primary data-drop-target:bg-primary/10 data-focus-visible:ring-2 data-focus-visible:ring-ring data-focus-visible:ring-offset-2 data-invalid:border-destructive data-disabled:opacity-40", {
|
|
134
|
+
variants: { size: {
|
|
135
|
+
default: "min-h-40 flex-col items-center justify-center gap-2 rounded-card p-6",
|
|
136
|
+
compact: "flex-row items-center justify-start gap-3 rounded-panel p-3 text-left"
|
|
137
|
+
} },
|
|
138
|
+
defaultVariants: { size: "default" }
|
|
139
|
+
});
|
|
140
|
+
function F({ className: r, size: i, onFiles: s, rules: c, hint: l, title: u = "Drag files here", icon: d = "arrow-up", browseLabel: f = "Browse files", multiple: g, acceptDirectory: w, defaultCamera: E, pasteable: O, isInvalid: k, error: A, isDisabled: j, children: M, ...F }) {
|
|
141
|
+
let I = D(), L = j ?? I?.disabled ?? !1, R = g ?? I?.multiple ?? !0, z = w ?? I?.acceptDirectory ?? !1, B = O ?? I?.pasteable ?? !1, V = c ?? I?.rules ?? {}, H = (e, t) => (s ?? I?.addFiles)?.(e, t), U = l ?? a(V), W = m(), G = m(), K = m(), q = I?.notice, J = h(!1), Y = h(null), X = h([]);
|
|
142
|
+
p(() => {
|
|
143
|
+
let e = Y.current, t = (e) => {
|
|
144
|
+
X.current = Array.from(e.dataTransfer?.files ?? []);
|
|
145
|
+
}, n = (t) => {
|
|
146
|
+
X.current = e?.contains(document.activeElement) ? Array.from(t.clipboardData?.files ?? []) : [];
|
|
147
|
+
};
|
|
148
|
+
return e?.addEventListener("drop", t, !0), document.addEventListener("paste", n, !0), () => {
|
|
149
|
+
e?.removeEventListener("drop", t, !0), document.removeEventListener("paste", n, !0);
|
|
150
|
+
};
|
|
151
|
+
}, []);
|
|
152
|
+
let Z = () => {
|
|
153
|
+
let e = X.current;
|
|
154
|
+
return X.current = [], e;
|
|
155
|
+
}, { clipboardProps: Q } = T({
|
|
156
|
+
isDisabled: !B || L,
|
|
157
|
+
onPaste: (e) => void N(e, "paste", z, H, Z())
|
|
158
|
+
}), $ = [
|
|
159
|
+
U ? W : null,
|
|
160
|
+
k && A ? G : null,
|
|
161
|
+
q ? K : null
|
|
162
|
+
].filter(Boolean).join(" ") || void 0;
|
|
163
|
+
return /* @__PURE__ */ v(b, {
|
|
164
|
+
ref: Y,
|
|
165
|
+
"data-slot": "file-drop-zone",
|
|
166
|
+
"data-invalid": k || void 0,
|
|
167
|
+
"aria-labelledby": $,
|
|
168
|
+
...F,
|
|
169
|
+
isDisabled: L,
|
|
170
|
+
className: C(r, (t) => e(P({ size: i }), t)),
|
|
171
|
+
onDropEnter: (e) => {
|
|
172
|
+
J.current = !0, F.onDropEnter?.(e);
|
|
173
|
+
},
|
|
174
|
+
onDropExit: (e) => {
|
|
175
|
+
J.current = !1, F.onDropExit?.(e);
|
|
176
|
+
},
|
|
177
|
+
onDrop: (e) => {
|
|
178
|
+
let t = J.current ? "drop" : "paste";
|
|
179
|
+
t === "paste" && !B || N(e.items, t, z, H, Z());
|
|
180
|
+
},
|
|
181
|
+
children: (r) => typeof M == "function" ? M(r) : M ?? /* @__PURE__ */ y(_, { children: [
|
|
182
|
+
/* @__PURE__ */ v("span", {
|
|
183
|
+
"data-slot": "file-drop-zone-icon",
|
|
184
|
+
className: "grid size-10 shrink-0 place-items-center rounded-full bg-secondary text-muted-foreground transition-colors duration-spring-snappy group-data-drop-target/zone:bg-primary group-data-drop-target/zone:text-primary-foreground motion-reduce:transition-none",
|
|
185
|
+
children: typeof d == "string" ? /* @__PURE__ */ v(t, {
|
|
186
|
+
name: d,
|
|
187
|
+
size: 20,
|
|
188
|
+
sw: 2
|
|
189
|
+
}) : d
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ y("div", {
|
|
192
|
+
className: e("flex min-w-0 flex-col gap-0.5", i === "compact" ? "flex-1 items-start" : "items-center"),
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ v(S, {
|
|
195
|
+
slot: "label",
|
|
196
|
+
className: "text-subhead font-semibold text-foreground",
|
|
197
|
+
children: r.isDropTarget ? "Drop to add" : u
|
|
198
|
+
}),
|
|
199
|
+
U ? /* @__PURE__ */ v("span", {
|
|
200
|
+
id: W,
|
|
201
|
+
className: "text-footnote text-foreground/70",
|
|
202
|
+
children: U
|
|
203
|
+
}) : null,
|
|
204
|
+
k && A ? /* @__PURE__ */ y("span", {
|
|
205
|
+
id: G,
|
|
206
|
+
className: "flex items-center gap-1 text-footnote font-medium text-foreground",
|
|
207
|
+
children: [/* @__PURE__ */ v(t, {
|
|
208
|
+
name: "exclamation-circle-fill",
|
|
209
|
+
size: 14,
|
|
210
|
+
className: "text-destructive"
|
|
211
|
+
}), A]
|
|
212
|
+
}) : null,
|
|
213
|
+
q ? /* @__PURE__ */ y("span", {
|
|
214
|
+
id: K,
|
|
215
|
+
className: "flex items-center gap-1 text-footnote text-foreground",
|
|
216
|
+
children: [/* @__PURE__ */ v(t, {
|
|
217
|
+
name: "info-fill",
|
|
218
|
+
size: 14,
|
|
219
|
+
className: "text-muted-foreground"
|
|
220
|
+
}), q]
|
|
221
|
+
}) : null
|
|
222
|
+
]
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ v(x, {
|
|
225
|
+
acceptedFileTypes: V.accept,
|
|
226
|
+
allowsMultiple: R,
|
|
227
|
+
acceptDirectory: z,
|
|
228
|
+
defaultCamera: E ?? I?.defaultCamera,
|
|
229
|
+
onSelect: (e) => {
|
|
230
|
+
let t = o(e);
|
|
231
|
+
t.length && H(t, {
|
|
232
|
+
source: "browse",
|
|
233
|
+
truncated: !1,
|
|
234
|
+
skippedFolders: 0
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
children: /* @__PURE__ */ v(n, {
|
|
238
|
+
variant: "secondary",
|
|
239
|
+
size: "sm",
|
|
240
|
+
isDisabled: L,
|
|
241
|
+
"data-file-trigger": "",
|
|
242
|
+
onFocus: (e) => Q.onFocus?.(e),
|
|
243
|
+
onBlur: (e) => Q.onBlur?.(e),
|
|
244
|
+
children: f
|
|
245
|
+
})
|
|
246
|
+
})
|
|
247
|
+
] })
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function I({ onFiles: e, accept: t, multiple: r, acceptDirectory: i, defaultCamera: a, children: s = "Upload files", isDisabled: c, ...l }) {
|
|
251
|
+
let u = D();
|
|
252
|
+
return /* @__PURE__ */ v(x, {
|
|
253
|
+
acceptedFileTypes: t ?? u?.rules.accept,
|
|
254
|
+
allowsMultiple: r ?? u?.multiple ?? !0,
|
|
255
|
+
acceptDirectory: i ?? u?.acceptDirectory ?? !1,
|
|
256
|
+
defaultCamera: a ?? u?.defaultCamera,
|
|
257
|
+
onSelect: (t) => {
|
|
258
|
+
let n = o(t);
|
|
259
|
+
n.length && (e ?? u?.addFiles)?.(n, {
|
|
260
|
+
source: "browse",
|
|
261
|
+
truncated: !1,
|
|
262
|
+
skippedFolders: 0
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
children: /* @__PURE__ */ v(n, {
|
|
266
|
+
"data-slot": "file-upload-button",
|
|
267
|
+
"data-file-trigger": "",
|
|
268
|
+
isDisabled: c ?? u?.disabled,
|
|
269
|
+
...l,
|
|
270
|
+
children: s
|
|
271
|
+
})
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
var L = {
|
|
275
|
+
image: "photo",
|
|
276
|
+
video: "video",
|
|
277
|
+
audio: "music-note",
|
|
278
|
+
pdf: "doc",
|
|
279
|
+
text: "doc",
|
|
280
|
+
archive: "archivebox",
|
|
281
|
+
other: "doc"
|
|
282
|
+
};
|
|
283
|
+
function R({ file: n, disabled: r, className: i }) {
|
|
284
|
+
let a = s(n), o = l(n, a === "image" && !r);
|
|
285
|
+
return /* @__PURE__ */ v("span", {
|
|
286
|
+
"data-slot": "file-thumbnail",
|
|
287
|
+
className: e("grid size-10 shrink-0 place-items-center overflow-hidden rounded-ctl bg-secondary text-muted-foreground", i),
|
|
288
|
+
children: o ? /* @__PURE__ */ v("img", {
|
|
289
|
+
src: o,
|
|
290
|
+
alt: "",
|
|
291
|
+
decoding: "async",
|
|
292
|
+
className: "size-full object-cover"
|
|
293
|
+
}) : /* @__PURE__ */ v(t, {
|
|
294
|
+
name: L[a],
|
|
295
|
+
size: 20
|
|
296
|
+
})
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
var z = w("box-border flex items-center gap-3 rounded-panel border border-border bg-card p-3 text-card-foreground transition-colors duration-spring-snappy motion-reduce:transition-none data-[status=error]:border-destructive data-[status=rejected]:border-destructive");
|
|
300
|
+
function B({ item: a, onRemove: o, onRetry: s, children: c, className: l, style: u }) {
|
|
301
|
+
let d = D(), f = m(), { status: p, file: h, path: g } = a, b = h.name, x = Math.round(a.progress * 100), S = g.includes("/") ? g.slice(0, g.lastIndexOf("/")) : "", C = () => o ? o(a) : d ? d.dismiss(a.id) : void 0, w = () => s ? s(a) : d?.retry(a.id), T = p === "error" && (s || d), E = o || d;
|
|
302
|
+
return /* @__PURE__ */ v("div", {
|
|
303
|
+
role: "group",
|
|
304
|
+
"aria-labelledby": f,
|
|
305
|
+
"data-slot": "file-item",
|
|
306
|
+
"data-file-id": a.id,
|
|
307
|
+
"data-status": p,
|
|
308
|
+
className: e(z(), l),
|
|
309
|
+
style: u,
|
|
310
|
+
children: typeof c == "function" ? c(a) : c ?? /* @__PURE__ */ y(_, { children: [
|
|
311
|
+
/* @__PURE__ */ v(R, {
|
|
312
|
+
file: h,
|
|
313
|
+
disabled: p === "rejected"
|
|
314
|
+
}),
|
|
315
|
+
/* @__PURE__ */ y("div", {
|
|
316
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ v("span", {
|
|
319
|
+
id: f,
|
|
320
|
+
title: g,
|
|
321
|
+
className: "truncate text-subhead font-medium text-foreground",
|
|
322
|
+
children: b
|
|
323
|
+
}),
|
|
324
|
+
/* @__PURE__ */ y("span", {
|
|
325
|
+
"data-slot": "file-item-status",
|
|
326
|
+
className: "flex min-w-0 items-start gap-1.5 text-footnote text-foreground/70",
|
|
327
|
+
children: [
|
|
328
|
+
p === "done" ? /* @__PURE__ */ v(t, {
|
|
329
|
+
name: "check-circle-fill",
|
|
330
|
+
size: 14,
|
|
331
|
+
className: "mt-px shrink-0 text-success"
|
|
332
|
+
}) : null,
|
|
333
|
+
p === "error" || p === "rejected" ? /* @__PURE__ */ v(t, {
|
|
334
|
+
name: "exclamation-circle-fill",
|
|
335
|
+
size: 14,
|
|
336
|
+
className: "mt-px shrink-0 text-destructive"
|
|
337
|
+
}) : null,
|
|
338
|
+
/* @__PURE__ */ v("span", {
|
|
339
|
+
className: e("min-w-0", p === "rejected" || p === "error" ? "break-words" : "truncate"),
|
|
340
|
+
children: p === "rejected" || p === "error" ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v("span", {
|
|
341
|
+
className: "font-medium",
|
|
342
|
+
children: p === "rejected" ? "Not added" : "Upload failed"
|
|
343
|
+
}), a.error ? ` · ${a.error}` : ""] }) : /* @__PURE__ */ y(_, { children: [
|
|
344
|
+
i(h.size),
|
|
345
|
+
S ? ` · ${S}` : "",
|
|
346
|
+
p === "queued" ? " · Waiting" : "",
|
|
347
|
+
p === "uploading" ? /* @__PURE__ */ y("span", {
|
|
348
|
+
className: "tabular-nums",
|
|
349
|
+
children: [
|
|
350
|
+
" · Uploading ",
|
|
351
|
+
x,
|
|
352
|
+
"%"
|
|
353
|
+
]
|
|
354
|
+
}) : "",
|
|
355
|
+
p === "done" ? " · Uploaded" : ""
|
|
356
|
+
] })
|
|
357
|
+
})
|
|
358
|
+
]
|
|
359
|
+
}),
|
|
360
|
+
p === "uploading" ? /* @__PURE__ */ v(r, {
|
|
361
|
+
"aria-label": `Uploading ${b}`,
|
|
362
|
+
value: x,
|
|
363
|
+
size: "sm"
|
|
364
|
+
}) : null
|
|
365
|
+
]
|
|
366
|
+
}),
|
|
367
|
+
T ? /* @__PURE__ */ v(n, {
|
|
368
|
+
"data-slot": "file-item-retry",
|
|
369
|
+
variant: "secondary",
|
|
370
|
+
size: "sm",
|
|
371
|
+
"aria-label": `Retry ${b}`,
|
|
372
|
+
onPress: w,
|
|
373
|
+
children: "Retry"
|
|
374
|
+
}) : null,
|
|
375
|
+
E ? /* @__PURE__ */ v(n, {
|
|
376
|
+
"data-slot": "file-item-remove",
|
|
377
|
+
variant: "ghost",
|
|
378
|
+
size: "icon",
|
|
379
|
+
className: "size-8 text-muted-foreground",
|
|
380
|
+
"aria-label": p === "uploading" ? `Cancel upload of ${b}` : p === "rejected" ? `Dismiss ${b}` : `Remove ${b}`,
|
|
381
|
+
onPress: C,
|
|
382
|
+
children: /* @__PURE__ */ v(t, {
|
|
383
|
+
name: "xmark",
|
|
384
|
+
size: 16,
|
|
385
|
+
sw: 2.2
|
|
386
|
+
})
|
|
387
|
+
}) : null
|
|
388
|
+
] })
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
function V({ files: t, children: n, className: r, style: i, "aria-label": a = "Files" }) {
|
|
392
|
+
let o = D(), s = t ?? o?.files ?? [];
|
|
393
|
+
return s.length ? /* @__PURE__ */ v("ul", {
|
|
394
|
+
"data-slot": "file-list",
|
|
395
|
+
"aria-label": a,
|
|
396
|
+
className: e("m-0 flex list-none flex-col gap-2 p-0", r),
|
|
397
|
+
style: i,
|
|
398
|
+
children: s.map((e) => /* @__PURE__ */ v("li", {
|
|
399
|
+
className: "min-w-0",
|
|
400
|
+
children: n ? n(e) : /* @__PURE__ */ v(B, { item: e })
|
|
401
|
+
}, e.id))
|
|
402
|
+
}) : null;
|
|
403
|
+
}
|
|
404
|
+
//#endregion
|
|
405
|
+
export { F as FileDropZone, B as FileItem, V as FileList, R as FileThumbnail, j as FileUpload, I as FileUploadButton, P as fileDropZoneVariants, z as fileItemVariants, D as useFileUploadContext };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { Filter, FilterField } from '../lib/filter';
|
|
3
|
+
import { UseFilterQueryOptions } from '../lib/filter-query';
|
|
4
|
+
export declare const filterInputVariants: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
5
|
+
export interface FilterInputProps extends Omit<ComponentProps<'div'>, 'onChange' | 'defaultValue' | 'children'> {
|
|
6
|
+
/** What can be filtered. Default: the enclosing FilterBar's fields. */
|
|
7
|
+
fields?: readonly FilterField[];
|
|
8
|
+
/** Called with the understood filters when the user applies them. Default: the enclosing FilterBar's `apply`. */
|
|
9
|
+
onApply?: (filters: Filter[]) => void;
|
|
10
|
+
/** With a FilterBar: `merge` (default) replaces the filter of a field it names and adds the rest; `replace` swaps them all. */
|
|
11
|
+
mode?: 'merge' | 'replace';
|
|
12
|
+
/** The phrase, controlled. */
|
|
13
|
+
value?: string;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
onValueChange?: (text: string) => void;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** Debounce, "now" for relative dates, … — see `useFilterQuery`. */
|
|
18
|
+
query?: UseFilterQueryOptions;
|
|
19
|
+
'aria-label'?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function FilterInput({ fields: fieldsProp, onApply, mode, value, defaultValue, onValueChange, placeholder, query: queryOptions, 'aria-label': ariaLabel, className, ...props }: FilterInputProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=filter-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-input.d.ts","sourceRoot":"","sources":["../../src/components/filter-input.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAK7D,OAAO,EAAkB,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAmC,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAwBjG,eAAO,MAAM,mBAAmB,oFAAuC,CAAC;AAExE,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;IAC7G,uEAAuE;IACvE,MAAM,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAChC,iHAAiH;IACjH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACtC,+HAA+H;IAC/H,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,IAAc,EAAE,KAAK,EAAE,YAAiB,EAAE,aAAa,EAAE,WAAuC,EAAE,KAAK,EAAE,YAAY,EAClJ,YAAY,EAAE,SAA2C,EAAE,SAAS,EAAE,GAAG,KAAK,EAC/E,EAAE,gBAAgB,2CA0GlB"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { Icon as t } from "../lib/icon.js";
|
|
4
|
+
import { Button as n } from "./button.js";
|
|
5
|
+
import { selectableText as r } from "../lib/primitives.js";
|
|
6
|
+
import { describeFilter as i } from "../lib/filter.js";
|
|
7
|
+
import { FilterChip as a, useOptionalFilterBar as o } from "./filter.js";
|
|
8
|
+
import { useFilterQuery as s, warmFilterQuery as c } from "../lib/filter-query.js";
|
|
9
|
+
import { useId as l, useState as u } from "react";
|
|
10
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
+
import { Input as m, TextField as h } from "react-aria-components";
|
|
12
|
+
import { cva as g } from "class-variance-authority";
|
|
13
|
+
//#region src/components/filter-input.tsx
|
|
14
|
+
var _ = [{
|
|
15
|
+
d: "M10.5 4.2l1.5 4.2 4.2 1.5-4.2 1.5-1.5 4.2-1.5-4.2-4.2-1.5 4.2-1.5z",
|
|
16
|
+
f: 2
|
|
17
|
+
}, {
|
|
18
|
+
d: "M18 14.6l.8 2.1 2.1.8-2.1.8-.8 2.1-.8-2.1-2.1-.8 2.1-.8z",
|
|
19
|
+
f: 2
|
|
20
|
+
}], v = g("flex min-w-0 flex-col gap-1.5"), y = "urgent bugs assigned to bob";
|
|
21
|
+
function b({ fields: g, onApply: b, mode: x = "merge", value: S, defaultValue: C = "", onValueChange: w, placeholder: T = "Describe what you want…", query: E, "aria-label": D = "Describe the filters you want", className: O, ...k }) {
|
|
22
|
+
let A = o(), j = g ?? A?.fields ?? [], [M, N] = u(C), P = S ?? M, F = (e) => {
|
|
23
|
+
S === void 0 && N(e), w?.(e);
|
|
24
|
+
}, [I, L] = u(""), R = l(), z = l(), B = s(P, j, E), { filters: V, unresolved: H, notes: U, status: W, pending: G } = B, K = P.trim(), q = K !== "" && !G && W === "ready", J = q && V.length > 0 && !!(b ?? A), Y = () => {
|
|
25
|
+
J && (b ? b(V) : A?.apply(V, x), F(""), L(""));
|
|
26
|
+
}, X = () => {
|
|
27
|
+
K && (G || W === "loading" ? (B.refresh(), L("Reading your sentence… press Enter again to apply what it shows.")) : W === "ready" && !V.length ? L("Nothing to apply: no filter was understood.") : q && Y());
|
|
28
|
+
}, Z = (e) => e.map((e) => i(e, j, A?.locale)).join("; "), Q = H.length ? ` Ignored: ${H.map((e) => e.text).join(", ")}.` : "", $ = [K ? W === "error" ? "The language model could not be loaded. Use the Filter menu instead." : q ? V.length ? `${V.length === 1 ? "1 filter" : `${V.length} filters`} understood: ${Z(V)}.${Q}${U.length ? ` ${U.join(". ")}.` : ""} Press Enter to apply.` : `No filter understood.${Q}` : "" : "", I].filter(Boolean).join(" ");
|
|
29
|
+
return /* @__PURE__ */ p("div", {
|
|
30
|
+
"data-slot": "filter-input",
|
|
31
|
+
className: e(v(), O),
|
|
32
|
+
...k,
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ p("div", {
|
|
35
|
+
className: "flex items-center gap-2",
|
|
36
|
+
children: [/* @__PURE__ */ f(h, {
|
|
37
|
+
value: P,
|
|
38
|
+
onChange: (e) => {
|
|
39
|
+
F(e), I && L("");
|
|
40
|
+
},
|
|
41
|
+
"aria-label": D,
|
|
42
|
+
className: "flex min-w-0 flex-1 items-center",
|
|
43
|
+
children: /* @__PURE__ */ p("div", {
|
|
44
|
+
className: "box-border flex h-9 w-full min-w-0 items-center gap-2 rounded-ctl bg-secondary px-2.5 focus-within:ring-2 focus-within:ring-ring/45",
|
|
45
|
+
children: [/* @__PURE__ */ f(t, {
|
|
46
|
+
shapes: _,
|
|
47
|
+
size: 16,
|
|
48
|
+
sw: 1.6,
|
|
49
|
+
className: "shrink-0 text-foreground/70"
|
|
50
|
+
}), /* @__PURE__ */ f(m, {
|
|
51
|
+
placeholder: T,
|
|
52
|
+
"aria-describedby": `${R} ${z}`,
|
|
53
|
+
autoComplete: "off",
|
|
54
|
+
spellCheck: !1,
|
|
55
|
+
maxLength: 400,
|
|
56
|
+
onFocus: () => {
|
|
57
|
+
c();
|
|
58
|
+
},
|
|
59
|
+
onKeyDown: (e) => {
|
|
60
|
+
e.key === "Enter" && !e.nativeEvent.isComposing ? (e.preventDefault(), X()) : e.key === "Escape" && P && (e.preventDefault(), e.stopPropagation(), F(""), L(""));
|
|
61
|
+
},
|
|
62
|
+
className: e("min-w-0 flex-1 appearance-none border-0 bg-transparent p-0 [font-family:inherit] text-body text-foreground outline-none placeholder:text-tertiary-foreground", r)
|
|
63
|
+
})]
|
|
64
|
+
})
|
|
65
|
+
}), /* @__PURE__ */ f(n, {
|
|
66
|
+
variant: "secondary",
|
|
67
|
+
size: "sm",
|
|
68
|
+
isDisabled: !J,
|
|
69
|
+
onPress: Y,
|
|
70
|
+
children: "Apply"
|
|
71
|
+
})]
|
|
72
|
+
}),
|
|
73
|
+
K ? /* @__PURE__ */ p("div", {
|
|
74
|
+
"data-slot": "filter-input-preview",
|
|
75
|
+
"aria-hidden": "true",
|
|
76
|
+
className: e("flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1.5 text-caption text-foreground/70 transition-opacity duration-spring-snappy motion-reduce:transition-none", G && "opacity-60"),
|
|
77
|
+
children: [
|
|
78
|
+
W === "error" ? /* @__PURE__ */ f("span", {
|
|
79
|
+
className: "text-destructive",
|
|
80
|
+
children: "The language model could not be loaded (offline?). The Filter menu still works."
|
|
81
|
+
}) : W === "loading" && !V.length ? /* @__PURE__ */ f("span", { children: "Loading the language model…" }) : V.length ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("span", {
|
|
82
|
+
className: "font-semibold",
|
|
83
|
+
children: "Will apply"
|
|
84
|
+
}), V.map((e) => /* @__PURE__ */ f(a, {
|
|
85
|
+
filter: e,
|
|
86
|
+
field: j.find((t) => t.id === e.field),
|
|
87
|
+
readOnly: !0,
|
|
88
|
+
size: "sm",
|
|
89
|
+
tone: "preview",
|
|
90
|
+
locale: A?.locale
|
|
91
|
+
}, e.id))] }) : /* @__PURE__ */ p("span", { children: [
|
|
92
|
+
"Nothing understood yet. Try “",
|
|
93
|
+
y,
|
|
94
|
+
"”."
|
|
95
|
+
] }),
|
|
96
|
+
!G && H.length ? /* @__PURE__ */ p("span", { children: ["Ignored: ", H.map((e, t) => /* @__PURE__ */ p("span", {
|
|
97
|
+
title: e.reason,
|
|
98
|
+
className: "text-foreground",
|
|
99
|
+
children: [
|
|
100
|
+
"“",
|
|
101
|
+
e.text,
|
|
102
|
+
"”",
|
|
103
|
+
t < H.length - 1 ? ", " : ""
|
|
104
|
+
]
|
|
105
|
+
}, `${e.text}-${t}`))] }) : null,
|
|
106
|
+
!G && U.map((e) => /* @__PURE__ */ f("span", { children: e }, e))
|
|
107
|
+
]
|
|
108
|
+
}) : null,
|
|
109
|
+
/* @__PURE__ */ f("p", {
|
|
110
|
+
id: R,
|
|
111
|
+
className: "m-0 text-caption text-foreground/70",
|
|
112
|
+
children: "Experimental: a small model that runs in your browser and reads simple filters joined by “and”. It misses plenty. Check the preview, then press Enter."
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ f("div", {
|
|
115
|
+
id: z,
|
|
116
|
+
role: "status",
|
|
117
|
+
"aria-live": "polite",
|
|
118
|
+
"aria-atomic": "true",
|
|
119
|
+
className: "sr-only",
|
|
120
|
+
children: $
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
export { b as FilterInput, v as filterInputVariants };
|