@alexgorbatchev/shadcn 0.0.87 → 0.0.88

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.
@@ -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 {};
@@ -31,7 +31,7 @@ import {
31
31
  DrawerHeader2,
32
32
  DrawerTitle2,
33
33
  DrawerDescription2
34
- } from "../../chunk-h2xvhydx.js";
34
+ } from "../../chunk-k8119w3b.js";
35
35
  import {
36
36
  MenuPopup,
37
37
  MenuItem2,
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-k8119w3b.js";
179
180
  import {
180
181
  Combobox2,
181
182
  ComboboxValue2,
@@ -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,
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.88",
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
+ ```
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.88",
4
4
  "description": "Sharp, monospace React components with compact and comfortable densities.",
5
5
  "license": "MIT",
6
6
  "repository": {