@alexgorbatchev/shadcn 0.0.129 → 0.0.130
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/dist/{chunk-b6472409.js → chunk-aasp54x3.js} +1 -1
- package/dist/{chunk-k7c5h30v.js → chunk-rzdp3st2.js} +1 -1
- package/dist/{chunk-dbxmw9ya.js → chunk-zrmtxp7r.js} +2 -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/index.js +2 -2
- package/dist/menu/types.d.ts +10 -2
- package/dist/prototype.js +1 -1
- package/llms/components/navigation/DropdownMenu.md +42 -1
- package/package.json +1 -1
|
@@ -38,7 +38,8 @@ function MenuPortal({ container, ref, children, ...props }) {
|
|
|
38
38
|
function usePointAnchor(point) {
|
|
39
39
|
const x = point?.clientX;
|
|
40
40
|
const y = point?.clientY;
|
|
41
|
-
|
|
41
|
+
const height = point?.height ?? 0;
|
|
42
|
+
return useMemo(() => x === undefined || y === undefined ? undefined : { getBoundingClientRect: () => DOMRect.fromRect({ x, y, width: 0, height }) }, [x, y, height]);
|
|
42
43
|
}
|
|
43
44
|
function MenuPopup({
|
|
44
45
|
density,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RegenerateMenu2
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import"../../../chunk-
|
|
3
|
+
} from "../../../chunk-aasp54x3.js";
|
|
4
|
+
import"../../../chunk-zrmtxp7r.js";
|
|
5
5
|
import"../../../chunk-2sx8m8b2.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-x3gz994f.js";
|
|
484
|
-
import"../../chunk-
|
|
484
|
+
import"../../chunk-zrmtxp7r.js";
|
|
485
485
|
import {
|
|
486
486
|
RegenerateMenu2
|
|
487
|
-
} from "../../chunk-
|
|
487
|
+
} from "../../chunk-aasp54x3.js";
|
|
488
488
|
import {
|
|
489
489
|
ResearchReport2
|
|
490
490
|
} from "../../chunk-fdhssr0q.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
PaginationPrevious2,
|
|
27
27
|
PaginationNext2,
|
|
28
28
|
PaginationEllipsis2
|
|
29
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-rzdp3st2.js";
|
|
30
30
|
import {
|
|
31
31
|
MenuPopup,
|
|
32
32
|
MenuItem2,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
MenuRadioItem2,
|
|
35
35
|
DropdownMenu2,
|
|
36
36
|
DropdownMenuTrigger2
|
|
37
|
-
} from "../../chunk-
|
|
37
|
+
} from "../../chunk-zrmtxp7r.js";
|
|
38
38
|
import {
|
|
39
39
|
Alert2,
|
|
40
40
|
AlertTitle2,
|
package/dist/index.js
CHANGED
|
@@ -187,7 +187,7 @@ import {
|
|
|
187
187
|
StatusTracker2,
|
|
188
188
|
DashboardLayout2,
|
|
189
189
|
BillingUsage2
|
|
190
|
-
} from "./chunk-
|
|
190
|
+
} from "./chunk-rzdp3st2.js";
|
|
191
191
|
import {
|
|
192
192
|
Combobox2,
|
|
193
193
|
ComboboxValue2,
|
|
@@ -266,7 +266,7 @@ import {
|
|
|
266
266
|
MenuShortcut2,
|
|
267
267
|
DropdownMenu2,
|
|
268
268
|
DropdownMenuTrigger2
|
|
269
|
-
} from "./chunk-
|
|
269
|
+
} from "./chunk-zrmtxp7r.js";
|
|
270
270
|
import {
|
|
271
271
|
Empty2,
|
|
272
272
|
EmptyHeader2,
|
package/dist/menu/types.d.ts
CHANGED
|
@@ -28,13 +28,21 @@ export type MenuSubTriggerProps = Menu.SubmenuTrigger.Props & IMenuInsetProps;
|
|
|
28
28
|
export type MenuCheckboxItemProps = Menu.CheckboxItem.Props & IMenuInsetProps;
|
|
29
29
|
export type MenuRadioItemProps = Menu.RadioItem.Props & IMenuInsetProps;
|
|
30
30
|
/** A viewport point in CSS pixels, such as the right-click event that asked for a menu. */
|
|
31
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Where a menu opens without a trigger. A pointer gives a point; a keyboard opening on a row gives the row's top and
|
|
33
|
+
* `height`, so the menu opens below the row and, where it does not fit, flips above it instead of over it.
|
|
34
|
+
*/
|
|
35
|
+
export type MenuPoint = Pick<MouseEvent, "clientX" | "clientY"> & {
|
|
36
|
+
height?: number;
|
|
37
|
+
};
|
|
32
38
|
export type MenuPopupProps = Menu.Popup.Props & Pick<Menu.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset"> & IDensityProps & {
|
|
33
39
|
width?: "content" | "anchor";
|
|
34
40
|
/**
|
|
35
41
|
* Opens the menu at this viewport point instead of at its trigger, as a context menu opens at the pointer. The
|
|
36
42
|
* menu's top start corner sits on the point; where the menu does not fit, it flips to the side with room and then
|
|
37
|
-
* shifts until it lies wholly inside the viewport. `
|
|
43
|
+
* shifts until it lies wholly inside the viewport. With a `height`, the point is the top of a box that tall, such as
|
|
44
|
+
* the row a keyboard opened the menu from: the menu opens below it or above it, never over it. `side`, `align` and
|
|
45
|
+
* their offsets are ignored.
|
|
38
46
|
*/
|
|
39
47
|
point?: MenuPoint;
|
|
40
48
|
};
|
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.130",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -14,7 +14,7 @@ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGro
|
|
|
14
14
|
## Supporting imports
|
|
15
15
|
|
|
16
16
|
```tsx
|
|
17
|
-
import { useState, type ReactElement } from "react";
|
|
17
|
+
import { useState, type KeyboardEvent, type ReactElement } from "react";
|
|
18
18
|
import {
|
|
19
19
|
BellIcon,
|
|
20
20
|
MailIcon,
|
|
@@ -690,6 +690,47 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
690
690
|
}
|
|
691
691
|
```
|
|
692
692
|
|
|
693
|
+
### AtRowFromKeyboard
|
|
694
|
+
|
|
695
|
+
```tsx
|
|
696
|
+
{
|
|
697
|
+
render: function Render() {
|
|
698
|
+
const [point, setPoint] = useState<MenuPoint>();
|
|
699
|
+
const [row, setRow] = useState<string>();
|
|
700
|
+
const openAt = (name: string, element: HTMLElement) => {
|
|
701
|
+
const rect = element.getBoundingClientRect();
|
|
702
|
+
setRow(name);
|
|
703
|
+
setPoint({ clientX: rect.left + 16, clientY: rect.top, height: rect.height });
|
|
704
|
+
};
|
|
705
|
+
const rowProps = (name: string) => ({
|
|
706
|
+
role: "button",
|
|
707
|
+
tabIndex: 0,
|
|
708
|
+
className: "rounded-sm border border-border px-2 py-1",
|
|
709
|
+
onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => {
|
|
710
|
+
if (event.key !== "F10" || !event.shiftKey)
|
|
711
|
+
return;
|
|
712
|
+
event.preventDefault();
|
|
713
|
+
openAt(name, event.currentTarget);
|
|
714
|
+
},
|
|
715
|
+
});
|
|
716
|
+
return (<div className="flex h-[calc(100vh-2rem)] flex-col justify-between">
|
|
717
|
+
<div {...rowProps("Alpha")}>Alpha</div>
|
|
718
|
+
<div {...rowProps("Bravo")}>Bravo</div>
|
|
719
|
+
<DropdownMenu open={point !== undefined} onOpenChange={(isOpen) => !isOpen && setPoint(undefined)}>
|
|
720
|
+
<DropdownMenuContent point={point} aria-label={`Actions for ${row ?? "row"}`}>
|
|
721
|
+
<DropdownMenuGroup>
|
|
722
|
+
<DropdownMenuLabel>{row}</DropdownMenuLabel>
|
|
723
|
+
<DropdownMenuItem>Open</DropdownMenuItem>
|
|
724
|
+
<DropdownMenuItem>Rename</DropdownMenuItem>
|
|
725
|
+
<DropdownMenuItem>Move</DropdownMenuItem>
|
|
726
|
+
</DropdownMenuGroup>
|
|
727
|
+
</DropdownMenuContent>
|
|
728
|
+
</DropdownMenu>
|
|
729
|
+
</div>);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
```
|
|
733
|
+
|
|
693
734
|
### FilterableSubmenu
|
|
694
735
|
|
|
695
736
|
```tsx
|