@fldr/ui 0.3.8 → 0.3.10

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 (73) hide show
  1. package/README.md +67 -448
  2. package/ai/component-registry.json +27 -14
  3. package/ai/component-registry.md +3 -3
  4. package/dist/.build-complete +1 -1
  5. package/dist/blocks-source/auth-card/auth-card.test.tsx +20 -14
  6. package/dist/blocks-source/auth-card/auth-card.tsx +73 -55
  7. package/dist/blocks-source/file-table/file-table.tsx +197 -150
  8. package/dist/blocks-source/login-page/login-page.tsx +3 -1
  9. package/dist/blocks-source/share-dialog/share-dialog.test.tsx +9 -3
  10. package/dist/blocks-source/share-dialog/share-dialog.tsx +50 -35
  11. package/dist/blocks.d.ts +24 -5
  12. package/dist/blocks.js +250 -197
  13. package/dist/brands.d.ts +143 -0
  14. package/dist/brands.js +92 -0
  15. package/dist/{button-DzavLWXm.d.ts → button-CS82eT0x.d.ts} +1 -1
  16. package/dist/chunks/{checkbox-eifiwbw34xwsikvf.js → checkbox-d5epe4dl78bzy4f8.js} +8 -8
  17. package/dist/chunks/{dropdown-e5zk0ez21busnt0b.js → dropdown-oec4g1w9kbsjsg15.js} +1 -1
  18. package/dist/chunks/highlighter-kb7huz24pcziin6d.js +57 -0
  19. package/dist/chunks/{layer-dialog-m8qb0wzfg3k7406a.js → layer-dialog-ioa3r4ayemppsspx.js} +4 -3
  20. package/dist/chunks/{table-ngl1b5yc8mcur662.js → table-bdye068ekayq3u1n.js} +1 -1
  21. package/dist/chunks/table-n5yarooiknhc18ln.js +448 -0
  22. package/dist/chunks/{table-of-contents-gkjv9ck8etbz64ej.js → table-of-contents-d3pmkrk223umdz9h.js} +1 -1
  23. package/dist/code/server.js +1 -1
  24. package/dist/code.js +4 -131
  25. package/dist/components/banner.d.ts +1 -1
  26. package/dist/components/button.d.ts +2 -2
  27. package/dist/components/checkbox.d.ts +1 -1
  28. package/dist/components/checkbox.js +1 -1
  29. package/dist/components/dropdown.js +1 -1
  30. package/dist/components/input-group.d.ts +2 -1
  31. package/dist/components/input.d.ts +2 -2
  32. package/dist/components/layer-dialog.js +1 -1
  33. package/dist/components/link.d.ts +2 -67
  34. package/dist/components/sidebar.d.ts +2 -1
  35. package/dist/components/table-of-contents.js +1 -1
  36. package/dist/components/table.d.ts +1 -1
  37. package/dist/components/table.js +1 -1
  38. package/dist/components/toast.d.ts +1 -1
  39. package/dist/components/toolbar.d.ts +1 -1
  40. package/dist/form.d.ts +207 -0
  41. package/dist/form.js +317 -0
  42. package/dist/hotkeys.d.ts +135 -0
  43. package/dist/hotkeys.js +203 -0
  44. package/dist/index-9LwQy84o.d.ts +1 -0
  45. package/dist/index-B7iG0qDU.d.ts +1 -0
  46. package/dist/{index-B6JNUfG9.d.ts → index-BMXHK-3k.d.ts} +2 -2
  47. package/dist/{index-B6Wo_iiN.d.ts → index-B_ug9XY7.d.ts} +1 -1
  48. package/dist/{index-RP_rt8vB.d.ts → index-Bh9kuAvN.d.ts} +1 -1
  49. package/dist/{index-DjSGDESy.d.ts → index-CAUjUp2G.d.ts} +1 -1
  50. package/dist/{index-NnHba-T1.d.ts → index-DK28YxxP.d.ts} +2 -2
  51. package/dist/{index-aahL-0Zw.d.ts → index-DOVlARA6.d.ts} +2 -2
  52. package/dist/index-DTj6M6kA.d.ts +1 -0
  53. package/dist/index.d.ts +14 -12
  54. package/dist/index.js +5 -6
  55. package/dist/{input-group-8gEtPiKw.d.ts → input-group-Swzit45o.d.ts} +1 -1
  56. package/dist/link-CoVXE5W2.d.ts +68 -0
  57. package/dist/query.d.ts +156 -0
  58. package/dist/query.js +204 -0
  59. package/dist/router.d.ts +95 -0
  60. package/dist/router.js +146 -0
  61. package/dist/skeleton.d.ts +3 -0
  62. package/dist/skeleton.js +4 -0
  63. package/dist/styles/kumo-binding.css +36 -0
  64. package/dist/styles/kumo-standalone.css +1 -1
  65. package/dist/styles/theme-fldr.css +18 -18
  66. package/dist/table.d.ts +245 -0
  67. package/dist/table.js +3 -0
  68. package/dist/theming.d.ts +4 -4
  69. package/dist/theming.js +2 -2
  70. package/package.json +46 -1
  71. package/dist/chunks/highlighter-mouttug0tu8xg1i8.js +0 -1364
  72. package/dist/index-DL1-uSuH.d.ts +0 -1
  73. /package/dist/{index-BkTAB4wj.d.ts → sidebar-BkTAB4wj.d.ts} +0 -0
