@alexgorbatchev/shadcn 0.0.30 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +26 -22
  2. package/THIRD_PARTY_NOTICES.md +10 -0
  3. package/dist/{chunk-0ewzb2ax.js → chunk-0kyfh857.js} +1 -1
  4. package/dist/chunk-1xncv9gb.js +19 -0
  5. package/dist/chunk-2dxa9enk.js +98 -0
  6. package/dist/{chunk-8wfy03bp.js → chunk-6kwf9644.js} +1 -1
  7. package/dist/{chunk-82e7fbmq.js → chunk-9vyg3854.js} +2 -1
  8. package/dist/chunk-c6g2rbhv.js +3940 -0
  9. package/dist/chunk-dzvsjw59.js +200 -0
  10. package/dist/{chunk-g238nezp.js → chunk-pg9rhbgm.js} +4 -2
  11. package/dist/{chunk-5da3rzn5.js → chunk-s0typ7hv.js} +1 -1
  12. package/dist/chunk-tch86q2w.js +6050 -0
  13. package/dist/{chunk-eehfrrdz.js → chunk-tnnf8ydf.js} +1 -15
  14. package/dist/chunk-yfr9syen.js +363 -0
  15. package/dist/{chunk-53q730zs.js → chunk-zdt8xxzy.js} +3 -0
  16. package/dist/components/Alert.d.ts +1 -1
  17. package/dist/components/Table.d.ts +1 -0
  18. package/dist/components/assistant-ui/elements/Chart.js +2 -2
  19. package/dist/components/assistant-ui/elements/GuardrailNotice.js +2 -2
  20. package/dist/components/assistant-ui/elements/OptionList.js +3 -2
  21. package/dist/components/assistant-ui/elements/QuestionFlow.js +4 -3
  22. package/dist/components/assistant-ui/index.js +8 -7
  23. package/dist/components/assistant-ui/native/Sources.d.ts +1 -1
  24. package/dist/components/carousel/index.js +15 -204
  25. package/dist/components/chart/AnalyticsChart.d.ts +3 -2
  26. package/dist/components/chart/Chart.d.ts +1 -1
  27. package/dist/components/chart/index.js +24 -10
  28. package/dist/components/chart/types.d.ts +1 -0
  29. package/dist/components/data-grid/DataGrid.d.ts +48 -9
  30. package/dist/components/data-grid/DataGridColumnOptions.d.ts +14 -0
  31. package/dist/components/data-grid/DataGridColumnResizer.d.ts +13 -0
  32. package/dist/components/data-grid/getDataGridColumnSizeVariables.d.ts +6 -0
  33. package/dist/components/data-grid/hooks/useDataGridColumnSizes.d.ts +8 -0
  34. package/dist/components/data-grid/index.d.ts +3 -2
  35. package/dist/components/data-grid/index.js +124 -199
  36. package/dist/components/data-grid/moveDataGridColumn.d.ts +5 -0
  37. package/dist/components/event-calendar/index.js +4 -2
  38. package/dist/components/json-render/JsonAccordion.d.ts +3 -0
  39. package/dist/components/json-render/JsonAlert.d.ts +3 -0
  40. package/dist/components/json-render/JsonAvatar.d.ts +3 -0
  41. package/dist/components/json-render/JsonBadge.d.ts +3 -0
  42. package/dist/components/json-render/JsonButton.d.ts +3 -0
  43. package/dist/components/json-render/JsonButtonGroup.d.ts +3 -0
  44. package/dist/components/json-render/JsonCard.d.ts +3 -0
  45. package/dist/components/json-render/JsonCarousel.d.ts +3 -0
  46. package/dist/components/json-render/JsonCheckbox.d.ts +3 -0
  47. package/dist/components/json-render/JsonCollapsible.d.ts +3 -0
  48. package/dist/components/json-render/JsonDialog.d.ts +3 -0
  49. package/dist/components/json-render/JsonDrawer.d.ts +3 -0
  50. package/dist/components/json-render/JsonDropdownMenu.d.ts +3 -0
  51. package/dist/components/json-render/JsonGrid.d.ts +3 -0
  52. package/dist/components/json-render/JsonHeading.d.ts +3 -0
  53. package/dist/components/json-render/JsonImage.d.ts +3 -0
  54. package/dist/components/json-render/JsonInput.d.ts +3 -0
  55. package/dist/components/json-render/JsonLink.d.ts +3 -0
  56. package/dist/components/json-render/JsonPagination.d.ts +3 -0
  57. package/dist/components/json-render/JsonPopover.d.ts +3 -0
  58. package/dist/components/json-render/JsonProgress.d.ts +3 -0
  59. package/dist/components/json-render/JsonRadio.d.ts +3 -0
  60. package/dist/components/json-render/JsonSelect.d.ts +3 -0
  61. package/dist/components/json-render/JsonSeparator.d.ts +3 -0
  62. package/dist/components/json-render/JsonSkeleton.d.ts +3 -0
  63. package/dist/components/json-render/JsonSlider.d.ts +3 -0
  64. package/dist/components/json-render/JsonSpinner.d.ts +3 -0
  65. package/dist/components/json-render/JsonStack.d.ts +3 -0
  66. package/dist/components/json-render/JsonSwitch.d.ts +3 -0
  67. package/dist/components/json-render/JsonTable.d.ts +3 -0
  68. package/dist/components/json-render/JsonTabs.d.ts +3 -0
  69. package/dist/components/json-render/JsonText.d.ts +3 -0
  70. package/dist/components/json-render/JsonTextarea.d.ts +3 -0
  71. package/dist/components/json-render/JsonToggle.d.ts +3 -0
  72. package/dist/components/json-render/JsonToggleGroup.d.ts +3 -0
  73. package/dist/components/json-render/JsonTooltip.d.ts +3 -0
  74. package/dist/components/json-render/catalog.d.ts +548 -0
  75. package/dist/components/json-render/catalog.js +6 -0
  76. package/dist/components/json-render/getPaginationRange.d.ts +1 -0
  77. package/dist/components/json-render/index.d.ts +39 -0
  78. package/dist/components/json-render/index.js +1254 -0
  79. package/dist/components/virtual-data-grid/VirtualDataGrid.d.ts +26 -0
  80. package/dist/components/virtual-data-grid/index.d.ts +2 -0
  81. package/dist/components/virtual-data-grid/index.js +88 -0
  82. package/dist/components/virtual-table/index.js +4 -96
  83. package/dist/index.d.ts +1 -0
  84. package/dist/index.js +569 -4189
  85. package/licenses/json-render-APACHE-2.0.txt +201 -0
  86. package/llms/components/data-display/AnalyticsChart.md +34 -0
  87. package/llms/components/data-display/DataGridColumnOptions.md +22 -0
  88. package/llms/components/data-display/JsonRender.md +476 -0
  89. package/llms/components/data-display/VirtualDataGrid.md +71 -0
  90. package/llms/components/feedback/Alert.md +20 -4
  91. package/llms/setup.md +26 -22
  92. package/llms.txt +3 -0
  93. package/package.json +24 -2
