@alexgorbatchev/shadcn 0.0.88 → 0.0.89

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.
@@ -78,7 +78,7 @@ import { Menu as MenuPrimitive2 } from "@base-ui/react/menu";
78
78
  import { ChevronRightIcon, CheckIcon } from "lucide-react";
79
79
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
80
80
  "use client";
81
- 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";
81
+ var menuItemClassName = "group/menu-item relative flex cursor-default items-center data-has-description:flex-wrap 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";
82
82
  function MenuGroup2({ ...props }) {
83
83
  return /* @__PURE__ */ jsx2(MenuPrimitive2.Group, {
84
84
  "data-slot": "menu-group",
@@ -100,12 +100,14 @@ function MenuItem2({
100
100
  className,
101
101
  inset,
102
102
  variant = "default",
103
+ description,
103
104
  disabledReason,
104
105
  onDisabledSelect,
105
106
  children,
106
107
  ...props
107
108
  }) {
108
109
  const trackedOnClick = useAnalyticsCallback("MenuItem", analytics, { name: "ui.activate" }, props.onClick);
110
+ const descriptionId = useId();
109
111
  const reasonId = useId();
110
112
  const disabledSelect = disabledReason ? {
111
113
  onClickCapture: (event) => {
@@ -124,15 +126,23 @@ function MenuItem2({
124
126
  "data-slot": "menu-item",
125
127
  "data-inset": inset,
126
128
  "data-variant": variant,
129
+ "data-has-description": description ? "" : undefined,
127
130
  "data-has-reason": disabledReason ? "" : undefined,
128
131
  className: (state) => cn2(menuItemClassName, typeof className === "function" ? className(state) : className),
129
132
  ...props,
130
133
  disabled: Boolean(disabledReason) || props.disabled,
131
- "aria-describedby": [props["aria-describedby"], disabledReason ? reasonId : undefined].filter(Boolean).join(" ") || undefined,
134
+ "aria-describedby": [props["aria-describedby"], description ? descriptionId : undefined, disabledReason ? reasonId : undefined].filter(Boolean).join(" ") || undefined,
132
135
  onClick: trackedOnClick,
133
136
  ...disabledSelect,
134
137
  children: [
135
138
  children,
139
+ description && /* @__PURE__ */ jsx2("span", {
140
+ id: descriptionId,
141
+ "aria-hidden": true,
142
+ "data-slot": "menu-item-description",
143
+ className: "basis-full text-xs text-muted-foreground group-has-[>svg]/menu-item:ps-6",
144
+ children: description
145
+ }),
136
146
  disabledReason && /* @__PURE__ */ jsx2("span", {
137
147
  id: reasonId,
138
148
  "data-slot": "menu-item-reason",
@@ -38,7 +38,7 @@ import {
38
38
  MenuShortcut2,
39
39
  DropdownMenu2,
40
40
  DropdownMenuTrigger2
41
- } from "./chunk-e6mnfecj.js";
41
+ } from "./chunk-dbxmw9ya.js";
42
42
  import {
43
43
  Alert2,
44
44
  AlertTitle2,
@@ -9,7 +9,7 @@ import {
9
9
  MenuItem2,
10
10
  DropdownMenu2,
11
11
  DropdownMenuTrigger2
12
- } from "./chunk-e6mnfecj.js";
12
+ } from "./chunk-dbxmw9ya.js";
13
13
  import {
14
14
  mono
15
15
  } from "./chunk-fgmcbtyt.js";
@@ -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, onDisabledSelect, children, ...props }: MenuItemProps & IAnalyticsProps): ReactElement;
8
+ declare function MenuItem({ analytics, density, className, inset, variant, description, 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-tpesmyp0.js";
4
- import"../../../chunk-e6mnfecj.js";
3
+ } from "../../../chunk-yd3h2yx1.js";
4
+ import"../../../chunk-dbxmw9ya.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-e6mnfecj.js";
484
+ import"../../chunk-dbxmw9ya.js";
485
485
  import {
486
486
  RegenerateMenu2
487
- } from "../../chunk-tpesmyp0.js";
487
+ } from "../../chunk-yd3h2yx1.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-k8119w3b.js";
34
+ } from "../../chunk-kr38ww4n.js";
35
35
  import {
36
36
  MenuPopup,
37
37
  MenuItem2,
38
38
  DropdownMenu2,
39
39
  DropdownMenuTrigger2
40
- } from "../../chunk-e6mnfecj.js";
40
+ } from "../../chunk-dbxmw9ya.js";
41
41
  import {
42
42
  Alert2,
43
43
  AlertTitle2,
package/dist/index.js CHANGED
@@ -176,7 +176,7 @@ import {
176
176
  StatusTracker2,
177
177
  DashboardLayout2,
178
178
  BillingUsage2
179
- } from "./chunk-k8119w3b.js";
179
+ } from "./chunk-kr38ww4n.js";
180
180
  import {
181
181
  Combobox2,
182
182
  ComboboxValue2,
@@ -249,7 +249,7 @@ import {
249
249
  MenuShortcut2,
250
250
  DropdownMenu2,
251
251
  DropdownMenuTrigger2
252
- } from "./chunk-e6mnfecj.js";
252
+ } from "./chunk-dbxmw9ya.js";
253
253
  import {
254
254
  Empty2,
255
255
  EmptyHeader2,
@@ -5,6 +5,12 @@ interface IMenuInsetProps extends IDensityProps {
5
5
  }
6
6
  interface IMenuItemOptions extends IMenuInsetProps {
7
7
  variant?: "default" | "destructive";
8
+ /**
9
+ * Shows a short secondary line under the label, such as what the item changes, that the item references through
10
+ * `aria-describedby` as its accessible description rather than as part of its name. With `disabledReason`, the
11
+ * description comes first.
12
+ */
13
+ description?: string;
8
14
  /**
9
15
  * Disables the item while keeping it reachable with the arrow keys, and shows why as visible secondary text that
10
16
  * the item references through `aria-describedby`.
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.88",
2054
+ version: "0.0.89",
2055
2055
  description: "Sharp, monospace React components with compact and comfortable densities.",
2056
2056
  license: "MIT",
2057
2057
  repository: {
@@ -632,6 +632,35 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
632
632
  }
633
633
  ```
634
634
 
635
+ ### Descriptions
636
+
637
+ ```tsx
638
+ {
639
+ render: function Render() {
640
+ const [action, setAction] = useState("None");
641
+ return (<>
642
+ <DropdownMenu>
643
+ <DropdownMenuTrigger render={<Button variant="outline"/>}>Track actions</DropdownMenuTrigger>
644
+ <DropdownMenuContent>
645
+ <DropdownMenuGroup>
646
+ <DropdownMenuItem description="writes into the files" onClick={() => setAction("File tags")}>
647
+ <FileIcon />
648
+ File tags…
649
+ </DropdownMenuItem>
650
+ <DropdownMenuItem description="moves the file" disabledReason="One track only">
651
+ <SaveIcon />
652
+ Move audio file…
653
+ </DropdownMenuItem>
654
+ <DropdownMenuItem description="reads the audio again">Analyze…</DropdownMenuItem>
655
+ </DropdownMenuGroup>
656
+ </DropdownMenuContent>
657
+ </DropdownMenu>
658
+ <output aria-label="Menu action">{action}</output>
659
+ </>);
660
+ }
661
+ }
662
+ ```
663
+
635
664
  ### AtPoint
636
665
 
637
666
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.88",
3
+ "version": "0.0.89",
4
4
  "description": "Sharp, monospace React components with compact and comfortable densities.",
5
5
  "license": "MIT",
6
6
  "repository": {