@cognite/aura 0.1.6 → 0.2.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.
Files changed (71) hide show
  1. package/DESIGN.md +1211 -0
  2. package/README.md +24 -0
  3. package/dist/colors.css +441 -214
  4. package/dist/components/index.d.ts +17 -1
  5. package/dist/components/index.js +344 -269
  6. package/dist/components/ui/core/accordion/accordion.js +22 -22
  7. package/dist/components/ui/core/alert/alert.d.ts +3 -2
  8. package/dist/components/ui/core/alert/alert.js +111 -87
  9. package/dist/components/ui/core/alert/alert.metadata.js +1 -1
  10. package/dist/components/ui/core/avatar/avatar.js +10 -10
  11. package/dist/components/ui/core/badge/badge.d.ts +2 -2
  12. package/dist/components/ui/core/badge/badge.js +13 -13
  13. package/dist/components/ui/core/banner/banner.d.ts +4 -4
  14. package/dist/components/ui/core/breadcrumb/breadcrumb.d.ts +11 -0
  15. package/dist/components/ui/core/breadcrumb/breadcrumb.js +190 -0
  16. package/dist/components/ui/core/breadcrumb/breadcrumb.metadata.d.ts +2 -0
  17. package/dist/components/ui/core/breadcrumb/breadcrumb.metadata.js +9 -0
  18. package/dist/components/ui/core/button/button.d.ts +1 -1
  19. package/dist/components/ui/core/card/card.d.ts +7 -4
  20. package/dist/components/ui/core/card/card.js +131 -87
  21. package/dist/components/ui/core/card/card.metadata.js +1 -1
  22. package/dist/components/ui/core/checkbox/checkbox.d.ts +13 -0
  23. package/dist/components/ui/core/checkbox/checkbox.js +129 -0
  24. package/dist/components/ui/core/checkbox/checkbox.metadata.d.ts +2 -0
  25. package/dist/components/ui/core/checkbox/checkbox.metadata.js +8 -0
  26. package/dist/components/ui/core/code-block/code-block.d.ts +5 -1
  27. package/dist/components/ui/core/code-block/code-block.js +200 -132
  28. package/dist/components/ui/core/command/command.d.ts +2 -2
  29. package/dist/components/ui/core/count/count.d.ts +8 -0
  30. package/dist/components/ui/core/count/count.js +32 -0
  31. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +1 -1
  32. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +43 -40
  33. package/dist/components/ui/core/inline-citation/inline-citation.js +8 -8
  34. package/dist/components/ui/core/input-group/input-group.d.ts +1 -1
  35. package/dist/components/ui/core/kbd/kbd.d.ts +3 -0
  36. package/dist/components/ui/core/kbd/kbd.js +36 -0
  37. package/dist/components/ui/core/kbd/kbd.metadata.d.ts +2 -0
  38. package/dist/components/ui/core/kbd/kbd.metadata.js +9 -0
  39. package/dist/components/ui/core/loader/loader.d.ts +9 -1
  40. package/dist/components/ui/core/loader/loader.js +106 -107
  41. package/dist/components/ui/core/loader/loader.metadata.js +2 -2
  42. package/dist/components/ui/core/popover/popover.d.ts +1 -1
  43. package/dist/components/ui/core/prompt-input/prompt-input.d.ts +1 -1
  44. package/dist/components/ui/core/radio-group/radio-group.d.ts +16 -0
  45. package/dist/components/ui/core/radio-group/radio-group.js +110 -0
  46. package/dist/components/ui/core/radio-group/radio-group.metadata.d.ts +2 -0
  47. package/dist/components/ui/core/radio-group/radio-group.metadata.js +9 -0
  48. package/dist/components/ui/core/scroll-area/scroll-area.d.ts +3 -0
  49. package/dist/components/ui/core/scroll-area/scroll-area.js +71 -0
  50. package/dist/components/ui/core/scroll-area/scroll-area.metadata.d.ts +2 -0
  51. package/dist/components/ui/core/scroll-area/scroll-area.metadata.js +9 -0
  52. package/dist/components/ui/core/segmented-control/segmented-control.d.ts +16 -0
  53. package/dist/components/ui/core/segmented-control/segmented-control.js +169 -0
  54. package/dist/components/ui/core/sonner-toast/sonner-toast.d.ts +3 -0
  55. package/dist/components/ui/core/sonner-toast/sonner-toast.js +48 -0
  56. package/dist/components/ui/core/sonner-toast/sonner-toast.metadata.d.ts +2 -0
  57. package/dist/components/ui/core/sonner-toast/sonner-toast.metadata.js +9 -0
  58. package/dist/components/ui/core/tabs/tabs.d.ts +23 -0
  59. package/dist/components/ui/core/tabs/tabs.js +222 -0
  60. package/dist/components/ui/core/tabs/tabs.utils.d.ts +2 -0
  61. package/dist/components/ui/core/tabs/tabs.utils.js +9 -0
  62. package/dist/components/ui/core/tool/tool.js +31 -27
  63. package/dist/components/ui/core/topbar/topbar.d.ts +30 -0
  64. package/dist/components/ui/core/topbar/topbar.js +190 -0
  65. package/dist/index.d.ts +1 -1
  66. package/dist/index.js +312 -248
  67. package/dist/lib/utils.d.ts +11 -0
  68. package/dist/lib/utils.js +40 -29
  69. package/dist/styles.css +1 -1
  70. package/dist/styles.source.css +66 -7
  71. package/package.json +11 -6
