@alexgorbatchev/shadcn 0.0.154 → 0.0.156
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-9e1yb90r.js → chunk-5ez5vgkn.js} +2 -2
- package/dist/{chunk-a08meqj4.js → chunk-g2amqz9q.js} +16 -13
- package/dist/{chunk-ncskzkqr.js → chunk-hbhpnc1m.js} +1 -1
- package/dist/{chunk-v64bc7ky.js → chunk-j6mh013a.js} +1 -1
- package/dist/{chunk-5q0670jv.js → chunk-tgkc06q4.js} +1 -1
- package/dist/{chunk-ywr2pqhc.js → chunk-xndv627n.js} +1 -1
- package/dist/components/Field.d.ts +5 -2
- package/dist/components/assistant-ui/elements/EditMessage.js +2 -2
- package/dist/components/assistant-ui/elements/ElicitationForm.js +2 -2
- package/dist/components/assistant-ui/elements/FeedbackDialog.js +2 -2
- package/dist/components/assistant-ui/elements/ModelPicker.js +2 -2
- package/dist/components/assistant-ui/index.js +5 -5
- package/dist/components/event-calendar/index.js +1 -1
- package/dist/components/image-viewer/ImageComparison.d.ts +23 -6
- package/dist/components/image-viewer/ImageComparisonToolbar.d.ts +6 -3
- package/dist/components/image-viewer/ImageDifferenceOverlay.d.ts +6 -2
- package/dist/components/image-viewer/ImageGallery.d.ts +16 -4
- package/dist/components/image-viewer/ImageRegionMarker.d.ts +3 -1
- package/dist/components/image-viewer/ImageRegionSelect.d.ts +4 -2
- package/dist/components/image-viewer/index.js +595 -206
- package/dist/components/input-otp/index.js +1 -1
- package/dist/components/json-render/index.js +2 -2
- package/dist/components/text-diff/index.js +5 -4
- package/dist/components/tree/Tree.d.ts +3 -1
- package/dist/components/tree/TreeItem.d.ts +3 -1
- package/dist/components/tree/TreeSelect.d.ts +3 -1
- package/dist/components/tree/index.js +18 -6
- package/dist/index.js +2 -2
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/ImageComparison.md +14 -1
- package/llms/components/data-display/ImageGallery.md +9 -1
- package/llms/components/navigation/TreeSelect.md +10 -0
- package/llms.txt +2 -2
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
PaginationPrevious2,
|
|
27
27
|
PaginationNext2,
|
|
28
28
|
PaginationEllipsis2
|
|
29
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-g2amqz9q.js";
|
|
30
30
|
import {
|
|
31
31
|
MenuPopup,
|
|
32
32
|
MenuItem2,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
import {
|
|
70
70
|
Field2,
|
|
71
71
|
FieldLabel2
|
|
72
|
-
} from "../../chunk-
|
|
72
|
+
} from "../../chunk-5ez5vgkn.js";
|
|
73
73
|
import {
|
|
74
74
|
Slider2
|
|
75
75
|
} from "../../chunk-7cq1s2ey.js";
|
|
@@ -126,7 +126,7 @@ function TextDiff({
|
|
|
126
126
|
children: [
|
|
127
127
|
/* @__PURE__ */ jsxs("div", {
|
|
128
128
|
"data-testid": "TextDiff--legend",
|
|
129
|
-
className: cn2("flex min-h-control-lg items-center
|
|
129
|
+
className: cn2("flex min-h-control-lg items-center border-b border-frame-edge text-xs font-medium tracking-wide text-muted-foreground", isSplit ? "[&>*]:w-1/2 [&>*:first-child]:border-e [&>*:first-child]:border-frame-edge [&>*:first-child]:ps-control-x [&>*:first-child]:pe-control-x [&>*:last-child]:px-control-x" : "gap-control-gap px-control-x"),
|
|
130
130
|
children: [
|
|
131
131
|
/* @__PURE__ */ jsx(SignLabel, {
|
|
132
132
|
sign: "-",
|
|
@@ -150,11 +150,12 @@ function TextDiff({
|
|
|
150
150
|
return /* @__PURE__ */ jsxs(Fragment, {
|
|
151
151
|
children: [
|
|
152
152
|
/* @__PURE__ */ jsx("div", {
|
|
153
|
-
|
|
153
|
+
"data-slot": "text-diff-fold",
|
|
154
|
+
className: "my-1 flex items-center border-y border-frame-edge bg-muted/40 px-control-x py-1 font-sans",
|
|
154
155
|
children: /* @__PURE__ */ jsx(Button2, {
|
|
155
156
|
type: "button",
|
|
156
|
-
variant: "
|
|
157
|
-
size: "
|
|
157
|
+
variant: "outline",
|
|
158
|
+
size: "xs",
|
|
158
159
|
"aria-expanded": isExpanded,
|
|
159
160
|
"aria-controls": regionId,
|
|
160
161
|
onClick: () => toggle(segment.start),
|
|
@@ -6,6 +6,8 @@ type TreeProps<T> = IAnalyticsProps & IDensityProps & {
|
|
|
6
6
|
tree: TreeInstance<T>;
|
|
7
7
|
label: string;
|
|
8
8
|
variant?: "default" | "sidebar";
|
|
9
|
+
/** Take remaining vertical space inside a flex parent while keeping rows packed from the top. */
|
|
10
|
+
grow?: boolean;
|
|
9
11
|
renderIcon?: (item: ItemInstance<T>) => ReactNode;
|
|
10
12
|
renderLabel?: (item: ItemInstance<T>) => ReactNode;
|
|
11
13
|
renderItem?: (item: ItemInstance<T>) => ReactNode;
|
|
@@ -14,6 +16,6 @@ type TreeProps<T> = IAnalyticsProps & IDensityProps & {
|
|
|
14
16
|
* Headless Tree owns navigation, selection, expansion, and optional pointer/keyboard drag and drop. The tree is one Tab
|
|
15
17
|
* stop: arrows move between items, and row controls stay out of the Tab order.
|
|
16
18
|
*/
|
|
17
|
-
declare function Tree<T>({ analytics, tree, label, variant, renderIcon, renderLabel, renderItem, density, }: TreeProps<T>): ReactElement;
|
|
19
|
+
declare function Tree<T>({ analytics, tree, label, variant, grow, renderIcon, renderLabel, renderItem, density, }: TreeProps<T>): ReactElement;
|
|
18
20
|
export { Tree };
|
|
19
21
|
export type { TreeProps };
|
|
@@ -27,6 +27,8 @@ type TreeItemProps<T> = useRender.ComponentProps<"div", TreeItemState> & IDensit
|
|
|
27
27
|
* never rests on colour.
|
|
28
28
|
*/
|
|
29
29
|
tone?: "default" | "warning";
|
|
30
|
+
/** Selected row highlight: `subtle` uses the neutral accent fill; `accent` adds a primary border for pickers. */
|
|
31
|
+
selectionStyle?: "subtle" | "accent";
|
|
30
32
|
endEnhancer?: ReactNode;
|
|
31
33
|
expandOn?: "click" | "doubleClick" | "disclosure";
|
|
32
34
|
isEditing?: boolean;
|
|
@@ -107,5 +109,5 @@ export declare function TreeItemDot({ count, className }: ITreeItemDotProps): Re
|
|
|
107
109
|
* Registered tree row; compose menus with render, put counts in `description` and pointer shortcuts in `actions`.
|
|
108
110
|
* `endEnhancer` holds controls that must stay keyboard reachable on their own.
|
|
109
111
|
*/
|
|
110
|
-
export declare function TreeItem<T>({ analytics, item, children, startEnhancer, endEnhancer, description, descriptionLabel, actions, expandOn, isEditing, isDropTarget, isDimmed, isUnread, hasIcon, tone, leading, marker, linkProps, dropHint, density, render, ref, ...props }: TreeItemProps<T>): ReactElement;
|
|
112
|
+
export declare function TreeItem<T>({ analytics, item, children, startEnhancer, endEnhancer, description, descriptionLabel, actions, expandOn, isEditing, isDropTarget, isDimmed, isUnread, hasIcon, tone, selectionStyle, leading, marker, linkProps, dropHint, density, render, ref, ...props }: TreeItemProps<T>): ReactElement;
|
|
111
113
|
export type { TreeItemProps };
|
|
@@ -24,6 +24,8 @@ export interface ITreeSelectProps {
|
|
|
24
24
|
currentLabel?: string | undefined;
|
|
25
25
|
/** Shown when the filter matches nothing; defaults to "No matches". */
|
|
26
26
|
emptyLabel?: string | undefined;
|
|
27
|
+
/** Stretch the destination list to fill remaining vertical space inside a flex parent. */
|
|
28
|
+
grow?: boolean | undefined;
|
|
27
29
|
isDisabled?: boolean | undefined;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
@@ -32,4 +34,4 @@ export interface ITreeSelectProps {
|
|
|
32
34
|
* Space or a click chooses. The current place carries `currentLabel`, and places that cannot be chosen stay listed with
|
|
33
35
|
* their reason as the row's description.
|
|
34
36
|
*/
|
|
35
|
-
export declare function TreeSelect({ nodes, value, onValueChange, label, filterLabel, filterPlaceholder, currentId, currentLabel, emptyLabel, isDisabled, }: ITreeSelectProps): ReactElement;
|
|
37
|
+
export declare function TreeSelect({ nodes, value, onValueChange, label, filterLabel, filterPlaceholder, currentId, currentLabel, emptyLabel, grow, isDisabled, }: ITreeSelectProps): ReactElement;
|
|
@@ -120,6 +120,7 @@ function TreeItem({
|
|
|
120
120
|
isUnread = false,
|
|
121
121
|
hasIcon = true,
|
|
122
122
|
tone = "default",
|
|
123
|
+
selectionStyle = "subtle",
|
|
123
124
|
leading,
|
|
124
125
|
marker,
|
|
125
126
|
linkProps,
|
|
@@ -247,7 +248,7 @@ function TreeItem({
|
|
|
247
248
|
onDragStart: undefined
|
|
248
249
|
} : {},
|
|
249
250
|
style: { paddingInlineStart: `${item.getItemMeta().level * (item.getTree().getConfig().indent ?? 20) + 8}px` },
|
|
250
|
-
className: cn2("relative flex min-h-control min-w-0 cursor-default items-center gap-2 rounded-sm py-1 pr-2 text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring", (isSelected || isDropTarget || isInsideTarget) && "bg-accent text-accent-foreground", tone === "warning" && "before:pointer-events-none before:absolute before:inset-y-1 before:start-0 before:w-0.5 before:rounded-full before:bg-warning", isDimmed && "group/tree-item"),
|
|
251
|
+
className: cn2("relative flex min-h-control min-w-0 cursor-default items-center gap-2 rounded-sm border border-transparent py-1 pr-2 text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring", (isSelected || isDropTarget || isInsideTarget) && (selectionStyle === "accent" && isSelected ? "border-primary bg-muted/60 font-medium text-foreground" : "bg-accent text-accent-foreground"), tone === "warning" && "before:pointer-events-none before:absolute before:inset-y-1 before:start-0 before:w-0.5 before:rounded-full before:bg-warning", isDimmed && "group/tree-item"),
|
|
251
252
|
children: /* @__PURE__ */ jsxs(Fragment, {
|
|
252
253
|
children: [
|
|
253
254
|
item.isFolder() && expandOn === "disclosure" ? /* @__PURE__ */ jsx(Button2, {
|
|
@@ -363,6 +364,7 @@ function Tree({
|
|
|
363
364
|
tree,
|
|
364
365
|
label,
|
|
365
366
|
variant = "default",
|
|
367
|
+
grow = false,
|
|
366
368
|
renderIcon,
|
|
367
369
|
renderLabel,
|
|
368
370
|
renderItem,
|
|
@@ -378,7 +380,7 @@ function Tree({
|
|
|
378
380
|
children: /* @__PURE__ */ jsxs2("div", {
|
|
379
381
|
...container,
|
|
380
382
|
"data-density": density,
|
|
381
|
-
className: cn2("grid min-w-0 grid-cols-1 gap-1", variant === "default" && "rounded-sm border border-border bg-card p-2"),
|
|
383
|
+
className: cn2("grid min-w-0 grid-cols-1 gap-1", variant === "default" && "rounded-sm border border-border bg-card p-2", grow && "min-h-0 flex-1 content-start"),
|
|
382
384
|
onKeyDown: (event) => {
|
|
383
385
|
if (event.target instanceof Element && event.target.closest("input,textarea,select,form,button,[role=menu]"))
|
|
384
386
|
return;
|
|
@@ -2630,6 +2632,7 @@ var useTree = (config) => {
|
|
|
2630
2632
|
};
|
|
2631
2633
|
// src/components/tree/TreeSelect.tsx
|
|
2632
2634
|
import { useEffect as useEffect2, useId as useId2, useMemo, useState as useState2 } from "react";
|
|
2635
|
+
import { CheckIcon } from "lucide-react";
|
|
2633
2636
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2634
2637
|
var ROOT_ID = "tree-select-root";
|
|
2635
2638
|
function indexNodes(nodes, parentId, index) {
|
|
@@ -2662,6 +2665,7 @@ function TreeSelect({
|
|
|
2662
2665
|
currentId,
|
|
2663
2666
|
currentLabel = "Current location",
|
|
2664
2667
|
emptyLabel = "No matches",
|
|
2668
|
+
grow = false,
|
|
2665
2669
|
isDisabled = false
|
|
2666
2670
|
}) {
|
|
2667
2671
|
const filterId = useId2();
|
|
@@ -2714,7 +2718,7 @@ function TreeSelect({
|
|
|
2714
2718
|
return /* @__PURE__ */ jsxs3("div", {
|
|
2715
2719
|
"data-testid": "TreeSelect",
|
|
2716
2720
|
"data-slot": "tree-select",
|
|
2717
|
-
className: "flex min-w-0 flex-col gap-2",
|
|
2721
|
+
className: cn2("flex min-w-0 flex-col gap-2", grow && "min-h-0 flex-1"),
|
|
2718
2722
|
children: [
|
|
2719
2723
|
/* @__PURE__ */ jsx3(Input2, {
|
|
2720
2724
|
id: filterId,
|
|
@@ -2739,17 +2743,25 @@ function TreeSelect({
|
|
|
2739
2743
|
hasItems ? /* @__PURE__ */ jsx3(Tree, {
|
|
2740
2744
|
tree,
|
|
2741
2745
|
label,
|
|
2746
|
+
grow,
|
|
2742
2747
|
renderItem: (item) => {
|
|
2743
2748
|
const node = item.getItemData();
|
|
2744
|
-
const
|
|
2749
|
+
const isCurrent = node.id === currentId;
|
|
2750
|
+
const isChoice = node.id === value && !isCurrent && !node.disabledReason;
|
|
2751
|
+
const description = node.disabledReason ?? (isCurrent ? currentLabel : undefined);
|
|
2745
2752
|
return /* @__PURE__ */ jsx3(TreeItem, {
|
|
2746
2753
|
item,
|
|
2747
2754
|
expandOn: "disclosure",
|
|
2748
2755
|
hasIcon: false,
|
|
2756
|
+
selectionStyle: "accent",
|
|
2749
2757
|
description,
|
|
2750
|
-
|
|
2758
|
+
marker: isChoice ? /* @__PURE__ */ jsx3(CheckIcon, {
|
|
2759
|
+
"aria-hidden": "true",
|
|
2760
|
+
className: "size-3.5 text-primary"
|
|
2761
|
+
}) : undefined,
|
|
2762
|
+
isDimmed: Boolean(node.disabledReason) || isCurrent,
|
|
2751
2763
|
"aria-disabled": node.disabledReason || isDisabled ? true : undefined,
|
|
2752
|
-
"data-current":
|
|
2764
|
+
"data-current": isCurrent ? "" : undefined,
|
|
2753
2765
|
onKeyDown: (event) => {
|
|
2754
2766
|
if (event.key !== " ")
|
|
2755
2767
|
return;
|
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-g2amqz9q.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-5ez5vgkn.js";
|
|
340
340
|
import {
|
|
341
341
|
Spinner2
|
|
342
342
|
} from "./chunk-t3p4dn1p.js";
|
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.156",
|
|
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 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
|
|
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`, chosen automatically when the stage is taller than wide unless controlled) that scroll in sync when zoomed. Every mode starts fitted and offers original size (zoom `1`) with edge-fade scroll hints when content extends out of view; 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 offers a "Change n of m" stepper (`N` / `Shift+N` on the stage, centering each change in every shown pane, and jumping to the first change at original size); it is disabled with a reason when pixels cannot be read. `toolbar`, `beforeOverlay`, `afterOverlay`, `stageOverlay`, and `onCommentDifference` let consumers host region comments in every mode. Controls sit in a single horizontal wrapping row above the stage so images use the full width.
|
|
4
4
|
|
|
5
5
|
Story: @alexgorbatchev/shadcn/components/data-display/ImageComparison
|
|
6
6
|
Source: src/components/stories/data-display/ImageComparison.stories.tsx
|
|
@@ -153,6 +153,19 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
153
153
|
}
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
+
### StepThroughChanges
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
{
|
|
160
|
+
args: {
|
|
161
|
+
before: { src: fixture_widerBeforeScreenshot, alt: BEFORE_ALT },
|
|
162
|
+
defaultMode: "side-by-side",
|
|
163
|
+
defaultShowDifferences: true,
|
|
164
|
+
onCommentDifference: fn(),
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
156
169
|
### FullscreenDialog
|
|
157
170
|
|
|
158
171
|
```tsx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ImageGallery
|
|
2
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.
|
|
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), an optional "Compare all" toggle (enabled by `allowCompareAll` or `renderItemFooter`) that shows every item side by side with synchronized scrolling and per-item footers, 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
4
|
|
|
5
5
|
Story: @alexgorbatchev/shadcn/components/data-display/ImageGallery
|
|
6
6
|
Source: src/components/stories/data-display/ImageGallery.stories.tsx
|
|
@@ -50,6 +50,14 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
50
50
|
}
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
### CompareAll
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
{
|
|
57
|
+
render: (args) => <GalleryInShell items={args.items} onIndexChange={args.onIndexChange} onChoose={chooseSpy}/>
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
53
61
|
### Empty
|
|
54
62
|
|
|
55
63
|
```tsx
|
|
@@ -39,6 +39,16 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
39
39
|
{}
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
### GrowingHeight
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
{
|
|
46
|
+
render: () => (<div className="flex h-[500px] w-[360px] flex-col">
|
|
47
|
+
<TreeSelect nodes={destinations.slice(0, 1)} value="homepage" currentId="navigation" label="Destination" filterLabel="Filter places" filterPlaceholder="Filter places" grow onValueChange={choose}/>
|
|
48
|
+
</div>)
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
42
52
|
### FilterAndKeys
|
|
43
53
|
|
|
44
54
|
```tsx
|
package/llms.txt
CHANGED
|
@@ -345,8 +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 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
|
|
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.
|
|
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`, chosen automatically when the stage is taller than wide unless controlled) that scroll in sync when zoomed. Every mode starts fitted and offers original size (zoom `1`) with edge-fade scroll hints when content extends out of view; 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 offers a "Change n of m" stepper (`N` / `Shift+N` on the stage, centering each change in every shown pane, and jumping to the first change at original size); it is disabled with a reason when pixels cannot be read. `toolbar`, `beforeOverlay`, `afterOverlay`, `stageOverlay`, and `onCommentDifference` let consumers host region comments in every mode. Controls sit in a single horizontal wrapping row above the stage so images use the full width.
|
|
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), an optional "Compare all" toggle (enabled by `allowCompareAll` or `renderItemFooter`) that shows every item side by side with synchronized scrolling and per-item footers, 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.
|
|
350
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.
|
|
351
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.
|
|
352
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.
|