@cognite/aura 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN.md +1651 -7
- package/README.md +45 -3
- package/dist/components/index.d.ts +4 -2
- package/dist/components/index.js +58 -325
- package/dist/components/ui/core/accordion/accordion.js +79 -114
- package/dist/components/ui/core/action-toolbar/action-toolbar.js +108 -176
- package/dist/components/ui/core/alert/alert.js +158 -206
- package/dist/components/ui/core/avatar/avatar.js +64 -90
- package/dist/components/ui/core/badge/badge.js +73 -108
- package/dist/components/ui/core/banner/banner.js +146 -215
- package/dist/components/ui/core/breadcrumb/breadcrumb.js +105 -200
- package/dist/components/ui/core/button/button.js +47 -52
- package/dist/components/ui/core/button-group/button-group.js +40 -79
- package/dist/components/ui/core/card/card.js +102 -185
- package/dist/components/ui/core/chart/chart.js +116 -206
- package/dist/components/ui/core/chart/index.js +2 -8
- package/dist/components/ui/core/checkbox/checkbox.js +67 -132
- package/dist/components/ui/core/checkbox/checkbox.metadata.js +7 -7
- package/dist/components/ui/core/code-block/code-block.d.ts +1 -1
- package/dist/components/ui/core/code-block/code-block.js +179 -267
- package/dist/components/ui/core/collapsible/collapsible.js +29 -49
- package/dist/components/ui/core/combobox/combobox.js +41 -0
- package/dist/components/ui/core/command/command.js +85 -150
- package/dist/components/ui/core/count/count.js +21 -32
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +60 -83
- package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +1 -2
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +36 -62
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +63 -98
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +1 -2
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +60 -81
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +118 -189
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +1 -2
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +104 -158
- package/dist/components/ui/core/date-time-pickers/index.d.ts +2 -0
- package/dist/components/ui/core/date-time-pickers/index.js +5 -8
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +42 -56
- package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +66 -117
- package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.js +63 -93
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +64 -98
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +38 -67
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +0 -2
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +23 -39
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +52 -62
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +18 -18
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +24 -31
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +24 -33
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +4 -7
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +17 -31
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +19 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +41 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +33 -50
- package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +16 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +79 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +23 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +42 -0
- package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +39 -52
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +7 -15
- package/dist/components/ui/core/dialog/dialog.js +82 -155
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +19 -17
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +150 -250
- package/dist/components/ui/core/empty-state/empty-state.context.js +5 -8
- package/dist/components/ui/core/empty-state/empty-state.js +86 -138
- package/dist/components/ui/core/helper-text/helper-text.js +37 -65
- package/dist/components/ui/core/hover-card/hover-card.js +54 -80
- package/dist/components/ui/core/inline-citation/inline-citation.js +98 -181
- package/dist/components/ui/core/input/input.js +12 -27
- package/dist/components/ui/core/input-group/input-group.js +76 -173
- package/dist/components/ui/core/kbd/kbd.js +20 -36
- package/dist/components/ui/core/label/label.js +26 -43
- package/dist/components/ui/core/loader/loader.js +80 -117
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +12 -12
- package/dist/components/ui/core/message/message.d.ts +2 -2
- package/dist/components/ui/core/message/message.js +316 -542
- package/dist/components/ui/core/pagination/pagination-size-context.js +5 -6
- package/dist/components/ui/core/pagination/pagination-teleport.js +86 -106
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
- package/dist/components/ui/core/pagination/pagination.js +231 -334
- package/dist/components/ui/core/popover/popover.js +90 -157
- package/dist/components/ui/core/progress/progress.js +36 -61
- package/dist/components/ui/core/prompt-input/prompt-input.js +274 -413
- package/dist/components/ui/core/radio-group/radio-group.js +58 -113
- package/dist/components/ui/core/reasoning/reasoning.js +55 -86
- package/dist/components/ui/core/scroll-area/scroll-area.js +41 -71
- package/dist/components/ui/core/search/search.js +77 -99
- package/dist/components/ui/core/segmented-control/segmented-control.js +110 -167
- package/dist/components/ui/core/select/select.js +168 -293
- package/dist/components/ui/core/separator/separator.js +13 -23
- package/dist/components/ui/core/shimmer/shimmer.d.ts +2 -4
- package/dist/components/ui/core/shimmer/shimmer.js +40 -107
- package/dist/components/ui/core/skeleton/skeleton.js +13 -18
- package/dist/components/ui/core/sonner-toast/sonner-toast.js +54 -47
- package/dist/components/ui/core/sources/sources.d.ts +5 -1
- package/dist/components/ui/core/sources/sources.js +58 -79
- package/dist/components/ui/core/switch/switch.js +62 -0
- package/dist/components/ui/core/tabs/tabs.js +149 -223
- package/dist/components/ui/core/tabs/tabs.utils.js +6 -8
- package/dist/components/ui/core/textarea/textarea.js +13 -27
- package/dist/components/ui/core/toggle/toggle.js +55 -74
- package/dist/components/ui/core/tool/tool.js +127 -163
- package/dist/components/ui/core/tooltip/tooltip.js +47 -86
- package/dist/components/ui/core/topbar/topbar.js +106 -190
- package/dist/eslint/index.js +5 -10
- package/dist/eslint/no-overriding-styles.js +178 -237
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/lib/highlight-code.d.ts +9 -0
- package/dist/lib/highlight-code.js +42 -0
- package/dist/lib/portal-container-context.js +8 -9
- package/dist/lib/style-scope.js +6 -6
- package/dist/lib/use-controllable-state.js +21 -30
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.js +32 -112
- package/dist/styles.css +1 -1
- package/dist/styles.source.css +23 -0
- package/package.json +23 -7
- package/dist/components/ui/core/date-time-pickers/shared/constants.js +0 -14
|
@@ -1,271 +1,183 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const a = o.length === 0 ? " " : o;
|
|
21
|
-
return n ? `${a}
|
|
22
|
-
…` : a;
|
|
1
|
+
import { cn as e, isStorybookTestEnv as t } from "../../../../lib/utils.js";
|
|
2
|
+
import { Button as n } from "../button/button.js";
|
|
3
|
+
import { highlightCode as r } from "../../../../lib/highlight-code.js";
|
|
4
|
+
import { createContext as i, forwardRef as a, useContext as o, useEffect as s, useMemo as c, useState as l } from "react";
|
|
5
|
+
import { IconCheck as u, IconCopy as d, IconDownload as f, IconSelector as p } from "@tabler/icons-react";
|
|
6
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
7
|
+
//#region libs/aura/src/components/ui/core/code-block/code-block.tsx
|
|
8
|
+
var g = i({
|
|
9
|
+
code: "",
|
|
10
|
+
copyText: "",
|
|
11
|
+
isCollapsed: !1,
|
|
12
|
+
setIsCollapsed: () => void 0,
|
|
13
|
+
lineCount: 0
|
|
14
|
+
}), _ = (e) => e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'"), v = 14, y = 8e3, b = 400, x = 16384, S = 1;
|
|
15
|
+
function C(e) {
|
|
16
|
+
let t = e.split("\n"), n = !1, r = t.slice(0, v).join("\n");
|
|
17
|
+
t.length > v && (n = !0), r.length > y && (r = r.slice(0, y), n = !0);
|
|
18
|
+
let i = r.length === 0 ? " " : r;
|
|
19
|
+
return n ? `${i}\n…` : i;
|
|
23
20
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
`).length > E || e.length > N;
|
|
21
|
+
function w(e) {
|
|
22
|
+
return e.split("\n").length > v || e.length > y;
|
|
27
23
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
24
|
+
function T(e, t) {
|
|
25
|
+
return t > b || e.length > x;
|
|
30
26
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
27
|
+
function E(e) {
|
|
28
|
+
return `<pre><code>${_(e)}</code></pre>`;
|
|
33
29
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
S,
|
|
189
|
-
{
|
|
190
|
-
ref: i,
|
|
191
|
-
"data-slot": "code-block-copy-button",
|
|
192
|
-
className: f("shrink-0", a),
|
|
193
|
-
onClick: d,
|
|
194
|
-
size: "icon-sm",
|
|
195
|
-
variant: "secondary",
|
|
196
|
-
...h,
|
|
197
|
-
children: o ?? /* @__PURE__ */ r(p, { size: 14 })
|
|
198
|
-
}
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
);
|
|
202
|
-
re.displayName = "CodeBlockCopyButton";
|
|
203
|
-
const le = w(
|
|
204
|
-
({ children: e, className: t, ...n }, o) => {
|
|
205
|
-
const { isCollapsed: a, setIsCollapsed: h, lineCount: i } = H(I);
|
|
206
|
-
return i <= 1 ? null : /* @__PURE__ */ r(
|
|
207
|
-
S,
|
|
208
|
-
{
|
|
209
|
-
ref: o,
|
|
210
|
-
"data-slot": "code-block-collapse-button",
|
|
211
|
-
className: f("shrink-0", t),
|
|
212
|
-
onClick: () => h(!a),
|
|
213
|
-
size: "icon-sm",
|
|
214
|
-
variant: "secondary",
|
|
215
|
-
...n,
|
|
216
|
-
children: e ?? /* @__PURE__ */ r($, { size: 14 })
|
|
217
|
-
}
|
|
218
|
-
);
|
|
219
|
-
}
|
|
220
|
-
);
|
|
221
|
-
le.displayName = "CodeBlockCollapseButton";
|
|
222
|
-
const ae = w(
|
|
223
|
-
({
|
|
224
|
-
fileName: e = "code.txt",
|
|
225
|
-
mimeType: t = "text/plain;charset=utf-8",
|
|
226
|
-
onDownload: n,
|
|
227
|
-
onError: o,
|
|
228
|
-
children: a,
|
|
229
|
-
className: h,
|
|
230
|
-
...i
|
|
231
|
-
}, C) => {
|
|
232
|
-
const { code: k } = H(I), b = () => {
|
|
233
|
-
if (typeof window > "u" || typeof document > "u") {
|
|
234
|
-
o?.(new Error("Download not available"));
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
try {
|
|
238
|
-
const d = new Blob([k], { type: t }), p = URL.createObjectURL(d), c = document.createElement("a");
|
|
239
|
-
c.href = p, c.download = e, c.rel = "noopener", c.click(), URL.revokeObjectURL(p), n?.();
|
|
240
|
-
} catch (d) {
|
|
241
|
-
o?.(
|
|
242
|
-
d instanceof Error ? d : new Error("Download failed")
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
return /* @__PURE__ */ r(
|
|
247
|
-
S,
|
|
248
|
-
{
|
|
249
|
-
ref: C,
|
|
250
|
-
"data-slot": "code-block-download-button",
|
|
251
|
-
className: f("shrink-0", h),
|
|
252
|
-
onClick: b,
|
|
253
|
-
size: "icon-sm",
|
|
254
|
-
variant: "secondary",
|
|
255
|
-
...i,
|
|
256
|
-
children: a ?? /* @__PURE__ */ r(q, { size: 14 })
|
|
257
|
-
}
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
);
|
|
261
|
-
ae.displayName = "CodeBlockDownloadButton";
|
|
262
|
-
export {
|
|
263
|
-
ne as CodeBlock,
|
|
264
|
-
le as CodeBlockCollapseButton,
|
|
265
|
-
re as CodeBlockCopyButton,
|
|
266
|
-
ae as CodeBlockDownloadButton,
|
|
267
|
-
J as getCollapsedPreviewDisplay,
|
|
268
|
-
Q as isContentLargerThanPreview,
|
|
269
|
-
Z as plainPreMarkup,
|
|
270
|
-
Y as shouldUsePlainTextInsteadOfShiki
|
|
271
|
-
};
|
|
30
|
+
var D = "min(60vh, 32rem)", O = "dark:hidden [&>pre]:m-0 [&>pre]:min-h-10 [&>pre]:bg-card-background [&>pre]:p-2 [&>pre]:text-secondary-foreground [&>pre]:leading-[18px] [&>pre]:tracking-[-0.08px] [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm [&>pre]:overflow-x-auto", k = "hidden dark:block [&>pre]:m-0 [&>pre]:min-h-10 [&>pre]:bg-card-background [&>pre]:p-2 [&>pre]:text-secondary-foreground [&>pre]:leading-[18px] [&>pre]:tracking-[-0.08px] [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm [&>pre]:overflow-x-auto", A = a(({ code: n, copyText: i, language: a, showLineNumbers: o = !1, collapsed: u = !1, className: d, children: f, style: p, ...v }, y) => {
|
|
31
|
+
let [b, x] = l(""), [A, j] = l(""), [M, N] = l(u), P = n.length === 0 ? " " : n, F = n.split("\n").length, I = M && F > S, L = i ?? n, R = c(() => t ? `<pre><code>${_(P)}</code></pre>` : "", [P]);
|
|
32
|
+
s(() => {
|
|
33
|
+
if (t) return;
|
|
34
|
+
let e = !1, n = (t) => {
|
|
35
|
+
if (!e) {
|
|
36
|
+
let e = E(t);
|
|
37
|
+
x(e), j(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
if (M && w(P)) {
|
|
41
|
+
let t = C(P);
|
|
42
|
+
return r(t, a, o).then(([t, n]) => {
|
|
43
|
+
e || (x(t), j(n));
|
|
44
|
+
}).catch((e) => {
|
|
45
|
+
console.error("Failed to highlight code:", e), n(t);
|
|
46
|
+
}), () => {
|
|
47
|
+
e = !0;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return !M && T(P, F) ? (queueMicrotask(() => {
|
|
51
|
+
n(P);
|
|
52
|
+
}), () => {
|
|
53
|
+
e = !0;
|
|
54
|
+
}) : (r(P, a, o).then(([t, n]) => {
|
|
55
|
+
e || (x(t), j(n));
|
|
56
|
+
}).catch((e) => {
|
|
57
|
+
console.error("Failed to highlight code:", e), n(P);
|
|
58
|
+
}), () => {
|
|
59
|
+
e = !0;
|
|
60
|
+
});
|
|
61
|
+
}, [
|
|
62
|
+
P,
|
|
63
|
+
a,
|
|
64
|
+
o,
|
|
65
|
+
M,
|
|
66
|
+
F
|
|
67
|
+
]);
|
|
68
|
+
let z = c(() => ({
|
|
69
|
+
code: n,
|
|
70
|
+
copyText: L,
|
|
71
|
+
isCollapsed: M,
|
|
72
|
+
setIsCollapsed: N,
|
|
73
|
+
lineCount: F
|
|
74
|
+
}), [
|
|
75
|
+
n,
|
|
76
|
+
L,
|
|
77
|
+
M,
|
|
78
|
+
F
|
|
79
|
+
]), B = /* @__PURE__ */ h("div", {
|
|
80
|
+
className: "relative",
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ m("div", {
|
|
83
|
+
className: e(O, I && "max-h-26 overflow-y-hidden"),
|
|
84
|
+
dangerouslySetInnerHTML: { __html: t ? R : b }
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ m("div", {
|
|
87
|
+
className: e(k, I && "max-h-26 overflow-y-hidden"),
|
|
88
|
+
dangerouslySetInnerHTML: { __html: t ? R : A }
|
|
89
|
+
}),
|
|
90
|
+
I && /* @__PURE__ */ m("div", { className: "pointer-events-none absolute bottom-0 left-0 right-0 h-3/4 bg-linear-to-b from-transparent via-card-background/70 to-card-background" })
|
|
91
|
+
]
|
|
92
|
+
}), V = f == null ? null : /* @__PURE__ */ m("div", {
|
|
93
|
+
"data-slot": "code-block-actions",
|
|
94
|
+
className: e("pointer-events-none absolute top-5 right-5 z-20 flex items-center gap-1 bg-transparent p-0 shadow-none ring-0 outline-none", "opacity-0 transition-opacity", "group-hover/code-block:pointer-events-auto group-hover/code-block:opacity-100", "group-focus-within/code-block:pointer-events-auto group-focus-within/code-block:opacity-100", t && "pointer-events-auto opacity-100"),
|
|
95
|
+
children: f
|
|
96
|
+
});
|
|
97
|
+
return /* @__PURE__ */ m(g.Provider, {
|
|
98
|
+
value: z,
|
|
99
|
+
children: /* @__PURE__ */ h("div", {
|
|
100
|
+
ref: y,
|
|
101
|
+
"data-slot": "code-block",
|
|
102
|
+
className: e("group/code-block relative w-full rounded-xl bg-background text-foreground", I ? "overflow-hidden" : "flex min-h-0 max-h-[min(60vh,_32rem)] flex-col overflow-hidden", d),
|
|
103
|
+
style: {
|
|
104
|
+
...I ? {} : {
|
|
105
|
+
maxHeight: D,
|
|
106
|
+
minHeight: 0
|
|
107
|
+
},
|
|
108
|
+
...p
|
|
109
|
+
},
|
|
110
|
+
...v,
|
|
111
|
+
children: [/* @__PURE__ */ m("div", {
|
|
112
|
+
className: e("relative min-h-0 bg-card-background", !I && "min-h-0 flex-1 overflow-x-auto overflow-y-auto [scrollbar-gutter:stable]"),
|
|
113
|
+
children: B
|
|
114
|
+
}), V]
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
A.displayName = "CodeBlock";
|
|
119
|
+
var j = a(({ onCopy: t, onError: r, timeout: i = 2e3, children: a, className: s, ...c }, f) => {
|
|
120
|
+
let [p, h] = l(!1), { copyText: _ } = o(g), v = async () => {
|
|
121
|
+
if (typeof window > "u" || !navigator?.clipboard?.writeText) {
|
|
122
|
+
r?.(/* @__PURE__ */ Error("Clipboard API not available"));
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
await navigator.clipboard.writeText(_), h(!0), t?.(), setTimeout(() => h(!1), i);
|
|
127
|
+
} catch (e) {
|
|
128
|
+
console.warn("Clipboard write failed:", e), r?.(e instanceof Error ? e : /* @__PURE__ */ Error("Clipboard write failed"));
|
|
129
|
+
}
|
|
130
|
+
}, y = p ? u : d;
|
|
131
|
+
return /* @__PURE__ */ m(n, {
|
|
132
|
+
ref: f,
|
|
133
|
+
"data-slot": "code-block-copy-button",
|
|
134
|
+
className: e("shrink-0", s),
|
|
135
|
+
onClick: v,
|
|
136
|
+
size: "icon-sm",
|
|
137
|
+
variant: "secondary",
|
|
138
|
+
...c,
|
|
139
|
+
children: a ?? /* @__PURE__ */ m(y, { size: 14 })
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
j.displayName = "CodeBlockCopyButton";
|
|
143
|
+
var M = a(({ children: t, className: r, ...i }, a) => {
|
|
144
|
+
let { isCollapsed: s, setIsCollapsed: c, lineCount: l } = o(g);
|
|
145
|
+
return l <= S ? null : /* @__PURE__ */ m(n, {
|
|
146
|
+
ref: a,
|
|
147
|
+
"data-slot": "code-block-collapse-button",
|
|
148
|
+
className: e("shrink-0", r),
|
|
149
|
+
onClick: () => c(!s),
|
|
150
|
+
size: "icon-sm",
|
|
151
|
+
variant: "secondary",
|
|
152
|
+
...i,
|
|
153
|
+
children: t ?? /* @__PURE__ */ m(p, { size: 14 })
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
M.displayName = "CodeBlockCollapseButton";
|
|
157
|
+
var N = a(({ fileName: t = "code.txt", mimeType: r = "text/plain;charset=utf-8", onDownload: i, onError: a, children: s, className: c, ...l }, u) => {
|
|
158
|
+
let { code: d } = o(g);
|
|
159
|
+
return /* @__PURE__ */ m(n, {
|
|
160
|
+
ref: u,
|
|
161
|
+
"data-slot": "code-block-download-button",
|
|
162
|
+
className: e("shrink-0", c),
|
|
163
|
+
onClick: () => {
|
|
164
|
+
if (typeof window > "u" || typeof document > "u") {
|
|
165
|
+
a?.(/* @__PURE__ */ Error("Download not available"));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
let e = new Blob([d], { type: r }), n = URL.createObjectURL(e), a = document.createElement("a");
|
|
170
|
+
a.href = n, a.download = t, a.rel = "noopener", a.click(), URL.revokeObjectURL(n), i?.();
|
|
171
|
+
} catch (e) {
|
|
172
|
+
a?.(e instanceof Error ? e : /* @__PURE__ */ Error("Download failed"));
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
size: "icon-sm",
|
|
176
|
+
variant: "secondary",
|
|
177
|
+
...l,
|
|
178
|
+
children: s ?? /* @__PURE__ */ m(f, { size: 14 })
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
N.displayName = "CodeBlockDownloadButton";
|
|
182
|
+
//#endregion
|
|
183
|
+
export { A as CodeBlock, M as CodeBlockCollapseButton, j as CodeBlockCopyButton, N as CodeBlockDownloadButton, C as getCollapsedPreviewDisplay, w as isContentLargerThanPreview, E as plainPreMarkup, T as shouldUsePlainTextInsteadOfShiki };
|
|
@@ -1,50 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cn as e } from "../../../../lib/utils.js";
|
|
2
2
|
import { forwardRef as t } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
d.displayName = "CollapsibleTrigger";
|
|
32
|
-
const m = t(({ className: l, keepMounted: o = !0, ...e }, r) => /* @__PURE__ */ a(
|
|
33
|
-
n.Panel,
|
|
34
|
-
{
|
|
35
|
-
ref: r,
|
|
36
|
-
"data-slot": "collapsible-content",
|
|
37
|
-
className: i(
|
|
38
|
-
"hidden data-open:block border-none outline-none text-secondary-foreground text-sm font-normal leading-5 tracking-tight w-full min-w-0 overflow-x-hidden box-border *:max-w-full *:box-border",
|
|
39
|
-
l
|
|
40
|
-
),
|
|
41
|
-
keepMounted: o,
|
|
42
|
-
...e
|
|
43
|
-
}
|
|
44
|
-
));
|
|
45
|
-
m.displayName = "CollapsibleContent";
|
|
46
|
-
export {
|
|
47
|
-
s as Collapsible,
|
|
48
|
-
m as CollapsibleContent,
|
|
49
|
-
d as CollapsibleTrigger
|
|
50
|
-
};
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import { Collapsible as r } from "@base-ui/react/collapsible";
|
|
5
|
+
//#region libs/aura/src/components/ui/core/collapsible/collapsible.tsx
|
|
6
|
+
var i = t(({ className: t, ...i }, a) => /* @__PURE__ */ n(r.Root, {
|
|
7
|
+
ref: a,
|
|
8
|
+
"data-slot": "collapsible",
|
|
9
|
+
className: e("w-full min-w-0 rounded-md box-border *:max-w-full", t),
|
|
10
|
+
...i
|
|
11
|
+
}));
|
|
12
|
+
i.displayName = "Collapsible";
|
|
13
|
+
var a = t(({ className: t, children: i, ...a }, o) => /* @__PURE__ */ n(r.Trigger, {
|
|
14
|
+
ref: o,
|
|
15
|
+
"data-slot": "collapsible-trigger",
|
|
16
|
+
className: e("group/collapsible-trigger rounded-lg text-sm font-medium leading-5 text-foreground overflow-hidden", t),
|
|
17
|
+
...a,
|
|
18
|
+
children: i
|
|
19
|
+
}));
|
|
20
|
+
a.displayName = "CollapsibleTrigger";
|
|
21
|
+
var o = t(({ className: t, keepMounted: i = !0, ...a }, o) => /* @__PURE__ */ n(r.Panel, {
|
|
22
|
+
ref: o,
|
|
23
|
+
"data-slot": "collapsible-content",
|
|
24
|
+
className: e("hidden data-open:block border-none outline-none text-secondary-foreground text-sm font-normal leading-5 tracking-tight w-full min-w-0 overflow-x-hidden box-border *:max-w-full *:box-border", t),
|
|
25
|
+
keepMounted: i,
|
|
26
|
+
...a
|
|
27
|
+
}));
|
|
28
|
+
o.displayName = "CollapsibleContent";
|
|
29
|
+
//#endregion
|
|
30
|
+
export { i as Collapsible, o as CollapsibleContent, a as CollapsibleTrigger };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { cn as e } from "../../../../lib/utils.js";
|
|
2
|
+
import { Button as t } from "../button/button.js";
|
|
3
|
+
import { Command as n, CommandEmpty as r, CommandGroup as i, CommandInput as a, CommandItem as o, CommandList as s } from "../command/command.js";
|
|
4
|
+
import { Popover as c, PopoverContent as l, PopoverTrigger as u } from "../popover/popover.js";
|
|
5
|
+
import { forwardRef as d, useState as f } from "react";
|
|
6
|
+
import { IconCaretUpDown as p, IconCheck as m } from "@tabler/icons-react";
|
|
7
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
8
|
+
//#region libs/aura/src/components/ui/core/combobox/combobox.tsx
|
|
9
|
+
var _ = d(({ options: d, value: _, onValueChange: v, placeholder: y = "Select option...", searchPlaceholder: b = "Search...", emptyText: x = "No option found.", className: S, ...C }, w) => {
|
|
10
|
+
let [T, E] = f(!1), [D, O] = f(_ ?? ""), k = _ !== void 0, A = k ? _ : D, j = (e) => {
|
|
11
|
+
let t = e === A ? "" : e;
|
|
12
|
+
k || O(t), v?.(t), E(!1);
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ h("div", {
|
|
15
|
+
"data-slot": "combobox",
|
|
16
|
+
children: /* @__PURE__ */ g(c, {
|
|
17
|
+
open: T,
|
|
18
|
+
onOpenChange: E,
|
|
19
|
+
children: [/* @__PURE__ */ h(u, { render: /* @__PURE__ */ g(t, {
|
|
20
|
+
ref: w,
|
|
21
|
+
"data-slot": "combobox-trigger",
|
|
22
|
+
variant: "outline",
|
|
23
|
+
role: "combobox",
|
|
24
|
+
"aria-expanded": T,
|
|
25
|
+
className: e("w-50 justify-between", S),
|
|
26
|
+
...C,
|
|
27
|
+
children: [A ? d.find((e) => e.value === A)?.label : y, /* @__PURE__ */ h(p, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })]
|
|
28
|
+
}) }), /* @__PURE__ */ h(l, {
|
|
29
|
+
className: e("w-50 p-0", S),
|
|
30
|
+
children: /* @__PURE__ */ g(n, { children: [/* @__PURE__ */ h(a, { placeholder: b }), /* @__PURE__ */ g(s, { children: [/* @__PURE__ */ h(r, { children: x }), /* @__PURE__ */ h(i, { children: d.map((t) => /* @__PURE__ */ g(o, {
|
|
31
|
+
value: t.value,
|
|
32
|
+
onSelect: j,
|
|
33
|
+
children: [/* @__PURE__ */ h(m, { className: e("mr-2 h-4 w-4", A === t.value ? "opacity-100" : "opacity-0") }), t.label]
|
|
34
|
+
}, t.value)) })] })] })
|
|
35
|
+
})]
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
_.displayName = "Combobox";
|
|
40
|
+
//#endregion
|
|
41
|
+
export { _ as Combobox };
|