@datum-cloud/datum-ui 2.3.0 → 2.3.1
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as GroupedTable } from "../grouped-table
|
|
1
|
+
import { t as GroupedTable } from "../grouped-table-Dldsvwz6.mjs";
|
|
2
2
|
export { GroupedTable };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { t as cn } from "./utils-Bu32wN-x.mjs";
|
|
2
|
+
import { t as Button } from "./button-A1qTjZ8U.mjs";
|
|
2
3
|
import { t as Icon } from "./icon-wrapper-DKfJlJd0.mjs";
|
|
3
4
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./collapsible/index.mjs";
|
|
4
5
|
import { t as useControllableState } from "./use-controllable-state-Dna7u3r9.mjs";
|
|
5
|
-
import { t as Input } from "./input-j4tbmYYz.mjs";
|
|
6
6
|
import { Skeleton } from "./skeleton/index.mjs";
|
|
7
7
|
import { TableBody, TableCell, TableHead, TableHeader, TableRow } from "./table/index.mjs";
|
|
8
8
|
import { f as rowMatchesSearch, g as createSelectionColumn, h as DataTableColumnHeader, m as DataTableRowActions, p as dataTableFeatures } from "./data-table-Du7_FLBi.mjs";
|
|
9
9
|
import { n as useDebouncedSearchInput } from "./use-debounced-search-input-yu_F0QBt.mjs";
|
|
10
|
-
import {
|
|
10
|
+
import { InputWithAddons } from "./input-with-addons/index.mjs";
|
|
11
|
+
import { ChevronRight, Search, X } from "lucide-react";
|
|
11
12
|
import { useCallback, useMemo, useState } from "react";
|
|
12
13
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
14
|
import { flexRender, useTable } from "@tanstack/react-table";
|
|
@@ -33,12 +34,37 @@ function GroupedToolbar({ search, onSearchChange, placeholder = "Search...", deb
|
|
|
33
34
|
return /* @__PURE__ */ jsx("div", {
|
|
34
35
|
className: cn("pb-3", className),
|
|
35
36
|
"data-slot": "gt-toolbar",
|
|
36
|
-
children: /* @__PURE__ */ jsx(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
38
|
+
className: "w-full min-w-full flex-1 rounded-md sm:max-w-3xs md:min-w-80",
|
|
39
|
+
children: /* @__PURE__ */ jsx(InputWithAddons, {
|
|
40
|
+
type: "text",
|
|
41
|
+
placeholder,
|
|
42
|
+
value,
|
|
43
|
+
onChange: (e) => setValue(e.target.value),
|
|
44
|
+
containerClassName: "h-9",
|
|
45
|
+
className: "h-full text-xs placeholder:text-xs md:text-xs",
|
|
46
|
+
"aria-label": placeholder,
|
|
47
|
+
"data-slot": "gt-search",
|
|
48
|
+
leading: /* @__PURE__ */ jsx(Icon, {
|
|
49
|
+
icon: Search,
|
|
50
|
+
size: 14,
|
|
51
|
+
className: "text-icon-quaternary"
|
|
52
|
+
}),
|
|
53
|
+
trailing: value ? /* @__PURE__ */ jsxs(Button, {
|
|
54
|
+
type: "quaternary",
|
|
55
|
+
theme: "borderless",
|
|
56
|
+
size: "icon",
|
|
57
|
+
onClick: () => setValue(""),
|
|
58
|
+
className: "hover:text-destructive text-icon-quaternary size-4 p-0 hover:bg-transparent",
|
|
59
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
60
|
+
icon: X,
|
|
61
|
+
size: 14
|
|
62
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
63
|
+
className: "sr-only",
|
|
64
|
+
children: "Clear search"
|
|
65
|
+
})]
|
|
66
|
+
}) : void 0
|
|
67
|
+
})
|
|
42
68
|
})
|
|
43
69
|
});
|
|
44
70
|
}
|
|
@@ -285,15 +311,17 @@ function GroupedTable(props) {
|
|
|
285
311
|
children: header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())
|
|
286
312
|
}, header.id))
|
|
287
313
|
}, hg.id)) })]
|
|
288
|
-
}), visibleSlices.map((slice) => {
|
|
314
|
+
}), visibleSlices.map((slice, sliceIndex) => {
|
|
289
315
|
const open = isSearching ? true : isOpen(slice.id);
|
|
290
316
|
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
291
317
|
open,
|
|
318
|
+
"data-slot": "grouped-table-group",
|
|
319
|
+
className: cn(sliceIndex > 0 && "border-border border-t"),
|
|
292
320
|
onOpenChange: () => {
|
|
293
321
|
if (!isSearching) toggle(slice.id);
|
|
294
322
|
},
|
|
295
323
|
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
296
|
-
className: cn("flex h-10 w-full items-center gap-2
|
|
324
|
+
className: cn("flex h-10 w-full items-center gap-2 bg-muted/40 px-2 text-left align-middle text-sm font-medium text-muted-foreground transition-colors hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", resolveClassName(groupHeaderClassName, slice.group)),
|
|
297
325
|
children: [
|
|
298
326
|
/* @__PURE__ */ jsx(Icon, {
|
|
299
327
|
icon: ChevronRight,
|
|
@@ -307,7 +335,7 @@ function GroupedTable(props) {
|
|
|
307
335
|
})
|
|
308
336
|
]
|
|
309
337
|
}), /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
310
|
-
|
|
338
|
+
"data-slot": "grouped-table-group-content",
|
|
311
339
|
children: /* @__PURE__ */ jsxs("table", {
|
|
312
340
|
className: cn("w-full table-fixed text-sm", tableClassName),
|
|
313
341
|
"aria-label": typeof slice.title === "string" ? slice.title : void 0,
|
|
@@ -322,9 +350,9 @@ function GroupedTable(props) {
|
|
|
322
350
|
}),
|
|
323
351
|
/* @__PURE__ */ jsx(TableBody, {
|
|
324
352
|
className: bodyClassName,
|
|
325
|
-
children: slice.rows.map((row) => /* @__PURE__ */ jsx(TableRow, {
|
|
353
|
+
children: slice.rows.map((row, rowIndex) => /* @__PURE__ */ jsx(TableRow, {
|
|
326
354
|
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
327
|
-
className: resolveClassName(rowClassName, row),
|
|
355
|
+
className: cn(rowIndex === 0 && "border-t", resolveClassName(rowClassName, row)),
|
|
328
356
|
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell, {
|
|
329
357
|
className: resolveClassName(cellClassName, cell),
|
|
330
358
|
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
package/dist/index.mjs
CHANGED
|
@@ -69,7 +69,7 @@ import { InputWithAddons } from "./input-with-addons/index.mjs";
|
|
|
69
69
|
import { t as TimePicker } from "./time-picker-CFhaHTtI.mjs";
|
|
70
70
|
import { t as Transfer } from "./transfer-CEq9AhL7.mjs";
|
|
71
71
|
import { a as getResponsiveValue, c as GRID_COLUMNS, d as RESPONSIVE_MAP, i as getGutter, l as GRID_PREFIX, n as Row, o as registerMediaQuery, r as RowContext, s as GRID_BREAKPOINTS, t as Col, u as RESPONSIVE_ARRAY } from "./col-BYGWTB4j.mjs";
|
|
72
|
-
import { t as GroupedTable } from "./grouped-table
|
|
72
|
+
import { t as GroupedTable } from "./grouped-table-Dldsvwz6.mjs";
|
|
73
73
|
import { t as InputNumber } from "./input-number-TXmW-X9o.mjs";
|
|
74
74
|
import { a as logoStyles, i as LogoFlat, n as LogoStacked, r as LogoIcon, t as LogoText } from "./logo-text-Dpm5O6Kg.mjs";
|
|
75
75
|
import { t as Logo } from "./logo-C3FxD7jb.mjs";
|