@rafal.lemieszewski/tide-ui 0.88.1 → 0.89.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/dist/cjs/components/fundamental/file-upload.cjs +1 -1
- package/dist/cjs/components/product/app-frame.cjs +1 -1
- package/dist/cjs/components/product/bookmarks.cjs +1 -1
- package/dist/cjs/components/product/filters.cjs +1 -1
- package/dist/es/components/fundamental/file-upload.js +103 -90
- package/dist/es/components/product/app-frame.js +3 -3
- package/dist/es/components/product/bookmarks.js +28 -29
- package/dist/es/components/product/filters.js +566 -517
- package/dist/types/components/fundamental/file-upload.d.ts +11 -3
- package/dist/types/components/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,61 +1,68 @@
|
|
|
1
|
-
import { jsx as s, jsxs as b } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { cva as
|
|
1
|
+
import { jsx as s, jsxs as b, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { cn as f } from "../../lib/utils.js";
|
|
4
|
+
import { cva as Y } from "class-variance-authority";
|
|
5
5
|
import { Button as P } from "./button.js";
|
|
6
|
-
import { Progress as
|
|
6
|
+
import { Progress as Z } from "./progress.js";
|
|
7
7
|
import { Icon as z } from "./icon.js";
|
|
8
|
-
import { X as
|
|
9
|
-
import { Badge as
|
|
10
|
-
const M =
|
|
8
|
+
import { X as _ } from "lucide-react";
|
|
9
|
+
import { Badge as ee } from "./badge.js";
|
|
10
|
+
const M = i.createContext(
|
|
11
11
|
null
|
|
12
12
|
), D = () => {
|
|
13
|
-
const r =
|
|
13
|
+
const r = i.useContext(M);
|
|
14
14
|
if (!r)
|
|
15
15
|
throw new Error("useFileUpload must be used within a FileUpload component");
|
|
16
16
|
return r;
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
|
+
function re(r) {
|
|
19
|
+
return r instanceof File;
|
|
20
|
+
}
|
|
21
|
+
const j = /* @__PURE__ */ i.forwardRef(
|
|
18
22
|
({
|
|
19
23
|
className: r,
|
|
20
24
|
files: e,
|
|
21
25
|
onFilesChange: o,
|
|
22
26
|
maxFiles: t = 10,
|
|
23
|
-
maxSize:
|
|
27
|
+
maxSize: n = 10 * 1024 * 1024,
|
|
24
28
|
// 10MB
|
|
25
|
-
accept:
|
|
26
|
-
disabled:
|
|
27
|
-
multiple:
|
|
28
|
-
onUpload:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
accept: l,
|
|
30
|
+
disabled: v = !1,
|
|
31
|
+
multiple: p = !0,
|
|
32
|
+
onUpload: c,
|
|
33
|
+
onDelete: u,
|
|
34
|
+
children: w,
|
|
35
|
+
...N
|
|
36
|
+
}, g) => {
|
|
37
|
+
const F = i.useMemo(
|
|
33
38
|
() => ({
|
|
34
39
|
files: e,
|
|
35
40
|
onFilesChange: o,
|
|
36
41
|
maxFiles: t,
|
|
37
|
-
maxSize:
|
|
38
|
-
accept:
|
|
39
|
-
disabled:
|
|
40
|
-
multiple:
|
|
41
|
-
onUpload:
|
|
42
|
+
maxSize: n,
|
|
43
|
+
accept: l,
|
|
44
|
+
disabled: v,
|
|
45
|
+
multiple: p,
|
|
46
|
+
onUpload: c,
|
|
47
|
+
onDelete: u
|
|
42
48
|
}),
|
|
43
49
|
[
|
|
44
50
|
e,
|
|
45
51
|
o,
|
|
46
52
|
t,
|
|
53
|
+
n,
|
|
47
54
|
l,
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
v,
|
|
56
|
+
p,
|
|
50
57
|
c,
|
|
51
|
-
|
|
58
|
+
u
|
|
52
59
|
]
|
|
53
60
|
);
|
|
54
|
-
return /* @__PURE__ */ s(M.Provider, { value:
|
|
61
|
+
return /* @__PURE__ */ s(M.Provider, { value: F, children: /* @__PURE__ */ s("div", { ref: g, className: f("space-y-4", r), ...N, children: w }) });
|
|
55
62
|
}
|
|
56
63
|
);
|
|
57
64
|
j.displayName = "FileUploadRoot";
|
|
58
|
-
const
|
|
65
|
+
const te = Y(
|
|
59
66
|
"relative flex flex-col items-center justify-center rounded-[var(--border-radius-l)] border-2 border-dashed p-6 text-center transition-colors duration-200",
|
|
60
67
|
{
|
|
61
68
|
variants: {
|
|
@@ -73,54 +80,54 @@ const ee = Q(
|
|
|
73
80
|
disabled: !1
|
|
74
81
|
}
|
|
75
82
|
}
|
|
76
|
-
), k = /* @__PURE__ */
|
|
83
|
+
), k = /* @__PURE__ */ i.forwardRef(({ className: r, children: e, ...o }, t) => {
|
|
77
84
|
const {
|
|
78
|
-
files:
|
|
79
|
-
onFilesChange:
|
|
80
|
-
maxFiles:
|
|
81
|
-
maxSize:
|
|
82
|
-
accept:
|
|
85
|
+
files: n,
|
|
86
|
+
onFilesChange: l,
|
|
87
|
+
maxFiles: v,
|
|
88
|
+
maxSize: p,
|
|
89
|
+
accept: c,
|
|
83
90
|
disabled: u,
|
|
84
|
-
multiple:
|
|
85
|
-
} = D(), [
|
|
86
|
-
if (
|
|
87
|
-
return `File size must be less than ${E(
|
|
88
|
-
if (
|
|
89
|
-
const d = a.type,
|
|
90
|
-
if (!
|
|
91
|
-
if (
|
|
92
|
-
return
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
95
|
-
return d.startsWith(
|
|
91
|
+
multiple: w
|
|
92
|
+
} = D(), [N, g] = i.useState(!1), F = i.useRef(null), O = (a) => {
|
|
93
|
+
if (p && a.size > p)
|
|
94
|
+
return `File size must be less than ${E(p)}`;
|
|
95
|
+
if (c && c.length > 0) {
|
|
96
|
+
const d = a.type, U = `.${a.name.split(".").pop()?.toLowerCase()}`;
|
|
97
|
+
if (!c.some((m) => {
|
|
98
|
+
if (m.startsWith("."))
|
|
99
|
+
return m.toLowerCase() === U;
|
|
100
|
+
if (m.includes("*")) {
|
|
101
|
+
const x = m.split("/")[0];
|
|
102
|
+
return d.startsWith(x);
|
|
96
103
|
}
|
|
97
|
-
return d ===
|
|
104
|
+
return d === m;
|
|
98
105
|
}))
|
|
99
|
-
return `File type not supported. Accepted types: ${
|
|
106
|
+
return `File type not supported. Accepted types: ${c.join(", ")}`;
|
|
100
107
|
}
|
|
101
108
|
return null;
|
|
102
109
|
}, I = (a) => {
|
|
103
|
-
const d = [],
|
|
104
|
-
Array.from(a).forEach((h,
|
|
105
|
-
if (
|
|
106
|
-
const
|
|
107
|
-
id: `${Date.now()}-${
|
|
110
|
+
const d = [], U = n.length;
|
|
111
|
+
Array.from(a).forEach((h, m) => {
|
|
112
|
+
if (v && U + d.length >= v) return;
|
|
113
|
+
const x = O(h), R = {
|
|
114
|
+
id: `${Date.now()}-${m}`,
|
|
108
115
|
file: h,
|
|
109
|
-
status:
|
|
110
|
-
error:
|
|
116
|
+
status: x ? "error" : "pending",
|
|
117
|
+
error: x || void 0,
|
|
111
118
|
progress: 0
|
|
112
119
|
};
|
|
113
120
|
if (h.type.startsWith("image/")) {
|
|
114
121
|
const C = new FileReader();
|
|
115
122
|
C.onload = (H) => {
|
|
116
|
-
const J =
|
|
117
|
-
(
|
|
123
|
+
const J = n.map(
|
|
124
|
+
(y) => y.id === R.id ? { ...y, preview: H.target?.result } : y
|
|
118
125
|
);
|
|
119
|
-
|
|
126
|
+
l(J);
|
|
120
127
|
}, C.readAsDataURL(h);
|
|
121
128
|
}
|
|
122
129
|
d.push(R);
|
|
123
|
-
}), d.length > 0 &&
|
|
130
|
+
}), d.length > 0 && l([...n, ...d]);
|
|
124
131
|
}, S = (a) => {
|
|
125
132
|
a.preventDefault(), a.stopPropagation(), u || g(!0);
|
|
126
133
|
}, G = (a) => {
|
|
@@ -130,7 +137,7 @@ const ee = Q(
|
|
|
130
137
|
const d = a.dataTransfer.files;
|
|
131
138
|
d.length > 0 && I(d);
|
|
132
139
|
}, X = () => {
|
|
133
|
-
u ||
|
|
140
|
+
u || F.current?.click();
|
|
134
141
|
}, q = (a) => {
|
|
135
142
|
const d = a.target.files;
|
|
136
143
|
d && I(d), a.target.value = "";
|
|
@@ -139,7 +146,7 @@ const ee = Q(
|
|
|
139
146
|
"div",
|
|
140
147
|
{
|
|
141
148
|
ref: t,
|
|
142
|
-
className:
|
|
149
|
+
className: f(te({ isDragActive: N, disabled: u }), r),
|
|
143
150
|
onDragOver: S,
|
|
144
151
|
onDragLeave: G,
|
|
145
152
|
onDrop: K,
|
|
@@ -152,10 +159,10 @@ const ee = Q(
|
|
|
152
159
|
/* @__PURE__ */ s(
|
|
153
160
|
"input",
|
|
154
161
|
{
|
|
155
|
-
ref:
|
|
162
|
+
ref: F,
|
|
156
163
|
type: "file",
|
|
157
|
-
multiple:
|
|
158
|
-
accept:
|
|
164
|
+
multiple: w,
|
|
165
|
+
accept: c?.join(","),
|
|
159
166
|
disabled: u,
|
|
160
167
|
className: "hidden",
|
|
161
168
|
onChange: q
|
|
@@ -167,21 +174,21 @@ const ee = Q(
|
|
|
167
174
|
);
|
|
168
175
|
});
|
|
169
176
|
k.displayName = "FileUploadDropzone";
|
|
170
|
-
const L = /* @__PURE__ */
|
|
177
|
+
const L = /* @__PURE__ */ i.forwardRef(({ children: r, ...e }, o) => {
|
|
171
178
|
const { disabled: t } = D();
|
|
172
179
|
return /* @__PURE__ */ s(P, { ref: o, disabled: t, ...e, children: r });
|
|
173
180
|
});
|
|
174
181
|
L.displayName = "FileUploadTrigger";
|
|
175
|
-
const A = /* @__PURE__ */
|
|
176
|
-
({ className: r, children: e, ...o }, t) => /* @__PURE__ */ s("div", { ref: t, className:
|
|
182
|
+
const A = /* @__PURE__ */ i.forwardRef(
|
|
183
|
+
({ className: r, children: e, ...o }, t) => /* @__PURE__ */ s("div", { ref: t, className: f("space-y-2", r), ...o, children: e })
|
|
177
184
|
);
|
|
178
185
|
A.displayName = "FileUploadList";
|
|
179
|
-
const B = /* @__PURE__ */
|
|
180
|
-
({ className: r, file: e, children: o, ...t },
|
|
186
|
+
const B = /* @__PURE__ */ i.forwardRef(
|
|
187
|
+
({ className: r, file: e, children: o, ...t }, n) => /* @__PURE__ */ s(
|
|
181
188
|
"div",
|
|
182
189
|
{
|
|
183
|
-
ref:
|
|
184
|
-
className:
|
|
190
|
+
ref: n,
|
|
191
|
+
className: f(
|
|
185
192
|
"flex items-center gap-3 rounded-[var(--border-radius-l)] border p-3",
|
|
186
193
|
"border-[var(--color-border-primary)]",
|
|
187
194
|
e.status === "error" && "border-[var(--color-border-error-bold)] bg-[var(--color-background-error-subtle)]",
|
|
@@ -194,18 +201,18 @@ const B = /* @__PURE__ */ n.forwardRef(
|
|
|
194
201
|
)
|
|
195
202
|
);
|
|
196
203
|
B.displayName = "FileUploadItem";
|
|
197
|
-
const W = /* @__PURE__ */
|
|
198
|
-
const
|
|
204
|
+
const W = /* @__PURE__ */ i.forwardRef(({ className: r, file: e, ...o }, t) => {
|
|
205
|
+
const n = (l) => l.startsWith("image/") ? "image" : l.startsWith("video/") ? "video" : l.startsWith("audio/") ? "volume-2" : l.includes("pdf") || l.includes("text/") || l.includes("application/json") ? "file-text" : "file";
|
|
199
206
|
return /* @__PURE__ */ s(
|
|
200
207
|
"div",
|
|
201
208
|
{
|
|
202
209
|
ref: t,
|
|
203
|
-
className:
|
|
210
|
+
className: f(
|
|
204
211
|
"flex h-10 w-10 items-center justify-center rounded",
|
|
205
212
|
r
|
|
206
213
|
),
|
|
207
214
|
...o,
|
|
208
|
-
children: e.preview ? /* @__PURE__ */ s(
|
|
215
|
+
children: e.preview && re(e.file) ? /* @__PURE__ */ s(
|
|
209
216
|
"img",
|
|
210
217
|
{
|
|
211
218
|
src: e.preview,
|
|
@@ -215,7 +222,7 @@ const W = /* @__PURE__ */ n.forwardRef(({ className: r, file: e, ...o }, t) => {
|
|
|
215
222
|
) : /* @__PURE__ */ s(
|
|
216
223
|
z,
|
|
217
224
|
{
|
|
218
|
-
name:
|
|
225
|
+
name: n(e.file.type ?? ""),
|
|
219
226
|
className: "h-5 w-5 text-[var(--color-text-secondary)]"
|
|
220
227
|
}
|
|
221
228
|
)
|
|
@@ -223,38 +230,44 @@ const W = /* @__PURE__ */ n.forwardRef(({ className: r, file: e, ...o }, t) => {
|
|
|
223
230
|
);
|
|
224
231
|
});
|
|
225
232
|
W.displayName = "FileUploadItemPreview";
|
|
226
|
-
const $ = /* @__PURE__ */
|
|
233
|
+
const $ = /* @__PURE__ */ i.forwardRef(({ className: r, file: e, children: o, ...t }, n) => /* @__PURE__ */ s("div", { ref: n, className: f("flex-1 space-y-1", r), ...t, children: o ?? /* @__PURE__ */ b(Q, { children: [
|
|
227
234
|
/* @__PURE__ */ b("div", { className: "flex items-center gap-2", children: [
|
|
228
235
|
/* @__PURE__ */ s("p", { className: "text-body-sm truncate font-medium", children: e.file.name }),
|
|
229
|
-
/* @__PURE__ */ s(
|
|
236
|
+
/* @__PURE__ */ s(ee, { children: e.status })
|
|
230
237
|
] }),
|
|
231
238
|
/* @__PURE__ */ s("p", { className: "text-caption-sm text-[var(--color-text-secondary)]", children: E(e.file.size) }),
|
|
232
239
|
e.error && /* @__PURE__ */ s("p", { className: "text-caption-sm text-[var(--color-text-error-bold)]", children: e.error })
|
|
233
|
-
] }));
|
|
240
|
+
] }) }));
|
|
234
241
|
$.displayName = "FileUploadItemMetadata";
|
|
235
|
-
const V = /* @__PURE__ */
|
|
236
|
-
/* @__PURE__ */ s(
|
|
242
|
+
const V = /* @__PURE__ */ i.forwardRef(({ className: r, file: e, variant: o = "linear", ...t }, n) => e.status !== "uploading" || e.progress === void 0 ? null : /* @__PURE__ */ b("div", { ref: n, className: f("w-full", r), ...t, children: [
|
|
243
|
+
/* @__PURE__ */ s(Z, { value: e.progress, className: "h-2" }),
|
|
237
244
|
/* @__PURE__ */ b("p", { className: "text-caption-sm mt-1 text-[var(--color-text-secondary)]", children: [
|
|
238
245
|
Math.round(e.progress),
|
|
239
246
|
"%"
|
|
240
247
|
] })
|
|
241
248
|
] }));
|
|
242
249
|
V.displayName = "FileUploadItemProgress";
|
|
243
|
-
const T = /* @__PURE__ */
|
|
244
|
-
const { files: t, onFilesChange: l } = D();
|
|
250
|
+
const T = /* @__PURE__ */ i.forwardRef(({ file: r, ...e }, o) => {
|
|
251
|
+
const { files: t, onFilesChange: n, onDelete: l } = D();
|
|
245
252
|
return /* @__PURE__ */ s(
|
|
246
253
|
P,
|
|
247
254
|
{
|
|
248
255
|
ref: o,
|
|
249
256
|
variant: "ghost",
|
|
250
257
|
size: "s",
|
|
251
|
-
onClick: () => {
|
|
252
|
-
|
|
253
|
-
|
|
258
|
+
onClick: async () => {
|
|
259
|
+
if (l)
|
|
260
|
+
try {
|
|
261
|
+
await l(r);
|
|
262
|
+
} catch {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const p = t.filter((c) => c.id !== r.id);
|
|
266
|
+
n(p);
|
|
254
267
|
},
|
|
255
268
|
"aria-label": `Remove ${r.file.name}`,
|
|
256
269
|
...e,
|
|
257
|
-
children: /* @__PURE__ */ s(z, { name:
|
|
270
|
+
children: /* @__PURE__ */ s(z, { name: _, className: "h-4 w-4" })
|
|
258
271
|
}
|
|
259
272
|
);
|
|
260
273
|
});
|
|
@@ -263,7 +276,7 @@ const E = (r) => {
|
|
|
263
276
|
if (r === 0) return "0 Bytes";
|
|
264
277
|
const e = 1024, o = ["Bytes", "KB", "MB", "GB"], t = Math.floor(Math.log(r) / Math.log(e));
|
|
265
278
|
return parseFloat((r / Math.pow(e, t)).toFixed(2)) + " " + o[t];
|
|
266
|
-
},
|
|
279
|
+
}, ue = {
|
|
267
280
|
Root: j,
|
|
268
281
|
Dropzone: k,
|
|
269
282
|
Trigger: L,
|
|
@@ -275,7 +288,7 @@ const E = (r) => {
|
|
|
275
288
|
ItemDelete: T
|
|
276
289
|
};
|
|
277
290
|
export {
|
|
278
|
-
|
|
291
|
+
ue as FileUpload,
|
|
279
292
|
k as FileUploadDropzone,
|
|
280
293
|
B as FileUploadItem,
|
|
281
294
|
T as FileUploadItemDelete,
|
|
@@ -259,7 +259,7 @@ function Ie({ navigationData: a, user: o, teams: u, onNavigate: n, navigationMod
|
|
|
259
259
|
) }),
|
|
260
260
|
/* @__PURE__ */ e(N, { side: "right", className: "hidden group-data-[collapsible=icon]:block", children: H(r) })
|
|
261
261
|
] }) }, r.title)) }) }) }),
|
|
262
|
-
/* @__PURE__ */ e("div", { className: "my-2 hidden justify-center px-2 group-data-[collapsible=icon]:flex", children: /* @__PURE__ */ e(Q, {
|
|
262
|
+
/* @__PURE__ */ e("div", { className: "my-2 hidden justify-center px-2 group-data-[collapsible=icon]:flex", children: /* @__PURE__ */ e(Q, { type: "horizontal-line" }) }),
|
|
263
263
|
/* @__PURE__ */ l(F, { className: "mt-1 p-[var(--space-s)]", children: [
|
|
264
264
|
/* @__PURE__ */ e(_, { className: "py-1 pb-1.5 group-data-[collapsible=icon]:hidden", children: "Operations" }),
|
|
265
265
|
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(I, { children: a.operations.map((r) => /* @__PURE__ */ e(P, { children: r.items && r.items.length > 0 ? /* @__PURE__ */ l(G, { children: [
|
|
@@ -337,7 +337,7 @@ function Ie({ navigationData: a, user: o, teams: u, onNavigate: n, navigationMod
|
|
|
337
337
|
/* @__PURE__ */ e(N, { side: "right", className: "hidden group-data-[collapsible=icon]:block", children: H(r) })
|
|
338
338
|
] }) }, r.title)) }) })
|
|
339
339
|
] }),
|
|
340
|
-
/* @__PURE__ */ e("div", { className: "my-2 hidden justify-center px-2 group-data-[collapsible=icon]:flex", children: /* @__PURE__ */ e(Q, {
|
|
340
|
+
/* @__PURE__ */ e("div", { className: "my-2 hidden justify-center px-2 group-data-[collapsible=icon]:flex", children: /* @__PURE__ */ e(Q, { type: "horizontal-line" }) }),
|
|
341
341
|
/* @__PURE__ */ l(F, { className: "mt-1 p-[var(--space-s)]", children: [
|
|
342
342
|
/* @__PURE__ */ e(_, { className: "py-1 pb-1.5 group-data-[collapsible=icon]:hidden", children: "Intelligence" }),
|
|
343
343
|
/* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(I, { children: a.intelligence.map((r) => /* @__PURE__ */ e(P, { children: r.items && r.items.length > 0 ? /* @__PURE__ */ l(G, { children: [
|
|
@@ -1042,7 +1042,7 @@ function rr({
|
|
|
1042
1042
|
/* @__PURE__ */ l(se, { children: [
|
|
1043
1043
|
(d || b || f) && /* @__PURE__ */ l("header", { className: "flex h-12 shrink-0 items-center gap-2 border-b border-[var(--color-border-primary-subtle)] transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12 box-border px-[var(--space-m)]", children: [
|
|
1044
1044
|
/* @__PURE__ */ e(Ze, {}),
|
|
1045
|
-
/* @__PURE__ */ e(Q, {
|
|
1045
|
+
/* @__PURE__ */ e(Q, { type: "vertical-line", className: "mr-2 h-4" }),
|
|
1046
1046
|
/* @__PURE__ */ e("div", { className: "flex-1 min-w-0", children: d }),
|
|
1047
1047
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-2 ml-auto shrink-0", children: [
|
|
1048
1048
|
f && /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: f }),
|
|
@@ -89,8 +89,8 @@ function Qe({
|
|
|
89
89
|
{
|
|
90
90
|
value: u,
|
|
91
91
|
onValueChange: (d) => {
|
|
92
|
-
const
|
|
93
|
-
|
|
92
|
+
const y = C.find((v) => v.id === d);
|
|
93
|
+
y && c(y);
|
|
94
94
|
},
|
|
95
95
|
children: [
|
|
96
96
|
/* @__PURE__ */ s(
|
|
@@ -237,10 +237,10 @@ const xe = /* @__PURE__ */ t.memo(
|
|
|
237
237
|
onSetDefault: b,
|
|
238
238
|
onNavigate: h,
|
|
239
239
|
onNavigateFirst: d,
|
|
240
|
-
onNavigateLast:
|
|
240
|
+
onNavigateLast: y,
|
|
241
241
|
onHover: v
|
|
242
242
|
}, W) => {
|
|
243
|
-
const A = r.type === "user",
|
|
243
|
+
const A = r.type === "user", B = t.useCallback(() => {
|
|
244
244
|
g(r);
|
|
245
245
|
}, [g, r]), F = t.useCallback(() => {
|
|
246
246
|
v?.(r);
|
|
@@ -265,11 +265,11 @@ const xe = /* @__PURE__ */ t.memo(
|
|
|
265
265
|
a.preventDefault(), d();
|
|
266
266
|
break;
|
|
267
267
|
case "End":
|
|
268
|
-
a.preventDefault(),
|
|
268
|
+
a.preventDefault(), y();
|
|
269
269
|
break;
|
|
270
270
|
}
|
|
271
271
|
},
|
|
272
|
-
[r, c, g, h, d,
|
|
272
|
+
[r, c, g, h, d, y]
|
|
273
273
|
);
|
|
274
274
|
return /* @__PURE__ */ s(
|
|
275
275
|
"div",
|
|
@@ -280,7 +280,7 @@ const xe = /* @__PURE__ */ t.memo(
|
|
|
280
280
|
"aria-posinset": c + 1,
|
|
281
281
|
"aria-setsize": x,
|
|
282
282
|
tabIndex: o ? 0 : -1,
|
|
283
|
-
onClick:
|
|
283
|
+
onClick: B,
|
|
284
284
|
onKeyDown: f,
|
|
285
285
|
onMouseEnter: F,
|
|
286
286
|
className: X(
|
|
@@ -371,12 +371,12 @@ function Ye({
|
|
|
371
371
|
onBookmarkHover: b,
|
|
372
372
|
onOverflowMenuChange: h
|
|
373
373
|
}) {
|
|
374
|
-
const [d,
|
|
374
|
+
const [d, y] = t.useState(!1), [v, W] = t.useState(null), A = t.useCallback(
|
|
375
375
|
(n) => {
|
|
376
|
-
|
|
376
|
+
y(n), h?.(n);
|
|
377
377
|
},
|
|
378
378
|
[h]
|
|
379
|
-
), [
|
|
379
|
+
), [B, F] = t.useState(null), P = t.useRef(null), k = t.useRef(/* @__PURE__ */ new Map()), f = t.useMemo(
|
|
380
380
|
() => [...o, ...r],
|
|
381
381
|
[o, r]
|
|
382
382
|
);
|
|
@@ -397,7 +397,7 @@ function Ye({
|
|
|
397
397
|
});
|
|
398
398
|
const U = 8, l = 32, z = 52;
|
|
399
399
|
let q = 0, R = 0, N = !1;
|
|
400
|
-
const ce = o.length,
|
|
400
|
+
const ce = o.length, ye = r.length > 0, ze = ce > 0 && ye ? ce : -1;
|
|
401
401
|
for (let V = 0; V < f.length; V++) {
|
|
402
402
|
const ne = f[V], de = D.get(ne.id);
|
|
403
403
|
if (de === void 0) continue;
|
|
@@ -417,9 +417,9 @@ function Ye({
|
|
|
417
417
|
};
|
|
418
418
|
}, [f, o.length, r.length]);
|
|
419
419
|
const { visibleBookmarks: a, overflowBookmarks: I } = t.useMemo(() => {
|
|
420
|
-
if (
|
|
420
|
+
if (B === null)
|
|
421
421
|
return { visibleBookmarks: f, overflowBookmarks: [] };
|
|
422
|
-
const n = f.slice(0,
|
|
422
|
+
const n = f.slice(0, B), m = f.slice(B), i = v ? m.find((p) => p.id === v) : null;
|
|
423
423
|
if (i && n.length > 0) {
|
|
424
424
|
const p = n[n.length - 1], M = [
|
|
425
425
|
...n.slice(0, -1),
|
|
@@ -431,7 +431,7 @@ function Ye({
|
|
|
431
431
|
return { visibleBookmarks: M, overflowBookmarks: D };
|
|
432
432
|
}
|
|
433
433
|
return { visibleBookmarks: n, overflowBookmarks: m };
|
|
434
|
-
}, [f,
|
|
434
|
+
}, [f, B, v]), j = t.useCallback(
|
|
435
435
|
(n, m) => {
|
|
436
436
|
let i = n + m;
|
|
437
437
|
i < 0 ? i = a.length - 1 : i >= a.length && (i = 0);
|
|
@@ -501,8 +501,7 @@ function Ye({
|
|
|
501
501
|
M && /* @__PURE__ */ e(
|
|
502
502
|
ge,
|
|
503
503
|
{
|
|
504
|
-
type: "line",
|
|
505
|
-
layout: "horizontal",
|
|
504
|
+
type: "vertical-line",
|
|
506
505
|
className: "h-20 flex-shrink-0",
|
|
507
506
|
"aria-hidden": "true"
|
|
508
507
|
}
|
|
@@ -618,7 +617,7 @@ function Se() {
|
|
|
618
617
|
const { isDirty: r, isSystemBookmark: o, handleRevert: u } = J();
|
|
619
618
|
return !r || !o ? null : /* @__PURE__ */ e(T, { variant: "ghost", onClick: u, className: "h-[var(--size-m)]", children: "Reset" });
|
|
620
619
|
}
|
|
621
|
-
function
|
|
620
|
+
function Be() {
|
|
622
621
|
const { isDirty: r, isSystemBookmark: o, handleUpdate: u, openCreateDialog: c } = J();
|
|
623
622
|
return !r || o ? null : /* @__PURE__ */ e(
|
|
624
623
|
Xe,
|
|
@@ -631,13 +630,13 @@ function ye() {
|
|
|
631
630
|
function en() {
|
|
632
631
|
const { isDirty: r, isSystemBookmark: o } = J();
|
|
633
632
|
return r ? /* @__PURE__ */ s(O, { children: [
|
|
634
|
-
/* @__PURE__ */ e(ge, { type: "dot"
|
|
633
|
+
/* @__PURE__ */ e(ge, { type: "dot" }),
|
|
635
634
|
o ? /* @__PURE__ */ s(O, { children: [
|
|
636
635
|
/* @__PURE__ */ e(Se, {}),
|
|
637
636
|
/* @__PURE__ */ e(Ne, {})
|
|
638
637
|
] }) : /* @__PURE__ */ s(O, { children: [
|
|
639
638
|
/* @__PURE__ */ e(De, {}),
|
|
640
|
-
/* @__PURE__ */ e(
|
|
639
|
+
/* @__PURE__ */ e(Be, {})
|
|
641
640
|
] })
|
|
642
641
|
] }) : null;
|
|
643
642
|
}
|
|
@@ -653,22 +652,22 @@ function E({
|
|
|
653
652
|
onRevert: b,
|
|
654
653
|
onSave: h,
|
|
655
654
|
onRename: d,
|
|
656
|
-
onDelete:
|
|
655
|
+
onDelete: y,
|
|
657
656
|
onSetDefault: v,
|
|
658
657
|
onBookmarkHover: W,
|
|
659
658
|
onOverflowMenuChange: A,
|
|
660
|
-
onDialogChange:
|
|
659
|
+
onDialogChange: B
|
|
661
660
|
}) {
|
|
662
661
|
const [F, P] = t.useState(!1), [k, f] = t.useState(!1), [a, I] = t.useState(), j = t.useCallback(
|
|
663
662
|
(l) => {
|
|
664
|
-
f(l),
|
|
663
|
+
f(l), B?.(l ? "create" : null);
|
|
665
664
|
},
|
|
666
|
-
[
|
|
665
|
+
[B]
|
|
667
666
|
), $ = t.useCallback(
|
|
668
667
|
(l) => {
|
|
669
|
-
P(l),
|
|
668
|
+
P(l), B?.(l ? "rename" : null);
|
|
670
669
|
},
|
|
671
|
-
[
|
|
670
|
+
[B]
|
|
672
671
|
), H = t.useMemo(
|
|
673
672
|
() => [...u, ...o],
|
|
674
673
|
[u, o]
|
|
@@ -683,8 +682,8 @@ function E({
|
|
|
683
682
|
await h("create", l);
|
|
684
683
|
}, [h]), G = t.useCallback(async (l) => {
|
|
685
684
|
const z = l || c;
|
|
686
|
-
z && await
|
|
687
|
-
}, [c,
|
|
685
|
+
z && await y(z);
|
|
686
|
+
}, [c, y]), _ = t.useCallback(async (l) => {
|
|
688
687
|
const z = l || c;
|
|
689
688
|
z && await v(z);
|
|
690
689
|
}, [c, v]), n = t.useMemo(
|
|
@@ -818,7 +817,7 @@ E.RevertButton = De;
|
|
|
818
817
|
E.CreateButton = Ne;
|
|
819
818
|
E.SaveButton = Ze;
|
|
820
819
|
E.ResetButton = Se;
|
|
821
|
-
E.SaveDropdown =
|
|
820
|
+
E.SaveDropdown = Be;
|
|
822
821
|
export {
|
|
823
822
|
E as Bookmarks,
|
|
824
823
|
Ce as BookmarksActions,
|
|
@@ -828,7 +827,7 @@ export {
|
|
|
828
827
|
Se as BookmarksResetButton,
|
|
829
828
|
De as BookmarksRevertButton,
|
|
830
829
|
Ze as BookmarksSaveButton,
|
|
831
|
-
|
|
830
|
+
Be as BookmarksSaveDropdown,
|
|
832
831
|
ke as BookmarksSettings,
|
|
833
832
|
J as useBookmarksActions
|
|
834
833
|
};
|