@alexgorbatchev/shadcn 0.0.76 → 0.0.77
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/dist/{chunk-jrf138sy.js → chunk-bv2bar22.js} +1 -1
- package/dist/{chunk-s1vn9bwy.js → chunk-k1jr6r51.js} +1 -1
- package/dist/{chunk-yywr1jgk.js → chunk-tegj7xts.js} +15 -1
- package/dist/components/MenuParts.d.ts +1 -1
- package/dist/components/assistant-ui/elements/RegenerateMenu.js +2 -2
- package/dist/components/assistant-ui/index.js +2 -2
- package/dist/components/json-render/index.js +2 -2
- package/dist/components/tree/Tree.d.ts +4 -1
- package/dist/components/tree/TreeItem.d.ts +26 -3
- package/dist/components/tree/TreeTabStopContext.d.ts +5 -0
- package/dist/components/tree/index.d.ts +1 -1
- package/dist/components/tree/index.js +100 -34
- package/dist/index.js +2 -2
- package/dist/menu/types.d.ts +5 -0
- package/dist/prototype.js +2 -1
- package/llms/components/navigation/DropdownMenu.md +3 -1
- package/llms/components/navigation/Tree.md +1 -1
- package/llms/setup.md +2 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -456,6 +456,8 @@ For nested layouts, compose `ActionsMenuTrigger`, `ActionsMenuContextTarget`, an
|
|
|
456
456
|
|
|
457
457
|
`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. `isDimmed` fades a settled row, such as completed work, to 70% opacity and exposes `data-dimmed`; hovering or focusing anything in the row restores full opacity, and the row stays interactive.
|
|
458
458
|
|
|
459
|
+
A `Tree` is one Tab stop: Tab reaches the focused item while it is visible, else the first selected item, else the first item, and the arrow keys move from there. Disclosure buttons are pointer targets outside the Tab order and the accessibility tree; the item's `aria-expanded` and the arrow keys carry the same state. Put secondary text such as a count in `description`, which the item exposes through `aria-describedby` instead of its name, with `descriptionLabel` when the spoken text differs ("12 tracks" for "12"). Put pointer shortcuts such as a ⋯ menu trigger in `actions`, each rendered as a `TreeItemAction` (including as a menu trigger's `render`): they stay out of the Tab order and the accessibility tree, so give the item a keyboard path to the same commands, such as Shift+F10 and the Menu key. Rows without an `endEnhancer` take their name from their visible label; `endEnhancer` keeps controls that must remain keyboard reachable on their own, and those rows keep the item name as their label.
|
|
460
|
+
|
|
459
461
|
Embedded actions, links, menus, editable fields, and media controls retain their own keyboard behavior. Registered anchor and button rows still participate in tree navigation; rename and search inputs retain their completion and cancellation shortcuts.
|
|
460
462
|
|
|
461
463
|
`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.
|
|
@@ -71,7 +71,7 @@ import { Menu as MenuPrimitive2 } from "@base-ui/react/menu";
|
|
|
71
71
|
import { ChevronRightIcon, CheckIcon } from "lucide-react";
|
|
72
72
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
73
73
|
"use client";
|
|
74
|
-
var menuItemClassName = "group/menu-item relative flex cursor-default items-center data-has-reason:flex-wrap data-has-reason:data-disabled:opacity-100 data-has-reason:data-disabled:text-muted-foreground gap-control-gap rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:ps-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive";
|
|
74
|
+
var menuItemClassName = "group/menu-item relative flex cursor-default items-center data-has-reason:flex-wrap data-has-reason:data-disabled:pointer-events-auto data-has-reason:data-disabled:opacity-100 data-has-reason:data-disabled:text-muted-foreground gap-control-gap rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:ps-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive";
|
|
75
75
|
function MenuGroup2({ ...props }) {
|
|
76
76
|
return /* @__PURE__ */ jsx2(MenuPrimitive2.Group, {
|
|
77
77
|
"data-slot": "menu-group",
|
|
@@ -94,11 +94,24 @@ function MenuItem2({
|
|
|
94
94
|
inset,
|
|
95
95
|
variant = "default",
|
|
96
96
|
disabledReason,
|
|
97
|
+
onDisabledSelect,
|
|
97
98
|
children,
|
|
98
99
|
...props
|
|
99
100
|
}) {
|
|
100
101
|
const trackedOnClick = useAnalyticsCallback("MenuItem", analytics, { name: "ui.activate" }, props.onClick);
|
|
101
102
|
const reasonId = useId();
|
|
103
|
+
const disabledSelect = disabledReason ? {
|
|
104
|
+
onClickCapture: (event) => {
|
|
105
|
+
props.onClickCapture?.(event);
|
|
106
|
+
onDisabledSelect?.();
|
|
107
|
+
},
|
|
108
|
+
onKeyDownCapture: (event) => {
|
|
109
|
+
props.onKeyDownCapture?.(event);
|
|
110
|
+
if (event.target !== event.currentTarget || event.repeat || event.key !== "Enter" && event.key !== " ")
|
|
111
|
+
return;
|
|
112
|
+
onDisabledSelect?.();
|
|
113
|
+
}
|
|
114
|
+
} : {};
|
|
102
115
|
return /* @__PURE__ */ jsxs(MenuPrimitive2.Item, {
|
|
103
116
|
"data-density": density,
|
|
104
117
|
"data-slot": "menu-item",
|
|
@@ -110,6 +123,7 @@ function MenuItem2({
|
|
|
110
123
|
disabled: Boolean(disabledReason) || props.disabled,
|
|
111
124
|
"aria-describedby": [props["aria-describedby"], disabledReason ? reasonId : undefined].filter(Boolean).join(" ") || undefined,
|
|
112
125
|
onClick: trackedOnClick,
|
|
126
|
+
...disabledSelect,
|
|
113
127
|
children: [
|
|
114
128
|
children,
|
|
115
129
|
disabledReason && /* @__PURE__ */ jsx2("span", {
|
|
@@ -5,7 +5,7 @@ import { type ComponentProps, type ReactElement } from "react";
|
|
|
5
5
|
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
6
6
|
declare function MenuGroup({ ...props }: MenuPrimitive.Group.Props): ReactElement;
|
|
7
7
|
declare function MenuLabel({ density, className, inset, ...props }: MenuLabelProps): ReactElement;
|
|
8
|
-
declare function MenuItem({ analytics, density, className, inset, variant, disabledReason, children, ...props }: MenuItemProps & IAnalyticsProps): ReactElement;
|
|
8
|
+
declare function MenuItem({ analytics, density, className, inset, variant, disabledReason, onDisabledSelect, children, ...props }: MenuItemProps & IAnalyticsProps): ReactElement;
|
|
9
9
|
type MenuLinkItemProps = MenuPrimitive.LinkItem.Props & IDensityProps & IAnalyticsProps & {
|
|
10
10
|
inset?: boolean;
|
|
11
11
|
variant?: "default" | "destructive";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RegenerateMenu2
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import"../../../chunk-
|
|
3
|
+
} from "../../../chunk-bv2bar22.js";
|
|
4
|
+
import"../../../chunk-tegj7xts.js";
|
|
5
5
|
import"../../../chunk-bd09gygt.js";
|
|
6
6
|
import"../../../chunk-x90xmrba.js";
|
|
7
7
|
import"../../../chunk-jpvw9xqy.js";
|
|
@@ -481,10 +481,10 @@ import {
|
|
|
481
481
|
import {
|
|
482
482
|
RecommendationCard2
|
|
483
483
|
} from "../../chunk-58cpjhsr.js";
|
|
484
|
-
import"../../chunk-
|
|
484
|
+
import"../../chunk-tegj7xts.js";
|
|
485
485
|
import {
|
|
486
486
|
RegenerateMenu2
|
|
487
|
-
} from "../../chunk-
|
|
487
|
+
} from "../../chunk-bv2bar22.js";
|
|
488
488
|
import {
|
|
489
489
|
ResearchReport2
|
|
490
490
|
} from "../../chunk-fdhssr0q.js";
|
|
@@ -31,13 +31,13 @@ import {
|
|
|
31
31
|
DrawerHeader2,
|
|
32
32
|
DrawerTitle2,
|
|
33
33
|
DrawerDescription2
|
|
34
|
-
} from "../../chunk-
|
|
34
|
+
} from "../../chunk-k1jr6r51.js";
|
|
35
35
|
import {
|
|
36
36
|
MenuPopup,
|
|
37
37
|
MenuItem2,
|
|
38
38
|
DropdownMenu2,
|
|
39
39
|
DropdownMenuTrigger2
|
|
40
|
-
} from "../../chunk-
|
|
40
|
+
} from "../../chunk-tegj7xts.js";
|
|
41
41
|
import {
|
|
42
42
|
Alert2,
|
|
43
43
|
AlertTitle2,
|
|
@@ -10,7 +10,10 @@ type TreeProps<T> = IAnalyticsProps & IDensityProps & {
|
|
|
10
10
|
renderLabel?: (item: ItemInstance<T>) => ReactNode;
|
|
11
11
|
renderItem?: (item: ItemInstance<T>) => ReactNode;
|
|
12
12
|
};
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Headless Tree owns navigation, selection, expansion, and optional pointer/keyboard drag and drop. The tree is one Tab
|
|
15
|
+
* stop: arrows move between items, and row controls stay out of the Tab order.
|
|
16
|
+
*/
|
|
14
17
|
declare function Tree<T>({ analytics, tree, label, variant, renderIcon, renderLabel, renderItem, density, }: TreeProps<T>): ReactElement;
|
|
15
18
|
export { Tree };
|
|
16
19
|
export type { TreeProps };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { IAnalyticsProps } from "../../analytics/types.js";
|
|
2
2
|
import { useRender } from "@base-ui/react/use-render";
|
|
3
3
|
import type { ItemInstance } from "@headless-tree/core";
|
|
4
|
-
import type { ReactElement, ReactNode } from "react";
|
|
4
|
+
import type { ComponentProps, ReactElement, ReactNode } from "react";
|
|
5
5
|
import type { IDensityProps } from "../../density/types.js";
|
|
6
|
+
import { Button } from "../Button.js";
|
|
6
7
|
type TreeItemState = {
|
|
7
8
|
slot: "tree-item";
|
|
8
9
|
selected: boolean;
|
|
@@ -28,7 +29,29 @@ type TreeItemProps<T> = useRender.ComponentProps<"div", TreeItemState> & IDensit
|
|
|
28
29
|
open: boolean;
|
|
29
30
|
side?: "top" | "right" | "bottom" | "left";
|
|
30
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Secondary text at the row's end, such as a count. It is the item's accessible description, never part of its
|
|
34
|
+
* name, so names stay stable for typeahead, drag announcements and tests.
|
|
35
|
+
*/
|
|
36
|
+
description?: ReactNode;
|
|
37
|
+
/** Spoken description when the visible `description` is terse, such as "12 tracks" for "12". */
|
|
38
|
+
descriptionLabel?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Pointer shortcuts at the row's end, such as a ⋯ menu trigger, each rendered as a `TreeItemAction`. A tree is one
|
|
41
|
+
* Tab stop whose items carry their own keys (arrows, Enter, Shift+F10 and the Menu key), so actions stay out of the
|
|
42
|
+
* Tab order and the accessibility tree, and the tree owns only tree items.
|
|
43
|
+
*/
|
|
44
|
+
actions?: ReactNode;
|
|
31
45
|
};
|
|
32
|
-
|
|
33
|
-
|
|
46
|
+
type TreeItemActionProps = ComponentProps<typeof Button>;
|
|
47
|
+
/**
|
|
48
|
+
* A row's pointer shortcut for a command its item also offers through keys. It is never a Tab stop, including when a
|
|
49
|
+
* menu trigger renders it, so the tree keeps one Tab stop.
|
|
50
|
+
*/
|
|
51
|
+
export declare function TreeItemAction({ variant, size, ...props }: TreeItemActionProps): ReactElement;
|
|
52
|
+
/**
|
|
53
|
+
* Registered tree row; compose menus with render, put counts in `description` and pointer shortcuts in `actions`.
|
|
54
|
+
* `endEnhancer` holds controls that must stay keyboard reachable on their own.
|
|
55
|
+
*/
|
|
56
|
+
export declare function TreeItem<T>({ analytics, item, children, startEnhancer, endEnhancer, description, descriptionLabel, actions, expandOn, isEditing, isDropTarget, isDimmed, linkProps, dropHint, density, render, ref, ...props }: TreeItemProps<T>): ReactElement;
|
|
34
57
|
export type { TreeItemProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Tree } from "./Tree.js";
|
|
2
|
-
export { TreeItem } from "./TreeItem.js";
|
|
2
|
+
export { TreeItem, TreeItemAction } from "./TreeItem.js";
|
|
3
3
|
export type { TreeProps } from "./Tree.js";
|
|
4
4
|
export type { TreeItemProps } from "./TreeItem.js";
|
|
5
5
|
export { useTree, AssistiveTreeDescription } from "@headless-tree/react";
|
|
@@ -22,8 +22,22 @@ import {
|
|
|
22
22
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
23
23
|
import { useRender } from "@base-ui/react/use-render";
|
|
24
24
|
import { ChevronRightIcon, FileIcon, FolderIcon, FolderOpenIcon } from "lucide-react";
|
|
25
|
-
import { useId } from "react";
|
|
25
|
+
import { use, useId } from "react";
|
|
26
|
+
|
|
27
|
+
// src/components/tree/TreeTabStopContext.ts
|
|
28
|
+
import { createContext } from "react";
|
|
29
|
+
var TreeTabStopContext = createContext(undefined);
|
|
30
|
+
|
|
31
|
+
// src/components/tree/TreeItem.tsx
|
|
26
32
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
33
|
+
function TreeItemAction({ variant = "ghost", size = "icon-xs", ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsx(Button2, {
|
|
35
|
+
variant,
|
|
36
|
+
size,
|
|
37
|
+
...props,
|
|
38
|
+
tabIndex: -1
|
|
39
|
+
});
|
|
40
|
+
}
|
|
27
41
|
function isRowControl(event) {
|
|
28
42
|
return event.target !== event.currentTarget && event.target instanceof Element && Boolean(event.target.closest("a,button,input,textarea,select,form"));
|
|
29
43
|
}
|
|
@@ -33,6 +47,9 @@ function TreeItem({
|
|
|
33
47
|
children,
|
|
34
48
|
startEnhancer,
|
|
35
49
|
endEnhancer,
|
|
50
|
+
description,
|
|
51
|
+
descriptionLabel,
|
|
52
|
+
actions,
|
|
36
53
|
expandOn = "click",
|
|
37
54
|
isEditing = false,
|
|
38
55
|
isDropTarget = false,
|
|
@@ -44,7 +61,16 @@ function TreeItem({
|
|
|
44
61
|
ref,
|
|
45
62
|
...props
|
|
46
63
|
}) {
|
|
47
|
-
const
|
|
64
|
+
const tabStop = use(TreeTabStopContext);
|
|
65
|
+
const descriptionId = useId();
|
|
66
|
+
const hasDescription = description !== undefined && description !== null || Boolean(descriptionLabel);
|
|
67
|
+
const registered = item.getProps();
|
|
68
|
+
const nativeProps = {
|
|
69
|
+
...registered,
|
|
70
|
+
...tabStop === undefined ? {} : { tabIndex: item.getId() === tabStop ? 0 : -1 },
|
|
71
|
+
"aria-label": endEnhancer || isEditing ? registered["aria-label"] : undefined,
|
|
72
|
+
"aria-describedby": hasDescription ? descriptionId : undefined
|
|
73
|
+
};
|
|
48
74
|
const hintId = useId();
|
|
49
75
|
const activate = useAnalyticsCallback("TreeItem", analytics, { name: "ui.activate" }, undefined);
|
|
50
76
|
const isExpanded = item.isExpanded();
|
|
@@ -117,6 +143,10 @@ function TreeItem({
|
|
|
117
143
|
props: mergeProps({
|
|
118
144
|
...linkProps && !isEditing ? {} : nativeProps,
|
|
119
145
|
ref: undefined,
|
|
146
|
+
onFocus: (event) => {
|
|
147
|
+
if (event.target === event.currentTarget && item.getTree().getState().focusedItem !== item.getId())
|
|
148
|
+
item.setFocused();
|
|
149
|
+
},
|
|
120
150
|
onKeyDown: (event) => {
|
|
121
151
|
if (event.target !== event.currentTarget || event.defaultPrevented || event.key !== "Enter" || event.repeat || item.getTree().getState().dnd)
|
|
122
152
|
return;
|
|
@@ -154,8 +184,10 @@ function TreeItem({
|
|
|
154
184
|
item.isFolder() && expandOn === "disclosure" ? /* @__PURE__ */ jsx(Button2, {
|
|
155
185
|
variant: "plain",
|
|
156
186
|
size: "icon-xs",
|
|
187
|
+
tabIndex: -1,
|
|
188
|
+
"aria-hidden": "true",
|
|
157
189
|
"aria-label": `${isExpanded ? "Collapse" : "Expand"} ${item.getItemName()}`,
|
|
158
|
-
|
|
190
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
159
191
|
onClick: (event) => {
|
|
160
192
|
event.stopPropagation();
|
|
161
193
|
toggle();
|
|
@@ -178,6 +210,31 @@ function TreeItem({
|
|
|
178
210
|
onDoubleClick: (event) => event.stopPropagation(),
|
|
179
211
|
onKeyDown: (event) => event.stopPropagation(),
|
|
180
212
|
children: endEnhancer
|
|
213
|
+
}),
|
|
214
|
+
(hasDescription || actions) && /* @__PURE__ */ jsxs("div", {
|
|
215
|
+
className: "flex shrink-0 items-center gap-1 text-xs tabular-nums",
|
|
216
|
+
children: [
|
|
217
|
+
description !== undefined && description !== null && /* @__PURE__ */ jsx("span", {
|
|
218
|
+
"aria-hidden": "true",
|
|
219
|
+
id: descriptionLabel ? undefined : descriptionId,
|
|
220
|
+
"data-slot": "tree-item-description",
|
|
221
|
+
children: description
|
|
222
|
+
}),
|
|
223
|
+
descriptionLabel && /* @__PURE__ */ jsx("span", {
|
|
224
|
+
id: descriptionId,
|
|
225
|
+
hidden: true,
|
|
226
|
+
children: descriptionLabel
|
|
227
|
+
}),
|
|
228
|
+
actions && /* @__PURE__ */ jsx("div", {
|
|
229
|
+
"aria-hidden": "true",
|
|
230
|
+
"data-slot": "tree-item-actions",
|
|
231
|
+
className: "flex items-center gap-1",
|
|
232
|
+
onClick: (event) => event.stopPropagation(),
|
|
233
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
234
|
+
onKeyDown: (event) => event.stopPropagation(),
|
|
235
|
+
children: actions
|
|
236
|
+
})
|
|
237
|
+
]
|
|
181
238
|
})
|
|
182
239
|
]
|
|
183
240
|
})
|
|
@@ -209,6 +266,10 @@ function TreeItem({
|
|
|
209
266
|
|
|
210
267
|
// src/components/tree/Tree.tsx
|
|
211
268
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
269
|
+
function tabStopId(items, focusedId) {
|
|
270
|
+
const focused = focusedId == null ? undefined : items.find((item) => item.getId() === focusedId);
|
|
271
|
+
return (focused ?? items.find((item) => item.isSelected?.()) ?? items.at(0))?.getId();
|
|
272
|
+
}
|
|
212
273
|
function Tree({
|
|
213
274
|
analytics,
|
|
214
275
|
tree,
|
|
@@ -223,37 +284,41 @@ function Tree({
|
|
|
223
284
|
const container = tree.getContainerProps(label);
|
|
224
285
|
const dragLine = tree.getDragLineData?.();
|
|
225
286
|
const element = tree.getElement();
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
287
|
+
const items = tree.getItems();
|
|
288
|
+
return /* @__PURE__ */ jsx2(TreeTabStopContext, {
|
|
289
|
+
value: tabStopId(items, tree.getState().focusedItem),
|
|
290
|
+
children: /* @__PURE__ */ jsxs2("div", {
|
|
291
|
+
...container,
|
|
292
|
+
"data-density": density,
|
|
293
|
+
className: cn2("grid min-w-0 grid-cols-1 gap-1", variant === "default" && "rounded-sm border border-border bg-card p-2"),
|
|
294
|
+
onKeyDown: (event) => {
|
|
295
|
+
if (event.target instanceof Element && event.target.closest("input,textarea,select,form,button,[role=menu]"))
|
|
296
|
+
return;
|
|
297
|
+
if (event.defaultPrevented)
|
|
298
|
+
return;
|
|
299
|
+
container.onKeyDown?.(event);
|
|
300
|
+
if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End", "Enter", " "].includes(event.key)) {
|
|
301
|
+
track({ name: "ui.navigate" }, event.nativeEvent);
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
children: [
|
|
305
|
+
items.map((item) => renderItem ? /* @__PURE__ */ jsx2("div", {
|
|
306
|
+
role: "none",
|
|
307
|
+
children: renderItem(item)
|
|
308
|
+
}, item.getKey()) : /* @__PURE__ */ jsx2(TreeItem, {
|
|
309
|
+
item,
|
|
310
|
+
startEnhancer: renderIcon?.(item),
|
|
311
|
+
density,
|
|
312
|
+
children: renderLabel?.(item)
|
|
313
|
+
}, item.getKey())),
|
|
314
|
+
dragLine && /* @__PURE__ */ jsx2("span", {
|
|
315
|
+
"data-slot": "tree-drop-indicator",
|
|
316
|
+
"aria-hidden": "true",
|
|
317
|
+
className: "pointer-events-none absolute h-0.5 bg-primary",
|
|
318
|
+
style: tree.getDragLineStyle(-1 - (element?.clientTop ?? 0), -(element?.clientLeft ?? 0))
|
|
319
|
+
})
|
|
320
|
+
]
|
|
321
|
+
})
|
|
257
322
|
});
|
|
258
323
|
}
|
|
259
324
|
// node_modules/@headless-tree/react/dist/chunk-FWCSY2DS.mjs
|
|
@@ -2479,6 +2544,7 @@ export {
|
|
|
2479
2544
|
AssistiveTreeDescription,
|
|
2480
2545
|
Tree,
|
|
2481
2546
|
TreeItem,
|
|
2547
|
+
TreeItemAction,
|
|
2482
2548
|
asyncDataLoaderFeature,
|
|
2483
2549
|
checkboxesFeature,
|
|
2484
2550
|
dragAndDropFeature,
|
package/dist/index.js
CHANGED
|
@@ -173,7 +173,7 @@ import {
|
|
|
173
173
|
StatusTracker2,
|
|
174
174
|
DashboardLayout2,
|
|
175
175
|
BillingUsage2
|
|
176
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-k1jr6r51.js";
|
|
177
177
|
import {
|
|
178
178
|
Combobox2,
|
|
179
179
|
ComboboxValue2,
|
|
@@ -242,7 +242,7 @@ import {
|
|
|
242
242
|
MenuShortcut2,
|
|
243
243
|
DropdownMenu2,
|
|
244
244
|
DropdownMenuTrigger2
|
|
245
|
-
} from "./chunk-
|
|
245
|
+
} from "./chunk-tegj7xts.js";
|
|
246
246
|
import {
|
|
247
247
|
Empty2,
|
|
248
248
|
EmptyHeader2,
|
package/dist/menu/types.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ interface IMenuItemOptions extends IMenuInsetProps {
|
|
|
10
10
|
* the item references through `aria-describedby`.
|
|
11
11
|
*/
|
|
12
12
|
disabledReason?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Runs once for each Enter, Space or click on an item disabled by `disabledReason`, so the consumer can announce the
|
|
15
|
+
* reason. The item still does nothing and the menu stays open; held keys do not repeat it.
|
|
16
|
+
*/
|
|
17
|
+
onDisabledSelect?: () => void;
|
|
13
18
|
}
|
|
14
19
|
export type MenuLabelProps = Menu.GroupLabel.Props & IMenuInsetProps;
|
|
15
20
|
export type MenuItemProps = Menu.Item.Props & IMenuItemOptions;
|
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.77",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -3157,6 +3157,7 @@ var package_default = {
|
|
|
3157
3157
|
"@vitest/coverage-istanbul": "4.1.11",
|
|
3158
3158
|
"@vitest/coverage-v8": "^4.1.6",
|
|
3159
3159
|
anser: "2.3.5",
|
|
3160
|
+
"axe-core": "4.14.0",
|
|
3160
3161
|
"beautiful-mermaid": "^1.1.3",
|
|
3161
3162
|
bun: "1.4.2",
|
|
3162
3163
|
"bun-plugin-tailwind": "^0.1.2",
|
|
@@ -607,6 +607,7 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
607
607
|
{
|
|
608
608
|
render: function Render() {
|
|
609
609
|
const [action, setAction] = useState("None");
|
|
610
|
+
const [announcements, setAnnouncements] = useState<string[]>([]);
|
|
610
611
|
return (<>
|
|
611
612
|
<DropdownMenu>
|
|
612
613
|
<DropdownMenuTrigger render={<Button variant="outline"/>}>Track actions</DropdownMenuTrigger>
|
|
@@ -616,7 +617,7 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
616
617
|
<FileIcon />
|
|
617
618
|
Edit track info…
|
|
618
619
|
</DropdownMenuItem>
|
|
619
|
-
<DropdownMenuItem disabledReason="One track only" onClick={() => setAction("Move")}>
|
|
620
|
+
<DropdownMenuItem disabledReason="One track only" onClick={() => setAction("Move")} onDisabledSelect={() => setAnnouncements((current) => [...current, "One track only"])}>
|
|
620
621
|
<SaveIcon />
|
|
621
622
|
Move audio file…
|
|
622
623
|
</DropdownMenuItem>
|
|
@@ -625,6 +626,7 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
625
626
|
</DropdownMenuContent>
|
|
626
627
|
</DropdownMenu>
|
|
627
628
|
<output aria-label="Menu action">{action}</output>
|
|
629
|
+
<output aria-label="Announcements">{announcements.join(" | ")}</output>
|
|
628
630
|
</>);
|
|
629
631
|
}
|
|
630
632
|
}
|
|
@@ -8,7 +8,7 @@ Source: src/components/stories/navigation/Tree.stories.tsx
|
|
|
8
8
|
## Public imports
|
|
9
9
|
|
|
10
10
|
```tsx
|
|
11
|
-
import { Tree, TreeItem, useTree, syncDataLoaderFeature, hotkeysCoreFeature, selectionFeature } from "@alexgorbatchev/shadcn/tree";
|
|
11
|
+
import { Tree, TreeItem, TreeItemAction, useTree, syncDataLoaderFeature, hotkeysCoreFeature, selectionFeature } from "@alexgorbatchev/shadcn/tree";
|
|
12
12
|
import { Button, ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuGroup, ContextMenuItem, InlineEdit } from "@alexgorbatchev/shadcn";
|
|
13
13
|
```
|
|
14
14
|
|
package/llms/setup.md
CHANGED
|
@@ -456,6 +456,8 @@ For nested layouts, compose `ActionsMenuTrigger`, `ActionsMenuContextTarget`, an
|
|
|
456
456
|
|
|
457
457
|
`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. `isDimmed` fades a settled row, such as completed work, to 70% opacity and exposes `data-dimmed`; hovering or focusing anything in the row restores full opacity, and the row stays interactive.
|
|
458
458
|
|
|
459
|
+
A `Tree` is one Tab stop: Tab reaches the focused item while it is visible, else the first selected item, else the first item, and the arrow keys move from there. Disclosure buttons are pointer targets outside the Tab order and the accessibility tree; the item's `aria-expanded` and the arrow keys carry the same state. Put secondary text such as a count in `description`, which the item exposes through `aria-describedby` instead of its name, with `descriptionLabel` when the spoken text differs ("12 tracks" for "12"). Put pointer shortcuts such as a ⋯ menu trigger in `actions`, each rendered as a `TreeItemAction` (including as a menu trigger's `render`): they stay out of the Tab order and the accessibility tree, so give the item a keyboard path to the same commands, such as Shift+F10 and the Menu key. Rows without an `endEnhancer` take their name from their visible label; `endEnhancer` keeps controls that must remain keyboard reachable on their own, and those rows keep the item name as their label.
|
|
460
|
+
|
|
459
461
|
Embedded actions, links, menus, editable fields, and media controls retain their own keyboard behavior. Registered anchor and button rows still participate in tree navigation; rename and search inputs retain their completion and cancellation shortcuts.
|
|
460
462
|
|
|
461
463
|
`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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexgorbatchev/shadcn",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.77",
|
|
4
4
|
"description": "Sharp, monospace React components with compact and comfortable densities.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -1106,6 +1106,7 @@
|
|
|
1106
1106
|
"@vitest/coverage-istanbul": "4.1.11",
|
|
1107
1107
|
"@vitest/coverage-v8": "^4.1.6",
|
|
1108
1108
|
"anser": "2.3.5",
|
|
1109
|
+
"axe-core": "4.14.0",
|
|
1109
1110
|
"beautiful-mermaid": "^1.1.3",
|
|
1110
1111
|
"bun": "1.4.2",
|
|
1111
1112
|
"bun-plugin-tailwind": "^0.1.2",
|