@actioneer/ads 0.6.0 → 0.7.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/components/ai-elements/agent-trace.d.ts +2 -2
- package/components/ai-elements/agent-trace.js +163 -104
- package/components/ai-elements/chain-of-thought.d.ts +2 -2
- package/components/ai-elements/chain-of-thought.js +1 -1
- package/components/ai-elements/index.d.ts +0 -5
- package/components/ai-elements/inline-citation.js +1 -1
- package/components/alert.d.ts +6 -6
- package/components/alert.js +89 -53
- package/components/answer-sources.d.ts +2 -6
- package/components/answer-sources.js +58 -60
- package/components/answer.d.ts +5 -0
- package/components/answer.js +311 -271
- package/components/assistant-ui/composer-harness.js +15 -20
- package/components/assistant-ui/composer.d.ts +3 -1
- package/components/assistant-ui/composer.js +148 -144
- package/components/assistant-ui/index.d.ts +0 -3
- package/components/assistant-ui/thread-context.d.ts +3 -1
- package/components/assistant-ui/thread.js +50 -42
- package/components/avatar.js +42 -42
- package/components/badge.d.ts +5 -6
- package/components/badge.js +13 -76
- package/components/body-page-header.d.ts +15 -0
- package/components/body-page-header.js +24 -0
- package/components/brand-loader.d.ts +0 -3
- package/components/brand-loader.js +10 -32
- package/components/breadcrumbs.d.ts +0 -7
- package/components/breadcrumbs.js +54 -71
- package/components/button.d.ts +1 -1
- package/components/button.js +55 -49
- package/components/chart.js +298 -296
- package/components/chip.d.ts +13 -1
- package/components/chip.js +93 -80
- package/components/collection-header.d.ts +17 -0
- package/components/collection-header.js +31 -0
- package/components/connector-card.d.ts +6 -6
- package/components/connector-card.js +31 -32
- package/components/date-range-picker.d.ts +2 -1
- package/components/date-range-picker.js +158 -122
- package/components/drawer.d.ts +19 -3
- package/components/drawer.js +109 -100
- package/components/dropdown.d.ts +1 -2
- package/components/dropdown.js +88 -89
- package/components/field.js +39 -34
- package/components/file-dropzone.js +1 -1
- package/components/index.d.ts +4 -4
- package/components/index.js +499 -546
- package/components/infinite-canvas.js +24 -24
- package/components/input-field.d.ts +18 -3
- package/components/input-field.js +88 -72
- package/components/input.js +16 -15
- package/components/modal.d.ts +31 -3
- package/components/modal.js +243 -169
- package/components/number-field.js +45 -42
- package/components/page-body.d.ts +12 -0
- package/components/page-body.js +18 -0
- package/components/pagination.js +36 -36
- package/components/select.d.ts +21 -0
- package/components/select.js +189 -148
- package/components/setting-row.d.ts +6 -5
- package/components/setting-row.js +33 -32
- package/components/sidebar.d.ts +2 -0
- package/components/sidebar.js +165 -155
- package/components/skeleton.js +8 -7
- package/components/slider.js +1 -1
- package/components/surface-loader.d.ts +11 -0
- package/components/surface-loader.js +35 -0
- package/components/table.d.ts +16 -10
- package/components/table.js +426 -410
- package/components/tabs.d.ts +2 -0
- package/components/tabs.js +159 -294
- package/components/textarea.js +9 -9
- package/components/toast.d.ts +1 -1
- package/components/toast.js +181 -118
- package/components/tree.d.ts +5 -1
- package/components/tree.js +54 -49
- package/components/typography.d.ts +4 -4
- package/components/typography.js +13 -13
- package/components/ui/button.d.ts +1 -1
- package/components/ui/dialog.js +33 -33
- package/demo/components/add-to-artifact.js +6 -10
- package/lib/cn.js +11 -4
- package/lib/icons.d.ts +4 -0
- package/lib/icons.js +107 -106
- package/lib/interactive.d.ts +1 -1
- package/llms.txt +95 -152
- package/manifest.json +1628 -2729
- package/package.json +1 -2
- package/styles.css +347 -223
- package/theme.css +303 -177
- package/components/agent-icon.d.ts +0 -76
- package/components/agent-icon.js +0 -265
- package/components/ai-elements/queue.d.ts +0 -60
- package/components/ai-elements/queue.js +0 -193
- package/components/ai-elements/speech-input.d.ts +0 -16
- package/components/ai-elements/speech-input.js +0 -151
- package/components/ai-elements/task-progress.d.ts +0 -41
- package/components/ai-elements/task-progress.js +0 -224
- package/components/ai-elements/task.d.ts +0 -39
- package/components/ai-elements/task.js +0 -105
- package/components/ai-elements/voice.d.ts +0 -90
- package/components/ai-elements/voice.js +0 -496
- package/components/assistant-ui/follow-up-suggestions.d.ts +0 -11
- package/components/assistant-ui/follow-up-suggestions.js +0 -72
- package/components/assistant-ui/suggestions.d.ts +0 -7
- package/components/assistant-ui/suggestions.js +0 -19
- package/components/assistant-ui/voice.d.ts +0 -18
- package/components/link.d.ts +0 -14
- package/components/link.js +0 -72
- package/components/navbar.d.ts +0 -15
- package/components/navbar.js +0 -68
- package/components/pixel-icon.d.ts +0 -37
- package/components/pixel-icon.js +0 -859
package/components/drawer.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as i, jsxs as
|
|
3
|
-
import * as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { MotionConfig as
|
|
6
|
-
import { Close as
|
|
7
|
-
import { cva as
|
|
2
|
+
import { jsx as i, jsxs as y } from "react/jsx-runtime";
|
|
3
|
+
import * as s from "react";
|
|
4
|
+
import { createPortal as R } from "react-dom";
|
|
5
|
+
import { MotionConfig as z, AnimatePresence as D, motion as g } from "motion/react";
|
|
6
|
+
import { Close as j } from "../lib/icons.js";
|
|
7
|
+
import { cva as F } from "class-variance-authority";
|
|
8
8
|
import { cn as n } from "../lib/cn.js";
|
|
9
|
-
import { springSheet as l, drawerOffset as
|
|
10
|
-
const N =
|
|
9
|
+
import { springSheet as l, drawerOffset as v, drawerBackdropVariants as A } from "../lib/motion.js";
|
|
10
|
+
const N = F(
|
|
11
11
|
[
|
|
12
12
|
"relative flex flex-col",
|
|
13
13
|
"bg-elevated text-foreground",
|
|
@@ -43,25 +43,25 @@ const N = j(
|
|
|
43
43
|
],
|
|
44
44
|
defaultVariants: { side: "right", size: "md" }
|
|
45
45
|
}
|
|
46
|
-
),
|
|
46
|
+
), B = {
|
|
47
47
|
right: "justify-end items-stretch",
|
|
48
48
|
left: "justify-start items-stretch",
|
|
49
49
|
bottom: "justify-center items-end"
|
|
50
|
-
},
|
|
50
|
+
}, L = {
|
|
51
51
|
sm: "25%",
|
|
52
52
|
md: "33.333333%",
|
|
53
53
|
lg: "50%",
|
|
54
54
|
xl: "66.666667%"
|
|
55
55
|
};
|
|
56
56
|
function k({
|
|
57
|
-
onClick:
|
|
58
|
-
className:
|
|
57
|
+
onClick: e,
|
|
58
|
+
className: t
|
|
59
59
|
}) {
|
|
60
60
|
return /* @__PURE__ */ i(
|
|
61
61
|
"button",
|
|
62
62
|
{
|
|
63
63
|
type: "button",
|
|
64
|
-
onClick:
|
|
64
|
+
onClick: e,
|
|
65
65
|
"aria-label": "Close",
|
|
66
66
|
className: n(
|
|
67
67
|
"absolute inline-flex size-8 items-center justify-center",
|
|
@@ -70,75 +70,75 @@ function k({
|
|
|
70
70
|
"active:scale-[0.97] motion-reduce:active:scale-100",
|
|
71
71
|
"outline-none focus-visible:ring-3 focus-visible:ring-ring",
|
|
72
72
|
"[&_svg]:size-4 [&_svg]:shrink-0",
|
|
73
|
-
|
|
73
|
+
t
|
|
74
74
|
),
|
|
75
|
-
children: /* @__PURE__ */ i(
|
|
75
|
+
children: /* @__PURE__ */ i(j, { "aria-hidden": !0 })
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
function G({
|
|
80
|
-
open:
|
|
81
|
-
onOpenChange:
|
|
82
|
-
side:
|
|
83
|
-
size:
|
|
84
|
-
className:
|
|
85
|
-
children:
|
|
86
|
-
"aria-label":
|
|
80
|
+
open: e,
|
|
81
|
+
onOpenChange: t,
|
|
82
|
+
side: o,
|
|
83
|
+
size: c,
|
|
84
|
+
className: x,
|
|
85
|
+
children: m,
|
|
86
|
+
"aria-label": p
|
|
87
87
|
}) {
|
|
88
|
-
const
|
|
89
|
-
return
|
|
90
|
-
if (!
|
|
91
|
-
|
|
92
|
-
const
|
|
88
|
+
const d = o ?? "right", f = s.useRef(null), u = s.useRef(null);
|
|
89
|
+
return s.useEffect(() => {
|
|
90
|
+
if (!e) return;
|
|
91
|
+
u.current = document.activeElement;
|
|
92
|
+
const a = document.body.style.overflow;
|
|
93
93
|
document.body.style.overflow = "hidden";
|
|
94
|
-
const
|
|
95
|
-
|
|
94
|
+
const w = (r) => {
|
|
95
|
+
r.key === "Escape" && (r.stopPropagation(), t(!1));
|
|
96
96
|
};
|
|
97
|
-
document.addEventListener("keydown",
|
|
98
|
-
const
|
|
99
|
-
var
|
|
100
|
-
(
|
|
97
|
+
document.addEventListener("keydown", w);
|
|
98
|
+
const b = requestAnimationFrame(() => {
|
|
99
|
+
var r;
|
|
100
|
+
(r = f.current) == null || r.focus();
|
|
101
101
|
});
|
|
102
102
|
return () => {
|
|
103
|
-
var
|
|
104
|
-
document.removeEventListener("keydown",
|
|
103
|
+
var r, h;
|
|
104
|
+
document.removeEventListener("keydown", w), document.body.style.overflow = a, cancelAnimationFrame(b), (h = (r = u.current) == null ? void 0 : r.focus) == null || h.call(r);
|
|
105
105
|
};
|
|
106
|
-
}, [
|
|
107
|
-
/* @__PURE__ */ i(
|
|
106
|
+
}, [e, t]), R(
|
|
107
|
+
/* @__PURE__ */ i(z, { reducedMotion: "user", children: /* @__PURE__ */ i(D, { children: e && /* @__PURE__ */ y("div", { className: n("fixed inset-0 z-50 flex", B[d]), children: [
|
|
108
108
|
/* @__PURE__ */ i(
|
|
109
|
-
|
|
109
|
+
g.div,
|
|
110
110
|
{
|
|
111
|
-
variants:
|
|
111
|
+
variants: A,
|
|
112
112
|
initial: "hidden",
|
|
113
113
|
animate: "visible",
|
|
114
114
|
exit: "hidden",
|
|
115
115
|
className: "absolute inset-0 bg-overlay",
|
|
116
|
-
onClick: () =>
|
|
116
|
+
onClick: () => t(!1),
|
|
117
117
|
"aria-hidden": !0
|
|
118
118
|
},
|
|
119
119
|
"backdrop"
|
|
120
120
|
),
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
|
|
121
|
+
/* @__PURE__ */ y(
|
|
122
|
+
g.div,
|
|
123
123
|
{
|
|
124
|
-
ref:
|
|
125
|
-
initial:
|
|
124
|
+
ref: f,
|
|
125
|
+
initial: v[d],
|
|
126
126
|
animate: { transform: "translate3d(0, 0, 0)", opacity: 1, transition: l },
|
|
127
|
-
exit: { ...
|
|
127
|
+
exit: { ...v[d], pointerEvents: "none", transition: l },
|
|
128
128
|
role: "dialog",
|
|
129
129
|
"aria-modal": "true",
|
|
130
|
-
"aria-label":
|
|
130
|
+
"aria-label": p,
|
|
131
131
|
tabIndex: -1,
|
|
132
|
-
className: n(N({ side:
|
|
132
|
+
className: n(N({ side: d, size: c }), "relative outline-none", x),
|
|
133
133
|
children: [
|
|
134
134
|
/* @__PURE__ */ i(
|
|
135
135
|
k,
|
|
136
136
|
{
|
|
137
|
-
onClick: () =>
|
|
137
|
+
onClick: () => t(!1),
|
|
138
138
|
className: "right-4 top-4"
|
|
139
139
|
}
|
|
140
140
|
),
|
|
141
|
-
|
|
141
|
+
m
|
|
142
142
|
]
|
|
143
143
|
},
|
|
144
144
|
"panel"
|
|
@@ -147,56 +147,61 @@ function G({
|
|
|
147
147
|
document.body
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
open:
|
|
152
|
-
onOpenChange:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
150
|
+
function E({
|
|
151
|
+
open: e,
|
|
152
|
+
onOpenChange: t,
|
|
153
|
+
appearance: o = "flat",
|
|
154
|
+
dismissible: c = !0,
|
|
155
|
+
side: x,
|
|
156
|
+
size: m,
|
|
157
|
+
containerClassName: p,
|
|
158
|
+
className: d,
|
|
159
|
+
children: f,
|
|
160
|
+
"aria-label": u
|
|
158
161
|
}) {
|
|
159
|
-
const
|
|
160
|
-
return
|
|
161
|
-
if (!
|
|
162
|
-
const
|
|
163
|
-
|
|
162
|
+
const a = x ?? "right", w = m ?? "md", b = s.useRef(null);
|
|
163
|
+
return s.useEffect(() => {
|
|
164
|
+
if (!e || !c) return;
|
|
165
|
+
const r = (h) => {
|
|
166
|
+
h.key === "Escape" && t(!1);
|
|
164
167
|
};
|
|
165
|
-
return document.addEventListener("keydown",
|
|
166
|
-
}, [t,
|
|
167
|
-
|
|
168
|
+
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
169
|
+
}, [e, t, c]), /* @__PURE__ */ i(z, { reducedMotion: "user", children: /* @__PURE__ */ i(D, { initial: !1, children: e && /* @__PURE__ */ i(
|
|
170
|
+
g.div,
|
|
168
171
|
{
|
|
169
|
-
initial:
|
|
170
|
-
animate:
|
|
171
|
-
exit:
|
|
172
|
+
initial: a === "bottom" ? { height: "0%" } : { width: 0 },
|
|
173
|
+
animate: a === "bottom" ? { height: L[w], transition: l } : { width: "auto", transition: l },
|
|
174
|
+
exit: a === "bottom" ? { height: "0%", pointerEvents: "none", transition: l } : { width: 0, pointerEvents: "none", transition: l },
|
|
172
175
|
className: n(
|
|
173
176
|
"shrink-0 overflow-hidden",
|
|
174
|
-
|
|
177
|
+
a === "bottom" ? "w-full" : "h-full",
|
|
178
|
+
p
|
|
175
179
|
),
|
|
176
|
-
children: /* @__PURE__ */
|
|
177
|
-
|
|
180
|
+
children: /* @__PURE__ */ y(
|
|
181
|
+
g.aside,
|
|
178
182
|
{
|
|
179
|
-
ref:
|
|
180
|
-
initial:
|
|
183
|
+
ref: b,
|
|
184
|
+
initial: v[a],
|
|
181
185
|
animate: { transform: "translate3d(0, 0, 0)", opacity: 1, transition: l },
|
|
182
|
-
exit: { ...
|
|
186
|
+
exit: { ...v[a], pointerEvents: "none", transition: l },
|
|
183
187
|
role: "complementary",
|
|
184
|
-
"aria-label":
|
|
188
|
+
"aria-label": u,
|
|
185
189
|
className: n(
|
|
186
|
-
N({ side:
|
|
187
|
-
"relative shrink-0 overflow-hidden rounded-lg bg-card
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
N({ side: a, size: m }),
|
|
191
|
+
"relative shrink-0 overflow-hidden rounded-lg bg-card outline-none",
|
|
192
|
+
o === "floating" ? "border border-ng3 shadow-400" : "border-0 shadow-none",
|
|
193
|
+
a === "bottom" && "h-full",
|
|
194
|
+
d
|
|
190
195
|
),
|
|
191
196
|
children: [
|
|
192
|
-
/* @__PURE__ */ i(
|
|
197
|
+
c && /* @__PURE__ */ i(
|
|
193
198
|
k,
|
|
194
199
|
{
|
|
195
|
-
onClick: () =>
|
|
200
|
+
onClick: () => t(!1),
|
|
196
201
|
className: "right-2 top-1"
|
|
197
202
|
}
|
|
198
203
|
),
|
|
199
|
-
|
|
204
|
+
f
|
|
200
205
|
]
|
|
201
206
|
}
|
|
202
207
|
)
|
|
@@ -204,52 +209,56 @@ function L({
|
|
|
204
209
|
"inline-drawer-slot"
|
|
205
210
|
) }) });
|
|
206
211
|
}
|
|
207
|
-
|
|
212
|
+
function J(e) {
|
|
213
|
+
return /* @__PURE__ */ i(E, { ...e, appearance: "floating" });
|
|
214
|
+
}
|
|
215
|
+
const Q = E, M = s.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ i(
|
|
208
216
|
"div",
|
|
209
217
|
{
|
|
210
|
-
ref:
|
|
211
|
-
className: n("flex flex-col gap-1 px-6 py-4 pr-14",
|
|
212
|
-
...
|
|
218
|
+
ref: o,
|
|
219
|
+
className: n("flex flex-col gap-1 px-6 py-4 pr-14", e),
|
|
220
|
+
...t
|
|
213
221
|
}
|
|
214
222
|
));
|
|
215
223
|
M.displayName = "DrawerHeader";
|
|
216
|
-
const V =
|
|
224
|
+
const V = s.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ i(
|
|
217
225
|
"h2",
|
|
218
226
|
{
|
|
219
|
-
ref:
|
|
220
|
-
className: n("text-lg font-medium text-foreground",
|
|
221
|
-
...
|
|
227
|
+
ref: o,
|
|
228
|
+
className: n("text-lg font-medium text-foreground", e),
|
|
229
|
+
...t
|
|
222
230
|
}
|
|
223
231
|
));
|
|
224
232
|
V.displayName = "DrawerTitle";
|
|
225
|
-
const I =
|
|
233
|
+
const I = s.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ i(
|
|
226
234
|
"div",
|
|
227
235
|
{
|
|
228
|
-
ref:
|
|
236
|
+
ref: o,
|
|
229
237
|
tabIndex: 0,
|
|
230
|
-
className: n("flex-1 overflow-y-auto px-6 py-4 text-xs text-foreground",
|
|
231
|
-
...
|
|
238
|
+
className: n("flex-1 overflow-y-auto px-6 py-4 text-xs text-foreground", e),
|
|
239
|
+
...t
|
|
232
240
|
}
|
|
233
241
|
));
|
|
234
242
|
I.displayName = "DrawerBody";
|
|
235
|
-
const P =
|
|
243
|
+
const P = s.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ i(
|
|
236
244
|
"div",
|
|
237
245
|
{
|
|
238
|
-
ref:
|
|
246
|
+
ref: o,
|
|
239
247
|
className: n(
|
|
240
248
|
"flex items-center justify-end gap-2 px-6 py-4",
|
|
241
|
-
|
|
249
|
+
e
|
|
242
250
|
),
|
|
243
|
-
...
|
|
251
|
+
...t
|
|
244
252
|
}
|
|
245
253
|
));
|
|
246
254
|
P.displayName = "DrawerFooter";
|
|
247
255
|
export {
|
|
248
|
-
|
|
256
|
+
E as Drawer,
|
|
249
257
|
I as DrawerBody,
|
|
250
258
|
P as DrawerFooter,
|
|
251
259
|
M as DrawerHeader,
|
|
252
260
|
V as DrawerTitle,
|
|
253
|
-
J as
|
|
261
|
+
J as FloatingDrawer,
|
|
262
|
+
Q as InlineDrawer,
|
|
254
263
|
G as ModalDrawer
|
|
255
264
|
};
|
package/components/dropdown.d.ts
CHANGED
|
@@ -17,11 +17,10 @@ export interface DropdownContentProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
17
17
|
align?: "start" | "end";
|
|
18
18
|
/** Which side of the trigger the menu opens on. Default below. */
|
|
19
19
|
side?: "top" | "bottom";
|
|
20
|
-
sideOffset?: number;
|
|
21
20
|
/** Opt in to focusing the first item when the menu opens. */
|
|
22
21
|
autoFocusFirstItem?: boolean;
|
|
23
22
|
}
|
|
24
|
-
export declare function DropdownContent({ className, align, side,
|
|
23
|
+
export declare function DropdownContent({ className, align, side, autoFocusFirstItem, children, ...props }: DropdownContentProps): React.ReactPortal;
|
|
25
24
|
export interface DropdownItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
26
25
|
startContent?: React.ReactNode;
|
|
27
26
|
danger?: boolean;
|
package/components/dropdown.js
CHANGED
|
@@ -1,82 +1,81 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as N, jsx as h } from "react/jsx-runtime";
|
|
3
3
|
import * as s from "react";
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { MotionConfig as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { menuVariants as
|
|
8
|
-
import { Ripple as
|
|
9
|
-
const C = (r, t) => `${r === "top" ? "bottom" : "top"} ${t === "start" ? "left" : "right"}`,
|
|
4
|
+
import { createPortal as A } from "react-dom";
|
|
5
|
+
import { MotionConfig as I, AnimatePresence as P, motion as z } from "motion/react";
|
|
6
|
+
import { cn as R } from "../lib/cn.js";
|
|
7
|
+
import { menuVariants as S } from "../lib/motion.js";
|
|
8
|
+
import { Ripple as _ } from "./ripple.js";
|
|
9
|
+
const C = 6, L = (r, t) => `${r === "top" ? "bottom" : "top"} ${t === "start" ? "left" : "right"}`, O = s.createContext(null);
|
|
10
10
|
function k(r) {
|
|
11
|
-
const t = s.useContext(
|
|
11
|
+
const t = s.useContext(O);
|
|
12
12
|
if (!t)
|
|
13
13
|
throw new Error(`${r} must be used within a <Dropdown>.`);
|
|
14
14
|
return t;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const [n,
|
|
18
|
-
return /* @__PURE__ */
|
|
16
|
+
function B({ children: r, defaultOpen: t = !1 }) {
|
|
17
|
+
const [n, f] = s.useState(t), p = s.useRef(null), d = s.useRef(null);
|
|
18
|
+
return /* @__PURE__ */ h(O.Provider, { value: { open: n, setOpen: f, triggerRef: p, contentRef: d }, children: r });
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const { open: t, setOpen: n, triggerRef:
|
|
22
|
-
return s.cloneElement(
|
|
23
|
-
ref:
|
|
20
|
+
function U({ children: r }) {
|
|
21
|
+
const { open: t, setOpen: n, triggerRef: f } = k("DropdownTrigger"), p = r;
|
|
22
|
+
return s.cloneElement(p, {
|
|
23
|
+
ref: f,
|
|
24
24
|
"aria-expanded": t,
|
|
25
25
|
"aria-haspopup": "menu",
|
|
26
|
-
onClick: (
|
|
27
|
-
var
|
|
28
|
-
(
|
|
26
|
+
onClick: (d) => {
|
|
27
|
+
var a, m;
|
|
28
|
+
(m = (a = p.props).onClick) == null || m.call(a, d), n(!t);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function V({
|
|
33
33
|
className: r,
|
|
34
34
|
align: t = "start",
|
|
35
35
|
side: n = "bottom",
|
|
36
|
-
|
|
37
|
-
autoFocusFirstItem: l = !1,
|
|
36
|
+
autoFocusFirstItem: f = !1,
|
|
38
37
|
children: p,
|
|
39
|
-
...
|
|
38
|
+
...d
|
|
40
39
|
}) {
|
|
41
|
-
const { open: a, setOpen:
|
|
40
|
+
const { open: a, setOpen: m, triggerRef: w, contentRef: c } = k("DropdownContent"), [l, D] = s.useState(null);
|
|
42
41
|
s.useLayoutEffect(() => {
|
|
43
42
|
if (!a) return;
|
|
44
|
-
const i =
|
|
43
|
+
const i = w.current;
|
|
45
44
|
if (!i) return;
|
|
46
45
|
const e = () => {
|
|
47
|
-
var x,
|
|
48
|
-
const o = i.getBoundingClientRect(),
|
|
49
|
-
|
|
46
|
+
var x, b;
|
|
47
|
+
const o = i.getBoundingClientRect(), u = ((x = c.current) == null ? void 0 : x.offsetWidth) ?? 0, v = ((b = c.current) == null ? void 0 : b.offsetHeight) ?? 0, y = t === "end" ? o.right - u : o.left, E = n === "top" ? o.top - v - C : o.bottom + C;
|
|
48
|
+
D({ top: E, left: y });
|
|
50
49
|
};
|
|
51
50
|
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
52
51
|
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
53
52
|
};
|
|
54
|
-
}, [a, t, n,
|
|
53
|
+
}, [a, t, n, w, c]), s.useEffect(() => {
|
|
55
54
|
if (!a) return;
|
|
56
55
|
const i = requestAnimationFrame(() => {
|
|
57
56
|
var e, o;
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
57
|
+
if (f) {
|
|
58
|
+
const u = (e = c.current) == null ? void 0 : e.querySelector(
|
|
60
59
|
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
61
60
|
);
|
|
62
|
-
|
|
61
|
+
u == null || u.focus();
|
|
63
62
|
} else
|
|
64
63
|
(o = c.current) == null || o.focus();
|
|
65
64
|
});
|
|
66
65
|
return () => cancelAnimationFrame(i);
|
|
67
|
-
}, [a,
|
|
66
|
+
}, [a, f, c]), s.useEffect(() => {
|
|
68
67
|
if (!a) return;
|
|
69
68
|
const i = (e) => {
|
|
70
|
-
var
|
|
69
|
+
var u, v;
|
|
71
70
|
const o = e.target;
|
|
72
|
-
(
|
|
71
|
+
(u = c.current) != null && u.contains(o) || (v = w.current) != null && v.contains(o) || m(!1);
|
|
73
72
|
};
|
|
74
73
|
return document.addEventListener("pointerdown", i), () => document.removeEventListener("pointerdown", i);
|
|
75
|
-
}, [a,
|
|
76
|
-
const
|
|
77
|
-
var
|
|
74
|
+
}, [a, m, w, c]);
|
|
75
|
+
const g = (i) => {
|
|
76
|
+
var u, v, y, E, x, b;
|
|
78
77
|
const e = Array.from(
|
|
79
|
-
((
|
|
78
|
+
((u = c.current) == null ? void 0 : u.querySelectorAll(
|
|
80
79
|
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
81
80
|
)) ?? []
|
|
82
81
|
);
|
|
@@ -84,49 +83,49 @@ function W({
|
|
|
84
83
|
const o = e.indexOf(document.activeElement);
|
|
85
84
|
switch (i.key) {
|
|
86
85
|
case "Escape":
|
|
87
|
-
i.preventDefault(),
|
|
86
|
+
i.preventDefault(), m(!1), (v = w.current) == null || v.focus();
|
|
88
87
|
break;
|
|
89
88
|
case "ArrowDown":
|
|
90
|
-
i.preventDefault(), (
|
|
89
|
+
i.preventDefault(), (y = e[o < 0 ? 0 : (o + 1) % e.length]) == null || y.focus();
|
|
91
90
|
break;
|
|
92
91
|
case "ArrowUp":
|
|
93
|
-
i.preventDefault(), (
|
|
92
|
+
i.preventDefault(), (E = e[o < 0 ? e.length - 1 : (o - 1 + e.length) % e.length]) == null || E.focus();
|
|
94
93
|
break;
|
|
95
94
|
case "Home":
|
|
96
95
|
i.preventDefault(), (x = e[0]) == null || x.focus();
|
|
97
96
|
break;
|
|
98
97
|
case "End":
|
|
99
|
-
i.preventDefault(), (
|
|
98
|
+
i.preventDefault(), (b = e[e.length - 1]) == null || b.focus();
|
|
100
99
|
break;
|
|
101
100
|
}
|
|
102
101
|
};
|
|
103
|
-
return
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
|
|
102
|
+
return A(
|
|
103
|
+
/* @__PURE__ */ h(I, { reducedMotion: "user", children: /* @__PURE__ */ h(P, { children: a && /* @__PURE__ */ N(
|
|
104
|
+
z.div,
|
|
106
105
|
{
|
|
107
106
|
ref: c,
|
|
108
107
|
role: "menu",
|
|
109
108
|
tabIndex: -1,
|
|
110
|
-
onKeyDown:
|
|
111
|
-
variants:
|
|
109
|
+
onKeyDown: g,
|
|
110
|
+
variants: S,
|
|
112
111
|
initial: "hidden",
|
|
113
112
|
animate: "visible",
|
|
114
113
|
exit: "hidden",
|
|
115
114
|
style: {
|
|
116
115
|
position: "fixed",
|
|
117
|
-
top: (
|
|
118
|
-
left: (
|
|
119
|
-
visibility:
|
|
120
|
-
transformOrigin:
|
|
116
|
+
top: (l == null ? void 0 : l.top) ?? 0,
|
|
117
|
+
left: (l == null ? void 0 : l.left) ?? 0,
|
|
118
|
+
visibility: l ? "visible" : "hidden",
|
|
119
|
+
transformOrigin: L(n, t)
|
|
121
120
|
},
|
|
122
|
-
className:
|
|
123
|
-
"relative z-50 min-w-44 rounded-lg border border-
|
|
121
|
+
className: R(
|
|
122
|
+
"relative z-50 min-w-44 rounded-lg border border-menu-stroke bg-elevated p-1",
|
|
124
123
|
"text-foreground shadow-elevation outline-none",
|
|
125
124
|
r
|
|
126
125
|
),
|
|
127
|
-
...
|
|
126
|
+
...d,
|
|
128
127
|
children: [
|
|
129
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ h(_, { origin: L(n, t) }),
|
|
130
129
|
p
|
|
131
130
|
]
|
|
132
131
|
}
|
|
@@ -134,78 +133,78 @@ function W({
|
|
|
134
133
|
document.body
|
|
135
134
|
);
|
|
136
135
|
}
|
|
137
|
-
const
|
|
136
|
+
const q = s.forwardRef(
|
|
138
137
|
({
|
|
139
138
|
className: r,
|
|
140
139
|
startContent: t,
|
|
141
140
|
danger: n,
|
|
142
|
-
disabled:
|
|
143
|
-
restoreFocus:
|
|
144
|
-
onSelect:
|
|
145
|
-
children:
|
|
146
|
-
...
|
|
147
|
-
},
|
|
148
|
-
const { setOpen:
|
|
149
|
-
var
|
|
150
|
-
|
|
141
|
+
disabled: f,
|
|
142
|
+
restoreFocus: p = !0,
|
|
143
|
+
onSelect: d,
|
|
144
|
+
children: a,
|
|
145
|
+
...m
|
|
146
|
+
}, w) => {
|
|
147
|
+
const { setOpen: c, triggerRef: l } = k("DropdownItem"), D = () => {
|
|
148
|
+
var g;
|
|
149
|
+
f || (d == null || d(), c(!1), p && ((g = l.current) == null || g.focus()));
|
|
151
150
|
};
|
|
152
|
-
return /* @__PURE__ */
|
|
151
|
+
return /* @__PURE__ */ N(
|
|
153
152
|
"div",
|
|
154
153
|
{
|
|
155
|
-
ref:
|
|
154
|
+
ref: w,
|
|
156
155
|
role: "menuitem",
|
|
157
156
|
tabIndex: -1,
|
|
158
|
-
"aria-disabled":
|
|
159
|
-
onClick:
|
|
160
|
-
onKeyDown: (
|
|
161
|
-
(
|
|
157
|
+
"aria-disabled": f || void 0,
|
|
158
|
+
onClick: D,
|
|
159
|
+
onKeyDown: (g) => {
|
|
160
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), D());
|
|
162
161
|
},
|
|
163
|
-
className:
|
|
164
|
-
"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-
|
|
162
|
+
className: R(
|
|
163
|
+
"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-m font-medium",
|
|
165
164
|
"outline-none transition-colors duration-150",
|
|
166
165
|
"focus-visible:ring-3 focus-visible:ring-ring",
|
|
167
166
|
n ? "text-danger" : "text-foreground",
|
|
168
|
-
|
|
167
|
+
f ? "pointer-events-none opacity-50" : n ? "hover:bg-danger/10 focus:bg-danger/10" : "hover:bg-action-primary-soft hover:text-action-primary-text focus:bg-action-primary-soft focus:text-action-primary-text",
|
|
169
168
|
"[&_svg]:size-4 [&_svg]:shrink-0",
|
|
170
169
|
r
|
|
171
170
|
),
|
|
172
|
-
...
|
|
171
|
+
...m,
|
|
173
172
|
children: [
|
|
174
173
|
t,
|
|
175
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ h("span", { className: "flex-1", children: a })
|
|
176
175
|
]
|
|
177
176
|
}
|
|
178
177
|
);
|
|
179
178
|
}
|
|
180
179
|
);
|
|
181
|
-
|
|
182
|
-
const
|
|
180
|
+
q.displayName = "DropdownItem";
|
|
181
|
+
const F = s.forwardRef(({ className: r, ...t }, n) => /* @__PURE__ */ h(
|
|
183
182
|
"div",
|
|
184
183
|
{
|
|
185
184
|
ref: n,
|
|
186
185
|
role: "separator",
|
|
187
|
-
className:
|
|
186
|
+
className: R("my-1 h-px bg-menu-stroke", r),
|
|
188
187
|
...t
|
|
189
188
|
}
|
|
190
189
|
));
|
|
191
|
-
|
|
192
|
-
const
|
|
190
|
+
F.displayName = "DropdownSeparator";
|
|
191
|
+
const T = s.forwardRef(({ className: r, ...t }, n) => /* @__PURE__ */ h(
|
|
193
192
|
"div",
|
|
194
193
|
{
|
|
195
194
|
ref: n,
|
|
196
|
-
className:
|
|
195
|
+
className: R(
|
|
197
196
|
"px-2 py-1.5 text-xs font-normal text-muted-foreground select-none",
|
|
198
197
|
r
|
|
199
198
|
),
|
|
200
199
|
...t
|
|
201
200
|
}
|
|
202
201
|
));
|
|
203
|
-
|
|
202
|
+
T.displayName = "DropdownLabel";
|
|
204
203
|
export {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
204
|
+
B as Dropdown,
|
|
205
|
+
V as DropdownContent,
|
|
206
|
+
q as DropdownItem,
|
|
207
|
+
T as DropdownLabel,
|
|
208
|
+
F as DropdownSeparator,
|
|
209
|
+
U as DropdownTrigger
|
|
211
210
|
};
|