@brightlocal/ui-components 3.4.0 → 3.5.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/AI_USAGE.md +22 -3
- package/README.md +177 -109
- package/component-meta.json +1061 -102
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +13 -2
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +4 -3
- package/dist/banner.cjs +1 -1
- package/dist/banner.d.ts +47 -11
- package/dist/banner.d.ts.map +1 -1
- package/dist/banner.js +156 -79
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +40 -5
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +59 -52
- package/dist/blocks/input-list.d.ts +1 -0
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +12 -6
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +64 -63
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +47 -43
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +12 -0
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +115 -97
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +6 -10
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +281 -296
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +430 -343
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -2
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +212 -207
- package/dist/count-indicator.cjs +1 -0
- package/dist/count-indicator.d.ts +85 -0
- package/dist/count-indicator.d.ts.map +1 -0
- package/dist/count-indicator.js +72 -0
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +101 -11
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +593 -523
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +26 -3
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +62 -47
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts +8 -4
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +37 -38
- package/dist/file-upload.cjs +1 -0
- package/dist/file-upload.d.ts +546 -0
- package/dist/file-upload.d.ts.map +1 -0
- package/dist/file-upload.js +1103 -0
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +7 -2
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +52 -52
- package/dist/hooks/use-file-dropzone.cjs +1 -0
- package/dist/hooks/use-file-dropzone.d.ts +75 -0
- package/dist/hooks/use-file-dropzone.d.ts.map +1 -0
- package/dist/hooks/use-file-dropzone.js +133 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts +29 -16
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +153 -36
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +676 -640
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.d.ts +30 -1
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +131 -115
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +37 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +131 -114
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.js +6 -6
- package/dist/lib/empty-canvas.cjs +1 -1
- package/dist/lib/empty-canvas.d.ts +27 -1
- package/dist/lib/empty-canvas.d.ts.map +1 -1
- package/dist/lib/empty-canvas.js +27 -23
- package/dist/lib/empty-chip.cjs +1 -1
- package/dist/lib/empty-chip.d.ts +19 -2
- package/dist/lib/empty-chip.d.ts.map +1 -1
- package/dist/lib/empty-chip.js +14 -9
- package/dist/lib/field-aria.cjs +1 -1
- package/dist/lib/field-aria.d.ts +4 -4
- package/dist/lib/field-aria.d.ts.map +1 -1
- package/dist/lib/field-aria.js +7 -5
- package/dist/lib/media-viewer-content.cjs +1 -1
- package/dist/lib/media-viewer-content.js +1 -1
- package/dist/lib/table-internal.cjs +1 -1
- package/dist/lib/table-internal.d.ts +19 -0
- package/dist/lib/table-internal.d.ts.map +1 -1
- package/dist/lib/table-internal.js +22 -7
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +13 -0
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +103 -82
- package/dist/logo-mark.cjs +1 -1
- package/dist/logo-mark.d.ts +18 -2
- package/dist/logo-mark.d.ts.map +1 -1
- package/dist/logo-mark.js +159 -79
- package/dist/media-empty.cjs +1 -1
- package/dist/media-empty.d.ts +50 -7
- package/dist/media-empty.d.ts.map +1 -1
- package/dist/media-empty.js +14 -13
- package/dist/media-viewer.cjs +1 -1
- package/dist/media-viewer.js +6 -6
- package/dist/multi-select-filter.cjs +1 -1
- package/dist/multi-select-filter.d.ts.map +1 -1
- package/dist/multi-select-filter.js +92 -101
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +11 -0
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +17 -17
- package/dist/relative-date.d.ts +6 -0
- package/dist/relative-date.d.ts.map +1 -1
- package/dist/resizable.d.ts +1 -1
- package/dist/result-count.cjs +1 -1
- package/dist/result-count.d.ts +13 -16
- package/dist/result-count.d.ts.map +1 -1
- package/dist/result-count.js +24 -33
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +22 -3
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +152 -125
- package/dist/single-select-filter.cjs +1 -1
- package/dist/single-select-filter.d.ts.map +1 -1
- package/dist/single-select-filter.js +67 -76
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +77 -76
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +39 -3
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +127 -76
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.d.ts +34 -0
- package/dist/textarea.d.ts.map +1 -1
- package/dist/textarea.js +115 -19
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +137 -131
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +6 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +14 -13
- package/package.json +3 -4
- package/src/blocks/empty-state.tsx +108 -48
- package/src/blocks/input-list.tsx +1 -0
- package/src/blocks/sidebar.tsx +39 -16
- package/src/components/alert-dialog.tsx +18 -2
- package/src/components/banner.tsx +247 -68
- package/src/components/button.tsx +27 -10
- package/src/components/card.tsx +89 -7
- package/src/components/chart.tsx +47 -67
- package/src/components/combobox.tsx +221 -12
- package/src/components/command.tsx +83 -37
- package/src/components/count-indicator.tsx +188 -0
- package/src/components/data-table.tsx +506 -159
- package/src/components/dialog.tsx +74 -5
- package/src/components/drawer.tsx +52 -32
- package/src/components/file-upload.tsx +2574 -0
- package/src/components/global-layout.tsx +18 -5
- package/src/components/hover-card.tsx +395 -65
- package/src/components/input-chip.tsx +67 -2
- package/src/components/input-group.tsx +89 -6
- package/src/components/list.tsx +40 -3
- package/src/components/logo-mark.tsx +109 -25
- package/src/components/media-empty.tsx +62 -7
- package/src/components/multi-select-filter.tsx +9 -16
- package/src/components/pagination.tsx +15 -2
- package/src/components/relative-date.tsx +6 -0
- package/src/components/result-count.tsx +27 -54
- package/src/components/sheet.tsx +86 -8
- package/src/components/single-select-filter.tsx +9 -16
- package/src/components/table.tsx +16 -1
- package/src/components/tabs.tsx +223 -41
- package/src/components/textarea.tsx +271 -4
- package/src/components/tooltip.tsx +29 -2
- package/src/components/typography-text.tsx +7 -2
- package/src/hooks/use-file-dropzone.ts +325 -0
- package/src/index.ts +3 -0
- package/src/lib/empty-canvas.tsx +47 -20
- package/src/lib/empty-chip.tsx +38 -3
- package/src/lib/field-aria.tsx +11 -6
- package/src/lib/table-internal.ts +38 -0
package/dist/command.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { hasEmptyActions as O } from "./lib/empty-chip.js";
|
|
3
|
+
import { EmptyState as U } from "./blocks/empty-state.js";
|
|
3
4
|
import * as e from "react";
|
|
4
|
-
import { Check as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { jsx as
|
|
5
|
+
import { Check as K, Search as W, X } from "@brightlocal/icons";
|
|
6
|
+
import { cn as N } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
+
import { jsx as m, jsxs as T } from "react/jsx-runtime";
|
|
7
8
|
import { Button as Y } from "@brightlocal/ui-components/button";
|
|
8
|
-
import { useDevWarning as
|
|
9
|
-
import { useVirtualizer as
|
|
10
|
-
import { Command as P, defaultFilter as
|
|
11
|
-
var
|
|
9
|
+
import { useDevWarning as J } from "@brightlocal/ui-components/lib/use-dev-warning";
|
|
10
|
+
import { useVirtualizer as Q } from "@tanstack/react-virtual";
|
|
11
|
+
import { Command as P, defaultFilter as j } from "cmdk";
|
|
12
|
+
var _ = e.createContext({
|
|
12
13
|
searchValue: "",
|
|
13
14
|
setSearchValue: () => {
|
|
14
15
|
},
|
|
@@ -18,324 +19,328 @@ var $ = e.createContext({
|
|
|
18
19
|
listboxId: void 0,
|
|
19
20
|
setListboxId: () => {
|
|
20
21
|
}
|
|
21
|
-
}),
|
|
22
|
-
const [
|
|
23
|
-
searchValue:
|
|
24
|
-
setSearchValue:
|
|
25
|
-
activeDescendantId:
|
|
26
|
-
setActiveDescendantId:
|
|
27
|
-
listboxId:
|
|
28
|
-
setListboxId:
|
|
22
|
+
}), Z = e.forwardRef(({ className: t, dataHook: a, trackingEl: n, trackingLabel: o, ...r }, c) => {
|
|
23
|
+
const [u, p] = e.useState(""), [h, I] = e.useState(void 0), [k, s] = e.useState(void 0), v = e.useMemo(() => ({
|
|
24
|
+
searchValue: u,
|
|
25
|
+
setSearchValue: p,
|
|
26
|
+
activeDescendantId: h,
|
|
27
|
+
setActiveDescendantId: I,
|
|
28
|
+
listboxId: k,
|
|
29
|
+
setListboxId: s
|
|
29
30
|
}), [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
u,
|
|
32
|
+
h,
|
|
33
|
+
k
|
|
33
34
|
]);
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
value:
|
|
36
|
-
children: /* @__PURE__ */
|
|
37
|
-
ref:
|
|
38
|
-
className:
|
|
35
|
+
return /* @__PURE__ */ m(_.Provider, {
|
|
36
|
+
value: v,
|
|
37
|
+
children: /* @__PURE__ */ m(P, {
|
|
38
|
+
ref: c,
|
|
39
|
+
className: N("bg-popover text-popover-foreground flex w-full flex-col overflow-hidden rounded-lg border shadow-md", t),
|
|
39
40
|
"data-hook": a,
|
|
40
41
|
"data-slot": "command",
|
|
41
42
|
"data-tracking-el": n,
|
|
42
43
|
"data-tracking-label": o,
|
|
43
|
-
...
|
|
44
|
+
...r
|
|
44
45
|
})
|
|
45
46
|
});
|
|
46
47
|
});
|
|
47
|
-
|
|
48
|
-
var
|
|
49
|
-
const
|
|
50
|
-
e.useImperativeHandle(
|
|
51
|
-
|
|
48
|
+
Z.displayName = "Command";
|
|
49
|
+
var ee = e.forwardRef(({ className: t, dataHook: a, trackingEl: n, trackingLabel: o, value: r, onValueChange: c, onClear: u, debounceMs: p, clearSearchAriaLabel: h, ...I }, k) => {
|
|
50
|
+
const s = e.useRef(null), [v, y] = e.useState(""), i = e.useRef(void 0), { setSearchValue: R, activeDescendantId: C, listboxId: f } = e.useContext(_);
|
|
51
|
+
e.useImperativeHandle(k, () => s.current, []), J(() => !!(p && p > 0 && r !== void 0), "debounceMs is set on <CommandInput> together with a controlled `value` prop.\nThe debounced onValueChange callback cannot update the controlled value synchronously, so the input will appear to lag behind typing.\nRemove `value` to let the input manage its own display, or remove debounceMs if you need a controlled input.", [p, r]), e.useEffect(() => () => {
|
|
52
|
+
i.current && clearTimeout(i.current);
|
|
52
53
|
}, []), e.useEffect(() => {
|
|
53
|
-
const
|
|
54
|
-
|
|
54
|
+
const x = s.current;
|
|
55
|
+
!x || !f || (x.setAttribute("aria-controls", f), C ? x.setAttribute("aria-activedescendant", C) : x.removeAttribute("aria-activedescendant"));
|
|
55
56
|
});
|
|
56
|
-
const E =
|
|
57
|
-
E ||
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
E ||
|
|
57
|
+
const E = r !== void 0, S = E ? r : v, L = String(S).length > 0, M = (x) => {
|
|
58
|
+
E || y(x), R(x), p && p > 0 ? (clearTimeout(i.current), i.current = setTimeout(() => {
|
|
59
|
+
c?.(x);
|
|
60
|
+
}, p)) : c?.(x);
|
|
61
|
+
}, g = () => {
|
|
62
|
+
E || y(""), R(""), clearTimeout(i.current), c?.(""), u?.(), s.current?.focus();
|
|
62
63
|
};
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
+
return /* @__PURE__ */ T("div", {
|
|
64
65
|
className: "border-base-border flex h-12 items-center gap-2 self-stretch border-b px-3",
|
|
65
66
|
"data-hook": a,
|
|
66
67
|
"data-slot": "command-input-wrapper",
|
|
67
68
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
ref:
|
|
71
|
-
className:
|
|
69
|
+
/* @__PURE__ */ m(W, { className: "shrink-0 opacity-50" }),
|
|
70
|
+
/* @__PURE__ */ m(P.Input, {
|
|
71
|
+
ref: s,
|
|
72
|
+
className: N("placeholder:text-muted-foreground text-field flex w-full bg-transparent outline-hidden disabled:cursor-not-allowed disabled:opacity-50", t),
|
|
72
73
|
"data-slot": "command-input",
|
|
73
74
|
"data-tracking-el": n,
|
|
74
75
|
"data-tracking-label": o,
|
|
75
76
|
value: S,
|
|
76
77
|
onValueChange: M,
|
|
77
|
-
...
|
|
78
|
+
...I
|
|
78
79
|
}),
|
|
79
|
-
|
|
80
|
-
"aria-label":
|
|
80
|
+
L && /* @__PURE__ */ m(Y, {
|
|
81
|
+
"aria-label": h ?? "Clear search",
|
|
81
82
|
className: "text-muted-foreground hover:text-foreground size-6 p-0",
|
|
82
83
|
dataHook: "command-input-clear",
|
|
83
84
|
variant: "ghost",
|
|
84
|
-
onClick:
|
|
85
|
-
children: /* @__PURE__ */
|
|
85
|
+
onClick: g,
|
|
86
|
+
children: /* @__PURE__ */ m(X, {})
|
|
86
87
|
})
|
|
87
88
|
]
|
|
88
89
|
});
|
|
89
90
|
});
|
|
90
|
-
|
|
91
|
-
var
|
|
91
|
+
ee.displayName = "CommandInput";
|
|
92
|
+
var te = e.forwardRef(({ className: t, dataHook: a, ...n }, o) => /* @__PURE__ */ m(P.List, {
|
|
92
93
|
ref: o,
|
|
93
|
-
className:
|
|
94
|
+
className: N("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", t),
|
|
94
95
|
"data-hook": a,
|
|
95
96
|
"data-slot": "command-list",
|
|
96
97
|
...n
|
|
97
98
|
}));
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
const p = e.useCallback((
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"
|
|
99
|
+
te.displayName = "CommandList";
|
|
100
|
+
var ae = e.forwardRef(({ children: t, dataHook: a, description: n, icon: o, title: r, ...c }, u) => {
|
|
101
|
+
const p = !!(o || n) || r !== void 0, h = r !== void 0 && O(t), I = e.useId(), k = e.useCallback((s) => {
|
|
102
|
+
if (s) {
|
|
103
|
+
s.setAttribute("role", h ? "group" : "option");
|
|
104
|
+
const v = h ? s.querySelector('[data-slot="empty-state-title"]') : null;
|
|
105
|
+
v ? (v.id || (v.id = I), s.setAttribute("aria-labelledby", v.id)) : s.removeAttribute("aria-labelledby");
|
|
106
|
+
}
|
|
107
|
+
typeof u == "function" ? u(s) : u && (u.current = s);
|
|
108
|
+
}, [
|
|
109
|
+
u,
|
|
110
|
+
h,
|
|
111
|
+
I
|
|
112
|
+
]);
|
|
113
|
+
return /* @__PURE__ */ m(P.Empty, {
|
|
114
|
+
ref: k,
|
|
115
|
+
...h ? {} : {
|
|
116
|
+
"aria-disabled": "true",
|
|
117
|
+
"aria-selected": "false"
|
|
118
|
+
},
|
|
107
119
|
className: "text-body-sm py-6 text-center",
|
|
108
120
|
"data-hook": a,
|
|
109
121
|
"data-slot": "command-empty",
|
|
122
|
+
onKeyDown: h ? (s) => {
|
|
123
|
+
s.key === "Enter" && s.stopPropagation();
|
|
124
|
+
} : void 0,
|
|
110
125
|
...c,
|
|
111
|
-
children:
|
|
112
|
-
className: "
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
/* @__PURE__ */ s("p", {
|
|
121
|
-
"data-slot": "command-empty-message",
|
|
122
|
-
children: t
|
|
123
|
-
}),
|
|
124
|
-
n ? /* @__PURE__ */ s("p", {
|
|
125
|
-
className: "text-muted-foreground",
|
|
126
|
-
"data-slot": "command-empty-description",
|
|
127
|
-
children: n
|
|
128
|
-
}) : null
|
|
129
|
-
]
|
|
126
|
+
children: p ? /* @__PURE__ */ m(U, {
|
|
127
|
+
className: "px-4",
|
|
128
|
+
"data-hook": void 0,
|
|
129
|
+
dataHook: a ?? "command-empty",
|
|
130
|
+
description: n,
|
|
131
|
+
icon: o,
|
|
132
|
+
size: "sm",
|
|
133
|
+
title: r === void 0 ? t : r,
|
|
134
|
+
children: h ? t : null
|
|
130
135
|
}) : t
|
|
131
136
|
});
|
|
132
137
|
});
|
|
133
|
-
|
|
134
|
-
var
|
|
138
|
+
ae.displayName = "CommandEmpty";
|
|
139
|
+
var oe = e.forwardRef(({ className: t, dataHook: a, ...n }, o) => /* @__PURE__ */ m(P.Group, {
|
|
135
140
|
ref: o,
|
|
136
|
-
className:
|
|
141
|
+
className: N("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-label-sm overflow-hidden px-2 py-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5", t),
|
|
137
142
|
"data-hook": a,
|
|
138
143
|
"data-slot": "command-group",
|
|
139
144
|
...n
|
|
140
145
|
}));
|
|
141
|
-
|
|
142
|
-
var
|
|
146
|
+
oe.displayName = "CommandGroup";
|
|
147
|
+
var re = e.forwardRef(({ className: t, dataHook: a, ...n }, o) => /* @__PURE__ */ m(P.Separator, {
|
|
143
148
|
ref: o,
|
|
144
|
-
className:
|
|
149
|
+
className: N("bg-border -mx-1 h-px", t),
|
|
145
150
|
"data-hook": a,
|
|
146
151
|
"data-slot": "command-separator",
|
|
147
152
|
...n
|
|
148
153
|
}));
|
|
149
|
-
|
|
150
|
-
var
|
|
151
|
-
ref:
|
|
152
|
-
className:
|
|
154
|
+
re.displayName = "CommandSeparator";
|
|
155
|
+
var ne = e.forwardRef(({ className: t, dataHook: a, trackingEl: n, trackingLabel: o, selected: r, children: c, ...u }, p) => /* @__PURE__ */ T(P.Item, {
|
|
156
|
+
ref: p,
|
|
157
|
+
className: N("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:text-muted-foreground text-label relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-3 outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", t),
|
|
153
158
|
"data-hook": a,
|
|
154
|
-
"data-selected-item":
|
|
159
|
+
"data-selected-item": r || void 0,
|
|
155
160
|
"data-slot": "command-item",
|
|
156
161
|
"data-tracking-el": n,
|
|
157
162
|
"data-tracking-label": o,
|
|
158
|
-
...
|
|
159
|
-
children: [
|
|
163
|
+
...u,
|
|
164
|
+
children: [c, r && /* @__PURE__ */ m(K, { className: "text-foreground ml-auto" })]
|
|
160
165
|
}));
|
|
161
|
-
|
|
162
|
-
var
|
|
163
|
-
ref:
|
|
164
|
-
className:
|
|
166
|
+
ne.displayName = "CommandItem";
|
|
167
|
+
var se = e.forwardRef(({ className: t, dataHook: a, trackingEl: n, trackingLabel: o, ...r }, c) => /* @__PURE__ */ m("span", {
|
|
168
|
+
ref: c,
|
|
169
|
+
className: N("text-muted-foreground text-body-xs ml-auto", t),
|
|
165
170
|
"data-hook": a,
|
|
166
171
|
"data-slot": "command-shortcut",
|
|
167
172
|
"data-tracking-el": n,
|
|
168
173
|
"data-tracking-label": o,
|
|
169
|
-
...
|
|
174
|
+
...r
|
|
170
175
|
}));
|
|
171
|
-
|
|
172
|
-
var
|
|
173
|
-
function
|
|
174
|
-
const
|
|
175
|
-
e.useImperativeHandle(
|
|
176
|
-
const M = e.useMemo(() => n ?? a, [n, a]),
|
|
177
|
-
if (!
|
|
178
|
-
const
|
|
179
|
-
for (const
|
|
180
|
-
let
|
|
181
|
-
if (o) for (const
|
|
182
|
-
|
|
183
|
-
item:
|
|
184
|
-
score:
|
|
176
|
+
se.displayName = "CommandShortcut";
|
|
177
|
+
var q = e.createContext(null);
|
|
178
|
+
function ie({ items: t, getItemValue: a, getItemLabel: n, getItemKeywords: o, estimateSize: r = 44, overscan: c = 5, children: u, renderEmpty: p, "aria-label": h, className: I, dataHook: k }, s) {
|
|
179
|
+
const v = e.useRef(null), { searchValue: y, setActiveDescendantId: i, setListboxId: R } = e.useContext(_), [C, f] = e.useState(0), E = e.useId(), S = e.useId(), L = e.useRef(/* @__PURE__ */ new Map());
|
|
180
|
+
e.useImperativeHandle(s, () => v.current, []);
|
|
181
|
+
const M = e.useMemo(() => n ?? a, [n, a]), g = e.useMemo(() => {
|
|
182
|
+
if (!y.trim()) return t;
|
|
183
|
+
const l = [];
|
|
184
|
+
for (const b of t) {
|
|
185
|
+
let d = j(M(b), y);
|
|
186
|
+
if (o) for (const w of o(b)) d = Math.max(d, j(w, y));
|
|
187
|
+
d > 0 && l.push({
|
|
188
|
+
item: b,
|
|
189
|
+
score: d
|
|
185
190
|
});
|
|
186
191
|
}
|
|
187
|
-
return
|
|
192
|
+
return l.sort((b, d) => d.score - b.score), l.map((b) => b.item);
|
|
188
193
|
}, [
|
|
189
194
|
t,
|
|
190
|
-
|
|
195
|
+
y,
|
|
191
196
|
M,
|
|
192
197
|
o
|
|
193
|
-
]),
|
|
194
|
-
count:
|
|
195
|
-
getScrollElement: () =>
|
|
196
|
-
estimateSize: () =>
|
|
197
|
-
overscan:
|
|
198
|
-
}), D =
|
|
198
|
+
]), x = Q({
|
|
199
|
+
count: g.length,
|
|
200
|
+
getScrollElement: () => v.current,
|
|
201
|
+
estimateSize: () => r,
|
|
202
|
+
overscan: c
|
|
203
|
+
}), D = C >= 0 && C < g.length ? a(g[C]) : null;
|
|
199
204
|
e.useEffect(() => {
|
|
200
|
-
|
|
201
|
-
}, [
|
|
202
|
-
const
|
|
205
|
+
f(0);
|
|
206
|
+
}, [y, g.length]);
|
|
207
|
+
const A = e.useRef(!1);
|
|
203
208
|
e.useEffect(() => {
|
|
204
|
-
|
|
209
|
+
A.current && C >= 0 && C < g.length && x.scrollToIndex(C, { align: "auto" }), A.current = !1;
|
|
205
210
|
}, [
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
211
|
+
C,
|
|
212
|
+
g.length,
|
|
213
|
+
x
|
|
209
214
|
]), e.useEffect(() => {
|
|
210
|
-
const
|
|
211
|
-
if (!
|
|
212
|
-
const
|
|
213
|
-
switch (
|
|
215
|
+
const l = v.current?.closest('[data-slot="command"]');
|
|
216
|
+
if (!l) return;
|
|
217
|
+
const b = (d) => {
|
|
218
|
+
switch (d.key) {
|
|
214
219
|
case "ArrowDown":
|
|
215
|
-
|
|
220
|
+
d.preventDefault(), d.stopPropagation(), A.current = !0, f((w) => w < g.length - 1 ? w + 1 : w);
|
|
216
221
|
break;
|
|
217
222
|
case "ArrowUp":
|
|
218
|
-
|
|
223
|
+
d.preventDefault(), d.stopPropagation(), A.current = !0, f((w) => w > 0 ? w - 1 : w);
|
|
219
224
|
break;
|
|
220
225
|
case "Enter":
|
|
221
|
-
|
|
226
|
+
d.preventDefault(), d.stopPropagation(), D != null && L.current.get(D)?.();
|
|
222
227
|
break;
|
|
223
228
|
case "Home":
|
|
224
|
-
|
|
229
|
+
d.preventDefault(), d.stopPropagation(), A.current = !0, f(0);
|
|
225
230
|
break;
|
|
226
231
|
case "End":
|
|
227
|
-
|
|
232
|
+
d.preventDefault(), d.stopPropagation(), A.current = !0, f(g.length - 1);
|
|
228
233
|
}
|
|
229
234
|
};
|
|
230
|
-
return
|
|
231
|
-
}, [
|
|
235
|
+
return l.addEventListener("keydown", b, { capture: !0 }), () => l.removeEventListener("keydown", b, { capture: !0 });
|
|
236
|
+
}, [g, D]);
|
|
232
237
|
const V = e.useMemo(() => {
|
|
233
|
-
const
|
|
234
|
-
return
|
|
235
|
-
|
|
236
|
-
}),
|
|
237
|
-
}, [
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
}, [V]),
|
|
238
|
+
const l = /* @__PURE__ */ new Map();
|
|
239
|
+
return g.forEach((b, d) => {
|
|
240
|
+
l.set(a(b), d);
|
|
241
|
+
}), l;
|
|
242
|
+
}, [g, a]), z = e.useCallback((l) => {
|
|
243
|
+
const b = V.get(l);
|
|
244
|
+
b !== void 0 && f(b);
|
|
245
|
+
}, [V]), $ = e.useCallback((l) => (V.get(l) ?? 0) + 1, [V]), H = g.length, F = e.useMemo(() => ({
|
|
241
246
|
activeValue: D,
|
|
242
|
-
onItemPointerMove:
|
|
247
|
+
onItemPointerMove: z,
|
|
243
248
|
idPrefix: E,
|
|
244
249
|
filteredCount: H,
|
|
245
|
-
getItemPosition:
|
|
246
|
-
onSelectCallbacks:
|
|
250
|
+
getItemPosition: $,
|
|
251
|
+
onSelectCallbacks: L
|
|
247
252
|
}), [
|
|
248
253
|
D,
|
|
249
|
-
|
|
254
|
+
z,
|
|
250
255
|
E,
|
|
251
256
|
H,
|
|
252
|
-
|
|
253
|
-
]),
|
|
254
|
-
e.useEffect(() => (
|
|
255
|
-
const
|
|
256
|
-
return
|
|
257
|
-
ref:
|
|
258
|
-
"aria-label":
|
|
259
|
-
className:
|
|
260
|
-
"data-hook":
|
|
257
|
+
$
|
|
258
|
+
]), B = D != null ? `${E}item-${D}` : void 0;
|
|
259
|
+
e.useEffect(() => (i(B), () => i(void 0)), [B, i]), e.useEffect(() => (R(S), () => R(void 0)), [S, R]);
|
|
260
|
+
const G = N("scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1", I);
|
|
261
|
+
return g.length === 0 ? /* @__PURE__ */ m("div", {
|
|
262
|
+
ref: v,
|
|
263
|
+
"aria-label": h,
|
|
264
|
+
className: G,
|
|
265
|
+
"data-hook": k,
|
|
261
266
|
"data-slot": "command-virtual-list",
|
|
262
267
|
id: S,
|
|
263
268
|
role: "listbox",
|
|
264
269
|
tabIndex: -1,
|
|
265
|
-
children:
|
|
266
|
-
}) : /* @__PURE__ */
|
|
267
|
-
value:
|
|
268
|
-
children: /* @__PURE__ */
|
|
269
|
-
ref:
|
|
270
|
-
"aria-label":
|
|
271
|
-
className:
|
|
272
|
-
"data-hook":
|
|
270
|
+
children: p
|
|
271
|
+
}) : /* @__PURE__ */ m(q.Provider, {
|
|
272
|
+
value: F,
|
|
273
|
+
children: /* @__PURE__ */ m("div", {
|
|
274
|
+
ref: v,
|
|
275
|
+
"aria-label": h,
|
|
276
|
+
className: G,
|
|
277
|
+
"data-hook": k,
|
|
273
278
|
"data-slot": "command-virtual-list",
|
|
274
279
|
id: S,
|
|
275
280
|
role: "listbox",
|
|
276
281
|
tabIndex: -1,
|
|
277
|
-
children: /* @__PURE__ */
|
|
282
|
+
children: /* @__PURE__ */ m("div", {
|
|
278
283
|
className: "relative w-full",
|
|
279
|
-
style: { height: `${
|
|
280
|
-
children:
|
|
281
|
-
ref:
|
|
284
|
+
style: { height: `${x.getTotalSize()}px` },
|
|
285
|
+
children: x.getVirtualItems().map((l) => /* @__PURE__ */ m("div", {
|
|
286
|
+
ref: x.measureElement,
|
|
282
287
|
className: "absolute top-0 left-0 w-full px-2",
|
|
283
|
-
"data-index":
|
|
284
|
-
style: { transform: `translateY(${
|
|
285
|
-
children:
|
|
286
|
-
},
|
|
288
|
+
"data-index": l.index,
|
|
289
|
+
style: { transform: `translateY(${l.start}px)` },
|
|
290
|
+
children: u(g[l.index], l.index, y)
|
|
291
|
+
}, l.key))
|
|
287
292
|
})
|
|
288
293
|
})
|
|
289
294
|
});
|
|
290
295
|
}
|
|
291
|
-
var
|
|
292
|
-
const
|
|
296
|
+
var xe = e.forwardRef(ie), le = e.forwardRef(({ value: t, dataHook: a, trackingEl: n, trackingLabel: o, selected: r, disabled: c, onSelect: u, children: p, className: h, onClick: I, onKeyDown: k, onPointerMove: s, ...v }, y) => {
|
|
297
|
+
const i = e.useContext(q), R = i?.activeValue === t, C = e.useRef(u);
|
|
293
298
|
return e.useEffect(() => {
|
|
294
|
-
|
|
299
|
+
C.current = u;
|
|
295
300
|
}), e.useEffect(() => {
|
|
296
|
-
if (
|
|
297
|
-
return
|
|
298
|
-
|
|
301
|
+
if (i)
|
|
302
|
+
return i.onSelectCallbacks.current.set(t, () => C.current?.()), () => {
|
|
303
|
+
i.onSelectCallbacks.current.delete(t);
|
|
299
304
|
};
|
|
300
|
-
}, [t,
|
|
301
|
-
ref:
|
|
302
|
-
...
|
|
303
|
-
"aria-disabled":
|
|
304
|
-
"aria-posinset":
|
|
305
|
-
"aria-selected":
|
|
306
|
-
"aria-setsize":
|
|
307
|
-
className:
|
|
308
|
-
"data-highlighted":
|
|
305
|
+
}, [t, i]), /* @__PURE__ */ T("div", {
|
|
306
|
+
ref: y,
|
|
307
|
+
...v,
|
|
308
|
+
"aria-disabled": c || void 0,
|
|
309
|
+
"aria-posinset": i?.getItemPosition(t),
|
|
310
|
+
"aria-selected": r || void 0,
|
|
311
|
+
"aria-setsize": i?.filteredCount,
|
|
312
|
+
className: N("data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground text-label relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-3 outline-hidden select-none", "[&_svg]:pointer-events-none [&_svg]:shrink-0", c && "pointer-events-none opacity-50", h),
|
|
313
|
+
"data-highlighted": R || void 0,
|
|
309
314
|
"data-hook": a,
|
|
310
|
-
"data-selected-item":
|
|
315
|
+
"data-selected-item": r || void 0,
|
|
311
316
|
"data-slot": "command-virtual-item",
|
|
312
317
|
"data-tracking-el": n,
|
|
313
318
|
"data-tracking-label": o,
|
|
314
|
-
id:
|
|
319
|
+
id: i ? `${i.idPrefix}item-${t}` : void 0,
|
|
315
320
|
role: "option",
|
|
316
321
|
tabIndex: -1,
|
|
317
|
-
onClick:
|
|
318
|
-
|
|
322
|
+
onClick: c ? void 0 : (f) => {
|
|
323
|
+
u?.(), I?.(f);
|
|
319
324
|
},
|
|
320
|
-
onKeyDown:
|
|
321
|
-
(
|
|
325
|
+
onKeyDown: c ? void 0 : (f) => {
|
|
326
|
+
(f.key === "Enter" || f.key === " ") && u?.(), k?.(f);
|
|
322
327
|
},
|
|
323
|
-
onPointerMove:
|
|
324
|
-
|
|
328
|
+
onPointerMove: c ? void 0 : (f) => {
|
|
329
|
+
i?.onItemPointerMove(t), s?.(f);
|
|
325
330
|
},
|
|
326
|
-
children: [
|
|
331
|
+
children: [p, r && /* @__PURE__ */ m(K, { className: "text-foreground ml-auto" })]
|
|
327
332
|
});
|
|
328
333
|
});
|
|
329
334
|
le.displayName = "CommandVirtualItem";
|
|
330
335
|
export {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
336
|
+
Z as Command,
|
|
337
|
+
ae as CommandEmpty,
|
|
338
|
+
oe as CommandGroup,
|
|
339
|
+
ee as CommandInput,
|
|
340
|
+
ne as CommandItem,
|
|
341
|
+
te as CommandList,
|
|
342
|
+
re as CommandSeparator,
|
|
343
|
+
se as CommandShortcut,
|
|
339
344
|
le as CommandVirtualItem,
|
|
340
|
-
|
|
345
|
+
xe as CommandVirtualList
|
|
341
346
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";const I=require("./_virtual/_rolldown/runtime.cjs"),b=require("./lib/field-aria.cjs");let n=require("react");n=I.__toESM(n,1);let C=require("@brightlocal/ui-components/lib/utils"),r=require("react/jsx-runtime");var S={value:(t,a)=>`${t} of ${a}`,over:t=>`${t} over the limit`};function x(t,a){return t>a?"over":"neutral"}var _=n.forwardRef(({className:t,dataHook:a,count:s,limit:o,labels:f,ready:u=!0,id:v,trackingEl:g,trackingLabel:h,...m},p)=>{const q=n.useId(),c=v??q,l={...S,...f},e=x(s,o);b.useFieldAriaRegistration("count",c,!0);const[i,d]=n.useState({state:e,text:"",seeded:u});u?i.seeded?i.state!==e&&d({state:e,text:e==="over"?l.over(s-o):"",seeded:!0}):d({state:e,text:"",seeded:!0}):i.seeded&&d({state:e,text:"",seeded:!1});const j=i.text;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{ref:p,className:(0,C.cn)("text-body-xs shrink-0 tabular-nums",e==="neutral"&&"text-muted-foreground",e==="over"&&"text-destructive-foreground",t),"data-hook":a,"data-slot":"count-indicator","data-state":e,"data-tracking-el":g,"data-tracking-label":h,id:c,...m,children:[(0,r.jsxs)("span",{"aria-hidden":"true",children:[s," / ",o]}),(0,r.jsx)("span",{className:"sr-only",children:l.value(s,o)})]}),(0,r.jsx)("span",{"aria-atomic":"true","aria-live":"polite",className:"sr-only","data-slot":"count-indicator-announcer",role:"status",children:j})]})});_.displayName="CountIndicator";exports.CountIndicator=_;exports.getCountState=x;
|