orbital-ds 0.30.0 → 0.35.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/AGENTS.md +1 -1
- package/components.manifest.json +3216 -3160
- package/dist/hooks/use-ds-messages.d.ts +39 -0
- package/dist/lib/i18n.d.ts +39 -0
- package/dist/lib/i18n.js +117 -0
- package/dist/lib/template-syntax.d.ts +22 -0
- package/dist/lib/template-syntax.js +66 -0
- package/dist/motion.css +146 -0
- package/dist/styles.css +1699 -0
- package/dist/themes/chocolate.css +259 -0
- package/dist/themes/chocolate.fonts.css +2 -0
- package/dist/themes/chocolate.guide.md +30 -0
- package/dist/themes/chocolate.meta.json +61 -0
- package/dist/themes/chocolate.scoped.css +259 -0
- package/dist/themes/chocolate.tokens.json +49 -0
- package/dist/themes/fractalia.css +556 -0
- package/dist/themes/fractalia.fonts.css +3 -0
- package/dist/themes/fractalia.guide.md +86 -0
- package/dist/themes/fractalia.meta.json +112 -0
- package/dist/themes/fractalia.scoped.css +556 -0
- package/dist/themes/fractalia.tokens.json +39 -0
- package/dist/themes/friendly.css +375 -0
- package/dist/themes/friendly.fonts.css +2 -0
- package/dist/themes/friendly.guide.md +38 -0
- package/dist/themes/friendly.meta.json +82 -0
- package/dist/themes/friendly.scoped.css +375 -0
- package/dist/themes/friendly.tokens.json +45 -0
- package/dist/themes/lagoon.css +359 -0
- package/dist/themes/lagoon.fonts.css +2 -0
- package/dist/themes/lagoon.guide.md +47 -0
- package/dist/themes/lagoon.meta.json +85 -0
- package/dist/themes/lagoon.scoped.css +359 -0
- package/dist/themes/lagoon.tokens.json +49 -0
- package/dist/themes/liquid.css +510 -0
- package/dist/themes/liquid.fonts.css +7 -0
- package/dist/themes/liquid.guide.md +82 -0
- package/dist/themes/liquid.meta.json +134 -0
- package/dist/themes/liquid.scoped.css +510 -0
- package/dist/themes/liquid.tokens.json +47 -0
- package/dist/themes/matcha.css +259 -0
- package/dist/themes/matcha.fonts.css +2 -0
- package/dist/themes/matcha.guide.md +30 -0
- package/dist/themes/matcha.meta.json +61 -0
- package/dist/themes/matcha.scoped.css +259 -0
- package/dist/themes/matcha.tokens.json +49 -0
- package/dist/themes/qratia.css +264 -0
- package/dist/themes/qratia.fonts.css +2 -0
- package/dist/themes/qratia.guide.md +34 -0
- package/dist/themes/qratia.meta.json +49 -0
- package/dist/themes/qratia.scoped.css +264 -0
- package/dist/themes/qratia.tokens.json +49 -0
- package/dist/themes/stone.css +263 -0
- package/dist/themes/stone.fonts.css +2 -0
- package/dist/themes/stone.guide.md +30 -0
- package/dist/themes/stone.meta.json +47 -0
- package/dist/themes/stone.scoped.css +263 -0
- package/dist/themes/stone.tokens.json +49 -0
- package/dist/themes/tactile.css +596 -0
- package/dist/themes/tactile.fonts.css +3 -0
- package/dist/themes/tactile.guide.md +82 -0
- package/dist/themes/tactile.meta.json +182 -0
- package/dist/themes/tactile.scoped.css +596 -0
- package/dist/themes/tactile.tokens.json +42 -0
- package/dist/themes/twitter.css +364 -0
- package/dist/themes/twitter.fonts.css +6 -0
- package/dist/themes/twitter.guide.md +35 -0
- package/dist/themes/twitter.meta.json +90 -0
- package/dist/themes/twitter.scoped.css +364 -0
- package/dist/themes/twitter.tokens.json +45 -0
- package/dist/themes/y2k.css +259 -0
- package/dist/themes/y2k.fonts.css +2 -0
- package/dist/themes/y2k.guide.md +30 -0
- package/dist/themes/y2k.meta.json +59 -0
- package/dist/themes/y2k.scoped.css +259 -0
- package/dist/themes/y2k.tokens.json +49 -0
- package/dist/themes/zyro.css +442 -0
- package/dist/themes/zyro.fonts.css +2 -0
- package/dist/themes/zyro.guide.md +33 -0
- package/dist/themes/zyro.meta.json +74 -0
- package/dist/themes/zyro.scoped.css +442 -0
- package/dist/themes/zyro.tokens.json +46 -0
- package/dist/ui/accordion.js +1 -1
- package/dist/ui/alert-dialog.js +1 -1
- package/dist/ui/alert.js +2 -2
- package/dist/ui/attachment.js +1 -1
- package/dist/ui/auth-form.js +4 -4
- package/dist/ui/auth-layout.d.ts +3 -1
- package/dist/ui/auth-layout.js +7 -4
- package/dist/ui/auth-parts.js +4 -4
- package/dist/ui/avatar.js +1 -1
- package/dist/ui/ayuda.js +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/badge.js +1 -1
- package/dist/ui/banner.js +1 -1
- package/dist/ui/bottom-nav.js +1 -1
- package/dist/ui/breadcrumb.js +1 -1
- package/dist/ui/bubble.d.ts +1 -1
- package/dist/ui/bubble.js +3 -3
- package/dist/ui/button-group.js +1 -1
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/button.js +4 -4
- package/dist/ui/calendar.js +6 -6
- package/dist/ui/carousel.js +4 -4
- package/dist/ui/choice-card.js +1 -1
- package/dist/ui/combobox.js +4 -4
- package/dist/ui/command.js +2 -2
- package/dist/ui/content-card.js +2 -2
- package/dist/ui/context-menu.js +9 -9
- package/dist/ui/data-table.d.ts +13 -3
- package/dist/ui/data-table.js +164 -71
- package/dist/ui/date-picker.js +1 -1
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/drawer.js +5 -5
- package/dist/ui/dropdown-menu.js +9 -9
- package/dist/ui/field.js +3 -3
- package/dist/ui/heatmap-grid.js +2 -2
- package/dist/ui/input-group.js +3 -3
- package/dist/ui/input-otp.js +1 -1
- package/dist/ui/instruction-editor.d.ts +51 -0
- package/dist/ui/instruction-editor.js +263 -0
- package/dist/ui/item.d.ts +1 -1
- package/dist/ui/item.js +1 -1
- package/dist/ui/marker.d.ts +1 -1
- package/dist/ui/marker.js +2 -2
- package/dist/ui/menubar.js +8 -8
- package/dist/ui/mfa-challenge.js +3 -3
- package/dist/ui/mfa-setup.js +1 -1
- package/dist/ui/navigation-menu.js +2 -2
- package/dist/ui/oauth-consent.js +3 -3
- package/dist/ui/pagination.js +2 -2
- package/dist/ui/panel.d.ts +1 -1
- package/dist/ui/panel.js +1 -0
- package/dist/ui/passkey-list.js +1 -1
- package/dist/ui/resizable.js +1 -1
- package/dist/ui/scroll-area.js +1 -1
- package/dist/ui/session-timeout.js +1 -1
- package/dist/ui/sheet.js +2 -2
- package/dist/ui/sidebar.js +7 -7
- package/dist/ui/sign-out-dialog.js +1 -1
- package/dist/ui/sparkline.d.ts +1 -1
- package/dist/ui/status-badge.d.ts +2 -2
- package/dist/ui/switch.js +1 -1
- package/dist/ui/table.js +2 -2
- package/dist/ui/tabs.d.ts +1 -1
- package/dist/ui/tabs.js +2 -2
- package/dist/ui/toast.js +3 -3
- package/dist/ui/toggle-group.js +1 -1
- package/dist/ui/toggle.js +3 -3
- package/dist/ui/tooltip.js +2 -2
- package/docs/CONTRACT.md +224 -224
- package/package.json +218 -188
- package/scripts/brand-core.mjs +20 -1
- package/scripts/cli.mjs +457 -457
- package/scripts/doctor.mjs +2 -0
- package/scripts/init.mjs +1 -1
- package/scripts/manifest.mjs +100 -100
package/dist/ui/data-table.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import {
|
|
4
4
|
columnFilteringFeature,
|
|
5
5
|
columnVisibilityFeature,
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
ArrowDownIcon,
|
|
25
25
|
ArrowUpIcon,
|
|
26
|
+
ChevronDownIcon,
|
|
26
27
|
ChevronLeftIcon,
|
|
27
28
|
ChevronRightIcon,
|
|
28
29
|
ChevronsUpDownIcon,
|
|
@@ -32,6 +33,7 @@ import {
|
|
|
32
33
|
import * as React from "react";
|
|
33
34
|
import { useDsLocale, useDsMessages } from "../hooks/use-ds-messages.js";
|
|
34
35
|
import { dsFormat } from "../lib/i18n.js";
|
|
36
|
+
import { dsWarn } from "../lib/presets.js";
|
|
35
37
|
import { cn } from "../lib/utils.js";
|
|
36
38
|
import { Button } from "./button.js";
|
|
37
39
|
import { Checkbox } from "./checkbox.js";
|
|
@@ -277,7 +279,9 @@ function prepareColumns(columns) {
|
|
|
277
279
|
const PRESET_DEFAULTS = {
|
|
278
280
|
browse: { searchable: true, selectable: false, columnToggle: true, density: "comfortable" },
|
|
279
281
|
manage: { searchable: true, selectable: true, columnToggle: true, density: "comfortable" },
|
|
280
|
-
compact: { searchable: true, selectable: false, columnToggle: false, density: "compact" }
|
|
282
|
+
compact: { searchable: true, selectable: false, columnToggle: false, density: "compact" },
|
|
283
|
+
grouped: { searchable: true, selectable: false, columnToggle: true, density: "comfortable" },
|
|
284
|
+
tree: { searchable: true, selectable: false, columnToggle: true, density: "comfortable" }
|
|
281
285
|
};
|
|
282
286
|
function DataTable({
|
|
283
287
|
columns,
|
|
@@ -297,11 +301,21 @@ function DataTable({
|
|
|
297
301
|
toolbar,
|
|
298
302
|
rowActions,
|
|
299
303
|
density = PRESET_DEFAULTS[preset].density,
|
|
304
|
+
groupBy,
|
|
305
|
+
groupLabel,
|
|
306
|
+
defaultCollapsedGroups,
|
|
307
|
+
getSubRows,
|
|
308
|
+
defaultExpandedRows,
|
|
300
309
|
"aria-label": ariaLabel,
|
|
301
310
|
className
|
|
302
311
|
}) {
|
|
303
312
|
const t = useDsMessages();
|
|
304
313
|
const id = React.useId();
|
|
314
|
+
if (preset === "grouped" && !groupBy) dsWarn("DataTable", 'preset="grouped" needs a groupBy function.');
|
|
315
|
+
if (preset === "tree" && !getSubRows) dsWarn("DataTable", 'preset="tree" needs a getSubRows function.');
|
|
316
|
+
const [collapsed, setCollapsed] = React.useState(defaultCollapsedGroups ?? []);
|
|
317
|
+
const [expanded, setExpanded] = React.useState(defaultExpandedRows ?? []);
|
|
318
|
+
const flip = (list, key) => list.includes(key) ? list.filter((k) => k !== key) : [...list, key];
|
|
305
319
|
const [own, setOwn] = React.useState(() => ({
|
|
306
320
|
...DEFAULT_STATE,
|
|
307
321
|
pageSize: pageSizes[0] ?? DEFAULT_STATE.pageSize,
|
|
@@ -345,6 +359,7 @@ function DataTable({
|
|
|
345
359
|
data,
|
|
346
360
|
columns: prepared,
|
|
347
361
|
getRowId,
|
|
362
|
+
getSubRows: getSubRows ? (row) => getSubRows(row) : void 0,
|
|
348
363
|
state: {
|
|
349
364
|
sorting,
|
|
350
365
|
globalFilter: current.search,
|
|
@@ -371,6 +386,25 @@ function DataTable({
|
|
|
371
386
|
const pageCount = Math.max(1, Math.ceil(total / pageSize));
|
|
372
387
|
const pageIndex = Math.min(Math.max(1, current.page), pageCount) - 1;
|
|
373
388
|
const rows = allRows.slice(pageIndex * pageSize, (pageIndex + 1) * pageSize);
|
|
389
|
+
const items = [];
|
|
390
|
+
const pushRows = (list, level) => {
|
|
391
|
+
for (const r of list) {
|
|
392
|
+
items.push({ kind: "row", row: r, level });
|
|
393
|
+
if (getSubRows && expanded.includes(r.id) && r.subRows?.length) pushRows(r.subRows, level + 1);
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
if (groupBy) {
|
|
397
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
398
|
+
for (const r of rows) {
|
|
399
|
+
const key = groupBy(r.original);
|
|
400
|
+
buckets.set(key, [...buckets.get(key) ?? [], r]);
|
|
401
|
+
}
|
|
402
|
+
for (const [key, list] of buckets) {
|
|
403
|
+
const isCollapsed = collapsed.includes(key);
|
|
404
|
+
items.push({ kind: "group", key, count: list.length, collapsed: isCollapsed });
|
|
405
|
+
if (!isCollapsed) pushRows(list, 0);
|
|
406
|
+
}
|
|
407
|
+
} else pushRows(rows, 0);
|
|
374
408
|
const leafColumns = table.getVisibleLeafColumns();
|
|
375
409
|
const colSpan = leafColumns.length + (selectable ? 1 : 0) + (rowActions ? 1 : 0);
|
|
376
410
|
const filterColumns = table.getAllLeafColumns().filter((c) => metaOf(c)?.filter && c.getCanFilter());
|
|
@@ -397,6 +431,8 @@ function DataTable({
|
|
|
397
431
|
"data-slot": "data-table",
|
|
398
432
|
"data-preset": preset,
|
|
399
433
|
"data-density": density,
|
|
434
|
+
"data-grouped": groupBy ? "" : void 0,
|
|
435
|
+
"data-tree": getSubRows ? "" : void 0,
|
|
400
436
|
"aria-busy": loading || void 0,
|
|
401
437
|
className: cn(
|
|
402
438
|
"group/data-table flex w-full min-w-0 flex-col gap-(--ds-section-gap)",
|
|
@@ -569,79 +605,136 @@ function DataTable({
|
|
|
569
605
|
/* @__PURE__ */ jsx(TableBody, { "data-slot": "data-table-body", children: loading ? Array.from({ length: skeletonRows }, (_, i) => (
|
|
570
606
|
// biome-ignore lint/suspicious/noArrayIndexKey: filas skeleton sin identidad
|
|
571
607
|
/* @__PURE__ */ jsx(TableRow, { "data-slot": "data-table-skeleton-row", children: /* @__PURE__ */ jsx(TableCell, { colSpan, className: CELL_DENSITY, children: /* @__PURE__ */ jsx(Skeleton, { className: "h-(--ds-control-h-xs) w-full" }) }) }, i)
|
|
572
|
-
)) : rows.length === 0 ? /* @__PURE__ */ jsx(TableRow, { "data-slot": "data-table-empty-row", className: "hover:bg-transparent", children: /* @__PURE__ */ jsx(TableCell, { colSpan, className: "whitespace-normal", children: empty ?? /* @__PURE__ */ jsx(Empty, { "data-slot": "data-table-empty", children: /* @__PURE__ */ jsx(EmptyHeader, { children: /* @__PURE__ */ jsx(EmptyTitle, { children: t.dataTableNoResults }) }) }) }) }) :
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
e.preventDefault();
|
|
584
|
-
onRowClick(row.original);
|
|
585
|
-
}
|
|
586
|
-
} : void 0,
|
|
587
|
-
className: cn(
|
|
588
|
-
onRowClick && "cursor-pointer outline-none focus-visible:bg-(--ds-row-hover) focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) focus-visible:ring-inset"
|
|
589
|
-
),
|
|
590
|
-
children: [
|
|
591
|
-
selectable && /* @__PURE__ */ jsx(
|
|
592
|
-
TableCell,
|
|
593
|
-
{
|
|
594
|
-
"data-slot": "data-table-select",
|
|
595
|
-
className: cn("w-0 pe-0", CELL_DENSITY),
|
|
596
|
-
onClick: stop,
|
|
597
|
-
onKeyDown: stop,
|
|
598
|
-
children: /* @__PURE__ */ jsx(
|
|
599
|
-
Checkbox,
|
|
608
|
+
)) : rows.length === 0 ? /* @__PURE__ */ jsx(TableRow, { "data-slot": "data-table-empty-row", className: "hover:bg-transparent", children: /* @__PURE__ */ jsx(TableCell, { colSpan, className: "whitespace-normal", children: empty ?? /* @__PURE__ */ jsx(Empty, { "data-slot": "data-table-empty", children: /* @__PURE__ */ jsx(EmptyHeader, { children: /* @__PURE__ */ jsx(EmptyTitle, { children: t.dataTableNoResults }) }) }) }) }) : items.map((item) => {
|
|
609
|
+
if (item.kind === "group") {
|
|
610
|
+
return /* @__PURE__ */ jsx(
|
|
611
|
+
TableRow,
|
|
612
|
+
{
|
|
613
|
+
"data-slot": "data-table-group",
|
|
614
|
+
"data-state": item.collapsed ? "collapsed" : "expanded",
|
|
615
|
+
className: "bg-(--ds-table-group-bg) hover:bg-(--ds-table-group-bg)",
|
|
616
|
+
children: /* @__PURE__ */ jsx(TableCell, { colSpan, className: CELL_DENSITY, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 font-(--ds-medium-weight)", children: [
|
|
617
|
+
/* @__PURE__ */ jsx(
|
|
618
|
+
Button,
|
|
600
619
|
{
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
"aria-
|
|
620
|
+
variant: "ghost",
|
|
621
|
+
size: "icon-xs",
|
|
622
|
+
"aria-expanded": !item.collapsed,
|
|
623
|
+
"aria-label": dsFormat(item.collapsed ? t.dataTableExpandGroup : t.dataTableCollapseGroup, { group: item.key }),
|
|
624
|
+
onClick: () => setCollapsed(flip(collapsed, item.key)),
|
|
625
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn(item.collapsed && "-rotate-90 rtl:rotate-90") })
|
|
605
626
|
}
|
|
606
|
-
)
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
627
|
+
),
|
|
628
|
+
groupLabel ? groupLabel(item.key, item.count) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
629
|
+
/* @__PURE__ */ jsx("span", { children: item.key }),
|
|
630
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground tabular-nums", children: item.count })
|
|
631
|
+
] })
|
|
632
|
+
] }) })
|
|
633
|
+
},
|
|
634
|
+
`group:${item.key}`
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
const { row, level } = item;
|
|
638
|
+
const hasChildren = !!getSubRows && !!row.subRows?.length;
|
|
639
|
+
const isExpanded = hasChildren && expanded.includes(row.id);
|
|
640
|
+
return /* @__PURE__ */ jsxs(
|
|
641
|
+
TableRow,
|
|
642
|
+
{
|
|
643
|
+
"aria-level": getSubRows ? level + 1 : void 0,
|
|
644
|
+
"data-slot": "data-table-row",
|
|
645
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
646
|
+
"data-clickable": onRowClick ? "" : void 0,
|
|
647
|
+
tabIndex: onRowClick ? 0 : void 0,
|
|
648
|
+
onClick: onRowClick ? () => onRowClick(row.original) : void 0,
|
|
649
|
+
onKeyDown: onRowClick ? (e) => {
|
|
650
|
+
if (e.target !== e.currentTarget) return;
|
|
651
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
652
|
+
e.preventDefault();
|
|
653
|
+
onRowClick(row.original);
|
|
629
654
|
}
|
|
655
|
+
} : void 0,
|
|
656
|
+
className: cn(
|
|
657
|
+
onRowClick && "cursor-pointer outline-none focus-visible:bg-(--ds-row-hover) focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color) focus-visible:ring-inset"
|
|
630
658
|
),
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
659
|
+
children: [
|
|
660
|
+
selectable && /* @__PURE__ */ jsx(
|
|
661
|
+
TableCell,
|
|
662
|
+
{
|
|
663
|
+
"data-slot": "data-table-select",
|
|
664
|
+
className: cn("w-0 pe-0", CELL_DENSITY),
|
|
665
|
+
onClick: stop,
|
|
666
|
+
onKeyDown: stop,
|
|
667
|
+
children: /* @__PURE__ */ jsx(
|
|
668
|
+
Checkbox,
|
|
669
|
+
{
|
|
670
|
+
checked: row.getIsSelected(),
|
|
671
|
+
disabled: !row.getCanSelect(),
|
|
672
|
+
onCheckedChange: (v) => row.toggleSelected(!!v),
|
|
673
|
+
"aria-labelledby": `${id}-${row.id}`
|
|
674
|
+
}
|
|
675
|
+
)
|
|
676
|
+
}
|
|
677
|
+
),
|
|
678
|
+
row.getVisibleCells().map(
|
|
679
|
+
(cell, i) => {
|
|
680
|
+
const meta = metaOf(cell.column);
|
|
681
|
+
const align = alignOf(meta);
|
|
682
|
+
return /* @__PURE__ */ jsx(
|
|
683
|
+
TableCell,
|
|
684
|
+
{
|
|
685
|
+
id: i === 0 ? `${id}-${row.id}` : void 0,
|
|
686
|
+
"data-slot": "data-table-cell",
|
|
687
|
+
"data-align": align,
|
|
688
|
+
className: cn(
|
|
689
|
+
ALIGN_CLASS[align],
|
|
690
|
+
meta?.numeric && "tabular-nums",
|
|
691
|
+
CELL_DENSITY,
|
|
692
|
+
meta?.className
|
|
693
|
+
),
|
|
694
|
+
children: getSubRows && i === 0 ? /* @__PURE__ */ jsxs(
|
|
695
|
+
"div",
|
|
696
|
+
{
|
|
697
|
+
className: "flex items-center gap-1",
|
|
698
|
+
style: { paddingInlineStart: `calc(${level} * var(--ds-table-tree-indent))` },
|
|
699
|
+
children: [
|
|
700
|
+
hasChildren ? /* @__PURE__ */ jsx(
|
|
701
|
+
Button,
|
|
702
|
+
{
|
|
703
|
+
variant: "ghost",
|
|
704
|
+
size: "icon-xs",
|
|
705
|
+
"aria-expanded": isExpanded,
|
|
706
|
+
"aria-label": isExpanded ? t.dataTableCollapseRow : t.dataTableExpandRow,
|
|
707
|
+
onClick: (e) => {
|
|
708
|
+
e.stopPropagation();
|
|
709
|
+
setExpanded(flip(expanded, row.id));
|
|
710
|
+
},
|
|
711
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn(!isExpanded && "-rotate-90 rtl:rotate-90") })
|
|
712
|
+
}
|
|
713
|
+
) : /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "inline-block size-(--ds-control-h-xs) shrink-0" }),
|
|
714
|
+
/* @__PURE__ */ jsx(table.FlexRender, { cell })
|
|
715
|
+
]
|
|
716
|
+
}
|
|
717
|
+
) : /* @__PURE__ */ jsx(table.FlexRender, { cell })
|
|
718
|
+
},
|
|
719
|
+
cell.id
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
),
|
|
723
|
+
rowActions && /* @__PURE__ */ jsx(
|
|
724
|
+
TableCell,
|
|
725
|
+
{
|
|
726
|
+
"data-slot": "data-table-actions",
|
|
727
|
+
className: cn("w-0 text-end", CELL_DENSITY),
|
|
728
|
+
onClick: stop,
|
|
729
|
+
onKeyDown: stop,
|
|
730
|
+
children: /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-1", JUSTIFY_CLASS.end), children: rowActions(row.original) })
|
|
731
|
+
}
|
|
732
|
+
)
|
|
733
|
+
]
|
|
734
|
+
},
|
|
735
|
+
row.id
|
|
736
|
+
);
|
|
737
|
+
}) })
|
|
645
738
|
] }),
|
|
646
739
|
loading && /* @__PURE__ */ jsx("span", { id: `${id}-status`, role: "status", className: "sr-only", children: t.dataTableLoading }),
|
|
647
740
|
/* @__PURE__ */ jsxs(
|
package/dist/ui/date-picker.js
CHANGED
|
@@ -56,7 +56,7 @@ function boundsMatcher(min, max) {
|
|
|
56
56
|
if (max) out.push({ after: startOfDay(max) });
|
|
57
57
|
return out;
|
|
58
58
|
}
|
|
59
|
-
const triggerClass = "w-full justify-start gap-2 text-start font-normal data-empty:text-muted-foreground";
|
|
59
|
+
const triggerClass = "w-full justify-start gap-2 text-start font-(--ds-normal-weight) data-empty:text-muted-foreground";
|
|
60
60
|
function DatePicker({
|
|
61
61
|
value,
|
|
62
62
|
onChange,
|
package/dist/ui/dialog.js
CHANGED
|
@@ -61,7 +61,7 @@ function DialogContent({
|
|
|
61
61
|
Button,
|
|
62
62
|
{
|
|
63
63
|
variant: "ghost",
|
|
64
|
-
className: "absolute top-(--ds-overlay-close-inset)
|
|
64
|
+
className: "absolute top-(--ds-overlay-close-inset) end-(--ds-overlay-close-inset)",
|
|
65
65
|
size: "icon-sm"
|
|
66
66
|
}
|
|
67
67
|
),
|
package/dist/ui/drawer.js
CHANGED
|
@@ -115,13 +115,13 @@ function DrawerContent({
|
|
|
115
115
|
// Axis: x.
|
|
116
116
|
"data-[swipe-axis=x]:inset-y-0 data-[swipe-axis=x]:flex-row",
|
|
117
117
|
// Direction: down.
|
|
118
|
-
"data-[swipe-direction=down]:bottom-0 data-[swipe-direction=down]:origin-bottom data-[swipe-direction=down]:[--closed-transform:translate3d(0,calc(100%+var(--drawer-inset,0px)+
|
|
118
|
+
"data-[swipe-direction=down]:bottom-0 data-[swipe-direction=down]:origin-bottom data-[swipe-direction=down]:[--closed-transform:translate3d(0,calc(100%+var(--drawer-inset,0px)+var(--ds-drawer-closed-gap)),0)] data-[swipe-direction=down]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)-var(--stack-peek-offset)-(var(--stack-shrink)*var(--stack-height)))]",
|
|
119
119
|
// Direction: up.
|
|
120
|
-
"data-[swipe-direction=up]:top-0 data-[swipe-direction=up]:origin-top data-[swipe-direction=up]:[--closed-transform:translate3d(0,calc(-100%-var(--drawer-inset,0px)-
|
|
120
|
+
"data-[swipe-direction=up]:top-0 data-[swipe-direction=up]:origin-top data-[swipe-direction=up]:[--closed-transform:translate3d(0,calc(-100%-var(--drawer-inset,0px)-var(--ds-drawer-closed-gap)),0)] data-[swipe-direction=up]:[--translate-y:calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y)+var(--stack-peek-offset)+(var(--stack-shrink)*var(--stack-height)))]",
|
|
121
121
|
// Direction: left.
|
|
122
|
-
"data-[swipe-direction=left]:left-0 data-[swipe-direction=left]:origin-left data-[swipe-direction=left]:[--closed-transform:translate3d(calc(-100%-var(--drawer-inset,0px)-
|
|
122
|
+
"data-[swipe-direction=left]:left-0 data-[swipe-direction=left]:origin-left data-[swipe-direction=left]:[--closed-transform:translate3d(calc(-100%-var(--drawer-inset,0px)-var(--ds-drawer-closed-gap)),0,0)] data-[swipe-direction=left]:[--translate-x:calc(var(--drawer-swipe-movement-x)+var(--stack-peek-offset)+(var(--stack-shrink)*100%))]",
|
|
123
123
|
// Direction: right.
|
|
124
|
-
"data-[swipe-direction=right]:right-0 data-[swipe-direction=right]:origin-right data-[swipe-direction=right]:[--closed-transform:translate3d(calc(100%+var(--drawer-inset,0px)+
|
|
124
|
+
"data-[swipe-direction=right]:right-0 data-[swipe-direction=right]:origin-right data-[swipe-direction=right]:[--closed-transform:translate3d(calc(100%+var(--drawer-inset,0px)+var(--ds-drawer-closed-gap)),0,0)] data-[swipe-direction=right]:[--translate-x:calc(var(--drawer-swipe-movement-x)-var(--stack-peek-offset)-(var(--stack-shrink)*100%))]",
|
|
125
125
|
className
|
|
126
126
|
),
|
|
127
127
|
...props,
|
|
@@ -150,7 +150,7 @@ function DrawerHeader({ className, ...props }) {
|
|
|
150
150
|
{
|
|
151
151
|
"data-slot": "drawer-header",
|
|
152
152
|
className: cn(
|
|
153
|
-
"flex shrink-0 flex-col gap-0.5 p-(--ds-overlay-p) pb-0 group-data-[swipe-axis=y]/drawer-popup:text-center md:gap-1.5 md:text-
|
|
153
|
+
"flex shrink-0 flex-col gap-0.5 p-(--ds-overlay-p) pb-0 group-data-[swipe-axis=y]/drawer-popup:text-center md:gap-1.5 md:text-start",
|
|
154
154
|
className
|
|
155
155
|
),
|
|
156
156
|
...props
|
package/dist/ui/dropdown-menu.js
CHANGED
|
@@ -66,7 +66,7 @@ function DropdownMenuItem({
|
|
|
66
66
|
"data-inset": inset,
|
|
67
67
|
"data-variant": variant,
|
|
68
68
|
className: cn(
|
|
69
|
-
"group/dropdown-menu-item relative flex cursor-default items-center gap-2.5 rounded-item px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-inset:
|
|
69
|
+
"group/dropdown-menu-item relative flex cursor-default items-center gap-2.5 rounded-item px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-inset:ps-9.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:data-highlighted:bg-destructive/10 data-[variant=destructive]:data-highlighted:text-destructive dark:data-[variant=destructive]:data-highlighted:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-(--ds-disabled-opacity) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
70
70
|
className
|
|
71
71
|
),
|
|
72
72
|
...props
|
|
@@ -86,7 +86,7 @@ function DropdownMenuCheckboxItem({
|
|
|
86
86
|
"data-slot": "dropdown-menu-checkbox-item",
|
|
87
87
|
"data-inset": inset,
|
|
88
88
|
className: cn(
|
|
89
|
-
"relative flex cursor-default items-center gap-2.5 rounded-item py-(--ds-menu-item-py)
|
|
89
|
+
"relative flex cursor-default items-center gap-2.5 rounded-item py-(--ds-menu-item-py) pe-8 ps-(--ds-menu-item-px) text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-highlighted:**:text-accent-foreground data-inset:ps-9.5 data-disabled:pointer-events-none data-disabled:opacity-(--ds-disabled-opacity) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
90
90
|
className
|
|
91
91
|
),
|
|
92
92
|
checked,
|
|
@@ -95,7 +95,7 @@ function DropdownMenuCheckboxItem({
|
|
|
95
95
|
/* @__PURE__ */ jsx(
|
|
96
96
|
"span",
|
|
97
97
|
{
|
|
98
|
-
className: "pointer-events-none absolute
|
|
98
|
+
className: "pointer-events-none absolute end-2 flex items-center justify-center",
|
|
99
99
|
"data-slot": "dropdown-menu-checkbox-item-indicator",
|
|
100
100
|
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.CheckboxItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
101
101
|
}
|
|
@@ -128,7 +128,7 @@ function DropdownMenuRadioItem({
|
|
|
128
128
|
"data-slot": "dropdown-menu-radio-item",
|
|
129
129
|
"data-inset": inset,
|
|
130
130
|
className: cn(
|
|
131
|
-
"relative flex cursor-default items-center gap-2.5 rounded-item py-(--ds-menu-item-py)
|
|
131
|
+
"relative flex cursor-default items-center gap-2.5 rounded-item py-(--ds-menu-item-py) pe-8 ps-(--ds-menu-item-px) text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-highlighted:**:text-accent-foreground data-inset:ps-9.5 data-disabled:pointer-events-none data-disabled:opacity-(--ds-disabled-opacity) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
132
132
|
className
|
|
133
133
|
),
|
|
134
134
|
...props,
|
|
@@ -136,7 +136,7 @@ function DropdownMenuRadioItem({
|
|
|
136
136
|
/* @__PURE__ */ jsx(
|
|
137
137
|
"span",
|
|
138
138
|
{
|
|
139
|
-
className: "pointer-events-none absolute
|
|
139
|
+
className: "pointer-events-none absolute end-2 flex items-center justify-center",
|
|
140
140
|
"data-slot": "dropdown-menu-radio-item-indicator",
|
|
141
141
|
children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.RadioItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
142
142
|
}
|
|
@@ -157,7 +157,7 @@ function DropdownMenuLabel({
|
|
|
157
157
|
"data-slot": "dropdown-menu-label",
|
|
158
158
|
"data-inset": inset,
|
|
159
159
|
className: cn(
|
|
160
|
-
"px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-xs text-muted-foreground data-inset:
|
|
160
|
+
"px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-xs text-muted-foreground data-inset:ps-9.5",
|
|
161
161
|
className
|
|
162
162
|
),
|
|
163
163
|
...props
|
|
@@ -186,7 +186,7 @@ function DropdownMenuShortcut({
|
|
|
186
186
|
{
|
|
187
187
|
"data-slot": "dropdown-menu-shortcut",
|
|
188
188
|
className: cn(
|
|
189
|
-
"
|
|
189
|
+
"ms-auto text-xs tracking-(--ds-widest-tracking) text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
|
|
190
190
|
className
|
|
191
191
|
),
|
|
192
192
|
...props
|
|
@@ -216,13 +216,13 @@ function DropdownMenuSubTrigger({
|
|
|
216
216
|
"data-slot": "dropdown-menu-sub-trigger",
|
|
217
217
|
"data-inset": inset,
|
|
218
218
|
className: cn(
|
|
219
|
-
"flex cursor-default items-center gap-2 rounded-item px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-inset:
|
|
219
|
+
"flex cursor-default items-center gap-2 rounded-item px-(--ds-menu-item-px) py-(--ds-menu-item-py) text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-inset:ps-9.5 data-popup-open:bg-accent data-popup-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
220
220
|
className
|
|
221
221
|
),
|
|
222
222
|
...props,
|
|
223
223
|
children: [
|
|
224
224
|
children,
|
|
225
|
-
/* @__PURE__ */ jsx(ChevronRightIcon, { className: "
|
|
225
|
+
/* @__PURE__ */ jsx(ChevronRightIcon, { className: "ms-auto" })
|
|
226
226
|
]
|
|
227
227
|
}
|
|
228
228
|
);
|
package/dist/ui/field.js
CHANGED
|
@@ -128,7 +128,7 @@ function FieldDescription({ className, ...props }) {
|
|
|
128
128
|
{
|
|
129
129
|
"data-slot": "field-description",
|
|
130
130
|
className: cn(
|
|
131
|
-
"text-
|
|
131
|
+
"text-start text-sm leading-normal font-(--ds-normal-weight) text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5",
|
|
132
132
|
"last:mt-0 nth-last-2:-mt-1",
|
|
133
133
|
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
|
|
134
134
|
className
|
|
@@ -185,7 +185,7 @@ function FieldError({
|
|
|
185
185
|
if (uniqueErrors?.length == 1) {
|
|
186
186
|
return uniqueErrors[0]?.message;
|
|
187
187
|
}
|
|
188
|
-
return /* @__PURE__ */ jsx("ul", { className: "
|
|
188
|
+
return /* @__PURE__ */ jsx("ul", { className: "ms-4 flex list-disc flex-col gap-1", children: uniqueErrors.map(
|
|
189
189
|
(error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index)
|
|
190
190
|
) });
|
|
191
191
|
}, [children, errors]);
|
|
@@ -197,7 +197,7 @@ function FieldError({
|
|
|
197
197
|
{
|
|
198
198
|
role: "alert",
|
|
199
199
|
"data-slot": "field-error",
|
|
200
|
-
className: cn("text-sm font-normal text-destructive", className),
|
|
200
|
+
className: cn("text-sm font-(--ds-normal-weight) text-destructive", className),
|
|
201
201
|
...props,
|
|
202
202
|
children: content
|
|
203
203
|
}
|
package/dist/ui/heatmap-grid.js
CHANGED
|
@@ -139,14 +139,14 @@ function HeatmapGrid({
|
|
|
139
139
|
scope: "col",
|
|
140
140
|
"data-slot": "heatmap-grid-column-header",
|
|
141
141
|
"aria-label": col,
|
|
142
|
-
className: "pb-1 text-center font-normal text-muted-foreground tabular-nums",
|
|
142
|
+
className: "pb-1 text-center font-(--ds-normal-weight) text-muted-foreground tabular-nums",
|
|
143
143
|
children: renderColumnHeader ? renderColumnHeader(col, c) : col
|
|
144
144
|
},
|
|
145
145
|
c
|
|
146
146
|
))
|
|
147
147
|
] }) }),
|
|
148
148
|
/* @__PURE__ */ jsx("tbody", { children: rows.map((row, r) => /* @__PURE__ */ jsxs("tr", { "data-slot": "heatmap-grid-row", children: [
|
|
149
|
-
/* @__PURE__ */ jsx("th", { scope: "row", "data-slot": "heatmap-grid-row-header", className: "pe-2 text-start font-normal whitespace-nowrap text-muted-foreground", children: row }),
|
|
149
|
+
/* @__PURE__ */ jsx("th", { scope: "row", "data-slot": "heatmap-grid-row-header", className: "pe-2 text-start font-(--ds-normal-weight) whitespace-nowrap text-muted-foreground", children: row }),
|
|
150
150
|
columns.map((_, c) => renderCell(r, c))
|
|
151
151
|
] }, r)) })
|
|
152
152
|
] });
|
package/dist/ui/input-group.js
CHANGED
|
@@ -12,7 +12,7 @@ function InputGroup({ className, ...props }) {
|
|
|
12
12
|
"data-slot": "input-group",
|
|
13
13
|
role: "group",
|
|
14
14
|
className: cn(
|
|
15
|
-
"group/input-group relative flex h-(--ds-control-h-md) w-full min-w-0 items-center rounded-control shadow-control border border-input bg-(--ds-field-bg) transition-colors duration-(--ds-motion-snap) outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-field-multiline has-data-[align=block-start]:rounded-field-multiline has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-(length:--ds-ring-width) has-[[data-slot=input-group-control]:focus-visible]:ring-(--ds-ring-color) has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-(length:--ds-ring-width) has-[[data-slot][aria-invalid=true]]:ring-(--ds-invalid-ring) has-[textarea]:rounded-field-multiline has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:
|
|
15
|
+
"group/input-group relative flex h-(--ds-control-h-md) w-full min-w-0 items-center rounded-control shadow-control border border-input bg-(--ds-field-bg) transition-colors duration-(--ds-motion-snap) outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-field-multiline has-data-[align=block-start]:rounded-field-multiline has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-(length:--ds-ring-width) has-[[data-slot=input-group-control]:focus-visible]:ring-(--ds-ring-color) has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-(length:--ds-ring-width) has-[[data-slot][aria-invalid=true]]:ring-(--ds-invalid-ring) has-[textarea]:rounded-field-multiline has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pe-1.5 has-[>[data-align=inline-start]]:[&>input]:ps-1.5",
|
|
16
16
|
className
|
|
17
17
|
),
|
|
18
18
|
...props
|
|
@@ -24,8 +24,8 @@ const inputGroupAddonVariants = cva(
|
|
|
24
24
|
{
|
|
25
25
|
variants: {
|
|
26
26
|
align: {
|
|
27
|
-
"inline-start": "order-first
|
|
28
|
-
"inline-end": "order-last
|
|
27
|
+
"inline-start": "order-first ps-(--ds-field-px) has-[>button]:-ms-1 has-[>kbd]:ms-[-0.15rem]",
|
|
28
|
+
"inline-end": "order-last pe-(--ds-field-px) has-[>button]:-me-1 has-[>kbd]:me-[-0.15rem]",
|
|
29
29
|
"block-start": "order-first w-full justify-start px-(--ds-field-px) pt-3 group-has-[>input]/input-group:pt-3 [.border-b]:pb-3",
|
|
30
30
|
"block-end": "order-last w-full justify-start px-(--ds-field-px) pb-3 group-has-[>input]/input-group:pb-3 [.border-t]:pt-3"
|
|
31
31
|
}
|
package/dist/ui/input-otp.js
CHANGED
|
@@ -49,7 +49,7 @@ function InputOTPSlot({
|
|
|
49
49
|
"data-active": isActive,
|
|
50
50
|
"data-filled": char ? true : void 0,
|
|
51
51
|
className: cn(
|
|
52
|
-
"relative flex size-(--ds-control-h-md) items-center justify-center border-y border-
|
|
52
|
+
"relative flex size-(--ds-control-h-md) items-center justify-center border-y border-e border-input bg-(--ds-field-bg) text-sm transition-all duration-(--ds-motion-snap) outline-none first:rounded-s-control first:border-s last:rounded-e-control aria-invalid:border-(--ds-invalid-border) data-[active=true]:z-(--ds-z-raised) data-[active=true]:border-ring data-[active=true]:ring-(length:--ds-ring-width) data-[active=true]:ring-(--ds-ring-color) data-[active=true]:aria-invalid:border-(--ds-invalid-border) data-[active=true]:aria-invalid:ring-(--ds-invalid-ring)",
|
|
53
53
|
className
|
|
54
54
|
),
|
|
55
55
|
...props,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type InstructionEditorPreset = "prompt" | "document" | "compact";
|
|
4
|
+
/** Lo que devuelve `renderPreview`: el texto final y, si la app los calcula, datos de tamaño (p. ej. tokens TOON frente a JSON). */
|
|
5
|
+
interface InstructionPreview {
|
|
6
|
+
text: string;
|
|
7
|
+
stats?: {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string | number;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
type InstructionEditorMode = "visual" | "markdown" | "html" | "preview";
|
|
13
|
+
type Tool = "history" | "heading" | "marks" | "lists" | "blocks";
|
|
14
|
+
interface InstructionEditorProps extends Omit<React.ComponentProps<"div">, "onChange" | "defaultValue"> {
|
|
15
|
+
/** Intención: `prompt`, `document` o `compact`. Solo fija valores por defecto. */
|
|
16
|
+
preset?: InstructionEditorPreset;
|
|
17
|
+
/** Markdown (controlado). */
|
|
18
|
+
value?: string;
|
|
19
|
+
/** Markdown inicial (no controlado). */
|
|
20
|
+
defaultValue?: string;
|
|
21
|
+
/** Recibe el documento como Markdown en cada cambio. */
|
|
22
|
+
onChange?: (markdown: string) => void;
|
|
23
|
+
/** Vistas disponibles, en orden. */
|
|
24
|
+
modes?: InstructionEditorMode[];
|
|
25
|
+
mode?: InstructionEditorMode;
|
|
26
|
+
defaultMode?: InstructionEditorMode;
|
|
27
|
+
onModeChange?: (mode: InstructionEditorMode) => void;
|
|
28
|
+
/** Variables que se insertan como {{nombre}} desde la barra. */
|
|
29
|
+
variables?: readonly string[];
|
|
30
|
+
/**
|
|
31
|
+
* Sintaxis de plantilla: `template` activa los fragmentos de lógica (`[[IF]]`, valor por defecto…)
|
|
32
|
+
* y los avisos de condiciones mal escritas. Por defecto, `plain` (solo `{{variable}}`).
|
|
33
|
+
*/
|
|
34
|
+
syntax?: "plain" | "template";
|
|
35
|
+
/**
|
|
36
|
+
* La app renderiza la plantilla con su motor (y variables de ejemplo) para la vista previa.
|
|
37
|
+
* Devuelve el texto que verá el modelo, o `{ text, stats }` con datos de tamaño.
|
|
38
|
+
*/
|
|
39
|
+
renderPreview?: (markdown: string) => string | InstructionPreview;
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
readOnly?: boolean;
|
|
42
|
+
/** Herramientas de la barra (por defecto, las del preset). */
|
|
43
|
+
tools?: Tool[];
|
|
44
|
+
/** Muestra el contador de caracteres (por defecto, el del preset). */
|
|
45
|
+
showCount?: boolean;
|
|
46
|
+
/** Nombre accesible del editor. */
|
|
47
|
+
"aria-label"?: string;
|
|
48
|
+
}
|
|
49
|
+
declare function InstructionEditor({ preset, value, defaultValue, onChange, modes, mode: modeProp, defaultMode, onModeChange, variables, syntax, renderPreview, placeholder, readOnly, tools, showCount, className, "aria-label": ariaLabel, ...props }: InstructionEditorProps): React.JSX.Element;
|
|
50
|
+
|
|
51
|
+
export { InstructionEditor, type InstructionEditorMode, type InstructionEditorPreset, type InstructionEditorProps, type InstructionPreview };
|