@@ -0,0 +1,26 @@
1
+ import type { RowData } from "@tanstack/react-table";
2
+ import { type ReactElement, type ReactNode } from "react";
3
+ import { type DataGridRow, type DataGridTable } from "../data-grid/DataGrid.js";
4
+ import { type IVirtualTableRowProps } from "../virtual-table/VirtualTable.js";
5
+ interface IVirtualDataGridProps<T extends RowData, TSelected> {
6
+ table: DataGridTable<T, TSelected>;
7
+ label: string;
8
+ maxHeight?: number | string;
9
+ estimateRowHeight?: number;
10
+ overscan?: number;
11
+ /** Row IDs that stay rendered while scrolled out of view, such as rows with an open editor. */
12
+ retainedRowIds?: readonly string[];
13
+ /**
14
+ * Renders one row. Spread `props` onto the row element and render `DataGridCells` inside it; the default renders a
15
+ * plain `TableRow` marked selected while the row is selected.
16
+ */
17
+ renderRow?: (row: DataGridRow<T>, props: IVirtualTableRowProps) => ReactNode;
18
+ }
19
+ /**
20
+ * A virtualized, fixed-layout data grid over every filtered and sorted row, without pagination. Columns marked
21
+ * `fill` take the remaining width; the others keep their sizes and can be resized by dragging or from the keyboard.
22
+ * Column widths change through CSS variables, so a `useTable` selector can leave out sizing state and resizing never
23
+ * renders rows again.
24
+ */
25
+ export declare function VirtualDataGrid<T extends RowData, TSelected>({ table, label, maxHeight, estimateRowHeight, overscan, retainedRowIds, renderRow, }: IVirtualDataGridProps<T, TSelected>): ReactElement;
26
+ export {};
@@ -0,0 +1,2 @@
1
+ export { VirtualDataGrid } from "./VirtualDataGrid.js";
2
+ export type { IVirtualTableRowProps } from "../virtual-table/VirtualTable.js";
@@ -0,0 +1,88 @@
1
+ import"../../chunk-cp2m7y7v.js";
2
+ import {
3
+ TableRow2
4
+ } from "../../chunk-zte6pw69.js";
5
+ import"../../chunk-q7p28b89.js";
6
+ import"../../chunk-r9qrb6b6.js";
7
+ import"../../chunk-59p19t57.js";
8
+ import {
9
+ getDataGridColumnSizeVariables,
10
+ DataGridHeaderRows,
11
+ DataGridCells2,
12
+ DataGridColumns
13
+ } from "../../chunk-yfr9syen.js";
14
+ import {
15
+ VirtualTable2
16
+ } from "../../chunk-2dxa9enk.js";
17
+
18
+ // src/components/virtual-data-grid/VirtualDataGrid.tsx
19
+ import { useRef } from "react";
20
+
21
+ // src/components/data-grid/hooks/useDataGridColumnSizes.ts
22
+ import { useLayoutEffect } from "react";
23
+ function useDataGridColumnSizes(table, scope) {
24
+ useLayoutEffect(() => {
25
+ const write = () => {
26
+ const element = scope.current;
27
+ if (!element)
28
+ return;
29
+ for (const [id, variable] of getDataGridColumnSizeVariables(table)) {
30
+ const column = table.getColumn(id);
31
+ if (column)
32
+ element.style.setProperty(variable, `${column.getSize()}px`);
33
+ }
34
+ };
35
+ write();
36
+ const subscription = table.atoms.columnSizing.subscribe(write);
37
+ return () => subscription.unsubscribe();
38
+ });
39
+ }
40
+
41
+ // src/components/virtual-data-grid/VirtualDataGrid.tsx
42
+ import { jsx } from "react/jsx-runtime";
43
+ function renderDefaultRow(row, props) {
44
+ return /* @__PURE__ */ jsx(TableRow2, {
45
+ ...props,
46
+ "data-state": row.getIsSelected() ? "selected" : undefined,
47
+ children: /* @__PURE__ */ jsx(DataGridCells2, {
48
+ row
49
+ })
50
+ }, row.id);
51
+ }
52
+ function VirtualDataGrid({
53
+ table,
54
+ label,
55
+ maxHeight,
56
+ estimateRowHeight,
57
+ overscan,
58
+ retainedRowIds,
59
+ renderRow = renderDefaultRow
60
+ }) {
61
+ const scope = useRef(null);
62
+ useDataGridColumnSizes(table, scope);
63
+ return /* @__PURE__ */ jsx("div", {
64
+ ref: scope,
65
+ "data-testid": "VirtualDataGrid",
66
+ className: "min-w-0",
67
+ children: /* @__PURE__ */ jsx(VirtualTable2, {
68
+ items: table.getPrePaginatedRowModel().rows,
69
+ getItemKey: (row) => row.id,
70
+ label,
71
+ maxHeight,
72
+ estimateRowHeight,
73
+ overscan,
74
+ retainedKeys: retainedRowIds,
75
+ columns: /* @__PURE__ */ jsx(DataGridColumns, {
76
+ table
77
+ }),
78
+ header: /* @__PURE__ */ jsx(DataGridHeaderRows, {
79
+ table,
80
+ isResizable: true
81
+ }),
82
+ renderRow
83
+ })
84
+ });
85
+ }
86
+ export {
87
+ VirtualDataGrid
88
+ };
@@ -1,100 +1,8 @@
1
1
  import"../../chunk-cp2m7y7v.js";
