@alexgorbatchev/shadcn 0.0.87 → 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.
@@ -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";
@@ -0,0 +1,41 @@
1
+ import { type ReactElement, type ReactNode, type Ref } from "react";
2
+ export interface IChoiceTableColumn {
3
+ id: string;
4
+ header: ReactNode;
5
+ /** The column's CSS grid track size, such as `6rem` or `minmax(0, 2fr)`. Defaults to `minmax(0, 1fr)`. */
6
+ width?: string;
7
+ /** Aligns the column's header and cells to the end, for numbers and trailing links. */
8
+ isEnd?: boolean;
9
+ }
10
+ export interface IChoiceTableRow {
11
+ id: string;
12
+ /** The row's accessible name, such as "SoundCloud · Undertow Signal (Original Mix) · 6:28". */
13
+ label: string;
14
+ /** One cell per column. Give controls inside them `tabIndex={-1}`: the table is one tab stop. */
15
+ cells: readonly ReactNode[];
16
+ /**
17
+ * Full-width content under the row's cells, such as its progress or outcome. Its controls keep their own tab stops,
18
+ * and clicks inside it never change the choice.
19
+ */
20
+ detail?: ReactNode;
21
+ }
22
+ interface IChoiceTableProps {
23
+ label: string;
24
+ columns: readonly IChoiceTableColumn[];
25
+ rows: readonly IChoiceTableRow[];
26
+ /** The chosen row's ID; no row is chosen while it is undefined or names no row. */
27
+ value: string | undefined;
28
+ /** Chooses a row: ↑/↓, Home, End and a click. */
29
+ onValueChange: (id: string) => void;
30
+ /** Enter on the table confirms the chosen row; focus stays in the table. */
31
+ onConfirm?: (id: string) => void;
32
+ /** The table's focusable element, so a page can move focus to it, such as when results arrive. */
33
+ ref?: Ref<HTMLDivElement>;
34
+ }
35
+ /**
36
+ * A single-choice table, where the highlight is the choice. It is one tab stop: ↑/↓, Home and End choose a row and
37
+ * Enter confirms it, keeping focus in the table; a click chooses a row. Space, ← and → are left to the page, such as a
38
+ * player, and modified keys keep their meaning, such as Mod+Enter for the page's primary action.
39
+ */
40
+ export declare function ChoiceTable({ label, columns, rows, value, onValueChange, onConfirm, ref, }: IChoiceTableProps): ReactElement;
41
+ export {};
@@ -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-h2xvhydx.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.d.ts CHANGED
@@ -93,6 +93,7 @@ export { useSidebar } from "./hooks/useSidebar.js";
93
93
  export { InlineEdit } from "./components/InlineEdit.js";
94
94
  export { StarRating } from "./components/StarRating.js";
95
95
  export { ReviewList, type IReviewListRow } from "./components/ReviewList.js";
96
+ export { ChoiceTable, type IChoiceTableColumn, type IChoiceTableRow } from "./components/ChoiceTable.js";
96
97
  export { ConfirmationDialog } from "./components/ConfirmationDialog.js";
97
98
  export { ImagePicker } from "./components/ImagePicker.js";
98
99
  export type { SidebarStyle, SidebarPartState, SidebarMenuButtonState, SidebarMenuSubButtonState, } from "./sidebar/types.js";
package/dist/index.js CHANGED
@@ -140,6 +140,7 @@ import {
140
140
  InlineEdit2,
141
141
  StarRating2,
142
142
  ReviewList2,
143
+ ChoiceTable2,
143
144
  ConfirmationDialog2,
144
145
  ImagePicker2,
145
146
  Meter2,
@@ -175,7 +176,7 @@ import {
175
176
  StatusTracker2,
176
177
  DashboardLayout2,
177
178
  BillingUsage2
178
- } from "./chunk-h2xvhydx.js";
179
+ } from "./chunk-kr38ww4n.js";
179
180
  import {
180
181
  Combobox2,
181
182
  ComboboxValue2,
@@ -248,7 +249,7 @@ import {
248
249
  MenuShortcut2,
249
250
  DropdownMenu2,
250
251
  DropdownMenuTrigger2
251
- } from "./chunk-e6mnfecj.js";
252
+ } from "./chunk-dbxmw9ya.js";
252
253
  import {
253
254
  Empty2,
254
255
  EmptyHeader2,
@@ -543,6 +544,7 @@ export {
543
544
  CardHeader2 as CardHeader,
544
545
  CardTitle2 as CardTitle,
545
546
  Checkbox2 as Checkbox,
547
+ ChoiceTable2 as ChoiceTable,
546
548
  Collapsible2 as Collapsible,
547
549
  CollapsibleContent2 as CollapsibleContent,
548
550
  CollapsibleTrigger2 as CollapsibleTrigger,
@@ -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.87",
2054
+ version: "0.0.89",
2055
2055
  description: "Sharp, monospace React components with compact and comfortable densities.",
2056
2056
  license: "MIT",
2057
2057
  repository: {
@@ -0,0 +1,60 @@
1
+ # ChoiceTable
2
+
3
+ Story: @alexgorbatchev/shadcn/components/data-display/ChoiceTable
4
+ Source: src/components/stories/data-display/ChoiceTable.stories.tsx
5
+
6
+ [Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/ChoiceTable.stories.tsx)
7
+
8
+ ## Public imports
9
+
10
+ ```tsx
11
+ import { ChoiceTable, type IChoiceTableColumn, type IChoiceTableRow, Badge, 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
+ ChoiceTable
24
+ ```
25
+
26
+ ## Default args
27
+
28
+ ```tsx
29
+ { label: "Sources", columns: [], rows: [], value: undefined, onValueChange: () => undefined }
30
+ ```
31
+
32
+ ## Default render
33
+
34
+ ```tsx
35
+ () => <ChoiceTableExample />
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
+ ### KeyboardChoice
43
+
44
+ ```tsx
45
+ {}
46
+ ```
47
+
48
+ ### PointerChoice
49
+
50
+ ```tsx
51
+ {}
52
+ ```
53
+
54
+ ### NothingChosen
55
+
56
+ ```tsx
57
+ {
58
+ render: () => <EmptyChoiceTable />
59
+ }
60
+ ```
@@ -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/llms.txt CHANGED
@@ -333,6 +333,7 @@ Generated from the public package exports and Storybook sources.
333
333
  - [BarList](./llms/components/data-display/BarList.md)
334
334
  - [Carousel](./llms/components/data-display/Carousel.md)
335
335
  - [Chart](./llms/components/data-display/Chart.md)
336
+ - [ChoiceTable](./llms/components/data-display/ChoiceTable.md)
336
337
  - [DataGrid](./llms/components/data-display/DataGrid.md)
337
338
  - [DataGridColumnOptions](./llms/components/data-display/DataGridColumnOptions.md)
338
339
  - [DataGridFilterSummary](./llms/components/data-display/DataGridFilterSummary.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.87",
3
+ "version": "0.0.89",
4
4
  "description": "Sharp, monospace React components with compact and comfortable densities.",
5
5
  "license": "MIT",
6
6
  "repository": {