@umami/react-zen 1.0.1 → 1.0.2

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/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import { Autocomplete as Autocomplete$1 } from '@base-ui/react/autocomplete';
3
3
  import * as lucide_react_star from 'lucide-react';
4
- import { XIcon, EyeOffIcon, EyeIcon, SearchIcon, CheckIcon, CopyIcon, MinusIcon, PlusIcon, ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon, CalendarIcon, Loader2Icon, ChevronUpIcon, MoreHorizontalIcon, PanelLeftIcon } from 'lucide-react';
5
- import * as React3 from 'react';
4
+ import { XIcon, EyeOffIcon, EyeIcon, SearchIcon, CheckIcon, CopyIcon, MinusIcon, PlusIcon, ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon, CalendarIcon, ChevronUpIcon, MoreHorizontalIcon, PanelLeftIcon } from 'lucide-react';
5
+ import * as React4 from 'react';
6
6
  import { forwardRef, useState, useRef, useCallback, useEffect, createContext, useId, isValidElement, cloneElement, useMemo, Fragment as Fragment$1, Children, createElement, useLayoutEffect, useContext } from 'react';
7
7
  import { cva } from 'class-variance-authority';
8
8
  import { cn } from 'cn';
@@ -17,12 +17,15 @@ import { useRender } from '@base-ui/react/use-render';
17
17
  export { useRender } from '@base-ui/react/use-render';
18
18
  import { CheckboxGroup as CheckboxGroup$1 } from '@base-ui/react/checkbox-group';
19
19
  import { AlertDialog as AlertDialog$1 } from '@base-ui/react/alert-dialog';
20
+ import { tableFeatures, sortFn_text, sortFn_datetime, sortFn_basic, sortFn_alphanumeric, filterFn_includesString, rowSortingFeature, rowSelectionFeature, rowPaginationFeature, globalFilteringFeature, columnFilteringFeature, createSortedRowModel, createPaginatedRowModel, createFilteredRowModel, useTable } from '@tanstack/react-table';
20
21
  import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
21
22
  import { getDefaultClassNames, DayPicker } from 'react-day-picker';
22
23
  import { Popover as Popover$1 } from '@base-ui/react/popover';
23
24
  import { useForm, FormProvider, Controller, useFormContext, useController, useFieldArray } from 'react-hook-form';
24
25
  import { Switch as Switch$1 } from '@base-ui/react/switch';
25
26
  import { Toggle as Toggle$1 } from '@base-ui/react/toggle';
27
+ import { createHighlighterCore } from 'shiki/core';
28
+ import { createJavaScriptRegexEngine } from 'shiki/engine/javascript';
26
29
  import { create } from 'zustand';
27
30
  import { useTransition, animated } from '@react-spring/web';
28
31
  import { Meter as Meter$1 } from '@base-ui/react/meter';
@@ -510,9 +513,6 @@ function debounce(func, delay) {
510
513
  }, delay);
511
514
  };
512
515
  }