2
+ import"../../chunk-zte6pw69.js";
2
3
  import {
3
- Table2,
4
- TableHeader2,
5
- TableBody2
6
- } from "../../chunk-zte6pw69.js";
7
-
8
- // src/components/virtual-table/VirtualTable.tsx
9
- import {
10
- Fragment,
11
- useCallback,
12
- useMemo,
13
- useRef,
14
- useState
15
- } from "react";
16
- import { defaultRangeExtractor, useVirtualizer } from "@tanstack/react-virtual";
17
- import { jsx, jsxs } from "react/jsx-runtime";
18
- function VirtualTable({
19
- items,
20
- getItemKey,
21
- renderRow,
22
- header,
23
- columns,
24
- label,
25
- maxHeight = "65vh",
26
- estimateRowHeight = 80,
27
- overscan = 5,
28
- retainedKeys,
29
- layout = "fixed"
30
- }) {
31
- const viewport = useRef(null);
32
- const [focusedKey, setFocusedKey] = useState();
33
- const retained = useMemo(() => items.flatMap((item, index) => retainedKeys?.includes(getItemKey(item)) || getItemKey(item) === focusedKey ? [index] : []), [items, retainedKeys, getItemKey, focusedKey]);
34
- const rangeExtractor = useCallback((range) => [...new Set([...defaultRangeExtractor(range), ...retained])].sort((a, b) => a - b), [retained]);
35
- const itemKey = useCallback((index) => getItemKey(items[index]), [items, getItemKey]);
36
- const virtualizer = useVirtualizer({
37
- count: items.length,
38
- getScrollElement: () => viewport.current,
39
- getItemKey: itemKey,
40
- estimateSize: () => estimateRowHeight,
41
- overscan,
42
- rangeExtractor
43
- });
44
- const rows = virtualizer.getVirtualItems();
45
- const last = rows.at(-1);
46
- return /* @__PURE__ */ jsx("div", {
47
- ref: viewport,
48
- "data-testid": "VirtualTable",
49
- role: "region",
50
- "aria-label": label,
51
- tabIndex: 0,
52
- className: "min-w-0 overflow-auto overscroll-contain",
53
- style: { maxHeight },
54
- onFocusCapture: (event) => {
55
- const row = event.target.closest("tr[data-index]");
56
- const item = items[Number(row?.dataset.index)];
57
- if (row && item)
58
- setFocusedKey(getItemKey(item));
59
- },
60
- children: /* @__PURE__ */ jsxs(Table2, {
61
- layout,
62
- "aria-label": label,
63
- "aria-rowcount": items.length + 1,
64
- children: [
65
- columns,
66
- /* @__PURE__ */ jsx(TableHeader2, {
67
- children: header
68
- }),
69
- /* @__PURE__ */ jsxs(TableBody2, {
70
- children: [
71
- rows.map((row, index) => /* @__PURE__ */ jsxs(Fragment, {
72
- children: [
73
- row.start > (rows[index - 1]?.end ?? 0) && /* @__PURE__ */ jsx("tr", {
74
- "aria-hidden": "true",
75
- children: /* @__PURE__ */ jsx("td", {
76
- style: { height: row.start - (rows[index - 1]?.end ?? 0), padding: 0, border: 0 }
77
- })
78
- }),
79
- renderRow(items[row.index], {
80
- ref: virtualizer.measureElement,
81
- "data-index": row.index,
82
- "aria-rowindex": row.index + 2
83
- })
84
- ]
85
- }, row.key)),
86
- last && virtualizer.getTotalSize() > last.end && /* @__PURE__ */ jsx("tr", {
87
- "aria-hidden": "true",
88
- children: /* @__PURE__ */ jsx("td", {
89
- style: { height: virtualizer.getTotalSize() - last.end, padding: 0, border: 0 }
90
- })
91
- })
92
- ]
93
- })
94
- ]
95
- })
96
- });
97
- }
4
+ VirtualTable2
5
+ } from "../../chunk-2dxa9enk.js";
98
6
  export {
99
- VirtualTable
7
+ VirtualTable2 as VirtualTable
100
8
  };
package/dist/index.d.ts CHANGED
@@ -60,6 +60,7 @@ export { Progress, ProgressTrack, ProgressIndicator, ProgressLabel, ProgressValu
60
60
  export { Collapsible, CollapsibleTrigger, CollapsibleContent } from "./components/Collapsible.js";
61
61
  export { Spinner } from "./components/Spinner.js";
62
62
  export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, TableColumnGroup, TableColumn, } from "./components/Table.js";
63
+ export type { TableTextAlign, TableVisibility } from "./components/Table.js";
63
64
  export { NativeSelect, NativeSelectOptGroup, NativeSelectOption } from "./components/NativeSelect.js";
64
65
  export { Kbd, KbdGroup } from "./components/Kbd.js";
65
66
  export { Item, ItemMedia, ItemContent, ItemActions, ItemGroup, ItemSeparator, ItemTitle, ItemDescription, ItemHeader, ItemFooter, } from "./components/Item.js";