@actioneer/ads 0.5.4 → 0.5.5
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/components/accordion.js +15 -15
- package/components/agent-icon.d.ts +64 -0
- package/components/agent-icon.js +251 -0
- package/components/ai-elements/agent-trace.d.ts +8 -1
- package/components/ai-elements/agent-trace.js +164 -129
- package/components/ai-elements/chain-of-thought-icon.d.ts +42 -0
- package/components/ai-elements/chain-of-thought-icon.js +283 -0
- package/components/ai-elements/chain-of-thought.js +7 -7
- package/components/ai-elements/chart.js +38 -35
- package/components/ai-elements/index.d.ts +1 -0
- package/components/ai-elements/inline-citation.js +40 -40
- package/components/ai-elements/message.js +5 -5
- package/components/ai-elements/queue.js +1 -1
- package/components/ai-elements/research-activity.d.ts +2 -0
- package/components/ai-elements/research-activity.js +79 -81
- package/components/ai-elements/task-progress.js +2 -2
- package/components/ai-elements/tool.d.ts +4 -2
- package/components/ai-elements/tool.js +74 -54
- package/components/ai-elements/transcript.js +1 -1
- package/components/alert.js +1 -1
- package/components/answer.d.ts +2643 -311
- package/components/answer.js +1836 -425
- package/components/assistant-ui/answer-tool-ui.js +23 -28
- package/components/assistant-ui/chain-of-thought.d.ts +7 -2
- package/components/assistant-ui/composer-harness.js +20 -16
- package/components/assistant-ui/reasoning.js +35 -31
- package/components/assistant-ui/tool-fallback.js +125 -122
- package/components/assistant-ui/tool-group.d.ts +3 -1
- package/components/assistant-ui/tool-group.js +48 -43
- package/components/audio-waveform.js +14 -14
- package/components/autocomplete.js +52 -48
- package/components/avatar.js +58 -44
- package/components/badge.js +3 -3
- package/components/brand-texture.js +1 -1
- package/components/breadcrumbs.d.ts +27 -1
- package/components/breadcrumbs.js +94 -42
- package/components/button.js +15 -15
- package/components/carousel.js +10 -10
- package/components/chart.js +77 -77
- package/components/chip.js +3 -3
- package/components/code-block.d.ts +39 -17
- package/components/code-block.js +153 -104
- package/components/command-palette.js +27 -25
- package/components/connector-card.js +2 -2
- package/components/dropdown.js +65 -61
- package/components/empty-state.js +15 -15
- package/components/field.js +23 -23
- package/components/index.d.ts +4 -0
- package/components/index.js +523 -477
- package/components/infinite-canvas.js +60 -60
- package/components/kbd.js +6 -6
- package/components/link.js +6 -6
- package/components/modal.js +22 -20
- package/components/page-header.js +1 -1
- package/components/pagination.js +22 -22
- package/components/pixel-blast-svg.js +1 -1
- package/components/pixel-icon.d.ts +31 -0
- package/components/pixel-icon.js +733 -0
- package/components/popover.js +46 -42
- package/components/ripple.d.ts +29 -0
- package/components/ripple.js +17 -0
- package/components/segmented.js +24 -23
- package/components/select.js +71 -67
- package/components/selection-action-bar.js +22 -22
- package/components/sidebar.d.ts +11 -3
- package/components/sidebar.js +161 -148
- package/components/stepper.d.ts +2 -0
- package/components/stepper.js +80 -43
- package/components/table.d.ts +7 -0
- package/components/table.js +223 -155
- package/components/tabs.d.ts +3 -1
- package/components/tabs.js +165 -144
- package/components/textarea.js +10 -8
- package/components/toast.js +48 -46
- package/components/tooltip.js +61 -59
- package/components/tree.js +44 -41
- package/components/typography.d.ts +1 -1
- package/components/typography.js +25 -25
- package/components/viz-charts.js +133 -133
- package/fonts/aribau-grotesk-500.otf +0 -0
- package/fonts/aribau-grotesk-600.woff2 +0 -0
- package/fonts.css +6 -4
- package/lib/icons.d.ts +411 -402
- package/lib/icons.js +109 -107
- package/llms.txt +96 -8
- package/manifest.json +951 -54
- package/package.json +5 -5
- package/styles.css +206 -81
- package/theme.css +200 -77
- package/fonts/aribau-grotesk-400.otf +0 -0
- package/fonts/aribau-grotesk-700.otf +0 -0
package/components/code-block.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import * as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { Check as
|
|
7
|
-
import { cn as
|
|
8
|
-
const
|
|
2
|
+
import { jsxs as v, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import * as s from "react";
|
|
4
|
+
import { cva as _ } from "class-variance-authority";
|
|
5
|
+
import { Button as L } from "./button.js";
|
|
6
|
+
import { Code as q, Check as I, Copy as Z } from "../lib/icons.js";
|
|
7
|
+
import { cn as u } from "../lib/cn.js";
|
|
8
|
+
const G = _(
|
|
9
9
|
// `flex flex-col` so a height cap from the consumer squeezes the <pre>
|
|
10
10
|
// rather than clipping it — the pre is the scroll container, not this.
|
|
11
11
|
"group/code-block relative flex w-full flex-col overflow-hidden rounded-lg text-xs",
|
|
12
12
|
{
|
|
13
13
|
variants: {
|
|
14
14
|
variant: {
|
|
15
|
-
/**
|
|
16
|
-
soft: "bg-
|
|
17
|
-
/**
|
|
15
|
+
/** Outlined toolbar + white outlined source surface — both unfilled. */
|
|
16
|
+
soft: "bg-transparent",
|
|
17
|
+
/** Keeps the toolbar stroke but drops the source fill/outer stroke. */
|
|
18
18
|
plain: "bg-transparent"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
defaultVariants: { variant: "soft" }
|
|
22
22
|
}
|
|
23
|
-
),
|
|
23
|
+
), b = '"(?:[^"\\\\\\n]|\\\\.)*"', y = "'(?:[^'\\\\\\n]|\\\\.)*'", Q = {
|
|
24
24
|
sql: [
|
|
25
25
|
{ kind: "comment", re: /--[^\n]*/y },
|
|
26
|
-
{ kind: "string", re: new RegExp(
|
|
26
|
+
{ kind: "string", re: new RegExp(y, "y") },
|
|
27
27
|
{
|
|
28
28
|
kind: "keyword",
|
|
29
29
|
re: /\b(select|from|where|create|table|index|concurrently|on|and|or|not|null|group|by|order|limit|offset|insert|into|values|update|set|delete|join|left|right|inner|outer|full|as|distinct|case|when|then|else|end|with|union|all|desc|asc|true|false|count|sum|avg|min|max|having)\b/iy
|
|
@@ -32,35 +32,37 @@ const j = C(
|
|
|
32
32
|
{ kind: "punct", re: /[(),;]/y }
|
|
33
33
|
],
|
|
34
34
|
json: [
|
|
35
|
-
{ kind: "string", re: new RegExp(
|
|
35
|
+
{ kind: "string", re: new RegExp(b, "y") },
|
|
36
36
|
{ kind: "keyword", re: /\b(?:true|false|null)\b/y },
|
|
37
37
|
{ kind: "number", re: /-?\b\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/y },
|
|
38
38
|
{ kind: "punct", re: /[{}[\],:]/y }
|
|
39
39
|
],
|
|
40
40
|
yaml: [
|
|
41
41
|
{ kind: "comment", re: /#[^\n]*/y },
|
|
42
|
-
{ kind: "string", re: new RegExp(`${
|
|
42
|
+
{ kind: "string", re: new RegExp(`${b}|${y}`, "y") },
|
|
43
43
|
{ kind: "keyword", re: /\b(?:true|false|null|yes|no)\b/y },
|
|
44
44
|
{ kind: "number", re: /\b\d+(?:\.\d+)?\b/y },
|
|
45
45
|
{ kind: "punct", re: /[-:]/y }
|
|
46
46
|
],
|
|
47
47
|
bash: [
|
|
48
48
|
{ kind: "comment", re: /#[^\n]*/y },
|
|
49
|
-
{ kind: "string", re: new RegExp(`${
|
|
49
|
+
{ kind: "string", re: new RegExp(`${b}|${y}`, "y") },
|
|
50
50
|
{ kind: "keyword", re: /--?[A-Za-z][\w-]*/y },
|
|
51
51
|
{ kind: "number", re: /\b\d+\b/y }
|
|
52
52
|
],
|
|
53
53
|
ts: [
|
|
54
54
|
{ kind: "comment", re: /\/\/[^\n]*|\/\*[\s\S]*?\*\//y },
|
|
55
|
-
{ kind: "string", re: new RegExp(`${
|
|
55
|
+
{ kind: "string", re: new RegExp(`${b}|${y}|\`(?:[^\`\\\\]|\\\\.)*\``, "y") },
|
|
56
|
+
{ kind: "tag", re: /<\/?[A-Za-z][\w.-]*/y },
|
|
56
57
|
{
|
|
57
58
|
kind: "keyword",
|
|
58
59
|
re: /\b(?:const|let|var|function|return|if|else|for|while|import|from|export|default|new|class|extends|implements|async|await|type|interface|enum|public|private|readonly|true|false|null|undefined|this)\b/y
|
|
59
60
|
},
|
|
61
|
+
{ kind: "function", re: /\b[A-Za-z_$][\w$]*(?=\s*\()/y },
|
|
60
62
|
{ kind: "number", re: /\b\d+(?:\.\d+)?\b/y },
|
|
61
|
-
{ kind: "punct", re: /[{}[\]()
|
|
63
|
+
{ kind: "punct", re: /[{}[\]();,:<>/=]/y }
|
|
62
64
|
]
|
|
63
|
-
},
|
|
65
|
+
}, V = {
|
|
64
66
|
sql: "sql",
|
|
65
67
|
json: "json",
|
|
66
68
|
yaml: "yaml",
|
|
@@ -75,152 +77,199 @@ const j = C(
|
|
|
75
77
|
jsx: "ts",
|
|
76
78
|
javascript: "ts",
|
|
77
79
|
typescript: "ts"
|
|
78
|
-
},
|
|
80
|
+
}, D = {
|
|
79
81
|
comment: "text-tertiary",
|
|
80
|
-
string: "text-
|
|
81
|
-
number: "text-
|
|
82
|
-
keyword: "font-
|
|
82
|
+
string: "text-foreground",
|
|
83
|
+
number: "text-foreground",
|
|
84
|
+
keyword: "font-semibold text-foreground",
|
|
85
|
+
function: "font-medium text-foreground",
|
|
86
|
+
tag: "font-medium text-foreground",
|
|
83
87
|
punct: "text-tertiary"
|
|
84
88
|
};
|
|
85
|
-
function
|
|
86
|
-
const
|
|
87
|
-
let
|
|
88
|
-
for (;
|
|
89
|
+
function F(a, t) {
|
|
90
|
+
const n = [];
|
|
91
|
+
let e = "", r = 0;
|
|
92
|
+
for (; r < a.length; ) {
|
|
89
93
|
let i = null;
|
|
90
|
-
for (const { kind:
|
|
91
|
-
|
|
92
|
-
const l =
|
|
93
|
-
if (l && l.index ===
|
|
94
|
-
i = { text: l[0], kind:
|
|
94
|
+
for (const { kind: g, re: m } of t) {
|
|
95
|
+
m.lastIndex = r;
|
|
96
|
+
const l = m.exec(a);
|
|
97
|
+
if (l && l.index === r && l[0].length > 0) {
|
|
98
|
+
i = { text: l[0], kind: g };
|
|
95
99
|
break;
|
|
96
100
|
}
|
|
97
101
|
}
|
|
98
|
-
i ? (
|
|
102
|
+
i ? (e && (n.push({ text: e }), e = ""), n.push(i), r += i.text.length) : (e += a[r], r += 1);
|
|
99
103
|
}
|
|
100
|
-
return
|
|
104
|
+
return e && n.push({ text: e }), n;
|
|
101
105
|
}
|
|
102
|
-
function
|
|
106
|
+
function H(a) {
|
|
103
107
|
const t = [[]];
|
|
104
|
-
for (const
|
|
105
|
-
|
|
106
|
-
`).forEach((
|
|
107
|
-
i > 0 && t.push([]),
|
|
108
|
+
for (const n of a)
|
|
109
|
+
n.text.split(`
|
|
110
|
+
`).forEach((r, i) => {
|
|
111
|
+
i > 0 && t.push([]), r && t[t.length - 1].push({ ...n, text: r });
|
|
108
112
|
});
|
|
109
113
|
return t;
|
|
110
114
|
}
|
|
111
|
-
function
|
|
112
|
-
return
|
|
113
|
-
(t,
|
|
115
|
+
function K(a) {
|
|
116
|
+
return a.map(
|
|
117
|
+
(t, n) => t.kind ? /* @__PURE__ */ o("span", { className: D[t.kind], children: t.text }, n) : /* @__PURE__ */ o(s.Fragment, { children: t.text }, n)
|
|
114
118
|
);
|
|
115
119
|
}
|
|
116
|
-
function
|
|
117
|
-
const [t,
|
|
118
|
-
|
|
120
|
+
function O(a = 2e3) {
|
|
121
|
+
const [t, n] = s.useState(!1), e = s.useRef(null);
|
|
122
|
+
s.useEffect(
|
|
119
123
|
() => () => {
|
|
120
|
-
|
|
124
|
+
e.current !== null && window.clearTimeout(e.current);
|
|
121
125
|
},
|
|
122
126
|
[]
|
|
123
127
|
);
|
|
124
|
-
const
|
|
128
|
+
const r = s.useCallback(
|
|
125
129
|
(i) => {
|
|
126
130
|
!i || typeof navigator > "u" || !navigator.clipboard || navigator.clipboard.writeText(i).then(
|
|
127
131
|
() => {
|
|
128
|
-
|
|
129
|
-
() =>
|
|
130
|
-
|
|
132
|
+
n(!0), e.current !== null && window.clearTimeout(e.current), e.current = window.setTimeout(
|
|
133
|
+
() => n(!1),
|
|
134
|
+
a
|
|
131
135
|
);
|
|
132
136
|
},
|
|
133
137
|
() => {
|
|
134
138
|
}
|
|
135
139
|
);
|
|
136
140
|
},
|
|
137
|
-
[
|
|
141
|
+
[a]
|
|
138
142
|
);
|
|
139
|
-
return { isCopied: t, copy:
|
|
143
|
+
return { isCopied: t, copy: r };
|
|
140
144
|
}
|
|
141
|
-
const
|
|
145
|
+
const J = s.forwardRef(
|
|
142
146
|
({
|
|
143
|
-
className:
|
|
144
|
-
|
|
147
|
+
className: a,
|
|
148
|
+
children: t,
|
|
149
|
+
code: n,
|
|
145
150
|
language: e,
|
|
146
|
-
filename:
|
|
147
|
-
variant:
|
|
148
|
-
isCopyable:
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
filename: r,
|
|
152
|
+
variant: i,
|
|
153
|
+
isCopyable: g = !0,
|
|
154
|
+
hideLineNumbers: m = !1,
|
|
155
|
+
showLineNumbers: l,
|
|
156
|
+
highlightedLinesNumbers: C,
|
|
157
|
+
addedLinesNumbers: N,
|
|
158
|
+
removedLinesNumbers: R,
|
|
159
|
+
copyLabel: E = "Copy code",
|
|
160
|
+
...j
|
|
161
|
+
}, A) => {
|
|
162
|
+
const { isCopied: x, copy: $ } = O(), k = t ?? n ?? "", w = !!r, S = l ?? !m, z = s.useMemo(
|
|
163
|
+
() => new Set(C ?? []),
|
|
164
|
+
[C]
|
|
165
|
+
), M = s.useMemo(
|
|
166
|
+
() => new Set(N ?? []),
|
|
167
|
+
[N]
|
|
168
|
+
), T = s.useMemo(
|
|
169
|
+
() => new Set(R ?? []),
|
|
170
|
+
[R]
|
|
171
|
+
), B = s.useMemo(() => {
|
|
172
|
+
const f = e ? Q[V[e.toLowerCase()]] : void 0, h = k.replace(/\n$/, "");
|
|
173
|
+
return H(f ? F(h, f) : [{ text: h }]);
|
|
174
|
+
}, [k, e]), p = g ? /* @__PURE__ */ o(
|
|
175
|
+
L,
|
|
158
176
|
{
|
|
159
177
|
type: "button",
|
|
160
178
|
variant: "ghost",
|
|
161
179
|
size: "icon-xs",
|
|
162
|
-
"aria-label":
|
|
163
|
-
onClick: () =>
|
|
164
|
-
children: x ? /* @__PURE__ */
|
|
180
|
+
"aria-label": x ? "Copied" : E,
|
|
181
|
+
onClick: () => $(k),
|
|
182
|
+
children: x ? /* @__PURE__ */ o(I, { "aria-hidden": !0, className: "text-foreground" }) : /* @__PURE__ */ o(Z, { "aria-hidden": !0 })
|
|
165
183
|
}
|
|
166
184
|
) : null;
|
|
167
|
-
return /* @__PURE__ */
|
|
185
|
+
return /* @__PURE__ */ v(
|
|
168
186
|
"div",
|
|
169
187
|
{
|
|
170
|
-
ref:
|
|
188
|
+
ref: A,
|
|
171
189
|
"data-slot": "code-block",
|
|
172
|
-
|
|
173
|
-
|
|
190
|
+
"data-variant": i ?? "soft",
|
|
191
|
+
className: u(G({ variant: i }), a),
|
|
192
|
+
...j,
|
|
174
193
|
children: [
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
|
|
194
|
+
/* @__PURE__ */ o("span", { "aria-live": "polite", className: "sr-only", children: x ? "Copied to clipboard" : "" }),
|
|
195
|
+
w && /* @__PURE__ */ v(
|
|
177
196
|
"div",
|
|
178
197
|
{
|
|
179
198
|
"data-slot": "code-block-header",
|
|
180
|
-
className: "flex items-center gap-2 px-
|
|
199
|
+
className: "flex min-h-10 items-center gap-2 rounded-t-lg border border-border px-4 py-2 text-tertiary",
|
|
181
200
|
children: [
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
p && /* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ o(q, { "aria-hidden": !0, className: "size-4 shrink-0" }),
|
|
202
|
+
/* @__PURE__ */ o("span", { className: "min-w-0 truncate font-normal text-secondary", children: r }),
|
|
203
|
+
p && /* @__PURE__ */ o("span", { className: "ml-auto shrink-0", children: p })
|
|
185
204
|
]
|
|
186
205
|
}
|
|
187
206
|
),
|
|
188
|
-
!
|
|
207
|
+
!w && p && /* @__PURE__ */ o(
|
|
189
208
|
"span",
|
|
190
209
|
{
|
|
191
|
-
className:
|
|
192
|
-
"absolute top-
|
|
210
|
+
className: u(
|
|
211
|
+
"absolute top-2 right-2 z-10 opacity-0 transition-opacity duration-(--duration-fast) ease-out",
|
|
193
212
|
"group-hover/code-block:opacity-100 focus-within:opacity-100",
|
|
194
213
|
"motion-reduce:transition-none"
|
|
195
214
|
),
|
|
196
215
|
children: p
|
|
197
216
|
}
|
|
198
217
|
),
|
|
199
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ o(
|
|
200
219
|
"pre",
|
|
201
220
|
{
|
|
202
221
|
"data-slot": "code-block-content",
|
|
203
|
-
className:
|
|
222
|
+
className: u(
|
|
204
223
|
// min-h-0 lets this shrink inside the flex column; without it a
|
|
205
224
|
// capped block clips its overflow instead of scrolling to it.
|
|
206
|
-
"min-h-0 overflow-auto
|
|
207
|
-
|
|
225
|
+
"min-h-0 overflow-auto bg-card leading-relaxed text-foreground tabular-nums",
|
|
226
|
+
w ? "rounded-b-lg border-x border-b border-border py-3" : "rounded-lg border border-border py-4",
|
|
227
|
+
i === "plain" && "border-transparent bg-transparent"
|
|
208
228
|
),
|
|
209
|
-
children: /* @__PURE__ */
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
229
|
+
children: /* @__PURE__ */ o(
|
|
230
|
+
"code",
|
|
231
|
+
{
|
|
232
|
+
"data-slot": "code-block-code",
|
|
233
|
+
className: "block w-max min-w-full font-mono",
|
|
234
|
+
"data-language": e,
|
|
235
|
+
children: B.map((f, h) => {
|
|
236
|
+
const c = h + 1, d = M.has(c) ? "added" : T.has(c) ? "removed" : z.has(c) ? "highlighted" : void 0;
|
|
237
|
+
return /* @__PURE__ */ v(
|
|
238
|
+
"span",
|
|
239
|
+
{
|
|
240
|
+
"data-slot": "code-block-line",
|
|
241
|
+
"data-line": c,
|
|
242
|
+
"data-line-state": d,
|
|
243
|
+
className: u(
|
|
244
|
+
"grid min-h-5 min-w-full px-4",
|
|
245
|
+
S ? "grid-cols-[3ch_minmax(0,1fr)] gap-3" : "grid-cols-[minmax(0,1fr)]",
|
|
246
|
+
d === "highlighted" && "bg-info-50",
|
|
247
|
+
d === "added" && "bg-fill font-medium",
|
|
248
|
+
d === "removed" && "bg-danger-50"
|
|
249
|
+
),
|
|
250
|
+
children: [
|
|
251
|
+
S && /* @__PURE__ */ o(
|
|
252
|
+
"span",
|
|
253
|
+
{
|
|
254
|
+
"aria-hidden": !0,
|
|
255
|
+
"data-slot": "code-block-line-number",
|
|
256
|
+
className: u(
|
|
257
|
+
"select-none text-right text-tertiary",
|
|
258
|
+
d === "highlighted" && "text-info-700",
|
|
259
|
+
d === "added" && "font-semibold text-foreground",
|
|
260
|
+
d === "removed" && "text-danger-700"
|
|
261
|
+
),
|
|
262
|
+
children: c
|
|
263
|
+
}
|
|
264
|
+
),
|
|
265
|
+
/* @__PURE__ */ o("span", { children: K(f) })
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
c
|
|
269
|
+
);
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
)
|
|
224
273
|
}
|
|
225
274
|
)
|
|
226
275
|
]
|
|
@@ -228,8 +277,8 @@ const _ = c.forwardRef(
|
|
|
228
277
|
);
|
|
229
278
|
}
|
|
230
279
|
);
|
|
231
|
-
|
|
280
|
+
J.displayName = "CodeBlock";
|
|
232
281
|
export {
|
|
233
|
-
|
|
234
|
-
|
|
282
|
+
J as CodeBlock,
|
|
283
|
+
G as codeBlockVariants
|
|
235
284
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as d, jsx as
|
|
2
|
+
import { jsxs as d, jsx as a } from "react/jsx-runtime";
|
|
3
3
|
import * as o from "react";
|
|
4
4
|
import { createPortal as S } from "react-dom";
|
|
5
5
|
import { Search as q } from "../lib/icons.js";
|
|
6
6
|
import { cn as k } from "../lib/cn.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { Ripple as C } from "./ripple.js";
|
|
8
|
+
const F = (s, i) => `${s.label} ${s.keywords ?? ""}`.toLowerCase().includes(i);
|
|
9
|
+
function L({
|
|
10
|
+
open: s,
|
|
10
11
|
onOpenChange: i,
|
|
11
12
|
items: p,
|
|
12
13
|
onSelect: R,
|
|
13
14
|
placeholder: $ = "Search…",
|
|
14
15
|
emptyLabel: A = "No results",
|
|
15
16
|
"aria-label": D = "Global search",
|
|
16
|
-
filter: h =
|
|
17
|
+
filter: h = F,
|
|
17
18
|
className: E
|
|
18
19
|
}) {
|
|
19
|
-
const f = o.useId(), v = o.useRef(null),
|
|
20
|
+
const f = o.useId(), v = o.useRef(null), g = o.useRef(null), y = o.useRef(null), [m, b] = o.useState(""), [c, x] = o.useState(0), n = o.useMemo(() => {
|
|
20
21
|
const e = m.trim().toLowerCase();
|
|
21
22
|
return e ? p.filter((r) => h(r, e)) : [...p];
|
|
22
23
|
}, [p, m, h]), M = o.useMemo(() => {
|
|
@@ -27,9 +28,9 @@ function _({
|
|
|
27
28
|
}, [n]), u = n[c];
|
|
28
29
|
o.useEffect(() => {
|
|
29
30
|
x(0);
|
|
30
|
-
}, [m,
|
|
31
|
-
if (!
|
|
32
|
-
|
|
31
|
+
}, [m, s]), o.useEffect(() => {
|
|
32
|
+
if (!s) return;
|
|
33
|
+
y.current = document.activeElement, b("");
|
|
33
34
|
const e = document.body.style.overflow;
|
|
34
35
|
document.body.style.overflow = "hidden";
|
|
35
36
|
const r = requestAnimationFrame(() => {
|
|
@@ -38,20 +39,20 @@ function _({
|
|
|
38
39
|
});
|
|
39
40
|
return () => {
|
|
40
41
|
var t, l;
|
|
41
|
-
document.body.style.overflow = e, cancelAnimationFrame(r), (l = (t =
|
|
42
|
+
document.body.style.overflow = e, cancelAnimationFrame(r), (l = (t = y.current) == null ? void 0 : t.focus) == null || l.call(t);
|
|
42
43
|
};
|
|
43
|
-
}, [
|
|
44
|
+
}, [s]), o.useEffect(() => {
|
|
44
45
|
var e, r;
|
|
45
|
-
!
|
|
46
|
-
}, [
|
|
46
|
+
!s || !u || (r = (e = g.current) == null ? void 0 : e.querySelector(`[data-index="${c}"]`)) == null || r.scrollIntoView({ block: "nearest" });
|
|
47
|
+
}, [s, u, c]);
|
|
47
48
|
const w = (e) => {
|
|
48
49
|
i(!1), R(e);
|
|
49
50
|
}, I = (e) => {
|
|
50
51
|
e.key === "Escape" ? (e.preventDefault(), i(!1)) : e.key === "ArrowDown" ? (e.preventDefault(), x((r) => Math.min(r + 1, n.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), x((r) => Math.max(r - 1, 0))) : e.key === "Enter" && u && (e.preventDefault(), w(u));
|
|
51
52
|
};
|
|
52
|
-
return
|
|
53
|
+
return s ? S(
|
|
53
54
|
/* @__PURE__ */ d("div", { className: "fixed inset-0 z-50 flex items-start justify-center px-4 pt-[15vh]", children: [
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ a(
|
|
55
56
|
"div",
|
|
56
57
|
{
|
|
57
58
|
"aria-hidden": !0,
|
|
@@ -72,9 +73,10 @@ function _({
|
|
|
72
73
|
),
|
|
73
74
|
onKeyDown: I,
|
|
74
75
|
children: [
|
|
76
|
+
/* @__PURE__ */ a(C, { origin: "top" }),
|
|
75
77
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2.5 px-4 py-3", children: [
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ a(q, { "aria-hidden": !0, className: "size-4 shrink-0 text-muted-foreground" }),
|
|
79
|
+
/* @__PURE__ */ a(
|
|
78
80
|
"input",
|
|
79
81
|
{
|
|
80
82
|
ref: v,
|
|
@@ -90,16 +92,16 @@ function _({
|
|
|
90
92
|
}
|
|
91
93
|
)
|
|
92
94
|
] }),
|
|
93
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ a(
|
|
94
96
|
"div",
|
|
95
97
|
{
|
|
96
|
-
ref:
|
|
98
|
+
ref: g,
|
|
97
99
|
id: f,
|
|
98
100
|
role: "listbox",
|
|
99
101
|
"aria-label": "Results",
|
|
100
102
|
className: "max-h-80 overflow-y-auto p-1.5 pt-0",
|
|
101
|
-
children: n.length === 0 ? /* @__PURE__ */
|
|
102
|
-
e && /* @__PURE__ */
|
|
103
|
+
children: n.length === 0 ? /* @__PURE__ */ a("p", { className: "px-2.5 py-6 text-center text-xs text-muted-foreground", children: A }) : M.map(({ group: e, items: r }) => /* @__PURE__ */ d("div", { role: "group", "aria-label": e, children: [
|
|
104
|
+
e && /* @__PURE__ */ a("div", { className: "px-2.5 pb-1 pt-2.5 text-xs font-normal text-muted-foreground select-none", children: e }),
|
|
103
105
|
r.map((t) => {
|
|
104
106
|
const l = n.indexOf(t), N = l === c;
|
|
105
107
|
return /* @__PURE__ */ d(
|
|
@@ -116,7 +118,7 @@ function _({
|
|
|
116
118
|
N ? "bg-fill text-foreground" : "text-secondary"
|
|
117
119
|
),
|
|
118
120
|
children: [
|
|
119
|
-
t.icon && /* @__PURE__ */
|
|
121
|
+
t.icon && /* @__PURE__ */ a(
|
|
120
122
|
"span",
|
|
121
123
|
{
|
|
122
124
|
"aria-hidden": !0,
|
|
@@ -124,8 +126,8 @@ function _({
|
|
|
124
126
|
children: t.icon
|
|
125
127
|
}
|
|
126
128
|
),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
t.hint && /* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate", children: t.label }),
|
|
130
|
+
t.hint && /* @__PURE__ */ a("span", { className: "shrink-0 text-xs text-tertiary", children: t.hint })
|
|
129
131
|
]
|
|
130
132
|
},
|
|
131
133
|
t.id
|
|
@@ -142,5 +144,5 @@ function _({
|
|
|
142
144
|
) : null;
|
|
143
145
|
}
|
|
144
146
|
export {
|
|
145
|
-
|
|
147
|
+
L as CommandPalette
|
|
146
148
|
};
|
|
@@ -95,7 +95,7 @@ const v = h.forwardRef(
|
|
|
95
95
|
] }),
|
|
96
96
|
/* @__PURE__ */ t(N, { strip: e.strip })
|
|
97
97
|
] }),
|
|
98
|
-
/* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3 rounded-b-xl bg-
|
|
98
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3 rounded-b-xl bg-ink-100 px-[var(--card-padding)] py-3", children: [
|
|
99
99
|
/* @__PURE__ */ t(
|
|
100
100
|
"span",
|
|
101
101
|
{
|
|
@@ -110,7 +110,7 @@ const v = h.forwardRef(
|
|
|
110
110
|
"span",
|
|
111
111
|
{
|
|
112
112
|
className: o(
|
|
113
|
-
"inline-flex shrink-0 items-center gap-0.5 text-xs font-
|
|
113
|
+
"inline-flex shrink-0 items-center gap-0.5 text-xs font-normal",
|
|
114
114
|
f ? "text-danger" : "text-foreground"
|
|
115
115
|
),
|
|
116
116
|
children: [
|