@alexgorbatchev/shadcn 0.0.81 → 0.0.83
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 +4 -0
- package/dist/{chunk-6em6sp6y.js → chunk-4r1fne02.js} +1 -1
- package/dist/{chunk-qq7brjez.js → chunk-kk558p5p.js} +381 -240
- package/dist/{chunk-tegj7xts.js → chunk-w8hgwhgc.js} +39 -5
- package/dist/components/MenuParts.d.ts +15 -1
- package/dist/components/MenuPopup.d.ts +2 -2
- package/dist/components/ReviewList.d.ts +26 -0
- 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/index.d.ts +3 -1
- package/dist/index.js +12 -2
- package/dist/menu/types.d.ts +8 -0
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/ReviewList.md +52 -0
- package/llms/components/navigation/DropdownMenu.md +56 -1
- package/llms/setup.md +4 -0
- package/llms.txt +1 -0
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-5mydsjp3.js";
|
|
18
18
|
|
|
19
19
|
// src/components/MenuPopup.tsx
|
|
20
|
+
import { useMemo } from "react";
|
|
20
21
|
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
21
22
|
import { jsx } from "react/jsx-runtime";
|
|
22
23
|
"use client";
|
|
@@ -34,6 +35,11 @@ function MenuPortal({ container, ref, children, ...props }) {
|
|
|
34
35
|
})
|
|
35
36
|
});
|
|
36
37
|
}
|
|
38
|
+
function usePointAnchor(point) {
|
|
39
|
+
const x = point?.clientX;
|
|
40
|
+
const y = point?.clientY;
|
|
41
|
+
return useMemo(() => x === undefined || y === undefined ? undefined : { getBoundingClientRect: () => DOMRect.fromRect({ x, y, width: 0, height: 0 }) }, [x, y]);
|
|
42
|
+
}
|
|
37
43
|
function MenuPopup({
|
|
38
44
|
density,
|
|
39
45
|
width = "content",
|
|
@@ -41,23 +47,24 @@ function MenuPopup({
|
|
|
41
47
|
alignOffset = 0,
|
|
42
48
|
side = "bottom",
|
|
43
49
|
sideOffset = 4,
|
|
50
|
+
point,
|
|
44
51
|
className,
|
|
45
52
|
...props
|
|
46
53
|
}) {
|
|
47
54
|
const resolvedDensity = useDensity(density);
|
|
48
55
|
const direction = useDirection2();
|
|
56
|
+
const anchor = usePointAnchor(point);
|
|
57
|
+
const placement = anchor ? { anchor, align: "start", alignOffset: 0, side: "bottom", sideOffset: 0, sticky: true } : { align, alignOffset, side, sideOffset };
|
|
49
58
|
return /* @__PURE__ */ jsx(MenuPortal, {
|
|
50
59
|
children: /* @__PURE__ */ jsx(MenuPrimitive.Positioner, {
|
|
51
60
|
dir: direction,
|
|
52
61
|
className: "isolate outline-none",
|
|
53
|
-
|
|
54
|
-
alignOffset,
|
|
55
|
-
side,
|
|
56
|
-
sideOffset,
|
|
62
|
+
...placement,
|
|
57
63
|
children: /* @__PURE__ */ jsx(MenuPrimitive.Popup, {
|
|
58
64
|
dir: direction,
|
|
59
65
|
"data-density": resolvedDensity,
|
|
60
66
|
"data-slot": "dropdown-menu-content",
|
|
67
|
+
"data-scroll": "none",
|
|
61
68
|
className: (state) => cn2("max-h-(--available-height) max-w-(--available-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-frame border border-frame-edge shadow-frame duration-120 outline-none data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0", width === "anchor" ? "w-(--anchor-width)" : "w-max", typeof className === "function" ? className(state) : className),
|
|
62
69
|
...props
|
|
63
70
|
})
|
|
@@ -198,6 +205,33 @@ function MenuSubContent2({
|
|
|
198
205
|
...props
|
|
199
206
|
});
|
|
200
207
|
}
|
|
208
|
+
function MenuFilterProvider2(props) {
|
|
209
|
+
return /* @__PURE__ */ jsx2(MenuPrimitive2.FilterProvider, {
|
|
210
|
+
...props
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function MenuInput2({ density, className, ...props }) {
|
|
214
|
+
return /* @__PURE__ */ jsx2(MenuPrimitive2.Input, {
|
|
215
|
+
"data-density": density,
|
|
216
|
+
"data-slot": "menu-input",
|
|
217
|
+
className: (state) => cn2("mb-1 h-control-sm w-full min-w-0 rounded-sm border border-input bg-secondary px-1.5 text-sm outline-none placeholder:text-faint-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring", typeof className === "function" ? className(state) : className),
|
|
218
|
+
...props
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function MenuList2(props) {
|
|
222
|
+
return /* @__PURE__ */ jsx2(MenuPrimitive2.List, {
|
|
223
|
+
"data-slot": "menu-list",
|
|
224
|
+
...props
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function MenuEmpty2({ density, className, ...props }) {
|
|
228
|
+
return /* @__PURE__ */ jsx2(MenuPrimitive2.Empty, {
|
|
229
|
+
"data-density": density,
|
|
230
|
+
"data-slot": "menu-empty",
|
|
231
|
+
className: (state) => cn2("px-1.5 py-1 text-sm text-muted-foreground empty:hidden", typeof className === "function" ? className(state) : className),
|
|
232
|
+
...props
|
|
233
|
+
});
|
|
234
|
+
}
|
|
201
235
|
function MenuCheckboxItem2({
|
|
202
236
|
analytics,
|
|
203
237
|
density,
|
|
@@ -294,4 +328,4 @@ function DropdownMenuTrigger2({ ...props }) {
|
|
|
294
328
|
});
|
|
295
329
|
}
|
|
296
330
|
|
|
297
|
-
export { MenuPortal, MenuPopup, MenuGroup2, MenuLabel2, MenuItem2, MenuLinkItem2, MenuSub2, MenuSubTrigger2, MenuSubContent2, MenuCheckboxItem2, MenuRadioGroup2, MenuRadioItem2, MenuSeparator2, MenuShortcut2, DropdownMenu2, DropdownMenuTrigger2 };
|
|
331
|
+
export { MenuPortal, MenuPopup, MenuGroup2, MenuLabel2, MenuItem2, MenuLinkItem2, MenuSub2, MenuSubTrigger2, MenuSubContent2, MenuFilterProvider2, MenuInput2, MenuList2, MenuEmpty2, MenuCheckboxItem2, MenuRadioGroup2, MenuRadioItem2, MenuSeparator2, MenuShortcut2, DropdownMenu2, DropdownMenuTrigger2 };
|
|
@@ -14,6 +14,20 @@ declare function MenuLinkItem({ analytics, density, className, inset, variant, .
|
|
|
14
14
|
declare function MenuSub({ analytics, ...props }: MenuPrimitive.SubmenuRoot.Props & IAnalyticsProps): ReactElement;
|
|
15
15
|
declare function MenuSubTrigger({ density, className, inset, children, ...props }: MenuSubTriggerProps): ReactElement;
|
|
16
16
|
declare function MenuSubContent({ density, align, alignOffset, side, sideOffset, className, ...props }: MenuPopupProps): ReactElement;
|
|
17
|
+
/**
|
|
18
|
+
* Makes the menu or submenu it wraps filterable: put a `MenuInput` at the top of its content and its items in a
|
|
19
|
+
* `MenuList`. Pass `filter={null}` with a controlled `value` to render the matching items yourself, for example to show
|
|
20
|
+
* only as many as fit.
|
|
21
|
+
*/
|
|
22
|
+
declare function MenuFilterProvider(props: MenuPrimitive.FilterProvider.Props): ReactElement;
|
|
23
|
+
type MenuInputProps = MenuPrimitive.Input.Props & IDensityProps;
|
|
24
|
+
/** The filter field of a `MenuFilterProvider` menu; typing narrows the items while the arrows keep moving among them. */
|
|
25
|
+
declare function MenuInput({ density, className, ...props }: MenuInputProps): ReactElement;
|
|
26
|
+
/** The items of a filterable menu, so the filter field can share the popup with them. */
|
|
27
|
+
declare function MenuList(props: MenuPrimitive.List.Props): ReactElement;
|
|
28
|
+
type MenuEmptyProps = MenuPrimitive.Empty.Props & IDensityProps;
|
|
29
|
+
/** Shown in a filterable menu when no item matches its query. */
|
|
30
|
+
declare function MenuEmpty({ density, className, ...props }: MenuEmptyProps): ReactElement;
|
|
17
31
|
declare function MenuCheckboxItem({ analytics, density, className, children, checked, inset, ...props }: MenuCheckboxItemProps & IAnalyticsProps): ReactElement;
|
|
18
32
|
declare function MenuRadioGroup({ analytics, ...props }: MenuPrimitive.RadioGroup.Props & IAnalyticsProps): ReactElement;
|
|
19
33
|
declare function MenuRadioItem({ density, className, children, inset, ...props }: MenuRadioItemProps): ReactElement;
|
|
@@ -21,4 +35,4 @@ type MenuSeparatorProps = MenuPrimitive.Separator.Props & IDensityProps;
|
|
|
21
35
|
declare function MenuSeparator({ density, className, ...props }: MenuSeparatorProps): ReactElement;
|
|
22
36
|
type MenuShortcutProps = ComponentProps<"span"> & IDensityProps;
|
|
23
37
|
declare function MenuShortcut({ density, className, ...props }: MenuShortcutProps): ReactElement;
|
|
24
|
-
export { MenuGroup, MenuLabel, MenuItem, MenuLinkItem, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSub, MenuSubTrigger, MenuSubContent, };
|
|
38
|
+
export { MenuGroup, MenuLabel, MenuItem, MenuLinkItem, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSub, MenuSubTrigger, MenuSubContent, MenuFilterProvider, MenuInput, MenuList, MenuEmpty, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MenuPopupProps } from "../menu/types.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type ReactElement } from "react";
|
|
3
3
|
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
4
4
|
declare function MenuPortal({ container, ref, children, ...props }: MenuPrimitive.Portal.Props): ReactElement;
|
|
5
|
-
declare function MenuPopup({ density, width, align, alignOffset, side, sideOffset, className, ...props }: MenuPopupProps): ReactElement;
|
|
5
|
+
declare function MenuPopup({ density, width, align, alignOffset, side, sideOffset, point, className, ...props }: MenuPopupProps): ReactElement;
|
|
6
6
|
export { MenuPortal, MenuPopup };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
export interface IReviewListRow {
|
|
3
|
+
id: string;
|
|
4
|
+
/** Whether the plan includes this row's change. */
|
|
5
|
+
isIncluded: boolean;
|
|
6
|
+
/** The checkbox's accessible name, such as "Include Undertow Signal by Fenwick Rao". */
|
|
7
|
+
checkboxLabel: string;
|
|
8
|
+
/** The row's description, its first cell after the checkbox. */
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
/** Further cells with their own controls, which ← and → reach; give those controls `tabIndex={-1}`. */
|
|
11
|
+
cells?: readonly ReactNode[];
|
|
12
|
+
}
|
|
13
|
+
interface IReviewListProps {
|
|
14
|
+
label: string;
|
|
15
|
+
rows: readonly IReviewListRow[];
|
|
16
|
+
/** Sets the inclusion of these rows; a range or Mod+A changes several at once. */
|
|
17
|
+
onIncludedChange: (ids: readonly string[], isIncluded: boolean) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A plan's review rows, where a tick means "include this change". It is one tab stop with a cursor: ↑/↓, Home and End
|
|
21
|
+
* move between rows and ← and → between a row's cells. A click only moves the cursor, so a stray click never changes
|
|
22
|
+
* what the plan includes; the checkbox, Mod+click, X and Shift+Space toggle a row, Shift+click sets the range from the
|
|
23
|
+
* anchor row to the anchor's state, and Mod+A includes every row. Space is left to the page, such as a player.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ReviewList({ label, rows, onIncludedChange }: IReviewListProps): ReactElement;
|
|
26
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RegenerateMenu2
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import"../../../chunk-
|
|
3
|
+
} from "../../../chunk-4r1fne02.js";
|
|
4
|
+
import"../../../chunk-w8hgwhgc.js";
|
|
5
5
|
import"../../../chunk-32t5kc0y.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-nqgpzqmk.js";
|
|
484
|
-
import"../../chunk-
|
|
484
|
+
import"../../chunk-w8hgwhgc.js";
|
|
485
485
|
import {
|
|
486
486
|
RegenerateMenu2
|
|
487
|
-
} from "../../chunk-
|
|
487
|
+
} from "../../chunk-4r1fne02.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-kk558p5p.js";
|
|
35
35
|
import {
|
|
36
36
|
MenuPopup,
|
|
37
37
|
MenuItem2,
|
|
38
38
|
DropdownMenu2,
|
|
39
39
|
DropdownMenuTrigger2
|
|
40
|
-
} from "../../chunk-
|
|
40
|
+
} from "../../chunk-w8hgwhgc.js";
|
|
41
41
|
import {
|
|
42
42
|
Alert2,
|
|
43
43
|
AlertTitle2,
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export { ButtonLink } from "./components/ButtonLink.js";
|
|
|
3
3
|
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, } from "./components/DropdownMenu.js";
|
|
4
4
|
export { ActionsMenu, ActionsMenuTrigger, ActionsMenuContextTarget, ActionsMenuContextContent, } from "./components/ActionsMenu.js";
|
|
5
5
|
export type { IActionsMenuProps, ActionsMenuTriggerProps } from "./components/ActionsMenu.js";
|
|
6
|
-
export { MenuGroup, MenuLabel, MenuLinkItem, MenuItem, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSub, MenuSubTrigger, MenuSubContent, } from "./components/MenuParts.js";
|
|
6
|
+
export { MenuGroup, MenuLabel, MenuLinkItem, MenuItem, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSub, MenuSubTrigger, MenuSubContent, MenuFilterProvider, MenuInput, MenuList, MenuEmpty, } from "./components/MenuParts.js";
|
|
7
|
+
export type { MenuPoint, MenuPopupProps } from "./menu/types.js";
|
|
7
8
|
export { FormDialog } from "./components/FormDialog.js";
|
|
8
9
|
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "./components/Accordion.js";
|
|
9
10
|
export { Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, } from "./components/Popover.js";
|
|
@@ -91,6 +92,7 @@ export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupActio
|
|
|
91
92
|
export { useSidebar } from "./hooks/useSidebar.js";
|
|
92
93
|
export { InlineEdit } from "./components/InlineEdit.js";
|
|
93
94
|
export { StarRating } from "./components/StarRating.js";
|
|
95
|
+
export { ReviewList, type IReviewListRow } from "./components/ReviewList.js";
|
|
94
96
|
export { ConfirmationDialog } from "./components/ConfirmationDialog.js";
|
|
95
97
|
export { ImagePicker } from "./components/ImagePicker.js";
|
|
96
98
|
export type { SidebarStyle, SidebarPartState, SidebarMenuButtonState, SidebarMenuSubButtonState, } from "./sidebar/types.js";
|
package/dist/index.js
CHANGED
|
@@ -139,6 +139,7 @@ import {
|
|
|
139
139
|
AttachmentGroup2,
|
|
140
140
|
InlineEdit2,
|
|
141
141
|
StarRating2,
|
|
142
|
+
ReviewList2,
|
|
142
143
|
ConfirmationDialog2,
|
|
143
144
|
ImagePicker2,
|
|
144
145
|
Meter2,
|
|
@@ -173,7 +174,7 @@ import {
|
|
|
173
174
|
StatusTracker2,
|
|
174
175
|
DashboardLayout2,
|
|
175
176
|
BillingUsage2
|
|
176
|
-
} from "./chunk-
|
|
177
|
+
} from "./chunk-kk558p5p.js";
|
|
177
178
|
import {
|
|
178
179
|
Combobox2,
|
|
179
180
|
ComboboxValue2,
|
|
@@ -235,6 +236,10 @@ import {
|
|
|
235
236
|
MenuSub2,
|
|
236
237
|
MenuSubTrigger2,
|
|
237
238
|
MenuSubContent2,
|
|
239
|
+
MenuFilterProvider2,
|
|
240
|
+
MenuInput2,
|
|
241
|
+
MenuList2,
|
|
242
|
+
MenuEmpty2,
|
|
238
243
|
MenuCheckboxItem2,
|
|
239
244
|
MenuRadioGroup2,
|
|
240
245
|
MenuRadioItem2,
|
|
@@ -242,7 +247,7 @@ import {
|
|
|
242
247
|
MenuShortcut2,
|
|
243
248
|
DropdownMenu2,
|
|
244
249
|
DropdownMenuTrigger2
|
|
245
|
-
} from "./chunk-
|
|
250
|
+
} from "./chunk-w8hgwhgc.js";
|
|
246
251
|
import {
|
|
247
252
|
Empty2,
|
|
248
253
|
EmptyHeader2,
|
|
@@ -670,10 +675,14 @@ export {
|
|
|
670
675
|
MarkerContent2 as MarkerContent,
|
|
671
676
|
MarkerIcon2 as MarkerIcon,
|
|
672
677
|
MenuCheckboxItem2 as MenuCheckboxItem,
|
|
678
|
+
MenuEmpty2 as MenuEmpty,
|
|
679
|
+
MenuFilterProvider2 as MenuFilterProvider,
|
|
673
680
|
MenuGroup2 as MenuGroup,
|
|
681
|
+
MenuInput2 as MenuInput,
|
|
674
682
|
MenuItem2 as MenuItem,
|
|
675
683
|
MenuLabel2 as MenuLabel,
|
|
676
684
|
MenuLinkItem2 as MenuLinkItem,
|
|
685
|
+
MenuList2 as MenuList,
|
|
677
686
|
MenuRadioGroup2 as MenuRadioGroup,
|
|
678
687
|
MenuRadioItem2 as MenuRadioItem,
|
|
679
688
|
MenuSeparator2 as MenuSeparator,
|
|
@@ -750,6 +759,7 @@ export {
|
|
|
750
759
|
ProgressValue2 as ProgressValue,
|
|
751
760
|
RadioGroup2 as RadioGroup,
|
|
752
761
|
RadioGroupItem2 as RadioGroupItem,
|
|
762
|
+
ReviewList2 as ReviewList,
|
|
753
763
|
ScrollArea2 as ScrollArea,
|
|
754
764
|
ScrollBar2 as ScrollBar,
|
|
755
765
|
ScrollGuard2 as ScrollGuard,
|
package/dist/menu/types.d.ts
CHANGED
|
@@ -21,7 +21,15 @@ export type MenuItemProps = Menu.Item.Props & IMenuItemOptions;
|
|
|
21
21
|
export type MenuSubTriggerProps = Menu.SubmenuTrigger.Props & IMenuInsetProps;
|
|
22
22
|
export type MenuCheckboxItemProps = Menu.CheckboxItem.Props & IMenuInsetProps;
|
|
23
23
|
export type MenuRadioItemProps = Menu.RadioItem.Props & IMenuInsetProps;
|
|
24
|
+
/** A viewport point in CSS pixels, such as the right-click event that asked for a menu. */
|
|
25
|
+
export type MenuPoint = Pick<MouseEvent, "clientX" | "clientY">;
|
|
24
26
|
export type MenuPopupProps = Menu.Popup.Props & Pick<Menu.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset"> & IDensityProps & {
|
|
25
27
|
width?: "content" | "anchor";
|
|
28
|
+
/**
|
|
29
|
+
* Opens the menu at this viewport point instead of at its trigger, as a context menu opens at the pointer. The
|
|
30
|
+
* menu's top start corner sits on the point; where the menu does not fit, it flips to the side with room and then
|
|
31
|
+
* shifts until it lies wholly inside the viewport. `side`, `align` and their offsets are ignored.
|
|
32
|
+
*/
|
|
33
|
+
point?: MenuPoint;
|
|
26
34
|
};
|
|
27
35
|
export {};
|
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.83",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# ReviewList
|
|
2
|
+
|
|
3
|
+
Story: @alexgorbatchev/shadcn/components/data-display/ReviewList
|
|
4
|
+
Source: src/components/stories/data-display/ReviewList.stories.tsx
|
|
5
|
+
|
|
6
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/ReviewList.stories.tsx)
|
|
7
|
+
|
|
8
|
+
## Public imports
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { ReviewList, type IReviewListRow, Button } from "@alexgorbatchev/shadcn";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Supporting imports
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { useState, type ReactElement } from "react";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Default component
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
ReviewList
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Default args
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
{ label: "Tracks", rows: [], onIncludedChange: () => undefined }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Default render
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
() => <ReviewListExample />
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
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.
|
|
41
|
+
|
|
42
|
+
### PointerGestures
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
{}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### KeyboardGestures
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
{}
|
|
52
|
+
```
|
|
@@ -8,7 +8,7 @@ Source: src/components/stories/navigation/DropdownMenu.stories.tsx
|
|
|
8
8
|
## Public imports
|
|
9
9
|
|
|
10
10
|
```tsx
|
|
11
|
-
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, Button, DirectionProvider, Avatar, AvatarImage, AvatarFallback } from "@alexgorbatchev/shadcn";
|
|
11
|
+
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, MenuEmpty, MenuFilterProvider, MenuInput, MenuList, type MenuPoint, Button, DirectionProvider, Avatar, AvatarImage, AvatarFallback } from "@alexgorbatchev/shadcn";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Supporting imports
|
|
@@ -631,3 +631,58 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
633
|
```
|
|
634
|
+
|
|
635
|
+
### AtPoint
|
|
636
|
+
|
|
637
|
+
```tsx
|
|
638
|
+
{
|
|
639
|
+
render: function Render() {
|
|
640
|
+
const [point, setPoint] = useState<MenuPoint>();
|
|
641
|
+
const [row, setRow] = useState<string>();
|
|
642
|
+
return (<div className="flex flex-col gap-1">
|
|
643
|
+
{["Alpha", "Bravo", "Charlie"].map((name) => (<div key={name} role="button" tabIndex={0} className="rounded-sm border border-border px-2 py-1" onContextMenu={(event) => {
|
|
644
|
+
event.preventDefault();
|
|
645
|
+
setRow(name);
|
|
646
|
+
setPoint({ clientX: event.clientX, clientY: event.clientY });
|
|
647
|
+
}}>
|
|
648
|
+
{name}
|
|
649
|
+
</div>))}
|
|
650
|
+
<DropdownMenu open={point !== undefined} onOpenChange={(isOpen) => !isOpen && setPoint(undefined)}>
|
|
651
|
+
<DropdownMenuContent point={point} aria-label={`Actions for ${row ?? "row"}`}>
|
|
652
|
+
<DropdownMenuGroup>
|
|
653
|
+
<DropdownMenuLabel>{row}</DropdownMenuLabel>
|
|
654
|
+
<DropdownMenuItem>Open</DropdownMenuItem>
|
|
655
|
+
<DropdownMenuItem>Rename</DropdownMenuItem>
|
|
656
|
+
</DropdownMenuGroup>
|
|
657
|
+
</DropdownMenuContent>
|
|
658
|
+
</DropdownMenu>
|
|
659
|
+
</div>);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
### FilterableSubmenu
|
|
665
|
+
|
|
666
|
+
```tsx
|
|
667
|
+
{
|
|
668
|
+
render: () => (<DropdownMenu>
|
|
669
|
+
<DropdownMenuTrigger render={<Button variant="outline"/>}>Track actions</DropdownMenuTrigger>
|
|
670
|
+
<DropdownMenuContent>
|
|
671
|
+
<DropdownMenuGroup>
|
|
672
|
+
<MenuFilterProvider>
|
|
673
|
+
<DropdownMenuSub>
|
|
674
|
+
<DropdownMenuSubTrigger>Add to playlist</DropdownMenuSubTrigger>
|
|
675
|
+
<DropdownMenuSubContent aria-label="Add to playlist">
|
|
676
|
+
<MenuInput aria-label="Filter playlists" placeholder="Filter playlists"/>
|
|
677
|
+
<MenuList>
|
|
678
|
+
{PLAYLISTS.map((playlist) => (<DropdownMenuItem key={playlist}>{playlist}</DropdownMenuItem>))}
|
|
679
|
+
</MenuList>
|
|
680
|
+
<MenuEmpty>No playlists match</MenuEmpty>
|
|
681
|
+
</DropdownMenuSubContent>
|
|
682
|
+
</DropdownMenuSub>
|
|
683
|
+
</MenuFilterProvider>
|
|
684
|
+
</DropdownMenuGroup>
|
|
685
|
+
</DropdownMenuContent>
|
|
686
|
+
</DropdownMenu>)
|
|
687
|
+
}
|
|
688
|
+
```
|
package/llms/setup.md
CHANGED
|
@@ -452,6 +452,10 @@ Keep preferred widths separate from the table's rendered sizing atom. In `onFitW
|
|
|
452
452
|
|
|
453
453
|
`ActionsMenu` shares one `items` definition between a dropdown action and an optional context menu. Supply an accessible `label`; the default trigger is a ghost icon button. `size="sm"` displays the label, and `variant`, `disabled`, and `trigger` customize the action. Supplying `contextTarget` composes the native context trigger with that element and adds its popup. Compose items with `MenuItem`, `MenuLinkItem`, checkbox/radio parts, groups, labels, separators, shortcuts, and submenu parts; dropdown and context menus share these implementations. `MenuLinkItem` retains its native anchor and menu keyboard semantics.
|
|
454
454
|
|
|
455
|
+
Menus never scroll. `DropdownMenuContent`, `ContextMenuContent`, and submenu content carry `data-scroll="none"`, so the development `ScrollGuard` reports a menu whose content outgrows the viewport; shorten it, for example by grouping items under submenus, instead of letting it scroll. A list longer than a menu should show belongs in a filterable menu: wrap the menu or submenu root in `MenuFilterProvider`, put `MenuInput` at the top of its content, its items in `MenuList`, and an optional `MenuEmpty` message after them. Typing narrows the items while the arrow keys keep moving among them. Pass `filter={null}` with a controlled `value` and `onValueChange` to render the matching items yourself, for example only as many as fit.
|
|
456
|
+
|
|
457
|
+
One menu instance can serve a whole list: open it through a `DropdownMenu` `handle` with each row's payload, and pass `point={{ clientX: event.clientX, clientY: event.clientY }}` to `DropdownMenuContent` when a right-click opened it, so it opens at the pointer instead of at the row's trigger. At a point the menu's top start corner sits on the pointer; near the viewport's edges it flips to the side with room and then shifts until it lies wholly inside the viewport. Leave `point` unset for keyboard and trigger opens, which anchor to their trigger.
|
|
458
|
+
|
|
455
459
|
For nested layouts, compose `ActionsMenuTrigger`, `ActionsMenuContextTarget`, and `ActionsMenuContextContent` explicitly inside `ActionsMenu`. The dropdown trigger owns its local native dropdown root and popup; the context target and content share an independent context root. A tree row can use `TreeItem render={<ActionsMenuContextTarget />}` and put the trigger in its action slot. For a table row, render the context target as the actual `tr`, then place the dropdown trigger and context content inside a `td`: native popup portals insert focus guards at their declaration, which must remain valid table children.
|
|
456
460
|
|
|
457
461
|
`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.
|
package/llms.txt
CHANGED
|
@@ -348,6 +348,7 @@ Generated from the public package exports and Storybook sources.
|
|
|
348
348
|
- [JsonViewer](./llms/components/data-display/JsonViewer.md)
|
|
349
349
|
- [Kbd](./llms/components/data-display/Kbd.md)
|
|
350
350
|
- [Meter](./llms/components/data-display/Meter.md)
|
|
351
|
+
- [ReviewList](./llms/components/data-display/ReviewList.md)
|
|
351
352
|
- [Sparkline](./llms/components/data-display/Sparkline.md)
|
|
352
353
|
- [StatCard](./llms/components/data-display/StatCard.md)
|
|
353
354
|
- [StatusTracker](./llms/components/data-display/StatusTracker.md)
|