@alexgorbatchev/shadcn 0.0.96 → 0.0.98

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.
@@ -1285,11 +1285,12 @@ function Breadcrumb2({ density, className, ...props }) {
1285
1285
  ...props
1286
1286
  });
1287
1287
  }
1288
- function BreadcrumbList2({ density, className, ...props }) {
1288
+ function BreadcrumbList2({ density, overflow = "wrap", className, ...props }) {
1289
1289
  return /* @__PURE__ */ jsx15("ol", {
1290
1290
  "data-density": density,
1291
1291
  "data-slot": "breadcrumb-list",
1292
- className: cn2("flex flex-wrap items-center gap-control-gap text-sm wrap-break-word text-muted-foreground", className),
1292
+ "data-overflow": overflow,
1293
+ className: cn2("flex items-center gap-control-gap text-sm text-muted-foreground", overflow === "wrap" ? "flex-wrap wrap-break-word" : "min-w-0 flex-nowrap overflow-hidden whitespace-nowrap [&>li]:min-w-0 [&>li>*]:min-w-0 [&>li>*]:truncate [&>li[data-slot=breadcrumb-separator]]:shrink-0", className),
1293
1294
  ...props
1294
1295
  });
1295
1296
  }
@@ -4,8 +4,15 @@ import type { ComponentProps, ReactElement } from "react";
4
4
  import { useRender } from "@base-ui/react/use-render";
5
5
  type BreadcrumbProps = ComponentProps<"nav"> & IDensityProps;
6
6
  declare function Breadcrumb({ density, className, ...props }: BreadcrumbProps): ReactElement;
7
- type BreadcrumbListProps = ComponentProps<"ol"> & IDensityProps;
8
- declare function BreadcrumbList({ density, className, ...props }: BreadcrumbListProps): ReactElement;
7
+ type BreadcrumbListProps = ComponentProps<"ol"> & IDensityProps & {
8
+ /**
9
+ * `wrap` (the default) lets a long path break onto more lines. `truncate` keeps the path on one line: every item
10
+ * shrinks and ends in an ellipsis, longer items giving up more width, while separators keep their size. Give each
11
+ * truncated item its full text as a tooltip or accessible name.
12
+ */
13
+ overflow?: "wrap" | "truncate";
14
+ };
15
+ declare function BreadcrumbList({ density, overflow, className, ...props }: BreadcrumbListProps): ReactElement;
9
16
  type BreadcrumbItemProps = ComponentProps<"li"> & IDensityProps;
10
17
  declare function BreadcrumbItem({ density, className, ...props }: BreadcrumbItemProps): ReactElement;
11
18
  type BreadcrumbLinkProps = IAnalyticsProps & useRender.ComponentProps<"a"> & IDensityProps;
@@ -24,7 +24,10 @@ export interface IImageViewerProps extends IDensityProps {
24
24
  * `ImageZoomToggle` yourself instead to put a simpler control in a header.
25
25
  */
26
26
  showZoomControl?: boolean;
27
- /** Further controls in the toolbar row after the zoom bar, such as comment actions. Renders the row on its own too. */
27
+ /**
28
+ * Further controls in the toolbar row after the zoom bar, such as comment actions. Renders the row on its own too.
29
+ * Controls that do not fit wrap onto further rows, so every control stays visible on narrow screens.
30
+ */
28
31
  toolbar?: ReactNode;
29
32
  /**
30
33
  * Content sized and positioned exactly over the rendered image at every zoom level, such as region selections or
@@ -537,7 +537,7 @@ function ImageViewer({
537
537
  children: [
538
538
  (showZoomControl || toolbar !== undefined) && /* @__PURE__ */ jsxs2("div", {
539
539
  "data-slot": "image-viewer-toolbar",
540
- className: "flex shrink-0 flex-nowrap items-center gap-control-gap overflow-x-auto overscroll-x-contain *:shrink-0",
540
+ className: "flex shrink-0 flex-wrap items-center gap-control-gap *:shrink-0",
541
541
  children: [
542
542
  showZoomControl && /* @__PURE__ */ jsx3(ImageZoomControl, {
543
543
  zoom: shownZoom,
@@ -26,7 +26,7 @@ import {
26
26
  PaginationPrevious2,
27
27
  PaginationNext2,
28
28
  PaginationEllipsis2
29
- } from "../../chunk-d2nyvsjc.js";
29
+ } from "../../chunk-m7rs4v5x.js";
30
30
  import {
31
31
  MenuPopup,
32
32
  MenuItem2,
package/dist/index.js CHANGED
@@ -165,7 +165,7 @@ import {
165
165
  StatusTracker2,
166
166
  DashboardLayout2,
167
167
  BillingUsage2
168
- } from "./chunk-d2nyvsjc.js";
168
+ } from "./chunk-m7rs4v5x.js";
169
169
  import {
170
170
  Combobox2,
171
171
  ComboboxValue2,
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.96",
2054
+ version: "0.0.98",
2055
2055
  description: "Sharp, monospace React components with compact and comfortable densities.",
2056
2056
  license: "MIT",
2057
2057
  repository: {
@@ -1,6 +1,6 @@
1
1
  # ImageViewer
2
2
 
3
- 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. `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.
3
+ 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.
4
4
 
5
5
  Story: @alexgorbatchev/shadcn/components/data-display/ImageViewer
6
6
  Source: src/components/stories/data-display/ImageViewer.stories.tsx
@@ -102,6 +102,26 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
102
102
  }
103
103
  ```
104
104
 
105
+ ### NarrowToolbar
106
+
107
+ ```tsx
108
+ {
109
+ args: { defaultZoom: "fit", showZoomControl: true },
110
+ render: (args) => (
111
+ // A 320 px phone with 16 px gutters leaves 288 px for the toolbar.
112
+ <div className="flex h-96 w-72 flex-col border border-border">
113
+ <ImageViewer {...args} toolbar={<>
114
+ <Toggle variant="outline" size="sm">
115
+ Comment on a region
116
+ </Toggle>
117
+ <Button variant="outline" size="sm">
118
+ Comment on image
119
+ </Button>
120
+ </>}/>
121
+ </div>)
122
+ }
123
+ ```
124
+
105
125
  ### RegionTool
106
126
 
107
127
  ```tsx
@@ -157,3 +157,29 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
157
157
  args: { dir: "rtl" }
158
158
  }
159
159
  ```
160
+
161
+ ### Truncated
162
+
163
+ ```tsx
164
+ {
165
+ render: (args) => (<div className="w-80">
166
+ <Breadcrumb {...args}>
167
+ <BreadcrumbList overflow="truncate">
168
+ <BreadcrumbItem>
169
+ <BreadcrumbLink href="#project" title={LONG_PROJECT}>
170
+ {LONG_PROJECT}
171
+ </BreadcrumbLink>
172
+ </BreadcrumbItem>
173
+ <BreadcrumbSeparator />
174
+ <BreadcrumbItem>
175
+ <BreadcrumbLink href="#interviews">Interviews</BreadcrumbLink>
176
+ </BreadcrumbItem>
177
+ <BreadcrumbSeparator />
178
+ <BreadcrumbItem>
179
+ <BreadcrumbPage>Interview 35</BreadcrumbPage>
180
+ </BreadcrumbItem>
181
+ </BreadcrumbList>
182
+ </Breadcrumb>
183
+ </div>)
184
+ }
185
+ ```
package/llms.txt CHANGED
@@ -345,7 +345,7 @@ Generated from the public package exports and Storybook sources.
345
345
  - [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
346
  - [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.
347
347
  - [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.
348
- - [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. `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.
348
+ - [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.
349
349
  - [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.
350
350
  - [Item](./llms/components/data-display/Item.md)
351
351
  - [JsonRender](./llms/components/data-display/JsonRender.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.96",
3
+ "version": "0.0.98",
4
4
  "description": "Sharp, monospace React components with compact and comfortable densities.",
5
5
  "license": "MIT",
6
6
  "repository": {