@alexgorbatchev/shadcn 0.0.148 → 0.0.152
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-m32ptxf3.js → chunk-4m2x9jfb.js} +1 -1
- package/dist/{chunk-p0d89mze.js → chunk-5q0670jv.js} +1 -1
- package/dist/{chunk-bfv4qesg.js → chunk-9e1yb90r.js} +1 -1
- package/dist/{chunk-ngttdb6m.js → chunk-fbajrfv6.js} +1 -1
- package/dist/{chunk-cbyqgfv4.js → chunk-kevm8s2n.js} +1 -1
- package/dist/{chunk-3dttg1b6.js → chunk-ncskzkqr.js} +1 -1
- package/dist/{chunk-v1semj30.js → chunk-rf70907h.js} +41 -16
- package/dist/{chunk-7q8kp3t5.js → chunk-ywr2pqhc.js} +1 -1
- package/dist/components/Item.d.ts +3 -1
- package/dist/components/OptionCardGroup.d.ts +23 -8
- package/dist/components/assistant-ui/elements/EditMessage.js +3 -3
- package/dist/components/assistant-ui/elements/ElicitationForm.js +3 -3
- package/dist/components/assistant-ui/elements/FeedbackDialog.js +3 -3
- package/dist/components/assistant-ui/elements/ModelPicker.js +3 -3
- package/dist/components/assistant-ui/index.js +6 -6
- package/dist/components/assistant-ui/native/McpConfigDialog.js +2 -2
- package/dist/components/assistant-ui/native/index.js +2 -2
- package/dist/components/data-grid/index.js +1 -1
- package/dist/components/event-calendar/index.js +2 -2
- package/dist/components/image-viewer/ImageComparison.d.ts +7 -2
- package/dist/components/image-viewer/ImageComparisonToolbar.d.ts +4 -2
- package/dist/components/image-viewer/ImageGallery.d.ts +41 -0
- package/dist/components/image-viewer/MediaShell.d.ts +19 -0
- package/dist/components/image-viewer/index.d.ts +5 -1
- package/dist/components/image-viewer/index.js +292 -75
- package/dist/components/image-viewer/types.d.ts +2 -0
- package/dist/components/input-otp/index.js +2 -2
- package/dist/components/json-render/JsonForm.d.ts +3 -1
- package/dist/components/json-render/index.js +16 -9
- package/dist/index.js +3 -3
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/ImageComparison.md +10 -1
- package/llms/components/data-display/ImageGallery.md +62 -0
- package/llms/components/data-display/Item.md +36 -0
- package/llms/components/data-display/JsonRenderForm.md +11 -1
- package/llms/components/forms/Label.md +14 -0
- package/llms/components/forms/OptionCardGroup.md +46 -0
- package/llms/components/layout/Accordion.md +29 -0
- package/llms.txt +2 -1
- package/package.json +1 -1
|
@@ -14,6 +14,8 @@ export interface IImageZoomScales {
|
|
|
14
14
|
}
|
|
15
15
|
/** How ImageComparison presents the before and after images. */
|
|
16
16
|
export type ImageComparisonMode = "toggle" | "swipe" | "side-by-side";
|
|
17
|
+
/** The image a comparison shows in `toggle` mode. */
|
|
18
|
+
export type ImageComparisonSide = "before" | "after";
|
|
17
19
|
/** Side-by-side pane arrangement: `horizontal` places panes left and right, `vertical` top and bottom. */
|
|
18
20
|
export type ImageComparisonOrientation = StackDirection;
|
|
19
21
|
export interface IImageSize {
|
|
@@ -22,14 +22,14 @@ import {
|
|
|
22
22
|
CardContent2,
|
|
23
23
|
CardFooter2
|
|
24
24
|
} from "../../chunk-jc3cbwyg.js";
|
|
25
|
-
import"../../chunk-
|
|
25
|
+
import"../../chunk-4m2x9jfb.js";
|
|
26
26
|
import"../../chunk-52aadmkc.js";
|
|
27
27
|
import {
|
|
28
28
|
FieldGroup2,
|
|
29
29
|
Field2,
|
|
30
30
|
FieldLabel2,
|
|
31
31
|
FieldDescription2
|
|
32
|
-
} from "../../chunk-
|
|
32
|
+
} from "../../chunk-9e1yb90r.js";
|
|
33
33
|
import"../../chunk-7jpsybag.js";
|
|
34
34
|
import {
|
|
35
35
|
Input2
|
|
@@ -102,7 +102,9 @@ export interface IJsonFieldValueProps {
|
|
|
102
102
|
field: IJsonField;
|
|
103
103
|
/** The value as text; empty renders "No answer". */
|
|
104
104
|
text: string;
|
|
105
|
+
/** Hides the visible label when a surrounding heading already names this value; the group keeps its accessible name. */
|
|
106
|
+
hideLabel?: boolean;
|
|
105
107
|
}
|
|
106
108
|
/** The field as read-only text: its label, then its value, grouped and named by the label. */
|
|
107
|
-
export declare function JsonFieldValue({ field, text }: IJsonFieldValueProps): ReactElement;
|
|
109
|
+
export declare function JsonFieldValue({ field, text, hideLabel }: IJsonFieldValueProps): ReactElement;
|
|
108
110
|
export {};
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
PaginationPrevious2,
|
|
27
27
|
PaginationNext2,
|
|
28
28
|
PaginationEllipsis2
|
|
29
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-rf70907h.js";
|
|
30
30
|
import {
|
|
31
31
|
MenuPopup,
|
|
32
32
|
MenuItem2,
|
|
@@ -62,14 +62,14 @@ import {
|
|
|
62
62
|
} from "../../chunk-7vg045gd.js";
|
|
63
63
|
import {
|
|
64
64
|
Label2
|
|
65
|
-
} from "../../chunk-
|
|
65
|
+
} from "../../chunk-4m2x9jfb.js";
|
|
66
66
|
import {
|
|
67
67
|
Separator2
|
|
68
68
|
} from "../../chunk-52aadmkc.js";
|
|
69
69
|
import {
|
|
70
70
|
Field2,
|
|
71
71
|
FieldLabel2
|
|
72
|
-
} from "../../chunk-
|
|
72
|
+
} from "../../chunk-9e1yb90r.js";
|
|
73
73
|
import {
|
|
74
74
|
Slider2
|
|
75
75
|
} from "../../chunk-7cq1s2ey.js";
|
|
@@ -355,7 +355,7 @@ function JsonFieldLabel({ field, id, htmlFor }) {
|
|
|
355
355
|
return null;
|
|
356
356
|
return /* @__PURE__ */ jsxs2("div", {
|
|
357
357
|
"data-slot": "json-field-label",
|
|
358
|
-
className: "flex flex-wrap items-center gap-2",
|
|
358
|
+
className: "flex min-w-0 flex-wrap items-center gap-2",
|
|
359
359
|
children: [
|
|
360
360
|
field.label && /* @__PURE__ */ jsx5(Label2, {
|
|
361
361
|
id,
|
|
@@ -379,20 +379,27 @@ function JsonFieldMessage({ field }) {
|
|
|
379
379
|
children: field.error
|
|
380
380
|
});
|
|
381
381
|
}
|
|
382
|
-
function JsonFieldValue({ field, text }) {
|
|
382
|
+
function JsonFieldValue({ field, text, hideLabel = false }) {
|
|
383
383
|
const labelId = useId();
|
|
384
384
|
return /* @__PURE__ */ jsxs2("div", {
|
|
385
385
|
role: "group",
|
|
386
|
-
"aria-labelledby": field.label ? labelId : undefined,
|
|
386
|
+
"aria-labelledby": !hideLabel && field.label ? labelId : undefined,
|
|
387
|
+
"aria-label": hideLabel && field.label ? field.label : undefined,
|
|
387
388
|
"data-slot": "json-field-value",
|
|
388
|
-
className: "flex w-full flex-col gap-1",
|
|
389
|
+
className: "flex w-full min-w-0 flex-col gap-1",
|
|
389
390
|
children: [
|
|
390
|
-
/* @__PURE__ */ jsx5(
|
|
391
|
+
hideLabel ? field.isDefault && /* @__PURE__ */ jsx5("div", {
|
|
392
|
+
"data-slot": "json-field-label",
|
|
393
|
+
className: "flex min-w-0 flex-wrap items-center gap-2",
|
|
394
|
+
children: /* @__PURE__ */ jsx5(JsonFieldTags, {
|
|
395
|
+
field
|
|
396
|
+
})
|
|
397
|
+
}) : /* @__PURE__ */ jsx5(JsonFieldLabel, {
|
|
391
398
|
field,
|
|
392
399
|
id: labelId
|
|
393
400
|
}),
|
|
394
401
|
/* @__PURE__ */ jsx5("p", {
|
|
395
|
-
className: text ? "text-sm whitespace-pre-wrap" : "text-sm text-muted-foreground",
|
|
402
|
+
className: text ? "text-sm wrap-break-word whitespace-pre-wrap" : "text-sm text-muted-foreground",
|
|
396
403
|
children: text || "No answer"
|
|
397
404
|
})
|
|
398
405
|
]
|
package/dist/index.js
CHANGED
|
@@ -188,7 +188,7 @@ import {
|
|
|
188
188
|
DashboardLayout2,
|
|
189
189
|
BillingUsage2,
|
|
190
190
|
SelectionAction2
|
|
191
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-rf70907h.js";
|
|
192
192
|
import {
|
|
193
193
|
statusDotVariants2,
|
|
194
194
|
StatusDot2
|
|
@@ -336,7 +336,7 @@ import {
|
|
|
336
336
|
FieldDescription2,
|
|
337
337
|
FieldSeparator2,
|
|
338
338
|
FieldError2
|
|
339
|
-
} from "./chunk-
|
|
339
|
+
} from "./chunk-9e1yb90r.js";
|
|
340
340
|
import {
|
|
341
341
|
Spinner2
|
|
342
342
|
} from "./chunk-t3p4dn1p.js";
|
|
@@ -414,7 +414,7 @@ import {
|
|
|
414
414
|
} from "./chunk-1j2hz3w9.js";
|
|
415
415
|
import {
|
|
416
416
|
Label2
|
|
417
|
-
} from "./chunk-
|
|
417
|
+
} from "./chunk-4m2x9jfb.js";
|
|
418
418
|
import"./chunk-tcefvfr8.js";
|
|
419
419
|
import {
|
|
420
420
|
Popover2,
|
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.152",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ImageComparison
|
|
2
2
|
|
|
3
|
-
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
|
|
3
|
+
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 one image, chosen by the "Shown image" control or B and A on the focused stage (`side`, default `after`), and the "Hold to show before" (or "after") button shows the other image while a pointer, Space, or Enter is held; the header announces the shown image. `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`, `side`, `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.
|
|
4
4
|
|
|
5
5
|
Story: @alexgorbatchev/shadcn/components/data-display/ImageComparison
|
|
6
6
|
Source: src/components/stories/data-display/ImageComparison.stories.tsx
|
|
@@ -46,6 +46,7 @@ ImageComparison
|
|
|
46
46
|
before: { src: fixture_beforeScreenshot, alt: BEFORE_ALT },
|
|
47
47
|
after: { src: fixture_afterScreenshot, alt: AFTER_ALT },
|
|
48
48
|
onModeChange: fn(),
|
|
49
|
+
onSideChange: fn(),
|
|
49
50
|
onOrientationChange: fn(),
|
|
50
51
|
onZoomChange: fn(),
|
|
51
52
|
onShowDifferencesChange: fn(),
|
|
@@ -70,6 +71,14 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
70
71
|
{}
|
|
71
72
|
```
|
|
72
73
|
|
|
74
|
+
### ShownSide
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
{
|
|
78
|
+
args: { defaultSide: "before" }
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
73
82
|
### Swipe
|
|
74
83
|
|
|
75
84
|
```tsx
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# ImageGallery
|
|
2
|
+
|
|
3
|
+
Import `ImageGallery` and `MediaShell` from `@alexgorbatchev/shadcn/image-viewer`. `MediaShell` is the full-screen shell every image, comparison, gallery and diagram opens in: `title` (one line, truncated) and an optional `description` in the header, an always visible Close, and `children` filling the stage; `onOpenChange` receives Base UI's change details, so Escape can close an inner layer first with `details.cancel()`. `ImageGallery` steps through `items` (`{ key, src, alt, label }`) in one `ImageViewer` at the controlled `index`, keeping the zoom and viewed position between items so the same area of each can be compared. Its toolbar holds the zoom bar, Previous, "n of m" and Next (named by `previousLabel` and `nextLabel`, disabled with a reason at either end) and then `toolbar`, such as a Choose action; Left and Right step on the focused stage only at Fit, where arrows do not pan, and each step is announced politely as "<label> · n of m". `overlay`, `imageRef`, `stageRef`, `onStageKeyDown` and `stageKeyShortcuts` pass to the viewer. Name the shell after the shown item.
|
|
4
|
+
|
|
5
|
+
Story: @alexgorbatchev/shadcn/components/data-display/ImageGallery
|
|
6
|
+
Source: src/components/stories/data-display/ImageGallery.stories.tsx
|
|
7
|
+
|
|
8
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/ImageGallery.stories.tsx)
|
|
9
|
+
|
|
10
|
+
## Public imports
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { ImageGallery, MediaShell, type IImageGalleryItem, type IImageGalleryProps } from "@alexgorbatchev/shadcn/image-viewer";
|
|
14
|
+
import { Button } from "@alexgorbatchev/shadcn";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Supporting imports
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { useState, type ReactElement } from "react";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Default component
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
ImageGallery
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Default args
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
{ items: ITEMS, index: 0, onIndexChange: fn() }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Default render
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
(args) => <GalleryInShell items={args.items} onIndexChange={args.onIndexChange}/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
### StepAndChoose
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
{
|
|
49
|
+
render: (args) => <GalleryInShell items={args.items} onIndexChange={args.onIndexChange} onChoose={chooseSpy}/>
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Empty
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
{
|
|
57
|
+
args: { items: [] },
|
|
58
|
+
render: (args) => (<div className="h-64">
|
|
59
|
+
<ImageGallery items={args.items} index={0} onIndexChange={args.onIndexChange}/>
|
|
60
|
+
</div>)
|
|
61
|
+
}
|
|
62
|
+
```
|
|
@@ -229,6 +229,42 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
229
229
|
}
|
|
230
230
|
```
|
|
231
231
|
|
|
232
|
+
### TruncatedTitle
|
|
233
|
+
|
|
234
|
+
```tsx
|
|
235
|
+
{
|
|
236
|
+
render: (args) => {
|
|
237
|
+
const longTitle = "Q1 · Should the homelab security audit accept the webhook endpoint as an approved ingress route?";
|
|
238
|
+
return (<div className="flex flex-col gap-4">
|
|
239
|
+
<div data-testid="narrow-item" className="w-80">
|
|
240
|
+
<Item {...args} size="xs" variant="outline">
|
|
241
|
+
<ItemContent>
|
|
242
|
+
<ItemTitle truncate title={longTitle}>
|
|
243
|
+
{longTitle}
|
|
244
|
+
</ItemTitle>
|
|
245
|
+
</ItemContent>
|
|
246
|
+
<ItemActions>
|
|
247
|
+
<ItemDescription>waiting 1 d</ItemDescription>
|
|
248
|
+
</ItemActions>
|
|
249
|
+
</Item>
|
|
250
|
+
</div>
|
|
251
|
+
<div data-testid="wide-item" className="w-[64rem]">
|
|
252
|
+
<Item {...args} size="xs" variant="outline">
|
|
253
|
+
<ItemContent>
|
|
254
|
+
<ItemTitle truncate title={longTitle}>
|
|
255
|
+
{longTitle}
|
|
256
|
+
</ItemTitle>
|
|
257
|
+
</ItemContent>
|
|
258
|
+
<ItemActions>
|
|
259
|
+
<ItemDescription>waiting 1 d</ItemDescription>
|
|
260
|
+
</ItemActions>
|
|
261
|
+
</Item>
|
|
262
|
+
</div>
|
|
263
|
+
</div>);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
232
268
|
### NativeSeparatorCallback
|
|
233
269
|
|
|
234
270
|
```tsx
|
|
@@ -9,7 +9,7 @@ Source: src/components/stories/data-display/JsonRenderForm.stories.tsx
|
|
|
9
9
|
|
|
10
10
|
```tsx
|
|
11
11
|
import { Button } from "@alexgorbatchev/shadcn";
|
|
12
|
-
import { components, componentDefinitions, JsonFormProvider, stripRequiredMark, useJsonReveal, type JsonFormMode } from "@alexgorbatchev/shadcn/json-render";
|
|
12
|
+
import { components, componentDefinitions, JsonFieldValue, JsonFormProvider, stripRequiredMark, useJsonField, useJsonReveal, type JsonFormMode } from "@alexgorbatchev/shadcn/json-render";
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Supporting imports
|
|
@@ -150,3 +150,13 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
```
|
|
153
|
+
|
|
154
|
+
### FieldValueHideLabelAndNarrowWrap
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
{
|
|
158
|
+
render: () => (<JsonFormProvider mode="values" defaults={["/answers/defaulted"]}>
|
|
159
|
+
<FieldValueSamples />
|
|
160
|
+
</JsonFormProvider>)
|
|
161
|
+
}
|
|
162
|
+
```
|
|
@@ -179,3 +179,17 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
179
179
|
]
|
|
180
180
|
}
|
|
181
181
|
```
|
|
182
|
+
|
|
183
|
+
### NarrowWrap
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
{
|
|
187
|
+
render: () => {
|
|
188
|
+
const id = useId();
|
|
189
|
+
return (<div className="flex w-48 flex-col gap-2" data-testid="narrow-label-box">
|
|
190
|
+
<Label htmlFor={id}>Choose a rollout plan for very-long-unbroken-service-identifier-in-narrow-layout</Label>
|
|
191
|
+
<Input id={id}/>
|
|
192
|
+
</div>);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
@@ -199,6 +199,52 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
199
199
|
}
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
+
### RowLayout
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
{
|
|
206
|
+
render: (args) => (<div className="flex flex-col gap-6">
|
|
207
|
+
<div className="w-[56rem]" data-testid="wide">
|
|
208
|
+
<OptionCardGroup aria-label="Hero direction" layout="row" {...args}>
|
|
209
|
+
<HeroOption value="quiet" label="Quiet"/>
|
|
210
|
+
<HeroOption value="bold" label="Bold"/>
|
|
211
|
+
<HeroOption value="playful" label="Playful"/>
|
|
212
|
+
</OptionCardGroup>
|
|
213
|
+
</div>
|
|
214
|
+
<div className="w-72" data-testid="narrow">
|
|
215
|
+
<OptionCheckboxGroup aria-label="Hero directions" layout="row">
|
|
216
|
+
<OptionCheckboxCard value="quiet" label="Quiet narrow"/>
|
|
217
|
+
<OptionCheckboxCard value="bold" label="Bold narrow"/>
|
|
218
|
+
</OptionCheckboxGroup>
|
|
219
|
+
</div>
|
|
220
|
+
</div>)
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### RowLayoutWithFullSpanOption
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
{
|
|
228
|
+
render: (args) => (<div className="flex flex-col gap-6">
|
|
229
|
+
<div className="w-[56rem]" data-testid="radio-row">
|
|
230
|
+
<OptionCardGroup aria-label="Hero direction" layout="row" {...args}>
|
|
231
|
+
<OptionCard value="quiet" label="Quiet" description="Short description." image={<img src={fixture_attachmentImage} alt="Quiet" className="block h-auto w-full"/>}/>
|
|
232
|
+
<OptionCard value="bold" label="Bold" description="A noticeably longer trade-off description that wraps onto multiple lines so sibling row cards must stretch to match its height." image={<img src={fixture_attachmentImage} alt="Bold" className="block h-auto w-full"/>}/>
|
|
233
|
+
<OptionCard value="playful" label="Playful" description="Medium copy." image={<img src={fixture_attachmentImage} alt="Playful" className="block h-auto w-full"/>}/>
|
|
234
|
+
<OptionCard value="other" label="Something else" span="full"/>
|
|
235
|
+
</OptionCardGroup>
|
|
236
|
+
</div>
|
|
237
|
+
<div className="w-[56rem]" data-testid="checkbox-row">
|
|
238
|
+
<OptionCheckboxGroup aria-label="Extra directions" layout="row">
|
|
239
|
+
<OptionCheckboxCard value="a" label="Alpha" description="Short."/>
|
|
240
|
+
<OptionCheckboxCard value="b" label="Beta" description="Multiple lines of description text that make this card taller than its sibling."/>
|
|
241
|
+
<OptionCheckboxCard value="other" label="Other direction" span="full"/>
|
|
242
|
+
</OptionCheckboxGroup>
|
|
243
|
+
</div>
|
|
244
|
+
</div>)
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
202
248
|
### FoldedDescription
|
|
203
249
|
|
|
204
250
|
```tsx
|
|
@@ -260,3 +260,32 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
260
260
|
</Accordion>)
|
|
261
261
|
}
|
|
262
262
|
```
|
|
263
|
+
|
|
264
|
+
### NarrowWrappingAndNestedProse
|
|
265
|
+
|
|
266
|
+
```tsx
|
|
267
|
+
{
|
|
268
|
+
render: () => (<div className="w-60" data-testid="narrow-accordion">
|
|
269
|
+
<Accordion multiple defaultValue={["direct", "nested"]}>
|
|
270
|
+
<AccordionItem value="direct">
|
|
271
|
+
<AccordionTrigger>
|
|
272
|
+
deployment-rollout-strategy-for-production-edge-workers-2026 with extra trailing words
|
|
273
|
+
</AccordionTrigger>
|
|
274
|
+
<AccordionContent>
|
|
275
|
+
<p data-testid="direct-first">First direct paragraph.</p>
|
|
276
|
+
<p data-testid="direct-second">Second direct paragraph.</p>
|
|
277
|
+
</AccordionContent>
|
|
278
|
+
</AccordionItem>
|
|
279
|
+
<AccordionItem value="nested">
|
|
280
|
+
<AccordionTrigger>Nested typeset content</AccordionTrigger>
|
|
281
|
+
<AccordionContent>
|
|
282
|
+
<div className="typeset" data-testid="nested-prose">
|
|
283
|
+
<p data-testid="nested-first">First nested paragraph.</p>
|
|
284
|
+
<p data-testid="nested-second">Second nested paragraph.</p>
|
|
285
|
+
</div>
|
|
286
|
+
</AccordionContent>
|
|
287
|
+
</AccordionItem>
|
|
288
|
+
</Accordion>
|
|
289
|
+
</div>)
|
|
290
|
+
}
|
|
291
|
+
```
|
package/llms.txt
CHANGED
|
@@ -345,7 +345,8 @@ Generated from the public package exports and Storybook sources.
|
|
|
345
345
|
- [DescriptionList](./llms/components/data-display/DescriptionList.md)
|
|
346
346
|
- [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.
|
|
347
347
|
- [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.
|
|
348
|
-
- [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
|
|
348
|
+
- [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 one image, chosen by the "Shown image" control or B and A on the focused stage (`side`, default `after`), and the "Hold to show before" (or "after") button shows the other image while a pointer, Space, or Enter is held; the header announces the shown image. `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`, `side`, `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.
|
|
349
|
+
- [ImageGallery](./llms/components/data-display/ImageGallery.md): Import `ImageGallery` and `MediaShell` from `@alexgorbatchev/shadcn/image-viewer`. `MediaShell` is the full-screen shell every image, comparison, gallery and diagram opens in: `title` (one line, truncated) and an optional `description` in the header, an always visible Close, and `children` filling the stage; `onOpenChange` receives Base UI's change details, so Escape can close an inner layer first with `details.cancel()`. `ImageGallery` steps through `items` (`{ key, src, alt, label }`) in one `ImageViewer` at the controlled `index`, keeping the zoom and viewed position between items so the same area of each can be compared. Its toolbar holds the zoom bar, Previous, "n of m" and Next (named by `previousLabel` and `nextLabel`, disabled with a reason at either end) and then `toolbar`, such as a Choose action; Left and Right step on the focused stage only at Fit, where arrows do not pan, and each step is announced politely as "<label> · n of m". `overlay`, `imageRef`, `stageRef`, `onStageKeyDown` and `stageKeyShortcuts` pass to the viewer. Name the shell after the shown item.
|
|
349
350
|
- [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.
|
|
350
351
|
- [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.
|
|
351
352
|
- [ImageZoomToggle](./llms/components/data-display/ImageZoomToggle.md): Import from `@alexgorbatchev/shadcn/image-viewer`. A two-option toggle for ImageViewer and ImageComparison zoom that consumers place in a header or toolbar. "Fit to screen" and "Original size" are pressed-state toggles with constant names, so assistive technology announces the active zoom through `aria-pressed`. Original size sets zoom `1`; other numeric zooms, such as 150% from the ImageViewer zoom bar, press neither option. `label` names the group (default "Zoom"); `size`, `orientation`, `layout`, `disabled`, and `density` follow ToggleGroup.
|