@@ -0,0 +1,448 @@
1
+ "use client";
2
+ import { t as cn } from "./vendor-styling-gs32v7xt5znc8kg0.js";
3
+ import { t as Button } from "./button-hzvowfkbathmx8yg.js";
4
+ import { t as Checkbox } from "./checkbox-d5epe4dl78bzy4f8.js";
5
+ import { t as InputGroup } from "./input-group-h9fepskc84e1h11n.js";
6
+ import { t as DropdownMenu } from "./dropdown-oec4g1w9kbsjsg15.js";
7
+ import { t as Pagination } from "./pagination-n96r3xdok9nc3pu5.js";
8
+ import { r as Table } from "./table-bdye068ekayq3u1n.js";
9
+ import { SkeletonBox } from "../skeleton.js";
10
+ import { useRef, useState } from "react";
11
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
+ import { CaretDownIcon, CaretUpIcon, MagnifyingGlassIcon, SlidersHorizontalIcon, XIcon } from "@phosphor-icons/react";
13
+ import { columnFilteringFeature, columnVisibilityFeature, createColumnHelper, createFilteredRowModel, createPaginatedRowModel, createSortedRowModel, filterFn_includesString, functionalUpdate, globalFilteringFeature, metaHelper, rowPaginationFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_basic, sortFn_datetime, sortFn_text, tableFeatures, useTable } from "@tanstack/react-table";
14
+ import { useVirtualizer } from "@tanstack/react-virtual";
15
+ import { useDebouncer } from "@tanstack/react-pacer";
16
+ //#region src/table/data-table.tsx
17
+ /** The TanStack features every DataTable registers. */
18
+ const dataTableFeatures = tableFeatures({
19
+ rowSortingFeature,
20
+ sortedRowModel: createSortedRowModel(),
21
+ sortFns: {
22
+ alphanumeric: sortFn_alphanumeric,
23
+ basic: sortFn_basic,
24
+ datetime: sortFn_datetime,
25
+ text: sortFn_text
26
+ },
27
+ rowSelectionFeature,
28
+ columnVisibilityFeature,
29
+ columnFilteringFeature,
30
+ globalFilteringFeature,
31
+ filteredRowModel: createFilteredRowModel(),
32
+ filterFns: { includesString: filterFn_includesString },
33
+ rowPaginationFeature,
34
+ paginatedRowModel: createPaginatedRowModel(),
35
+ columnMeta: metaHelper()
36
+ });
37
+ /**
38
+ * Column helper bound to DataTable's features, so apps only pass the row type.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const col = createColumnHelper<Receipt>();
43
+ * const columns = col.columns([
44
+ * selectColumn<Receipt>(),
45
+ * col.accessor("vendor", { header: "Vendor" }),
46
+ * ]);
47
+ * ```
48
+ */
49
+ function createColumnHelper$1() {
50
+ return createColumnHelper();
51
+ }
52
+ /**
53
+ * Creates a table instance with DataTable's features. Use it when you need the
54
+ * instance yourself (toolbar, controlled state, server data); otherwise pass
55
+ * `columns` and `data` straight to `DataTable`.
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * const table = useDataTable({ columns, data, getRowId: (r) => r.id, pageSize: 50 });
60
+ * return <DataTable table={table} />;
61
+ * ```
62
+ */
63
+ function useDataTable({ pageSize, ...options }) {
64
+ return useTable({
65
+ features: dataTableFeatures,
66
+ globalFilterFn: "includesString",
67
+ manualPagination: pageSize === void 0,
68
+ ...options,
69
+ initialState: {
70
+ ...pageSize !== void 0 && { pagination: {
71
+ pageIndex: 0,
72
+ pageSize
73
+ } },
74
+ ...options.initialState
75
+ }
76
+ });
77
+ }
78
+ const CHECKBOX_HIT_AREA = "relative before:absolute before:-inset-3 before:content-['']";
79
+ /**
80
+ * Checkbox column for row selection: a select-all box in the header and one
81
+ * per row. Clicks on it never reach `onRowClick`.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const columns = col.columns([selectColumn<Receipt>({ rowLabel: (r) => `Select ${r.vendor}` }), ...]);
86
+ * ```
87
+ */
88
+ function selectColumn({ rowLabel = () => "Select row", allLabel = "Select all rows" } = {}) {
89
+ return {
90
+ id: "select",
91
+ enableSorting: false,
92
+ enableHiding: false,
93
+ enableGlobalFilter: false,
94
+ meta: { className: "w-10 leading-none" },
95
+ header: ({ table }) => /* @__PURE__ */ jsx(Checkbox, {
96
+ "aria-label": allLabel,
97
+ checked: table.getIsAllRowsSelected(),
98
+ indeterminate: table.getIsSomeRowsSelected(),
99
+ onCheckedChange: (checked) => table.toggleAllRowsSelected(checked),
100
+ className: CHECKBOX_HIT_AREA
101
+ }),
102
+ cell: ({ row }) => /* @__PURE__ */ jsx("span", {
103
+ className: "inline-flex",
104
+ onClick: (e) => e.stopPropagation(),
105
+ children: /* @__PURE__ */ jsx(Checkbox, {
106
+ "aria-label": rowLabel(row.original),
107
+ checked: row.getIsSelected(),
108
+ disabled: !row.getCanSelect(),
109
+ onCheckedChange: (checked) => row.toggleSelected(checked),
110
+ className: CHECKBOX_HIT_AREA
111
+ })
112
+ })
113
+ };
114
+ }
115
+ const DEFAULT_LABELS$1 = {
116
+ selected: (count) => `${count} selected`,
117
+ clearSelection: "Clear selection",
118
+ noResults: "No results",
119
+ loading: "Loading"
120
+ };
121
+ const sortAria = (sorted) => sorted === "asc" ? "ascending" : sorted === "desc" ? "descending" : void 0;
122
+ /**
123
+ * DataTable — a TanStack Table rendered with Kumo table styles: sortable
124
+ * headers, row selection with a bulk-action bar, global filter, pagination or
125
+ * virtualization, loading and empty states.
126
+ *
127
+ * Pass `columns` + `data` (plus any table options), or a `table` from
128
+ * `useDataTable` for full control.
129
+ *
130
+ * @example
131
+ * ```tsx
132
+ * <DataTable
133
+ * columns={columns}
134
+ * data={receipts}
135
+ * getRowId={(r) => r.id}
136
+ * toolbar={(table) => <DataTableToolbar table={table} />}
137
+ * bulkActions={(rows) => <Button size="sm">Export {rows.length}</Button>}
138
+ * onRowClick={(row) => open(row.original)}
139
+ * />
140
+ * ```
141
+ */
142
+ function DataTable(props) {
143
+ if (props.table) return /* @__PURE__ */ jsx(DataTableView, {
144
+ ...props,
145
+ table: props.table
146
+ });
147
+ return /* @__PURE__ */ jsx(OwnedDataTable, { ...props });
148
+ }
149
+ function OwnedDataTable({ toolbar, bulkActions, onRowClick, loading, loadingRows, empty, stickyHeader, height, virtualize, pagination, labels, className, table: _table, ...options }) {
150
+ const table = useDataTable(options);
151
+ return /* @__PURE__ */ jsx(DataTableView, {
152
+ table,
153
+ toolbar,
154
+ bulkActions,
155
+ onRowClick,
156
+ loading,
157
+ loadingRows,
158
+ empty,
159
+ stickyHeader,
160
+ height,
161
+ virtualize,
162
+ pagination,
163
+ labels,
164
+ className
165
+ });
166
+ }
167
+ function DataTableView({ table, toolbar, bulkActions, onRowClick, loading, loadingRows = 5, empty, stickyHeader, height, virtualize, pagination, labels: labelsProp, className }) {
168
+ const labels = {
169
+ ...DEFAULT_LABELS$1,
170
+ ...labelsProp
171
+ };
172
+ const scrollRef = useRef(null);
173
+ const rows = table.getRowModel().rows;
174
+ const virtual = virtualize ? {
175
+ estimateSize: 40,
176
+ overscan: 8,
177
+ ...virtualize === true ? {} : virtualize
178
+ } : void 0;
179
+ const scrollHeight = height ?? (virtual ? 480 : void 0);
180
+ const virtualizer = useVirtualizer({
181
+ enabled: !!virtual && !loading,
182
+ count: rows.length,
183
+ getScrollElement: () => scrollRef.current,
184
+ estimateSize: () => virtual?.estimateSize ?? 40,
185
+ overscan: virtual?.overscan ?? 8,
186
+ getItemKey: (index) => rows[index]?.id ?? index,
187
+ initialRect: {
188
+ width: 0,
189
+ height: typeof scrollHeight === "number" ? scrollHeight : 480
190
+ }
191
+ });
192
+ const items = virtual ? virtualizer.getVirtualItems() : [];
193
+ const visibleRows = virtual ? items.map((item) => rows[item.index]) : rows;
194
+ const padTop = virtual ? items[0]?.start ?? 0 : 0;
195
+ const padBottom = virtual ? virtualizer.getTotalSize() - (items.at(-1)?.end ?? 0) : 0;
196
+ const columnCount = table.getVisibleLeafColumns().length;
197
+ const selectedCount = table.getSelectedRowIds().length;
198
+ const showPagination = !virtual && (pagination ?? (!table.options.manualPagination || table.options.rowCount !== void 0));
199
+ const { pageIndex, pageSize } = table.state.pagination;
200
+ const bulk = typeof bulkActions === "function" ? bulkActions(table.getSelectedRowModel().rows, table) : bulkActions;
201
+ return /* @__PURE__ */ jsxs("div", {
202
+ className: cn("w-full", className),
203
+ children: [
204
+ toolbar?.(table),
205
+ selectedCount > 0 && /* @__PURE__ */ jsxs("div", {
206
+ role: "toolbar",
207
+ "aria-label": labels.selected(selectedCount),
208
+ className: "flex items-center gap-2 bg-kumo-tint px-3 py-1.5",
209
+ children: [/* @__PURE__ */ jsx("span", {
210
+ className: "text-sm font-medium text-kumo-default",
211
+ children: labels.selected(selectedCount)
212
+ }), /* @__PURE__ */ jsxs("div", {
213
+ className: "ml-auto flex items-center gap-1.5",
214
+ children: [bulk, /* @__PURE__ */ jsx(Button, {
215
+ variant: "ghost",
216
+ size: "sm",
217
+ shape: "square",
218
+ icon: /* @__PURE__ */ jsx(XIcon, {}),
219
+ "aria-label": labels.clearSelection,
220
+ onClick: () => table.setRowSelection({})
221
+ })]
222
+ })]
223
+ }),
224
+ /* @__PURE__ */ jsx("div", {
225
+ ref: scrollRef,
226
+ className: cn(scrollHeight !== void 0 && "overflow-auto"),
227
+ style: { height: scrollHeight },
228
+ children: /* @__PURE__ */ jsxs(Table, {
229
+ "aria-busy": loading || void 0,
230
+ children: [/* @__PURE__ */ jsx(Table.Header, {
231
+ variant: "compact",
232
+ sticky: stickyHeader || !!virtual || void 0,
233
+ children: table.getHeaderGroups().map((group) => /* @__PURE__ */ jsx(Table.Row, { children: group.headers.map((header) => {
234
+ const { column } = header;
235
+ const meta = column.columnDef.meta;
236
+ const sorted = column.getIsSorted();
237
+ const Caret = sorted === "desc" ? CaretDownIcon : CaretUpIcon;
238
+ const content = header.isPlaceholder ? null : /* @__PURE__ */ jsx(table.FlexRender, { header });
239
+ return /* @__PURE__ */ jsx(Table.Head, {
240
+ colSpan: header.colSpan,
241
+ "aria-sort": sortAria(sorted),
242
+ className: cn("font-medium", meta?.className, meta?.headerClassName),
243
+ children: column.getCanSort() && !header.isPlaceholder ? /* @__PURE__ */ jsxs("button", {
244
+ type: "button",
245
+ className: "inline-flex cursor-pointer items-center gap-1 text-kumo-subtle hover:text-kumo-default",
246
+ onClick: column.getToggleSortingHandler(),
247
+ children: [content, sorted && /* @__PURE__ */ jsx(Caret, {
248
+ size: 12,
249
+ weight: "bold",
250
+ "aria-hidden": true
251
+ })]
252
+ }) : content
253
+ }, header.id);
254
+ }) }, group.id))
255
+ }), /* @__PURE__ */ jsx(Table.Body, { children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsx(Table.Row, {
256
+ className: ROW,
257
+ "aria-label": labels.loading,
258
+ children: Array.from({ length: columnCount }, (_, j) => /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(SkeletonBox, {
259
+ width: "60%",
260
+ height: "0.75em"
261
+ }) }, j))
262
+ }, i)) : rows.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
263
+ colSpan: columnCount,
264
+ className: "py-8 text-center text-kumo-subtle",
265
+ children: empty ?? labels.noResults
266
+ }) }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
267
+ padTop > 0 && /* @__PURE__ */ jsx("tr", {
268
+ "aria-hidden": true,
269
+ style: { height: padTop }
270
+ }),
271
+ visibleRows.map((row) => {
272
+ const isSelected = row.getIsSelected();
273
+ return /* @__PURE__ */ jsx(Table.Row, {
274
+ variant: isSelected ? "selected" : "default",
275
+ "aria-selected": isSelected || void 0,
276
+ className: cn(ROW, !isSelected && "even:bg-kumo-base hover:bg-kumo-tint even:hover:bg-kumo-tint", onRowClick && "cursor-pointer"),
277
+ style: virtual ? { height: virtual.estimateSize } : void 0,
278
+ onClick: onRowClick && (() => onRowClick(row)),
279
+ children: row.getVisibleCells().map((cell) => {
280
+ const meta = cell.column.columnDef.meta;
281
+ return /* @__PURE__ */ jsx(Table.Cell, {
282
+ className: cn(meta?.className, meta?.cellClassName),
283
+ children: /* @__PURE__ */ jsx(table.FlexRender, { cell })
284
+ }, cell.id);
285
+ })
286
+ }, row.id);
287
+ }),
288
+ padBottom > 0 && /* @__PURE__ */ jsx("tr", {
289
+ "aria-hidden": true,
290
+ style: { height: padBottom }
291
+ })
292
+ ] }) })]
293
+ })
294
+ }),
295
+ showPagination && !loading && /* @__PURE__ */ jsxs(Pagination, {
296
+ page: pageIndex + 1,
297
+ setPage: (page) => table.setPageIndex(page - 1),
298
+ perPage: pageSize,
299
+ totalCount: table.getRowCount(),
300
+ className: "px-3 py-2",
301
+ children: [/* @__PURE__ */ jsx(Pagination.Info, {}), /* @__PURE__ */ jsx(Pagination.Controls, {})]
302
+ })
303
+ ]
304
+ });
305
+ }
306
+ /** Hairline divider between body rows; the last row has none. */
307
+ const ROW = "border-b border-kumo-hairline last:border-0";
308
+ //#endregion
309
+ //#region src/table/search-input.tsx
310
+ /**
311
+ * SearchInput — text field with a search icon and clear button that reports
312
+ * its value debounced (via TanStack Pacer). Escape clears it. Works anywhere,
313
+ * not just in tables.
314
+ *
315
+ * @example
316
+ * ```tsx
317
+ * <SearchInput placeholder="Search receipts" onValueChange={setQuery} />
318
+ * ```
319
+ */
320
+ function SearchInput({ value, defaultValue = "", onValueChange, wait = 250, placeholder, "aria-label": ariaLabel, clearLabel = "Clear search", size = "sm", autoFocus, className }) {
321
+ const [text, setText] = useState(value ?? defaultValue);
322
+ const [emitted, setEmitted] = useState(value ?? defaultValue);
323
+ const [prevValue, setPrevValue] = useState(value);
324
+ if (value !== prevValue) {
325
+ setPrevValue(value);
326
+ if (value !== void 0 && value !== emitted) setText(value);
327
+ }
328
+ const emit = (next) => {
329
+ setEmitted(next);
330
+ onValueChange?.(next);
331
+ };
332
+ const debouncer = useDebouncer(emit, { wait });
333
+ const clear = () => {
334
+ debouncer.cancel();
335
+ setText("");
336
+ emit("");
337
+ };
338
+ return /* @__PURE__ */ jsxs(InputGroup, {
339
+ size,
340
+ className,
341
+ children: [
342
+ /* @__PURE__ */ jsx(InputGroup.Addon, { children: /* @__PURE__ */ jsx(MagnifyingGlassIcon, { "aria-hidden": true }) }),
343
+ /* @__PURE__ */ jsx(InputGroup.Input, {
344
+ role: "searchbox",
345
+ enterKeyHint: "search",
346
+ autoFocus,
347
+ value: text,
348
+ placeholder,
349
+ "aria-label": ariaLabel ?? placeholder ?? "Search",
350
+ onChange: (e) => {
351
+ setText(e.target.value);
352
+ debouncer.maybeExecute(e.target.value);
353
+ },
354
+ onKeyDown: (e) => {
355
+ if (e.key === "Escape" && text) {
356
+ e.preventDefault();
357
+ clear();
358
+ }
359
+ }
360
+ }),
361
+ text && /* @__PURE__ */ jsx(InputGroup.Addon, {
362
+ align: "end",
363
+ children: /* @__PURE__ */ jsx(InputGroup.Button, {
364
+ variant: "ghost",
365
+ shape: "square",
366
+ "aria-label": clearLabel,
367
+ icon: /* @__PURE__ */ jsx(XIcon, {}),
368
+ onClick: clear
369
+ })
370
+ })
371
+ ]
372
+ });
373
+ }
374
+ //#endregion
375
+ //#region src/table/toolbar.tsx
376
+ const DEFAULT_LABELS = {
377
+ search: "Search",
378
+ columns: "Columns"
379
+ };
380
+ /**
381
+ * DataTableToolbar — global search, column visibility menu and a slot for
382
+ * actions, wired to a DataTable instance.
383
+ *
384
+ * @example
385
+ * ```tsx
386
+ * <DataTable
387
+ * columns={columns}
388
+ * data={data}
389
+ * toolbar={(table) => (
390
+ * <DataTableToolbar table={table}>
391
+ * <Button size="sm">New folder</Button>
392
+ * </DataTableToolbar>
393
+ * )}
394
+ * />
395
+ * ```
396
+ */
397
+ function DataTableToolbar({ table, search = true, columnVisibility = true, children, labels: labelsProp, className }) {
398
+ const labels = {
399
+ ...DEFAULT_LABELS,
400
+ ...labelsProp
401
+ };
402
+ const globalFilter = table.state.globalFilter;
403
+ return /* @__PURE__ */ jsxs("div", {
404
+ className: cn("flex items-center gap-2 py-2", className),
405
+ children: [search && /* @__PURE__ */ jsx(SearchInput, {
406
+ placeholder: labels.search,
407
+ value: typeof globalFilter === "string" ? globalFilter : "",
408
+ onValueChange: (value) => table.setGlobalFilter(value),
409
+ className: "max-w-xs"
410
+ }), /* @__PURE__ */ jsxs("div", {
411
+ className: "ml-auto flex items-center gap-1.5",
412
+ children: [children, columnVisibility && /* @__PURE__ */ jsx(ColumnVisibilityMenu, {
413
+ table,
414
+ label: labels.columns
415
+ })]
416
+ })]
417
+ });
418
+ }
419
+ /**
420
+ * Dropdown of checkbox items that show and hide a table's hideable columns.
421
+ *
422
+ * @example
423
+ * ```tsx
424
+ * <ColumnVisibilityMenu table={table} label="Columns" />
425
+ * ```
426
+ */
427
+ function ColumnVisibilityMenu({ table, label = DEFAULT_LABELS.columns }) {
428
+ const columns = table.getAllLeafColumns().filter((c) => c.getCanHide());
429
+ if (columns.length === 0) return null;
430
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenu.Trigger, { render: /* @__PURE__ */ jsx(Button, {
431
+ variant: "ghost",
432
+ size: "sm",
433
+ icon: /* @__PURE__ */ jsx(SlidersHorizontalIcon, {}),
434
+ children: label
435
+ }) }), /* @__PURE__ */ jsx(DropdownMenu.Content, {
436
+ align: "end",
437
+ children: columns.map((column) => {
438
+ const { header, meta } = column.columnDef;
439
+ return /* @__PURE__ */ jsx(DropdownMenu.CheckboxItem, {
440
+ checked: column.getIsVisible(),
441
+ onCheckedChange: (visible) => column.toggleVisibility(visible),
442
+ children: meta?.label ?? (typeof header === "string" ? header : column.id)
443
+ }, column.id);
444
+ })
445
+ })] });
446
+ }
447
+ //#endregion
448
+ export { DataTable as a, selectColumn as c, SearchInput as i, useDataTable as l, ColumnVisibilityMenu as n, createColumnHelper$1 as o, DataTableToolbar as r, dataTableFeatures as s, functionalUpdate as t };
@@ -24,7 +24,7 @@ const TableOfContentsRoot = forwardRef(({ className, "aria-label": ariaLabel = "
24
24
  }));