@@ -0,0 +1,2 @@
1
+ import { ComponentMeta } from '../../../../lib/types';
2
+ export declare const CheckboxMetadata: ComponentMeta;
@@ -0,0 +1,8 @@
1
+ const e = {
2
+ name: "Checkbox",
3
+ description: "A composable checkbox group with optional label and description slots, including a card-style item variant and support for checked, unchecked, and indeterminate states.",
4
+ llmUsage: 'Use `<CheckboxGroup>` with `<CheckboxItem>` wrapping `<CheckboxItemControl />`, plus optional `<CheckboxItemLabel>` and `<CheckboxItemDescription>`. Always pass an accessible name on `<CheckboxItemControl>` via `aria-label` (or `aria-labelledby` pointing to the label\'s id) — the wrapping `<label>` element names the underlying hidden form input, but does not name the visible `role="checkbox"` element that screen readers focus on. `<CheckboxItemDescription>` is a visual slot at this primitive layer; if you need it announced by screen readers, give it an `id` and pass `aria-describedby` to `<CheckboxItemControl>`. Use `variant="card"` on `<CheckboxItem>` for card-style options. `<CheckboxItemControl>` supports `checked`, `defaultChecked`, `indeterminate`, `onCheckedChange`, `disabled`, and `required` for form integration.'
5
+ };
6
+ export {
7
+ e as CheckboxMetadata
8
+ };
@@ -1,6 +1,10 @@
1
1
  import { ComponentProps, HTMLAttributes } from 'react';
2
2
  import { BundledLanguage } from 'shiki';
3
3
  import { Button } from '../button/button';
4
+ export declare function getCollapsedPreviewDisplay(code: string): string;
5
+ export declare function isContentLargerThanPreview(code: string): boolean;
6
+ export declare function shouldUsePlainTextInsteadOfShiki(code: string, lineCount: number): boolean;
7
+ export declare function plainPreMarkup(code: string): string;
4
8
  declare const CodeBlock: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
5
9
  code: string;
6
10
  copyText?: string;
