@akira-io/ui 1.0.0 → 1.1.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 (70) hide show
  1. package/README.md +15 -10
  2. package/dist/blocks.d.ts +159 -6
  3. package/dist/blocks.js +1388 -29
  4. package/dist/blocks.js.map +1 -1
  5. package/dist/button-B6wQRe7p.d.ts +16 -0
  6. package/dist/chunk-5AJFQ6C4.js +35 -0
  7. package/dist/chunk-5AJFQ6C4.js.map +1 -0
  8. package/dist/chunk-6QM5BA7B.js +148 -0
  9. package/dist/chunk-6QM5BA7B.js.map +1 -0
  10. package/dist/chunk-6X4TKSF6.js +21 -0
  11. package/dist/chunk-6X4TKSF6.js.map +1 -0
  12. package/dist/chunk-DSD7MVLL.js +287 -0
  13. package/dist/chunk-DSD7MVLL.js.map +1 -0
  14. package/dist/chunk-IQMRJXEO.js +59 -0
  15. package/dist/chunk-IQMRJXEO.js.map +1 -0
  16. package/dist/chunk-JAHTUAQL.js +82 -0
  17. package/dist/chunk-JAHTUAQL.js.map +1 -0
  18. package/dist/{chunk-A2SIZOEA.js → chunk-KYWA5UYN.js} +125 -45
  19. package/dist/chunk-KYWA5UYN.js.map +1 -0
  20. package/dist/chunk-L2H5GIF7.js +22 -0
  21. package/dist/chunk-L2H5GIF7.js.map +1 -0
  22. package/dist/chunk-LKSM3WLK.js +44 -0
  23. package/dist/chunk-LKSM3WLK.js.map +1 -0
  24. package/dist/{chunk-5MQWJVM2.js → chunk-MNGNBEYN.js} +168 -200
  25. package/dist/chunk-MNGNBEYN.js.map +1 -0
  26. package/dist/chunk-SA5LM2GD.js +102 -0
  27. package/dist/chunk-SA5LM2GD.js.map +1 -0
  28. package/dist/chunk-UUEWFCKT.js +28 -0
  29. package/dist/chunk-UUEWFCKT.js.map +1 -0
  30. package/dist/{chunk-42BJBH56.js → chunk-UUTXPPRN.js} +521 -107
  31. package/dist/chunk-UUTXPPRN.js.map +1 -0
  32. package/dist/{chunk-UXL33CZ4.js → chunk-YOVY3KT6.js} +13 -11
  33. package/dist/chunk-YOVY3KT6.js.map +1 -0
  34. package/dist/code.d.ts +6 -0
  35. package/dist/code.js +651 -0
  36. package/dist/code.js.map +1 -0
  37. package/dist/context-VgHq4U98.d.ts +384 -0
  38. package/dist/editor.d.ts +126 -0
  39. package/dist/editor.js +436 -0
  40. package/dist/editor.js.map +1 -0
  41. package/dist/index.d.ts +93 -17
  42. package/dist/index.js +996 -472
  43. package/dist/index.js.map +1 -1
  44. package/dist/inertia.d.ts +47 -2
  45. package/dist/inertia.js +138 -7
  46. package/dist/inertia.js.map +1 -1
  47. package/dist/input-4uxAHW6y.d.ts +5 -0
  48. package/dist/json-viewer-BTHBACj9.d.ts +50 -0
  49. package/dist/{language-Bft6rBBt.d.ts → language-Dgjr9bm3.d.ts} +1 -1
  50. package/dist/locales/pt.d.ts +26 -4
  51. package/dist/locales/pt.js +127 -1
  52. package/dist/locales/pt.js.map +1 -1
  53. package/dist/password-input-r39y2pCT.d.ts +50 -0
  54. package/dist/shells.d.ts +45 -7
  55. package/dist/shells.js +95 -60
  56. package/dist/shells.js.map +1 -1
  57. package/dist/{sidebar-BDhG9SUU.d.ts → sidebar-BhOIlSjt.d.ts} +4 -12
  58. package/dist/{types-Cno1_Ijx.d.ts → types-B4QS3h5p.d.ts} +9 -1
  59. package/dist/types-CT0rBsFc.d.ts +110 -0
  60. package/package.json +170 -130
  61. package/theme.css +20 -0
  62. package/themes/nosferry.css +4 -0
  63. package/dist/chunk-42BJBH56.js.map +0 -1
  64. package/dist/chunk-5MQWJVM2.js.map +0 -1
  65. package/dist/chunk-A2SIZOEA.js.map +0 -1
  66. package/dist/chunk-POE7OYET.js +0 -96
  67. package/dist/chunk-POE7OYET.js.map +0 -1
  68. package/dist/chunk-UXL33CZ4.js.map +0 -1
  69. package/dist/date-range-filter-QEa8fhUM.d.ts +0 -149
  70. package/dist/types-cOieac8G.d.ts +0 -77