513
- function mapIdProperty(data) {
514
- return data.length && data?.[0]?.id === void 0 ? data.map((row, id) => ({ ...row, id })) : data;
515
- }
516
516
  var Autocomplete = forwardRef(
517
517
  ({
518
518
  id,
@@ -1394,9 +1394,12 @@ var shadowMap = {
1394
1394
  true: "shadow-md"
1395
1395
  };
1396
1396
  var statusColorTokens = ["destructive", "success", "warning", "info"];
1397
+ var textColorAliases = {
1398
+ muted: "muted-foreground"
1399
+ };
1397
1400
  var textColorTokens = /* @__PURE__ */ new Set([
1398
1401
  "foreground",
1399
- "muted-foreground",
1402
+ "muted",
1400
1403
  "primary",
1401
1404
  "primary-foreground",
1402
1405
  "secondary-foreground",
@@ -1408,6 +1411,7 @@ var textColorTokens = /* @__PURE__ */ new Set([
1408
1411
  ]);
1409
1412
  var backgroundColorTokens = /* @__PURE__ */ new Set([
1410
1413
  "background",
1414
+ "page",
1411
1415
  "card",
1412
1416
  "popover",
1413
1417
  "primary",
@@ -1805,19 +1809,19 @@ function mapHeadingSize(value) {
1805
1809
  function mapFontWeight(value) {
1806
1810
  return mapResponsive(value, (v) => fontWeightMap[v]);
1807
1811
  }
1808
- function mapColor(value, prefix, tokens) {
1812
+ function mapColor(value, prefix, tokens, aliases2 = {}) {
1809
1813
  if (!value) return "";
1810
1814
  if (value === "true") return `${prefix}-${defaultColorToken[prefix]}`;
1811
1815
  if (value === "transparent") return `${prefix}-transparent`;
1812
- if (tokens.has(value)) return `${prefix}-${value}`;
1816
+ if (tokens.has(value)) return `${prefix}-${aliases2[value] ?? value}`;
1813
1817
  if (isTailwindColor(value)) return getTailwindColorClass(value, prefix);
1814
1818
  return "";
1815
1819
  }
1816
1820
  function mapTextColor(value) {
1817
- return mapColor(value, "text", textColorTokens);
1821
+ return mapColor(value, "text", textColorTokens, textColorAliases);
1818
1822
  }
1819
1823
  function mapDecorationColor(value) {
1820
- return mapColor(value, "decoration", textColorTokens);
1824
+ return mapColor(value, "decoration", textColorTokens, textColorAliases);
1821
1825
  }
1822
1826
  function mapBackgroundColor(value) {
1823
1827
  return mapColor(value, "bg", backgroundColorTokens);
@@ -2189,7 +2193,7 @@ function getCssColorValue(value) {
2189
2193
  if (!value) return void 0;
2190
2194
  if (value === "true") return `var(--${defaultColorToken.text})`;
2191
2195
  if (value === "transparent") return "transparent";
2192
- if (textColorTokens.has(value)) return `var(--${value})`;
2196
+ if (textColorTokens.has(value)) return `var(--${textColorAliases[value] ?? value})`;
2193
2197
  const parts = value.split("-");
2194
2198
  if (parts.length === 2 && tailwindColors.has(parts[0])) {
2195
2199
  return tailwindColorHex[parts[0]]?.[parts[1]];
@@ -2960,7 +2964,7 @@ function AlertDialogOverlay({
2960
2964
  {
2961
2965
  "data-slot": "alert-dialog-overlay",
2962
2966
  className: cn(
2963
- "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
2967
+ "fixed inset-0 isolate z-50 bg-black/50 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
2964
2968
  className
2965
2969
  ),
2966
2970
  ...props
@@ -3357,26 +3361,44 @@ function Grid({
3357
3361
  /* @__PURE__ */ jsx(Box, { ...props, className: classes, style: hasInlineStyles ? inlineStyles : void 0, children })
3358
3362
  ] });
3359
3363
  }
3360
- function Row({ reverse, children, ...props }) {
3361
- return /* @__PURE__ */ jsx(Flexbox, { ...props, direction: reverse ? "row-reverse" : "row", children });
3362
- }
3363
- function DataCard({ data = [], labelWidth = "auto", ...props }) {
3364
- const rows = mapIdProperty(data);
3364
+ function DataCard({ data = [], labelWidth = "auto", className, ...props }) {
3365
3365
  return /* @__PURE__ */ jsx(
3366
3366
  Grid,
3367
3367
  {
3368
+ "data-slot": "data-card",
3368
3369
  width: "100%",
3369
3370
  columns: `${labelWidth} 1fr`,
3370
3371
  border: true,
3371
3372
  borderRadius: "lg",
3372
- padding: "6",
3373
3373
  ...props,
3374
- children: rows.map((row, index) => {
3374
+ className: cn("overflow-hidden text-sm", className),
3375
+ children: data.map((row, index) => {
3376
+ const isLast = index === data.length - 1;
3375
3377
  return (
3376
3378
  // biome-ignore lint/suspicious/noArrayIndexKey: rows are static display data
3377
3379
  /* @__PURE__ */ jsxs(Fragment$1, { children: [
3378
- /* @__PURE__ */ jsx(Row, { paddingY: "3", border: "bottom", paddingRight: "6", children: /* @__PURE__ */ jsx(Text, { weight: "medium", children: row?.label }) }),
3379
- /* @__PURE__ */ jsx(Row, { paddingY: "3", border: "bottom", children: /* @__PURE__ */ jsx(Text, { children: row?.value }) })
3380
+ /* @__PURE__ */ jsx(
3381
+ "div",
3382
+ {
3383
+ "data-slot": "data-card-label",
3384
+ className: cn(
3385
+ "flex items-center border-r bg-muted/50 py-2 pr-6 pl-4 font-medium text-foreground",
3386
+ !isLast && "border-b"
3387
+ ),
3388
+ children: row?.label
3389
+ }
3390
+ ),
3391
+ /* @__PURE__ */ jsx(
3392
+ "div",
3393
+ {
3394
+ "data-slot": "data-card-value",
3395
+ className: cn(
3396
+ "flex min-w-0 items-center px-4 py-2 wrap-anywhere",
3397
+ !isLast && "border-b"
3398
+ ),
3399
+ children: row?.value
3400
+ }
3401
+ )
3380
3402
  ] }, index)
3381
3403
  );
3382
3404
  })
@@ -3509,139 +3531,334 @@ function TableCaption({
3509
3531
  }
3510
3532
  );
3511
3533
  }
3512
- var SELECTION_COLUMN_WIDTH = "2rem";
3534
+ var features = tableFeatures({
3535
+ columnFilteringFeature,
3536
+ // required by globalFilteringFeature
3537
+ globalFilteringFeature,
3538
+ rowPaginationFeature,
3539
+ rowSelectionFeature,
3540
+ rowSortingFeature,
3541
+ filteredRowModel: createFilteredRowModel(),
3542
+ paginatedRowModel: createPaginatedRowModel(),
3543
+ sortedRowModel: createSortedRowModel(),
3544
+ filterFns: { includesString: filterFn_includesString },
3545
+ sortFns: {
3546
+ alphanumeric: sortFn_alphanumeric,
3547
+ basic: sortFn_basic,
3548
+ datetime: sortFn_datetime,
3549
+ text: sortFn_text
3550
+ }
3551
+ });
3552
+ var SELECTION_COLUMN_WIDTH = "2.5rem";
3553
+ var ROW_CLASS = "grid [&>*:first-child]:pl-4";
3513
3554
  var alignClasses = {
3514
3555
  start: "justify-start text-left",
3515
3556
  center: "justify-center text-center",
3516
3557
  end: "justify-end text-right"
3517
3558
  };
3559
+ function DataColumn(_props) {
3560
+ return null;
3561
+ }
3562
+ function resolve(updater, old) {
3563
+ return typeof updater === "function" ? updater(old) : updater;
3564
+ }
3565
+ function useControllableState(value, defaultValue, onChange) {
3566
+ const [uncontrolled, setUncontrolled] = useState(defaultValue);
3567
+ const current = value === void 0 ? uncontrolled : value;
3568
+ const setValue = (next) => {
3569
+ if (value === void 0) {
3570
+ setUncontrolled(next);
3571
+ }
3572
+ onChange?.(next);
3573
+ };
3574
+ return [current, setValue];
3575
+ }
3576
+ function defaultGetRowId(row, index) {
3577
+ return row?.id !== void 0 && row?.id !== null ? String(row.id) : String(index);
3578
+ }
3579
+ function getColumnValue(column, row) {
3580
+ return column.value ? column.value(row) : row?.[column.id];
3581
+ }
3582
+ function renderCell(column, row, index) {
3583
+ const { children, as } = column;
3584
+ const content = typeof children === "function" ? children(row, index) : children !== void 0 && children !== null ? children : getColumnValue(column, row);
3585
+ return as ? createElement(as, {}, content) : content;
3586
+ }
3518
3587
  function DataTable({
3519
3588
  data = [],
3520
3589
  displayMode = "table",
3590
+ getRowId = defaultGetRowId,
3521
3591
  selectionMode = "none",
3522
3592
  selectedRows: selectedRowsProp,
3523
3593
  defaultSelectedRows = [],
3524
3594
  onSelectedRowsChange,
3595
+ sorting: sortingProp,
3596
+ defaultSorting = [],
3597
+ onSortingChange,
3598
+ filter = "",
3599
+ pageSize,
3600
+ pageIndex: pageIndexProp,
3601
+ defaultPageIndex = 0,
3602
+ onPageIndexChange,
3603
+ emptyState = "No results.",
3525
3604
  className,
3526
3605
  children,
3527
3606
  ...props
3528
3607
  }) {
3529
- const [uncontrolledSelectedRows, setUncontrolledSelectedRows] = useState(defaultSelectedRows);
3530
- const selectedRows = selectedRowsProp ?? uncontrolledSelectedRows;
3531
- const rows = mapIdProperty(data);
3532
- const rowIds = rows.map((row) => String(row.id));
3608
+ const [selectedRows, setSelectedRows] = useControllableState(
3609
+ selectedRowsProp,
3610
+ defaultSelectedRows,
3611
+ onSelectedRowsChange
3612
+ );
3613
+ const [sorting, setSorting] = useControllableState(sortingProp, defaultSorting, onSortingChange);
3614
+ const [pageIndex, setPageIndex] = useControllableState(
3615
+ pageIndexProp,
3616
+ defaultPageIndex,
3617
+ onPageIndexChange
3618
+ );
3533
3619
  const columns = Children.toArray(children).filter(isValidElement).map((child) => child.props);
3534
3620
  const visibleColumns = columns.filter(({ hidden }) => !hidden);
3621
+ const isSelectable = selectionMode !== "none";
3622
+ const isPaginated = pageSize !== void 0 && pageSize > 0;
3623
+ const rowSelection = Object.fromEntries(selectedRows.map((id) => [id, true]));
3624
+ const table = useTable({
3625
+ features,
3626
+ data,
3627
+ columns: visibleColumns.map((column) => ({
3628
+ id: column.id,
3629
+ accessorFn: (row) => getColumnValue(column, row),
3630
+ enableSorting: !!column.sortable,
3631
+ enableGlobalFilter: column.filterable !== false,
3632
+ sortUndefined: "last",
3633
+ // TanStack sorts numbers and dates descending first; always start ascending instead.
3634
+ sortDescFirst: false
3635
+ })),
3636
+ getRowId: (row, index) => getRowId(row, index),
3637
+ enableRowSelection: isSelectable,
3638
+ enableMultiRowSelection: selectionMode === "multiple",
3639
+ globalFilterFn: "includesString",
3640
+ state: {
3641
+ sorting,
3642
+ rowSelection,
3643
+ globalFilter: filter,
3644
+ pagination: { pageIndex, pageSize: pageSize ?? Math.max(data.length, 1) }
3645
+ },
3646
+ onSortingChange: (updater) => setSorting(resolve(updater, sorting)),
3647
+ onRowSelectionChange: (updater) => {
3648
+ const next = resolve(updater, rowSelection);
3649
+ setSelectedRows(Object.keys(next));
3650
+ },
3651
+ onPaginationChange: (updater) => {
3652
+ setPageIndex(resolve(updater, { pageIndex, pageSize: pageSize ?? 0 }).pageIndex);
3653
+ },
3654
+ onGlobalFilterChange: () => {
3655
+ }
3656
+ });
3657
+ const rows = (isPaginated ? table.getRowModel() : table.getPrePaginatedRowModel()).rows;
3658
+ const pageCount = isPaginated ? table.getPageCount() : 1;
3659
+ const pagination = isPaginated && pageCount > 1 && /* @__PURE__ */ jsxs(
3660
+ "div",
3661
+ {
3662
+ "data-slot": "data-table-pagination",
3663
+ className: "flex w-full items-center justify-between gap-4 py-3 text-sm text-muted-foreground",
3664
+ children: [
3665
+ /* @__PURE__ */ jsxs("span", { children: [
3666
+ "Page ",
3667
+ pageIndex + 1,
3668
+ " of ",
3669
+ pageCount
3670
+ ] }),
3671
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
3672
+ /* @__PURE__ */ jsx(
3673
+ Button,
3674
+ {
3675
+ variant: "outline",
3676
+ size: "sm",
3677
+ onClick: () => table.previousPage(),
3678
+ disabled: !table.getCanPreviousPage(),
3679
+ children: "Previous"
3680
+ }
3681
+ ),
3682
+ /* @__PURE__ */ jsx(
3683
+ Button,
3684
+ {
3685
+ variant: "outline",
3686
+ size: "sm",
3687
+ onClick: () => table.nextPage(),
3688
+ disabled: !table.getCanNextPage(),
3689
+ children: "Next"
3690
+ }
3691
+ )
3692
+ ] })
3693
+ ]
3694
+ }
3695
+ );
3696
+ const empty = /* @__PURE__ */ jsx("div", { "data-slot": "data-table-empty", className: "py-10 text-center text-sm text-muted-foreground", children: emptyState });
3535
3697
  if (displayMode === "cards") {
3536
- return /* @__PURE__ */ jsx(Grid, { width: "100%", gap: "6", children: rows.map((row, index) => {
3537
- const items = visibleColumns.map(({ id, label, children: children2 }) => {
3538
- const value = typeof children2 === "function" ? children2(row, index) : children2 ?? row[id];
3539
- return { id, label, value };
3540
- });
3541
- return /* @__PURE__ */ jsx(DataCard, { data: items }, `${row.id}-${index}`);
3542
- }) });
3698
+ return /* @__PURE__ */ jsxs(Grid, { width: "100%", gap: "6", "data-slot": "data-table", "data-display-mode": "cards", children: [
3699
+ rows.length === 0 ? empty : rows.map((row) => {
3700
+ const items = visibleColumns.map((column) => ({
3701
+ label: column.label,
3702
+ value: renderCell(column, row.original, row.index)
3703
+ }));
3704
+ if (isSelectable) {
3705
+ items.unshift({
3706
+ label: "",
3707
+ value: /* @__PURE__ */ jsx(
3708
+ Checkbox,
3709
+ {
3710
+ "aria-label": "Select row",
3711
+ checked: row.getIsSelected(),
3712
+ onCheckedChange: (checked) => row.toggleSelected(checked)
3713
+ }
3714
+ )
3715
+ });
3716
+ }
3717
+ return /* @__PURE__ */ jsx(
3718
+ DataCard,
3719
+ {
3720
+ "data-row-id": row.id,
3721
+ "data-state": row.getIsSelected() ? "selected" : void 0,
3722
+ data: items
3723
+ },
3724
+ row.id
3725
+ );
3726
+ }),
3727
+ pagination
3728
+ ] });
3543
3729
  }
3544
- const isSelectable = selectionMode !== "none";
3545
3730
  const gridTemplateColumns = [
3546
3731
  ...isSelectable ? [SELECTION_COLUMN_WIDTH] : [],
3547
3732
  ...visibleColumns.map(({ width }) => width || "1fr")
3548
3733
  ].join(" ");
3549
3734
  const rowStyle = { gridTemplateColumns };
3550
- const setSelectedRows = (next) => {
3551
- if (selectedRowsProp === void 0) {
3552
- setUncontrolledSelectedRows(next);
3553
- }
3554
- onSelectedRowsChange?.(next);
3555
- };
3556
- const setRowSelected = (rowId, checked) => {
3557
- if (selectionMode === "single") {
3558
- setSelectedRows(checked ? [rowId] : []);
3559
- return;
3560
- }
3561
- setSelectedRows(
3562
- checked ? [...selectedRows.filter((id) => id !== rowId), rowId] : selectedRows.filter((id) => id !== rowId)
3563
- );
3564
- };
3565
- const selectedCount = rowIds.filter((id) => selectedRows.includes(id)).length;
3566
- const allSelected = rowIds.length > 0 && selectedCount === rowIds.length;
3567
- return /* @__PURE__ */ jsxs(
3735
+ const allSelected = table.getIsAllRowsSelected();
3736
+ const someSelected = table.getIsSomeRowsSelected();
3737
+ const tableElement = /* @__PURE__ */ jsxs(
3568
3738
  Table,
3569
3739
  {
3570
3740
  ...props,
3741
+ role: "table",
3571
3742
  "data-slot": "data-table",
3572
3743
  "data-selection-mode": isSelectable ? selectionMode : void 0,
3573
- className: cn("grid", className),
3744
+ className: cn("grid overflow-hidden rounded-lg border border-border", className),
3574
3745
  children: [
3575
- /* @__PURE__ */ jsx(TableHeader, { className: "contents", children: /* @__PURE__ */ jsxs(TableRow, { className: "grid hover:bg-transparent", style: rowStyle, children: [
3576
- isSelectable && /* @__PURE__ */ jsx(TableHead, { className: "flex items-center", children: selectionMode === "multiple" && /* @__PURE__ */ jsx(
3577
- Checkbox,
3578
- {
3579
- "aria-label": "Select all rows",
3580
- checked: allSelected,
3581
- indeterminate: selectedCount > 0 && !allSelected,
3582
- onCheckedChange: (checked) => setSelectedRows(checked ? rowIds : [])
3583
- }
3584
- ) }),
3585
- visibleColumns.map(({ id, label, align }) => /* @__PURE__ */ jsx(TableHead, { className: cn("flex items-center", align && alignClasses[align]), children: label }, id))
3586
- ] }) }),
3587
- /* @__PURE__ */ jsx(TableBody, { className: "contents", children: rows.map((row, index) => {
3588
- const rowId = String(row.id);
3589
- const isSelected = isSelectable && selectedRows.includes(rowId);
3746
+ /* @__PURE__ */ jsx(TableHeader, { role: "rowgroup", className: "contents", children: /* @__PURE__ */ jsxs(
3747
+ TableRow,
3748
+ {
3749
+ role: "row",
3750
+ className: cn(ROW_CLASS, "bg-muted/50 hover:bg-muted/50"),
3751
+ style: rowStyle,
3752
+ children: [
3753
+ isSelectable && /* @__PURE__ */ jsx(TableHead, { role: "columnheader", className: "flex items-center", children: selectionMode === "multiple" && /* @__PURE__ */ jsx(
3754
+ Checkbox,
3755
+ {
3756
+ "aria-label": "Select all rows",
3757
+ checked: allSelected,
3758
+ indeterminate: someSelected && !allSelected,
3759
+ onCheckedChange: (checked) => table.toggleAllRowsSelected(checked)
3760
+ }
3761
+ ) }),
3762
+ visibleColumns.map((column) => {
3763
+ const tableColumn = table.getColumn(column.id);
3764
+ const sorted = column.sortable ? tableColumn?.getIsSorted() : false;
3765
+ const SortIcon = sorted === "asc" ? icons_exports.ArrowUp : sorted === "desc" ? icons_exports.ArrowDown : icons_exports.ChevronsUpDown;
3766
+ return /* @__PURE__ */ jsx(
3767
+ TableHead,
3768
+ {
3769
+ role: "columnheader",
3770
+ "aria-sort": column.sortable ? sorted === "asc" ? "ascending" : sorted === "desc" ? "descending" : "none" : void 0,
3771
+ className: cn("flex items-center", column.align && alignClasses[column.align]),
3772
+ children: column.sortable ? /* @__PURE__ */ jsxs(
3773
+ "button",
3774
+ {
3775
+ type: "button",
3776
+ "data-slot": "data-table-sort",
3777
+ onClick: tableColumn?.getToggleSortingHandler(),
3778
+ className: "-mx-2 inline-flex h-7 cursor-pointer items-center gap-1 rounded-md px-2 font-medium outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50",
3779
+ children: [
3780
+ column.label,
3781
+ /* @__PURE__ */ jsx(
3782
+ SortIcon,
3783
+ {
3784
+ "aria-hidden": "true",
3785
+ className: cn("size-3.5", !sorted && "text-muted-foreground")
3786
+ }
3787
+ )
3788
+ ]
3789
+ }
3790
+ ) : column.label
3791
+ },
3792
+ column.id
3793
+ );
3794
+ })
3795
+ ]
3796
+ }
3797
+ ) }),
3798
+ /* @__PURE__ */ jsx(TableBody, { role: "rowgroup", className: "contents", children: rows.length === 0 ? /* @__PURE__ */ jsx(TableRow, { role: "row", className: "grid hover:bg-transparent", style: rowStyle, children: /* @__PURE__ */ jsx(TableCell, { role: "cell", style: { gridColumn: "1 / -1" }, children: empty }) }) : rows.map((row) => {
3799
+ const isSelected = isSelectable && row.getIsSelected();
3590
3800
  return /* @__PURE__ */ jsxs(
3591
3801
  TableRow,
3592
3802
  {
3593
- "data-row-id": rowId,
3803
+ role: "row",
3804
+ "data-row-id": row.id,
3594
3805
  "data-state": isSelected ? "selected" : void 0,
3595
- className: "grid",
3806
+ className: ROW_CLASS,
3596
3807
  style: rowStyle,
3597
3808
  children: [
3598
- isSelectable && /* @__PURE__ */ jsx(TableCell, { className: "flex items-center", children: /* @__PURE__ */ jsx(
3809
+ isSelectable && /* @__PURE__ */ jsx(TableCell, { role: "cell", className: "flex items-center", children: /* @__PURE__ */ jsx(
3599
3810
  Checkbox,
3600
3811
  {
3601
3812
  "aria-label": "Select row",
3602
3813
  checked: isSelected,
3603
- onCheckedChange: (checked) => setRowSelected(rowId, checked)
3814
+ onCheckedChange: (checked) => row.toggleSelected(checked)
3604
3815
  }
3605
3816
  ) }),
3606
- visibleColumns.map(
3607
- ({
3817
+ visibleColumns.map((column) => {
3818
+ const {
3608
3819
  id,
3609
3820
  label: _label,
3610
3821
  width: _width,
3611
3822
  hidden: _hidden,
3612
- as,
3823
+ as: _as,
3824
+ value: _value,
3825
+ sortable: _sortable,
3826
+ filterable: _filterable,
3613
3827
  align,
3614
3828
  className: cellClassName,
3615
- children: children2,
3829
+ children: _children,
3616
3830
  ...cellProps
3617
- }) => {
3618
- const value = typeof children2 === "function" ? children2(row, index) : children2 || row[id];
3619
- return /* @__PURE__ */ createElement(
3620
- TableCell,
3621
- {
3622
- ...cellProps,
3623
- key: id,
3624
- className: cn(
3625
- "flex min-w-0 items-center whitespace-normal",
3626
- align && alignClasses[align],
3627
- cellClassName
3628
- )
3629
- },
3630
- as ? createElement(as, {}, value) : value
3631
- );
3632
- }
3633
- )
3831
+ } = column;
3832
+ return /* @__PURE__ */ createElement(
3833
+ TableCell,
3834
+ {
3835
+ ...cellProps,
3836
+ key: id,
3837
+ role: "cell",
3838
+ className: cn(
3839
+ "flex min-w-0 items-center whitespace-normal wrap-anywhere",
3840
+ align && alignClasses[align],
3841
+ cellClassName
3842
+ )
3843
+ },
3844
+ renderCell(column, row.original, row.index)
3845
+ );
3846
+ })
3634
3847
  ]
3635
3848
  },
3636
- rowId
3849
+ row.id
3637
3850
  );
3638
3851
  }) })
3639
3852
  ]
3640
3853
  }
3641
3854
  );
3642
- }
3643
- function DataColumn(_props) {
3644
- return null;
3855
+ if (!pagination) {
3856
+ return tableElement;
3857
+ }
3858
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "data-table-wrapper", className: "flex w-full flex-col", children: [
3859
+ tableElement,
3860
+ pagination
3861
+ ] });
3645
3862
  }
3646
3863
  function Calendar({
3647
3864
  className,
@@ -3796,8 +4013,8 @@ function CalendarDayButton({
3796
4013
  ...props
3797
4014
  }) {
3798
4015
  const defaultClassNames = getDefaultClassNames();
3799
- const ref = React3.useRef(null);
3800
- React3.useEffect(() => {
4016
+ const ref = React4.useRef(null);
4017
+ React4.useEffect(() => {
3801
4018
  if (modifiers.focused) ref.current?.focus();
3802
4019
  }, [modifiers.focused]);
3803
4020
  return /* @__PURE__ */ jsx(
@@ -3991,6 +4208,9 @@ function DatePicker({
3991
4208
  picker
3992
4209
  ] });
3993
4210
  }
4211
+ function Row({ reverse, children, ...props }) {
4212
+ return /* @__PURE__ */ jsx(Flexbox, { ...props, direction: reverse ? "row-reverse" : "row", children });
4213
+ }
3994
4214
  var sizeMap = {
3995
4215
  sm: "w-1.5 h-1.5",
3996
4216
  md: "w-2 h-2",
@@ -4743,8 +4963,22 @@ function FormResetButton({
4743
4963
  };
4744
4964
  return /* @__PURE__ */ jsx(Button, { ...props, type: "reset", variant, onClick: handleClick });
4745
4965
  }
4746
- function Spinner({ className, ...props }) {
4747
- return /* @__PURE__ */ jsx(Loader2Icon, { "data-slot": "spinner", role: "status", "aria-label": "Loading", className: cn("size-4 animate-spin", className), ...props });
4966
+ function Spinner({ quiet, className, ...props }) {
4967
+ return /* @__PURE__ */ jsxs(
4968
+ "svg",
4969
+ {
4970
+ viewBox: "25 25 50 50",
4971
+ "data-slot": "spinner",
4972
+ role: "status",
4973
+ "aria-label": "Loading",
4974
+ ...props,
4975
+ className: cn("zen-spinner size-4", className),
4976
+ children: [
4977
+ !quiet && /* @__PURE__ */ jsx("circle", { className: "zen-spinner-track", cx: "50", cy: "50", r: "20" }),
4978
+ /* @__PURE__ */ jsx("circle", { className: "zen-spinner-fill", cx: "50", cy: "50", r: "20" })
4979
+ ]
4980
+ }
4981
+ );
4748
4982
  }
4749
4983
  function FormSubmitButton({
4750
4984
  disabled,
@@ -4794,10 +5028,142 @@ function Heading({
4794
5028
  }
4795
5029
  );
4796
5030
  }
5031
+ var languages = {
5032
+ bash: () => import('shiki/langs/shellscript.mjs'),
5033
+ css: () => import('shiki/langs/css.mjs'),
5034
+ diff: () => import('shiki/langs/diff.mjs'),
5035
+ html: () => import('shiki/langs/html.mjs'),
5036
+ javascript: () => import('shiki/langs/javascript.mjs'),
5037
+ json: () => import('shiki/langs/json.mjs'),
5038
+ jsx: () => import('shiki/langs/jsx.mjs'),
5039
+ markdown: () => import('shiki/langs/markdown.mjs'),
5040
+ python: () => import('shiki/langs/python.mjs'),
5041
+ sql: () => import('shiki/langs/sql.mjs'),
5042
+ tsx: () => import('shiki/langs/tsx.mjs'),
5043
+ typescript: () => import('shiki/langs/typescript.mjs'),
5044
+ yaml: () => import('shiki/langs/yaml.mjs')
5045
+ };
5046
+ var aliases = {
5047
+ js: "javascript",
5048
+ md: "markdown",
5049
+ py: "python",
5050
+ sh: "bash",
5051
+ shell: "bash",
5052
+ shellscript: "bash",
5053
+ ts: "typescript",
5054
+ yml: "yaml",
5055
+ zsh: "bash"
5056
+ };
5057
+ var highlighter;
5058
+ function getHighlighter() {
5059
+ highlighter ??= createHighlighterCore({
5060
+ themes: [
5061
+ import('shiki/themes/github-light.mjs'),
5062
+ import('shiki/themes/github-dark.mjs')
5063
+ ],
5064
+ langs: [],
5065
+ engine: createJavaScriptRegexEngine({ forgiving: true })
5066
+ });
5067
+ return highlighter;
5068
+ }
5069
+ function getLanguage(language) {
5070
+ const name = language.toLowerCase();
5071
+ if (name === "ansi") {
5072
+ return name;
5073
+ }
5074
+ if (name in languages) {
5075
+ return name;
5076
+ }
5077
+ return aliases[name] ?? null;
5078
+ }
5079
+ async function loadHighlighter(language) {
5080
+ const lang = getLanguage(language);
5081
+ if (!lang) {
5082
+ return null;
5083
+ }
5084
+ const shiki = await getHighlighter();
5085
+ if (lang !== "ansi" && !shiki.getLoadedLanguages().includes(lang)) {
5086
+ await shiki.loadLanguage(languages[lang]);
5087
+ }
5088
+ return {
5089
+ // Returns one React node per line, and the grammar state after the last
5090
+ // line. Pass that state back to continue where the code left off.
5091
+ highlight(code, state) {
5092
+ const tokenize = (text) => shiki.codeToTokens(text, {
5093
+ lang,
5094
+ themes: { light: "github-light", dark: "github-dark" },
5095
+ defaultColor: false,
5096
+ grammarState: state
5097
+ }).tokens;
5098
+ const tokens = lang === "ansi" ? code.split("\n").flatMap((line) => tokenize(line)) : tokenize(code);
5099
+ return {
5100
+ lines: tokens.map(
5101
+ (line) => line.map((token, index) => /* @__PURE__ */ jsx(
5102
+ "span",
5103
+ {
5104
+ style: token.htmlStyle,
5105
+ className: "text-(--shiki-light) dark:text-(--shiki-dark)",
5106
+ children: token.content
5107
+ },
5108
+ index
5109
+ ))
5110
+ ),
5111
+ state: shiki.getLastGrammarState(tokens)
5112
+ };
5113
+ }
5114
+ };
5115
+ }
5116
+
5117
+ // src/components/hooks/use-highlighted-code.ts
5118
+ function useHighlightedCode(value, language) {
5119
+ const code = value.endsWith("\n") ? value.slice(0, -1) : value;
5120
+ const [loaded, setLoaded] = React4.useState(null);
5121
+ const highlighter2 = loaded?.language === language ? loaded.highlighter : null;
5122
+ React4.useEffect(() => {
5123
+ let cancelled = false;
5124
+ loadHighlighter(language).then((next2) => {
5125
+ if (!cancelled) {
5126
+ setLoaded({ language, highlighter: next2 });
5127
+ }
5128
+ }).catch(() => {
5129
+ });
5130
+ return () => {
5131
+ cancelled = true;
5132
+ };
5133
+ }, [language]);
5134
+ const [done, setDone] = React4.useState({ highlighter: null, text: "", lines: [] });
5135
+ let next = done;
5136
+ if (next.highlighter !== highlighter2 || !code.startsWith(next.text)) {
5137
+ next = { highlighter: highlighter2, text: "", lines: [] };
5138
+ }
5139
+ const end = code.lastIndexOf("\n") + 1;
5140
+ if (highlighter2 && end > next.text.length) {
5141
+ const result = highlighter2.highlight(
5142
+ code.slice(next.text.length, end - 1),
5143
+ next.state
5144
+ );
5145
+ next = {
5146
+ highlighter: highlighter2,
5147
+ text: code.slice(0, end),
5148
+ lines: [...next.lines, ...result.lines],
5149
+ state: result.state
5150
+ };
5151
+ }
5152
+ if (next !== done) {
5153
+ setDone(next);
5154
+ }
5155
+ const tail = code.slice(end);
5156
+ return React4.useMemo(() => {
5157
+ if (!highlighter2) {
5158
+ return code.split("\n");
5159
+ }
5160
+ return [...next.lines, highlighter2.highlight(tail, next.state).lines[0]];
5161
+ }, [code, highlighter2, next, tail]);
5162
+ }
4797
5163
  var MOBILE_BREAKPOINT = 768;
4798
5164
  function useIsMobile() {
4799
- const [isMobile, setIsMobile] = React3.useState(void 0);
4800
- React3.useEffect(() => {
5165
+ const [isMobile, setIsMobile] = React4.useState(void 0);
5166
+ React4.useEffect(() => {
4801
5167
  const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
4802
5168
  const onChange = () => {
4803
5169
  setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
@@ -5614,7 +5980,7 @@ var NumberField = forwardRef(function NumberField2({
5614
5980
  id: fieldId,
5615
5981
  "data-slot": "number-field",
5616
5982
  className: cn(
5617
- "group/field flex w-full flex-col gap-3 data-disabled:[&_[data-slot=field-label]]:opacity-50",
5983
+ "group/field flex w-full flex-col gap-2 data-disabled:[&_[data-slot=field-label]]:opacity-50",
5618
5984
  className
5619
5985
  ),
5620
5986
  children: [
@@ -5681,7 +6047,7 @@ function PageHeaderTitle({
5681
6047
  return /* @__PURE__ */ jsxs(Column, { gap: "1", ...props, children: [
5682
6048
  breadcrumb,
5683
6049
  /* @__PURE__ */ jsx(Text, { size: "xl", weight: "semibold", children: title }),
5684
- description && /* @__PURE__ */ jsx(Text, { color: "muted-foreground", children: description }),
6050
+ description && /* @__PURE__ */ jsx(Text, { color: "muted", children: description }),
5685
6051
  children
5686
6052
  ] });
5687
6053
  }
@@ -5848,7 +6214,7 @@ function TagGroup({ label, children, className, onRemove, ...props }) {
5848
6214
  removable: !!onRemove,
5849
6215
  remove: (value) => onRemove?.(value)
5850
6216
  },
5851
- children: /* @__PURE__ */ jsxs("div", { ...props, "data-slot": "tag-group", className: cn("flex flex-col gap-3", className), children: [
6217
+ children: /* @__PURE__ */ jsxs("div", { ...props, "data-slot": "tag-group", className: cn("flex flex-col gap-2", className), children: [
5852
6218
  label && /* @__PURE__ */ jsx(FieldTitle, { id: labelId, children: label }),
5853
6219
  /* @__PURE__ */ jsx(
5854
6220
  "ul",
@@ -6573,9 +6939,9 @@ function CardFooter({ className, ...props }) {
6573
6939
  }
6574
6940
  );
6575
6941
  }
6576
- var CarouselContext = React3.createContext(null);
6942
+ var CarouselContext = React4.createContext(null);
6577
6943
  function useCarousel() {
6578
- const context = React3.useContext(CarouselContext);
6944
+ const context = React4.useContext(CarouselContext);
6579
6945
  if (!context) {
6580
6946
  throw new Error("useCarousel must be used within a <Carousel />");
6581
6947
  }
@@ -6597,20 +6963,20 @@ function Carousel({
6597
6963
  },
6598
6964
  plugins
6599
6965
  );
6600
- const [canScrollPrev, setCanScrollPrev] = React3.useState(false);
6601
- const [canScrollNext, setCanScrollNext] = React3.useState(false);
6602
- const onSelect = React3.useCallback((api2) => {
6966
+ const [canScrollPrev, setCanScrollPrev] = React4.useState(false);
6967
+ const [canScrollNext, setCanScrollNext] = React4.useState(false);
6968
+ const onSelect = React4.useCallback((api2) => {
6603
6969
  if (!api2) return;
6604
6970
  setCanScrollPrev(api2.canScrollPrev());
6605
6971
  setCanScrollNext(api2.canScrollNext());
6606
6972
  }, []);
6607
- const scrollPrev = React3.useCallback(() => {
6973
+ const scrollPrev = React4.useCallback(() => {
6608
6974
  api?.scrollPrev();
6609
6975
  }, [api]);
6610
- const scrollNext = React3.useCallback(() => {
6976
+ const scrollNext = React4.useCallback(() => {
6611
6977
  api?.scrollNext();
6612
6978
  }, [api]);
6613
- const handleKeyDown = React3.useCallback(
6979
+ const handleKeyDown = React4.useCallback(
6614
6980
  (event) => {
6615
6981
  if (event.key === "ArrowLeft") {
6616
6982
  event.preventDefault();
@@ -6622,11 +6988,11 @@ function Carousel({
6622
6988
  },
6623
6989
  [scrollPrev, scrollNext]
6624
6990
  );
6625
- React3.useEffect(() => {
6991
+ React4.useEffect(() => {
6626
6992
  if (!api || !setApi) return;
6627
6993
  setApi(api);
6628
6994
  }, [api, setApi]);
6629
- React3.useEffect(() => {
6995
+ React4.useEffect(() => {
6630
6996
  if (!api) return;
6631
6997
  onSelect(api);
6632
6998
  api.on("reInit", onSelect);
@@ -6758,6 +7124,204 @@ function CarouselNext({
6758
7124
  }
6759
7125
  );
6760
7126
  }
7127
+ var codeBlockVariants = cva(
7128
+ "group/code-block relative flex w-full min-w-0 flex-col overflow-hidden rounded-lg text-sm has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/50 data-[size=sm]:text-xs",
7129
+ {
7130
+ variants: {
7131
+ variant: {
7132
+ default: "border border-input text-foreground has-[>[data-slot=code-block-content]:focus-visible]:border-ring dark:bg-input/30",
7133
+ destructive: "border border-destructive/30 text-destructive dark:border-destructive/40"
7134
+ }
7135
+ },
7136
+ defaultVariants: {
7137
+ variant: "default"
7138
+ }
7139
+ }
7140
+ );
7141
+ function CodeBlock({
7142
+ className,
7143
+ variant = "default",
7144
+ size = "default",
7145
+ ...props
7146
+ }) {
7147
+ return /* @__PURE__ */ jsx(
7148
+ "div",
7149
+ {
7150
+ "data-slot": "code-block",
7151
+ "data-variant": variant,
7152
+ "data-size": size,
7153
+ className: cn(codeBlockVariants({ variant }), className),
7154
+ ...props
7155
+ }
7156
+ );
7157
+ }
7158
+ function CodeBlockHeader({ className, ...props }) {
7159
+ return /* @__PURE__ */ jsx(
7160
+ "div",
7161
+ {
7162
+ "data-slot": "code-block-header",
7163
+ className: cn(
7164
+ "flex min-w-0 shrink-0 items-center gap-2 px-4 pt-4 text-muted-foreground group-data-[size=sm]/code-block:px-3 group-data-[size=sm]/code-block:pt-3 group-data-[variant=destructive]/code-block:text-destructive *:has-[>[data-slot=code-block-title]]:min-w-0",
7165
+ className
7166
+ ),
7167
+ ...props
7168
+ }
7169
+ );
7170
+ }
7171
+ function CodeBlockTitle({ className, ...props }) {
7172
+ return /* @__PURE__ */ jsx(
7173
+ "div",
7174
+ {
7175
+ "data-slot": "code-block-title",
7176
+ className: cn(
7177
+ "min-w-0 truncate font-sans text-sm font-medium text-foreground group-data-[size=sm]/code-block:text-xs group-data-[variant=destructive]/code-block:text-destructive [&_svg]:pointer-events-none [&_svg]:inline-block [&_svg]:align-middle [&_svg:not([class*='size-'])]:size-4 group-data-[size=sm]/code-block:[&_svg:not([class*='size-'])]:size-3.5 *:[svg]:me-1.5",
7178
+ className
7179
+ ),
7180
+ ...props
7181
+ }
7182
+ );
7183
+ }
7184
+ function CodeBlockActions({
7185
+ className,
7186
+ ...props
7187
+ }) {
7188
+ return /* @__PURE__ */ jsx(
7189
+ "div",
7190
+ {
7191
+ "data-slot": "code-block-actions",
7192
+ className: cn(
7193
+ "-my-1 ms-auto -me-1.5 flex shrink-0 items-center gap-1 [[data-slot=code-block]>&]:absolute [[data-slot=code-block]>&]:end-3 [[data-slot=code-block]>&]:top-3 [[data-slot=code-block]>&]:z-10 [[data-slot=code-block]>&]:m-0 [[data-slot=code-block]>&]:opacity-0 [[data-slot=code-block]>&]:transition-opacity [[data-slot=code-block]>&]:group-focus-within/code-block:opacity-100 [[data-slot=code-block]>&]:group-hover/code-block:opacity-100 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:end-2 group-data-[size=sm]/code-block:[[data-slot=code-block]>&]:top-2 [[data-slot=code-block]>&]:pointer-coarse:opacity-100 [[data-slot=code-block]>&]:*:[button]:bg-background [[data-slot=code-block]>&]:*:[button]:ring-1 [[data-slot=code-block]>&]:*:[button]:ring-foreground/10",
7194
+ className
7195
+ ),
7196
+ ...props
7197
+ }
7198
+ );
7199
+ }
7200
+ function CodeBlockCopyButton({
7201
+ value,
7202
+ variant = "ghost",
7203
+ size = "icon-xs",
7204
+ className,
7205
+ onClick,
7206
+ ...props
7207
+ }) {
7208
+ const [copied, setCopied] = React4.useState(false);
7209
+ React4.useEffect(() => {
7210
+ if (!copied) {
7211
+ return;
7212
+ }
7213
+ const timeout = setTimeout(() => setCopied(false), 2e3);
7214
+ return () => clearTimeout(timeout);
7215
+ }, [copied]);
7216
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
7217
+ /* @__PURE__ */ jsx(
7218
+ Button,
7219
+ {
7220
+ "data-slot": "code-block-copy-button",
7221
+ "data-copied": copied || void 0,
7222
+ variant,
7223
+ size,
7224
+ "aria-label": copied ? "Copied" : "Copy",
7225
+ className: cn(className),
7226
+ onClick: (event) => {
7227
+ onClick?.(event);
7228
+ navigator.clipboard.writeText(value).then(() => setCopied(true)).catch(() => {
7229
+ });
7230
+ },
7231
+ ...props,
7232
+ children: copied ? /* @__PURE__ */ jsx(
7233
+ CheckIcon,
7234
+ {}
7235
+ ) : /* @__PURE__ */ jsx(
7236
+ CopyIcon,
7237
+ {}
7238
+ )
7239
+ }
7240
+ ),
7241
+ /* @__PURE__ */ jsx("span", { "aria-live": "polite", className: "sr-only", children: copied ? "Copied" : "" })
7242
+ ] });
7243
+ }
7244
+ function CodeBlockContent({
7245
+ className,
7246
+ children,
7247
+ style,
7248
+ wrap = false,
7249
+ lineNumbers = false,
7250
+ startLine = 1,
7251
+ ...props
7252
+ }) {
7253
+ return /* @__PURE__ */ jsx(
7254
+ "pre",
7255
+ {
7256
+ "data-slot": "code-block-content",
7257
+ "data-wrap": wrap || void 0,
7258
+ "data-numbered": lineNumbers || void 0,
7259
+ dir: "ltr",
7260
+ tabIndex: 0,
7261
+ style: { counterReset: `line ${startLine - 1}`, ...style },
7262
+ className: cn(
7263
+ "min-h-0 min-w-0 scroll-fade-x scrollbar-thin overflow-auto px-4 py-4 text-start font-mono leading-relaxed outline-none group-has-data-[slot=code-block-footer]/code-block:pb-2 group-has-data-[slot=code-block-header]/code-block:pt-2 group-data-[size=sm]/code-block:px-3 group-data-[size=sm]/code-block:py-3 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 data-wrap:scroll-fade-y data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap",
7264
+ className
7265
+ ),
7266
+ ...props,
7267
+ children: /* @__PURE__ */ jsx(
7268
+ "code",
7269
+ {
7270
+ "data-slot": "code-block-code",
7271
+ className: "grid min-h-lh min-w-max content-start in-data-numbered:grid-cols-[auto_1fr] in-data-wrap:min-w-0",
7272
+ children: lineNumbers && typeof children === "string" ? children.replace(/\n$/, "").split("\n").map((line, index) => /* @__PURE__ */ jsx(CodeBlockLine, { children: line }, index)) : children
7273
+ }
7274
+ )
7275
+ }
7276
+ );
7277
+ }
7278
+ var codeBlockLineVariants = cva(
7279
+ "relative -mx-4 block min-h-lh px-4 group-data-[size=sm]/code-block:-mx-3 group-data-[size=sm]/code-block:px-3 before:min-w-6 before:text-end before:text-muted-foreground after:absolute after:start-1 after:top-0 after:text-muted-foreground after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:gap-x-3 in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']",
7280
+ {
7281
+ variants: {
7282
+ variant: {
7283
+ default: "",
7284
+ added: "bg-muted after:content-['+']",
7285
+ removed: "bg-destructive/10 after:text-destructive after:content-['\u2212']",
7286
+ highlighted: "bg-muted"
7287
+ }
7288
+ },
7289
+ defaultVariants: {
7290
+ variant: "default"
7291
+ }
7292
+ }
7293
+ );
7294
+ function CodeBlockLine({
7295
+ className,
7296
+ variant = "default",
7297
+ children,
7298
+ ...props
7299
+ }) {
7300
+ const empty = children === void 0 || children === null || children === "" || Array.isArray(children) && children.length === 0;
7301
+ return /* @__PURE__ */ jsx(
7302
+ "span",
7303
+ {
7304
+ "data-slot": "code-block-line",
7305
+ "data-variant": variant,
7306
+ className: cn(codeBlockLineVariants({ variant }), className),
7307
+ ...props,
7308
+ children: /* @__PURE__ */ jsx("span", { "data-slot": "code-block-line-content", className: "min-w-0", children: empty ? "\n" : children })
7309
+ }
7310
+ );
7311
+ }
7312
+ function CodeBlockFooter({ className, ...props }) {
7313
+ return /* @__PURE__ */ jsx(
7314
+ "div",
7315
+ {
7316
+ "data-slot": "code-block-footer",
7317
+ className: cn(
7318
+ "flex min-w-0 shrink-0 items-center gap-2 px-4 pb-4 text-muted-foreground group-data-[size=sm]/code-block:px-3 group-data-[size=sm]/code-block:pb-3",
7319
+ className
7320
+ ),
7321
+ ...props
7322
+ }
7323
+ );
7324
+ }
6761
7325
  function Collapsible({ ...props }) {
6762
7326
  return /* @__PURE__ */ jsx(Collapsible$1.Root, { "data-slot": "collapsible", ...props });
6763
7327
  }
@@ -7016,7 +7580,7 @@ function ComboboxChipsInput({
7016
7580
  );
7017
7581
  }
7018
7582
  function useComboboxAnchor() {
7019
- return React3.useRef(null);
7583
+ return React4.useRef(null);
7020
7584
  }
7021
7585
  function Dialog({ ...props }) {
7022
7586
  return /* @__PURE__ */ jsx(Dialog$1.Root, { "data-slot": "dialog", ...props });
@@ -7039,7 +7603,7 @@ function DialogOverlay({
7039
7603
  {
7040
7604
  "data-slot": "dialog-overlay",
7041
7605
  className: cn(
7042
- "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
7606
+ "fixed inset-0 isolate z-50 bg-black/50 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
7043
7607
  className
7044
7608
  ),
7045
7609
  ...props
@@ -7049,7 +7613,7 @@ function DialogOverlay({
7049
7613
  function DialogContent({
7050
7614
  className,
7051
7615
  children,
7052
- showCloseButton = true,
7616
+ showCloseButton = false,
7053
7617
  ...props
7054
7618
  }) {
7055
7619
  return /* @__PURE__ */ jsxs(DialogPortal, { children: [
@@ -7525,9 +8089,9 @@ function ContextMenuShortcut({
7525
8089
  }
7526
8090
  );
7527
8091
  }
7528
- var DrawerContext = React3.createContext(null);
8092
+ var DrawerContext = React4.createContext(null);
7529
8093
  function useDrawer() {
7530
- const context = React3.useContext(DrawerContext);
8094
+ const context = React4.useContext(DrawerContext);
7531
8095
  if (!context) {
7532
8096
  throw new Error("useDrawer must be used within a Drawer.");
7533
8097
  }
@@ -7541,7 +8105,7 @@ function Drawer({
7541
8105
  ...props
7542
8106
  }) {
7543
8107
  const hasSnapPoints = snapPoints != null && snapPoints.length > 0;
7544
- const contextValue = React3.useMemo(
8108
+ const contextValue = React4.useMemo(
7545
8109
  () => ({ hasSnapPoints, modal, showSwipeHandle, swipeDirection }),
7546
8110
  [hasSnapPoints, modal, showSwipeHandle, swipeDirection]
7547
8111
  );
@@ -8106,7 +8670,7 @@ function InputOTPSlot({
8106
8670
  className,
8107
8671
  ...props
8108
8672
  }) {
8109
- const inputOTPContext = React3.useContext(OTPInputContext);
8673
+ const inputOTPContext = React4.useContext(OTPInputContext);
8110
8674
  const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
8111
8675
  return /* @__PURE__ */ jsxs(
8112
8676
  "div",
@@ -9053,9 +9617,9 @@ var SIDEBAR_WIDTH = "16rem";
9053
9617
  var SIDEBAR_WIDTH_MOBILE = "18rem";
9054
9618
  var SIDEBAR_WIDTH_ICON = "3rem";
9055
9619
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
9056
- var SidebarContext = React3.createContext(null);
9620
+ var SidebarContext = React4.createContext(null);
9057
9621
  function useSidebar() {
9058
- const context = React3.useContext(SidebarContext);
9622
+ const context = React4.useContext(SidebarContext);
9059
9623
  if (!context) {
9060
9624
  throw new Error("useSidebar must be used within a SidebarProvider.");
9061
9625
  }
@@ -9071,10 +9635,10 @@ function SidebarProvider({
9071
9635
  ...props
9072
9636
  }) {
9073
9637
  const isMobile = useIsMobile();
9074
- const [openMobile, setOpenMobile] = React3.useState(false);
9075
- const [_open, _setOpen] = React3.useState(defaultOpen);
9638
+ const [openMobile, setOpenMobile] = React4.useState(false);
9639
+ const [_open, _setOpen] = React4.useState(defaultOpen);
9076
9640
  const open = openProp ?? _open;
9077
- const setOpen = React3.useCallback(
9641
+ const setOpen = React4.useCallback(
9078
9642
  (value) => {
9079
9643
  const openState = typeof value === "function" ? value(open) : value;
9080
9644
  if (setOpenProp) {
@@ -9086,10 +9650,10 @@ function SidebarProvider({
9086
9650
  },
9087
9651
  [setOpenProp, open]
9088
9652
  );
9089
- const toggleSidebar = React3.useCallback(() => {
9653
+ const toggleSidebar = React4.useCallback(() => {
9090
9654
  return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
9091
9655
  }, [isMobile, setOpen, setOpenMobile]);
9092
- React3.useEffect(() => {
9656
+ React4.useEffect(() => {
9093
9657
  const handleKeyDown = (event) => {
9094
9658
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
9095
9659
  event.preventDefault();
@@ -9100,7 +9664,7 @@ function SidebarProvider({
9100
9664
  return () => window.removeEventListener("keydown", handleKeyDown);
9101
9665
  }, [toggleSidebar]);
9102
9666
  const state = open ? "expanded" : "collapsed";
9103
- const contextValue = React3.useMemo(
9667
+ const contextValue = React4.useMemo(
9104
9668
  () => ({
9105
9669
  state,
9106
9670
  open,
@@ -9560,7 +10124,7 @@ function SidebarMenuSkeleton({
9560
10124
  showIcon = false,
9561
10125
  ...props
9562
10126
  }) {
9563
- const [width] = React3.useState(() => {
10127
+ const [width] = React4.useState(() => {
9564
10128
  return `${Math.floor(Math.random() * 40) + 50}%`;
9565
10129
  });
9566
10130
  return /* @__PURE__ */ jsxs(
@@ -9767,7 +10331,7 @@ function TabsContent({ className, ...props }) {
9767
10331
  }
9768
10332
  );
9769
10333
  }
9770
- var ToggleGroupContext = React3.createContext({
10334
+ var ToggleGroupContext = React4.createContext({
9771
10335
  size: "default",
9772
10336
  variant: "default",
9773
10337
  spacing: 2,
@@ -9813,7 +10377,7 @@ function ToggleGroupItem({
9813
10377
  size = "default",
9814
10378
  ...props
9815
10379
  }) {
9816
- const context = React3.useContext(ToggleGroupContext);
10380
+ const context = React4.useContext(ToggleGroupContext);
9817
10381
  return /* @__PURE__ */ jsx(
9818
10382
  Toggle$1,
9819
10383
  {
@@ -9849,6 +10413,6 @@ function ZenProvider({
9849
10413
  return /* @__PURE__ */ jsx(TooltipProvider, { ...tooltip, children: /* @__PURE__ */ jsx(ToastProvider, { ...defaultToastConfig, ...toast, children }) });
9850
10414
  }
9851
10415
 
9852
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Autocomplete, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Blockquote, Box, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, CheckboxGroup, Code, Collapsible, CollapsibleContent, CollapsibleTrigger, Column, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmationDialog, Container, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, DataCard, DataColumn, DataTable, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dots, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerSwipeHandle, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Flexbox, FloatingTooltip, Form, FormButtons, FormController, FormField, FormFieldArray, FormResetButton, FormSubmitButton, Grid, Heading, HoverCard, HoverCardContent, HoverCardTrigger, Icon, Image, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Kbd, KbdGroup, Label, List, ListItem, ListSection, ListSeparator, Loading, LoadingButton, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Meter, Navbar, NavbarItem, NavbarLink, NumberField, PALETTES, PageHeader, PageHeaderActions, PageHeaderTitle, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordField, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressCircle, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, Row, ScrollArea, ScrollBar, SearchField, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, StatusLight, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TagGroup, Text, TextField, Textarea, ThemeButton, ThemeSwitcher, Toast, ToastContext, ToastProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Toolbar, ToolbarButton, ToolbarGroup, ToolbarLink, ToolbarSeparator, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, ZenProvider, badgeVariants, buttonGroupVariants, buttonVariants, getCssColorValue, isHeightPreset, isMaxHeightPreset, isMaxWidthPreset, isMinHeightPreset, isMinWidthPreset, isWidthPreset, mapAlignContent, mapAlignItems, mapAlignSelf, mapBackgroundColor, mapBorder, mapBorderColor, mapBorderRadius, mapBorderWidth, mapCursor, mapDecorationColor, mapDisplay, mapFlexDirection, mapFlexWrap, mapFontSize, mapFontWeight, mapGap, mapGridAutoFlow, mapGridColumns, mapGridRows, mapHeadingSize, mapHeight, mapJustifyContent, mapJustifyItems, mapLetterSpacing, mapLineHeight, mapMargin, mapMaxHeight, mapMaxWidth, mapMinHeight, mapMinWidth, mapOpacity, mapOverflow, mapPadding, mapPointerEvents, mapPosition, mapShadow, mapSpace, mapStateStyles, mapTextAlign, mapTextColor, mapTextDecorationStyle, mapTextIndent, mapTextTransform, mapTextWrap, mapVerticalAlign, mapWhitespace, mapWidth, mapWordBreak, removeToast, resolveRender, tabsListVariants, toggleVariants, useBreakpoint, useCarousel, useComboboxAnchor, useDebounce, useInitTheme, useIsMobile, useSidebar, useTheme, useToast };
10416
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Autocomplete, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Blockquote, Box, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, CheckboxGroup, Code, CodeBlock, CodeBlockActions, CodeBlockContent, CodeBlockCopyButton, CodeBlockFooter, CodeBlockHeader, CodeBlockLine, CodeBlockTitle, Collapsible, CollapsibleContent, CollapsibleTrigger, Column, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmationDialog, Container, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, DataCard, DataColumn, DataTable, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dots, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerSwipeHandle, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Flexbox, FloatingTooltip, Form, FormButtons, FormController, FormField, FormFieldArray, FormResetButton, FormSubmitButton, Grid, Heading, HoverCard, HoverCardContent, HoverCardTrigger, Icon, Image, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Kbd, KbdGroup, Label, List, ListItem, ListSection, ListSeparator, Loading, LoadingButton, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Meter, Navbar, NavbarItem, NavbarLink, NumberField, PALETTES, PageHeader, PageHeaderActions, PageHeaderTitle, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordField, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressCircle, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, Row, ScrollArea, ScrollBar, SearchField, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, StatusLight, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TagGroup, Text, TextField, Textarea, ThemeButton, ThemeSwitcher, Toast, ToastContext, ToastProvider, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Toolbar, ToolbarButton, ToolbarGroup, ToolbarLink, ToolbarSeparator, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, ZenProvider, badgeVariants, buttonGroupVariants, buttonVariants, getCssColorValue, isHeightPreset, isMaxHeightPreset, isMaxWidthPreset, isMinHeightPreset, isMinWidthPreset, isWidthPreset, mapAlignContent, mapAlignItems, mapAlignSelf, mapBackgroundColor, mapBorder, mapBorderColor, mapBorderRadius, mapBorderWidth, mapCursor, mapDecorationColor, mapDisplay, mapFlexDirection, mapFlexWrap, mapFontSize, mapFontWeight, mapGap, mapGridAutoFlow, mapGridColumns, mapGridRows, mapHeadingSize, mapHeight, mapJustifyContent, mapJustifyItems, mapLetterSpacing, mapLineHeight, mapMargin, mapMaxHeight, mapMaxWidth, mapMinHeight, mapMinWidth, mapOpacity, mapOverflow, mapPadding, mapPointerEvents, mapPosition, mapShadow, mapSpace, mapStateStyles, mapTextAlign, mapTextColor, mapTextDecorationStyle, mapTextIndent, mapTextTransform, mapTextWrap, mapVerticalAlign, mapWhitespace, mapWidth, mapWordBreak, removeToast, resolveRender, tabsListVariants, toggleVariants, useBreakpoint, useCarousel, useComboboxAnchor, useDebounce, useHighlightedCode, useInitTheme, useIsMobile, useSidebar, useTheme, useToast };
9853
10417
  //# sourceMappingURL=index.mjs.map
9854
10418
  //# sourceMappingURL=index.mjs.map