@nocoo/basalt 2.2.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/ai/COMPATIBILITY.md +11 -1
- package/ai/DESIGN.md +398 -0
- package/ai/INTEGRATION.md +255 -129
- package/ai/RECIPES.md +51 -26
- package/ai/USAGE.md +4 -4
- package/ai/registry.json +3018 -271
- package/dist/charts/config.d.ts +11 -11
- package/dist/charts/config.js +4 -4
- package/dist/charts/config.js.map +1 -1
- package/dist/charts/date-navigation.js +10 -10
- package/dist/charts/date-navigation.js.map +1 -1
- package/dist/charts/donut.js +1 -1
- package/dist/charts/donut.js.map +1 -1
- package/dist/charts/frame.d.ts +1 -1
- package/dist/charts/frame.js +4 -4
- package/dist/charts/frame.js.map +1 -1
- package/dist/charts/gauge.js +5 -5
- package/dist/charts/gauge.js.map +1 -1
- package/dist/charts/heatmap-calendar.js +11 -11
- package/dist/charts/heatmap-calendar.js.map +1 -1
- package/dist/charts/heatmap-matrix.js +8 -8
- package/dist/charts/heatmap-matrix.js.map +1 -1
- package/dist/charts/item-list.js +1 -1
- package/dist/charts/item-list.js.map +1 -1
- package/dist/charts/legend.js +19 -19
- package/dist/charts/legend.js.map +1 -1
- package/dist/charts/palette.js +2 -2
- package/dist/charts/palette.js.map +1 -1
- package/dist/charts/slot-bar.js +2 -2
- package/dist/charts/slot-bar.js.map +1 -1
- package/dist/charts/sparkline.js +38 -23
- package/dist/charts/sparkline.js.map +1 -1
- package/dist/charts/stat-card.d.ts +2 -2
- package/dist/charts/stat-card.js +61 -58
- package/dist/charts/stat-card.js.map +1 -1
- package/dist/charts/timeline.js +18 -9
- package/dist/charts/timeline.js.map +1 -1
- package/dist/charts/tooltip.js +16 -16
- package/dist/charts/tooltip.js.map +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.js +4 -4
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/app-header.js +8 -8
- package/dist/components/app-header.js.map +1 -1
- package/dist/components/app-shell.js +1 -1
- package/dist/components/app-shell.js.map +1 -1
- package/dist/components/approval-card.d.ts +13 -0
- package/dist/components/approval-card.js +161 -0
- package/dist/components/approval-card.js.map +1 -0
- package/dist/components/avatar.d.ts +12 -0
- package/dist/components/avatar.js +39 -18
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.js +8 -8
- package/dist/components/badge.js.map +1 -1
- package/dist/components/banner.d.ts +2 -2
- package/dist/components/banner.js +9 -8
- package/dist/components/banner.js.map +1 -1
- package/dist/components/basalt-mark.js +1 -1
- package/dist/components/basalt-mark.js.map +1 -1
- package/dist/components/battery-meter.js +5 -5
- package/dist/components/battery-meter.js.map +1 -1
- package/dist/components/breadcrumbs.js +6 -6
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/button.js +10 -10
- package/dist/components/button.js.map +1 -1
- package/dist/components/chat-bubble.js +4 -3
- package/dist/components/chat-bubble.js.map +1 -1
- package/dist/components/chat-composer.d.ts +21 -3
- package/dist/components/chat-composer.js +126 -60
- package/dist/components/chat-composer.js.map +1 -1
- package/dist/components/chat-header.js +6 -6
- package/dist/components/chat-header.js.map +1 -1
- package/dist/components/chat-inbox.js +34 -30
- package/dist/components/chat-inbox.js.map +1 -1
- package/dist/components/chat-markdown.d.ts +8 -0
- package/dist/components/chat-markdown.js +122 -0
- package/dist/components/chat-markdown.js.map +1 -0
- package/dist/components/chat-message.d.ts +26 -0
- package/dist/components/chat-message.js +145 -0
- package/dist/components/chat-message.js.map +1 -0
- package/dist/components/checkbox.js +11 -11
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/clipboard-text.js +3 -3
- package/dist/components/clipboard-text.js.map +1 -1
- package/dist/components/code.d.ts +22 -20
- package/dist/components/code.js +94 -32
- package/dist/components/code.js.map +1 -1
- package/dist/components/collapsible.js +8 -4
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/command-palette.js +73 -47
- package/dist/components/command-palette.js.map +1 -1
- package/dist/components/context-cards.d.ts +15 -0
- package/dist/components/context-cards.js +148 -0
- package/dist/components/context-cards.js.map +1 -0
- package/dist/components/context-menu.d.ts +1 -1
- package/dist/components/context-menu.js +18 -14
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/data-table.d.ts +14 -2
- package/dist/components/data-table.js +185 -135
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.js +13 -13
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/delete-resource.js +1 -1
- package/dist/components/delete-resource.js.map +1 -1
- package/dist/components/description-list.js +3 -3
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog.d.ts +2 -2
- package/dist/components/dialog.js +8 -8
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/diff-table.d.ts +15 -0
- package/dist/components/diff-table.js +151 -0
- package/dist/components/diff-table.js.map +1 -0
- package/dist/components/dock.js +2 -2
- package/dist/components/dock.js.map +1 -1
- package/dist/components/dropdown-menu.js +23 -18
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/editable-nav-item.js +63 -58
- package/dist/components/editable-nav-item.js.map +1 -1
- package/dist/components/empty.js +6 -6
- package/dist/components/empty.js.map +1 -1
- package/dist/components/fab.js +1 -1
- package/dist/components/fab.js.map +1 -1
- package/dist/components/field.js +3 -3
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-dropzone.js +7 -7
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/filter-bar.js +6 -6
- package/dist/components/filter-bar.js.map +1 -1
- package/dist/components/flow.js +4 -3
- package/dist/components/flow.js.map +1 -1
- package/dist/components/grid.d.ts +3 -1
- package/dist/components/grid.js +15 -8
- package/dist/components/grid.js.map +1 -1
- package/dist/components/hover-card.js +1 -1
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/icon-picker.d.ts +8 -2
- package/dist/components/icon-picker.js +75 -47
- package/dist/components/icon-picker.js.map +1 -1
- package/dist/components/inline-editable.js +6 -6
- package/dist/components/inline-editable.js.map +1 -1
- package/dist/components/input-area.js +3 -3
- package/dist/components/input-area.js.map +1 -1
- package/dist/components/input-group.js +5 -5
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input.js +4 -4
- package/dist/components/input.js.map +1 -1
- package/dist/components/label.js +3 -3
- package/dist/components/label.js.map +1 -1
- package/dist/components/layer-card.d.ts +9 -4
- package/dist/components/layer-card.js +72 -67
- package/dist/components/layer-card.js.map +1 -1
- package/dist/components/loader.d.ts +16 -10
- package/dist/components/loader.js +46 -53
- package/dist/components/loader.js.map +1 -1
- package/dist/components/loading-screen.js +3 -3
- package/dist/components/loading-screen.js.map +1 -1
- package/dist/components/menu-bar.js +32 -27
- package/dist/components/menu-bar.js.map +1 -1
- package/dist/components/meter.d.ts +5 -5
- package/dist/components/meter.js +25 -12
- package/dist/components/meter.js.map +1 -1
- package/dist/components/multi-select.js +66 -62
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu.js +22 -8
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/overlay.js +2 -2
- package/dist/components/overlay.js.map +1 -1
- package/dist/components/page-header.d.ts +3 -1
- package/dist/components/page-header.js +12 -12
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/pagination.js +3 -3
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.js +18 -23
- package/dist/components/popover.js.map +1 -1
- package/dist/components/prompt-bar.d.ts +16 -0
- package/dist/components/prompt-bar.js +49 -0
- package/dist/components/prompt-bar.js.map +1 -0
- package/dist/components/radio.js +9 -9
- package/dist/components/radio.js.map +1 -1
- package/dist/components/recommendation-card.d.ts +13 -0
- package/dist/components/recommendation-card.js +123 -0
- package/dist/components/recommendation-card.js.map +1 -0
- package/dist/components/resource-list.js +1 -1
- package/dist/components/resource-list.js.map +1 -1
- package/dist/components/responsive-master-detail.js +4 -4
- package/dist/components/responsive-master-detail.js.map +1 -1
- package/dist/components/scroll-area.js +3 -3
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/section-rule.d.ts +5 -3
- package/dist/components/section-rule.js +12 -12
- package/dist/components/section-rule.js.map +1 -1
- package/dist/components/segment-control.js +3 -3
- package/dist/components/segment-control.js.map +1 -1
- package/dist/components/select.js +47 -32
- package/dist/components/select.js.map +1 -1
- package/dist/components/sensitive-input.js +17 -19
- package/dist/components/sensitive-input.js.map +1 -1
- package/dist/components/sheet.d.ts +4 -4
- package/dist/components/sheet.js +11 -10
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.js +149 -137
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton-line.d.ts +1 -1
- package/dist/components/skeleton-line.js +2 -2
- package/dist/components/skeleton-line.js.map +1 -1
- package/dist/components/slider.js +2 -2
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stat-strip.js +5 -4
- package/dist/components/stat-strip.js.map +1 -1
- package/dist/components/switch.js +6 -6
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table-of-contents.js +5 -5
- package/dist/components/table-of-contents.js.map +1 -1
- package/dist/components/table-pager.js +2 -2
- package/dist/components/table-pager.js.map +1 -1
- package/dist/components/table.d.ts +39 -2
- package/dist/components/table.js +48 -17
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js +7 -6
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag-badge.d.ts +10 -10
- package/dist/components/tag-badge.js +11 -11
- package/dist/components/tag-badge.js.map +1 -1
- package/dist/components/tag-color-picker.d.ts +8 -1
- package/dist/components/tag-color-picker.js +33 -25
- package/dist/components/tag-color-picker.js.map +1 -1
- package/dist/components/text.js +5 -5
- package/dist/components/text.js.map +1 -1
- package/dist/components/theme-toggle.js +1 -1
- package/dist/components/theme-toggle.js.map +1 -1
- package/dist/components/thinking.d.ts +16 -0
- package/dist/components/thinking.js +85 -0
- package/dist/components/thinking.js.map +1 -0
- package/dist/components/toast.js +25 -20
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.js +6 -5
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle.js +6 -6
- package/dist/components/toggle.js.map +1 -1
- package/dist/components/tool-chips.d.ts +12 -0
- package/dist/components/tool-chips.js +138 -0
- package/dist/components/tool-chips.js.map +1 -0
- package/dist/components/toolbar.js +3 -3
- package/dist/components/toolbar.js.map +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/typeahead-field.js +59 -56
- package/dist/components/typeahead-field.js.map +1 -1
- package/dist/components/upload-queue.js +15 -14
- package/dist/components/upload-queue.js.map +1 -1
- package/dist/models/agent-feedback.d.ts +44 -0
- package/dist/models/agent-feedback.js +28 -0
- package/dist/models/agent-feedback.js.map +1 -0
- package/dist/models/avatar.d.ts +2 -0
- package/dist/models/avatar.js +15 -0
- package/dist/models/avatar.js.map +1 -0
- package/dist/models/code.d.ts +6 -0
- package/dist/models/code.js +24 -0
- package/dist/models/code.js.map +1 -0
- package/dist/models/context-cards.d.ts +13 -0
- package/dist/models/context-cards.js +17 -0
- package/dist/models/context-cards.js.map +1 -0
- package/dist/models/diff-table.d.ts +12 -0
- package/dist/models/diff-table.js +9 -0
- package/dist/models/diff-table.js.map +1 -0
- package/dist/models/recommendation.d.ts +26 -0
- package/dist/models/recommendation.js +23 -0
- package/dist/models/recommendation.js.map +1 -0
- package/dist/styles/base.css +14 -2
- package/dist/styles/standalone.css +1901 -943
- package/dist/styles/tailwind.css +180 -13
- package/dist/styles/tokens.css +681 -20
- package/dist/utils/cn.js +25 -4
- package/dist/utils/cn.js.map +1 -1
- package/dist/utils/control-surface.d.ts +1 -1
- package/dist/utils/control-surface.js +1 -1
- package/dist/utils/control-surface.js.map +1 -1
- package/dist/utils/navigation.d.ts +3 -0
- package/dist/utils/navigation.js +8 -0
- package/dist/utils/navigation.js.map +1 -0
- package/dist/utils/selection-indicator.d.ts +1 -1
- package/dist/utils/selection-indicator.js +49 -72
- package/dist/utils/selection-indicator.js.map +1 -1
- package/dist/utils/use-hover-highlight.d.ts +4 -0
- package/dist/utils/use-hover-highlight.js +82 -0
- package/dist/utils/use-hover-highlight.js.map +1 -0
- package/dist/viewmodels/use-approval-card.d.ts +20 -0
- package/dist/viewmodels/use-approval-card.js +83 -0
- package/dist/viewmodels/use-approval-card.js.map +1 -0
- package/dist/viewmodels/use-chat-composer.d.ts +16 -0
- package/dist/viewmodels/use-chat-composer.js +34 -0
- package/dist/viewmodels/use-chat-composer.js.map +1 -0
- package/dist/viewmodels/use-chat-message.d.ts +16 -0
- package/dist/viewmodels/use-chat-message.js +26 -0
- package/dist/viewmodels/use-chat-message.js.map +1 -0
- package/dist/viewmodels/use-code-block.d.ts +8 -0
- package/dist/viewmodels/use-code-block.js +38 -0
- package/dist/viewmodels/use-code-block.js.map +1 -0
- package/dist/viewmodels/use-context-cards.d.ts +17 -0
- package/dist/viewmodels/use-context-cards.js +18 -0
- package/dist/viewmodels/use-context-cards.js.map +1 -0
- package/dist/viewmodels/use-diff-table.d.ts +16 -0
- package/dist/viewmodels/use-diff-table.js +42 -0
- package/dist/viewmodels/use-diff-table.js.map +1 -0
- package/dist/viewmodels/use-loader.d.ts +4 -0
- package/dist/viewmodels/use-loader.js +22 -0
- package/dist/viewmodels/use-loader.js.map +1 -0
- package/dist/viewmodels/use-recommendation-card.d.ts +17 -0
- package/dist/viewmodels/use-recommendation-card.js +41 -0
- package/dist/viewmodels/use-recommendation-card.js.map +1 -0
- package/dist/viewmodels/use-thinking.d.ts +13 -0
- package/dist/viewmodels/use-thinking.js +18 -0
- package/dist/viewmodels/use-thinking.js.map +1 -0
- package/dist/viewmodels/use-tool-chips.d.ts +10 -0
- package/dist/viewmodels/use-tool-chips.js +20 -0
- package/dist/viewmodels/use-tool-chips.js.map +1 -0
- package/package.json +28 -26
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import { type TableTextAlign } from "./table.js";
|
|
3
|
+
export type DataTableEdge = "inset" | "attached";
|
|
2
4
|
export type DataTableColumn<T> = {
|
|
3
5
|
id: string;
|
|
4
6
|
header: string;
|
|
@@ -9,12 +11,16 @@ export type DataTableColumn<T> = {
|
|
|
9
11
|
headerContent?: ReactNode;
|
|
10
12
|
/** Whether the header changes sorting. @default true */
|
|
11
13
|
sortable?: boolean;
|
|
12
|
-
/**
|
|
14
|
+
/** Preferred and minimum column width; narrow viewports scroll instead of squeezing it. */
|
|
13
15
|
width?: CSSProperties["width"];
|
|
16
|
+
/** Allow multiline cell content. Default false keeps dense records on one line. */
|
|
17
|
+
wrap?: boolean;
|
|
14
18
|
/** Classes applied to the header cell. */
|
|
15
19
|
headerClassName?: string;
|
|
16
20
|
/** Classes applied to each data cell. */
|
|
17
21
|
cellClassName?: string;
|
|
22
|
+
/** Logical header and cell alignment. Omitted cells inherit from the table. */
|
|
23
|
+
textAlign?: TableTextAlign;
|
|
18
24
|
};
|
|
19
25
|
export type DataTableSort = {
|
|
20
26
|
id: string;
|
|
@@ -86,6 +92,10 @@ export type DataTableProps<T = unknown> = {
|
|
|
86
92
|
* Additional classes for the table.
|
|
87
93
|
*/
|
|
88
94
|
className?: string;
|
|
95
|
+
/** Bound the local scroll region; column headers stay visible while scrolling. */
|
|
96
|
+
maxHeight?: CSSProperties["maxHeight"];
|
|
97
|
+
/** Show display-order row numbers, continuous across pages. @default false */
|
|
98
|
+
rowNumbers?: boolean;
|
|
89
99
|
/** Controlled sorting. null explicitly disables sorting. */
|
|
90
100
|
sort?: DataTableSort | null;
|
|
91
101
|
/** Initial sorting for uncontrolled usage. @default null */
|
|
@@ -110,5 +120,7 @@ export type DataTableProps<T = unknown> = {
|
|
|
110
120
|
"aria-label"?: string;
|
|
111
121
|
/** ID of additional table instructions or summary. */
|
|
112
122
|
"aria-describedby"?: string;
|
|
123
|
+
/** Direct-card rails on the first and last display columns. @default "inset" */
|
|
124
|
+
edge?: DataTableEdge;
|
|
113
125
|
};
|
|
114
|
-
export declare function DataTable<T>({ data, columns, filter, loading, empty, selected, defaultSelected, onSelectedChange, multiple, page, defaultPage, pageSize, onPageChange, getRowId, className, sort: controlledSort, defaultSort, onSortChange, manualSorting, manualPagination, manualFiltering, total, error, onRetry, retryLabel, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, }: DataTableProps<T>): import("react").JSX.Element;
|
|
126
|
+
export declare function DataTable<T>({ data, columns, filter, loading, empty, selected, defaultSelected, onSelectedChange, multiple, page, defaultPage, pageSize, onPageChange, getRowId, className, maxHeight, rowNumbers, sort: controlledSort, defaultSort, onSortChange, manualSorting, manualPagination, manualFiltering, total, error, onRetry, retryLabel, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, edge, }: DataTableProps<T>): import("react").JSX.Element;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../utils/cn.js";
|
|
3
3
|
import { Button as t } from "./button.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { Checkbox as n } from "./checkbox.js";
|
|
5
|
+
import { SkeletonLine as r } from "./skeleton-line.js";
|
|
6
|
+
import { Pagination as i } from "./pagination.js";
|
|
7
|
+
import { Table as a, TableBody as o, TableCell as s, TableHead as c, TableHeader as l, TableRow as u, TableSortableHeader as d } from "./table.js";
|
|
8
|
+
import { useCallback as f, useEffect as ee, useLayoutEffect as te, useMemo as ne, useRef as p, useState as m } from "react";
|
|
9
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
9
10
|
//#region src/components/data-table.tsx
|
|
10
|
-
function
|
|
11
|
+
function _(t, n, r) {
|
|
12
|
+
if (t === "attached") return e(n === 0 && "ps-basalt-table-edge", n === r - 1 && "pe-basalt-table-edge");
|
|
13
|
+
}
|
|
14
|
+
function v(e) {
|
|
11
15
|
return e === -Infinity ? 0 : typeof e == "bigint" || typeof e == "number" && Number.isFinite(e) ? 1 : e === Infinity ? 2 : typeof e == "number" ? 3 : typeof e == "string" ? 4 : 5;
|
|
12
16
|
}
|
|
13
|
-
function
|
|
14
|
-
let n =
|
|
17
|
+
function re(e, t) {
|
|
18
|
+
let n = v(e), r = v(t);
|
|
15
19
|
if (n !== r) return n - r;
|
|
16
20
|
if (n === 1) {
|
|
17
21
|
let n = e, r = t;
|
|
@@ -20,7 +24,7 @@ function ne(e, t) {
|
|
|
20
24
|
let i = String(e), a = String(t);
|
|
21
25
|
return i < a ? -1 : +(i > a);
|
|
22
26
|
}
|
|
23
|
-
function
|
|
27
|
+
function ie(e, t, n, r) {
|
|
24
28
|
if (e === null) return "prim:null";
|
|
25
29
|
if (e === void 0) return "prim:undefined";
|
|
26
30
|
if (typeof e == "symbol") {
|
|
@@ -30,33 +34,33 @@ function re(e, t, n, r) {
|
|
|
30
34
|
let i = typeof e;
|
|
31
35
|
return i === "number" ? Object.is(e, -0) ? "prim:number:-0" : `prim:number:${String(e)}` : i === "string" || i === "bigint" || i === "boolean" ? `prim:${i}:${String(e)}` : `prim:${t}`;
|
|
32
36
|
}
|
|
33
|
-
function
|
|
37
|
+
function y(e) {
|
|
34
38
|
return e.startsWith("dup:") || e.startsWith("gen:");
|
|
35
39
|
}
|
|
36
|
-
function
|
|
40
|
+
function b(e) {
|
|
37
41
|
return typeof e == "function" || typeof e == "object" && !!e;
|
|
38
42
|
}
|
|
39
|
-
function
|
|
43
|
+
function ae(e, t) {
|
|
40
44
|
if (e.filterValue) return String(e.filterValue(t));
|
|
41
45
|
if (e.sortValue) return String(e.sortValue(t));
|
|
42
46
|
let n = e.accessor(t);
|
|
43
47
|
return typeof n == "string" || typeof n == "number" || typeof n == "bigint" ? String(n) : "";
|
|
44
48
|
}
|
|
45
|
-
function
|
|
49
|
+
function x(e, t, n, r) {
|
|
46
50
|
let i = r?.(e, t);
|
|
47
|
-
return i === void 0 ?
|
|
51
|
+
return i === void 0 ? b(e) && "id" in e && e.id != null ? String(e.id) : n : i;
|
|
48
52
|
}
|
|
49
|
-
function
|
|
50
|
-
let [
|
|
51
|
-
|
|
52
|
-
}, [
|
|
53
|
+
function S({ data: v, columns: S, filter: oe = "", loading: C = !1, empty: se = "No results", selected: w, defaultSelected: ce, onSelectedChange: T, multiple: le = !1, page: E, defaultPage: ue = 1, pageSize: D, onPageChange: O, getRowId: k, className: de, maxHeight: fe, rowNumbers: A = !1, sort: j, defaultSort: pe = null, onSortChange: me, manualSorting: M = !1, manualPagination: N = !1, manualFiltering: P = !1, total: F, error: I, onRetry: L, retryLabel: he = "Try again", "aria-label": R = "Data table", "aria-describedby": ge, edge: z }) {
|
|
54
|
+
let [_e, ve] = m(pe), B = j === void 0 ? _e : j, ye = (e) => {
|
|
55
|
+
j === void 0 && ve(e), me?.(e);
|
|
56
|
+
}, [be, xe] = m(ce ?? []), [V, Se] = m(ue), H = p(/* @__PURE__ */ new WeakMap()), U = p(0), W = p(/* @__PURE__ */ new WeakMap()), G = p(/* @__PURE__ */ new Map()), Ce = p(/* @__PURE__ */ new Map()), we = p(/* @__PURE__ */ new Map()), Te = p(/* @__PURE__ */ new Map()), K = oe.trim().toLowerCase(), q = ne(() => {
|
|
53
57
|
let e = (e) => {
|
|
54
|
-
let t =
|
|
55
|
-
return t || (t = `basalt-row-${
|
|
58
|
+
let t = H.current.get(e);
|
|
59
|
+
return t || (t = `basalt-row-${U.current++}`, H.current.set(e, t)), t;
|
|
56
60
|
}, t = (e, t) => {
|
|
57
|
-
let n =
|
|
61
|
+
let n = k?.(e, t);
|
|
58
62
|
if (n !== void 0) return `get:${n}`;
|
|
59
|
-
if (
|
|
63
|
+
if (b(e) && "id" in e) {
|
|
60
64
|
let t = e.id;
|
|
61
65
|
if (t != null) return `id:${String(t)}`;
|
|
62
66
|
}
|
|
@@ -65,12 +69,12 @@ function b({ data: g, columns: b, filter: ae = "", loading: x = !1, empty: oe =
|
|
|
65
69
|
let l = a.get(c) ?? [];
|
|
66
70
|
l.push(s), a.set(c, l), o.set(s, c);
|
|
67
71
|
let u = t(e, n);
|
|
68
|
-
if (u && (r.set(u, s),
|
|
72
|
+
if (u && (r.set(u, s), y(s))) {
|
|
69
73
|
let e = i.get(u) ?? [];
|
|
70
74
|
e.push(s), i.set(u, e);
|
|
71
75
|
}
|
|
72
|
-
}, c = /* @__PURE__ */ new WeakMap(), l =
|
|
73
|
-
let n =
|
|
76
|
+
}, c = /* @__PURE__ */ new WeakMap(), l = v.map((e, t) => {
|
|
77
|
+
let n = b(e) ? e : null, r = n ? c.get(n) ?? 0 : 0;
|
|
74
78
|
return n && c.set(n, r + 1), {
|
|
75
79
|
row: e,
|
|
76
80
|
index: t,
|
|
@@ -79,29 +83,29 @@ function b({ data: g, columns: b, filter: ae = "", loading: x = !1, empty: oe =
|
|
|
79
83
|
};
|
|
80
84
|
});
|
|
81
85
|
for (let e of l) {
|
|
82
|
-
let t =
|
|
86
|
+
let t = b(e.row) ? e.row : null;
|
|
83
87
|
if (!t) continue;
|
|
84
|
-
let r =
|
|
85
|
-
r && !n.has(r) &&
|
|
88
|
+
let r = W.current.get(t)?.[e.occurrence];
|
|
89
|
+
r && !n.has(r) && G.current.get(r) === t && (e.key = r, n.add(r));
|
|
86
90
|
}
|
|
87
91
|
let u = l.map(({ row: r, index: i, occurrence: a, key: o }) => {
|
|
88
|
-
let c =
|
|
92
|
+
let c = b(r) ? r : null;
|
|
89
93
|
if (o) return s(r, i, o, c), {
|
|
90
94
|
row: r,
|
|
91
95
|
key: o,
|
|
92
|
-
selectId:
|
|
96
|
+
selectId: x(r, i, o, k)
|
|
93
97
|
};
|
|
94
98
|
let l = a > 0, u, d = t(r, i);
|
|
95
99
|
if (d && (u = d), c) {
|
|
96
100
|
let t = e(c);
|
|
97
101
|
if (!u) u = l ? `gen:${t}#${a}` : `gen:${t}`;
|
|
98
|
-
else if (n.has(u) || l) u = (
|
|
102
|
+
else if (n.has(u) || l) u = (we.current.get(u) ?? []).find((e) => !n.has(e)) ?? (l ? `dup:${t}#${a}` : `dup:${t}`);
|
|
99
103
|
else {
|
|
100
|
-
let e =
|
|
101
|
-
e && !n.has(e) &&
|
|
104
|
+
let e = Ce.current.get(u);
|
|
105
|
+
e && !n.has(e) && y(e) && (u = e);
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
|
-
if (u ??=
|
|
108
|
+
if (u ??= ie(r, i, Te.current, U), n.has(u)) {
|
|
105
109
|
let e = 0, t = `occ:${u}#${e}`;
|
|
106
110
|
for (; n.has(t);) e += 1, t = `occ:${u}#${e}`;
|
|
107
111
|
u = t;
|
|
@@ -109,16 +113,16 @@ function b({ data: g, columns: b, filter: ae = "", loading: x = !1, empty: oe =
|
|
|
109
113
|
return n.add(u), s(r, i, u, c), {
|
|
110
114
|
row: r,
|
|
111
115
|
key: u,
|
|
112
|
-
selectId:
|
|
116
|
+
selectId: x(r, i, u, k)
|
|
113
117
|
};
|
|
114
|
-
}), d =
|
|
118
|
+
}), d = K && !P ? u.filter(({ row: e }) => S.some((t) => ae(t, e).toLowerCase().includes(K))) : u;
|
|
115
119
|
return {
|
|
116
120
|
rows: (() => {
|
|
117
|
-
if (!
|
|
118
|
-
let e =
|
|
121
|
+
if (!B || M) return d;
|
|
122
|
+
let e = S.find((e) => e.id === B.id);
|
|
119
123
|
return e ? [...d].sort((t, n) => {
|
|
120
|
-
let r =
|
|
121
|
-
return
|
|
124
|
+
let r = re(e.sortValue?.(t.row) ?? e.accessor(t.row), e.sortValue?.(n.row) ?? e.accessor(n.row));
|
|
125
|
+
return B.dir === "asc" ? r : -r;
|
|
122
126
|
}) : d;
|
|
123
127
|
})(),
|
|
124
128
|
assigned: a,
|
|
@@ -127,140 +131,186 @@ function b({ data: g, columns: b, filter: ae = "", loading: x = !1, empty: oe =
|
|
|
127
131
|
dups: i
|
|
128
132
|
};
|
|
129
133
|
}, [
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
S,
|
|
135
|
+
v,
|
|
136
|
+
k,
|
|
137
|
+
K,
|
|
138
|
+
B,
|
|
139
|
+
P,
|
|
140
|
+
M
|
|
137
141
|
]);
|
|
142
|
+
te(() => {
|
|
143
|
+
for (let [e, t] of q.assigned) W.current.set(e, t);
|
|
144
|
+
G.current = q.owner, Ce.current = q.lastKey, we.current = q.dups;
|
|
145
|
+
}, [q]);
|
|
146
|
+
let J = w !== void 0 || ce !== void 0 || T !== void 0, Y = w ?? be, Ee = f((e) => {
|
|
147
|
+
w === void 0 && xe(e), T?.(e);
|
|
148
|
+
}, [T, w]), De = N && F !== void 0 ? Math.max(0, F) : q.rows.length, Oe = D && D > 0 ? Math.max(1, Math.ceil(De / D)) : 1, X = Math.min(Oe, Math.max(1, E ?? V)), Z = f((e) => {
|
|
149
|
+
E === void 0 && Se(e), O?.(e);
|
|
150
|
+
}, [O, E]), Q = p(null);
|
|
138
151
|
ee(() => {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}, [G]);
|
|
142
|
-
let K = S !== void 0 || C !== void 0 || w !== void 0, q = S ?? ve, J = u((e) => {
|
|
143
|
-
S === void 0 && ye(e), w?.(e);
|
|
144
|
-
}, [w, S]), Se = A && M !== void 0 ? Math.max(0, M) : G.rows.length, Y = E && E > 0 ? Math.max(1, Math.ceil(Se / E)) : 1, X = Math.min(Y, Math.max(1, T ?? L)), Z = u((e) => {
|
|
145
|
-
T === void 0 && be(e), le?.(e);
|
|
146
|
-
}, [le, T]), Q = f(null);
|
|
147
|
-
d(() => {
|
|
148
|
-
let e = T ?? L;
|
|
149
|
-
if (e === X || x) {
|
|
152
|
+
let e = E ?? V;
|
|
153
|
+
if (e === X || C) {
|
|
150
154
|
Q.current = null;
|
|
151
155
|
return;
|
|
152
156
|
}
|
|
153
157
|
let t = `${e}:${X}`;
|
|
154
158
|
Q.current !== t && (Q.current = t, Z(X));
|
|
155
159
|
}, [
|
|
156
|
-
|
|
157
|
-
|
|
160
|
+
E,
|
|
161
|
+
V,
|
|
158
162
|
X,
|
|
159
|
-
|
|
163
|
+
C,
|
|
160
164
|
Z
|
|
161
165
|
]);
|
|
162
|
-
let
|
|
163
|
-
if (
|
|
164
|
-
|
|
166
|
+
let ke = !N && D && D > 0 ? q.rows.slice((X - 1) * D, X * D) : q.rows, $ = S.length + +!!J + +!!A, Ae = (e) => {
|
|
167
|
+
if (le) {
|
|
168
|
+
Ee(Y.includes(e) ? Y.filter((t) => t !== e) : [...Y, e]);
|
|
165
169
|
return;
|
|
166
170
|
}
|
|
167
|
-
|
|
171
|
+
Ee(Y.includes(e) ? [] : [e]);
|
|
168
172
|
};
|
|
169
|
-
return /* @__PURE__ */
|
|
170
|
-
className: "flex min-w-0 flex-col gap-
|
|
171
|
-
children: [/* @__PURE__ */
|
|
173
|
+
return /* @__PURE__ */ g("div", {
|
|
174
|
+
className: "flex min-w-0 flex-col gap-basalt-space-lg",
|
|
175
|
+
children: [/* @__PURE__ */ h("div", {
|
|
172
176
|
role: "region",
|
|
173
|
-
"aria-label": `${
|
|
177
|
+
"aria-label": `${R} scroll area`,
|
|
174
178
|
tabIndex: 0,
|
|
175
|
-
className: "min-w-0 overflow-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"
|
|
179
|
-
"aria-
|
|
180
|
-
"aria-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
"
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
179
|
+
className: "relative min-w-0 overflow-auto rounded-basalt-md focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-basalt-primary",
|
|
180
|
+
style: { maxHeight: fe },
|
|
181
|
+
children: /* @__PURE__ */ g(a, {
|
|
182
|
+
className: e("w-full", de),
|
|
183
|
+
"aria-label": R,
|
|
184
|
+
"aria-describedby": ge,
|
|
185
|
+
"aria-busy": C || void 0,
|
|
186
|
+
"data-basalt-data-table": "",
|
|
187
|
+
children: [/* @__PURE__ */ h(l, { children: /* @__PURE__ */ g(u, { children: [
|
|
188
|
+
A && /* @__PURE__ */ g(c, {
|
|
189
|
+
scope: "col",
|
|
190
|
+
textAlign: "end",
|
|
191
|
+
className: e("sticky top-0 z-10 w-basalt-10 min-w-basalt-10 bg-basalt-control", _(z, 0, $)),
|
|
192
|
+
children: [/* @__PURE__ */ h("span", {
|
|
193
|
+
"aria-hidden": "true",
|
|
194
|
+
children: "#"
|
|
195
|
+
}), /* @__PURE__ */ h("span", {
|
|
196
|
+
className: "sr-only",
|
|
197
|
+
children: "Row number"
|
|
198
|
+
})]
|
|
199
|
+
}),
|
|
200
|
+
J ? /* @__PURE__ */ h(c, {
|
|
201
|
+
scope: "col",
|
|
202
|
+
className: e("sticky top-0 z-10 w-basalt-10 min-w-basalt-10 bg-basalt-control text-center", _(z, +!!A, $)),
|
|
203
|
+
children: /* @__PURE__ */ h("span", {
|
|
204
|
+
className: "sr-only",
|
|
205
|
+
children: "Select"
|
|
206
|
+
})
|
|
207
|
+
}) : null,
|
|
208
|
+
S.map((t, n) => /* @__PURE__ */ h(c, {
|
|
209
|
+
textAlign: t.textAlign,
|
|
210
|
+
className: e("sticky top-0 z-10 bg-basalt-control", _(z, +!!A + +!!J + n, $), t.headerClassName),
|
|
211
|
+
style: {
|
|
212
|
+
width: t.width,
|
|
213
|
+
minWidth: t.width
|
|
214
|
+
},
|
|
215
|
+
scope: "col",
|
|
216
|
+
"aria-sort": t.sortable === !1 ? void 0 : B?.id === t.id ? B.dir === "asc" ? "ascending" : "descending" : "none",
|
|
217
|
+
children: t.sortable === !1 ? /* @__PURE__ */ h("span", {
|
|
218
|
+
className: e("flex items-center gap-basalt-control-gap", t.textAlign === "end" && "w-full justify-end text-end"),
|
|
219
|
+
children: t.headerContent ?? t.header
|
|
220
|
+
}) : /* @__PURE__ */ h(d, {
|
|
221
|
+
textAlign: t.textAlign,
|
|
222
|
+
sorted: B?.id === t.id ? B.dir : void 0,
|
|
223
|
+
"aria-label": t.header,
|
|
224
|
+
onClick: () => ye(B?.id === t.id && B.dir === "asc" ? {
|
|
225
|
+
id: t.id,
|
|
226
|
+
dir: "desc"
|
|
227
|
+
} : {
|
|
228
|
+
id: t.id,
|
|
229
|
+
dir: "asc"
|
|
230
|
+
}),
|
|
231
|
+
children: t.headerContent ?? t.header
|
|
232
|
+
})
|
|
233
|
+
}, t.id))
|
|
234
|
+
] }) }), /* @__PURE__ */ h(o, { children: C ? /* @__PURE__ */ h(u, { children: /* @__PURE__ */ h(s, {
|
|
203
235
|
colSpan: $,
|
|
204
|
-
|
|
236
|
+
className: _(z, 0, 1),
|
|
237
|
+
children: /* @__PURE__ */ g("div", {
|
|
205
238
|
role: "status",
|
|
206
|
-
className: "flex flex-col gap-
|
|
239
|
+
className: "flex flex-col gap-basalt-space-lg py-basalt-space-lg",
|
|
207
240
|
children: [
|
|
208
|
-
/* @__PURE__ */
|
|
241
|
+
/* @__PURE__ */ h("span", {
|
|
209
242
|
className: "sr-only",
|
|
210
243
|
children: "Loading"
|
|
211
244
|
}),
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ h(r, {}),
|
|
246
|
+
/* @__PURE__ */ h(r, {}),
|
|
247
|
+
/* @__PURE__ */ h(r, {})
|
|
215
248
|
]
|
|
216
249
|
})
|
|
217
|
-
}) }) :
|
|
250
|
+
}) }) : I != null && I !== !1 ? /* @__PURE__ */ h(u, { children: /* @__PURE__ */ h(s, {
|
|
218
251
|
colSpan: $,
|
|
219
|
-
|
|
252
|
+
className: _(z, 0, 1),
|
|
253
|
+
children: /* @__PURE__ */ g("div", {
|
|
220
254
|
role: "alert",
|
|
221
|
-
className: "flex flex-wrap items-center justify-between gap-
|
|
222
|
-
children: [/* @__PURE__ */
|
|
255
|
+
className: "flex flex-wrap items-center justify-between gap-basalt-space-lg py-basalt-space-lg",
|
|
256
|
+
children: [/* @__PURE__ */ h("div", { children: I }), L ? /* @__PURE__ */ h(t, {
|
|
223
257
|
variant: "outline",
|
|
224
258
|
size: "sm",
|
|
225
|
-
onClick:
|
|
226
|
-
children:
|
|
259
|
+
onClick: L,
|
|
260
|
+
children: he
|
|
227
261
|
}) : null]
|
|
228
262
|
})
|
|
229
|
-
}) }) :
|
|
263
|
+
}) }) : ke.length === 0 ? /* @__PURE__ */ h(u, { children: /* @__PURE__ */ h(s, {
|
|
230
264
|
colSpan: $,
|
|
231
|
-
|
|
265
|
+
className: _(z, 0, 1),
|
|
266
|
+
children: /* @__PURE__ */ h("div", {
|
|
232
267
|
role: "status",
|
|
233
|
-
children:
|
|
268
|
+
children: se
|
|
234
269
|
})
|
|
235
|
-
}) }) :
|
|
236
|
-
let
|
|
237
|
-
return /* @__PURE__ */
|
|
238
|
-
variant:
|
|
239
|
-
"aria-selected":
|
|
240
|
-
children: [
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
className:
|
|
249
|
-
children:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
270
|
+
}) }) : ke.map(({ row: t, key: r, selectId: i }, a) => {
|
|
271
|
+
let o = Y.includes(i);
|
|
272
|
+
return /* @__PURE__ */ g(u, {
|
|
273
|
+
variant: o ? "selected" : "default",
|
|
274
|
+
"aria-selected": J ? o : void 0,
|
|
275
|
+
children: [
|
|
276
|
+
A && /* @__PURE__ */ h(s, {
|
|
277
|
+
"data-row-number": "",
|
|
278
|
+
textAlign: "end",
|
|
279
|
+
className: e("text-basalt-sm text-basalt-muted-foreground", _(z, 0, $)),
|
|
280
|
+
children: (D && D > 0 ? (X - 1) * D : 0) + a + 1
|
|
281
|
+
}),
|
|
282
|
+
J ? /* @__PURE__ */ h(s, {
|
|
283
|
+
className: e("text-center", _(z, +!!A, $)),
|
|
284
|
+
children: /* @__PURE__ */ h(n, {
|
|
285
|
+
checked: o,
|
|
286
|
+
"aria-label": `Select ${i}`,
|
|
287
|
+
onCheckedChange: () => Ae(i),
|
|
288
|
+
className: "align-middle"
|
|
289
|
+
})
|
|
290
|
+
}) : null,
|
|
291
|
+
S.map((n, r) => {
|
|
292
|
+
let i = n.accessor(t);
|
|
293
|
+
return /* @__PURE__ */ h(s, {
|
|
294
|
+
textAlign: n.textAlign,
|
|
295
|
+
className: e(n.wrap ? "whitespace-normal break-words" : "whitespace-nowrap", _(z, +!!A + +!!J + r, $), n.cellClassName),
|
|
296
|
+
style: { minWidth: n.width },
|
|
297
|
+
children: typeof i == "bigint" ? String(i) : i
|
|
298
|
+
}, n.id);
|
|
299
|
+
})
|
|
300
|
+
]
|
|
301
|
+
}, r);
|
|
253
302
|
}) })]
|
|
254
303
|
})
|
|
255
|
-
}),
|
|
304
|
+
}), D && D > 0 ? /* @__PURE__ */ h(i, {
|
|
256
305
|
page: X,
|
|
257
|
-
pageCount:
|
|
258
|
-
disabled:
|
|
259
|
-
onPageChange: Z
|
|
306
|
+
pageCount: Oe,
|
|
307
|
+
disabled: C,
|
|
308
|
+
onPageChange: Z,
|
|
309
|
+
className: z === "attached" ? "px-basalt-panel-x pb-basalt-panel-y" : void 0
|
|
260
310
|
}) : null]
|
|
261
311
|
});
|
|
262
312
|
}
|
|
263
313
|
//#endregion
|
|
264
|
-
export {
|
|
314
|
+
export { S as DataTable };
|
|
265
315
|
|
|
266
316
|
//# sourceMappingURL=data-table.js.map
|