package/dist/code.js ADDED
@@ -0,0 +1,651 @@
1
+ import { CopyButton } from './chunk-JAHTUAQL.js';
2
+ import { useUiLabels } from './chunk-5AJFQ6C4.js';
3
+ import { cn, compactRadius, controlFill, elevatedSurface, nestedSurfaceReset, Button, focusRing } from './chunk-DSD7MVLL.js';
4
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
+ import * as React2 from 'react';
6
+ import { FileCode, ChevronRight } from 'lucide-react';
7
+
8
+ function Code({ className, ...props }) {
9
+ return /* @__PURE__ */ jsx(
10
+ "code",
11
+ {
12
+ "data-slot": "code",
13
+ className: cn(
14
+ compactRadius,
15
+ controlFill,
16
+ "px-1.5 py-0.5 font-mono font-medium text-[0.875em] text-foreground",
17
+ className
18
+ ),
19
+ ...props
20
+ }
21
+ );
22
+ }
23
+ function CodeBlockHeader({
24
+ filename,
25
+ language,
26
+ code,
27
+ copyLabel,
28
+ copiedLabel
29
+ }) {
30
+ return /* @__PURE__ */ jsxs(
31
+ "div",
32
+ {
33
+ "data-slot": "code-block-header",
34
+ className: "gap-2 px-4 py-2 flex items-center border-b border-border",
35
+ children: [
36
+ /* @__PURE__ */ jsx(FileCode, { className: "size-4 shrink-0 text-muted-foreground" }),
37
+ /* @__PURE__ */ jsx(
38
+ "span",
39
+ {
40
+ "data-slot": "code-block-filename",
41
+ className: "text-sm font-medium truncate text-foreground",
42
+ children: filename
43
+ }
44
+ ),
45
+ language !== void 0 && /* @__PURE__ */ jsx(
46
+ "span",
47
+ {
48
+ "data-slot": "code-block-language",
49
+ className: "text-xs font-medium tracking-wide text-muted-foreground uppercase",
50
+ children: language
51
+ }
52
+ ),
53
+ /* @__PURE__ */ jsx(
54
+ CopyButton,
55
+ {
56
+ value: code,
57
+ copyLabel,
58
+ copiedLabel,
59
+ className: "ml-auto text-muted-foreground"
60
+ }
61
+ )
62
+ ]
63
+ }
64
+ );
65
+ }
66
+
67
+ // src/lib/shiki.ts
68
+ var LIGHT_THEME = "github-light";
69
+ var DARK_THEME = "github-dark";
70
+ var pending = null;
71
+ function loadCodeToHtml() {
72
+ pending ??= import('shiki').then((module) => module.codeToHtml).catch(() => null);
73
+ return pending;
74
+ }
75
+ async function highlightCode(code, language) {
76
+ const codeToHtml = await loadCodeToHtml();
77
+ if (!codeToHtml) {
78
+ return null;
79
+ }
80
+ try {
81
+ return await codeToHtml(code, {
82
+ lang: language,
83
+ themes: { light: LIGHT_THEME, dark: DARK_THEME },
84
+ defaultColor: false
85
+ });
86
+ } catch {
87
+ return null;
88
+ }
89
+ }
90
+
91
+ // src/hooks/use-highlighted-code.ts
92
+ function useHighlightedCode(code, language, html) {
93
+ const [highlighted, setHighlighted] = React2.useState(
94
+ html ?? null
95
+ );
96
+ React2.useEffect(() => {
97
+ if (html !== void 0) {
98
+ setHighlighted(html);
99
+ return;
100
+ }
101
+ if (language === void 0) {
102
+ setHighlighted(null);
103
+ return;
104
+ }
105
+ let active = true;
106
+ highlightCode(code, language).then((result) => {
107
+ if (active) {
108
+ setHighlighted(result);
109
+ }
110
+ });
111
+ return () => {
112
+ active = false;
113
+ };
114
+ }, [code, language, html]);
115
+ return highlighted;
116
+ }
117
+
118
+ // src/lib/code-lines.ts
119
+ var LINE_OPEN = '<span class="line">';
120
+ var SPAN_CLOSE = "</span>";
121
+ function splitSourceLines(code) {
122
+ return code.replace(/\n$/, "").split("\n");
123
+ }
124
+ function parseLineRanges(spec) {
125
+ const lines = /* @__PURE__ */ new Set();
126
+ if (spec === void 0) {
127
+ return lines;
128
+ }
129
+ if (Array.isArray(spec)) {
130
+ for (const line of spec) {
131
+ lines.add(line);
132
+ }
133
+ return lines;
134
+ }
135
+ for (const part of spec.split(",")) {
136
+ const [from, to] = part.split("-").map((bound) => Number.parseInt(bound.trim(), 10));
137
+ if (Number.isNaN(from)) {
138
+ continue;
139
+ }
140
+ const last = to === void 0 || Number.isNaN(to) ? from : to;
141
+ for (let line = from; line <= last; line += 1) {
142
+ lines.add(line);
143
+ }
144
+ }
145
+ return lines;
146
+ }
147
+ function closingSpan(html, from) {
148
+ let depth = 0;
149
+ let cursor = from;
150
+ while (cursor < html.length) {
151
+ const open = html.indexOf("<span", cursor);
152
+ const close = html.indexOf(SPAN_CLOSE, cursor);
153
+ if (close === -1) {
154
+ return -1;
155
+ }
156
+ if (open !== -1 && open < close) {
157
+ depth += 1;
158
+ cursor = open + 5;
159
+ continue;
160
+ }
161
+ if (depth === 0) {
162
+ return close;
163
+ }
164
+ depth -= 1;
165
+ cursor = close + SPAN_CLOSE.length;
166
+ }
167
+ return -1;
168
+ }
169
+ function splitHighlightedLines(html) {
170
+ const lines = [];
171
+ let cursor = html.indexOf(LINE_OPEN);
172
+ while (cursor !== -1) {
173
+ const start = cursor + LINE_OPEN.length;
174
+ const end = closingSpan(html, start);
175
+ if (end === -1) {
176
+ return null;
177
+ }
178
+ lines.push(html.slice(start, end));
179
+ cursor = html.indexOf(LINE_OPEN, end);
180
+ }
181
+ return lines.length > 0 ? lines : null;
182
+ }
183
+ var codeBlockLabels = {
184
+ copyLabel: "Copy",
185
+ copiedLabel: "Copied",
186
+ expandLabel: "Expand",
187
+ collapseLabel: "Collapse"
188
+ };
189
+ function CodeBlock({
190
+ code,
191
+ language,
192
+ html,
193
+ filename,
194
+ lineNumbers = false,
195
+ highlightLines,
196
+ maxHeight,
197
+ copyLabel,
198
+ copiedLabel,
199
+ expandLabel,
200
+ collapseLabel,
201
+ className,
202
+ ...props
203
+ }) {
204
+ const labels = useUiLabels("codeBlock", codeBlockLabels, {
205
+ copyLabel,
206
+ copiedLabel,
207
+ expandLabel,
208
+ collapseLabel
209
+ });
210
+ const highlighted = useHighlightedCode(code, language, html);
211
+ const lines = React2.useMemo(() => splitSourceLines(code), [code]);
212
+ const markup = React2.useMemo(
213
+ () => highlighted === null ? null : splitHighlightedLines(highlighted),
214
+ [highlighted]
215
+ );
216
+ const emphasised = React2.useMemo(
217
+ () => parseLineRanges(highlightLines),
218
+ [highlightLines]
219
+ );
220
+ const bodyRef = React2.useRef(null);
221
+ const [expanded, setExpanded] = React2.useState(false);
222
+ const [clipped, setClipped] = React2.useState(false);
223
+ React2.useEffect(() => {
224
+ const body = bodyRef.current;
225
+ if (!body || maxHeight === void 0 || expanded) {
226
+ return;
227
+ }
228
+ setClipped(body.scrollHeight > body.clientHeight + 1);
229
+ }, [maxHeight, expanded, lines, markup]);
230
+ return /* @__PURE__ */ jsxs(
231
+ "div",
232
+ {
233
+ "data-slot": "code-block",
234
+ className: cn(
235
+ elevatedSurface,
236
+ nestedSurfaceReset,
237
+ "relative overflow-hidden bg-card",
238
+ className
239
+ ),
240
+ ...props,
241
+ children: [
242
+ filename === void 0 ? /* @__PURE__ */ jsx(
243
+ CopyButton,
244
+ {
245
+ value: code,
246
+ copyLabel: labels.copyLabel,
247
+ copiedLabel: labels.copiedLabel,
248
+ className: "top-2 right-2 absolute z-10 text-muted-foreground"
249
+ }
250
+ ) : /* @__PURE__ */ jsx(
251
+ CodeBlockHeader,
252
+ {
253
+ filename,
254
+ language,
255
+ code,
256
+ copyLabel: labels.copyLabel,
257
+ copiedLabel: labels.copiedLabel
258
+ }
259
+ ),
260
+ /* @__PURE__ */ jsx(
261
+ "div",
262
+ {
263
+ ref: bodyRef,
264
+ "data-slot": "code-block-body",
265
+ style: { maxHeight: expanded ? void 0 : maxHeight },
266
+ className: "py-4 font-mono text-sm leading-6 overflow-auto rounded-[inherit]",
267
+ children: /* @__PURE__ */ jsx("pre", { className: "w-max min-w-full", children: /* @__PURE__ */ jsx("code", { "data-slot": "code-block-code", children: lines.map((line, index) => /* @__PURE__ */ jsx(
268
+ CodeBlockLine,
269
+ {
270
+ number: index + 1,
271
+ line,
272
+ markup: markup?.[index],
273
+ lineNumbers,
274
+ emphasised: emphasised.has(index + 1)
275
+ },
276
+ index
277
+ )) }) })
278
+ }
279
+ ),
280
+ clipped && /* @__PURE__ */ jsx(
281
+ CodeBlockExpander,
282
+ {
283
+ expanded,
284
+ expandLabel: labels.expandLabel,
285
+ collapseLabel: labels.collapseLabel,
286
+ onToggle: () => setExpanded((open) => !open)
287
+ }
288
+ )
289
+ ]
290
+ }
291
+ );
292
+ }
293
+ function CodeBlockLine({
294
+ number,
295
+ line,
296
+ markup,
297
+ lineNumbers,
298
+ emphasised
299
+ }) {
300
+ return /* @__PURE__ */ jsxs(
301
+ "span",
302
+ {
303
+ "data-slot": "code-block-line",
304
+ "data-highlighted": emphasised ? "" : void 0,
305
+ className: cn(
306
+ "min-h-6 px-4 grid w-full data-highlighted:bg-accent",
307
+ lineNumbers ? "grid-cols-[2.5rem_1fr]" : "grid-cols-1"
308
+ ),
309
+ children: [
310
+ lineNumbers && /* @__PURE__ */ jsx(
311
+ "span",
312
+ {
313
+ "data-slot": "code-block-gutter",
314
+ "aria-hidden": "true",
315
+ className: "pr-4 text-right text-muted-foreground select-none",
316
+ children: number
317
+ }
318
+ ),
319
+ markup === void 0 ? /* @__PURE__ */ jsx("span", { "data-slot": "code-block-source", children: line }) : /* @__PURE__ */ jsx(
320
+ "span",
321
+ {
322
+ "data-slot": "code-block-source",
323
+ dangerouslySetInnerHTML: { __html: markup }
324
+ }
325
+ )
326
+ ]
327
+ }
328
+ );
329
+ }
330
+ function CodeBlockExpander({
331
+ expanded,
332
+ expandLabel,
333
+ collapseLabel,
334
+ onToggle
335
+ }) {
336
+ return /* @__PURE__ */ jsxs(
337
+ "div",
338
+ {
339
+ "data-slot": "code-block-expander",
340
+ className: "inset-x-0 bottom-0 pt-10 pb-2 absolute flex justify-center",
341
+ children: [
342
+ !expanded && /* @__PURE__ */ jsx(
343
+ "span",
344
+ {
345
+ "aria-hidden": "true",
346
+ className: "inset-0 pointer-events-none absolute bg-gradient-to-t from-card to-transparent"
347
+ }
348
+ ),
349
+ /* @__PURE__ */ jsx(
350
+ Button,
351
+ {
352
+ type: "button",
353
+ variant: "secondary",
354
+ size: "sm",
355
+ onClick: onToggle,
356
+ children: expanded ? collapseLabel : expandLabel
357
+ }
358
+ )
359
+ ]
360
+ }
361
+ );
362
+ }
363
+
364
+ // src/lib/json-value.ts
365
+ var CIRCULAR_MARKER = "[Circular]";
366
+ function jsonKind(value) {
367
+ if (value === null) {
368
+ return "null";
369
+ }
370
+ if (Array.isArray(value)) {
371
+ return "array";
372
+ }
373
+ switch (typeof value) {
374
+ case "string":
375
+ return "string";
376
+ case "number":
377
+ return Number.isFinite(value) ? "number" : "unsupported";
378
+ case "boolean":
379
+ return "boolean";
380
+ case "object":
381
+ return "object";
382
+ default:
383
+ return "unsupported";
384
+ }
385
+ }
386
+ function isBranch(kind) {
387
+ return kind === "object" || kind === "array";
388
+ }
389
+ function entriesOf(value) {
390
+ if (Array.isArray(value)) {
391
+ return value.map((item, index) => [String(index), item]);
392
+ }
393
+ if (value !== null && typeof value === "object") {
394
+ return Object.entries(value);
395
+ }
396
+ return [];
397
+ }
398
+ function serialisable(value, ancestors) {
399
+ if (typeof value === "bigint") {
400
+ return value.toString();
401
+ }
402
+ if (value === null || typeof value !== "object") {
403
+ return value;
404
+ }
405
+ if (ancestors.includes(value)) {
406
+ return CIRCULAR_MARKER;
407
+ }
408
+ const trail = [...ancestors, value];
409
+ if (Array.isArray(value)) {
410
+ return value.map((item) => serialisable(item, trail));
411
+ }
412
+ return Object.fromEntries(
413
+ Object.entries(value).map(([key, item]) => [
414
+ key,
415
+ serialisable(item, trail)
416
+ ])
417
+ );
418
+ }
419
+ function stringifyJson(value) {
420
+ return JSON.stringify(serialisable(value, []), null, 2) ?? "null";
421
+ }
422
+ var LEAF_CLASS = {
423
+ string: "text-success",
424
+ number: "text-primary",
425
+ boolean: "text-destructive",
426
+ null: "text-muted-foreground",
427
+ object: "text-foreground",
428
+ array: "text-foreground",
429
+ unsupported: "text-muted-foreground italic"
430
+ };
431
+ var BRACKETS = {
432
+ object: ["{", "}"],
433
+ array: ["[", "]"]
434
+ };
435
+ function leafText(value, kind) {
436
+ if (kind === "string") {
437
+ return `"${String(value)}"`;
438
+ }
439
+ if (kind === "null") {
440
+ return "null";
441
+ }
442
+ return String(value);
443
+ }
444
+ function JsonKey({ name }) {
445
+ return /* @__PURE__ */ jsxs(
446
+ "span",
447
+ {
448
+ "data-slot": "json-viewer-key",
449
+ className: "font-medium text-foreground",
450
+ children: [
451
+ name,
452
+ ":"
453
+ ]
454
+ }
455
+ );
456
+ }
457
+ function JsonNode({
458
+ name,
459
+ value,
460
+ depth,
461
+ initialDepth,
462
+ ancestors,
463
+ labels
464
+ }) {
465
+ const kind = jsonKind(value);
466
+ const branch = isBranch(kind);
467
+ const circular = branch && ancestors.includes(value);
468
+ const [open, setOpen] = React2.useState(depth < initialDepth);
469
+ const entries = React2.useMemo(
470
+ () => branch && !circular ? entriesOf(value) : [],
471
+ [branch, circular, value]
472
+ );
473
+ const trail = React2.useMemo(
474
+ () => branch ? [...ancestors, value] : ancestors,
475
+ [branch, ancestors, value]
476
+ );
477
+ if (!branch || circular) {
478
+ return /* @__PURE__ */ jsxs(
479
+ "div",
480
+ {
481
+ "data-slot": "json-viewer-node",
482
+ className: "gap-2 py-0.5 pl-5 flex",
483
+ children: [
484
+ name !== void 0 && /* @__PURE__ */ jsx(JsonKey, { name }),
485
+ circular ? /* @__PURE__ */ jsx(
486
+ "span",
487
+ {
488
+ "data-slot": "json-viewer-circular",
489
+ className: "text-muted-foreground italic",
490
+ children: labels.circularLabel
491
+ }
492
+ ) : /* @__PURE__ */ jsx(
493
+ "span",
494
+ {
495
+ "data-slot": "json-viewer-value",
496
+ className: cn("break-all", LEAF_CLASS[kind]),
497
+ children: leafText(value, kind)
498
+ }
499
+ )
500
+ ]
501
+ }
502
+ );
503
+ }
504
+ const [opening, closing] = BRACKETS[kind === "array" ? "array" : "object"];
505
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "json-viewer-node", children: [
506
+ /* @__PURE__ */ jsxs(
507
+ "button",
508
+ {
509
+ type: "button",
510
+ "data-slot": "json-viewer-toggle",
511
+ "aria-expanded": open,
512
+ "aria-label": open ? labels.collapseLabel : labels.expandLabel,
513
+ onClick: () => setOpen((current) => !current),
514
+ className: cn(
515
+ "gap-2 rounded-xl py-0.5 flex w-full cursor-pointer items-center text-left hover:bg-accent",
516
+ focusRing
517
+ ),
518
+ children: [
519
+ /* @__PURE__ */ jsx(
520
+ ChevronRight,
521
+ {
522
+ "aria-hidden": "true",
523
+ className: cn(
524
+ "size-3.5 shrink-0 text-muted-foreground transition-transform",
525
+ open && "rotate-90"
526
+ )
527
+ }
528
+ ),
529
+ name !== void 0 && /* @__PURE__ */ jsx(JsonKey, { name }),
530
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: opening }),
531
+ !open && /* @__PURE__ */ jsxs(Fragment, { children: [
532
+ /* @__PURE__ */ jsx(
533
+ "span",
534
+ {
535
+ "data-slot": "json-viewer-summary",
536
+ className: "text-xs font-medium text-muted-foreground",
537
+ children: labels.entriesLabel(entries.length)
538
+ }
539
+ ),
540
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: closing })
541
+ ] })
542
+ ]
543
+ }
544
+ ),
545
+ open && /* @__PURE__ */ jsxs("div", { className: "ml-1.5 pl-3 border-l border-border", children: [
546
+ entries.map(([key, item]) => /* @__PURE__ */ jsx(
547
+ JsonNode,
548
+ {
549
+ name: key,
550
+ value: item,
551
+ depth: depth + 1,
552
+ initialDepth,
553
+ ancestors: trail,
554
+ labels
555
+ },
556
+ key
557
+ )),
558
+ /* @__PURE__ */ jsx("div", { className: "pl-5 text-muted-foreground", children: closing })
559
+ ] })
560
+ ] });
561
+ }
562
+ var jsonViewerLabels = {
563
+ copyLabel: "Copy",
564
+ copiedLabel: "Copied",
565
+ expandLabel: "Expand",
566
+ collapseLabel: "Collapse",
567
+ circularLabel: "Circular reference",
568
+ entriesLabel: (count) => `${count} ${count === 1 ? "entry" : "entries"}`
569
+ };
570
+ function JsonViewer({
571
+ value,
572
+ initialDepth = 1,
573
+ maxHeight,
574
+ copyLabel,
575
+ copiedLabel,
576
+ expandLabel,
577
+ collapseLabel,
578
+ circularLabel,
579
+ entriesLabel,
580
+ className,
581
+ ...props
582
+ }) {
583
+ const text = useUiLabels("jsonViewer", jsonViewerLabels, {
584
+ copyLabel,
585
+ copiedLabel,
586
+ expandLabel,
587
+ collapseLabel,
588
+ circularLabel,
589
+ entriesLabel
590
+ });
591
+ const labels = React2.useMemo(
592
+ () => ({
593
+ expandLabel: text.expandLabel,
594
+ collapseLabel: text.collapseLabel,
595
+ circularLabel: text.circularLabel,
596
+ entriesLabel: text.entriesLabel
597
+ }),
598
+ [
599
+ text.expandLabel,
600
+ text.collapseLabel,
601
+ text.circularLabel,
602
+ text.entriesLabel
603
+ ]
604
+ );
605
+ return /* @__PURE__ */ jsxs(
606
+ "div",
607
+ {
608
+ "data-slot": "json-viewer",
609
+ className: cn(
610
+ elevatedSurface,
611
+ nestedSurfaceReset,
612
+ "relative overflow-hidden bg-card",
613
+ className
614
+ ),
615
+ ...props,
616
+ children: [
617
+ /* @__PURE__ */ jsx(
618
+ CopyButton,
619
+ {
620
+ value: stringifyJson(value),
621
+ copyLabel: text.copyLabel,
622
+ copiedLabel: text.copiedLabel,
623
+ className: "top-2 right-2 absolute z-10 text-muted-foreground"
624
+ }
625
+ ),
626
+ /* @__PURE__ */ jsx(
627
+ "div",
628
+ {
629
+ "data-slot": "json-viewer-body",
630
+ style: { maxHeight },
631
+ className: "p-4 pr-12 font-mono text-sm leading-6 overflow-auto rounded-[inherit]",
632
+ children: /* @__PURE__ */ jsx(
633
+ JsonNode,
634
+ {
635
+ value,
636
+ depth: 0,
637
+ initialDepth,
638
+ ancestors: [],
639
+ labels
640
+ }
641
+ )
642
+ }
643
+ )
644
+ ]
645
+ }
646
+ );
647
+ }
648
+
649
+ export { Code, CodeBlock, JsonViewer, codeBlockLabels, jsonViewerLabels };
650
+ //# sourceMappingURL=code.js.map
651
+ //# sourceMappingURL=code.js.map