@alexgorbatchev/shadcn 0.0.75 → 0.0.76
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 +3 -3
- package/dist/{chunk-jdvyr7tw.js → chunk-s1vn9bwy.js} +11 -5
- package/dist/components/StarRating.d.ts +7 -1
- package/dist/components/data-grid/DataGridSelectCell.d.ts +6 -1
- package/dist/components/data-grid/index.js +3 -1
- package/dist/components/json-render/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/DataGridSelectCell.md +8 -0
- package/llms/components/forms/StarRating.md +24 -0
- package/llms/setup.md +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -578,7 +578,7 @@ The preview shows compact individual badges, up to five labels followed by `+N m
|
|
|
578
578
|
|
|
579
579
|
# Devhost Preview
|
|
580
580
|
|
|
581
|
-
The routed preview serves Storybook at `shadcn.localhost` through devhost.
|
|
581
|
+
The routed preview serves Storybook at `shadcn.localhost` through devhost v0.0.14 or newer. The manifest names its services with the bare host labels `shadcn` and `shadcn-snapshots`, and devhost's machine configuration supplies the domain: a custom `domainSuffix` changes the hostname, and a machine enrolled in [remote previews](https://alexgorbatchev.github.io/devhost/stacks/remote-previews/) serves the preview through its relay.
|
|
582
582
|
|
|
583
583
|
From this repository, start the configured Storybook service:
|
|
584
584
|
|
|
@@ -586,9 +586,9 @@ From this repository, start the configured Storybook service:
|
|
|
586
586
|
just run
|
|
587
587
|
```
|
|
588
588
|
|
|
589
|
-
`just run`
|
|
589
|
+
`just run` starts the preview in the background and passes its arguments to `devhost start --detach`; `just run --local` keeps local routing on a machine enrolled in remote previews.
|
|
590
590
|
|
|
591
|
-
Open the hostname printed by devhost over HTTPS. The manifest allocates a port automatically and serves Storybook through the shared devhost HTTPS proxy.
|
|
591
|
+
Open the hostname printed by devhost over HTTPS. The manifest allocates a port automatically and serves Storybook through the shared devhost HTTPS proxy. For local routing, the hostname must resolve to the machine running devhost; `.localhost` names need no DNS setup. The managed Caddy instance must be running (`devhost caddy start`).
|
|
592
592
|
|
|
593
593
|
Storybook binds to IPv4 loopback and allows the configured hostname in both Storybook and Vite. Caddy listens on all interfaces and serves HTTP as well as HTTPS, so the external devbox gateway can reach it. The direct `just storybook` preview remains available on `127.0.0.1:6006`.
|
|
594
594
|
|
|
@@ -2745,38 +2745,44 @@ function InlineEdit2({
|
|
|
2745
2745
|
import { Radio } from "@base-ui/react/radio";
|
|
2746
2746
|
import { StarIcon, CircleOffIcon } from "lucide-react";
|
|
2747
2747
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
2748
|
+
var ITEM_SIZES = { comfortable: "size-5", compact: "size-4" };
|
|
2749
|
+
var STAR_SIZES = { comfortable: "size-3.5", compact: "size-3" };
|
|
2750
|
+
var CLEAR_SIZES = { comfortable: "size-3", compact: "size-2.5" };
|
|
2748
2751
|
function StarRating2({
|
|
2749
2752
|
analytics,
|
|
2750
2753
|
label,
|
|
2751
2754
|
value,
|
|
2752
2755
|
disabled,
|
|
2753
|
-
density,
|
|
2756
|
+
density: densityProp,
|
|
2757
|
+
focusable = true,
|
|
2754
2758
|
onValueChange
|
|
2755
2759
|
}) {
|
|
2760
|
+
const density = useDensity(densityProp);
|
|
2756
2761
|
return /* @__PURE__ */ jsx28(RadioGroup2, {
|
|
2757
2762
|
analytics,
|
|
2758
2763
|
"aria-label": label,
|
|
2759
2764
|
value,
|
|
2760
2765
|
disabled,
|
|
2761
|
-
"data-density":
|
|
2766
|
+
"data-density": densityProp,
|
|
2762
2767
|
className: "inline-flex w-fit shrink-0 items-center gap-0.5",
|
|
2763
2768
|
onValueChange,
|
|
2764
2769
|
children: [1, 2, 3, 4, 5, 0].map((star) => /* @__PURE__ */ jsx28(Radio.Root, {
|
|
2765
2770
|
value: star,
|
|
2766
2771
|
nativeButton: true,
|
|
2772
|
+
...focusable ? {} : { tabIndex: -1 },
|
|
2767
2773
|
render: /* @__PURE__ */ jsx28(AnalyticsButton, {
|
|
2768
2774
|
component: "StarRating",
|
|
2769
2775
|
type: "button"
|
|
2770
2776
|
}),
|
|
2771
2777
|
"aria-label": star === 0 ? "Unrated" : `${star} ${star === 1 ? "star" : "stars"}`,
|
|
2772
2778
|
title: star === 0 ? "Clear rating" : `${star} stars`,
|
|
2773
|
-
className: "inline-flex
|
|
2779
|
+
className: cn2("inline-flex shrink-0 items-center justify-center rounded-sm text-muted-foreground outline-none hover:text-primary focus-visible:ring-1 focus-visible:ring-ring data-disabled:cursor-not-allowed data-disabled:opacity-50", ITEM_SIZES[density]),
|
|
2774
2780
|
children: star === 0 ? /* @__PURE__ */ jsx28(CircleOffIcon, {
|
|
2775
2781
|
"aria-hidden": "true",
|
|
2776
|
-
className:
|
|
2782
|
+
className: CLEAR_SIZES[density]
|
|
2777
2783
|
}) : /* @__PURE__ */ jsx28(StarIcon, {
|
|
2778
2784
|
"aria-hidden": "true",
|
|
2779
|
-
className: star <= value ? "
|
|
2785
|
+
className: star <= value ? cn2(STAR_SIZES[density], "fill-primary text-primary") : STAR_SIZES[density]
|
|
2780
2786
|
})
|
|
2781
2787
|
}, star))
|
|
2782
2788
|
});
|
|
@@ -5,7 +5,13 @@ interface IStarRatingProps extends IDensityProps, IAnalyticsProps {
|
|
|
5
5
|
label: string;
|
|
6
6
|
value: number;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the stars take a tab stop. Turn it off where the rating is a pointer affordance of a larger keyboard
|
|
10
|
+
* target, such as a data-grid row that rates its track with its own keys.
|
|
11
|
+
*/
|
|
12
|
+
focusable?: boolean;
|
|
8
13
|
onValueChange: (value: number) => void;
|
|
9
14
|
}
|
|
10
|
-
|
|
15
|
+
/** Five stars and Unrated as one radio group; compact density draws it to fit a single-line row. */
|
|
16
|
+
export declare function StarRating({ analytics, label, value, disabled, density: densityProp, focusable, onValueChange, }: IStarRatingProps): ReactElement;
|
|
11
17
|
export {};
|
|
@@ -6,7 +6,12 @@ interface DataGridSelectCellProps<T extends RowData> extends IDensityProps, IDat
|
|
|
6
6
|
row: DataGridRow<T>;
|
|
7
7
|
/** Names this row's selection control, such as "Select project Atlas". */
|
|
8
8
|
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the checkbox takes a tab stop. Turn it off when the row itself is the keyboard target and selects with
|
|
11
|
+
* its own keys, so each row costs one tab stop.
|
|
12
|
+
*/
|
|
13
|
+
focusable?: boolean;
|
|
9
14
|
}
|
|
10
15
|
/** Uses the row's native selection rules, including disabled and partially selected parent rows. */
|
|
11
|
-
export declare function DataGridSelectCell<T extends RowData>({ row, table, label, density, }: DataGridSelectCellProps<T>): ReactElement;
|
|
16
|
+
export declare function DataGridSelectCell<T extends RowData>({ row, table, label, density, focusable, }: DataGridSelectCellProps<T>): ReactElement;
|
|
12
17
|
export type { DataGridSelectCellProps };
|
|
@@ -592,13 +592,15 @@ function DataGridSelectCell({
|
|
|
592
592
|
row,
|
|
593
593
|
table,
|
|
594
594
|
label,
|
|
595
|
-
density
|
|
595
|
+
density,
|
|
596
|
+
focusable = true
|
|
596
597
|
}) {
|
|
597
598
|
return /* @__PURE__ */ jsx5(Subscribe5, {
|
|
598
599
|
source: table.atoms.rowSelection,
|
|
599
600
|
children: () => /* @__PURE__ */ jsx5(Checkbox2, {
|
|
600
601
|
"aria-label": label,
|
|
601
602
|
density,
|
|
603
|
+
...focusable ? {} : { tabIndex: -1 },
|
|
602
604
|
checked: row.getIsSelected(),
|
|
603
605
|
indeterminate: row.getIsSomeSelected(),
|
|
604
606
|
disabled: !row.getCanSelect(),
|
package/dist/index.js
CHANGED
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.76",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -26,3 +26,11 @@ DataGridSelectCell
|
|
|
26
26
|
## Examples
|
|
27
27
|
|
|
28
28
|
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.
|
|
29
|
+
|
|
30
|
+
### OutsideTabOrder
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
{
|
|
34
|
+
render: () => <SelectionControls focusable={false}/>
|
|
35
|
+
}
|
|
36
|
+
```
|
|
@@ -51,6 +51,30 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
51
51
|
{}
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
### Compact
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
{
|
|
58
|
+
args: { density: "compact" }
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### OutsideTabOrder
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
{
|
|
66
|
+
args: { focusable: false },
|
|
67
|
+
render: function Example(args): ReactElement {
|
|
68
|
+
const [value, setValue] = useState(args.value);
|
|
69
|
+
return (<div className="flex items-center gap-2">
|
|
70
|
+
<button type="button">Before</button>
|
|
71
|
+
<StarRating {...args} value={value} onValueChange={setValue}/>
|
|
72
|
+
<button type="button">After</button>
|
|
73
|
+
</div>);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
54
78
|
### Disabled
|
|
55
79
|
|
|
56
80
|
```tsx
|
package/llms/setup.md
CHANGED
|
@@ -578,7 +578,7 @@ The preview shows compact individual badges, up to five labels followed by `+N m
|
|
|
578
578
|
|
|
579
579
|
# Devhost Preview
|
|
580
580
|
|
|
581
|
-
The routed preview serves Storybook at `shadcn.localhost` through devhost.
|
|
581
|
+
The routed preview serves Storybook at `shadcn.localhost` through devhost v0.0.14 or newer. The manifest names its services with the bare host labels `shadcn` and `shadcn-snapshots`, and devhost's machine configuration supplies the domain: a custom `domainSuffix` changes the hostname, and a machine enrolled in [remote previews](https://alexgorbatchev.github.io/devhost/stacks/remote-previews/) serves the preview through its relay.
|
|
582
582
|
|
|
583
583
|
From this repository, start the configured Storybook service:
|
|
584
584
|
|
|
@@ -586,9 +586,9 @@ From this repository, start the configured Storybook service:
|
|
|
586
586
|
just run
|
|
587
587
|
```
|
|
588
588
|
|
|
589
|
-
`just run`
|
|
589
|
+
`just run` starts the preview in the background and passes its arguments to `devhost start --detach`; `just run --local` keeps local routing on a machine enrolled in remote previews.
|
|
590
590
|
|
|
591
|
-
Open the hostname printed by devhost over HTTPS. The manifest allocates a port automatically and serves Storybook through the shared devhost HTTPS proxy.
|
|
591
|
+
Open the hostname printed by devhost over HTTPS. The manifest allocates a port automatically and serves Storybook through the shared devhost HTTPS proxy. For local routing, the hostname must resolve to the machine running devhost; `.localhost` names need no DNS setup. The managed Caddy instance must be running (`devhost caddy start`).
|
|
592
592
|
|
|
593
593
|
Storybook binds to IPv4 loopback and allows the configured hostname in both Storybook and Vite. Caddy listens on all interfaces and serves HTTP as well as HTTPS, so the external devbox gateway can reach it. The direct `just storybook` preview remains available on `127.0.0.1:6006`.
|
|
594
594
|
|