@alexgorbatchev/shadcn 0.0.192 → 0.0.193
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-0sw2wewv.js → chunk-8jsnbs5p.js} +16 -3
- package/dist/components/Heading.d.ts +8 -1
- package/dist/components/json-render/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/Heading.md +18 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
|
@@ -4260,14 +4260,27 @@ var SIZE_CLASSES2 = {
|
|
|
4260
4260
|
"2xl": "text-2xl tracking-tight",
|
|
4261
4261
|
"3xl": "text-3xl tracking-tight"
|
|
4262
4262
|
};
|
|
4263
|
-
|
|
4263
|
+
var TONE_CLASSES2 = {
|
|
4264
|
+
default: "text-foreground",
|
|
4265
|
+
destructive: "text-destructive"
|
|
4266
|
+
};
|
|
4267
|
+
function Heading2({
|
|
4268
|
+
level,
|
|
4269
|
+
size,
|
|
4270
|
+
tone = "default",
|
|
4271
|
+
truncate = false,
|
|
4272
|
+
density,
|
|
4273
|
+
className,
|
|
4274
|
+
render,
|
|
4275
|
+
...props
|
|
4276
|
+
}) {
|
|
4264
4277
|
return useRender14({
|
|
4265
4278
|
defaultTagName: HEADING_TAGS[level],
|
|
4266
4279
|
props: mergeProps13({
|
|
4267
|
-
className: cn2("min-w-0 rounded-sm font-semibold
|
|
4280
|
+
className: cn2("min-w-0 rounded-sm font-semibold outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", TONE_CLASSES2[tone], SIZE_CLASSES2[size ?? DEFAULT_SIZES[level]], truncate ? "truncate" : "break-words", className)
|
|
4268
4281
|
}, props),
|
|
4269
4282
|
render,
|
|
4270
|
-
state: { slot: "heading", level, density }
|
|
4283
|
+
state: { slot: "heading", level, tone, density }
|
|
4271
4284
|
});
|
|
4272
4285
|
}
|
|
4273
4286
|
// src/components/Quote.tsx
|
|
@@ -3,9 +3,11 @@ import { useRender } from "@base-ui/react/use-render";
|
|
|
3
3
|
import type { Density, IDensityProps } from "../density/types.js";
|
|
4
4
|
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
5
|
type HeadingSize = "sm" | "base" | "lg" | "xl" | "2xl" | "3xl";
|
|
6
|
+
type HeadingTone = "default" | "destructive";
|
|
6
7
|
type HeadingState = {
|
|
7
8
|
slot: "heading";
|
|
8
9
|
level: HeadingLevel;
|
|
10
|
+
tone: HeadingTone;
|
|
9
11
|
density?: Density;
|
|
10
12
|
};
|
|
11
13
|
type HeadingProps = useRender.ComponentProps<"h2", HeadingState> & IDensityProps & {
|
|
@@ -13,9 +15,14 @@ type HeadingProps = useRender.ComponentProps<"h2", HeadingState> & IDensityProps
|
|
|
13
15
|
level: HeadingLevel;
|
|
14
16
|
/** Visual size, independent of the outline level. Defaults by level. */
|
|
15
17
|
size?: HeadingSize;
|
|
18
|
+
/**
|
|
19
|
+
* Text colour. `destructive` marks a heading whose section needs attention, such as an unanswered required question
|
|
20
|
+
* after a failed submit; pair it with an accessible description, because colour alone carries no meaning.
|
|
21
|
+
*/
|
|
22
|
+
tone?: HeadingTone;
|
|
16
23
|
truncate?: boolean;
|
|
17
24
|
};
|
|
18
25
|
/** Section heading whose outline level and visual size are chosen independently. */
|
|
19
|
-
declare function Heading({ level, size, truncate, density, className, render, ...props }: HeadingProps): ReactElement;
|
|
26
|
+
declare function Heading({ level, size, tone, truncate, density, className, render, ...props }: HeadingProps): ReactElement;
|
|
20
27
|
export { Heading };
|
|
21
28
|
export type { HeadingProps, HeadingLevel, HeadingSize };
|
package/dist/index.js
CHANGED
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.193",
|
|
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
|
# Heading
|
|
2
2
|
|
|
3
|
-
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.
|
|
3
|
+
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. `tone="destructive"` colours a heading whose section needs attention, such as an unanswered required question after a failed submit; give it an accessible description too, because colour alone carries no meaning.
|
|
4
4
|
|
|
5
5
|
Story: @alexgorbatchev/shadcn/components/data-display/Heading
|
|
6
6
|
Source: src/components/stories/data-display/Heading.stories.tsx
|
|
@@ -25,6 +25,7 @@ Heading
|
|
|
25
25
|
{
|
|
26
26
|
level: { control: "select", options: [1, 2, 3, 4, 5, 6] },
|
|
27
27
|
size: { control: "select", options: ["sm", "base", "lg", "xl", "2xl", "3xl"] },
|
|
28
|
+
tone: { control: "inline-radio", options: ["default", "destructive"] },
|
|
28
29
|
}
|
|
29
30
|
```
|
|
30
31
|
|
|
@@ -80,6 +81,22 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
80
81
|
}
|
|
81
82
|
```
|
|
82
83
|
|
|
84
|
+
### DestructiveTone
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
{
|
|
88
|
+
render: () => (<>
|
|
89
|
+
<Heading level={3} tone="destructive" aria-describedby="heading-tone-error">
|
|
90
|
+
Which layout should take precedence?
|
|
91
|
+
</Heading>
|
|
92
|
+
<p id="heading-tone-error" className="text-sm text-destructive">
|
|
93
|
+
Answer this question
|
|
94
|
+
</p>
|
|
95
|
+
<Heading level={3}>Should rows keep their padding?</Heading>
|
|
96
|
+
</>)
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
83
100
|
### Truncated
|
|
84
101
|
|
|
85
102
|
```tsx
|
package/llms.txt
CHANGED
|
@@ -345,7 +345,7 @@ Generated from the public package exports and Storybook sources.
|
|
|
345
345
|
- [DescriptionList](./llms/components/data-display/DescriptionList.md)
|
|
346
346
|
- [DiagramViewer](./llms/components/data-display/DiagramViewer.md): Import from `@alexgorbatchev/shadcn/image-viewer`. `DiagramViewer` renders a live vector `<svg>` diagram inside the shared pan-and-zoom `ImageViewport` with `ImageZoomControl` (Fit, Fit width, zoom out/in up to 400%, keyboard shortcuts, drag/pinch/Mod+wheel, and `openingWidth` floor). Pair with `DiagramSurface` for inline rendering and `getMermaidThemeConfig` / `useMermaidTheme` to map active theme tokens onto Mermaid diagrams.
|
|
347
347
|
- [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.
|
|
348
|
-
- [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
|
+
- [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. `tone="destructive"` colours a heading whose section needs attention, such as an unanswered required question after a failed submit; give it an accessible description too, because colour alone carries no meaning.
|
|
349
349
|
- [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.
|
|
350
350
|
- [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.
|
|
351
351
|
- [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.
|