@alexgorbatchev/shadcn 0.0.124 → 0.0.126
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/dist/chunk-bvzjbk43.js +48 -0
- package/dist/{chunk-xdher2cd.js → chunk-wk3xn989.js} +566 -276
- package/dist/components/DescriptionList.d.ts +16 -6
- package/dist/components/Heading.d.ts +1 -1
- package/dist/components/OptionCardGroup.d.ts +29 -5
- package/dist/components/PageHeader.d.ts +7 -2
- package/dist/components/PageIntro.d.ts +7 -2
- package/dist/components/Quote.d.ts +16 -0
- package/dist/components/ReadMore.d.ts +13 -0
- package/dist/components/SkipLink.d.ts +14 -0
- package/dist/components/StatusDot.d.ts +18 -0
- package/dist/components/json-render/index.js +2 -1
- package/dist/components/tree/index.js +6 -20
- package/dist/index.d.ts +10 -2
- package/dist/index.js +19 -1
- package/dist/prototype.js +1 -1
- package/dist/typeset.css +4 -1
- package/llms/components/data-display/DescriptionList.md +16 -0
- package/llms/components/data-display/Heading.md +18 -2
- package/llms/components/data-display/Quote.md +90 -0
- package/llms/components/data-display/StatusDot.md +80 -0
- package/llms/components/forms/OptionCardGroup.md +48 -1
- package/llms/components/layout/PageHeader.md +8 -0
- package/llms/components/layout/PageIntro.md +8 -0
- package/llms/components/layout/ReadMore.md +60 -0
- package/llms/components/navigation/SkipLink.md +63 -0
- package/llms.txt +5 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ Source: src/components/stories/forms/OptionCardGroup.stories.tsx
|
|
|
8
8
|
## Public imports
|
|
9
9
|
|
|
10
10
|
```tsx
|
|
11
|
-
import { OptionCard, OptionCardGroup, Field, FieldError, FieldLegend, FieldSet, Button } from "@alexgorbatchev/shadcn";
|
|
11
|
+
import { OptionCard, OptionCardGroup, OptionCheckboxCard, OptionCheckboxGroup, Field, FieldError, FieldLegend, FieldSet, Button } from "@alexgorbatchev/shadcn";
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Supporting imports
|
|
@@ -192,3 +192,50 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
192
192
|
</div>)
|
|
193
193
|
}
|
|
194
194
|
```
|
|
195
|
+
|
|
196
|
+
### FoldedDescription
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
{
|
|
200
|
+
render: (args) => (<div className="w-96">
|
|
201
|
+
<OptionCardGroup aria-label="Deployment strategy" {...args}>
|
|
202
|
+
<OptionCard value="blue-green" label="Blue-green" description={LONG_TRADE_OFF} descriptionLines={3}/>
|
|
203
|
+
<OptionCard value="recreate" label="Recreate" description="Stops everything first." descriptionLines={3}/>
|
|
204
|
+
</OptionCardGroup>
|
|
205
|
+
</div>)
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### RecommendedWithReasonAndImage
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
{
|
|
213
|
+
render: (args) => (<div className="w-96">
|
|
214
|
+
<OptionCardGroup aria-label="Hero layout" {...args}>
|
|
215
|
+
<OptionCard value="split" label="Split hero" image={<img src={fixture_attachmentImage} alt="Split hero layout" className="block w-full"/>} description="Text on the left, product shot on the right." recommended reason="It keeps the call to action above the fold at every width."/>
|
|
216
|
+
<OptionCard value="full" label="Full-bleed hero" description="One large image behind the headline."/>
|
|
217
|
+
</OptionCardGroup>
|
|
218
|
+
</div>)
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### MultipleChoice
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
{
|
|
226
|
+
render: () => {
|
|
227
|
+
function Example(): ReactElement {
|
|
228
|
+
const [value, setValue] = useState<string[]>([]);
|
|
229
|
+
return (<div className="w-96">
|
|
230
|
+
<OptionCheckboxGroup aria-label="Projects" value={value} onValueChange={setValue}>
|
|
231
|
+
<OptionCheckboxCard value="web" label="Web" description="The customer site."/>
|
|
232
|
+
<OptionCheckboxCard value="api" label="API" description="Public endpoints." recommended/>
|
|
233
|
+
<OptionCheckboxCard value="docs" label="Docs"/>
|
|
234
|
+
</OptionCheckboxGroup>
|
|
235
|
+
<output aria-label="Chosen projects">{value.join(",")}</output>
|
|
236
|
+
</div>);
|
|
237
|
+
}
|
|
238
|
+
return <Example />;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
@@ -100,3 +100,11 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
100
100
|
]
|
|
101
101
|
}
|
|
102
102
|
```
|
|
103
|
+
|
|
104
|
+
### FocusableDisplayTitle
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
{
|
|
108
|
+
args: { titleSize: "3xl", headingProps: { tabIndex: -1, id: "intro-title" } }
|
|
109
|
+
}
|
|
110
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# ReadMore
|
|
2
|
+
|
|
3
|
+
ReadMore folds long content to `maxHeight` with a More button, and Less folds it again. Content that fits shows in full without a button.
|
|
4
|
+
|
|
5
|
+
Story: @alexgorbatchev/shadcn/components/layout/ReadMore
|
|
6
|
+
Source: src/components/stories/layout/ReadMore.stories.tsx
|
|
7
|
+
|
|
8
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/layout/ReadMore.stories.tsx)
|
|
9
|
+
|
|
10
|
+
## Public imports
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { ReadMore } from "@alexgorbatchev/shadcn";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Default component
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
ReadMore
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Default args
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
{ maxHeight: "6rem", "aria-label": "Context" }
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Default render
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
(args) => (<div className="w-80 text-sm">
|
|
32
|
+
<ReadMore {...args}>
|
|
33
|
+
{PARAGRAPHS.map((text) => (<p key={text} className="mb-2">
|
|
34
|
+
{text}
|
|
35
|
+
</p>))}
|
|
36
|
+
</ReadMore>
|
|
37
|
+
</div>)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Examples
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
### Folded
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
{}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### ShortContent
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
{
|
|
54
|
+
render: (args) => (<div className="w-80 text-sm">
|
|
55
|
+
<ReadMore {...args}>
|
|
56
|
+
<p>Short enough to show in full.</p>
|
|
57
|
+
</ReadMore>
|
|
58
|
+
</div>)
|
|
59
|
+
}
|
|
60
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# SkipLink
|
|
2
|
+
|
|
3
|
+
SkipLink is the first Tab stop: a link to the main content that stays hidden until it has keyboard focus, then shows as an outline button pinned to the top start corner. It jumps to `targetId`; an `onClick` that calls `preventDefault` lets the app move focus itself.
|
|
4
|
+
|
|
5
|
+
Story: @alexgorbatchev/shadcn/components/navigation/SkipLink
|
|
6
|
+
Source: src/components/stories/navigation/SkipLink.stories.tsx
|
|
7
|
+
|
|
8
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/navigation/SkipLink.stories.tsx)
|
|
9
|
+
|
|
10
|
+
## Public imports
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { SkipLink } from "@alexgorbatchev/shadcn";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Default component
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
SkipLink
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Default args
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
{ targetId: "main-content", children: "Skip to content" }
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Default render
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
(args) => (<>
|
|
32
|
+
<SkipLink {...args}/>
|
|
33
|
+
<nav aria-label="Site">
|
|
34
|
+
<a href="#home">Home</a>
|
|
35
|
+
</nav>
|
|
36
|
+
<main id="main-content" tabIndex={-1}>
|
|
37
|
+
<h1>Main content</h1>
|
|
38
|
+
</main>
|
|
39
|
+
</>)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
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.
|
|
45
|
+
|
|
46
|
+
### HiddenUntilFocused
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
{}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### AppManagedFocus
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
{
|
|
56
|
+
args: {
|
|
57
|
+
onClick: fn((event) => {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
event.currentTarget.ownerDocument.getElementById("main-content")?.focus();
|
|
60
|
+
}),
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
package/llms.txt
CHANGED
|
@@ -343,7 +343,7 @@ Generated from the public package exports and Storybook sources.
|
|
|
343
343
|
- [DataViewer](./llms/components/data-display/DataViewer.md)
|
|
344
344
|
- [DescriptionList](./llms/components/data-display/DescriptionList.md)
|
|
345
345
|
- [FramedImage](./llms/components/data-display/FramedImage.md): Import from `@alexgorbatchev/shadcn/image-viewer`. FramedImage shows a screenshot or other supplied image as evidence: a 1px edge in the `media-edge` token, which keeps at least 3:1 against the page in both themes, so a white image in the light theme and a black one in the dark theme still show where they end. `size="intrinsic"` (the default) keeps the image's own size within its column and at most 70% of the viewport height, scaled and never cropped; `size="fill"` fills its container's width, as in a row of thumbnails. It takes every `<img>` attribute.
|
|
346
|
-
- [Heading](./llms/components/data-display/Heading.md): Heading renders `h1`–`h6` from the required `level` so the document outline stays correct, while `size` (sm, base, lg, xl) sets the visual size independently. Sizes default by level: 1 xl, 2 lg, 3 base, 4–6 sm. `truncate` keeps one line.
|
|
346
|
+
- [Heading](./llms/components/data-display/Heading.md): Heading renders `h1`–`h6` from the required `level` so the document outline stays correct, while `size` (sm, base, lg, xl, and the display sizes 2xl and 3xl for a page's own title) sets the visual size independently. Sizes default by level: 1 xl, 2 lg, 3 base, 4–6 sm. `truncate` keeps one line.
|
|
347
347
|
- [ImageComparison](./llms/components/data-display/ImageComparison.md): Import from `@alexgorbatchev/shadcn/image-viewer`. ImageComparison fills its container and compares `before` and `after` images (`{ src, alt, crossOrigin? }`) labelled by `beforeLabel` and `afterLabel` (default "Before" and "After"). `toggle` (the default) shows the after image and the "Hold to show before" button shows the before image while a pointer, Space, or Enter is held. `swipe` stacks both images; the divider is a slider (0–100, arrows ±1, Page Up/Page Down ±10, Home/End) whose handle drags with pointer capture. `side-by-side` shows labelled panes left and right (`horizontal`) or top and bottom (`vertical`) that scroll in sync when zoomed. Every mode starts fitted and offers original size (zoom `1`); the focused stage also takes the ImageViewer stage keys, Mod+wheel and pinch, and its name ends with the zoom percent. A differently sized before image is drawn inside the after image box, and the toolbar reports the mismatch. "Highlight differences" compares pixels on first use, caches the result per image pair, outlines changed regions, and summarizes them; it is disabled with a reason when pixels cannot be read. `mode`, `orientation`, `zoom`, and `showDifferences` are controllable with matching `default*` and `on*Change` props; `showToolbar={false}` hides the controls, which sit beside wide comparisons and below narrow ones.
|
|
348
348
|
- [ImageRegionMarker](./llms/components/data-display/ImageRegionMarker.md): Import from `@alexgorbatchev/shadcn/image-viewer`. Outlines a region over an image: a 2px outline 1px outside the region over a 4px halo in the page background, so the outline keeps 3:1 against any screenshot in both themes; forced colours draw it in Highlight. Variants: `comment` (a saved comment's region), `draft` (dashed, a region being drawn) and `difference` (changed pixels, used by ImageComparison's Highlight differences). Position it with `region` (left, top, width, height in pixels or any CSS length) over a positioned image box. `ImageRegionMarkerBadge` pins an interactive control, such as a comment count, beside the marker with the same outline and halo; place it with `position`, and pass `interactive={false}` while another gesture owns the pointer. The theme's `target-emphasis` utility is the matching two-tone mark for a jump target on the page.
|
|
349
349
|
- [ImageViewer](./llms/components/data-display/ImageViewer.md): Import from `@alexgorbatchev/shadcn/image-viewer`. ImageViewer fills the container it is given, such as a `DialogContent size="fullscreen"` body, and shows one framed image in a native scroll viewport. `fit` scales the image down proportionally to fit both dimensions, centered and without scrollbars, and never upscales it; `fit-width` fills the width and scrolls vertically; a number is a scale from the fitted one up to 4 (400%), so `1` shows natural size. Without `zoom` or `defaultZoom` it opens at `fit`, or at `fit-width` for an image much taller than the stage, and never narrower than `openingWidth`. Zooming keeps the viewed center. The stage, named "<alt>, <percent>", owns its gestures: a drag pans, two fingers pinch-zoom and Mod+wheel zooms around the pointer, so a touch never reaches overlay content unless it handles the pointer itself, such as `ImageRegionSelect`; while focused it takes + or = (zoom in), − (zoom out), 0 (fit), 1 (100%) and arrows (pan while larger than the stage), and `onStageKeyDown` runs first to add or replace keys. `showZoomControl` shows the zoom bar (Fit, Fit width, −, percent, +) in a toolbar row, and `toolbar` adds further controls to that row, which wraps onto further rows when its controls do not fit. `overlay` renders content sized and positioned exactly over the rendered image at every zoom, `imageRef` and `overlayRef` expose the rendered image box, and `getNormalizedImagePoint(event, box)` maps pointer coordinates to 0–1 image coordinates. `ImageRegionSelect` is a region tool for the overlay: a drag draws a region, a click places a half-size region centred on it and a second click makes the two clicks opposite corners; it reports each region through `onRegionChange` and draws the placed `region` with its text form (`formatImageRegion`, "Region 60% × 50% at 25%, 25%") as its accessible name. For keyboard placement, `placeImageRegion()` gives the half-size region in the middle and `applyImageRegionKey(region, key, shiftKey)` moves it by 5% with arrows or resizes it with Shift+arrows from `onStageKeyDown`; `ImageRegionFields` shows Left, Top, Width and Height as percent fields that take typed values.
|
|
@@ -354,9 +354,11 @@ Generated from the public package exports and Storybook sources.
|
|
|
354
354
|
- [JsonViewer](./llms/components/data-display/JsonViewer.md)
|
|
355
355
|
- [Kbd](./llms/components/data-display/Kbd.md)
|
|
356
356
|
- [Meter](./llms/components/data-display/Meter.md)
|
|
357
|
+
- [Quote](./llms/components/data-display/Quote.md): Quote marks text quoted from elsewhere, such as the passage a comment targets or the message a reply answers, with a start rule that follows the reading direction. `size` is `default` for panels and composers and `compact` for message footers, bubbles and rows; `clamp` stops a long quote after two lines.
|
|
357
358
|
- [ReviewList](./llms/components/data-display/ReviewList.md)
|
|
358
359
|
- [Sparkline](./llms/components/data-display/Sparkline.md)
|
|
359
360
|
- [StatCard](./llms/components/data-display/StatCard.md)
|
|
361
|
+
- [StatusDot](./llms/components/data-display/StatusDot.md): StatusDot marks something new or waiting with a small SVG dot in `currentColor`, so forced colors keep it. `tone` is `primary` for new or waiting and `muted` for quieter states; `count` adds a number; `placement="corner"` pins it to the top end corner of a positioned parent such as an icon button. It is hidden from assistive technology, so say what it means in nearby text or the control's name.
|
|
360
362
|
- [StatusTracker](./llms/components/data-display/StatusTracker.md)
|
|
361
363
|
- [Table](./llms/components/data-display/Table.md)
|
|
362
364
|
- [TableResponsive](./llms/components/data-display/TableResponsive.md)
|
|
@@ -440,6 +442,7 @@ Generated from the public package exports and Storybook sources.
|
|
|
440
442
|
- [PageHeader](./llms/components/layout/PageHeader.md)
|
|
441
443
|
- [PageIntro](./llms/components/layout/PageIntro.md)
|
|
442
444
|
- [PanelHeader](./llms/components/layout/PanelHeader.md)
|
|
445
|
+
- [ReadMore](./llms/components/layout/ReadMore.md): ReadMore folds long content to `maxHeight` with a More button, and Less folds it again. Content that fits shows in full without a button.
|
|
443
446
|
- [Resizable](./llms/components/layout/Resizable.md)
|
|
444
447
|
- [ScrollArea](./llms/components/layout/ScrollArea.md)
|
|
445
448
|
- [Separator](./llms/components/layout/Separator.md)
|
|
@@ -467,6 +470,7 @@ Generated from the public package exports and Storybook sources.
|
|
|
467
470
|
- [Outline](./llms/components/navigation/Outline.md)
|
|
468
471
|
- [Pagination](./llms/components/navigation/Pagination.md)
|
|
469
472
|
- [Sidebar](./llms/components/navigation/Sidebar.md)
|
|
473
|
+
- [SkipLink](./llms/components/navigation/SkipLink.md): SkipLink is the first Tab stop: a link to the main content that stays hidden until it has keyboard focus, then shows as an outline button pinned to the top start corner. It jumps to `targetId`; an `onClick` that calls `preventDefault` lets the app move focus itself.
|
|
470
474
|
- [Tabs](./llms/components/navigation/Tabs.md)
|
|
471
475
|
- [Tree](./llms/components/navigation/Tree.md)
|
|
472
476
|
- [WorkspaceSwitcher](./llms/components/navigation/WorkspaceSwitcher.md)
|