@alexgorbatchev/shadcn 0.0.45 → 0.0.46
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 +6 -0
- package/dist/{chunk-pp0qdx0f.js → chunk-0qgd06td.js} +6 -2
- package/dist/{chunk-9w9berq8.js → chunk-caz81rnv.js} +9 -2
- package/dist/{chunk-k455qwx2.js → chunk-dy4ghe9p.js} +1 -1
- package/dist/{chunk-55s7v2mw.js → chunk-mqea74ex.js} +1 -1
- package/dist/components/PageHeader.d.ts +3 -1
- package/dist/components/assistant-ui/elements/OptionList.js +2 -2
- package/dist/components/assistant-ui/elements/QuestionFlow.js +3 -3
- package/dist/components/assistant-ui/index.js +3 -3
- package/dist/components/data-grid/DataGridSelectCell.d.ts +12 -0
- package/dist/components/data-grid/DataGridSelectHeader.d.ts +8 -0
- package/dist/components/data-grid/index.d.ts +4 -0
- package/dist/components/data-grid/index.js +53 -1
- package/dist/components/event-calendar/index.js +1 -1
- package/dist/components/json-render/index.js +2 -2
- package/dist/components/tree/TreeItem.d.ts +9 -1
- package/dist/components/tree/index.js +75 -22
- package/dist/index.js +2 -2
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/DataGrid.md +10 -2
- package/llms/components/data-display/DataGridSelectCell.md +28 -0
- package/llms/components/data-display/DataGridSelectHeader.md +36 -0
- package/llms/components/forms/Checkbox.md +15 -0
- package/llms/components/layout/PageHeader.md +25 -0
- package/llms/components/navigation/Tree.md +16 -0
- package/llms/setup.md +6 -0
- package/llms.txt +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -368,6 +368,12 @@ Compose `QuestionnaireItem`, `QuestionnaireTitle`, and answer controls inside `Q
|
|
|
368
368
|
|
|
369
369
|
Column `meta.filter` offers a column in `DataGridFilters`, hidden columns included. A `range` filter edits `[min, max]` bounds, `null` for an open end, for `filterFn: "inNumberRange"`; its inputs suggest the range of the rows the other filters leave, formatted through the filter's `Intl.NumberFormatOptions`. An `options` filter chooses among labelled string values, one or several, listed in its `options` or, when they depend on runtime data, in the `options` prop of `DataGridFilters` and `DataGridFilterSummary` keyed by column ID, for `filterFn: "arrHas"` (one value per row), `"arrIncludesSome"` (an array per row), or a custom `filterFn`; each option counts the rows the other filters leave with that value, so a column whose rows hold several values or values in another form supplies them through `getUniqueValues`. Column filters combine with each other and with the global filter. `DataGridFilterSummary` lists the active filters with buttons that remove them, and both controls clear every column filter at once.
|
|
370
370
|
|
|
371
|
+
Import `DataGridSelectHeader` and `DataGridSelectCell` from `@alexgorbatchev/shadcn/data-grid`. Pass the current `useTable` result as `table` to both controls, and pass `row` and an accessible `label` to each cell. The header selects selectable filtered rows across all pages and preserves selections hidden by filters. It shows a mixed state when some of those rows are selected and disables itself when none are selectable. Its default label is "Select all filtered rows"; provide `label` to name the scope in your application. Cells follow native row selection rules, including disabled rows and partially selected parents. The controls observe selection changes without requiring the parent table selector to include selection state.
|
|
372
|
+
|
|
373
|
+
`TreeItem linkProps` places the registered tree item, roving focus, and native drag handlers on an anchor. Pass `href` and anchor events directly, or compose a router link through `linkProps.render`. The outer `render` and `ref` remain available for row overlays; disclosure and `endEnhancer` controls remain siblings of the link. Enter and modified clicks retain native link behavior, while tree arrows retain navigation and expansion behavior. Optional `dropHint={{ content, open, side }}` displays caller-controlled drag feedback without adding a focus target.
|
|
374
|
+
|
|
375
|
+
`PageHeader` accepts an optional `eyebrow` above its single page title. It accepts any React content without introducing another heading. Breadcrumbs, description, actions, and density remain independent slots; long action content wraps within narrow layouts.
|
|
376
|
+
|
|
371
377
|
`StarRating` takes a controlled numeric `value` from 0 to 5, `onValueChange`, and an accessible `label`. Its native radio buttons support keyboard selection and an Unrated option to clear the rating. Set `disabled` while saving. `Avatar shape="square"` displays square artwork with matching image, fallback, and border corners.
|
|
372
378
|
|
|
373
379
|
`DialogContent size="wide"` uses a desktop maximum width of 576px; `size="narrow"` uses 192px, and the default uses 384px. Dialogs remain bounded by the viewport. `FieldGroup columns={2}` arranges fields in two columns on desktop and one on mobile.
|
|
@@ -3140,7 +3140,7 @@ function AppShell2({
|
|
|
3140
3140
|
}
|
|
3141
3141
|
// src/components/PageHeader.tsx
|
|
3142
3142
|
import { jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3143
|
-
function PageHeader2({ title, description, breadcrumbs, actions, density }) {
|
|
3143
|
+
function PageHeader2({ title, eyebrow, description, breadcrumbs, actions, density }) {
|
|
3144
3144
|
return /* @__PURE__ */ jsxs19("header", {
|
|
3145
3145
|
"data-density": density,
|
|
3146
3146
|
"data-slot": "page-header",
|
|
@@ -3154,6 +3154,10 @@ function PageHeader2({ title, description, breadcrumbs, actions, density }) {
|
|
|
3154
3154
|
/* @__PURE__ */ jsxs19("div", {
|
|
3155
3155
|
className: "min-w-0",
|
|
3156
3156
|
children: [
|
|
3157
|
+
eyebrow != null && /* @__PURE__ */ jsx32("div", {
|
|
3158
|
+
className: "mb-2 text-xs font-medium tracking-widest text-muted-foreground",
|
|
3159
|
+
children: eyebrow
|
|
3160
|
+
}),
|
|
3157
3161
|
/* @__PURE__ */ jsx32("h1", {
|
|
3158
3162
|
className: "text-xl font-semibold text-foreground",
|
|
3159
3163
|
children: title
|
|
@@ -3165,7 +3169,7 @@ function PageHeader2({ title, description, breadcrumbs, actions, density }) {
|
|
|
3165
3169
|
]
|
|
3166
3170
|
}),
|
|
3167
3171
|
actions && /* @__PURE__ */ jsx32("div", {
|
|
3168
|
-
className: "flex
|
|
3172
|
+
className: "flex min-w-0 max-w-full flex-wrap items-center gap-control-gap wrap-anywhere",
|
|
3169
3173
|
children: actions
|
|
3170
3174
|
})
|
|
3171
3175
|
]
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
|
|
8
8
|
// src/components/Checkbox.tsx
|
|
9
9
|
import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
|
|
10
|
-
import { CheckIcon } from "lucide-react";
|
|
10
|
+
import { CheckIcon, MinusIcon } from "lucide-react";
|
|
11
11
|
import { jsx } from "react/jsx-runtime";
|
|
12
12
|
function Checkbox2({ analytics, density, className, ...props }) {
|
|
13
13
|
const trackedOnCheckedChange = useAnalyticsCallback("Checkbox", analytics, { name: "ui.change-request" }, props.onCheckedChange);
|
|
@@ -20,7 +20,14 @@ function Checkbox2({ analytics, density, className, ...props }) {
|
|
|
20
20
|
children: /* @__PURE__ */ jsx(CheckboxPrimitive.Indicator, {
|
|
21
21
|
"data-slot": "checkbox-indicator",
|
|
22
22
|
className: "grid place-content-center text-current transition-none [&>svg]:size-3.5",
|
|
23
|
-
|
|
23
|
+
render: (indicatorProps, state) => /* @__PURE__ */ jsx("span", {
|
|
24
|
+
...indicatorProps,
|
|
25
|
+
children: state.indeterminate ? /* @__PURE__ */ jsx(MinusIcon, {
|
|
26
|
+
"data-slot": "checkbox-mixed-indicator"
|
|
27
|
+
}) : /* @__PURE__ */ jsx(CheckIcon, {
|
|
28
|
+
"data-slot": "checkbox-checked-indicator"
|
|
29
|
+
})
|
|
30
|
+
})
|
|
24
31
|
})
|
|
25
32
|
});
|
|
26
33
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-vxvaaptq.js";
|
|
7
7
|
import {
|
|
8
8
|
OptionList2
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-dy4ghe9p.js";
|
|
10
10
|
|
|
11
11
|
// src/components/assistant-ui/elements/QuestionFlow.tsx
|
|
12
12
|
import { useCallback, useId, useLayoutEffect, useRef, useState } from "react";
|
|
@@ -2,10 +2,12 @@ import type { ReactElement, ReactNode } from "react";
|
|
|
2
2
|
import type { IDensityProps } from "../density/types.js";
|
|
3
3
|
type PageHeaderProps = IDensityProps & {
|
|
4
4
|
title: string;
|
|
5
|
+
/** Context above the page title without introducing another heading. */
|
|
6
|
+
eyebrow?: ReactNode;
|
|
5
7
|
description?: ReactNode;
|
|
6
8
|
breadcrumbs?: ReactNode;
|
|
7
9
|
actions?: ReactNode;
|
|
8
10
|
};
|
|
9
|
-
declare function PageHeader({ title, description, breadcrumbs, actions, density }: PageHeaderProps): ReactElement;
|
|
11
|
+
declare function PageHeader({ title, eyebrow, description, breadcrumbs, actions, density }: PageHeaderProps): ReactElement;
|
|
10
12
|
export { PageHeader };
|
|
11
13
|
export type { PageHeaderProps };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OptionList2
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-dy4ghe9p.js";
|
|
4
4
|
import"../../../chunk-71efbr5n.js";
|
|
5
5
|
import"../../../chunk-vxvaaptq.js";
|
|
6
6
|
import"../../../chunk-1xncv9gb.js";
|
|
7
|
-
import"../../../chunk-
|
|
7
|
+
import"../../../chunk-caz81rnv.js";
|
|
8
8
|
import"../../../chunk-38301e40.js";
|
|
9
9
|
import"../../../chunk-x90xmrba.js";
|
|
10
10
|
import"../../../chunk-jpvw9xqy.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
QuestionFlow2
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import"../../../chunk-
|
|
3
|
+
} from "../../../chunk-mqea74ex.js";
|
|
4
|
+
import"../../../chunk-dy4ghe9p.js";
|
|
5
5
|
import"../../../chunk-71efbr5n.js";
|
|
6
6
|
import"../../../chunk-vxvaaptq.js";
|
|
7
7
|
import"../../../chunk-1xncv9gb.js";
|
|
8
|
-
import"../../../chunk-
|
|
8
|
+
import"../../../chunk-caz81rnv.js";
|
|
9
9
|
import"../../../chunk-38301e40.js";
|
|
10
10
|
import"../../../chunk-x90xmrba.js";
|
|
11
11
|
import"../../../chunk-jpvw9xqy.js";
|
|
@@ -427,13 +427,13 @@ import {
|
|
|
427
427
|
OpenAILogo2
|
|
428
428
|
} from "../../chunk-pa07b92f.js";
|
|
429
429
|
import"../../chunk-1xncv9gb.js";
|
|
430
|
-
import"../../chunk-
|
|
430
|
+
import"../../chunk-caz81rnv.js";
|
|
431
431
|
import {
|
|
432
432
|
OptionText2
|
|
433
433
|
} from "../../chunk-71efbr5n.js";
|
|
434
434
|
import {
|
|
435
435
|
OptionList2
|
|
436
|
-
} from "../../chunk-
|
|
436
|
+
} from "../../chunk-dy4ghe9p.js";
|
|
437
437
|
import {
|
|
438
438
|
PermissionGrant2
|
|
439
439
|
} from "../../chunk-8jnfvgvk.js";
|
|
@@ -442,7 +442,7 @@ import {
|
|
|
442
442
|
} from "../../chunk-10t1w38s.js";
|
|
443
443
|
import {
|
|
444
444
|
QuestionFlow2
|
|
445
|
-
} from "../../chunk-
|
|
445
|
+
} from "../../chunk-mqea74ex.js";
|
|
446
446
|
import {
|
|
447
447
|
QuotaBanner2
|
|
448
448
|
} from "../../chunk-zp3wrbve.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type RowData } from "@tanstack/react-table";
|
|
2
|
+
import type { ReactElement } from "react";
|
|
3
|
+
import type { IDensityProps } from "../../density/types.js";
|
|
4
|
+
import type { DataGridRow, IDataGridControlProps } from "./DataGrid.js";
|
|
5
|
+
interface DataGridSelectCellProps<T extends RowData> extends IDensityProps, IDataGridControlProps<T> {
|
|
6
|
+
row: DataGridRow<T>;
|
|
7
|
+
/** Names this row's selection control, such as "Select project Atlas". */
|
|
8
|
+
label: string;
|
|
9
|
+
}
|
|
10
|
+
/** Uses the row's native selection rules, including disabled and partially selected parent rows. */
|
|
11
|
+
export declare function DataGridSelectCell<T extends RowData>({ row, table, label, density, }: DataGridSelectCellProps<T>): ReactElement;
|
|
12
|
+
export type { DataGridSelectCellProps };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type RowData } from "@tanstack/react-table";
|
|
2
|
+
import type { ReactElement } from "react";
|
|
3
|
+
import type { IDensityProps } from "../../density/types.js";
|
|
4
|
+
import type { IDataGridControlProps } from "./DataGrid.js";
|
|
5
|
+
type DataGridSelectHeaderProps<T extends RowData> = IDataGridControlProps<T> & IDensityProps;
|
|
6
|
+
/** Selects the selectable filtered rows across every page, preserving selections hidden by filters. */
|
|
7
|
+
export declare function DataGridSelectHeader<T extends RowData>({ table, label, density, }: DataGridSelectHeaderProps<T>): ReactElement;
|
|
8
|
+
export type { DataGridSelectHeaderProps };
|
|
@@ -3,3 +3,7 @@ export type { DataGridColumn, DataGridColumnFilter, DataGridFeatures, DataGridPr
|
|
|
3
3
|
export { DataGridColumnOptions } from "./DataGridColumnOptions.js";
|
|
4
4
|
export { DataGridFilters } from "./DataGridFilters.js";
|
|
5
5
|
export { DataGridFilterSummary } from "./DataGridFilterSummary.js";
|
|
6
|
+
export { DataGridSelectHeader } from "./DataGridSelectHeader.js";
|
|
7
|
+
export type { DataGridSelectHeaderProps } from "./DataGridSelectHeader.js";
|
|
8
|
+
export { DataGridSelectCell } from "./DataGridSelectCell.js";
|
|
9
|
+
export type { DataGridSelectCellProps } from "./DataGridSelectCell.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "../../chunk-77xfccfq.js";
|
|
23
23
|
import {
|
|
24
24
|
Checkbox2
|
|
25
|
-
} from "../../chunk-
|
|
25
|
+
} from "../../chunk-caz81rnv.js";
|
|
26
26
|
import {
|
|
27
27
|
Label2
|
|
28
28
|
} from "../../chunk-jcxxjkqx.js";
|
|
@@ -514,6 +514,56 @@ function DataGridFilterSummary({
|
|
|
514
514
|
}
|
|
515
515
|
});
|
|
516
516
|
}
|
|
517
|
+
// src/components/data-grid/DataGridSelectHeader.tsx
|
|
518
|
+
import { Subscribe as Subscribe4 } from "@tanstack/react-table";
|
|
519
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
520
|
+
function DataGridSelectHeader({
|
|
521
|
+
table,
|
|
522
|
+
label = "Select all filtered rows",
|
|
523
|
+
density
|
|
524
|
+
}) {
|
|
525
|
+
return /* @__PURE__ */ jsx4(Subscribe4, {
|
|
526
|
+
source: table.store,
|
|
527
|
+
selector: (state) => ({
|
|
528
|
+
selection: state.rowSelection,
|
|
529
|
+
filters: state.columnFilters,
|
|
530
|
+
filter: state.globalFilter
|
|
531
|
+
}),
|
|
532
|
+
children: () => {
|
|
533
|
+
const rows = table.getFilteredRowModel().flatRows.filter((row) => row.getCanSelect() && row.getParentRows().every((parent) => parent.getCanSelectSubRows()));
|
|
534
|
+
const selected = rows.filter((row) => row.getIsSelected()).length;
|
|
535
|
+
return /* @__PURE__ */ jsx4(Checkbox2, {
|
|
536
|
+
"aria-label": label,
|
|
537
|
+
density,
|
|
538
|
+
disabled: rows.length === 0,
|
|
539
|
+
checked: rows.length > 0 && selected === rows.length,
|
|
540
|
+
indeterminate: selected > 0 && selected < rows.length,
|
|
541
|
+
onCheckedChange: (checked) => table.toggleAllRowsSelected(checked)
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
// src/components/data-grid/DataGridSelectCell.tsx
|
|
547
|
+
import { Subscribe as Subscribe5 } from "@tanstack/react-table";
|
|
548
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
549
|
+
function DataGridSelectCell({
|
|
550
|
+
row,
|
|
551
|
+
table,
|
|
552
|
+
label,
|
|
553
|
+
density
|
|
554
|
+
}) {
|
|
555
|
+
return /* @__PURE__ */ jsx5(Subscribe5, {
|
|
556
|
+
source: table.atoms.rowSelection,
|
|
557
|
+
children: () => /* @__PURE__ */ jsx5(Checkbox2, {
|
|
558
|
+
"aria-label": label,
|
|
559
|
+
density,
|
|
560
|
+
checked: row.getIsSelected(),
|
|
561
|
+
indeterminate: row.getIsSomeSelected(),
|
|
562
|
+
disabled: !row.getCanSelect(),
|
|
563
|
+
onCheckedChange: (checked) => row.toggleSelected(checked)
|
|
564
|
+
})
|
|
565
|
+
});
|
|
566
|
+
}
|
|
517
567
|
export {
|
|
518
568
|
DataGrid2 as DataGrid,
|
|
519
569
|
DataGridCells2 as DataGridCells,
|
|
@@ -523,5 +573,7 @@ export {
|
|
|
523
573
|
DataGridFilterSummary,
|
|
524
574
|
DataGridFilters,
|
|
525
575
|
DataGridPagination2 as DataGridPagination,
|
|
576
|
+
DataGridSelectCell,
|
|
577
|
+
DataGridSelectHeader,
|
|
526
578
|
dataGridFeatures2 as dataGridFeatures
|
|
527
579
|
};
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
DrawerHeader2,
|
|
37
37
|
DrawerTitle2,
|
|
38
38
|
DrawerDescription2
|
|
39
|
-
} from "../../chunk-
|
|
39
|
+
} from "../../chunk-0qgd06td.js";
|
|
40
40
|
import {
|
|
41
41
|
DropdownMenu2,
|
|
42
42
|
DropdownMenuTrigger2,
|
|
@@ -105,7 +105,7 @@ import {
|
|
|
105
105
|
import"../../chunk-9de1htr5.js";
|
|
106
106
|
import {
|
|
107
107
|
Checkbox2
|
|
108
|
-
} from "../../chunk-
|
|
108
|
+
} from "../../chunk-caz81rnv.js";
|
|
109
109
|
import"../../chunk-1j2hz3w9.js";
|
|
110
110
|
import"../../chunk-k99h6evz.js";
|
|
111
111
|
import {
|
|
@@ -17,7 +17,15 @@ type TreeItemProps<T> = useRender.ComponentProps<"div", TreeItemState> & IDensit
|
|
|
17
17
|
expandOn?: "click" | "doubleClick" | "disclosure";
|
|
18
18
|
isEditing?: boolean;
|
|
19
19
|
isDropTarget?: boolean;
|
|
20
|
+
/** The registered native link owns row focus; disclosure and actions remain siblings. */
|
|
21
|
+
linkProps?: useRender.ComponentProps<"a", TreeItemState>;
|
|
22
|
+
/** Domain-controlled drag feedback; omitted rows have no tooltip wrapper. */
|
|
23
|
+
dropHint?: {
|
|
24
|
+
content: ReactNode;
|
|
25
|
+
open: boolean;
|
|
26
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
27
|
+
};
|
|
20
28
|
};
|
|
21
29
|
/** Registered tree row; compose menus with render and place counts/actions in endEnhancer. */
|
|
22
|
-
export declare function TreeItem<T>({ analytics, item, children, startEnhancer, endEnhancer, expandOn, isEditing, isDropTarget, density, render, ref, ...props }: TreeItemProps<T>): ReactElement;
|
|
30
|
+
export declare function TreeItem<T>({ analytics, item, children, startEnhancer, endEnhancer, expandOn, isEditing, isDropTarget, linkProps, dropHint, density, render, ref, ...props }: TreeItemProps<T>): ReactElement;
|
|
23
31
|
export type { TreeItemProps };
|
|
@@ -9,6 +9,9 @@ import"../../chunk-e6hk39ev.js";
|
|
|
9
9
|
import"../../chunk-x90xmrba.js";
|
|
10
10
|
import"../../chunk-jpvw9xqy.js";
|
|
11
11
|
import {
|
|
12
|
+
Tooltip2,
|
|
13
|
+
TooltipTrigger2,
|
|
14
|
+
TooltipContent2,
|
|
12
15
|
Button2
|
|
13
16
|
} from "../../chunk-38301e40.js";
|
|
14
17
|
import {
|
|
@@ -19,9 +22,10 @@ import {
|
|
|
19
22
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
20
23
|
import { useRender } from "@base-ui/react/use-render";
|
|
21
24
|
import { ChevronRightIcon, FileIcon, FolderIcon, FolderOpenIcon } from "lucide-react";
|
|
25
|
+
import { useId } from "react";
|
|
22
26
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
23
27
|
function isRowControl(event) {
|
|
24
|
-
return event.target !== event.currentTarget && event.target instanceof Element && Boolean(event.target.closest("button,input,textarea,select,form"));
|
|
28
|
+
return event.target !== event.currentTarget && event.target instanceof Element && Boolean(event.target.closest("a,button,input,textarea,select,form"));
|
|
25
29
|
}
|
|
26
30
|
function TreeItem({
|
|
27
31
|
analytics,
|
|
@@ -32,16 +36,26 @@ function TreeItem({
|
|
|
32
36
|
expandOn = "click",
|
|
33
37
|
isEditing = false,
|
|
34
38
|
isDropTarget = false,
|
|
39
|
+
linkProps,
|
|
40
|
+
dropHint,
|
|
35
41
|
density,
|
|
36
42
|
render,
|
|
37
43
|
ref,
|
|
38
44
|
...props
|
|
39
45
|
}) {
|
|
40
46
|
const nativeProps = item.getProps();
|
|
47
|
+
const hintId = useId();
|
|
41
48
|
const activate = useAnalyticsCallback("TreeItem", analytics, { name: "ui.activate" }, undefined);
|
|
42
49
|
const isExpanded = item.isExpanded();
|
|
43
50
|
const isSelected = item.isSelected?.() ?? false;
|
|
44
51
|
const isInsideTarget = item.isUnorderedDragTarget?.() ?? false;
|
|
52
|
+
const state = {
|
|
53
|
+
slot: "tree-item",
|
|
54
|
+
selected: isSelected,
|
|
55
|
+
expanded: isExpanded,
|
|
56
|
+
dropTarget: isInsideTarget || isDropTarget,
|
|
57
|
+
density
|
|
58
|
+
};
|
|
45
59
|
const toggle = () => {
|
|
46
60
|
if (isExpanded)
|
|
47
61
|
item.collapse();
|
|
@@ -62,12 +76,44 @@ function TreeItem({
|
|
|
62
76
|
item.getTree().getDataRef().current.selectUpToAnchorId = item.getId();
|
|
63
77
|
item.primaryAction();
|
|
64
78
|
};
|
|
65
|
-
|
|
79
|
+
const label = /* @__PURE__ */ jsxs(Fragment, {
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ jsx("span", {
|
|
82
|
+
"aria-hidden": "true",
|
|
83
|
+
className: "flex shrink-0 [&>svg]:size-4",
|
|
84
|
+
children: startEnhancer ?? (item.isFolder() ? isExpanded ? /* @__PURE__ */ jsx(FolderOpenIcon, {}) : /* @__PURE__ */ jsx(FolderIcon, {}) : /* @__PURE__ */ jsx(FileIcon, {}))
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ jsx("div", {
|
|
87
|
+
className: "min-w-0 flex-1 truncate",
|
|
88
|
+
children: children ?? item.getItemName()
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
const link = useRender({
|
|
93
|
+
defaultTagName: "a",
|
|
94
|
+
render: linkProps?.render,
|
|
95
|
+
ref: [item.registerElement, linkProps?.ref ?? null],
|
|
96
|
+
props: mergeProps({
|
|
97
|
+
...nativeProps,
|
|
98
|
+
ref: undefined,
|
|
99
|
+
className: "flex min-w-0 flex-1 items-center gap-2 outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
100
|
+
children: label,
|
|
101
|
+
onFocus: () => item.setFocused(),
|
|
102
|
+
onClick: (event) => {
|
|
103
|
+
item.setFocused();
|
|
104
|
+
if (!event.ctrlKey && !event.metaKey && !event.shiftKey)
|
|
105
|
+
item.getTree().setSelectedItems?.([item.getId()]);
|
|
106
|
+
activate(event);
|
|
107
|
+
}
|
|
108
|
+
}, linkProps ?? {}),
|
|
109
|
+
state
|
|
110
|
+
});
|
|
111
|
+
const element = useRender({
|
|
66
112
|
defaultTagName: "div",
|
|
67
113
|
render,
|
|
68
|
-
ref: [item.registerElement, ref ?? null],
|
|
114
|
+
ref: [linkProps && !isEditing ? null : item.registerElement, ref ?? null],
|
|
69
115
|
props: mergeProps({
|
|
70
|
-
...nativeProps,
|
|
116
|
+
...linkProps && !isEditing ? {} : nativeProps,
|
|
71
117
|
ref: undefined,
|
|
72
118
|
onKeyDown: (event) => {
|
|
73
119
|
if (event.target !== event.currentTarget || event.defaultPrevented || event.key !== "Enter" || event.repeat || item.getTree().getState().dnd)
|
|
@@ -78,8 +124,15 @@ function TreeItem({
|
|
|
78
124
|
if (expandOn !== "click" && item.isFolder())
|
|
79
125
|
toggle();
|
|
80
126
|
},
|
|
81
|
-
|
|
82
|
-
onClick:
|
|
127
|
+
...!linkProps ? {
|
|
128
|
+
onClick: (event) => {
|
|
129
|
+
if (isRowControl(event))
|
|
130
|
+
return;
|
|
131
|
+
if (expandOn === "click")
|
|
132
|
+
nativeProps.onClick?.(event);
|
|
133
|
+
else
|
|
134
|
+
select(event);
|
|
135
|
+
},
|
|
83
136
|
onDoubleClick: (event) => {
|
|
84
137
|
if (expandOn === "doubleClick" && !isRowControl(event) && item.isFolder())
|
|
85
138
|
toggle();
|
|
@@ -116,15 +169,7 @@ function TreeItem({
|
|
|
116
169
|
}) : /* @__PURE__ */ jsx("span", {
|
|
117
170
|
className: cn2("shrink-0", expandOn === "disclosure" ? "size-control-xs" : "size-3.5")
|
|
118
171
|
}),
|
|
119
|
-
|
|
120
|
-
"aria-hidden": "true",
|
|
121
|
-
className: "flex shrink-0 [&>svg]:size-4",
|
|
122
|
-
children: startEnhancer ?? (item.isFolder() ? isExpanded ? /* @__PURE__ */ jsx(FolderOpenIcon, {}) : /* @__PURE__ */ jsx(FolderIcon, {}) : /* @__PURE__ */ jsx(FileIcon, {}))
|
|
123
|
-
}),
|
|
124
|
-
/* @__PURE__ */ jsx("div", {
|
|
125
|
-
className: "min-w-0 flex-1 truncate",
|
|
126
|
-
children: children ?? item.getItemName()
|
|
127
|
-
}),
|
|
172
|
+
linkProps && !isEditing ? link : label,
|
|
128
173
|
endEnhancer && /* @__PURE__ */ jsx("div", {
|
|
129
174
|
className: "flex shrink-0 items-center gap-1 text-xs tabular-nums",
|
|
130
175
|
onClick: (event) => event.stopPropagation(),
|
|
@@ -142,14 +187,22 @@ function TreeItem({
|
|
|
142
187
|
activate(event);
|
|
143
188
|
}
|
|
144
189
|
}),
|
|
145
|
-
state
|
|
146
|
-
slot: "tree-item",
|
|
147
|
-
selected: isSelected,
|
|
148
|
-
expanded: isExpanded,
|
|
149
|
-
dropTarget: isInsideTarget || isDropTarget,
|
|
150
|
-
density
|
|
151
|
-
}
|
|
190
|
+
state
|
|
152
191
|
});
|
|
192
|
+
return dropHint ? /* @__PURE__ */ jsxs(Tooltip2, {
|
|
193
|
+
open: dropHint.open,
|
|
194
|
+
triggerId: hintId,
|
|
195
|
+
children: [
|
|
196
|
+
/* @__PURE__ */ jsx(TooltipTrigger2, {
|
|
197
|
+
id: hintId,
|
|
198
|
+
render: element
|
|
199
|
+
}),
|
|
200
|
+
/* @__PURE__ */ jsx(TooltipContent2, {
|
|
201
|
+
side: dropHint.side,
|
|
202
|
+
children: dropHint.content
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
}) : element;
|
|
153
206
|
}
|
|
154
207
|
|
|
155
208
|
// src/components/tree/Tree.tsx
|
package/dist/index.js
CHANGED
|
@@ -178,7 +178,7 @@ import {
|
|
|
178
178
|
StatusTracker2,
|
|
179
179
|
DashboardLayout2,
|
|
180
180
|
BillingUsage2
|
|
181
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-0qgd06td.js";
|
|
182
182
|
import {
|
|
183
183
|
Tabs2,
|
|
184
184
|
tabsListVariants2,
|
|
@@ -307,7 +307,7 @@ import {
|
|
|
307
307
|
} from "./chunk-1xncv9gb.js";
|
|
308
308
|
import {
|
|
309
309
|
Checkbox2
|
|
310
|
-
} from "./chunk-
|
|
310
|
+
} from "./chunk-caz81rnv.js";
|
|
311
311
|
import {
|
|
312
312
|
Kbd2,
|
|
313
313
|
KbdGroup2
|
package/dist/prototype.js
CHANGED
|
@@ -2051,7 +2051,7 @@ var program = new Command;
|
|
|
2051
2051
|
// package.json
|
|
2052
2052
|
var package_default = {
|
|
2053
2053
|
name: "@alexgorbatchev/shadcn",
|
|
2054
|
-
version: "0.0.
|
|
2054
|
+
version: "0.0.46",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -8,8 +8,8 @@ Source: src/components/stories/data-display/DataGrid.stories.tsx
|
|
|
8
8
|
## Public imports
|
|
9
9
|
|
|
10
10
|
```tsx
|
|
11
|
-
import { DataGrid, DataGridColumnHeader, DataGridFilter, dataGridFeatures } from "@alexgorbatchev/shadcn/data-grid";
|
|
12
|
-
import {
|
|
11
|
+
import { DataGrid, DataGridColumnHeader, DataGridFilter, DataGridSelectHeader, DataGridSelectCell, dataGridFeatures } from "@alexgorbatchev/shadcn/data-grid";
|
|
12
|
+
import { Button } from "@alexgorbatchev/shadcn";
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Supporting imports
|
|
@@ -50,6 +50,14 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
50
50
|
}
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
### FilteredSelection
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
{
|
|
57
|
+
render: () => <Example restricted/>
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
53
61
|
### CombinedSortHeader
|
|
54
62
|
|
|
55
63
|
```tsx
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# DataGridSelectCell
|
|
2
|
+
|
|
3
|
+
Story: @alexgorbatchev/shadcn/components/data-display/DataGridSelectCell
|
|
4
|
+
Source: src/components/stories/data-display/DataGridSelectCell.stories.tsx
|
|
5
|
+
|
|
6
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/DataGridSelectCell.stories.tsx)
|
|
7
|
+
|
|
8
|
+
## Public imports
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { DataGridSelectCell } from "@alexgorbatchev/shadcn/data-grid";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Default component
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
DataGridSelectCell
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Default render
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
() => <SelectionControls />
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
Storybook CSF excerpts. Default args and render apply unless overridden. Local helpers, fixtures, decorators, and providers may be required; these are reference excerpts, not standalone consumer modules. Interaction tests are omitted.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# DataGridSelectHeader
|
|
2
|
+
|
|
3
|
+
Story: @alexgorbatchev/shadcn/components/data-display/DataGridSelectHeader
|
|
4
|
+
Source: src/components/stories/data-display/DataGridSelectHeader.stories.tsx
|
|
5
|
+
|
|
6
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/DataGridSelectHeader.stories.tsx)
|
|
7
|
+
|
|
8
|
+
## Public imports
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { DataGridSelectHeader } from "@alexgorbatchev/shadcn/data-grid";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Default component
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
DataGridSelectHeader
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Default render
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
() => <SelectionControls selectChildren={false}/>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
Storybook CSF excerpts. Default args and render apply unless overridden. Local helpers, fixtures, decorators, and providers may be required; these are reference excerpts, not standalone consumer modules. Interaction tests are omitted.
|
|
29
|
+
|
|
30
|
+
### ChangedRows
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
{
|
|
34
|
+
render: () => <SelectionControls />
|
|
35
|
+
}
|
|
36
|
+
```
|
|
@@ -94,6 +94,21 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
94
94
|
}
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
### MixedToChecked
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
{
|
|
101
|
+
render: function Render() {
|
|
102
|
+
const [isMixed, setMixed] = useState(true);
|
|
103
|
+
const [isChecked, setChecked] = useState(false);
|
|
104
|
+
return (<Checkbox aria-label="Select visible items" indeterminate={isMixed} checked={isChecked} onCheckedChange={(checked) => {
|
|
105
|
+
setMixed(false);
|
|
106
|
+
setChecked(checked);
|
|
107
|
+
}}/>);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
97
112
|
### ReadOnly
|
|
98
113
|
|
|
99
114
|
```tsx
|
|
@@ -47,3 +47,28 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
47
47
|
args: { description: undefined, breadcrumbs: undefined, actions: undefined }
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
|
+
|
|
51
|
+
### WithEyebrow
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
{
|
|
55
|
+
args: { eyebrow: "ENGINE LIBRARY" }
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### NarrowWithLongAddress
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
{
|
|
63
|
+
globals: { theme: "light", density: "compact" },
|
|
64
|
+
decorators: [
|
|
65
|
+
(Story) => (<div className="w-80 max-w-full">
|
|
66
|
+
<Story />
|
|
67
|
+
</div>),
|
|
68
|
+
],
|
|
69
|
+
args: {
|
|
70
|
+
eyebrow: <strong>ENGINE LIBRARY</strong>,
|
|
71
|
+
actions: "https://music.example.com/a-very-long-server-address-without-spaces-for-the-collection-endpoint",
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
@@ -28,6 +28,22 @@ import { useState } from "react";
|
|
|
28
28
|
|
|
29
29
|
Storybook CSF excerpts. Default args and render apply unless overridden. Local helpers, fixtures, decorators, and providers may be required; these are reference excerpts, not standalone consumer modules. Interaction tests are omitted.
|
|
30
30
|
|
|
31
|
+
### LinkRows
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
{
|
|
35
|
+
render: () => <LinkExample />
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### ControlledDropHint
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
{
|
|
43
|
+
render: () => <LinkExample />
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
31
47
|
### ConstrainedRows
|
|
32
48
|
|
|
33
49
|
```tsx
|
package/llms/setup.md
CHANGED
|
@@ -368,6 +368,12 @@ Compose `QuestionnaireItem`, `QuestionnaireTitle`, and answer controls inside `Q
|
|
|
368
368
|
|
|
369
369
|
Column `meta.filter` offers a column in `DataGridFilters`, hidden columns included. A `range` filter edits `[min, max]` bounds, `null` for an open end, for `filterFn: "inNumberRange"`; its inputs suggest the range of the rows the other filters leave, formatted through the filter's `Intl.NumberFormatOptions`. An `options` filter chooses among labelled string values, one or several, listed in its `options` or, when they depend on runtime data, in the `options` prop of `DataGridFilters` and `DataGridFilterSummary` keyed by column ID, for `filterFn: "arrHas"` (one value per row), `"arrIncludesSome"` (an array per row), or a custom `filterFn`; each option counts the rows the other filters leave with that value, so a column whose rows hold several values or values in another form supplies them through `getUniqueValues`. Column filters combine with each other and with the global filter. `DataGridFilterSummary` lists the active filters with buttons that remove them, and both controls clear every column filter at once.
|
|
370
370
|
|
|
371
|
+
Import `DataGridSelectHeader` and `DataGridSelectCell` from `@alexgorbatchev/shadcn/data-grid`. Pass the current `useTable` result as `table` to both controls, and pass `row` and an accessible `label` to each cell. The header selects selectable filtered rows across all pages and preserves selections hidden by filters. It shows a mixed state when some of those rows are selected and disables itself when none are selectable. Its default label is "Select all filtered rows"; provide `label` to name the scope in your application. Cells follow native row selection rules, including disabled rows and partially selected parents. The controls observe selection changes without requiring the parent table selector to include selection state.
|
|
372
|
+
|
|
373
|
+
`TreeItem linkProps` places the registered tree item, roving focus, and native drag handlers on an anchor. Pass `href` and anchor events directly, or compose a router link through `linkProps.render`. The outer `render` and `ref` remain available for row overlays; disclosure and `endEnhancer` controls remain siblings of the link. Enter and modified clicks retain native link behavior, while tree arrows retain navigation and expansion behavior. Optional `dropHint={{ content, open, side }}` displays caller-controlled drag feedback without adding a focus target.
|
|
374
|
+
|
|
375
|
+
`PageHeader` accepts an optional `eyebrow` above its single page title. It accepts any React content without introducing another heading. Breadcrumbs, description, actions, and density remain independent slots; long action content wraps within narrow layouts.
|
|
376
|
+
|
|
371
377
|
`StarRating` takes a controlled numeric `value` from 0 to 5, `onValueChange`, and an accessible `label`. Its native radio buttons support keyboard selection and an Unrated option to clear the rating. Set `disabled` while saving. `Avatar shape="square"` displays square artwork with matching image, fallback, and border corners.
|
|
372
378
|
|
|
373
379
|
`DialogContent size="wide"` uses a desktop maximum width of 576px; `size="narrow"` uses 192px, and the default uses 384px. Dialogs remain bounded by the viewport. `FieldGroup columns={2}` arranges fields in two columns on desktop and one on mobile.
|
package/llms.txt
CHANGED
|
@@ -336,6 +336,8 @@ Generated from the public package exports and Storybook sources.
|
|
|
336
336
|
- [DataGridColumnOptions](./llms/components/data-display/DataGridColumnOptions.md)
|
|
337
337
|
- [DataGridFilterSummary](./llms/components/data-display/DataGridFilterSummary.md)
|
|
338
338
|
- [DataGridFilters](./llms/components/data-display/DataGridFilters.md)
|
|
339
|
+
- [DataGridSelectCell](./llms/components/data-display/DataGridSelectCell.md)
|
|
340
|
+
- [DataGridSelectHeader](./llms/components/data-display/DataGridSelectHeader.md)
|
|
339
341
|
- [DataViewer](./llms/components/data-display/DataViewer.md)
|
|
340
342
|
- [Item](./llms/components/data-display/Item.md)
|
|
341
343
|
- [JsonRender](./llms/components/data-display/JsonRender.md)
|