25
25
  const TableOfContentsTitle = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", {
26
26
  ref,
27
- className: cn("mb-3 text-xs font-semibold tracking-wide text-kumo-subtle uppercase", className),
27
+ className: cn("mb-2 text-sm text-kumo-subtle", className),
28
28
  ...props
29
29
  }));
30
30
  const TableOfContentsList = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("ul", {
@@ -1,4 +1,4 @@
1
- import { n as normalizeLanguage, t as highlightCode } from "../chunks/highlighter-mouttug0tu8xg1i8.js";
1
+ import { n as normalizeLanguage, t as highlightCode } from "../chunks/highlighter-kb7huz24pcziin6d.js";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/code/server.tsx
4
4
  function CodeBlock({ html, className }) {
package/dist/code.js CHANGED
@@ -2,9 +2,12 @@
2
2
  import { t as cn } from "./chunks/vendor-styling-gs32v7xt5znc8kg0.js";
3
3
  import { t as Button } from "./chunks/button-hzvowfkbathmx8yg.js";
4
4
  import { t as useCopyFeedback } from "./chunks/use-copy-feedback-gl55ghst0csvpv4j.js";
5
- import { n as normalizeLanguage, t as highlightCode } from "./chunks/highlighter-mouttug0tu8xg1i8.js";
5
+ import { n as normalizeLanguage, t as highlightCode } from "./chunks/highlighter-kb7huz24pcziin6d.js";
6
6
  import { useCallback, useMemo } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { createThemeCss } from "@tanstack/highlight/theme";
9
+ import { githubDarkTheme } from "@tanstack/highlight/themes/github-dark";
10
+ import { githubLightTheme } from "@tanstack/highlight/themes/github-light";
8
11
  //#region src/code/code-highlighted.tsx
9
12
  /**
10
13
  * Syntax-highlighted code block, powered by TanStack Highlight.
@@ -68,136 +71,6 @@ function CodeHighlighted({ code, lang, variant = "default", showLineNumbers = fa
68
71
  }
69
72
  CodeHighlighted.displayName = "CodeHighlighted";
70
73
  //#endregion
71
- //#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/theme.js
72
- const themeTokenClasses = [
73
- "token",
74
- "attr",
75
- "code-inline",
76
- "command",
77
- "comment",
78
- "deleted",
79
- "function",
80
- "heading",
81
- "inserted",
82
- "keyword",
83
- "link",
84
- "literal",
85
- "meta",
86
- "number",
87
- "operator",
88
- "property",
89
- "selector",
90
- "string",
91
- "tag",
92
- "type",
93
- "variable"
94
- ];
95
- function createThemeCss(options) {
96
- const themeCss = (options.themes || [...options.light ? [{
97
- selector: options.lightSelector || ":root",
98
- theme: options.light
99
- }] : [], ...options.dark ? [{
100
- selector: options.darkSelector || ".dark",
101
- theme: options.dark
102
- }] : []]).map(({ selector, theme }) => createThemeRule(selector, theme)).join("\n\n");
103
- if (options.includeBaseStyles === false) return themeCss;
104
- return `${themeCss}\n\n${createThemeBaseCss(options)}`;
105
- }
106
- function createThemeRule(selector, theme) {
107
- return `${selector} {
108
- ${[
109
- ` --th-background: ${theme.background};`,
110
- ` --th-token: ${theme.tokens.token || theme.foreground};`,
111
- ...themeTokenClasses.filter((className) => className !== "token").map((className) => ` --th-${className}: ${theme.tokens[className]};`)
112
- ].join("\n")}
113
- }`;
114
- }
115
- function createThemeBaseCss(options = {}) {
116
- const codeBlockSelector = options.codeBlockSelector || "pre.th-code";
117
- const lineNumbersSelector = options.lineNumbersSelector || ".th-code--line-numbers";
118
- return `${codeBlockSelector} {
119
- overflow-x: auto;
120
- padding: 1rem;
121
- background: var(--th-background);
122
- color: var(--th-token);
123
- }
124
-
125
- ${themeTokenClasses.map((token) => `.th-${token} { color: var(--th-${token}); }`).join("\n")}
126
- .th-line { display: inline-block; min-width: 100%; width: max-content; }
127
- ${lineNumbersSelector} code { counter-reset: th-line; }
128
- ${lineNumbersSelector} .th-line::before {
129
- display: inline-block;
130
- width: 2.5em;
131
- padding-right: 1em;
132
- color: var(--th-comment);
133
- content: attr(data-line);
134
- text-align: right;
135
- user-select: none;
136
- }`;
137
- }
138
- //#endregion
139
- //#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/themes/github-dark.js
140
- const githubDarkTheme = {
141
- background: "#0d1117",
142
- foreground: "#c9d1d9",
143
- name: "github-dark",
144
- type: "dark",
145
- tokens: {
146
- attr: "#79c0ff",
147
- "code-inline": "#ffa657",
148
- command: "#d2a8ff",
149
- comment: "#8b949e",
150
- deleted: "#ff7b72",
151
- function: "#d2a8ff",
152
- heading: "#79c0ff",
153
- inserted: "#7ee787",
154
- keyword: "#ff7b72",
155
- link: "#58a6ff",
156
- literal: "#79c0ff",
157
- meta: "#8b949e",
158
- number: "#79c0ff",
159
- operator: "#d2a8ff",
160
- property: "#79c0ff",
161
- selector: "#7ee787",
162
- string: "#a5d6ff",
163
- tag: "#7ee787",
164
- token: "#c9d1d9",
165
- type: "#ffa657",
166
- variable: "#ffa657"
167
- }
168
- };
169
- //#endregion
170
- //#region ../../node_modules/.pnpm/@tanstack+highlight@1.2.12/node_modules/@tanstack/highlight/dist/themes/github-light.js
171
- const githubLightTheme = {
172
- background: "#ffffff",
173
- foreground: "#24292f",
174
- name: "github-light",
175
- type: "light",
176
- tokens: {
177
- attr: "#0550ae",
178
- "code-inline": "#953800",
179
- command: "#8250df",
180
- comment: "#6e7781",
181
- deleted: "#cf222e",
182
- function: "#8250df",
183
- heading: "#0550ae",
184
- inserted: "#1a7f37",
185
- keyword: "#cf222e",
186
- link: "#0969da",
187
- literal: "#0550ae",
188
- meta: "#57606a",
189
- number: "#0550ae",
190
- operator: "#8250df",
191
- property: "#0550ae",
192
- selector: "#116329",
193
- string: "#0a7f64",
194
- tag: "#116329",
195
- token: "#24292f",
196
- type: "#953800",
197
- variable: "#953800"
198
- }
199
- };
200
- //#endregion
201
74
  //#region src/code/theme.ts
202
75
  /**
203
76
  * CSS for code token colors, switched by Kumo's `data-mode`. Pass other
@@ -1,2 +1,2 @@
1
- import { n as BannerVariant, t as Banner } from "../index-NnHba-T1.js";
1
+ import { n as BannerVariant, t as Banner } from "../index-DK28YxxP.js";
2
2
  export { Banner, BannerVariant };
@@ -1,3 +1,3 @@
1
- import { a as LinkButtonProps, i as LinkButton, n as ButtonProps, o as RefreshButton, s as buttonVariants, t as Button } from "../button-DzavLWXm.js";
2
- import "../index-DL1-uSuH.js";
1
+ import { a as LinkButton, c as buttonVariants, n as ButtonProps, o as LinkButtonProps, s as RefreshButton, t as Button } from "../button-CS82eT0x.js";
2
+ import "../index-9LwQy84o.js";
3
3
  export { Button, type ButtonProps, LinkButton, type LinkButtonProps, RefreshButton, buttonVariants };
@@ -1,2 +1,2 @@
1
- import { a as CheckboxLegendProps, c as KUMO_CHECKBOX_DEFAULT_VARIANTS, i as CheckboxItemProps, l as KUMO_CHECKBOX_VARIANTS, n as CheckboxChangeEventDetails, o as CheckboxProps, r as CheckboxGroupProps, s as CheckboxVariant, t as Checkbox, u as KumoCheckboxVariant } from "../index-DjSGDESy.js";
1
+ import { a as CheckboxLegendProps, c as KUMO_CHECKBOX_DEFAULT_VARIANTS, i as CheckboxItemProps, l as KUMO_CHECKBOX_VARIANTS, n as CheckboxChangeEventDetails, o as CheckboxProps, r as CheckboxGroupProps, s as CheckboxVariant, t as Checkbox, u as KumoCheckboxVariant } from "../index-CAUjUp2G.js";
2
2
  export { Checkbox, type CheckboxChangeEventDetails, type CheckboxGroupProps, type CheckboxItemProps, type CheckboxLegendProps, type CheckboxProps, type CheckboxVariant, KUMO_CHECKBOX_DEFAULT_VARIANTS, KUMO_CHECKBOX_VARIANTS, type KumoCheckboxVariant };
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import { n as KUMO_CHECKBOX_DEFAULT_VARIANTS, r as KUMO_CHECKBOX_VARIANTS, t as Checkbox } from "../chunks/checkbox-eifiwbw34xwsikvf.js";
2
+ import { n as KUMO_CHECKBOX_DEFAULT_VARIANTS, r as KUMO_CHECKBOX_VARIANTS, t as Checkbox } from "../chunks/checkbox-d5epe4dl78bzy4f8.js";
3
3
  export { Checkbox, KUMO_CHECKBOX_DEFAULT_VARIANTS, KUMO_CHECKBOX_VARIANTS };
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import { t as DropdownMenu } from "../chunks/dropdown-e5zk0ez21busnt0b.js";
2
+ import { t as DropdownMenu } from "../chunks/dropdown-oec4g1w9kbsjsg15.js";
3
3
  export { DropdownMenu };
@@ -1,2 +1,3 @@
1
- import { a as InputGroupSuffixProps, c as InputGroupInputProps, i as InputGroupRootProps, n as KUMO_INPUT_GROUP_DEFAULT_VARIANTS, o as InputGroupAddonProps, r as KUMO_INPUT_GROUP_VARIANTS, s as InputGroupButtonProps, t as InputGroup } from "../input-group-8gEtPiKw.js";
1
+ import { a as InputGroupSuffixProps, c as InputGroupInputProps, i as InputGroupRootProps, n as KUMO_INPUT_GROUP_DEFAULT_VARIANTS, o as InputGroupAddonProps, r as KUMO_INPUT_GROUP_VARIANTS, s as InputGroupButtonProps, t as InputGroup } from "../input-group-Swzit45o.js";
2
+ import "../index-B7iG0qDU.js";
2
3
  export { InputGroup, type InputGroupAddonProps, type InputGroupButtonProps, type InputGroupInputProps, type InputGroupRootProps, type InputGroupSuffixProps, KUMO_INPUT_GROUP_DEFAULT_VARIANTS, KUMO_INPUT_GROUP_VARIANTS };
@@ -1,4 +1,4 @@
1
1
  import { a as inputVariants, n as InputProps, t as Input } from "../input-BeWEb-jD.js";
2
- import { n as KUMO_INPUT_GROUP_DEFAULT_VARIANTS, r as KUMO_INPUT_GROUP_VARIANTS, t as InputGroup } from "../input-group-8gEtPiKw.js";
3
- import { a as Textarea, i as InputAreaProps, n as KumoInputGroupVariantsProps, r as InputArea, t as KumoInputGroupFocusMode } from "../index-B6Wo_iiN.js";
2
+ import { n as KUMO_INPUT_GROUP_DEFAULT_VARIANTS, r as KUMO_INPUT_GROUP_VARIANTS, t as InputGroup } from "../input-group-Swzit45o.js";
3
+ import { a as Textarea, i as InputAreaProps, n as KumoInputGroupVariantsProps, r as InputArea, t as KumoInputGroupFocusMode } from "../index-B_ug9XY7.js";
4
4
  export { Input, InputArea, type InputAreaProps, InputGroup, type InputProps, KUMO_INPUT_GROUP_DEFAULT_VARIANTS, KUMO_INPUT_GROUP_VARIANTS, KumoInputGroupFocusMode, KumoInputGroupVariantsProps, Textarea, inputVariants };
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import { t as LayerDialog } from "../chunks/layer-dialog-m8qb0wzfg3k7406a.js";
2
+ import { t as LayerDialog } from "../chunks/layer-dialog-ioa3r4ayemppsspx.js";
3
3
  export { LayerDialog };