@rafal.lemieszewski/tide-ui 0.83.0 → 0.84.3
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 +20 -8
- package/dist/cjs/components/core-index.cjs +1 -0
- package/dist/cjs/components/fundamental/accordion.cjs +1 -0
- package/dist/cjs/components/fundamental/alert-dialog.cjs +1 -0
- package/dist/cjs/components/fundamental/alert.cjs +1 -0
- package/dist/cjs/components/fundamental/autocomplete-search.cjs +1 -0
- package/dist/cjs/components/fundamental/avatar-group.cjs +1 -0
- package/dist/cjs/components/fundamental/avatar.cjs +1 -0
- package/dist/cjs/components/fundamental/badge.cjs +1 -0
- package/dist/cjs/components/fundamental/breadcrumb.cjs +1 -0
- package/dist/cjs/components/fundamental/button-group.cjs +1 -0
- package/dist/cjs/components/fundamental/button.cjs +1 -0
- package/dist/cjs/components/fundamental/calendar.cjs +1 -0
- package/dist/cjs/components/fundamental/card.cjs +1 -0
- package/dist/cjs/components/fundamental/chart.cjs +1 -0
- package/dist/cjs/components/fundamental/checkbox.cjs +1 -0
- package/dist/cjs/components/fundamental/collapsible.cjs +1 -0
- package/dist/cjs/components/fundamental/combobox.cjs +1 -0
- package/dist/cjs/components/fundamental/command.cjs +1 -0
- package/dist/cjs/components/fundamental/country-dropdown.cjs +1 -0
- package/dist/cjs/components/fundamental/custom-icons.cjs +1 -0
- package/dist/cjs/components/fundamental/date-picker.cjs +1 -0
- package/dist/cjs/components/fundamental/dialog.cjs +1 -0
- package/dist/cjs/components/fundamental/drawer.cjs +1 -0
- package/dist/cjs/components/fundamental/dropdown-menu.cjs +1 -0
- package/dist/cjs/components/fundamental/editable.cjs +1 -0
- package/dist/cjs/components/fundamental/empty.cjs +1 -0
- package/dist/cjs/components/fundamental/file-upload.cjs +1 -0
- package/dist/cjs/components/fundamental/flag.cjs +1 -0
- package/dist/cjs/components/fundamental/form-field.cjs +1 -0
- package/dist/cjs/components/fundamental/hover-card.cjs +1 -0
- package/dist/cjs/components/fundamental/icon.cjs +1 -0
- package/dist/cjs/components/fundamental/input-group.cjs +1 -0
- package/dist/cjs/components/fundamental/input.cjs +1 -0
- package/dist/cjs/components/fundamental/kbd.cjs +1 -0
- package/dist/cjs/components/fundamental/label.cjs +1 -0
- package/dist/cjs/components/fundamental/month-picker.cjs +1 -0
- package/dist/cjs/components/fundamental/pagination.cjs +1 -0
- package/dist/cjs/components/fundamental/popover.cjs +1 -0
- package/dist/cjs/components/fundamental/progress.cjs +1 -0
- package/dist/cjs/components/fundamental/radio-group.cjs +1 -0
- package/dist/cjs/components/fundamental/resizable.cjs +1 -0
- package/dist/cjs/components/fundamental/scroll-area.cjs +1 -0
- package/dist/cjs/components/fundamental/select.cjs +1 -0
- package/dist/cjs/components/fundamental/separator.cjs +1 -0
- package/dist/cjs/components/fundamental/sheet.cjs +1 -0
- package/dist/cjs/components/fundamental/sidebar.cjs +1 -0
- package/dist/cjs/components/fundamental/skeleton.cjs +1 -0
- package/dist/cjs/components/fundamental/slider.cjs +1 -0
- package/dist/cjs/components/fundamental/spinner.cjs +1 -0
- package/dist/cjs/components/fundamental/switch.cjs +1 -0
- package/dist/cjs/components/fundamental/table.cjs +1 -0
- package/dist/cjs/components/fundamental/tabs.cjs +1 -0
- package/dist/cjs/components/fundamental/tag.cjs +27 -0
- package/dist/cjs/components/fundamental/text-link.cjs +1 -0
- package/dist/cjs/components/fundamental/textarea.cjs +1 -0
- package/dist/cjs/components/fundamental/toast.cjs +1 -0
- package/dist/cjs/components/fundamental/toggle-group.cjs +1 -0
- package/dist/cjs/components/fundamental/toggle.cjs +1 -0
- package/dist/cjs/components/fundamental/tooltip.cjs +1 -0
- package/dist/cjs/components/fundamental/tree.cjs +1 -0
- package/dist/cjs/components/product/activity-log.cjs +1 -0
- package/dist/cjs/components/product/app-frame.cjs +1 -0
- package/dist/cjs/components/product/attributes-list.cjs +1 -0
- package/dist/cjs/components/product/bookmarks.cjs +1 -0
- package/dist/cjs/components/product/data-table-settings-menu.cjs +1 -0
- package/dist/cjs/components/product/data-table.cjs +1 -0
- package/dist/cjs/components/product/filters.cjs +1 -0
- package/dist/cjs/components/product/fixture-status.cjs +1 -0
- package/dist/cjs/components/product/linked-chart.cjs +1 -0
- package/dist/cjs/components/product/view-mode-menu.cjs +1 -0
- package/dist/cjs/lib/date-utils.cjs +1 -0
- package/dist/cjs/lib/hooks.cjs +1 -0
- package/dist/cjs/lib/index.cjs +1 -0
- package/dist/cjs/lib/utils.cjs +1 -0
- package/dist/es/components/core-index.js +37 -0
- package/dist/es/components/fundamental/accordion.js +60 -0
- package/dist/es/components/fundamental/alert-dialog.js +116 -0
- package/dist/es/components/fundamental/alert.js +65 -0
- package/dist/es/components/fundamental/autocomplete-search.js +139 -0
- package/dist/es/components/fundamental/avatar-group.js +51 -0
- package/dist/es/components/fundamental/avatar.js +165 -0
- package/dist/es/components/fundamental/badge.js +157 -0
- package/dist/es/components/fundamental/breadcrumb.js +142 -0
- package/dist/es/components/fundamental/button-group.js +86 -0
- package/dist/es/components/fundamental/button.js +186 -0
- package/dist/es/components/fundamental/calendar.js +130 -0
- package/dist/es/components/fundamental/card.js +68 -0
- package/dist/es/components/fundamental/chart.js +1006 -0
- package/dist/es/components/fundamental/checkbox.js +51 -0
- package/dist/es/components/fundamental/collapsible.js +55 -0
- package/dist/es/components/fundamental/combobox.js +229 -0
- package/dist/es/components/fundamental/command.js +155 -0
- package/dist/es/components/fundamental/country-dropdown.js +215 -0
- package/dist/es/components/fundamental/custom-icons.js +876 -0
- package/dist/es/components/fundamental/date-picker.js +119 -0
- package/dist/es/components/fundamental/dialog.js +106 -0
- package/dist/es/components/fundamental/drawer.js +93 -0
- package/dist/es/components/fundamental/dropdown-menu.js +600 -0
- package/dist/es/components/fundamental/editable.js +123 -0
- package/dist/es/components/fundamental/empty.js +152 -0
- package/dist/es/components/fundamental/file-upload.js +289 -0
- package/dist/es/components/fundamental/flag.js +60 -0
- package/dist/es/components/fundamental/form-field.js +352 -0
- package/dist/es/components/fundamental/hover-card.js +23 -0
- package/dist/es/components/fundamental/icon.js +200 -0
- package/dist/es/components/fundamental/input-group.js +135 -0
- package/dist/es/components/fundamental/input.js +78 -0
- package/dist/es/components/fundamental/kbd.js +57 -0
- package/dist/es/components/fundamental/label.js +54 -0
- package/dist/es/components/fundamental/month-picker.js +161 -0
- package/dist/es/components/fundamental/pagination.js +109 -0
- package/dist/es/components/fundamental/popover.js +24 -0
- package/dist/es/components/fundamental/progress.js +66 -0
- package/dist/es/components/fundamental/radio-group.js +64 -0
- package/dist/es/components/fundamental/resizable.js +43 -0
- package/dist/es/components/fundamental/scroll-area.js +38 -0
- package/dist/es/components/fundamental/select.js +136 -0
- package/dist/es/components/fundamental/separator.js +47 -0
- package/dist/es/components/fundamental/sheet.js +134 -0
- package/dist/es/components/fundamental/sidebar.js +709 -0
- package/dist/es/components/fundamental/skeleton.js +158 -0
- package/dist/es/components/fundamental/slider.js +35 -0
- package/dist/es/components/fundamental/spinner.js +225 -0
- package/dist/es/components/fundamental/switch.js +27 -0
- package/dist/es/components/fundamental/table.js +263 -0
- package/dist/es/components/fundamental/tabs.js +170 -0
- package/dist/es/components/fundamental/tag.js +295 -0
- package/dist/es/components/fundamental/text-link.js +105 -0
- package/dist/es/components/fundamental/textarea.js +47 -0
- package/dist/es/components/fundamental/toast.js +108 -0
- package/dist/es/components/fundamental/toggle-group.js +37 -0
- package/dist/es/components/fundamental/toggle.js +51 -0
- package/dist/es/components/fundamental/tooltip.js +26 -0
- package/dist/es/components/fundamental/tree.js +161 -0
- package/dist/es/components/product/activity-log.js +231 -0
- package/dist/es/components/product/app-frame.js +985 -0
- package/dist/es/components/product/attributes-list.js +351 -0
- package/dist/es/components/product/bookmarks.js +833 -0
- package/dist/es/components/product/data-table-settings-menu.js +169 -0
- package/dist/es/components/product/data-table.js +2473 -0
- package/dist/es/components/product/filters.js +1041 -0
- package/dist/es/components/product/fixture-status.js +178 -0
- package/dist/es/components/product/linked-chart.js +179 -0
- package/dist/es/components/product/view-mode-menu.js +353 -0
- package/dist/es/lib/date-utils.js +151 -0
- package/dist/es/lib/hooks.js +29 -0
- package/dist/es/lib/index.js +348 -0
- package/dist/es/lib/utils.js +8 -0
- package/dist/es/style.css +1 -0
- package/dist/types/bookmarks.d.ts +2 -0
- package/dist/types/calendar.d.ts +2 -0
- package/dist/types/chart.d.ts +2 -0
- package/dist/types/components/core-index.d.cts +135 -0
- package/dist/types/components/core-index.d.ts +135 -0
- package/dist/{components → types/components}/fundamental/avatar.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/badge.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/button-group.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/button.d.ts +1 -1
- package/dist/types/components/fundamental/calendar.d.ts +7 -0
- package/dist/types/components/fundamental/chart.d.ts +95 -0
- package/dist/{components → types/components}/fundamental/command.d.ts +2 -2
- package/dist/types/components/fundamental/country-dropdown.d.ts +34 -0
- package/dist/types/components/fundamental/date-picker.d.ts +30 -0
- package/dist/{components → types/components}/fundamental/file-upload.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/form-field.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/form.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/icon.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/input-group.d.ts +1 -1
- package/dist/types/components/fundamental/resizable.d.cts +23 -0
- package/dist/{components → types/components}/fundamental/resizable.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/sidebar.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/spinner.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/table.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/text-link.d.ts +1 -1
- package/dist/{components → types/components}/index.d.ts +118 -118
- package/dist/{components → types/components}/product/activity-log.d.ts +1 -1
- package/dist/{components → types/components}/product/attributes-list.d.ts +1 -1
- package/dist/types/components/product/bookmarks.d.cts +90 -0
- package/dist/{components → types/components}/product/bookmarks.d.ts +1 -1
- package/dist/types/components/product/data-table.d.ts +802 -0
- package/dist/types/components/product/filters.d.ts +124 -0
- package/dist/{components → types/components}/product/fixture-status.d.ts +1 -1
- package/dist/types/components/product/linked-chart.d.cts +22 -0
- package/dist/{components → types/components}/product/linked-chart.d.ts +1 -1
- package/dist/types/country-dropdown.d.ts +2 -0
- package/dist/types/data-table.d.ts +2 -0
- package/dist/types/date-picker.d.ts +2 -0
- package/dist/types/filters.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/lib/index.d.cts +104 -0
- package/dist/types/lib/index.d.ts +104 -0
- package/dist/types/linked-chart.d.ts +2 -0
- package/dist/types/resizable.d.ts +2 -0
- package/package.json +191 -31
- package/dist/index.cjs.js +0 -144
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.es.js +0 -87768
- package/dist/index.es.js.map +0 -1
- package/dist/lib/index.d.ts +0 -3
- package/dist/style.css +0 -1
- /package/dist/{components → types/components}/fundamental/accordion.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/alert-dialog.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/alert.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/autocomplete-search.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/avatar-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/breadcrumb.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/button.test.d.ts +0 -0
- /package/dist/{components/fundamental/calendar.d.ts → types/components/fundamental/calendar.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/card.d.ts +0 -0
- /package/dist/{components/fundamental/chart.d.ts → types/components/fundamental/chart.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/checkbox.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/collapsible.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/combobox.d.ts +0 -0
- /package/dist/{components/fundamental/country-dropdown.d.ts → types/components/fundamental/country-dropdown.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/custom-icons.d.ts +0 -0
- /package/dist/{components/fundamental/date-picker.d.ts → types/components/fundamental/date-picker.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/dialog.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/drawer.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/dropdown-menu.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/editable.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/empty.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/flag.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/hover-card.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/input.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/kbd.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/label.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/month-picker.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/pagination.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/popover.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/progress.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/radio-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/scroll-area.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/select.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/separator.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/sheet.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/skeleton.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/slider.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/switch.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tabs.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tag.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/textarea.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toast.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toggle-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toggle.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tooltip.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tree.d.ts +0 -0
- /package/dist/{components → types/components}/product/app-frame.d.ts +0 -0
- /package/dist/{components → types/components}/product/data-table-settings-menu.d.ts +0 -0
- /package/dist/{components/product/data-table.d.ts → types/components/product/data-table.d.cts} +0 -0
- /package/dist/{components/product/filters.d.ts → types/components/product/filters.d.cts} +0 -0
- /package/dist/{components → types/components}/product/view-mode-menu.d.ts +0 -0
- /package/dist/{lib → types/lib}/date-utils.d.ts +0 -0
- /package/dist/{lib → types/lib}/hooks.d.ts +0 -0
- /package/dist/{lib → types/lib}/utils.d.ts +0 -0
|
@@ -0,0 +1,833 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e, Fragment as O } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { cn as X } from "../../lib/utils.js";
|
|
4
|
+
import { Button as T } from "../fundamental/button.js";
|
|
5
|
+
import { ButtonGroup as De } from "../fundamental/button-group.js";
|
|
6
|
+
import { Icon as w } from "../fundamental/icon.js";
|
|
7
|
+
import { Separator as ue } from "../fundamental/separator.js";
|
|
8
|
+
import { Select as Ne, SelectTrigger as Se, SelectContent as ye, SelectItem as de, SelectSeparator as Be, SelectGroup as ze, SelectLabel as Re } from "../fundamental/select.js";
|
|
9
|
+
import { DropdownMenu as se, DropdownMenuTrigger as oe, DropdownMenuContent as le, DropdownMenuItem as L, DropdownMenuSeparator as Me } from "../fundamental/dropdown-menu.js";
|
|
10
|
+
import { Popover as Oe, PopoverTrigger as Te, PopoverContent as Ee } from "../fundamental/popover.js";
|
|
11
|
+
import { Dialog as Ae, DialogContent as Ue, DialogHeader as Ve, DialogTitle as Pe, DialogBody as We, DialogFooter as Ie } from "../fundamental/dialog.js";
|
|
12
|
+
import { Input as Le } from "../fundamental/input.js";
|
|
13
|
+
import { Label as Fe } from "../fundamental/label.js";
|
|
14
|
+
import { Badge as je } from "../fundamental/badge.js";
|
|
15
|
+
import { Skeleton as me } from "../fundamental/skeleton.js";
|
|
16
|
+
const ae = r.createContext(null);
|
|
17
|
+
function J() {
|
|
18
|
+
const t = r.useContext(ae);
|
|
19
|
+
if (!t)
|
|
20
|
+
throw new Error("useBookmarksActions must be used within Bookmarks");
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
23
|
+
function te({
|
|
24
|
+
open: t,
|
|
25
|
+
onOpenChange: o,
|
|
26
|
+
mode: u,
|
|
27
|
+
initialName: c = "",
|
|
28
|
+
onSave: x
|
|
29
|
+
}) {
|
|
30
|
+
const [g, S] = r.useState(c);
|
|
31
|
+
r.useEffect(() => {
|
|
32
|
+
t && S(c);
|
|
33
|
+
}, [t, c]);
|
|
34
|
+
const k = () => {
|
|
35
|
+
g.trim() && (x(g.trim()), o(!1));
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ e(Ae, { open: t, onOpenChange: o, children: /* @__PURE__ */ s(Ue, { children: [
|
|
38
|
+
/* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(Pe, { children: u === "create" ? "Create bookmark" : "Rename bookmark" }) }),
|
|
39
|
+
/* @__PURE__ */ e(We, { children: /* @__PURE__ */ s("div", { className: "flex flex-col gap-[var(--space-s)]", children: [
|
|
40
|
+
/* @__PURE__ */ e(Fe, { htmlFor: "bookmark-name", children: "Bookmark name" }),
|
|
41
|
+
/* @__PURE__ */ e(
|
|
42
|
+
Le,
|
|
43
|
+
{
|
|
44
|
+
id: "bookmark-name",
|
|
45
|
+
value: g,
|
|
46
|
+
onChange: (b) => S(b.target.value),
|
|
47
|
+
placeholder: "Enter bookmark name...",
|
|
48
|
+
onKeyDown: (b) => {
|
|
49
|
+
b.key === "Enter" && (b.preventDefault(), k());
|
|
50
|
+
},
|
|
51
|
+
autoFocus: !0
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] }) }),
|
|
55
|
+
/* @__PURE__ */ s(Ie, { children: [
|
|
56
|
+
/* @__PURE__ */ e(T, { variant: "default", onClick: () => o(!1), children: "Cancel" }),
|
|
57
|
+
/* @__PURE__ */ e(
|
|
58
|
+
T,
|
|
59
|
+
{
|
|
60
|
+
variant: "primary",
|
|
61
|
+
onClick: k,
|
|
62
|
+
disabled: !g.trim(),
|
|
63
|
+
children: u === "create" ? "Create" : "Save"
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] })
|
|
67
|
+
] }) });
|
|
68
|
+
}
|
|
69
|
+
function $e({
|
|
70
|
+
bookmarks: t,
|
|
71
|
+
systemBookmarks: o,
|
|
72
|
+
activeBookmarkId: u,
|
|
73
|
+
onSelect: c,
|
|
74
|
+
onRename: x,
|
|
75
|
+
onDelete: g,
|
|
76
|
+
onSetDefault: S
|
|
77
|
+
}) {
|
|
78
|
+
const k = r.useMemo(
|
|
79
|
+
() => [...o, ...t],
|
|
80
|
+
[o, t]
|
|
81
|
+
), b = r.useMemo(
|
|
82
|
+
() => k.find((d) => d.id === u),
|
|
83
|
+
[k, u]
|
|
84
|
+
), h = b?.type === "system";
|
|
85
|
+
return /* @__PURE__ */ s(De, { children: [
|
|
86
|
+
/* @__PURE__ */ s(
|
|
87
|
+
Ne,
|
|
88
|
+
{
|
|
89
|
+
value: u,
|
|
90
|
+
onValueChange: (d) => {
|
|
91
|
+
const B = k.find((v) => v.id === d);
|
|
92
|
+
B && c(B);
|
|
93
|
+
},
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ s(
|
|
96
|
+
Se,
|
|
97
|
+
{
|
|
98
|
+
className: X(
|
|
99
|
+
"!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-sm 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-xs data-[state=open]:ring-0",
|
|
100
|
+
h ? "rounded-m" : "rounded-l-m !rounded-r-none !border-r-0"
|
|
101
|
+
),
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ e(w, { name: "bookmark", size: "m", color: "primary" }),
|
|
104
|
+
b?.name || "Bookmarks"
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
/* @__PURE__ */ s(ye, { align: "start", position: "popper", className: "min-w-[200px]", children: [
|
|
109
|
+
o.length > 0 && /* @__PURE__ */ e(O, { children: o.map((d) => /* @__PURE__ */ e(de, { 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)) }),
|
|
110
|
+
o.length > 0 && t.length > 0 && /* @__PURE__ */ e(Be, {}),
|
|
111
|
+
t.length > 0 && /* @__PURE__ */ s(ze, { children: [
|
|
112
|
+
/* @__PURE__ */ e(Re, { children: "Custom Bookmarks" }),
|
|
113
|
+
t.map((d) => /* @__PURE__ */ e(de, { value: d.id, children: /* @__PURE__ */ s("div", { className: "flex items-center gap-[var(--space-s)] pr-6", children: [
|
|
114
|
+
/* @__PURE__ */ e(
|
|
115
|
+
w,
|
|
116
|
+
{
|
|
117
|
+
name: "bookmark",
|
|
118
|
+
className: "h-[var(--size-2xs)] w-[var(--size-2xs)]"
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: d.name }),
|
|
122
|
+
d.isDefault && /* @__PURE__ */ e(
|
|
123
|
+
w,
|
|
124
|
+
{
|
|
125
|
+
name: "star",
|
|
126
|
+
className: "h-[var(--size-2xs)] w-[var(--size-2xs)] flex-shrink-0 text-[var(--color-icon-warning-bold)]"
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] }) }, d.id))
|
|
130
|
+
] })
|
|
131
|
+
] })
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
!h && /* @__PURE__ */ s(se, { children: [
|
|
136
|
+
/* @__PURE__ */ e(oe, { asChild: !0, children: /* @__PURE__ */ e(
|
|
137
|
+
T,
|
|
138
|
+
{
|
|
139
|
+
icon: "more-horizontal",
|
|
140
|
+
"aria-label": "Bookmark options",
|
|
141
|
+
className: "!rounded-l-none rounded-r-md !border-l !border-l-[var(--color-border-action-outline)] focus:ring-0 data-[state=open]:ring-0"
|
|
142
|
+
}
|
|
143
|
+
) }),
|
|
144
|
+
/* @__PURE__ */ s(le, { align: "end", children: [
|
|
145
|
+
/* @__PURE__ */ s(
|
|
146
|
+
L,
|
|
147
|
+
{
|
|
148
|
+
onClick: (d) => {
|
|
149
|
+
if (h) {
|
|
150
|
+
d.preventDefault();
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
x();
|
|
154
|
+
},
|
|
155
|
+
disabled: h,
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ e(w, { name: "pencil", className: "mr-2 h-4 w-4" }),
|
|
158
|
+
"Rename"
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
/* @__PURE__ */ s(
|
|
163
|
+
L,
|
|
164
|
+
{
|
|
165
|
+
onClick: (d) => {
|
|
166
|
+
if (h) {
|
|
167
|
+
d.preventDefault();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
g();
|
|
171
|
+
},
|
|
172
|
+
disabled: h,
|
|
173
|
+
destructive: !0,
|
|
174
|
+
children: [
|
|
175
|
+
/* @__PURE__ */ e(w, { name: "trash-2", className: "mr-2 h-4 w-4" }),
|
|
176
|
+
"Delete"
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
!h && /* @__PURE__ */ s(O, { children: [
|
|
181
|
+
/* @__PURE__ */ e(Me, {}),
|
|
182
|
+
/* @__PURE__ */ s(L, { onClick: S, children: [
|
|
183
|
+
/* @__PURE__ */ e(
|
|
184
|
+
w,
|
|
185
|
+
{
|
|
186
|
+
name: (b?.isDefault, "star"),
|
|
187
|
+
className: X(
|
|
188
|
+
"mr-2 h-4 w-4",
|
|
189
|
+
b?.isDefault && "text-[var(--color-icon-warning-bold)]"
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
b?.isDefault ? "Unset as Default" : "Set as Default"
|
|
194
|
+
] })
|
|
195
|
+
] })
|
|
196
|
+
] })
|
|
197
|
+
] })
|
|
198
|
+
] });
|
|
199
|
+
}
|
|
200
|
+
function Ke({ onUpdate: t, onCreate: o }) {
|
|
201
|
+
return /* @__PURE__ */ s(se, { children: [
|
|
202
|
+
/* @__PURE__ */ e(oe, { asChild: !0, children: /* @__PURE__ */ s(
|
|
203
|
+
T,
|
|
204
|
+
{
|
|
205
|
+
variant: "ghost",
|
|
206
|
+
className: "h-[var(--size-m)] gap-[var(--space-xs)] px-[var(--space-m)] data-[state=open]:ring-0",
|
|
207
|
+
children: [
|
|
208
|
+
/* @__PURE__ */ e("span", { className: "text-label-md", children: "Save" }),
|
|
209
|
+
/* @__PURE__ */ e(
|
|
210
|
+
w,
|
|
211
|
+
{
|
|
212
|
+
name: "chevron-down",
|
|
213
|
+
className: "h-[var(--size-2xs)] w-[var(--size-2xs)]"
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
) }),
|
|
219
|
+
/* @__PURE__ */ s(le, { align: "end", children: [
|
|
220
|
+
/* @__PURE__ */ e(L, { onClick: t, children: "Update bookmark" }),
|
|
221
|
+
/* @__PURE__ */ e(L, { onClick: o, children: "Create new bookmark" })
|
|
222
|
+
] })
|
|
223
|
+
] });
|
|
224
|
+
}
|
|
225
|
+
const he = /* @__PURE__ */ r.memo(
|
|
226
|
+
/* @__PURE__ */ r.forwardRef(
|
|
227
|
+
({
|
|
228
|
+
bookmark: t,
|
|
229
|
+
isActive: o,
|
|
230
|
+
isVisible: u = !0,
|
|
231
|
+
index: c,
|
|
232
|
+
totalTabs: x,
|
|
233
|
+
onSelect: g,
|
|
234
|
+
onRename: S,
|
|
235
|
+
onDelete: k,
|
|
236
|
+
onSetDefault: b,
|
|
237
|
+
onNavigate: h,
|
|
238
|
+
onNavigateFirst: d,
|
|
239
|
+
onNavigateLast: B,
|
|
240
|
+
onHover: v
|
|
241
|
+
}, W) => {
|
|
242
|
+
const A = t.type === "user", y = r.useCallback(() => {
|
|
243
|
+
g(t);
|
|
244
|
+
}, [g, t]), F = r.useCallback(() => {
|
|
245
|
+
v?.(t);
|
|
246
|
+
}, [v, t]), U = r.useCallback(() => {
|
|
247
|
+
S(t.id);
|
|
248
|
+
}, [S, t.id]), C = r.useCallback(() => {
|
|
249
|
+
k(t.id);
|
|
250
|
+
}, [k, t.id]), f = r.useCallback(
|
|
251
|
+
(a) => {
|
|
252
|
+
switch (a.key) {
|
|
253
|
+
case "Enter":
|
|
254
|
+
case " ":
|
|
255
|
+
a.preventDefault(), g(t);
|
|
256
|
+
break;
|
|
257
|
+
case "ArrowRight":
|
|
258
|
+
a.preventDefault(), h(c, 1);
|
|
259
|
+
break;
|
|
260
|
+
case "ArrowLeft":
|
|
261
|
+
a.preventDefault(), h(c, -1);
|
|
262
|
+
break;
|
|
263
|
+
case "Home":
|
|
264
|
+
a.preventDefault(), d();
|
|
265
|
+
break;
|
|
266
|
+
case "End":
|
|
267
|
+
a.preventDefault(), B();
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
[t, c, g, h, d, B]
|
|
272
|
+
);
|
|
273
|
+
return /* @__PURE__ */ s(
|
|
274
|
+
"div",
|
|
275
|
+
{
|
|
276
|
+
ref: W,
|
|
277
|
+
role: "tab",
|
|
278
|
+
"aria-selected": o,
|
|
279
|
+
"aria-posinset": c + 1,
|
|
280
|
+
"aria-setsize": x,
|
|
281
|
+
tabIndex: o ? 0 : -1,
|
|
282
|
+
onClick: y,
|
|
283
|
+
onKeyDown: f,
|
|
284
|
+
onMouseEnter: F,
|
|
285
|
+
className: X(
|
|
286
|
+
"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
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-border-brand-bold)] focus-visible:ring-offset-2",
|
|
288
|
+
o ? "bg-[var(--blue-50)] hover:bg-[var(--blue-50)]" : "bg-[var(--color-background-neutral-default)] hover:bg-[var(--color-background-neutral-hovered)]",
|
|
289
|
+
!u && "pointer-events-none invisible absolute"
|
|
290
|
+
),
|
|
291
|
+
children: [
|
|
292
|
+
/* @__PURE__ */ s("div", { className: "flex min-h-[var(--size-s)] items-center justify-between gap-[var(--space-xs)]", children: [
|
|
293
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-[var(--space-xs)]", children: [
|
|
294
|
+
A && /* @__PURE__ */ e(
|
|
295
|
+
w,
|
|
296
|
+
{
|
|
297
|
+
name: "bookmark",
|
|
298
|
+
size: "s",
|
|
299
|
+
color: "secondary",
|
|
300
|
+
className: "flex-shrink-0"
|
|
301
|
+
}
|
|
302
|
+
),
|
|
303
|
+
/* @__PURE__ */ e("div", { className: "text-body-md whitespace-nowrap text-[var(--color-text-primary)]", children: t.name })
|
|
304
|
+
] }),
|
|
305
|
+
A && /* @__PURE__ */ s(se, { children: [
|
|
306
|
+
/* @__PURE__ */ e(oe, { asChild: !0, children: /* @__PURE__ */ e(
|
|
307
|
+
T,
|
|
308
|
+
{
|
|
309
|
+
variant: "ghost",
|
|
310
|
+
size: "s",
|
|
311
|
+
"aria-label": `Options for ${t.name}`,
|
|
312
|
+
className: "p-[var(--space-xs)] opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
|
|
313
|
+
tabIndex: -1,
|
|
314
|
+
onClick: (a) => a.stopPropagation(),
|
|
315
|
+
children: /* @__PURE__ */ e(
|
|
316
|
+
w,
|
|
317
|
+
{
|
|
318
|
+
name: "more-horizontal",
|
|
319
|
+
className: "h-[var(--size-2xs)] w-[var(--size-2xs)]"
|
|
320
|
+
}
|
|
321
|
+
)
|
|
322
|
+
}
|
|
323
|
+
) }),
|
|
324
|
+
/* @__PURE__ */ s(le, { align: "end", children: [
|
|
325
|
+
/* @__PURE__ */ s(
|
|
326
|
+
L,
|
|
327
|
+
{
|
|
328
|
+
onClick: (a) => {
|
|
329
|
+
a.stopPropagation(), U();
|
|
330
|
+
},
|
|
331
|
+
children: [
|
|
332
|
+
/* @__PURE__ */ e(w, { name: "pencil", className: "mr-2 h-4 w-4" }),
|
|
333
|
+
"Rename"
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
),
|
|
337
|
+
/* @__PURE__ */ s(
|
|
338
|
+
L,
|
|
339
|
+
{
|
|
340
|
+
onClick: (a) => {
|
|
341
|
+
a.stopPropagation(), C();
|
|
342
|
+
},
|
|
343
|
+
destructive: !0,
|
|
344
|
+
children: [
|
|
345
|
+
/* @__PURE__ */ e(w, { name: "trash-2", className: "mr-2 h-4 w-4" }),
|
|
346
|
+
"Delete"
|
|
347
|
+
]
|
|
348
|
+
}
|
|
349
|
+
)
|
|
350
|
+
] })
|
|
351
|
+
] })
|
|
352
|
+
] }),
|
|
353
|
+
/* @__PURE__ */ e("div", { className: "text-heading-lg text-[var(--color-text-primary)]", children: t.isLoadingCount ? /* @__PURE__ */ e(me, { height: 32, width: 40 }) : t.count ?? " " })
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
);
|
|
360
|
+
he.displayName = "BookmarkTab";
|
|
361
|
+
function Ge({
|
|
362
|
+
bookmarks: t,
|
|
363
|
+
systemBookmarks: o,
|
|
364
|
+
activeBookmarkId: u,
|
|
365
|
+
"aria-label": c = "Bookmarks",
|
|
366
|
+
onSelect: x,
|
|
367
|
+
onRename: g,
|
|
368
|
+
onDelete: S,
|
|
369
|
+
onSetDefault: k,
|
|
370
|
+
onBookmarkHover: b,
|
|
371
|
+
onOverflowMenuChange: h
|
|
372
|
+
}) {
|
|
373
|
+
const [d, B] = r.useState(!1), [v, W] = r.useState(null), A = r.useCallback(
|
|
374
|
+
(n) => {
|
|
375
|
+
B(n), h?.(n);
|
|
376
|
+
},
|
|
377
|
+
[h]
|
|
378
|
+
), [y, F] = r.useState(null), U = r.useRef(null), C = r.useRef(/* @__PURE__ */ new Map()), f = r.useMemo(
|
|
379
|
+
() => [...o, ...t],
|
|
380
|
+
[o, t]
|
|
381
|
+
);
|
|
382
|
+
r.useEffect(() => {
|
|
383
|
+
v && !f.some((n) => n.id === v) && W(null);
|
|
384
|
+
}, [f, v]), r.useEffect(() => {
|
|
385
|
+
if (!U.current || f.length === 0) return;
|
|
386
|
+
let n = null;
|
|
387
|
+
const m = () => {
|
|
388
|
+
n && clearTimeout(n), n = setTimeout(() => {
|
|
389
|
+
const p = U.current;
|
|
390
|
+
if (!p || C.current.size < f.length)
|
|
391
|
+
return;
|
|
392
|
+
const M = p.offsetWidth, D = /* @__PURE__ */ new Map();
|
|
393
|
+
f.forEach((P) => {
|
|
394
|
+
const ne = C.current.get(P.id);
|
|
395
|
+
ne && D.set(P.id, ne.offsetWidth);
|
|
396
|
+
});
|
|
397
|
+
const V = 8, i = 32, z = 52;
|
|
398
|
+
let q = 0, R = 0, N = !1;
|
|
399
|
+
const ie = o.length, ke = t.length > 0, Ce = ie > 0 && ke ? ie : -1;
|
|
400
|
+
for (let P = 0; P < f.length; P++) {
|
|
401
|
+
const ne = f[P], ce = D.get(ne.id);
|
|
402
|
+
if (ce === void 0) continue;
|
|
403
|
+
P === Ce && (N = !0, q += i + V);
|
|
404
|
+
const re = q + ce + (R > 0 || N ? V : 0);
|
|
405
|
+
if ((P < f.length - 1 ? re + V + z : re) > M)
|
|
406
|
+
break;
|
|
407
|
+
q = re, R++;
|
|
408
|
+
}
|
|
409
|
+
R === 0 && f.length > 0 && (R = 1), F(R);
|
|
410
|
+
}, 100);
|
|
411
|
+
};
|
|
412
|
+
m();
|
|
413
|
+
const l = new ResizeObserver(m);
|
|
414
|
+
return l.observe(U.current), () => {
|
|
415
|
+
n && clearTimeout(n), l.disconnect();
|
|
416
|
+
};
|
|
417
|
+
}, [f, o.length, t.length]);
|
|
418
|
+
const { visibleBookmarks: a, overflowBookmarks: I } = r.useMemo(() => {
|
|
419
|
+
if (y === null)
|
|
420
|
+
return { visibleBookmarks: f, overflowBookmarks: [] };
|
|
421
|
+
const n = f.slice(0, y), m = f.slice(y), l = v ? m.find((p) => p.id === v) : null;
|
|
422
|
+
if (l && n.length > 0) {
|
|
423
|
+
const p = n[n.length - 1], M = [
|
|
424
|
+
...n.slice(0, -1),
|
|
425
|
+
l
|
|
426
|
+
], D = [
|
|
427
|
+
p,
|
|
428
|
+
...m.filter((V) => V.id !== v)
|
|
429
|
+
];
|
|
430
|
+
return { visibleBookmarks: M, overflowBookmarks: D };
|
|
431
|
+
}
|
|
432
|
+
return { visibleBookmarks: n, overflowBookmarks: m };
|
|
433
|
+
}, [f, y, v]), j = r.useCallback(
|
|
434
|
+
(n, m) => {
|
|
435
|
+
let l = n + m;
|
|
436
|
+
l < 0 ? l = a.length - 1 : l >= a.length && (l = 0);
|
|
437
|
+
const p = a[l];
|
|
438
|
+
p && C.current.get(p.id)?.focus();
|
|
439
|
+
},
|
|
440
|
+
[a]
|
|
441
|
+
), $ = r.useCallback(
|
|
442
|
+
(n) => {
|
|
443
|
+
x(n);
|
|
444
|
+
},
|
|
445
|
+
[x]
|
|
446
|
+
), K = r.useCallback(() => {
|
|
447
|
+
const n = a[0];
|
|
448
|
+
n && C.current.get(n.id)?.focus();
|
|
449
|
+
}, [a]), Q = r.useCallback(() => {
|
|
450
|
+
const n = a[a.length - 1];
|
|
451
|
+
n && C.current.get(n.id)?.focus();
|
|
452
|
+
}, [a]), Y = a.length, G = r.useMemo(() => {
|
|
453
|
+
for (let n = 0; n < a.length - 1; n++)
|
|
454
|
+
if (a[n].type === "system" && a[n + 1].type === "user")
|
|
455
|
+
return n;
|
|
456
|
+
return -1;
|
|
457
|
+
}, [a]), Z = r.useCallback(
|
|
458
|
+
(n) => {
|
|
459
|
+
a.some((l) => l.id === n.id) && n.id !== v && W(null), x(n);
|
|
460
|
+
},
|
|
461
|
+
[a, v, x]
|
|
462
|
+
), ee = r.useCallback(
|
|
463
|
+
(n) => {
|
|
464
|
+
W(n.id), x(n), A(!1);
|
|
465
|
+
},
|
|
466
|
+
[x, A]
|
|
467
|
+
), H = r.useMemo(() => [...a, ...I], [a, I]), _ = r.useMemo(() => new Set(a.map((n) => n.id)), [a]);
|
|
468
|
+
return /* @__PURE__ */ s(
|
|
469
|
+
"div",
|
|
470
|
+
{
|
|
471
|
+
ref: U,
|
|
472
|
+
role: "tablist",
|
|
473
|
+
"aria-label": c,
|
|
474
|
+
className: "flex items-center gap-[var(--space-s)]",
|
|
475
|
+
children: [
|
|
476
|
+
H.map((n, m) => {
|
|
477
|
+
const l = _.has(n.id), p = l ? a.findIndex((D) => D.id === n.id) : -1, M = l && p === G;
|
|
478
|
+
return /* @__PURE__ */ s(r.Fragment, { children: [
|
|
479
|
+
/* @__PURE__ */ e(
|
|
480
|
+
he,
|
|
481
|
+
{
|
|
482
|
+
ref: (D) => {
|
|
483
|
+
D ? C.current.set(n.id, D) : C.current.delete(n.id);
|
|
484
|
+
},
|
|
485
|
+
bookmark: n,
|
|
486
|
+
isActive: u === n.id,
|
|
487
|
+
isVisible: l,
|
|
488
|
+
index: p >= 0 ? p : m,
|
|
489
|
+
totalTabs: Y,
|
|
490
|
+
onSelect: l ? Z : $,
|
|
491
|
+
onRename: g,
|
|
492
|
+
onDelete: S,
|
|
493
|
+
onSetDefault: k,
|
|
494
|
+
onNavigate: j,
|
|
495
|
+
onNavigateFirst: K,
|
|
496
|
+
onNavigateLast: Q,
|
|
497
|
+
onHover: b
|
|
498
|
+
}
|
|
499
|
+
),
|
|
500
|
+
M && /* @__PURE__ */ e(
|
|
501
|
+
ue,
|
|
502
|
+
{
|
|
503
|
+
type: "line",
|
|
504
|
+
layout: "horizontal",
|
|
505
|
+
className: "h-20 flex-shrink-0",
|
|
506
|
+
"aria-hidden": "true"
|
|
507
|
+
}
|
|
508
|
+
)
|
|
509
|
+
] }, n.id);
|
|
510
|
+
}),
|
|
511
|
+
I.length > 0 && /* @__PURE__ */ s(Oe, { open: d, onOpenChange: A, children: [
|
|
512
|
+
/* @__PURE__ */ e(Te, { asChild: !0, children: /* @__PURE__ */ e(
|
|
513
|
+
"button",
|
|
514
|
+
{
|
|
515
|
+
"aria-label": `Show ${I.length} more bookmarks`,
|
|
516
|
+
"aria-expanded": d,
|
|
517
|
+
className: X(
|
|
518
|
+
"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
|
+
"min-h-[88px]",
|
|
520
|
+
// Match the height of bookmark tabs (padding + content + padding)
|
|
521
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-border-brand-bold)] focus-visible:ring-offset-2"
|
|
522
|
+
),
|
|
523
|
+
children: /* @__PURE__ */ e(
|
|
524
|
+
w,
|
|
525
|
+
{
|
|
526
|
+
name: "chevron-down",
|
|
527
|
+
className: "h-[var(--size-2xs)] w-[var(--size-2xs)]"
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
}
|
|
531
|
+
) }),
|
|
532
|
+
/* @__PURE__ */ e(
|
|
533
|
+
Ee,
|
|
534
|
+
{
|
|
535
|
+
align: "end",
|
|
536
|
+
side: "bottom",
|
|
537
|
+
className: "w-[280px] p-[var(--space-s)]",
|
|
538
|
+
role: "menu",
|
|
539
|
+
"aria-label": "More bookmarks",
|
|
540
|
+
children: /* @__PURE__ */ e("div", { className: "flex flex-col", children: I.map((n) => {
|
|
541
|
+
const m = u === n.id, l = n.type === "user";
|
|
542
|
+
return /* @__PURE__ */ s(
|
|
543
|
+
"button",
|
|
544
|
+
{
|
|
545
|
+
role: "menuitem",
|
|
546
|
+
"aria-label": `Select ${n.name} bookmark${m ? " (currently selected)" : ""}`,
|
|
547
|
+
onClick: () => ee(n),
|
|
548
|
+
className: X(
|
|
549
|
+
"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
|
+
"hover:bg-[var(--color-background-neutral-subtlest-hovered)]",
|
|
551
|
+
"focus:outline-none focus-visible:bg-[var(--color-background-neutral-subtlest-hovered)]"
|
|
552
|
+
),
|
|
553
|
+
children: [
|
|
554
|
+
l && /* @__PURE__ */ e(
|
|
555
|
+
w,
|
|
556
|
+
{
|
|
557
|
+
name: "bookmark",
|
|
558
|
+
className: "h-[var(--size-2xs)] w-[var(--size-2xs)]",
|
|
559
|
+
"aria-hidden": "true"
|
|
560
|
+
}
|
|
561
|
+
),
|
|
562
|
+
!l && /* @__PURE__ */ e("div", { className: "w-[var(--size-2xs)]", "aria-hidden": "true" }),
|
|
563
|
+
/* @__PURE__ */ s("div", { className: "flex flex-1 items-center gap-[var(--space-xs)]", children: [
|
|
564
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: n.name }),
|
|
565
|
+
(n.count !== void 0 || n.isLoadingCount) && /* @__PURE__ */ e(je, { size: "s", intent: "neutral", appearance: "subtle", children: n.isLoadingCount ? /* @__PURE__ */ e(me, { height: 16, width: 24 }) : n.count })
|
|
566
|
+
] }),
|
|
567
|
+
n.isDefault && /* @__PURE__ */ e(
|
|
568
|
+
w,
|
|
569
|
+
{
|
|
570
|
+
name: "star",
|
|
571
|
+
className: "h-[var(--size-2xs)] w-[var(--size-2xs)] text-[var(--color-icon-warning-bold)]",
|
|
572
|
+
"aria-hidden": "true"
|
|
573
|
+
}
|
|
574
|
+
),
|
|
575
|
+
m && /* @__PURE__ */ e(
|
|
576
|
+
w,
|
|
577
|
+
{
|
|
578
|
+
name: "check",
|
|
579
|
+
className: "h-[var(--size-2xs)] w-[var(--size-2xs)] text-[var(--color-icon-primary)]",
|
|
580
|
+
"aria-hidden": "true"
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
]
|
|
584
|
+
},
|
|
585
|
+
n.id
|
|
586
|
+
);
|
|
587
|
+
}) })
|
|
588
|
+
}
|
|
589
|
+
)
|
|
590
|
+
] })
|
|
591
|
+
]
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
function pe({ children: t }) {
|
|
596
|
+
return /* @__PURE__ */ e(O, { children: t });
|
|
597
|
+
}
|
|
598
|
+
function fe({ children: t }) {
|
|
599
|
+
return /* @__PURE__ */ e(O, { children: t });
|
|
600
|
+
}
|
|
601
|
+
function ve({ children: t }) {
|
|
602
|
+
return /* @__PURE__ */ e(O, { children: t });
|
|
603
|
+
}
|
|
604
|
+
function ge() {
|
|
605
|
+
const { isDirty: t, handleRevert: o } = J();
|
|
606
|
+
return t ? /* @__PURE__ */ e(T, { variant: "ghost", onClick: o, className: "h-[var(--size-m)]", children: "Revert changes" }) : null;
|
|
607
|
+
}
|
|
608
|
+
function be() {
|
|
609
|
+
const { isDirty: t, isSystemBookmark: o, openCreateDialog: u } = J();
|
|
610
|
+
return !t || !o ? null : /* @__PURE__ */ e(T, { variant: "ghost", onClick: u, className: "h-[var(--size-m)]", children: "Create bookmark" });
|
|
611
|
+
}
|
|
612
|
+
function He() {
|
|
613
|
+
const { isDirty: t, isSystemBookmark: o, handleUpdate: u } = J();
|
|
614
|
+
return !t || o ? null : /* @__PURE__ */ e(T, { variant: "ghost", onClick: u, className: "h-[var(--size-m)]", children: "Update bookmark" });
|
|
615
|
+
}
|
|
616
|
+
function xe() {
|
|
617
|
+
const { isDirty: t, isSystemBookmark: o, handleRevert: u } = J();
|
|
618
|
+
return !t || !o ? null : /* @__PURE__ */ e(T, { variant: "ghost", onClick: u, className: "h-[var(--size-m)]", children: "Reset" });
|
|
619
|
+
}
|
|
620
|
+
function we() {
|
|
621
|
+
const { isDirty: t, isSystemBookmark: o, handleUpdate: u, openCreateDialog: c } = J();
|
|
622
|
+
return !t || o ? null : /* @__PURE__ */ e(
|
|
623
|
+
Ke,
|
|
624
|
+
{
|
|
625
|
+
onUpdate: u,
|
|
626
|
+
onCreate: c
|
|
627
|
+
}
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
function _e() {
|
|
631
|
+
const { isDirty: t, isSystemBookmark: o } = J();
|
|
632
|
+
return t ? /* @__PURE__ */ s(O, { children: [
|
|
633
|
+
/* @__PURE__ */ e(ue, { type: "dot", layout: "horizontal" }),
|
|
634
|
+
o ? /* @__PURE__ */ s(O, { children: [
|
|
635
|
+
/* @__PURE__ */ e(xe, {}),
|
|
636
|
+
/* @__PURE__ */ e(be, {})
|
|
637
|
+
] }) : /* @__PURE__ */ s(O, { children: [
|
|
638
|
+
/* @__PURE__ */ e(ge, {}),
|
|
639
|
+
/* @__PURE__ */ e(we, {})
|
|
640
|
+
] })
|
|
641
|
+
] }) : null;
|
|
642
|
+
}
|
|
643
|
+
function E({
|
|
644
|
+
variant: t,
|
|
645
|
+
bookmarks: o,
|
|
646
|
+
systemBookmarks: u,
|
|
647
|
+
activeBookmarkId: c,
|
|
648
|
+
isDirty: x,
|
|
649
|
+
children: g,
|
|
650
|
+
"aria-label": S = "Bookmarks",
|
|
651
|
+
onSelect: k,
|
|
652
|
+
onRevert: b,
|
|
653
|
+
onSave: h,
|
|
654
|
+
onRename: d,
|
|
655
|
+
onDelete: B,
|
|
656
|
+
onSetDefault: v,
|
|
657
|
+
onBookmarkHover: W,
|
|
658
|
+
onOverflowMenuChange: A,
|
|
659
|
+
onDialogChange: y
|
|
660
|
+
}) {
|
|
661
|
+
const [F, U] = r.useState(!1), [C, f] = r.useState(!1), [a, I] = r.useState(), j = r.useCallback(
|
|
662
|
+
(i) => {
|
|
663
|
+
f(i), y?.(i ? "create" : null);
|
|
664
|
+
},
|
|
665
|
+
[y]
|
|
666
|
+
), $ = r.useCallback(
|
|
667
|
+
(i) => {
|
|
668
|
+
U(i), y?.(i ? "rename" : null);
|
|
669
|
+
},
|
|
670
|
+
[y]
|
|
671
|
+
), K = r.useMemo(
|
|
672
|
+
() => [...u, ...o],
|
|
673
|
+
[u, o]
|
|
674
|
+
), Q = r.useMemo(
|
|
675
|
+
() => K.find((i) => i.id === c),
|
|
676
|
+
[K, c]
|
|
677
|
+
), Y = Q?.type === "system", G = r.useCallback((i) => {
|
|
678
|
+
I(i || c), $(!0);
|
|
679
|
+
}, [c, $]), Z = r.useCallback(async (i) => {
|
|
680
|
+
a && await d(a, i);
|
|
681
|
+
}, [a, d]), ee = r.useCallback(async (i) => {
|
|
682
|
+
await h("create", i);
|
|
683
|
+
}, [h]), H = r.useCallback(async (i) => {
|
|
684
|
+
const z = i || c;
|
|
685
|
+
z && await B(z);
|
|
686
|
+
}, [c, B]), _ = r.useCallback(async (i) => {
|
|
687
|
+
const z = i || c;
|
|
688
|
+
z && await v(z);
|
|
689
|
+
}, [c, v]), n = r.useMemo(
|
|
690
|
+
() => K.find((i) => i.id === a),
|
|
691
|
+
[K, a]
|
|
692
|
+
), { contentSlot: m, actionsSlot: l, settingsSlot: p } = r.useMemo(() => {
|
|
693
|
+
let i = null, z = null, q = null;
|
|
694
|
+
const R = [];
|
|
695
|
+
return r.Children.forEach(g, (N) => {
|
|
696
|
+
r.isValidElement(N) ? N.type === pe ? i = N.props.children : N.type === fe ? z = N.props.children : N.type === ve ? q = N.props.children : R.push(N) : R.push(N);
|
|
697
|
+
}), !i && R.length > 0 && (i = R), {
|
|
698
|
+
contentSlot: i,
|
|
699
|
+
actionsSlot: z,
|
|
700
|
+
settingsSlot: q
|
|
701
|
+
};
|
|
702
|
+
}, [g]), M = r.useCallback(() => j(!0), [j]), D = r.useCallback(() => h("update"), [h]), V = r.useMemo(
|
|
703
|
+
() => ({
|
|
704
|
+
isDirty: x,
|
|
705
|
+
isSystemBookmark: Y,
|
|
706
|
+
activeBookmark: Q,
|
|
707
|
+
openCreateDialog: M,
|
|
708
|
+
openRenameDialog: G,
|
|
709
|
+
handleRevert: b,
|
|
710
|
+
handleUpdate: D,
|
|
711
|
+
handleDelete: H,
|
|
712
|
+
handleSetDefault: _
|
|
713
|
+
}),
|
|
714
|
+
[
|
|
715
|
+
x,
|
|
716
|
+
Y,
|
|
717
|
+
Q,
|
|
718
|
+
M,
|
|
719
|
+
G,
|
|
720
|
+
b,
|
|
721
|
+
D,
|
|
722
|
+
H,
|
|
723
|
+
_
|
|
724
|
+
]
|
|
725
|
+
);
|
|
726
|
+
return t === "tabs" ? /* @__PURE__ */ s(ae.Provider, { value: V, children: [
|
|
727
|
+
/* @__PURE__ */ e(
|
|
728
|
+
Ge,
|
|
729
|
+
{
|
|
730
|
+
bookmarks: o,
|
|
731
|
+
systemBookmarks: u,
|
|
732
|
+
activeBookmarkId: c,
|
|
733
|
+
"aria-label": S,
|
|
734
|
+
onSelect: k,
|
|
735
|
+
onRename: G,
|
|
736
|
+
onDelete: H,
|
|
737
|
+
onSetDefault: _,
|
|
738
|
+
onBookmarkHover: W,
|
|
739
|
+
onOverflowMenuChange: A
|
|
740
|
+
}
|
|
741
|
+
),
|
|
742
|
+
(m || l || p) && /* @__PURE__ */ s("div", { className: "flex items-center", children: [
|
|
743
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-[7px] flex-1 min-w-0 overflow-hidden", children: [
|
|
744
|
+
m && /* @__PURE__ */ e("div", { className: "flex items-center gap-[7px] min-w-0", children: m }),
|
|
745
|
+
l && /* @__PURE__ */ e("div", { className: "flex items-center gap-[7px] flex-shrink-0", children: l })
|
|
746
|
+
] }),
|
|
747
|
+
p && /* @__PURE__ */ s(O, { children: [
|
|
748
|
+
/* @__PURE__ */ e("div", { className: "w-[var(--space-m)]" }),
|
|
749
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: p })
|
|
750
|
+
] })
|
|
751
|
+
] }),
|
|
752
|
+
/* @__PURE__ */ e(
|
|
753
|
+
te,
|
|
754
|
+
{
|
|
755
|
+
open: C,
|
|
756
|
+
onOpenChange: j,
|
|
757
|
+
mode: "create",
|
|
758
|
+
onSave: ee
|
|
759
|
+
}
|
|
760
|
+
),
|
|
761
|
+
/* @__PURE__ */ e(
|
|
762
|
+
te,
|
|
763
|
+
{
|
|
764
|
+
open: F,
|
|
765
|
+
onOpenChange: $,
|
|
766
|
+
mode: "rename",
|
|
767
|
+
initialName: n?.name,
|
|
768
|
+
onSave: Z
|
|
769
|
+
}
|
|
770
|
+
)
|
|
771
|
+
] }) : /* @__PURE__ */ s(ae.Provider, { value: V, children: [
|
|
772
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-[var(--space-m)]", children: [
|
|
773
|
+
/* @__PURE__ */ e(
|
|
774
|
+
$e,
|
|
775
|
+
{
|
|
776
|
+
bookmarks: o,
|
|
777
|
+
systemBookmarks: u,
|
|
778
|
+
activeBookmarkId: c,
|
|
779
|
+
onSelect: k,
|
|
780
|
+
onRename: () => G(),
|
|
781
|
+
onDelete: () => H(),
|
|
782
|
+
onSetDefault: () => _()
|
|
783
|
+
}
|
|
784
|
+
),
|
|
785
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-[7px] flex-1 min-w-0 overflow-hidden", children: [
|
|
786
|
+
m && /* @__PURE__ */ e("div", { className: "flex items-center gap-[7px]", children: m }),
|
|
787
|
+
l && /* @__PURE__ */ e("div", { className: "flex items-center gap-[7px] flex-shrink-0", children: l })
|
|
788
|
+
] }),
|
|
789
|
+
p && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: p })
|
|
790
|
+
] }),
|
|
791
|
+
/* @__PURE__ */ e(
|
|
792
|
+
te,
|
|
793
|
+
{
|
|
794
|
+
open: C,
|
|
795
|
+
onOpenChange: j,
|
|
796
|
+
mode: "create",
|
|
797
|
+
onSave: ee
|
|
798
|
+
}
|
|
799
|
+
),
|
|
800
|
+
/* @__PURE__ */ e(
|
|
801
|
+
te,
|
|
802
|
+
{
|
|
803
|
+
open: F,
|
|
804
|
+
onOpenChange: $,
|
|
805
|
+
mode: "rename",
|
|
806
|
+
initialName: n?.name,
|
|
807
|
+
onSave: Z
|
|
808
|
+
}
|
|
809
|
+
)
|
|
810
|
+
] });
|
|
811
|
+
}
|
|
812
|
+
E.Content = pe;
|
|
813
|
+
E.Actions = fe;
|
|
814
|
+
E.Settings = ve;
|
|
815
|
+
E.DefaultActions = _e;
|
|
816
|
+
E.RevertButton = ge;
|
|
817
|
+
E.CreateButton = be;
|
|
818
|
+
E.SaveButton = He;
|
|
819
|
+
E.ResetButton = xe;
|
|
820
|
+
E.SaveDropdown = we;
|
|
821
|
+
export {
|
|
822
|
+
E as Bookmarks,
|
|
823
|
+
fe as BookmarksActions,
|
|
824
|
+
pe as BookmarksContent,
|
|
825
|
+
be as BookmarksCreateButton,
|
|
826
|
+
_e as BookmarksDefaultActions,
|
|
827
|
+
xe as BookmarksResetButton,
|
|
828
|
+
ge as BookmarksRevertButton,
|
|
829
|
+
He as BookmarksSaveButton,
|
|
830
|
+
we as BookmarksSaveDropdown,
|
|
831
|
+
ve as BookmarksSettings,
|
|
832
|
+
J as useBookmarksActions
|
|
833
|
+
};
|