@actioneer/ads 0.2.3 → 0.3.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/chain-of-thought.d.ts +88 -19
- package/components/ai-elements/chain-of-thought.js +358 -149
- package/components/ai-elements/chart.d.ts +30 -0
- package/components/ai-elements/chart.js +303 -0
- package/components/ai-elements/index.d.ts +2 -1
- package/components/ai-elements/message.d.ts +19 -4
- package/components/ai-elements/message.js +177 -130
- package/components/ai-elements/research-activity.d.ts +45 -0
- package/components/ai-elements/research-activity.js +260 -0
- package/components/ai-elements/task-progress.js +69 -66
- package/components/ai-elements/tool.js +42 -38
- package/components/answer.d.ts +19 -0
- package/components/answer.js +363 -300
- package/components/assistant-ui/attachment.js +5 -1
- package/components/assistant-ui/composer-deep-research.js +44 -29
- package/components/assistant-ui/composer-harness.js +55 -38
- package/components/assistant-ui/composer.js +16 -16
- package/components/assistant-ui/index.d.ts +0 -1
- package/components/assistant-ui/message.d.ts +7 -0
- package/components/assistant-ui/message.js +64 -51
- package/components/assistant-ui/primitives.d.ts +1 -1
- package/components/assistant-ui/thread-context.d.ts +2 -0
- package/components/assistant-ui/thread.js +34 -32
- package/components/brand-texture.d.ts +37 -0
- package/components/brand-texture.js +54 -0
- package/components/chart.d.ts +64 -2
- package/components/chart.js +717 -456
- package/components/code-block.d.ts +36 -0
- package/components/code-block.js +136 -0
- package/components/command-palette.d.ts +43 -0
- package/components/command-palette.js +146 -0
- package/components/drawer.d.ts +1 -1
- package/components/file-dropzone.d.ts +32 -0
- package/components/file-dropzone.js +134 -0
- package/components/index.d.ts +11 -0
- package/components/index.js +480 -430
- package/components/infinite-canvas.d.ts +50 -0
- package/components/infinite-canvas.js +215 -0
- package/components/page-header.d.ts +22 -0
- package/components/page-header.js +52 -0
- package/components/resizable-panel.d.ts +29 -0
- package/components/resizable-panel.js +102 -0
- package/components/reveal.d.ts +36 -0
- package/components/reveal.js +35 -0
- package/components/scroll-area.d.ts +19 -0
- package/components/scroll-area.js +57 -0
- package/components/setting-row.d.ts +35 -0
- package/components/setting-row.js +86 -0
- package/components/sidebar.d.ts +4 -1
- package/components/sidebar.js +134 -132
- package/components/stepper.d.ts +32 -0
- package/components/stepper.js +113 -0
- package/components/table.js +16 -15
- package/components/tabs.js +1 -1
- package/hooks/agents-ui/voice-visualizer-types.js +1 -0
- package/lib/icons.d.ts +24 -0
- package/lib/icons.js +100 -110
- package/lib/motion.d.ts +5 -3
- package/lib/motion.js +46 -20
- package/lib/router.js +19 -0
- package/lib/utils.js +5 -0
- package/llms.txt +143 -39
- package/manifest.json +1232 -100
- package/package.json +2 -2
- package/styles.css +71 -28
- package/theme.css +19 -15
- package/components/ai-elements/reasoning.d.ts +0 -26
- package/components/ai-elements/reasoning.js +0 -131
- package/components/assistant-ui/smart-message-text.d.ts +0 -15
- package/components/assistant-ui/smart-message-text.js +0 -29
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* CodeBlock — block-level source display: a query, a config, a tool payload.
|
|
5
|
+
* The inline sibling is `Code`; reach for this whenever the snippet owns its
|
|
6
|
+
* own line(s).
|
|
7
|
+
*
|
|
8
|
+
* A recessed, static surface — filled, never elevated (elevation means
|
|
9
|
+
* actionable) and never bordered. Long snippets scroll inside the block, so
|
|
10
|
+
* cap the height from the outside (`className="max-h-96"`) rather than letting
|
|
11
|
+
* the page grow.
|
|
12
|
+
*
|
|
13
|
+
* There is no syntax highlighting: it would cost a highlighter dependency and
|
|
14
|
+
* a second color language competing with the brand's monochrome. `language` is
|
|
15
|
+
* a label, not a lexer. The mono face and tabular figures carry the "this is
|
|
16
|
+
* code" signal.
|
|
17
|
+
*/
|
|
18
|
+
declare const codeBlockVariants: (props?: ({
|
|
19
|
+
variant?: "soft" | "plain" | null | undefined;
|
|
20
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
21
|
+
export interface CodeBlockProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children">, VariantProps<typeof codeBlockVariants> {
|
|
22
|
+
/** The source to display, verbatim. */
|
|
23
|
+
code: string;
|
|
24
|
+
/** Language label for the header, e.g. `sql`. A label only — not a lexer. */
|
|
25
|
+
language?: string;
|
|
26
|
+
/** Leading header label, e.g. `schema.yaml`. Takes the header's start slot. */
|
|
27
|
+
filename?: string;
|
|
28
|
+
/** Show the copy control. */
|
|
29
|
+
isCopyable?: boolean;
|
|
30
|
+
/** Number the lines in a non-selectable gutter. */
|
|
31
|
+
showLineNumbers?: boolean;
|
|
32
|
+
/** Accessible label for the copy control. */
|
|
33
|
+
copyLabel?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare const CodeBlock: React.ForwardRefExoticComponent<CodeBlockProps & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
export { codeBlockVariants };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as p, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import * as r from "react";
|
|
4
|
+
import { cva as k } from "class-variance-authority";
|
|
5
|
+
import { Button as C } from "./button.js";
|
|
6
|
+
import { Check as w, Copy as N } from "../lib/icons.js";
|
|
7
|
+
import { cn as u } from "../lib/cn.js";
|
|
8
|
+
const B = k(
|
|
9
|
+
"group/code-block relative w-full overflow-hidden rounded-lg text-xs",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
/** Recessed fill — the default, for code sitting on a card or panel. */
|
|
14
|
+
soft: "bg-muted",
|
|
15
|
+
/** No fill, for code already inside a filled or tinted surface. */
|
|
16
|
+
plain: "bg-transparent"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: { variant: "soft" }
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
function T(n = 2e3) {
|
|
23
|
+
const [o, a] = r.useState(!1), t = r.useRef(null);
|
|
24
|
+
r.useEffect(
|
|
25
|
+
() => () => {
|
|
26
|
+
t.current !== null && window.clearTimeout(t.current);
|
|
27
|
+
},
|
|
28
|
+
[]
|
|
29
|
+
);
|
|
30
|
+
const c = r.useCallback(
|
|
31
|
+
(i) => {
|
|
32
|
+
!i || typeof navigator > "u" || !navigator.clipboard || navigator.clipboard.writeText(i).then(
|
|
33
|
+
() => {
|
|
34
|
+
a(!0), t.current !== null && window.clearTimeout(t.current), t.current = window.setTimeout(
|
|
35
|
+
() => a(!1),
|
|
36
|
+
n
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
() => {
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
[n]
|
|
44
|
+
);
|
|
45
|
+
return { isCopied: o, copy: c };
|
|
46
|
+
}
|
|
47
|
+
const R = r.forwardRef(
|
|
48
|
+
({
|
|
49
|
+
className: n,
|
|
50
|
+
code: o,
|
|
51
|
+
language: a,
|
|
52
|
+
filename: t,
|
|
53
|
+
variant: c,
|
|
54
|
+
isCopyable: i = !0,
|
|
55
|
+
showLineNumbers: l = !1,
|
|
56
|
+
copyLabel: h = "Copy code",
|
|
57
|
+
...x
|
|
58
|
+
}, y) => {
|
|
59
|
+
const { isCopied: m, copy: v } = T(), d = !!(t || a), b = r.useMemo(
|
|
60
|
+
() => l ? o.replace(/\n$/, "").split(`
|
|
61
|
+
`) : [],
|
|
62
|
+
[o, l]
|
|
63
|
+
), s = i ? /* @__PURE__ */ e(
|
|
64
|
+
C,
|
|
65
|
+
{
|
|
66
|
+
type: "button",
|
|
67
|
+
variant: "ghost",
|
|
68
|
+
size: "icon-xs",
|
|
69
|
+
"aria-label": h,
|
|
70
|
+
onClick: () => v(o),
|
|
71
|
+
children: m ? /* @__PURE__ */ e(w, { "aria-hidden": !0, className: "text-success" }) : /* @__PURE__ */ e(N, { "aria-hidden": !0 })
|
|
72
|
+
}
|
|
73
|
+
) : null;
|
|
74
|
+
return /* @__PURE__ */ p(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
ref: y,
|
|
78
|
+
"data-slot": "code-block",
|
|
79
|
+
className: u(B({ variant: c }), n),
|
|
80
|
+
...x,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ e("span", { "aria-live": "polite", className: "sr-only", children: m ? "Copied to clipboard" : "" }),
|
|
83
|
+
d && /* @__PURE__ */ p(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
"data-slot": "code-block-header",
|
|
87
|
+
className: "flex items-center gap-2 px-3 py-1.5 text-tertiary",
|
|
88
|
+
children: [
|
|
89
|
+
t && /* @__PURE__ */ e("span", { className: "min-w-0 truncate font-medium text-secondary", children: t }),
|
|
90
|
+
a && /* @__PURE__ */ e("span", { className: "shrink-0 font-mono text-[11px] uppercase", children: a }),
|
|
91
|
+
s && /* @__PURE__ */ e("span", { className: "ml-auto shrink-0", children: s })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
!d && s && /* @__PURE__ */ e(
|
|
96
|
+
"span",
|
|
97
|
+
{
|
|
98
|
+
className: u(
|
|
99
|
+
"absolute top-1.5 right-1.5 z-10 opacity-0 transition-opacity duration-(--duration-fast) ease-out",
|
|
100
|
+
"group-hover/code-block:opacity-100 focus-within:opacity-100",
|
|
101
|
+
"motion-reduce:transition-none"
|
|
102
|
+
),
|
|
103
|
+
children: s
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ e(
|
|
107
|
+
"pre",
|
|
108
|
+
{
|
|
109
|
+
"data-slot": "code-block-content",
|
|
110
|
+
className: u(
|
|
111
|
+
"overflow-x-auto px-3 leading-relaxed text-foreground tabular-nums",
|
|
112
|
+
d ? "pb-3" : "py-3"
|
|
113
|
+
),
|
|
114
|
+
children: /* @__PURE__ */ e("code", { className: "font-mono", children: l ? b.map((g, f) => /* @__PURE__ */ p("span", { className: "grid grid-cols-[2ch_1fr] gap-3", children: [
|
|
115
|
+
/* @__PURE__ */ e(
|
|
116
|
+
"span",
|
|
117
|
+
{
|
|
118
|
+
"aria-hidden": !0,
|
|
119
|
+
className: "select-none text-right text-tertiary",
|
|
120
|
+
children: f + 1
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
/* @__PURE__ */ e("span", { children: g })
|
|
124
|
+
] }, f)) : o })
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
R.displayName = "CodeBlock";
|
|
133
|
+
export {
|
|
134
|
+
R as CodeBlock,
|
|
135
|
+
B as codeBlockVariants
|
|
136
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* CommandPalette — the global-search / command surface (⌘K pattern).
|
|
4
|
+
*
|
|
5
|
+
* A portaled, top-anchored dialog with a search input and a grouped,
|
|
6
|
+
* keyboard-navigable result list. Deliberately NOT animated: the motion
|
|
7
|
+
* principles class a command palette as a frequent, keyboard-initiated
|
|
8
|
+
* action ("frequent = fast or none"), so it appears and dismisses
|
|
9
|
+
* instantly.
|
|
10
|
+
*
|
|
11
|
+
* Fully props-driven: the consumer supplies flat `items` (each optionally
|
|
12
|
+
* tagged with a `group`) and receives `onSelect`; filtering is a simple
|
|
13
|
+
* case-insensitive substring match over label + keywords, overridable via
|
|
14
|
+
* `filter`.
|
|
15
|
+
*/
|
|
16
|
+
export interface CommandPaletteItem {
|
|
17
|
+
id: string;
|
|
18
|
+
/** Primary label — also the default match text. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Section heading the item is listed under. Ungrouped items come first. */
|
|
21
|
+
group?: string;
|
|
22
|
+
/** Leading icon slot (sized to the row's text). */
|
|
23
|
+
icon?: React.ReactNode;
|
|
24
|
+
/** Muted right-aligned hint (a path, type, or shortcut). */
|
|
25
|
+
hint?: string;
|
|
26
|
+
/** Extra text the filter matches against (synonyms, paths). */
|
|
27
|
+
keywords?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface CommandPaletteProps {
|
|
30
|
+
open: boolean;
|
|
31
|
+
onOpenChange: (open: boolean) => void;
|
|
32
|
+
items: readonly CommandPaletteItem[];
|
|
33
|
+
/** Called with the chosen item; the palette closes itself afterwards. */
|
|
34
|
+
onSelect: (item: CommandPaletteItem) => void;
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
emptyLabel?: string;
|
|
37
|
+
/** Accessible name for the dialog. */
|
|
38
|
+
"aria-label"?: string;
|
|
39
|
+
/** Override the match predicate (query is already lowercased). */
|
|
40
|
+
filter?: (item: CommandPaletteItem, query: string) => boolean;
|
|
41
|
+
className?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function CommandPalette({ open, onOpenChange, items, onSelect, placeholder, emptyLabel, "aria-label": ariaLabel, filter, className, }: CommandPaletteProps): React.ReactPortal | null;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as d, jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import * as o from "react";
|
|
4
|
+
import { createPortal as S } from "react-dom";
|
|
5
|
+
import { Search as q } from "../lib/icons.js";
|
|
6
|
+
import { cn as k } from "../lib/cn.js";
|
|
7
|
+
const C = (a, i) => `${a.label} ${a.keywords ?? ""}`.toLowerCase().includes(i);
|
|
8
|
+
function _({
|
|
9
|
+
open: a,
|
|
10
|
+
onOpenChange: i,
|
|
11
|
+
items: p,
|
|
12
|
+
onSelect: R,
|
|
13
|
+
placeholder: $ = "Search…",
|
|
14
|
+
emptyLabel: A = "No results",
|
|
15
|
+
"aria-label": D = "Global search",
|
|
16
|
+
filter: h = C,
|
|
17
|
+
className: E
|
|
18
|
+
}) {
|
|
19
|
+
const f = o.useId(), v = o.useRef(null), y = o.useRef(null), g = o.useRef(null), [m, b] = o.useState(""), [c, x] = o.useState(0), n = o.useMemo(() => {
|
|
20
|
+
const e = m.trim().toLowerCase();
|
|
21
|
+
return e ? p.filter((r) => h(r, e)) : [...p];
|
|
22
|
+
}, [p, m, h]), M = o.useMemo(() => {
|
|
23
|
+
const e = [], r = /* @__PURE__ */ new Map();
|
|
24
|
+
for (const t of n)
|
|
25
|
+
r.has(t.group) || (r.set(t.group, []), e.push(t.group)), r.get(t.group).push(t);
|
|
26
|
+
return e.map((t) => ({ group: t, items: r.get(t) }));
|
|
27
|
+
}, [n]), u = n[c];
|
|
28
|
+
o.useEffect(() => {
|
|
29
|
+
x(0);
|
|
30
|
+
}, [m, a]), o.useEffect(() => {
|
|
31
|
+
if (!a) return;
|
|
32
|
+
g.current = document.activeElement, b("");
|
|
33
|
+
const e = document.body.style.overflow;
|
|
34
|
+
document.body.style.overflow = "hidden";
|
|
35
|
+
const r = requestAnimationFrame(() => {
|
|
36
|
+
var t;
|
|
37
|
+
return (t = v.current) == null ? void 0 : t.focus();
|
|
38
|
+
});
|
|
39
|
+
return () => {
|
|
40
|
+
var t, l;
|
|
41
|
+
document.body.style.overflow = e, cancelAnimationFrame(r), (l = (t = g.current) == null ? void 0 : t.focus) == null || l.call(t);
|
|
42
|
+
};
|
|
43
|
+
}, [a]), o.useEffect(() => {
|
|
44
|
+
var e, r;
|
|
45
|
+
!a || !u || (r = (e = y.current) == null ? void 0 : e.querySelector(`[data-index="${c}"]`)) == null || r.scrollIntoView({ block: "nearest" });
|
|
46
|
+
}, [a, u, c]);
|
|
47
|
+
const w = (e) => {
|
|
48
|
+
i(!1), R(e);
|
|
49
|
+
}, I = (e) => {
|
|
50
|
+
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
|
+
return a ? S(
|
|
53
|
+
/* @__PURE__ */ d("div", { className: "fixed inset-0 z-50 flex items-start justify-center px-4 pt-[15vh]", children: [
|
|
54
|
+
/* @__PURE__ */ s(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
"aria-hidden": !0,
|
|
58
|
+
className: "absolute inset-0 bg-overlay",
|
|
59
|
+
onClick: () => i(!1)
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ d(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
role: "dialog",
|
|
66
|
+
"aria-modal": "true",
|
|
67
|
+
"aria-label": D,
|
|
68
|
+
className: k(
|
|
69
|
+
"relative flex w-full max-w-lg flex-col overflow-hidden",
|
|
70
|
+
"rounded-xl bg-elevated text-foreground shadow-elevation",
|
|
71
|
+
E
|
|
72
|
+
),
|
|
73
|
+
onKeyDown: I,
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2.5 px-4 py-3", children: [
|
|
76
|
+
/* @__PURE__ */ s(q, { "aria-hidden": !0, className: "size-4 shrink-0 text-muted-foreground" }),
|
|
77
|
+
/* @__PURE__ */ s(
|
|
78
|
+
"input",
|
|
79
|
+
{
|
|
80
|
+
ref: v,
|
|
81
|
+
role: "combobox",
|
|
82
|
+
"aria-expanded": "true",
|
|
83
|
+
"aria-controls": f,
|
|
84
|
+
"aria-activedescendant": u ? `${f}-${c}` : void 0,
|
|
85
|
+
"aria-autocomplete": "list",
|
|
86
|
+
value: m,
|
|
87
|
+
onChange: (e) => b(e.target.value),
|
|
88
|
+
placeholder: $,
|
|
89
|
+
className: "w-full bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground"
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ s(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
ref: y,
|
|
97
|
+
id: f,
|
|
98
|
+
role: "listbox",
|
|
99
|
+
"aria-label": "Results",
|
|
100
|
+
className: "max-h-80 overflow-y-auto p-1.5 pt-0",
|
|
101
|
+
children: n.length === 0 ? /* @__PURE__ */ s("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: [
|
|
102
|
+
e && /* @__PURE__ */ s("div", { className: "px-2.5 pb-1 pt-2.5 text-xs font-medium text-muted-foreground select-none", children: e }),
|
|
103
|
+
r.map((t) => {
|
|
104
|
+
const l = n.indexOf(t), N = l === c;
|
|
105
|
+
return /* @__PURE__ */ d(
|
|
106
|
+
"div",
|
|
107
|
+
{
|
|
108
|
+
id: `${f}-${l}`,
|
|
109
|
+
"data-index": l,
|
|
110
|
+
role: "option",
|
|
111
|
+
"aria-selected": N,
|
|
112
|
+
onPointerMove: () => x(l),
|
|
113
|
+
onClick: () => w(t),
|
|
114
|
+
className: k(
|
|
115
|
+
"flex cursor-default items-center gap-2 rounded-md px-2.5 py-1.5 text-xs",
|
|
116
|
+
N ? "bg-fill text-foreground" : "text-secondary"
|
|
117
|
+
),
|
|
118
|
+
children: [
|
|
119
|
+
t.icon && /* @__PURE__ */ s(
|
|
120
|
+
"span",
|
|
121
|
+
{
|
|
122
|
+
"aria-hidden": !0,
|
|
123
|
+
className: "flex shrink-0 items-center text-muted-foreground [&_svg]:size-4",
|
|
124
|
+
children: t.icon
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: t.label }),
|
|
128
|
+
t.hint && /* @__PURE__ */ s("span", { className: "shrink-0 text-xs text-tertiary", children: t.hint })
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
t.id
|
|
132
|
+
);
|
|
133
|
+
})
|
|
134
|
+
] }, e ?? "__ungrouped"))
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] }),
|
|
141
|
+
document.body
|
|
142
|
+
) : null;
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
_ as CommandPalette
|
|
146
|
+
};
|
package/components/drawer.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface DrawerProps extends VariantProps<typeof panelVariants> {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* ModalDrawer — legacy portaled drawer. Kept for the demo product's
|
|
17
|
-
* answer-sources /
|
|
17
|
+
* answer-sources / voice-campaigns screens where a blocking
|
|
18
18
|
* side panel over the whole viewport is the intended pattern. New code should
|
|
19
19
|
* prefer `Drawer` (the inline variant) — it doesn't leave the page while it's
|
|
20
20
|
* open, so users can keep referencing content beside it.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* FileDropzone — the drop-or-browse target for file input. ADS previously had
|
|
4
|
+
* no file primitive at all, so every upload surface hand-rolled a hidden
|
|
5
|
+
* `<input type="file">`.
|
|
6
|
+
*
|
|
7
|
+
* A dashed edge is the one sanctioned stroke here: it is the affordance
|
|
8
|
+
* ("something goes in this hole"), not decoration. The zone is actionable, so
|
|
9
|
+
* it takes hover, focus and press feedback; while a file is dragged over it
|
|
10
|
+
* the fill deepens rather than the stroke thickening, so nothing jumps.
|
|
11
|
+
*/
|
|
12
|
+
declare const fileDropzoneVariants: (props?: ({
|
|
13
|
+
isDragging?: boolean | null | undefined;
|
|
14
|
+
isDisabled?: boolean | null | undefined;
|
|
15
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
16
|
+
export interface FileDropzoneProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onDrop" | "onChange"> {
|
|
17
|
+
/** Native accept string, e.g. `"image/*,.csv"`. */
|
|
18
|
+
accept?: string;
|
|
19
|
+
multiple?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Fires with the chosen files, whether dropped or browsed. */
|
|
22
|
+
onFiles?: (files: File[]) => void;
|
|
23
|
+
/** The current selection — render the chosen state and a clear control. */
|
|
24
|
+
files?: File[];
|
|
25
|
+
onClear?: () => void;
|
|
26
|
+
/** Headline copy; defaults to a browse prompt. */
|
|
27
|
+
label?: React.ReactNode;
|
|
28
|
+
/** Sub-line, e.g. "CSV up to 10 MB". */
|
|
29
|
+
hint?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export declare const FileDropzone: React.ForwardRefExoticComponent<FileDropzoneProps & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export { fileDropzoneVariants };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as t, jsx as r, Fragment as f } from "react/jsx-runtime";
|
|
3
|
+
import * as i from "react";
|
|
4
|
+
import { cva as C } from "class-variance-authority";
|
|
5
|
+
import { cn as v } from "../lib/cn.js";
|
|
6
|
+
import { Button as D } from "./button.js";
|
|
7
|
+
import { FileText as R, Close as B, Upload as w } from "../lib/icons.js";
|
|
8
|
+
const T = C(
|
|
9
|
+
v(
|
|
10
|
+
"flex w-full cursor-pointer flex-col items-center justify-center gap-2 rounded-xl px-6 py-8 text-center",
|
|
11
|
+
"border-2 border-dashed border-border-strong bg-surface outline-none",
|
|
12
|
+
"transition-[background-color,border-color,transform] duration-(--duration-fast) ease-out",
|
|
13
|
+
"hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring",
|
|
14
|
+
"active:scale-(--scale-press) motion-reduce:transition-none"
|
|
15
|
+
),
|
|
16
|
+
{
|
|
17
|
+
variants: {
|
|
18
|
+
isDragging: {
|
|
19
|
+
true: "border-ring bg-accent",
|
|
20
|
+
false: ""
|
|
21
|
+
},
|
|
22
|
+
isDisabled: {
|
|
23
|
+
true: "pointer-events-none opacity-50",
|
|
24
|
+
false: ""
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: { isDragging: !1, isDisabled: !1 }
|
|
28
|
+
}
|
|
29
|
+
), j = (a) => a < 1024 ? `${a} B` : a < 1024 * 1024 ? `${Math.round(a / 1024)} KB` : `${(a / (1024 * 1024)).toFixed(1)} MB`, $ = i.forwardRef(
|
|
30
|
+
({
|
|
31
|
+
className: a,
|
|
32
|
+
accept: b,
|
|
33
|
+
multiple: c = !1,
|
|
34
|
+
disabled: n = !1,
|
|
35
|
+
onFiles: l,
|
|
36
|
+
files: s,
|
|
37
|
+
onClear: g,
|
|
38
|
+
label: N,
|
|
39
|
+
hint: p,
|
|
40
|
+
...y
|
|
41
|
+
}, z) => {
|
|
42
|
+
const m = i.useRef(null), [h, d] = i.useState(!1), o = i.useRef(0), x = (e) => {
|
|
43
|
+
e != null && e.length && (l == null || l(c ? Array.from(e) : [e[0]]));
|
|
44
|
+
}, u = () => {
|
|
45
|
+
var e;
|
|
46
|
+
return (e = m.current) == null ? void 0 : e.click();
|
|
47
|
+
}, k = !!(s != null && s.length);
|
|
48
|
+
return /* @__PURE__ */ t(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
ref: z,
|
|
52
|
+
"data-slot": "file-dropzone",
|
|
53
|
+
"data-dragging": h || void 0,
|
|
54
|
+
role: "button",
|
|
55
|
+
tabIndex: n ? -1 : 0,
|
|
56
|
+
"aria-disabled": n || void 0,
|
|
57
|
+
onClick: u,
|
|
58
|
+
onKeyDown: (e) => {
|
|
59
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), u());
|
|
60
|
+
},
|
|
61
|
+
onDragEnter: (e) => {
|
|
62
|
+
e.preventDefault(), o.current += 1, d(!0);
|
|
63
|
+
},
|
|
64
|
+
onDragOver: (e) => e.preventDefault(),
|
|
65
|
+
onDragLeave: () => {
|
|
66
|
+
o.current -= 1, o.current <= 0 && (o.current = 0, d(!1));
|
|
67
|
+
},
|
|
68
|
+
onDrop: (e) => {
|
|
69
|
+
e.preventDefault(), o.current = 0, d(!1), n || x(e.dataTransfer.files);
|
|
70
|
+
},
|
|
71
|
+
className: v(
|
|
72
|
+
T({ isDragging: h, isDisabled: n }),
|
|
73
|
+
a
|
|
74
|
+
),
|
|
75
|
+
...y,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ r(
|
|
78
|
+
"input",
|
|
79
|
+
{
|
|
80
|
+
ref: m,
|
|
81
|
+
hidden: !0,
|
|
82
|
+
type: "file",
|
|
83
|
+
accept: b,
|
|
84
|
+
multiple: c,
|
|
85
|
+
disabled: n,
|
|
86
|
+
onChange: (e) => {
|
|
87
|
+
x(e.currentTarget.files), e.currentTarget.value = "";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
),
|
|
91
|
+
k ? /* @__PURE__ */ t(f, { children: [
|
|
92
|
+
/* @__PURE__ */ r("span", { "aria-hidden": !0, className: "text-tertiary [&>svg]:size-6", children: /* @__PURE__ */ r(R, {}) }),
|
|
93
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-0.5", children: s.map((e) => /* @__PURE__ */ t("span", { className: "text-base text-foreground", children: [
|
|
94
|
+
e.name,
|
|
95
|
+
/* @__PURE__ */ r("span", { className: "ml-2 text-xs text-tertiary tabular-nums", children: j(e.size) })
|
|
96
|
+
] }, e.name)) }),
|
|
97
|
+
/* @__PURE__ */ t("div", { className: "mt-1 flex items-center gap-2", children: [
|
|
98
|
+
/* @__PURE__ */ r(D, { size: "sm", variant: "secondary", onClick: (e) => {
|
|
99
|
+
e.stopPropagation(), u();
|
|
100
|
+
}, children: "Replace" }),
|
|
101
|
+
g && /* @__PURE__ */ r(
|
|
102
|
+
D,
|
|
103
|
+
{
|
|
104
|
+
size: "sm",
|
|
105
|
+
variant: "ghost",
|
|
106
|
+
startContent: /* @__PURE__ */ r(B, {}),
|
|
107
|
+
onClick: (e) => {
|
|
108
|
+
e.stopPropagation(), g();
|
|
109
|
+
},
|
|
110
|
+
children: "Clear"
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] })
|
|
114
|
+
] }) : /* @__PURE__ */ t(f, { children: [
|
|
115
|
+
/* @__PURE__ */ r("span", { "aria-hidden": !0, className: "text-tertiary [&>svg]:size-6", children: /* @__PURE__ */ r(w, {}) }),
|
|
116
|
+
/* @__PURE__ */ r("span", { className: "text-base text-foreground", children: N ?? /* @__PURE__ */ t(f, { children: [
|
|
117
|
+
"Drop ",
|
|
118
|
+
c ? "files" : "a file",
|
|
119
|
+
" here, or",
|
|
120
|
+
" ",
|
|
121
|
+
/* @__PURE__ */ r("span", { className: "underline underline-offset-4", children: "browse" })
|
|
122
|
+
] }) }),
|
|
123
|
+
p && /* @__PURE__ */ r("span", { className: "text-xs text-tertiary", children: p })
|
|
124
|
+
] })
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
$.displayName = "FileDropzone";
|
|
131
|
+
export {
|
|
132
|
+
$ as FileDropzone,
|
|
133
|
+
T as fileDropzoneVariants
|
|
134
|
+
};
|
package/components/index.d.ts
CHANGED
|
@@ -3,11 +3,18 @@ export { interactive, type InteractiveProps } from '../lib/interactive';
|
|
|
3
3
|
export { TooltipProvider } from './ui/tooltip';
|
|
4
4
|
export * from './button';
|
|
5
5
|
export * from './spinner';
|
|
6
|
+
export * from './reveal';
|
|
6
7
|
export * from './field';
|
|
7
8
|
export * from './typography';
|
|
8
9
|
export * from './link';
|
|
9
10
|
export * from './divider';
|
|
10
11
|
export * from './kbd';
|
|
12
|
+
export * from './code-block';
|
|
13
|
+
export * from './setting-row';
|
|
14
|
+
export * from './file-dropzone';
|
|
15
|
+
export * from './scroll-area';
|
|
16
|
+
export * from './stepper';
|
|
17
|
+
export * from './resizable-panel';
|
|
11
18
|
export * from './input';
|
|
12
19
|
export * from './input-field';
|
|
13
20
|
export * from './textarea';
|
|
@@ -20,6 +27,7 @@ export * from './autocomplete';
|
|
|
20
27
|
export * from './slider';
|
|
21
28
|
export * from './segmented';
|
|
22
29
|
export * from './modal';
|
|
30
|
+
export * from './command-palette';
|
|
23
31
|
export * from './drawer';
|
|
24
32
|
export * from './popover';
|
|
25
33
|
export * from './tooltip';
|
|
@@ -30,6 +38,7 @@ export * from './card';
|
|
|
30
38
|
export * from './carousel';
|
|
31
39
|
export * from './chart';
|
|
32
40
|
export * from './connector-card';
|
|
41
|
+
export * from './infinite-canvas';
|
|
33
42
|
export * from './table';
|
|
34
43
|
export * from './tabs';
|
|
35
44
|
export * from './tree';
|
|
@@ -41,10 +50,12 @@ export * from './timeline';
|
|
|
41
50
|
export * from './alert';
|
|
42
51
|
export * from './brand-loader';
|
|
43
52
|
export * from './pixel-blast-svg';
|
|
53
|
+
export * from './brand-texture';
|
|
44
54
|
export * from './progress';
|
|
45
55
|
export * from './progress-circle';
|
|
46
56
|
export * from './skeleton';
|
|
47
57
|
export * from './empty-state';
|
|
58
|
+
export * from './page-header';
|
|
48
59
|
export * from './navbar';
|
|
49
60
|
export * from './breadcrumbs';
|
|
50
61
|
export * from './pagination';
|