@alexgorbatchev/shadcn 0.0.73 → 0.0.75
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 +14 -12
- package/dist/{chunk-st134dvp.js → chunk-jdvyr7tw.js} +549 -470
- package/dist/components/OptionCardGroup.d.ts +27 -0
- package/dist/components/json-render/index.js +4 -4
- package/dist/components/resizable/SplitView.d.ts +4 -0
- package/dist/components/resizable/index.js +50 -17
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -1
- package/dist/prototype.js +1 -1
- package/llms/components/forms/OptionCardGroup.md +194 -0
- package/llms/components/layout/SplitView.md +34 -1
- package/llms/setup.md +14 -12
- package/llms.txt +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IAnalyticsProps } from "../analytics/types.js";
|
|
2
|
+
import type { IDensityProps } from "../density/types.js";
|
|
3
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
4
|
+
import { Radio as RadioPrimitive } from "@base-ui/react/radio";
|
|
5
|
+
import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
|
|
6
|
+
type OptionCardGroupProps = IAnalyticsProps & RadioGroupPrimitive.Props & IDensityProps;
|
|
7
|
+
/**
|
|
8
|
+
* A single-choice group of option cards. Each card is a radio: arrow keys move the selection between cards, Space
|
|
9
|
+
* selects the focused card, and `name`, `required` and `form` take part in native form submission and validation.
|
|
10
|
+
*/
|
|
11
|
+
declare function OptionCardGroup({ analytics, density, className, ...props }: OptionCardGroupProps): ReactElement;
|
|
12
|
+
type OptionCardProps = Omit<RadioPrimitive.Root.Props, "children"> & IDensityProps & {
|
|
13
|
+
/** The option's name, shown in bold and used as its accessible name. */
|
|
14
|
+
label: ReactNode;
|
|
15
|
+
/** A short explanation shown below the label, such as the option's trade-off. */
|
|
16
|
+
description?: ReactNode;
|
|
17
|
+
/** Marks the option the author recommends with a tag after its label and a tinted border. */
|
|
18
|
+
recommended?: boolean;
|
|
19
|
+
/** Text of the recommended tag. */
|
|
20
|
+
recommendedLabel?: ReactNode;
|
|
21
|
+
/** Short identifier in the leading column; defaults to the card's letter in its group: a, b, c. */
|
|
22
|
+
marker?: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
/** One option of an `OptionCardGroup`: a bordered card with a leading letter, a bold label and a muted description. */
|
|
25
|
+
declare function OptionCard({ label, description, recommended, recommendedLabel, marker, density, className, ...props }: OptionCardProps): ReactElement;
|
|
26
|
+
export { OptionCardGroup, OptionCard };
|
|
27
|
+
export type { OptionCardGroupProps, OptionCardProps };
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
DrawerHeader2,
|
|
32
32
|
DrawerTitle2,
|
|
33
33
|
DrawerDescription2
|
|
34
|
-
} from "../../chunk-
|
|
34
|
+
} from "../../chunk-jdvyr7tw.js";
|
|
35
35
|
import {
|
|
36
36
|
MenuPopup,
|
|
37
37
|
MenuItem2,
|
|
@@ -86,6 +86,9 @@ import {
|
|
|
86
86
|
RadioGroup2,
|
|
87
87
|
RadioGroupItem2
|
|
88
88
|
} from "../../chunk-kgqe8gpb.js";
|
|
89
|
+
import {
|
|
90
|
+
Badge2
|
|
91
|
+
} from "../../chunk-9t530p75.js";
|
|
89
92
|
import {
|
|
90
93
|
Card2,
|
|
91
94
|
CardHeader2,
|
|
@@ -100,9 +103,6 @@ import {
|
|
|
100
103
|
TabsList2,
|
|
101
104
|
TabsTrigger2
|
|
102
105
|
} from "../../chunk-k45r2rz0.js";
|
|
103
|
-
import {
|
|
104
|
-
Badge2
|
|
105
|
-
} from "../../chunk-9t530p75.js";
|
|
106
106
|
import"../../chunk-4e96tpw0.js";
|
|
107
107
|
import {
|
|
108
108
|
Checkbox2
|
|
@@ -17,5 +17,9 @@ interface ISplitViewProps {
|
|
|
17
17
|
/** Fill a bounded parent; mobile navigation scrolls within at most 35% of its height. */
|
|
18
18
|
layout?: "content" | "fill";
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Pairs a resizable sidebar with its content above 1024px and stacks them below it. The sidebar and content render
|
|
22
|
+
* into slots that move between the two layouts, so their state survives resizing across the breakpoint.
|
|
23
|
+
*/
|
|
20
24
|
export declare function SplitView({ sidebar, children, storageKey, sidebarPosition, sidebarOpen, storage, sidebarLabel, contentLabel, resizeLabel, defaultSidebarSize, sidebarPadding, contentPadding, layout: layoutMode, }: ISplitViewProps): ReactElement;
|
|
21
25
|
export {};
|
|
@@ -16,9 +16,10 @@ import {
|
|
|
16
16
|
} from "../../chunk-k99h6evz.js";
|
|
17
17
|
import"../../chunk-5mydsjp3.js";
|
|
18
18
|
// src/components/resizable/SplitView.tsx
|
|
19
|
-
import { useEffect } from "react";
|
|
19
|
+
import { useCallback, useEffect, useState, useSyncExternalStore } from "react";
|
|
20
|
+
import { createPortal } from "react-dom";
|
|
20
21
|
import { useDefaultLayout, usePanelRef } from "react-resizable-panels";
|
|
21
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
22
23
|
var layoutStorage = {
|
|
23
24
|
getItem(key) {
|
|
24
25
|
try {
|
|
@@ -39,6 +40,24 @@ var layoutStorage = {
|
|
|
39
40
|
} catch {}
|
|
40
41
|
}
|
|
41
42
|
};
|
|
43
|
+
function createSlot() {
|
|
44
|
+
const slot = document.createElement("div");
|
|
45
|
+
slot.className = "contents";
|
|
46
|
+
return slot;
|
|
47
|
+
}
|
|
48
|
+
function createSlots() {
|
|
49
|
+
return typeof document === "undefined" ? null : { sidebar: createSlot(), content: createSlot() };
|
|
50
|
+
}
|
|
51
|
+
function subscribeToHydration() {
|
|
52
|
+
return () => {};
|
|
53
|
+
}
|
|
54
|
+
function SlotHost({ slot }) {
|
|
55
|
+
const attach = useCallback((host) => host?.append(slot), [slot]);
|
|
56
|
+
return /* @__PURE__ */ jsx("div", {
|
|
57
|
+
className: "contents",
|
|
58
|
+
ref: attach
|
|
59
|
+
});
|
|
60
|
+
}
|
|
42
61
|
function SplitView({
|
|
43
62
|
sidebar,
|
|
44
63
|
children,
|
|
@@ -58,6 +77,9 @@ function SplitView({
|
|
|
58
77
|
const isWide = useMediaQuery("(min-width: 1024px)");
|
|
59
78
|
const layout = useDefaultLayout({ id: storageKey, storage, onlySaveAfterUserInteractions: true });
|
|
60
79
|
const sidebarRef = usePanelRef();
|
|
80
|
+
const isHydrated = useSyncExternalStore(subscribeToHydration, () => true, () => false);
|
|
81
|
+
const [slots] = useState(createSlots);
|
|
82
|
+
const portalSlots = isHydrated ? slots : null;
|
|
61
83
|
useEffect(() => {
|
|
62
84
|
if (!isWide)
|
|
63
85
|
return;
|
|
@@ -77,18 +99,12 @@ function SplitView({
|
|
|
77
99
|
className: cn2("min-w-0 bg-card", isWide && "h-full", contentPadding === "panel" && "p-4", isFill && "flex min-h-0 flex-1 flex-col overflow-hidden"),
|
|
78
100
|
children
|
|
79
101
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
thickness: "strong",
|
|
87
|
-
hidden: !sidebarOpen
|
|
88
|
-
}),
|
|
89
|
-
sidebarPosition === "start" ? content : sidebarContent
|
|
90
|
-
]
|
|
91
|
-
});
|
|
102
|
+
const sidebarSlot = portalSlots ? /* @__PURE__ */ jsx(SlotHost, {
|
|
103
|
+
slot: portalSlots.sidebar
|
|
104
|
+
}) : sidebarContent;
|
|
105
|
+
const contentSlot = portalSlots ? /* @__PURE__ */ jsx(SlotHost, {
|
|
106
|
+
slot: portalSlots.content
|
|
107
|
+
}) : content;
|
|
92
108
|
const sidebarPanel = /* @__PURE__ */ jsx(ResizablePanel2, {
|
|
93
109
|
id: "sidebar",
|
|
94
110
|
panelRef: sidebarRef,
|
|
@@ -97,14 +113,14 @@ function SplitView({
|
|
|
97
113
|
defaultSize: defaultSidebarSize,
|
|
98
114
|
minSize: 200,
|
|
99
115
|
maxSize: "50%",
|
|
100
|
-
children:
|
|
116
|
+
children: sidebarSlot
|
|
101
117
|
});
|
|
102
118
|
const contentPanel = /* @__PURE__ */ jsx(ResizablePanel2, {
|
|
103
119
|
id: "content",
|
|
104
120
|
minSize: "35%",
|
|
105
|
-
children:
|
|
121
|
+
children: contentSlot
|
|
106
122
|
});
|
|
107
|
-
|
|
123
|
+
const frame = isWide ? /* @__PURE__ */ jsxs(Resizable2, {
|
|
108
124
|
orientation: "horizontal",
|
|
109
125
|
defaultLayout: layout.defaultLayout,
|
|
110
126
|
onLayoutChanged: layout.onLayoutChanged,
|
|
@@ -117,6 +133,23 @@ function SplitView({
|
|
|
117
133
|
}),
|
|
118
134
|
sidebarPosition === "start" ? contentPanel : sidebarPanel
|
|
119
135
|
]
|
|
136
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
137
|
+
className: cn2("flex min-w-0 flex-col bg-card", isFill && "h-full min-h-0 overflow-hidden"),
|
|
138
|
+
children: [
|
|
139
|
+
sidebarPosition === "start" ? sidebarSlot : contentSlot,
|
|
140
|
+
/* @__PURE__ */ jsx(Separator2, {
|
|
141
|
+
thickness: "strong",
|
|
142
|
+
hidden: !sidebarOpen
|
|
143
|
+
}),
|
|
144
|
+
sidebarPosition === "start" ? contentSlot : sidebarSlot
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
148
|
+
children: [
|
|
149
|
+
frame,
|
|
150
|
+
portalSlots && createPortal(sidebarContent, portalSlots.sidebar),
|
|
151
|
+
portalSlots && createPortal(content, portalSlots.content)
|
|
152
|
+
]
|
|
120
153
|
});
|
|
121
154
|
}
|
|
122
155
|
export {
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export { Textarea } from "./components/Textarea.js";
|
|
|
18
18
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "./components/Tooltip.js";
|
|
19
19
|
export { Label } from "./components/Label.js";
|
|
20
20
|
export { RadioGroup, RadioGroupItem } from "./components/RadioGroup.js";
|
|
21
|
+
export { OptionCardGroup, OptionCard } from "./components/OptionCardGroup.js";
|
|
22
|
+
export type { OptionCardGroupProps, OptionCardProps } from "./components/OptionCardGroup.js";
|
|
21
23
|
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, } from "./components/Card.js";
|
|
22
24
|
export { Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput, ComboboxTrigger, ComboboxValue, } from "./components/Combobox.js";
|
|
23
25
|
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants } from "./components/Tabs.js";
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
AccordionItem2,
|
|
14
14
|
AccordionTrigger2,
|
|
15
15
|
AccordionContent2,
|
|
16
|
+
OptionCardGroup2,
|
|
17
|
+
OptionCard2,
|
|
16
18
|
EmptyState3,
|
|
17
19
|
PageMessage2,
|
|
18
20
|
formatDataLabel2,
|
|
@@ -171,7 +173,7 @@ import {
|
|
|
171
173
|
StatusTracker2,
|
|
172
174
|
DashboardLayout2,
|
|
173
175
|
BillingUsage2
|
|
174
|
-
} from "./chunk-
|
|
176
|
+
} from "./chunk-jdvyr7tw.js";
|
|
175
177
|
import {
|
|
176
178
|
Combobox2,
|
|
177
179
|
ComboboxValue2,
|
|
@@ -721,6 +723,8 @@ export {
|
|
|
721
723
|
NumberFieldInput2 as NumberFieldInput,
|
|
722
724
|
NumberFieldScrubArea2 as NumberFieldScrubArea,
|
|
723
725
|
NumberFieldScrubAreaCursor2 as NumberFieldScrubAreaCursor,
|
|
726
|
+
OptionCard2 as OptionCard,
|
|
727
|
+
OptionCardGroup2 as OptionCardGroup,
|
|
724
728
|
OptionSelect2 as OptionSelect,
|
|
725
729
|
PageHeader2 as PageHeader,
|
|
726
730
|
PageIntro2 as PageIntro,
|
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.75",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# OptionCardGroup
|
|
2
|
+
|
|
3
|
+
Story: @alexgorbatchev/shadcn/components/forms/OptionCardGroup
|
|
4
|
+
Source: src/components/stories/forms/OptionCardGroup.stories.tsx
|
|
5
|
+
|
|
6
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/forms/OptionCardGroup.stories.tsx)
|
|
7
|
+
|
|
8
|
+
## Public imports
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { OptionCard, OptionCardGroup, Field, FieldError, FieldLegend, FieldSet, Button } from "@alexgorbatchev/shadcn";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Supporting imports
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { useId, useState } from "react";
|
|
18
|
+
import type { ComponentProps, ReactElement } from "react";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Default component
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
OptionCardGroup
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Default args
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
{ onValueChange: fn() }
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Default render
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
(args) => (<FieldSet className="max-w-xl">
|
|
37
|
+
<FieldLegend>Deployment strategy</FieldLegend>
|
|
38
|
+
<OptionCardGroup aria-label="Deployment strategy" {...args}>
|
|
39
|
+
<StrategyOptions disabled={args.disabled}/>
|
|
40
|
+
</OptionCardGroup>
|
|
41
|
+
</FieldSet>)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
### Default
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
{}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### RecommendedOption
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
{
|
|
58
|
+
args: { defaultValue: "blue-green" }
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### KeyboardSelection
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
{}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Disabled
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
{
|
|
72
|
+
args: { disabled: true, defaultValue: "rolling" }
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### DisabledOption
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
{
|
|
80
|
+
render: (args) => (<OptionCardGroup aria-label="Deployment strategy" {...args}>
|
|
81
|
+
<OptionCard value="rolling" label="Rolling update"/>
|
|
82
|
+
<OptionCard value="blue-green" label="Blue-green" description="Needs twice the capacity." disabled/>
|
|
83
|
+
<OptionCard value="recreate" label="Recreate"/>
|
|
84
|
+
</OptionCardGroup>)
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### ReadOnly
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
{
|
|
92
|
+
args: { readOnly: true, defaultValue: "recreate" }
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Controlled
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
{
|
|
100
|
+
render: function Render(args) {
|
|
101
|
+
const [value, setValue] = useState("rolling");
|
|
102
|
+
return (<FieldSet className="max-w-xl">
|
|
103
|
+
<FieldLegend>Deployment strategy</FieldLegend>
|
|
104
|
+
<OptionCardGroup {...args} aria-label="Deployment strategy" value={value} onValueChange={setValue}>
|
|
105
|
+
<StrategyOptions />
|
|
106
|
+
</OptionCardGroup>
|
|
107
|
+
<output aria-label="Chosen strategy">{value}</output>
|
|
108
|
+
</FieldSet>);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### CustomMarkers
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
{
|
|
117
|
+
render: (args) => (<OptionCardGroup aria-label="Release window" {...args}>
|
|
118
|
+
<OptionCard value="tonight" marker="1" label="Tonight" description="Fewest users online."/>
|
|
119
|
+
<OptionCard value="weekend" marker="2" label="This weekend" description="More time to watch it."/>
|
|
120
|
+
</OptionCardGroup>)
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### RequiredForm
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
{
|
|
128
|
+
args: { required: true, name: "strategy" },
|
|
129
|
+
render: function Render(args) {
|
|
130
|
+
const [result, setResult] = useState("");
|
|
131
|
+
const [value, setValue] = useState<string | null>(null);
|
|
132
|
+
return (<form aria-label="Strategy form" onReset={() => setValue(null)} onSubmit={(event) => {
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
setResult(JSON.stringify(Object.fromEntries(new FormData(event.currentTarget))));
|
|
135
|
+
}}>
|
|
136
|
+
<FieldSet className="max-w-xl">
|
|
137
|
+
<FieldLegend>Deployment strategy</FieldLegend>
|
|
138
|
+
<OptionCardGroup {...args} aria-label="Deployment strategy" value={value} onValueChange={setValue}>
|
|
139
|
+
<StrategyOptions />
|
|
140
|
+
</OptionCardGroup>
|
|
141
|
+
<Field orientation="horizontal">
|
|
142
|
+
<Button type="submit">Save strategy</Button>
|
|
143
|
+
<Button type="reset">Reset strategy</Button>
|
|
144
|
+
</Field>
|
|
145
|
+
</FieldSet>
|
|
146
|
+
<output aria-label="Saved strategy">{result}</output>
|
|
147
|
+
</form>);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Invalid
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
{
|
|
156
|
+
render: function Render(args) {
|
|
157
|
+
const id = useId();
|
|
158
|
+
return (<FieldSet className="max-w-xl">
|
|
159
|
+
<FieldLegend>Deployment strategy</FieldLegend>
|
|
160
|
+
<OptionCardGroup {...args} aria-label="Deployment strategy" aria-invalid>
|
|
161
|
+
<OptionCard value="rolling" label="Rolling update" aria-invalid aria-errormessage={`${id}-error`}/>
|
|
162
|
+
<OptionCard value="blue-green" label="Blue-green" recommended aria-invalid aria-errormessage={`${id}-error`}/>
|
|
163
|
+
</OptionCardGroup>
|
|
164
|
+
<FieldError id={`${id}-error`}>Choose a deployment strategy.</FieldError>
|
|
165
|
+
</FieldSet>);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### NativeStateCallbacks
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
{
|
|
174
|
+
args: { disabled: false, className: (state) => (state.disabled ? "gap-2" : "gap-6") },
|
|
175
|
+
render: (args) => (<OptionCardGroup aria-label="Deployment strategy" {...args}>
|
|
176
|
+
<OptionCard value="rolling" label="Rolling update" className={(state) => (state.checked ? "min-h-24" : "min-h-16")}/>
|
|
177
|
+
<OptionCard value="recreate" label="Recreate"/>
|
|
178
|
+
</OptionCardGroup>)
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### NarrowWidth
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
{
|
|
186
|
+
args: { defaultValue: "blue-green" },
|
|
187
|
+
render: (args) => (<div className="w-72">
|
|
188
|
+
<OptionCardGroup aria-label="Deployment strategy" {...args}>
|
|
189
|
+
<StrategyOptions />
|
|
190
|
+
<OptionCard value="canary-with-a-very-long-unbroken-identifier" label="Canary-release-to-one-percent-of-traffic-first" description="A long label wraps inside its card instead of widening the group."/>
|
|
191
|
+
</OptionCardGroup>
|
|
192
|
+
</div>)
|
|
193
|
+
}
|
|
194
|
+
```
|
|
@@ -9,7 +9,7 @@ Source: src/components/stories/layout/SplitView.stories.tsx
|
|
|
9
9
|
|
|
10
10
|
```tsx
|
|
11
11
|
import { SplitView } from "@alexgorbatchev/shadcn/resizable";
|
|
12
|
-
import { Button } from "@alexgorbatchev/shadcn";
|
|
12
|
+
import { Button, Field, FieldGroup, FieldLabel, Input, Switch } from "@alexgorbatchev/shadcn";
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Supporting imports
|
|
@@ -127,3 +127,36 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
```
|
|
130
|
+
|
|
131
|
+
### StatefulPanels
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
{
|
|
135
|
+
render: function Example(args) {
|
|
136
|
+
const key = useId();
|
|
137
|
+
return (<div className="w-[900px] max-w-full">
|
|
138
|
+
<SplitView {...args} storageKey={key} sidebar={<FieldGroup>
|
|
139
|
+
<Field>
|
|
140
|
+
<FieldLabel htmlFor={`${key}-filter`}>Filter pages</FieldLabel>
|
|
141
|
+
<Input id={`${key}-filter`}/>
|
|
142
|
+
</Field>
|
|
143
|
+
<Field orientation="horizontal">
|
|
144
|
+
<Switch id={`${key}-archived`}/>
|
|
145
|
+
<FieldLabel htmlFor={`${key}-archived`}>Show archived</FieldLabel>
|
|
146
|
+
</Field>
|
|
147
|
+
</FieldGroup>}>
|
|
148
|
+
<FieldGroup>
|
|
149
|
+
<Field>
|
|
150
|
+
<FieldLabel htmlFor={`${key}-answer`}>Draft answer</FieldLabel>
|
|
151
|
+
<Input id={`${key}-answer`}/>
|
|
152
|
+
</Field>
|
|
153
|
+
<Field orientation="horizontal">
|
|
154
|
+
<Switch id={`${key}-notify`}/>
|
|
155
|
+
<FieldLabel htmlFor={`${key}-notify`}>Notify me</FieldLabel>
|
|
156
|
+
</Field>
|
|
157
|
+
</FieldGroup>
|
|
158
|
+
</SplitView>
|
|
159
|
+
</div>);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
package/llms/setup.md
CHANGED
|
@@ -264,17 +264,17 @@ The npm package includes the same index at `llms.txt` in its root and its linked
|
|
|
264
264
|
|
|
265
265
|
# Component Catalog
|
|
266
266
|
|
|
267
|
-
| Area | Components
|
|
268
|
-
| :----------------------- |
|
|
269
|
-
| Actions and status | Alert, Badge, Button, ButtonGroup, ButtonLink, Sonner, Toast, Toggle, ToggleGroup
|
|
270
|
-
| Forms and selections | AuthForm, Calendar, Checkbox, Combobox, Command, EmailCodeAuthForm, Field, Input, InputGroup, InputOTP, Label, OptionSelect, Questionnaire, RadioGroup, Select, Slider, Switch, Textarea
|
|
271
|
-
| Structure and navigation | Accordion, AspectRatio, Avatar, Breadcrumb, Card, Carousel, Chart, Collapsible, Empty, Item, Kbd, Menubar, NavigationMenu, Pagination, Resizable, ScrollArea, Separator, Sidebar, Table, Tabs
|
|
272
|
-
| Layout and typography | AppShell, Container, Grid, GridItem, Heading, PageHeader, PageIntro, Stack, Text
|
|
273
|
-
| Data display | ImageComparison, ImageViewer, WeatherForecast, WeatherSummary
|
|
274
|
-
| Overlays | AlertDialog, ContextMenu, Dialog, Drawer, DropdownMenu, HoverCard, Popover, Sheet, Tooltip
|
|
275
|
-
| Loading | Progress, Skeleton, Spinner
|
|
276
|
-
| Conversations | Attachment, Bubble, Marker, Message, MessageScroller
|
|
277
|
-
| App configuration | DensityProvider, DirectionProvider, ThemeProvider
|
|
267
|
+
| Area | Components |
|
|
268
|
+
| :----------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
269
|
+
| Actions and status | Alert, Badge, Button, ButtonGroup, ButtonLink, Sonner, Toast, Toggle, ToggleGroup |
|
|
270
|
+
| Forms and selections | AuthForm, Calendar, Checkbox, Combobox, Command, EmailCodeAuthForm, Field, Input, InputGroup, InputOTP, Label, OptionCardGroup, OptionSelect, Questionnaire, RadioGroup, Select, Slider, Switch, Textarea |
|
|
271
|
+
| Structure and navigation | Accordion, AspectRatio, Avatar, Breadcrumb, Card, Carousel, Chart, Collapsible, Empty, Item, Kbd, Menubar, NavigationMenu, Pagination, Resizable, ScrollArea, Separator, Sidebar, Table, Tabs |
|
|
272
|
+
| Layout and typography | AppShell, Container, Grid, GridItem, Heading, PageHeader, PageIntro, Stack, Text |
|
|
273
|
+
| Data display | ImageComparison, ImageViewer, WeatherForecast, WeatherSummary |
|
|
274
|
+
| Overlays | AlertDialog, ContextMenu, Dialog, Drawer, DropdownMenu, HoverCard, Popover, Sheet, Tooltip |
|
|
275
|
+
| Loading | Progress, Skeleton, Spinner |
|
|
276
|
+
| Conversations | Attachment, Bubble, Marker, Message, MessageScroller |
|
|
277
|
+
| App configuration | DensityProvider, DirectionProvider, ThemeProvider |
|
|
278
278
|
|
|
279
279
|
Use the composed parts exported from the package root, such as `DialogTrigger`, `DialogContent`, and `DialogTitle`. Storybook provides working compositions, variants, disabled states, and action callbacks. The local preview starts with `just storybook` and binds to `127.0.0.1:6006`.
|
|
280
280
|
|
|
@@ -308,6 +308,8 @@ Compose grouped controls with InputGroupInput or InputGroupTextarea, then place
|
|
|
308
308
|
|
|
309
309
|
`RadioGroup` uses `value`/`onValueChange` for controlled selection and `defaultValue` for initial selection. Name the group and each option; use `FieldSet`/`FieldLegend` and `Field`/`FieldLabel` for visible labels. Arrow keys select options and skip disabled items; Space selects a focused option. Both the group and `RadioGroupItem` preserve native state-based className and style callbacks. Use `nativeButton` with `render={<button type="button" />}` for sibling labels on button-rendered items. `name`, `required`, and `form` connect selection to browser form submission and validation, including an external form. The required-form story restores controlled selection through `onReset`.
|
|
310
310
|
|
|
311
|
+
`OptionCardGroup` is a single-choice group for decisions. Each `OptionCard` is a bordered radio card with a leading letter (a, b, c by position, or `marker`), a bold `label`, an optional muted `description`, and an optional `recommended` flag that adds a success-colored tag after the label and tints the unselected card's border. The selected card takes the primary border, or the system highlight color in forced-colors mode, and keyboard focus draws an offset outline. Mark cards `aria-invalid` with `aria-errormessage` to show an error; unselected invalid cards take the destructive border instead of the recommended tint. It shares `RadioGroup`'s Base UI behavior: `value`/`onValueChange`/`defaultValue`, arrow keys that select and skip disabled cards, Space to select, `disabled` and `readOnly`, and `name`/`required`/`form` for native submission and validation. The label and tag name each card; the description describes it. Use `RadioGroup` for short plain lists.
|
|
312
|
+
|
|
311
313
|
`Select` supports single, multiple, and object values through its native generic props. Pass `items` to display labels instead of raw values; provide object comparison and serialization through `isItemEqualToValue` and `itemToStringValue`. Disabled options remain focusable while rejecting selection. Read-only selection permits browsing and blocks value changes. The composed parts preserve state-based className callbacks, and portaled content follows density and DirectionProvider context. Named multiple selects submit repeated form entries. Restore controlled values in your form's reset handler. Bun-built RTL menus currently place the selection checkmark on the wrong side; verify that layout in consuming apps. See the [Base UI Select reference](https://base-ui.com/react/components/select).
|
|
312
314
|
|
|
313
315
|
`Combobox` retains native filtering, single/multiple selection, cancellation, controlled values, object identity comparison, and keyboard focus. Give its input an accessible name; an input inside the popup uses a named trigger. `ComboboxInput.className` belongs to the native input and accepts its state callback; use `frameClassName` for the surrounding InputGroup. Built-in controls use “Open popup” and “Clear selection”; customize them with `triggerLabel` and `clearLabel`. Chips use density metrics, and their removal button is named “Remove item”. Keep `ComboboxEmpty` mounted so its polite live region can announce results. In grouped lists, pass `items={group.items}` to each `ComboboxGroup`. Popup density and direction follow their providers, including through portals; reduced motion disables popup animations. See the [Base UI Combobox reference](https://base-ui.com/react/components/combobox).
|
|
@@ -470,7 +472,7 @@ Embedded actions, links, menus, editable fields, and media controls retain their
|
|
|
470
472
|
|
|
471
473
|
# Split views
|
|
472
474
|
|
|
473
|
-
`SplitView` pairs a `sidebar` with its `children` in equally padded, borderless panels. Provide `sidebarLabel`, `contentLabel`, and `resizeLabel` for accessibility and a unique `storageKey` to remember the resized layout in localStorage. The desktop sidebar defaults to 325px (`defaultSidebarSize`), with a 200px minimum and a 50% maximum. Its 2px divider supports mouse, touch, and keyboard resizing. Below 1024px, the panels stack vertically while preserving the desktop preference. Storage failures leave the layout usable.
|
|
475
|
+
`SplitView` pairs a `sidebar` with its `children` in equally padded, borderless panels. Provide `sidebarLabel`, `contentLabel`, and `resizeLabel` for accessibility and a unique `storageKey` to remember the resized layout in localStorage. The desktop sidebar defaults to 325px (`defaultSidebarSize`), with a 200px minimum and a 50% maximum. Its 2px divider supports mouse, touch, and keyboard resizing. Below 1024px, the panels stack vertically while preserving the desktop preference. The sidebar and content stay mounted when the viewport crosses 1024px: they render into slots that move between the stacked and resizable layouts, so form values and component state survive resizing and rotation. Focus and scroll positions inside the panels reset when the layout changes. Server rendering places the panels in the stacked layout; after hydration they move into their slots and mount once more. Storage failures leave the layout usable.
|
|
474
476
|
|
|
475
477
|
`SplitView` defaults to `layout="content"` and `sidebarPadding="panel"` / `contentPadding="panel"`. Choose `"none"` padding for children that own their spacing. With a bounded parent, `layout="fill"` fills the available height, scrolls overflowing navigation independently, and leaves the content panel available for a scrolling child. On narrow screens the stacked navigation uses at most 35% of the split height.
|
|
476
478
|
|
package/llms.txt
CHANGED
|
@@ -401,6 +401,7 @@ Generated from the public package exports and Storybook sources.
|
|
|
401
401
|
- [InputOTP](./llms/components/forms/InputOTP.md)
|
|
402
402
|
- [Label](./llms/components/forms/Label.md)
|
|
403
403
|
- [NumberField](./llms/components/forms/NumberField.md)
|
|
404
|
+
- [OptionCardGroup](./llms/components/forms/OptionCardGroup.md)
|
|
404
405
|
- [OptionSelect](./llms/components/forms/OptionSelect.md)
|
|
405
406
|
- [Questionnaire](./llms/components/forms/Questionnaire.md)
|
|
406
407
|
- [RadioGroup](./llms/components/forms/RadioGroup.md)
|