@rafal.lemieszewski/tide-ui 0.87.7 → 0.87.9
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/alert-dialog.cjs +1 -1
- package/dist/cjs/components/fundamental/alert.cjs +1 -1
- package/dist/cjs/components/fundamental/avatar.cjs +1 -1
- package/dist/cjs/components/fundamental/badge.cjs +1 -1
- package/dist/cjs/components/fundamental/breadcrumb.cjs +1 -1
- package/dist/cjs/components/fundamental/button-group.cjs +1 -1
- package/dist/cjs/components/fundamental/button.cjs +1 -1
- package/dist/cjs/components/fundamental/calendar.cjs +1 -1
- package/dist/cjs/components/fundamental/card.cjs +1 -1
- package/dist/cjs/components/fundamental/chart.cjs +1 -1
- package/dist/cjs/components/fundamental/checkbox.cjs +1 -1
- package/dist/cjs/components/fundamental/command.cjs +1 -1
- package/dist/cjs/components/fundamental/dialog.cjs +1 -1
- package/dist/cjs/components/fundamental/drawer.cjs +1 -1
- package/dist/cjs/components/fundamental/dropdown-menu.cjs +1 -1
- package/dist/cjs/components/fundamental/file-upload.cjs +1 -1
- package/dist/cjs/components/fundamental/hover-card.cjs +1 -1
- package/dist/cjs/components/fundamental/input-group.cjs +1 -1
- package/dist/cjs/components/fundamental/input.cjs +1 -1
- package/dist/cjs/components/fundamental/kbd.cjs +1 -1
- package/dist/cjs/components/fundamental/month-picker.cjs +1 -1
- package/dist/cjs/components/fundamental/popover.cjs +1 -1
- package/dist/cjs/components/fundamental/resizable.cjs +1 -1
- package/dist/cjs/components/fundamental/select.cjs +1 -1
- package/dist/cjs/components/fundamental/sheet.cjs +1 -1
- package/dist/cjs/components/fundamental/sidebar.cjs +1 -1
- package/dist/cjs/components/fundamental/skeleton.cjs +1 -1
- package/dist/cjs/components/fundamental/slider.cjs +1 -1
- package/dist/cjs/components/fundamental/spinner.cjs +1 -1
- package/dist/cjs/components/fundamental/switch.cjs +1 -1
- package/dist/cjs/components/fundamental/tabs.cjs +1 -1
- package/dist/cjs/components/fundamental/tag.cjs +3 -3
- package/dist/cjs/components/fundamental/textarea.cjs +1 -1
- package/dist/cjs/components/fundamental/toast.cjs +1 -1
- package/dist/cjs/components/fundamental/toggle.cjs +1 -1
- package/dist/cjs/components/fundamental/tooltip.cjs +1 -1
- package/dist/cjs/components/fundamental/tree.cjs +1 -1
- package/dist/cjs/components/product/activity-log.cjs +1 -1
- package/dist/cjs/components/product/app-frame.cjs +1 -1
- package/dist/cjs/components/product/attributes-list.cjs +1 -1
- package/dist/cjs/components/product/bookmarks.cjs +1 -1
- package/dist/cjs/components/product/data-table-settings-menu.cjs +1 -1
- package/dist/cjs/components/product/data-table.cjs +1 -1
- package/dist/cjs/components/product/filters.cjs +1 -1
- package/dist/cjs/components/product/linked-chart.cjs +1 -1
- package/dist/es/components/fundamental/alert-dialog.js +10 -10
- package/dist/es/components/fundamental/alert.js +1 -1
- package/dist/es/components/fundamental/avatar.js +23 -23
- package/dist/es/components/fundamental/badge.js +1 -1
- package/dist/es/components/fundamental/breadcrumb.js +23 -23
- package/dist/es/components/fundamental/button-group.js +14 -14
- package/dist/es/components/fundamental/button.js +28 -28
- package/dist/es/components/fundamental/calendar.js +20 -20
- package/dist/es/components/fundamental/card.js +26 -26
- package/dist/es/components/fundamental/chart.js +1 -1
- package/dist/es/components/fundamental/checkbox.js +3 -3
- package/dist/es/components/fundamental/command.js +36 -36
- package/dist/es/components/fundamental/dialog.js +7 -7
- package/dist/es/components/fundamental/drawer.js +1 -1
- package/dist/es/components/fundamental/dropdown-menu.js +111 -111
- package/dist/es/components/fundamental/file-upload.js +2 -2
- package/dist/es/components/fundamental/hover-card.js +6 -6
- package/dist/es/components/fundamental/input-group.js +2 -2
- package/dist/es/components/fundamental/input.js +1 -1
- package/dist/es/components/fundamental/kbd.js +5 -5
- package/dist/es/components/fundamental/month-picker.js +21 -21
- package/dist/es/components/fundamental/popover.js +7 -7
- package/dist/es/components/fundamental/resizable.js +1 -1
- package/dist/es/components/fundamental/select.js +21 -21
- package/dist/es/components/fundamental/sheet.js +40 -40
- package/dist/es/components/fundamental/sidebar.js +45 -45
- package/dist/es/components/fundamental/skeleton.js +19 -19
- package/dist/es/components/fundamental/slider.js +1 -1
- package/dist/es/components/fundamental/spinner.js +11 -11
- package/dist/es/components/fundamental/switch.js +7 -7
- package/dist/es/components/fundamental/tabs.js +30 -30
- package/dist/es/components/fundamental/tag.js +28 -28
- package/dist/es/components/fundamental/textarea.js +9 -9
- package/dist/es/components/fundamental/toast.js +11 -11
- package/dist/es/components/fundamental/toggle.js +7 -7
- package/dist/es/components/fundamental/tooltip.js +4 -4
- package/dist/es/components/fundamental/tree.js +17 -17
- package/dist/es/components/product/activity-log.js +41 -41
- package/dist/es/components/product/app-frame.js +3 -3
- package/dist/es/components/product/attributes-list.js +68 -68
- package/dist/es/components/product/bookmarks.js +148 -148
- package/dist/es/components/product/data-table-settings-menu.js +45 -45
- package/dist/es/components/product/data-table.js +822 -816
- package/dist/es/components/product/filters.js +5 -5
- package/dist/es/components/product/linked-chart.js +24 -24
- package/dist/es/style.css +1 -1
- package/dist/types/components/product/data-table.d.cts +3 -1
- package/dist/types/components/product/data-table.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { jsxs as s, jsx as e, Fragment as O } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
2
|
+
import * as t from "react";
|
|
3
3
|
import { cn as X } from "../../lib/utils.js";
|
|
4
4
|
import { Button as T } from "../fundamental/button.js";
|
|
5
5
|
import { ButtonGroup as Re } from "../fundamental/button-group.js";
|
|
6
6
|
import { Icon as w } from "../fundamental/icon.js";
|
|
7
|
-
import { Bookmark as
|
|
7
|
+
import { Bookmark as te, MoreHorizontal as me, Pencil as he, Trash2 as pe, ChevronDown as fe, Star as ve, Check as Me } from "lucide-react";
|
|
8
8
|
import { Separator as ge } from "../fundamental/separator.js";
|
|
9
9
|
import { Select as Oe, SelectTrigger as Te, SelectContent as Ee, SelectItem as ue, SelectSeparator as Ae, SelectGroup as Pe, SelectLabel as Ue } from "../fundamental/select.js";
|
|
10
|
-
import { DropdownMenu as oe, DropdownMenuTrigger as
|
|
10
|
+
import { DropdownMenu as oe, DropdownMenuTrigger as ie, DropdownMenuContent as le, DropdownMenuItem as L, DropdownMenuSeparator as Ve } from "../fundamental/dropdown-menu.js";
|
|
11
11
|
import { Popover as We, PopoverTrigger as Ie, PopoverContent as Le } from "../fundamental/popover.js";
|
|
12
12
|
import { Dialog as Fe, DialogContent as je, DialogHeader as $e, DialogTitle as He, DialogBody as Ke, DialogFooter as Ge } from "../fundamental/dialog.js";
|
|
13
13
|
import { Input as _e } from "../fundamental/input.js";
|
|
14
14
|
import { Label as qe } from "../fundamental/label.js";
|
|
15
15
|
import { Badge as Je } from "../fundamental/badge.js";
|
|
16
16
|
import { Skeleton as be } from "../fundamental/skeleton.js";
|
|
17
|
-
const se =
|
|
17
|
+
const se = t.createContext(null);
|
|
18
18
|
function J() {
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
19
|
+
const r = t.useContext(se);
|
|
20
|
+
if (!r)
|
|
21
21
|
throw new Error("useBookmarksActions must be used within Bookmarks");
|
|
22
|
-
return
|
|
22
|
+
return r;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
open:
|
|
24
|
+
function re({
|
|
25
|
+
open: r,
|
|
26
26
|
onOpenChange: o,
|
|
27
27
|
mode: u,
|
|
28
28
|
initialName: c = "",
|
|
29
29
|
onSave: x
|
|
30
30
|
}) {
|
|
31
|
-
const [g, S] =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}, [
|
|
31
|
+
const [g, S] = t.useState(c);
|
|
32
|
+
t.useEffect(() => {
|
|
33
|
+
r && S(c);
|
|
34
|
+
}, [r, c]);
|
|
35
35
|
const C = () => {
|
|
36
36
|
g.trim() && (x(g.trim()), o(!1));
|
|
37
37
|
};
|
|
38
|
-
return /* @__PURE__ */ e(Fe, { open:
|
|
38
|
+
return /* @__PURE__ */ e(Fe, { open: r, onOpenChange: o, children: /* @__PURE__ */ s(je, { children: [
|
|
39
39
|
/* @__PURE__ */ e($e, { children: /* @__PURE__ */ e(He, { children: u === "create" ? "Create bookmark" : "Rename bookmark" }) }),
|
|
40
40
|
/* @__PURE__ */ e(Ke, { children: /* @__PURE__ */ s("div", { className: "flex flex-col gap-[var(--space-s)]", children: [
|
|
41
41
|
/* @__PURE__ */ e(qe, { htmlFor: "bookmark-name", children: "Bookmark name" }),
|
|
@@ -68,7 +68,7 @@ function te({
|
|
|
68
68
|
] }) });
|
|
69
69
|
}
|
|
70
70
|
function Qe({
|
|
71
|
-
bookmarks:
|
|
71
|
+
bookmarks: r,
|
|
72
72
|
systemBookmarks: o,
|
|
73
73
|
activeBookmarkId: u,
|
|
74
74
|
onSelect: c,
|
|
@@ -76,10 +76,10 @@ function Qe({
|
|
|
76
76
|
onDelete: g,
|
|
77
77
|
onSetDefault: S
|
|
78
78
|
}) {
|
|
79
|
-
const C =
|
|
80
|
-
() => [...o, ...
|
|
81
|
-
[o,
|
|
82
|
-
), b =
|
|
79
|
+
const C = t.useMemo(
|
|
80
|
+
() => [...o, ...r],
|
|
81
|
+
[o, r]
|
|
82
|
+
), b = t.useMemo(
|
|
83
83
|
() => C.find((d) => d.id === u),
|
|
84
84
|
[C, u]
|
|
85
85
|
), h = b?.type === "system";
|
|
@@ -97,25 +97,25 @@ function Qe({
|
|
|
97
97
|
Te,
|
|
98
98
|
{
|
|
99
99
|
className: X(
|
|
100
|
-
"!text-label-md relative z-0 h-[var(--size-m)] w-auto gap-[var(--space-xs)] border border-[var(--color-border-action-outline)] bg-[var(--color-background-neutral-subtlest)] pr-[var(--space-m)] pl-[var(--space-s)] text-[var(--color-text-primary)] hover:border-[var(--color-border-action-outline-hovered)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:shadow-
|
|
101
|
-
h ? "rounded-m" : "rounded-l-m !rounded-r-none !border-r-0"
|
|
100
|
+
"!text-label-md relative z-0 h-[var(--size-m)] w-auto gap-[var(--space-xs)] border border-[var(--color-border-action-outline)] bg-[var(--color-background-neutral-subtlest)] pr-[var(--space-m)] pl-[var(--space-s)] text-[var(--color-text-primary)] hover:border-[var(--color-border-action-outline-hovered)] hover:bg-[var(--color-background-neutral-subtlest-hovered)] hover:shadow-[var(--shadow-200)] focus:border-[var(--color-border-action-outline)] focus:ring-0 focus:outline-none focus-visible:z-10 focus-visible:ring-2 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-2 active:translate-y-px active:bg-[var(--grey-alpha-50)] active:shadow-[var(--shadow-100)] data-[state=open]:ring-0",
|
|
101
|
+
h ? "rounded-[var(--border-radius-m)]" : "rounded-l-[var(--border-radius-m)] !rounded-r-none !border-r-0"
|
|
102
102
|
),
|
|
103
103
|
children: [
|
|
104
|
-
/* @__PURE__ */ e(w, { name:
|
|
104
|
+
/* @__PURE__ */ e(w, { name: te, size: "m", color: "primary" }),
|
|
105
105
|
b?.name || "Bookmarks"
|
|
106
106
|
]
|
|
107
107
|
}
|
|
108
108
|
),
|
|
109
109
|
/* @__PURE__ */ s(Ee, { align: "start", position: "popper", className: "min-w-[200px]", children: [
|
|
110
110
|
o.length > 0 && /* @__PURE__ */ e(O, { children: o.map((d) => /* @__PURE__ */ e(ue, { value: d.id, children: /* @__PURE__ */ e("div", { className: "flex items-center gap-[var(--space-s)] pr-6", children: /* @__PURE__ */ e("span", { children: d.name }) }) }, d.id)) }),
|
|
111
|
-
o.length > 0 &&
|
|
112
|
-
|
|
111
|
+
o.length > 0 && r.length > 0 && /* @__PURE__ */ e(Ae, {}),
|
|
112
|
+
r.length > 0 && /* @__PURE__ */ s(Pe, { children: [
|
|
113
113
|
/* @__PURE__ */ e(Ue, { children: "Custom Bookmarks" }),
|
|
114
|
-
|
|
114
|
+
r.map((d) => /* @__PURE__ */ e(ue, { value: d.id, children: /* @__PURE__ */ s("div", { className: "flex items-center gap-[var(--space-s)] pr-6", children: [
|
|
115
115
|
/* @__PURE__ */ e(
|
|
116
116
|
w,
|
|
117
117
|
{
|
|
118
|
-
name:
|
|
118
|
+
name: te,
|
|
119
119
|
className: "h-[var(--size-2xs)] w-[var(--size-2xs)]"
|
|
120
120
|
}
|
|
121
121
|
),
|
|
@@ -134,7 +134,7 @@ function Qe({
|
|
|
134
134
|
}
|
|
135
135
|
),
|
|
136
136
|
!h && /* @__PURE__ */ s(oe, { children: [
|
|
137
|
-
/* @__PURE__ */ e(
|
|
137
|
+
/* @__PURE__ */ e(ie, { asChild: !0, children: /* @__PURE__ */ e(
|
|
138
138
|
T,
|
|
139
139
|
{
|
|
140
140
|
icon: me,
|
|
@@ -142,7 +142,7 @@ function Qe({
|
|
|
142
142
|
className: "!rounded-l-none rounded-r-md !border-l !border-l-[var(--color-border-action-outline)] focus:ring-0 data-[state=open]:ring-0"
|
|
143
143
|
}
|
|
144
144
|
) }),
|
|
145
|
-
/* @__PURE__ */ s(
|
|
145
|
+
/* @__PURE__ */ s(le, { align: "end", children: [
|
|
146
146
|
/* @__PURE__ */ s(
|
|
147
147
|
L,
|
|
148
148
|
{
|
|
@@ -198,9 +198,9 @@ function Qe({
|
|
|
198
198
|
] })
|
|
199
199
|
] });
|
|
200
200
|
}
|
|
201
|
-
function Xe({ onUpdate:
|
|
201
|
+
function Xe({ onUpdate: r, onCreate: o }) {
|
|
202
202
|
return /* @__PURE__ */ s(oe, { children: [
|
|
203
|
-
/* @__PURE__ */ e(
|
|
203
|
+
/* @__PURE__ */ e(ie, { asChild: !0, children: /* @__PURE__ */ s(
|
|
204
204
|
T,
|
|
205
205
|
{
|
|
206
206
|
variant: "ghost",
|
|
@@ -217,16 +217,16 @@ function Xe({ onUpdate: t, onCreate: o }) {
|
|
|
217
217
|
]
|
|
218
218
|
}
|
|
219
219
|
) }),
|
|
220
|
-
/* @__PURE__ */ s(
|
|
221
|
-
/* @__PURE__ */ e(L, { onClick:
|
|
220
|
+
/* @__PURE__ */ s(le, { align: "end", children: [
|
|
221
|
+
/* @__PURE__ */ e(L, { onClick: r, children: "Update bookmark" }),
|
|
222
222
|
/* @__PURE__ */ e(L, { onClick: o, children: "Create new bookmark" })
|
|
223
223
|
] })
|
|
224
224
|
] });
|
|
225
225
|
}
|
|
226
|
-
const xe = /* @__PURE__ */
|
|
227
|
-
/* @__PURE__ */
|
|
226
|
+
const xe = /* @__PURE__ */ t.memo(
|
|
227
|
+
/* @__PURE__ */ t.forwardRef(
|
|
228
228
|
({
|
|
229
|
-
bookmark:
|
|
229
|
+
bookmark: r,
|
|
230
230
|
isActive: o,
|
|
231
231
|
isVisible: u = !0,
|
|
232
232
|
index: c,
|
|
@@ -240,20 +240,20 @@ const xe = /* @__PURE__ */ r.memo(
|
|
|
240
240
|
onNavigateLast: B,
|
|
241
241
|
onHover: v
|
|
242
242
|
}, W) => {
|
|
243
|
-
const A =
|
|
244
|
-
g(
|
|
245
|
-
}, [g,
|
|
246
|
-
v?.(
|
|
247
|
-
}, [v,
|
|
248
|
-
S(
|
|
249
|
-
}, [S,
|
|
250
|
-
C(
|
|
251
|
-
}, [C,
|
|
243
|
+
const A = r.type === "user", y = t.useCallback(() => {
|
|
244
|
+
g(r);
|
|
245
|
+
}, [g, r]), F = t.useCallback(() => {
|
|
246
|
+
v?.(r);
|
|
247
|
+
}, [v, r]), P = t.useCallback(() => {
|
|
248
|
+
S(r.id);
|
|
249
|
+
}, [S, r.id]), k = t.useCallback(() => {
|
|
250
|
+
C(r.id);
|
|
251
|
+
}, [C, r.id]), f = t.useCallback(
|
|
252
252
|
(a) => {
|
|
253
253
|
switch (a.key) {
|
|
254
254
|
case "Enter":
|
|
255
255
|
case " ":
|
|
256
|
-
a.preventDefault(), g(
|
|
256
|
+
a.preventDefault(), g(r);
|
|
257
257
|
break;
|
|
258
258
|
case "ArrowRight":
|
|
259
259
|
a.preventDefault(), h(c, 1);
|
|
@@ -269,7 +269,7 @@ const xe = /* @__PURE__ */ r.memo(
|
|
|
269
269
|
break;
|
|
270
270
|
}
|
|
271
271
|
},
|
|
272
|
-
[
|
|
272
|
+
[r, c, g, h, d, B]
|
|
273
273
|
);
|
|
274
274
|
return /* @__PURE__ */ s(
|
|
275
275
|
"div",
|
|
@@ -284,7 +284,7 @@ const xe = /* @__PURE__ */ r.memo(
|
|
|
284
284
|
onKeyDown: f,
|
|
285
285
|
onMouseEnter: F,
|
|
286
286
|
className: X(
|
|
287
|
-
"group relative flex min-w-[160px] flex-shrink-0 cursor-pointer flex-col gap-[var(--space-xs)] rounded-l p-[var(--space-l)] transition-colors",
|
|
287
|
+
"group relative flex min-w-[160px] flex-shrink-0 cursor-pointer flex-col gap-[var(--space-xs)] rounded-[var(--border-radius-l)] p-[var(--space-l)] transition-colors",
|
|
288
288
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-border-brand-bold)] focus-visible:ring-offset-2",
|
|
289
289
|
o ? "bg-[var(--blue-50)] hover:bg-[var(--blue-50)]" : "bg-[var(--color-background-neutral-default)] hover:bg-[var(--color-background-neutral-hovered)]",
|
|
290
290
|
!u && "pointer-events-none invisible absolute"
|
|
@@ -295,21 +295,21 @@ const xe = /* @__PURE__ */ r.memo(
|
|
|
295
295
|
A && /* @__PURE__ */ e(
|
|
296
296
|
w,
|
|
297
297
|
{
|
|
298
|
-
name:
|
|
298
|
+
name: te,
|
|
299
299
|
size: "s",
|
|
300
300
|
color: "secondary",
|
|
301
301
|
className: "flex-shrink-0"
|
|
302
302
|
}
|
|
303
303
|
),
|
|
304
|
-
/* @__PURE__ */ e("div", { className: "text-body-md whitespace-nowrap text-[var(--color-text-primary)]", children:
|
|
304
|
+
/* @__PURE__ */ e("div", { className: "text-body-md whitespace-nowrap text-[var(--color-text-primary)]", children: r.name })
|
|
305
305
|
] }),
|
|
306
306
|
A && /* @__PURE__ */ s(oe, { children: [
|
|
307
|
-
/* @__PURE__ */ e(
|
|
307
|
+
/* @__PURE__ */ e(ie, { asChild: !0, children: /* @__PURE__ */ e(
|
|
308
308
|
T,
|
|
309
309
|
{
|
|
310
310
|
variant: "ghost",
|
|
311
311
|
size: "s",
|
|
312
|
-
"aria-label": `Options for ${
|
|
312
|
+
"aria-label": `Options for ${r.name}`,
|
|
313
313
|
className: "p-[var(--space-xs)] opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
|
|
314
314
|
tabIndex: -1,
|
|
315
315
|
onClick: (a) => a.stopPropagation(),
|
|
@@ -322,7 +322,7 @@ const xe = /* @__PURE__ */ r.memo(
|
|
|
322
322
|
)
|
|
323
323
|
}
|
|
324
324
|
) }),
|
|
325
|
-
/* @__PURE__ */ s(
|
|
325
|
+
/* @__PURE__ */ s(le, { align: "end", children: [
|
|
326
326
|
/* @__PURE__ */ s(
|
|
327
327
|
L,
|
|
328
328
|
{
|
|
@@ -351,7 +351,7 @@ const xe = /* @__PURE__ */ r.memo(
|
|
|
351
351
|
] })
|
|
352
352
|
] })
|
|
353
353
|
] }),
|
|
354
|
-
/* @__PURE__ */ e("div", { className: "text-heading-lg text-[var(--color-text-primary)]", children:
|
|
354
|
+
/* @__PURE__ */ e("div", { className: "text-heading-lg text-[var(--color-text-primary)]", children: r.isLoadingCount ? /* @__PURE__ */ e(be, { height: 32, width: 40 }) : r.count ?? " " })
|
|
355
355
|
]
|
|
356
356
|
}
|
|
357
357
|
);
|
|
@@ -360,7 +360,7 @@ const xe = /* @__PURE__ */ r.memo(
|
|
|
360
360
|
);
|
|
361
361
|
xe.displayName = "BookmarkTab";
|
|
362
362
|
function Ye({
|
|
363
|
-
bookmarks:
|
|
363
|
+
bookmarks: r,
|
|
364
364
|
systemBookmarks: o,
|
|
365
365
|
activeBookmarkId: u,
|
|
366
366
|
"aria-label": c = "Bookmarks",
|
|
@@ -371,18 +371,18 @@ function Ye({
|
|
|
371
371
|
onBookmarkHover: b,
|
|
372
372
|
onOverflowMenuChange: h
|
|
373
373
|
}) {
|
|
374
|
-
const [d, B] =
|
|
374
|
+
const [d, B] = t.useState(!1), [v, W] = t.useState(null), A = t.useCallback(
|
|
375
375
|
(n) => {
|
|
376
376
|
B(n), h?.(n);
|
|
377
377
|
},
|
|
378
378
|
[h]
|
|
379
|
-
), [y, F] =
|
|
380
|
-
() => [...o, ...
|
|
381
|
-
[o,
|
|
379
|
+
), [y, F] = t.useState(null), P = t.useRef(null), k = t.useRef(/* @__PURE__ */ new Map()), f = t.useMemo(
|
|
380
|
+
() => [...o, ...r],
|
|
381
|
+
[o, r]
|
|
382
382
|
);
|
|
383
|
-
|
|
383
|
+
t.useEffect(() => {
|
|
384
384
|
v && !f.some((n) => n.id === v) && W(null);
|
|
385
|
-
}, [f, v]),
|
|
385
|
+
}, [f, v]), t.useEffect(() => {
|
|
386
386
|
if (!P.current || f.length === 0) return;
|
|
387
387
|
let n = null;
|
|
388
388
|
const m = () => {
|
|
@@ -395,13 +395,13 @@ function Ye({
|
|
|
395
395
|
const ne = k.current.get(V.id);
|
|
396
396
|
ne && D.set(V.id, ne.offsetWidth);
|
|
397
397
|
});
|
|
398
|
-
const U = 8,
|
|
398
|
+
const U = 8, l = 32, z = 52;
|
|
399
399
|
let q = 0, R = 0, N = !1;
|
|
400
|
-
const ce = o.length, Be =
|
|
400
|
+
const ce = o.length, Be = r.length > 0, ze = ce > 0 && Be ? 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;
|
|
404
|
-
V === ze && (N = !0, q +=
|
|
404
|
+
V === ze && (N = !0, q += l + U);
|
|
405
405
|
const ae = q + de + (R > 0 || N ? U : 0);
|
|
406
406
|
if ((V < f.length - 1 ? ae + U + z : ae) > M)
|
|
407
407
|
break;
|
|
@@ -411,19 +411,19 @@ function Ye({
|
|
|
411
411
|
}, 100);
|
|
412
412
|
};
|
|
413
413
|
m();
|
|
414
|
-
const
|
|
415
|
-
return
|
|
416
|
-
n && clearTimeout(n),
|
|
414
|
+
const i = new ResizeObserver(m);
|
|
415
|
+
return i.observe(P.current), () => {
|
|
416
|
+
n && clearTimeout(n), i.disconnect();
|
|
417
417
|
};
|
|
418
|
-
}, [f, o.length,
|
|
419
|
-
const { visibleBookmarks: a, overflowBookmarks: I } =
|
|
418
|
+
}, [f, o.length, r.length]);
|
|
419
|
+
const { visibleBookmarks: a, overflowBookmarks: I } = t.useMemo(() => {
|
|
420
420
|
if (y === null)
|
|
421
421
|
return { visibleBookmarks: f, overflowBookmarks: [] };
|
|
422
|
-
const n = f.slice(0, y), m = f.slice(y),
|
|
423
|
-
if (
|
|
422
|
+
const n = f.slice(0, y), m = f.slice(y), i = v ? m.find((p) => p.id === v) : null;
|
|
423
|
+
if (i && n.length > 0) {
|
|
424
424
|
const p = n[n.length - 1], M = [
|
|
425
425
|
...n.slice(0, -1),
|
|
426
|
-
|
|
426
|
+
i
|
|
427
427
|
], D = [
|
|
428
428
|
p,
|
|
429
429
|
...m.filter((U) => U.id !== v)
|
|
@@ -431,41 +431,41 @@ function Ye({
|
|
|
431
431
|
return { visibleBookmarks: M, overflowBookmarks: D };
|
|
432
432
|
}
|
|
433
433
|
return { visibleBookmarks: n, overflowBookmarks: m };
|
|
434
|
-
}, [f, y, v]), j =
|
|
434
|
+
}, [f, y, v]), j = t.useCallback(
|
|
435
435
|
(n, m) => {
|
|
436
|
-
let
|
|
437
|
-
|
|
438
|
-
const p = a[
|
|
436
|
+
let i = n + m;
|
|
437
|
+
i < 0 ? i = a.length - 1 : i >= a.length && (i = 0);
|
|
438
|
+
const p = a[i];
|
|
439
439
|
p && k.current.get(p.id)?.focus();
|
|
440
440
|
},
|
|
441
441
|
[a]
|
|
442
|
-
), $ =
|
|
442
|
+
), $ = t.useCallback(
|
|
443
443
|
(n) => {
|
|
444
444
|
x(n);
|
|
445
445
|
},
|
|
446
446
|
[x]
|
|
447
|
-
), H =
|
|
447
|
+
), H = t.useCallback(() => {
|
|
448
448
|
const n = a[0];
|
|
449
449
|
n && k.current.get(n.id)?.focus();
|
|
450
|
-
}, [a]), Q =
|
|
450
|
+
}, [a]), Q = t.useCallback(() => {
|
|
451
451
|
const n = a[a.length - 1];
|
|
452
452
|
n && k.current.get(n.id)?.focus();
|
|
453
|
-
}, [a]), Y = a.length, K =
|
|
453
|
+
}, [a]), Y = a.length, K = t.useMemo(() => {
|
|
454
454
|
for (let n = 0; n < a.length - 1; n++)
|
|
455
455
|
if (a[n].type === "system" && a[n + 1].type === "user")
|
|
456
456
|
return n;
|
|
457
457
|
return -1;
|
|
458
|
-
}, [a]), Z =
|
|
458
|
+
}, [a]), Z = t.useCallback(
|
|
459
459
|
(n) => {
|
|
460
|
-
a.some((
|
|
460
|
+
a.some((i) => i.id === n.id) && n.id !== v && W(null), x(n);
|
|
461
461
|
},
|
|
462
462
|
[a, v, x]
|
|
463
|
-
), ee =
|
|
463
|
+
), ee = t.useCallback(
|
|
464
464
|
(n) => {
|
|
465
465
|
W(n.id), x(n), A(!1);
|
|
466
466
|
},
|
|
467
467
|
[x, A]
|
|
468
|
-
), G =
|
|
468
|
+
), G = t.useMemo(() => [...a, ...I], [a, I]), _ = t.useMemo(() => new Set(a.map((n) => n.id)), [a]);
|
|
469
469
|
return /* @__PURE__ */ s(
|
|
470
470
|
"div",
|
|
471
471
|
{
|
|
@@ -475,8 +475,8 @@ function Ye({
|
|
|
475
475
|
className: "flex items-center gap-[var(--space-s)]",
|
|
476
476
|
children: [
|
|
477
477
|
G.map((n, m) => {
|
|
478
|
-
const
|
|
479
|
-
return /* @__PURE__ */ s(
|
|
478
|
+
const i = _.has(n.id), p = i ? a.findIndex((D) => D.id === n.id) : -1, M = i && p === K;
|
|
479
|
+
return /* @__PURE__ */ s(t.Fragment, { children: [
|
|
480
480
|
/* @__PURE__ */ e(
|
|
481
481
|
xe,
|
|
482
482
|
{
|
|
@@ -485,10 +485,10 @@ function Ye({
|
|
|
485
485
|
},
|
|
486
486
|
bookmark: n,
|
|
487
487
|
isActive: u === n.id,
|
|
488
|
-
isVisible:
|
|
488
|
+
isVisible: i,
|
|
489
489
|
index: p >= 0 ? p : m,
|
|
490
490
|
totalTabs: Y,
|
|
491
|
-
onSelect:
|
|
491
|
+
onSelect: i ? Z : $,
|
|
492
492
|
onRename: g,
|
|
493
493
|
onDelete: S,
|
|
494
494
|
onSetDefault: C,
|
|
@@ -516,7 +516,7 @@ function Ye({
|
|
|
516
516
|
"aria-label": `Show ${I.length} more bookmarks`,
|
|
517
517
|
"aria-expanded": d,
|
|
518
518
|
className: X(
|
|
519
|
-
"flex cursor-pointer flex-shrink-0 items-center justify-center rounded-l border border-[var(--color-border-action-outline)] bg-transparent px-[var(--space-m)] transition-colors hover:bg-[var(--color-background-neutral-subtlest-hovered)]",
|
|
519
|
+
"flex cursor-pointer flex-shrink-0 items-center justify-center rounded-[var(--border-radius-l)] border border-[var(--color-border-action-outline)] bg-transparent px-[var(--space-m)] transition-colors hover:bg-[var(--color-background-neutral-subtlest-hovered)]",
|
|
520
520
|
"min-h-[88px]",
|
|
521
521
|
// Match the height of bookmark tabs (padding + content + padding)
|
|
522
522
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-border-brand-bold)] focus-visible:ring-offset-2"
|
|
@@ -539,7 +539,7 @@ function Ye({
|
|
|
539
539
|
role: "menu",
|
|
540
540
|
"aria-label": "More bookmarks",
|
|
541
541
|
children: /* @__PURE__ */ e("div", { className: "flex flex-col", children: I.map((n) => {
|
|
542
|
-
const m = u === n.id,
|
|
542
|
+
const m = u === n.id, i = n.type === "user";
|
|
543
543
|
return /* @__PURE__ */ s(
|
|
544
544
|
"button",
|
|
545
545
|
{
|
|
@@ -547,20 +547,20 @@ function Ye({
|
|
|
547
547
|
"aria-label": `Select ${n.name} bookmark${m ? " (currently selected)" : ""}`,
|
|
548
548
|
onClick: () => ee(n),
|
|
549
549
|
className: X(
|
|
550
|
-
"text-body-md flex cursor-pointer items-center gap-[var(--space-s)] rounded-m px-[var(--space-m)] py-[var(--space-s)] text-left transition-colors",
|
|
550
|
+
"text-body-md flex cursor-pointer items-center gap-[var(--space-s)] rounded-[var(--border-radius-m)] px-[var(--space-m)] py-[var(--space-s)] text-left transition-colors",
|
|
551
551
|
"hover:bg-[var(--color-background-neutral-subtlest-hovered)]",
|
|
552
552
|
"focus:outline-none focus-visible:bg-[var(--color-background-neutral-subtlest-hovered)]"
|
|
553
553
|
),
|
|
554
554
|
children: [
|
|
555
|
-
|
|
555
|
+
i && /* @__PURE__ */ e(
|
|
556
556
|
w,
|
|
557
557
|
{
|
|
558
|
-
name:
|
|
558
|
+
name: te,
|
|
559
559
|
className: "h-[var(--size-2xs)] w-[var(--size-2xs)]",
|
|
560
560
|
"aria-hidden": "true"
|
|
561
561
|
}
|
|
562
562
|
),
|
|
563
|
-
!
|
|
563
|
+
!i && /* @__PURE__ */ e("div", { className: "w-[var(--size-2xs)]", "aria-hidden": "true" }),
|
|
564
564
|
/* @__PURE__ */ s("div", { className: "flex flex-1 items-center gap-[var(--space-xs)]", children: [
|
|
565
565
|
/* @__PURE__ */ e("span", { className: "truncate", children: n.name }),
|
|
566
566
|
(n.count !== void 0 || n.isLoadingCount) && /* @__PURE__ */ e(Je, { size: "s", intent: "neutral", appearance: "subtle", children: n.isLoadingCount ? /* @__PURE__ */ e(be, { height: 16, width: 24 }) : n.count })
|
|
@@ -593,34 +593,34 @@ function Ye({
|
|
|
593
593
|
}
|
|
594
594
|
);
|
|
595
595
|
}
|
|
596
|
-
function we({ children:
|
|
597
|
-
return /* @__PURE__ */ e(O, { children:
|
|
596
|
+
function we({ children: r }) {
|
|
597
|
+
return /* @__PURE__ */ e(O, { children: r });
|
|
598
598
|
}
|
|
599
|
-
function Ce({ children:
|
|
600
|
-
return /* @__PURE__ */ e(O, { children:
|
|
599
|
+
function Ce({ children: r }) {
|
|
600
|
+
return /* @__PURE__ */ e(O, { children: r });
|
|
601
601
|
}
|
|
602
|
-
function ke({ children:
|
|
603
|
-
return /* @__PURE__ */ e(O, { children:
|
|
602
|
+
function ke({ children: r }) {
|
|
603
|
+
return /* @__PURE__ */ e(O, { children: r });
|
|
604
604
|
}
|
|
605
605
|
function De() {
|
|
606
|
-
const { isDirty:
|
|
607
|
-
return
|
|
606
|
+
const { isDirty: r, handleRevert: o } = J();
|
|
607
|
+
return r ? /* @__PURE__ */ e(T, { variant: "ghost", onClick: o, className: "h-[var(--size-m)]", children: "Revert changes" }) : null;
|
|
608
608
|
}
|
|
609
609
|
function Ne() {
|
|
610
|
-
const { isDirty:
|
|
611
|
-
return !
|
|
610
|
+
const { isDirty: r, isSystemBookmark: o, openCreateDialog: u } = J();
|
|
611
|
+
return !r || !o ? null : /* @__PURE__ */ e(T, { variant: "ghost", onClick: u, className: "h-[var(--size-m)]", children: "Create bookmark" });
|
|
612
612
|
}
|
|
613
613
|
function Ze() {
|
|
614
|
-
const { isDirty:
|
|
615
|
-
return !
|
|
614
|
+
const { isDirty: r, isSystemBookmark: o, handleUpdate: u } = J();
|
|
615
|
+
return !r || o ? null : /* @__PURE__ */ e(T, { variant: "ghost", onClick: u, className: "h-[var(--size-m)]", children: "Update bookmark" });
|
|
616
616
|
}
|
|
617
617
|
function Se() {
|
|
618
|
-
const { isDirty:
|
|
619
|
-
return !
|
|
618
|
+
const { isDirty: r, isSystemBookmark: o, handleRevert: u } = J();
|
|
619
|
+
return !r || !o ? null : /* @__PURE__ */ e(T, { variant: "ghost", onClick: u, className: "h-[var(--size-m)]", children: "Reset" });
|
|
620
620
|
}
|
|
621
621
|
function ye() {
|
|
622
|
-
const { isDirty:
|
|
623
|
-
return !
|
|
622
|
+
const { isDirty: r, isSystemBookmark: o, handleUpdate: u, openCreateDialog: c } = J();
|
|
623
|
+
return !r || o ? null : /* @__PURE__ */ e(
|
|
624
624
|
Xe,
|
|
625
625
|
{
|
|
626
626
|
onUpdate: u,
|
|
@@ -629,8 +629,8 @@ function ye() {
|
|
|
629
629
|
);
|
|
630
630
|
}
|
|
631
631
|
function en() {
|
|
632
|
-
const { isDirty:
|
|
633
|
-
return
|
|
632
|
+
const { isDirty: r, isSystemBookmark: o } = J();
|
|
633
|
+
return r ? /* @__PURE__ */ s(O, { children: [
|
|
634
634
|
/* @__PURE__ */ e(ge, { type: "dot", layout: "horizontal" }),
|
|
635
635
|
o ? /* @__PURE__ */ s(O, { children: [
|
|
636
636
|
/* @__PURE__ */ e(Se, {}),
|
|
@@ -642,7 +642,7 @@ function en() {
|
|
|
642
642
|
] }) : null;
|
|
643
643
|
}
|
|
644
644
|
function E({
|
|
645
|
-
variant:
|
|
645
|
+
variant: r,
|
|
646
646
|
bookmarks: o,
|
|
647
647
|
systemBookmarks: u,
|
|
648
648
|
activeBookmarkId: c,
|
|
@@ -659,48 +659,48 @@ function E({
|
|
|
659
659
|
onOverflowMenuChange: A,
|
|
660
660
|
onDialogChange: y
|
|
661
661
|
}) {
|
|
662
|
-
const [F, P] =
|
|
663
|
-
(
|
|
664
|
-
f(
|
|
662
|
+
const [F, P] = t.useState(!1), [k, f] = t.useState(!1), [a, I] = t.useState(), j = t.useCallback(
|
|
663
|
+
(l) => {
|
|
664
|
+
f(l), y?.(l ? "create" : null);
|
|
665
665
|
},
|
|
666
666
|
[y]
|
|
667
|
-
), $ =
|
|
668
|
-
(
|
|
669
|
-
P(
|
|
667
|
+
), $ = t.useCallback(
|
|
668
|
+
(l) => {
|
|
669
|
+
P(l), y?.(l ? "rename" : null);
|
|
670
670
|
},
|
|
671
671
|
[y]
|
|
672
|
-
), H =
|
|
672
|
+
), H = t.useMemo(
|
|
673
673
|
() => [...u, ...o],
|
|
674
674
|
[u, o]
|
|
675
|
-
), Q =
|
|
676
|
-
() => H.find((
|
|
675
|
+
), Q = t.useMemo(
|
|
676
|
+
() => H.find((l) => l.id === c),
|
|
677
677
|
[H, c]
|
|
678
|
-
), Y = Q?.type === "system", K =
|
|
679
|
-
I(
|
|
680
|
-
}, [c, $]), Z =
|
|
681
|
-
a && await d(a,
|
|
682
|
-
}, [a, d]), ee =
|
|
683
|
-
await h("create",
|
|
684
|
-
}, [h]), G =
|
|
685
|
-
const z =
|
|
678
|
+
), Y = Q?.type === "system", K = t.useCallback((l) => {
|
|
679
|
+
I(l || c), $(!0);
|
|
680
|
+
}, [c, $]), Z = t.useCallback(async (l) => {
|
|
681
|
+
a && await d(a, l);
|
|
682
|
+
}, [a, d]), ee = t.useCallback(async (l) => {
|
|
683
|
+
await h("create", l);
|
|
684
|
+
}, [h]), G = t.useCallback(async (l) => {
|
|
685
|
+
const z = l || c;
|
|
686
686
|
z && await B(z);
|
|
687
|
-
}, [c, B]), _ =
|
|
688
|
-
const z =
|
|
687
|
+
}, [c, B]), _ = t.useCallback(async (l) => {
|
|
688
|
+
const z = l || c;
|
|
689
689
|
z && await v(z);
|
|
690
|
-
}, [c, v]), n =
|
|
691
|
-
() => H.find((
|
|
690
|
+
}, [c, v]), n = t.useMemo(
|
|
691
|
+
() => H.find((l) => l.id === a),
|
|
692
692
|
[H, a]
|
|
693
|
-
), { contentSlot: m, actionsSlot:
|
|
694
|
-
let
|
|
693
|
+
), { contentSlot: m, actionsSlot: i, settingsSlot: p } = t.useMemo(() => {
|
|
694
|
+
let l = null, z = null, q = null;
|
|
695
695
|
const R = [];
|
|
696
|
-
return
|
|
697
|
-
|
|
698
|
-
}), !
|
|
699
|
-
contentSlot:
|
|
696
|
+
return t.Children.forEach(g, (N) => {
|
|
697
|
+
t.isValidElement(N) ? N.type === we ? l = N.props.children : N.type === Ce ? z = N.props.children : N.type === ke ? q = N.props.children : R.push(N) : R.push(N);
|
|
698
|
+
}), !l && R.length > 0 && (l = R), {
|
|
699
|
+
contentSlot: l,
|
|
700
700
|
actionsSlot: z,
|
|
701
701
|
settingsSlot: q
|
|
702
702
|
};
|
|
703
|
-
}, [g]), M =
|
|
703
|
+
}, [g]), M = t.useCallback(() => j(!0), [j]), D = t.useCallback(() => h("update"), [h]), U = t.useMemo(
|
|
704
704
|
() => ({
|
|
705
705
|
isDirty: x,
|
|
706
706
|
isSystemBookmark: Y,
|
|
@@ -724,7 +724,7 @@ function E({
|
|
|
724
724
|
_
|
|
725
725
|
]
|
|
726
726
|
);
|
|
727
|
-
return
|
|
727
|
+
return r === "tabs" ? /* @__PURE__ */ s(se.Provider, { value: U, children: [
|
|
728
728
|
/* @__PURE__ */ e(
|
|
729
729
|
Ye,
|
|
730
730
|
{
|
|
@@ -740,10 +740,10 @@ function E({
|
|
|
740
740
|
onOverflowMenuChange: A
|
|
741
741
|
}
|
|
742
742
|
),
|
|
743
|
-
(m ||
|
|
743
|
+
(m || i || p) && /* @__PURE__ */ s("div", { className: "flex items-center", children: [
|
|
744
744
|
/* @__PURE__ */ s("div", { className: "flex items-center gap-[7px] flex-1 min-w-0 overflow-hidden", children: [
|
|
745
745
|
m && /* @__PURE__ */ e("div", { className: "flex items-center gap-[7px] min-w-0", children: m }),
|
|
746
|
-
|
|
746
|
+
i && /* @__PURE__ */ e("div", { className: "flex items-center gap-[7px] flex-shrink-0", children: i })
|
|
747
747
|
] }),
|
|
748
748
|
p && /* @__PURE__ */ s(O, { children: [
|
|
749
749
|
/* @__PURE__ */ e("div", { className: "w-[var(--space-m)]" }),
|
|
@@ -751,7 +751,7 @@ function E({
|
|
|
751
751
|
] })
|
|
752
752
|
] }),
|
|
753
753
|
/* @__PURE__ */ e(
|
|
754
|
-
|
|
754
|
+
re,
|
|
755
755
|
{
|
|
756
756
|
open: k,
|
|
757
757
|
onOpenChange: j,
|
|
@@ -760,7 +760,7 @@ function E({
|
|
|
760
760
|
}
|
|
761
761
|
),
|
|
762
762
|
/* @__PURE__ */ e(
|
|
763
|
-
|
|
763
|
+
re,
|
|
764
764
|
{
|
|
765
765
|
open: F,
|
|
766
766
|
onOpenChange: $,
|
|
@@ -785,12 +785,12 @@ function E({
|
|
|
785
785
|
),
|
|
786
786
|
/* @__PURE__ */ s("div", { className: "flex items-center gap-[7px] flex-1 min-w-0 overflow-hidden", children: [
|
|
787
787
|
m && /* @__PURE__ */ e("div", { className: "flex items-center gap-[7px]", children: m }),
|
|
788
|
-
|
|
788
|
+
i && /* @__PURE__ */ e("div", { className: "flex items-center gap-[7px] flex-shrink-0", children: i })
|
|
789
789
|
] }),
|
|
790
790
|
p && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: p })
|
|
791
791
|
] }),
|
|
792
792
|
/* @__PURE__ */ e(
|
|
793
|
-
|
|
793
|
+
re,
|
|
794
794
|
{
|
|
795
795
|
open: k,
|
|
796
796
|
onOpenChange: j,
|
|
@@ -799,7 +799,7 @@ function E({
|
|
|
799
799
|
}
|
|
800
800
|
),
|
|
801
801
|
/* @__PURE__ */ e(
|
|
802
|
-
|
|
802
|
+
re,
|
|
803
803
|
{
|
|
804
804
|
open: F,
|
|
805
805
|
onOpenChange: $,
|