@@ -16,7 +20,7 @@ type CodeBlockCopyButtonProps = ComponentProps<typeof Button> & {
16
20
  declare const CodeBlockCopyButton: import('react').ForwardRefExoticComponent<Omit<CodeBlockCopyButtonProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
17
21
  declare const CodeBlockCollapseButton: import('react').ForwardRefExoticComponent<Omit<Omit<import('@base-ui/react').ButtonProps & import('class-variance-authority').VariantProps<(props?: ({
18
22
  variant?: "default" | "secondary" | "outline" | "ghost" | "destructive" | null | undefined;
19
- size?: "icon" | "default" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
23
+ size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg" | null | undefined;
20
24
  } & import('class-variance-authority/types').ClassProp) | undefined) => string>, "ref"> & import('react').RefAttributes<HTMLElement>, "ref"> & import('react').RefAttributes<HTMLElement>>;
21
25
  type CodeBlockDownloadButtonProps = ComponentProps<typeof Button> & {
22
26
  fileName?: string;
@@ -1,199 +1,267 @@
1
- import { jsx as t, jsxs as E } from "react/jsx-runtime";
2
- import { createContext as R, forwardRef as x, useState as y, useMemo as z, useEffect as L, useContext as B } from "react";
3
- import { IconCheck as S, IconCopy as j, IconSelector as M, IconDownload as U } from "@tabler/icons-react";
4
- import { isStorybookTestEnv as h, highlightCode as F, cn as i } from "../../../../lib/utils.js";
5
- import { Button as I } from "../button/button.js";
6
- const g = R({
1
+ import { jsxs as L, jsx as r } from "react/jsx-runtime";
2
+ import { createContext as F, forwardRef as w, useState as x, useMemo as D, useEffect as O, useContext as H } from "react";
3
+ import { IconCheck as K, IconCopy as V, IconSelector as $, IconDownload as q } from "@tabler/icons-react";
4
+ import { isStorybookTestEnv as v, highlightCode as M, cn as f } from "../../../../lib/utils.js";
5
+ import { Button as S } from "../button/button.js";
6
+ const I = F({
7
7
  code: "",
8
8
  copyText: "",
9
9
  isCollapsed: !1,
10
10
  setIsCollapsed: () => {
11
11
  },
12
12
  lineCount: 0
13
- }), A = (e) => e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;"), O = x(
13
+ }), P = (e) => e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;"), E = 14, N = 8e3, W = 400, G = 16384;
14
+ function J(e) {
15
+ const t = e.split(`
16
+ `);
17
+ let n = !1, o = t.slice(0, E).join(`
18
+ `);
19
+ t.length > E && (n = !0), o.length > N && (o = o.slice(0, N), n = !0);
20
+ const a = o.length === 0 ? " " : o;
21
+ return n ? `${a}
22
+ …` : a;
23
+ }
24
+ function Q(e) {
25
+ return e.split(`
26
+ `).length > E || e.length > N;
27
+ }
28
+ function Y(e, t) {
29
+ return t > W || e.length > G;
30
+ }
31
+ function Z(e) {
32
+ return `<pre><code>${P(e)}</code></pre>`;
33
+ }
34
+ const ee = "min(60vh, 32rem)", oe = "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", te = "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", ne = w(
14
35
  ({
15
36
  code: e,
16
- copyText: l,
17
- language: a,
18
- showLineNumbers: r = !1,
19
- collapsed: s = !1,
20
- className: d,
21
- children: c,
22
- ...m
23
- }, p) => {
24
- const [f, n] = y(""), [u, o] = y(""), [k, D] = y(s), b = e.length === 0 ? " " : e, N = e.split(`
25
- `).length, T = l ?? e, _ = z(
26
- () => h ? `<pre><code>${A(b)}</code></pre>` : "",
27
- [b]
37
+ copyText: t,
38
+ language: n,
39
+ showLineNumbers: o = !1,
40
+ collapsed: a = !1,
41
+ className: h,
42
+ children: i,
43
+ style: C,
44
+ ...k
45
+ }, b) => {
46
+ const [d, p] = x(""), [c, _] = x(""), [l, R] = x(a), s = e.length === 0 ? " " : e, y = e.split(`
47
+ `).length, A = t ?? e, T = D(
48
+ () => v ? `<pre><code>${P(s)}</code></pre>` : "",
49
+ [s]
28
50
  );
29
- L(() => {
30
- if (h) return;
31
- let w = !1;
32
- return F(b, a, r).then(([v, C]) => {
33
- w || (n(v), o(C));
34
- }).catch((v) => {
35
- if (console.error("Failed to highlight code:", v), !w) {
36
- const C = `<pre><code>${A(b)}</code></pre>`;
37
- n(C), o(C);
51
+ O(() => {
52
+ if (v) return;
53
+ let g = !1;
54
+ const B = (u) => {
55
+ if (!g) {
56
+ const m = Z(u);
57
+ p(m), _(m);
38
58
  }
39
- }), () => {
40
- w = !0;
41
59
  };
42
- }, [b, a, r]);
43
- const H = z(
60
+ if (l && Q(s)) {
61
+ const u = J(s);
62
+ return M(u, n, o).then(([m, j]) => {
63
+ g || (p(m), _(j));
64
+ }).catch((m) => {
65
+ console.error("Failed to highlight code:", m), B(u);
66
+ }), () => {
67
+ g = !0;
68
+ };
69
+ }
70
+ return !l && Y(s, y) ? (queueMicrotask(() => {
71
+ B(s);
72
+ }), () => {
73
+ g = !0;
74
+ }) : (M(s, n, o).then(([u, m]) => {
75
+ g || (p(u), _(m));
76
+ }).catch((u) => {
77
+ console.error("Failed to highlight code:", u), B(s);
78
+ }), () => {
79
+ g = !0;
80
+ });
81
+ }, [s, n, o, l, y]);
82
+ const z = D(
44
83
  () => ({
45
84
  code: e,
46
- copyText: T,
47
- isCollapsed: k,
48
- setIsCollapsed: D,
49
- lineCount: N
85
+ copyText: A,
86
+ isCollapsed: l,
87
+ setIsCollapsed: R,
88
+ lineCount: y
50
89
  }),
51
- [e, T, k, N]
52
- );
53
- return /* @__PURE__ */ t(g.Provider, { value: H, children: /* @__PURE__ */ E(
90
+ [e, A, l, y]
91
+ ), U = /* @__PURE__ */ L("div", { className: "relative", children: [
92
+ /* @__PURE__ */ r(
93
+ "div",
94
+ {
95
+ className: f(
96
+ oe,
97
+ l && "max-h-26 overflow-y-hidden"
98
+ ),
99
+ dangerouslySetInnerHTML: {
100
+ __html: v ? T : d
101
+ }
102
+ }
103
+ ),
104
+ /* @__PURE__ */ r(
105
+ "div",
106
+ {
107
+ className: f(
108
+ te,
109
+ l && "max-h-26 overflow-y-hidden"
110
+ ),
111
+ dangerouslySetInnerHTML: {
112
+ __html: v ? T : c
113
+ }
114
+ }
115
+ ),
116
+ l && /* @__PURE__ */ r("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" })
117
+ ] }), X = i != null ? /* @__PURE__ */ r(
118
+ "div",
119
+ {
120
+ "data-slot": "code-block-actions",
121
+ className: f(
122
+ /* Sibling of scroll inner: pinned while code scrolls; even inset from top/right (scrollbar gutter on inner) */
123
+ "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",
124
+ "opacity-0 transition-opacity",
125
+ "group-hover/code-block:pointer-events-auto group-hover/code-block:opacity-100",
126
+ "group-focus-within/code-block:pointer-events-auto group-focus-within/code-block:opacity-100",
127
+ v && "pointer-events-auto opacity-100"
128
+ ),
129
+ children: i
130
+ }
131
+ ) : null;
132
+ return /* @__PURE__ */ r(I.Provider, { value: z, children: /* @__PURE__ */ L(
54
133
  "div",
55
134
  {
56
- ref: p,
135
+ ref: b,
57
136
  "data-slot": "code-block",
58
- className: i(
59
- "group/code-block relative w-full overflow-hidden rounded-xl bg-background text-foreground",
60
- d
137
+ className: f(
138
+ "group/code-block relative w-full rounded-xl bg-background text-foreground",
139
+ l ? "overflow-hidden" : (
140
+ /* Expanded: flex + clip so actions overlay without a reserved top row */
141
+ "flex min-h-0 max-h-[min(60vh,_32rem)] flex-col overflow-hidden"
142
+ ),
143
+ h
61
144
  ),
62
- ...m,
145
+ style: {
146
+ ...l ? {} : {
147
+ maxHeight: ee,
148
+ minHeight: 0
149
+ },
150
+ ...C
151
+ },
152
+ ...k,
63
153
  children: [
64
- /* @__PURE__ */ E("div", { className: "relative", children: [
65
- /* @__PURE__ */ t(
66
- "div",
67
- {
68
- className: i(
69
- "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",
70
- k && "max-h-26 overflow-y-hidden"
71
- ),
72
- dangerouslySetInnerHTML: {
73
- __html: h ? _ : f
74
- }
75
- }
76
- ),
77
- /* @__PURE__ */ t(
78
- "div",
79
- {
80
- className: i(
81
- "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",
82
- k && "max-h-26 overflow-y-hidden"
83
- ),
84
- dangerouslySetInnerHTML: {
85
- __html: h ? _ : u
86
- }
87
- }
88
- ),
89
- k && /* @__PURE__ */ t("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" })
90
- ] }),
91
- c ? /* @__PURE__ */ t(
154
+ /* @__PURE__ */ r(
92
155
  "div",
93
156
  {
94
- "data-slot": "code-block-actions",
95
- className: i(
96
- "absolute top-2 right-2 flex items-center gap-1 opacity-0 transition-opacity group-hover/code-block:opacity-100 group-focus-within/code-block:opacity-100",
97
- h && "opacity-100"
157
+ className: f(
158
+ /* Match <pre> card tone so transparent actions are not over root bg-background */
159
+ "relative min-h-0 bg-card-background",
160
+ !l && "min-h-0 flex-1 overflow-x-auto overflow-y-auto [scrollbar-gutter:stable]"
98
161
  ),
99
- children: c
162
+ children: U
100
163
  }
101
- ) : null
164
+ ),
165
+ X
102
166
  ]
103
167
  }
104
168
  ) });
105
169
  }
106
170
  );
107
- O.displayName = "CodeBlock";
108
- const P = x(({ onCopy: e, onError: l, timeout: a = 2e3, children: r, className: s, ...d }, c) => {
109
- const [m, p] = y(!1), { copyText: f } = B(g), n = async () => {
171
+ ne.displayName = "CodeBlock";
172
+ const re = w(({ onCopy: e, onError: t, timeout: n = 2e3, children: o, className: a, ...h }, i) => {
173
+ const [C, k] = x(!1), { copyText: b } = H(I), d = async () => {
110
174
  if (typeof window > "u" || !navigator?.clipboard?.writeText) {
111
- l?.(new Error("Clipboard API not available"));
175
+ t?.(new Error("Clipboard API not available"));
112
176
  return;
113
177
  }
114
178
  try {
115
- await navigator.clipboard.writeText(f), p(!0), e?.(), setTimeout(() => p(!1), a);
116
- } catch (o) {
117
- console.warn("Clipboard write failed:", o), l?.(
118
- o instanceof Error ? o : new Error("Clipboard write failed")
179
+ await navigator.clipboard.writeText(b), k(!0), e?.(), setTimeout(() => k(!1), n);
180
+ } catch (c) {
181
+ console.warn("Clipboard write failed:", c), t?.(
182
+ c instanceof Error ? c : new Error("Clipboard write failed")
119
183
  );
120
184
  }
121
- }, u = m ? S : j;
122
- return /* @__PURE__ */ t(
123
- I,
185
+ }, p = C ? K : V;
186
+ return /* @__PURE__ */ r(
187
+ S,
124
188
  {
125
- ref: c,
189
+ ref: i,
126
190
  "data-slot": "code-block-copy-button",
127
- className: i("shrink-0", s),
128
- onClick: n,
191
+ className: f("shrink-0", a),
192
+ onClick: d,
129
193
  size: "icon-sm",
130
194
  variant: "secondary",
131
- ...d,
132
- children: r ?? /* @__PURE__ */ t(u, { size: 14 })
195
+ ...h,
196
+ children: o ?? /* @__PURE__ */ r(p, { size: 14 })
133
197
  }
134
198
  );
135
199
  });
136
- P.displayName = "CodeBlockCopyButton";
137
- const $ = x(({ children: e, className: l, ...a }, r) => {
138
- const { isCollapsed: s, setIsCollapsed: d, lineCount: c } = B(g);
139
- return c <= 1 ? null : /* @__PURE__ */ t(
140
- I,
200
+ re.displayName = "CodeBlockCopyButton";
201
+ const le = w(({ children: e, className: t, ...n }, o) => {
202
+ const { isCollapsed: a, setIsCollapsed: h, lineCount: i } = H(I);
203
+ return i <= 1 ? null : /* @__PURE__ */ r(
204
+ S,
141
205
  {
142
- ref: r,
206
+ ref: o,
143
207
  "data-slot": "code-block-collapse-button",
144
- className: i("shrink-0", l),
145
- onClick: () => d(!s),
208
+ className: f("shrink-0", t),
209
+ onClick: () => h(!a),
146
210
  size: "icon-sm",
147
211
  variant: "secondary",
148
- ...a,
149
- children: e ?? /* @__PURE__ */ t(M, { size: 14 })
212
+ ...n,
213
+ children: e ?? /* @__PURE__ */ r($, { size: 14 })
150
214
  }
151
215
  );
152
216
  });
153
- $.displayName = "CodeBlockCollapseButton";
154
- const q = x(
217
+ le.displayName = "CodeBlockCollapseButton";
218
+ const ae = w(
155
219
  ({
156
220
  fileName: e = "code.txt",
157
- mimeType: l = "text/plain;charset=utf-8",
158
- onDownload: a,
159
- onError: r,
160
- children: s,
161
- className: d,
162
- ...c
163
- }, m) => {
164
- const { code: p } = B(g), f = () => {
221
+ mimeType: t = "text/plain;charset=utf-8",
222
+ onDownload: n,
223
+ onError: o,
224
+ children: a,
225
+ className: h,
226
+ ...i
227
+ }, C) => {
228
+ const { code: k } = H(I), b = () => {
165
229
  if (typeof window > "u" || typeof document > "u") {
166
- r?.(new Error("Download not available"));
230
+ o?.(new Error("Download not available"));
167
231
  return;
168
232
  }
169
233
  try {
170
- const n = new Blob([p], { type: l }), u = URL.createObjectURL(n), o = document.createElement("a");
171
- o.href = u, o.download = e, o.rel = "noopener", o.click(), URL.revokeObjectURL(u), a?.();
172
- } catch (n) {
173
- r?.(
174
- n instanceof Error ? n : new Error("Download failed")
234
+ const d = new Blob([k], { type: t }), p = URL.createObjectURL(d), c = document.createElement("a");
235
+ c.href = p, c.download = e, c.rel = "noopener", c.click(), URL.revokeObjectURL(p), n?.();
236
+ } catch (d) {
237
+ o?.(
238
+ d instanceof Error ? d : new Error("Download failed")
175
239
  );
176
240
  }
177
241
  };
178
- return /* @__PURE__ */ t(
179
- I,
242
+ return /* @__PURE__ */ r(
243
+ S,
180
244
  {
181
- ref: m,
245
+ ref: C,
182
246
  "data-slot": "code-block-download-button",
183
- className: i("shrink-0", d),
184
- onClick: f,
247
+ className: f("shrink-0", h),
248
+ onClick: b,
185
249
  size: "icon-sm",
186
250
  variant: "secondary",
187
- ...c,
188
- children: s ?? /* @__PURE__ */ t(U, { size: 14 })
251
+ ...i,
252
+ children: a ?? /* @__PURE__ */ r(q, { size: 14 })
189
253
  }
190
254
  );
191
255
  }
192
256
  );
193
- q.displayName = "CodeBlockDownloadButton";
257
+ ae.displayName = "CodeBlockDownloadButton";
194
258
  export {
195
- O as CodeBlock,
196
- $ as CodeBlockCollapseButton,
197
- P as CodeBlockCopyButton,
198
- q as CodeBlockDownloadButton
259
+ ne as CodeBlock,
260
+ le as CodeBlockCollapseButton,
261
+ re as CodeBlockCopyButton,
262
+ ae as CodeBlockDownloadButton,
263
+ J as getCollapsedPreviewDisplay,
264
+ Q as isContentLargerThanPreview,
265
+ Z as plainPreMarkup,
266
+ Y as shouldUsePlainTextInsteadOfShiki
199
267
  };
@@ -31,7 +31,7 @@ declare const CommandInput: import('react').ForwardRefExoticComponent<Omit<Omit<
31
31
  ref?: React.Ref<HTMLInputElement>;
32
32
  } & {
33
33
  asChild?: boolean;
34
- }, "key" | keyof import('react').InputHTMLAttributes<HTMLInputElement> | "asChild">, "onChange" | "value" | "type"> & {
34
+ }, "key" | keyof import('react').InputHTMLAttributes<HTMLInputElement> | "asChild">, "type" | "value" | "onChange"> & {
35
35
  value?: string;
36
36
  onValueChange?: (search: string) => void;
37
37
  } & import('react').RefAttributes<HTMLInputElement>, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
@@ -75,7 +75,7 @@ declare const CommandItem: import('react').ForwardRefExoticComponent<Omit<{
75
75
  ref?: React.Ref<HTMLDivElement>;
76
76
  } & {
77
77
  asChild?: boolean;
78
- }, "key" | keyof import('react').HTMLAttributes<HTMLDivElement> | "asChild">, "onSelect" | "value" | "disabled"> & {
78
+ }, "key" | keyof import('react').HTMLAttributes<HTMLDivElement> | "asChild">, "disabled" | "value" | "onSelect"> & {
79
79
  disabled?: boolean;
80
80
  onSelect?: (value: string) => void;
81
81
  value?: string;
@@ -0,0 +1,8 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ declare const countVariants: (props?: ({
3
+ variant?: "default" | "warning" | "critical" | null | undefined;
4
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
5
+ declare const Count: import('react').ForwardRefExoticComponent<Omit<import('react').ClassAttributes<HTMLOutputElement> & import('react').OutputHTMLAttributes<HTMLOutputElement> & VariantProps<(props?: ({
6
+ variant?: "default" | "warning" | "critical" | null | undefined;
7
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string>, "ref"> & import('react').RefAttributes<HTMLOutputElement>>;
8
+ export { Count, countVariants };
@@ -0,0 +1,32 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { forwardRef as o } from "react";
3
+ import { cva as i } from "class-variance-authority";
4
+ import { cn as u } from "../../../../lib/utils.js";
5
+ const c = i(
6
+ "flex min-h-9 min-w-9 flex-col items-center justify-center rounded-sm px-0.5 text-3xl font-medium leading-8 tracking-tightest",
7
+ {
8
+ variants: {
9
+ variant: {
10
+ default: "bg-neutral-background text-neutral-foreground-on-neutral",
11
+ warning: "bg-warning-background text-warning-foreground-on-warning",
12
+ critical: "bg-destructive-background text-destructive-foreground-on-critical"
13
+ }
14
+ },
15
+ defaultVariants: {
16
+ variant: "default"
17
+ }
18
+ }
19
+ ), d = o(({ className: t, variant: r, ...n }, a) => /* @__PURE__ */ e(
20
+ "output",
21
+ {
22
+ ref: a,
23
+ "data-slot": "count",
24
+ className: u(c({ variant: r }), t),
25
+ ...n
26
+ }
27
+ ));
28
+ d.displayName = "Count";
29
+ export {
30
+ d as Count,
31
+ c as countVariants
32
+ };
@@ -4,7 +4,7 @@ declare function DropdownMenu({ ...props }: MenuPrimitive.Root.Props): import("r
4
4
  declare namespace DropdownMenu {
5
5
  var displayName: string;
6
6
  }
7
- declare function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props): import("react/jsx-runtime").JSX.Element;
7
+ declare function DropdownMenuPortal({ container, ...props }: MenuPrimitive.Portal.Props): import("react/jsx-runtime").JSX.Element;
8
8
  declare namespace DropdownMenuPortal {
9
9
  var displayName: string;
10
10
  }