@alexgorbatchev/shadcn 0.0.201 → 0.0.202
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/README.md +1 -1
- package/dist/{chunk-3d6ctgyx.js → chunk-hcptnha3.js} +65 -24
- package/dist/components/json-render/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/prototype.js +1 -1
- package/dist/theme.css +4 -2
- package/llms/components/actions/Button.md +26 -0
- package/llms/components/actions/ToolbarToggleChip.md +31 -0
- package/llms/setup.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -211,7 +211,7 @@ Use `<DensityProvider density="desktop" touchOnMobile>` for 17px base text, 15px
|
|
|
211
211
|
|
|
212
212
|
`useTheme()` returns `theme`, `resolvedTheme`, `setTheme`, and `preset`. Call `setTheme("light")`, `setTheme("dark")`, or `setTheme("system")` from a component inside the provider.
|
|
213
213
|
|
|
214
|
-
Use `<ThemeProvider preset="shadcn" defaultTheme="system">` for the [default shadcn Neutral palette](https://ui.shadcn.com/docs/theming), system sans-serif text, and its rounded corner scale. The default `devhost` preset uses the package's monospace design and sharp corners. Both presets support light, dark, and system modes, including portaled content. Code retains the monospace font. Density, component composition, and package-specific status colors remain independent of the preset.
|
|
214
|
+
Use `<ThemeProvider preset="shadcn" defaultTheme="system">` for the [default shadcn Neutral palette](https://ui.shadcn.com/docs/theming), system sans-serif text, and its rounded corner scale. The default `devhost` preset uses the package's monospace design and sharp corners. Both presets support light, dark, and system modes, including portaled content. The Neutral preset follows upstream's token values with one exception: its light focus ring is `oklch(0.556 0 0)` instead of upstream's `oklch(0.708 0 0)`, because upstream's measures about 2.6:1 on white and a focus indicator needs at least 3:1 (WCAG 2.2 SC 1.4.11). Code retains the monospace font. Density, component composition, and package-specific status colors remain independent of the preset.
|
|
215
215
|
|
|
216
216
|
The preset is controlled by the prop; changing it updates the document without changing the saved color-mode preference. Persist that prop in your application if needed. Storybook exposes the same choice in its **Design** toolbar. For a page styled before React mounts, set `data-theme-preset="shadcn"` and `data-theme="light"` or `"dark"` on `<html>` to match the provider. The existing `theme.css` import and `@source` setup cover both presets.
|
|
217
217
|
|
|
@@ -3710,6 +3710,45 @@ function ToolbarToggleChip2({
|
|
|
3710
3710
|
if (!spaceActivates && event.key === " ")
|
|
3711
3711
|
event.preventDefault();
|
|
3712
3712
|
};
|
|
3713
|
+
const swatchMark = swatch && /* @__PURE__ */ jsx37("span", {
|
|
3714
|
+
"aria-hidden": "true",
|
|
3715
|
+
className: cn2("inline-block size-3 shrink-0 overflow-hidden", !hideLabel && "me-1.5 align-[calc(0.5cap-0.375rem)]"),
|
|
3716
|
+
children: /* @__PURE__ */ jsxs24("span", {
|
|
3717
|
+
"data-slot": "toolbar-toggle-chip-swatch",
|
|
3718
|
+
className: "relative block size-full rounded-sm border border-media-edge",
|
|
3719
|
+
style: { backgroundColor: swatch },
|
|
3720
|
+
children: [
|
|
3721
|
+
pressed === true && /* @__PURE__ */ jsxs24("span", {
|
|
3722
|
+
"data-slot": "toolbar-toggle-chip-check",
|
|
3723
|
+
className: "absolute -inset-px grid place-items-center",
|
|
3724
|
+
children: [
|
|
3725
|
+
/* @__PURE__ */ jsx37(CheckIcon3, {
|
|
3726
|
+
strokeWidth: 6,
|
|
3727
|
+
className: "col-start-1 row-start-1 size-3 text-background"
|
|
3728
|
+
}),
|
|
3729
|
+
/* @__PURE__ */ jsx37(CheckIcon3, {
|
|
3730
|
+
strokeWidth: 3,
|
|
3731
|
+
className: "col-start-1 row-start-1 size-3 text-foreground"
|
|
3732
|
+
})
|
|
3733
|
+
]
|
|
3734
|
+
}),
|
|
3735
|
+
pressed === "mixed" && /* @__PURE__ */ jsxs24("span", {
|
|
3736
|
+
"data-slot": "toolbar-toggle-chip-mixed",
|
|
3737
|
+
className: "absolute -inset-px grid place-items-center",
|
|
3738
|
+
children: [
|
|
3739
|
+
/* @__PURE__ */ jsx37(MinusIcon, {
|
|
3740
|
+
strokeWidth: 6,
|
|
3741
|
+
className: "col-start-1 row-start-1 size-3 text-background"
|
|
3742
|
+
}),
|
|
3743
|
+
/* @__PURE__ */ jsx37(MinusIcon, {
|
|
3744
|
+
strokeWidth: 3,
|
|
3745
|
+
className: "col-start-1 row-start-1 size-3 text-foreground"
|
|
3746
|
+
})
|
|
3747
|
+
]
|
|
3748
|
+
})
|
|
3749
|
+
]
|
|
3750
|
+
})
|
|
3751
|
+
});
|
|
3713
3752
|
const button = /* @__PURE__ */ jsxs24(ToolbarPrimitive.Button, {
|
|
3714
3753
|
"data-density": density,
|
|
3715
3754
|
"data-slot": "toolbar-toggle-chip",
|
|
@@ -3729,34 +3768,36 @@ function ToolbarToggleChip2({
|
|
|
3729
3768
|
trackedChange(pressed !== true);
|
|
3730
3769
|
},
|
|
3731
3770
|
children: [
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
className: "
|
|
3771
|
+
hideLabel && swatchMark,
|
|
3772
|
+
/* @__PURE__ */ jsxs24("span", {
|
|
3773
|
+
className: hideLabel ? "sr-only" : "min-w-0 truncate",
|
|
3735
3774
|
children: [
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3775
|
+
!hideLabel && swatchMark,
|
|
3776
|
+
!swatch && !hideLabel && /* @__PURE__ */ jsx37("span", {
|
|
3777
|
+
"aria-hidden": "true",
|
|
3778
|
+
"data-slot": "toolbar-toggle-chip-state",
|
|
3779
|
+
className: "me-1.5 inline-block size-3.5 overflow-hidden align-[calc(0.5cap-0.4375rem)]",
|
|
3780
|
+
children: /* @__PURE__ */ jsxs24("span", {
|
|
3781
|
+
className: "grid size-full place-items-center",
|
|
3782
|
+
children: [
|
|
3783
|
+
pressed === true && /* @__PURE__ */ jsx37(CheckIcon3, {
|
|
3784
|
+
"data-slot": "toolbar-toggle-chip-check",
|
|
3785
|
+
className: "size-3.5"
|
|
3786
|
+
}),
|
|
3787
|
+
pressed === "mixed" && /* @__PURE__ */ jsx37(MinusIcon, {
|
|
3788
|
+
"data-slot": "toolbar-toggle-chip-mixed",
|
|
3789
|
+
className: "size-3.5"
|
|
3790
|
+
}),
|
|
3791
|
+
pressed === false && /* @__PURE__ */ jsx37("span", {
|
|
3792
|
+
"data-slot": "toolbar-toggle-chip-indicator",
|
|
3793
|
+
className: "size-2.5 rounded-full border border-current/70"
|
|
3794
|
+
})
|
|
3795
|
+
]
|
|
3796
|
+
})
|
|
3743
3797
|
}),
|
|
3744
|
-
|
|
3745
|
-
"data-slot": "toolbar-toggle-chip-indicator",
|
|
3746
|
-
className: "size-2.5 rounded-full border border-current/70"
|
|
3747
|
-
})
|
|
3798
|
+
children
|
|
3748
3799
|
]
|
|
3749
3800
|
}),
|
|
3750
|
-
swatch && /* @__PURE__ */ jsx37("span", {
|
|
3751
|
-
"aria-hidden": "true",
|
|
3752
|
-
"data-slot": "toolbar-toggle-chip-swatch",
|
|
3753
|
-
className: "size-3 shrink-0 rounded-sm border border-border",
|
|
3754
|
-
style: { backgroundColor: swatch }
|
|
3755
|
-
}),
|
|
3756
|
-
/* @__PURE__ */ jsx37("span", {
|
|
3757
|
-
className: hideLabel ? "sr-only" : "min-w-0 truncate",
|
|
3758
|
-
children
|
|
3759
|
-
}),
|
|
3760
3801
|
detail !== undefined && /* @__PURE__ */ jsxs24("span", {
|
|
3761
3802
|
"data-slot": "toolbar-toggle-chip-detail",
|
|
3762
3803
|
className: "text-xs text-muted-foreground",
|
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.202",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
package/dist/theme.css
CHANGED
|
@@ -336,7 +336,9 @@
|
|
|
336
336
|
--destructive-foreground: oklch(1 0 0);
|
|
337
337
|
--border: oklch(0.922 0 0);
|
|
338
338
|
--input: oklch(0.922 0 0);
|
|
339
|
-
|
|
339
|
+
/* Upstream uses oklch(0.708 0 0), about 2.6:1 on white; a focus indicator needs 3:1 (WCAG 2.2 SC 1.4.11), so this
|
|
340
|
+
takes the darkest upstream neutral step that clears it, about 4.7:1 (README, design presets). */
|
|
341
|
+
--ring: oklch(0.556 0 0);
|
|
340
342
|
--chart-1: oklch(0.646 0.222 41.116);
|
|
341
343
|
--chart-2: oklch(0.6 0.118 184.704);
|
|
342
344
|
--chart-3: oklch(0.398 0.07 227.392);
|
|
@@ -349,7 +351,7 @@
|
|
|
349
351
|
--sidebar-accent: oklch(0.97 0 0);
|
|
350
352
|
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
351
353
|
--sidebar-border: oklch(0.922 0 0);
|
|
352
|
-
--sidebar-ring: oklch(0.
|
|
354
|
+
--sidebar-ring: oklch(0.556 0 0);
|
|
353
355
|
}
|
|
354
356
|
|
|
355
357
|
/* With Increase contrast (prefers-contrast: more), dividers and card and table borders take the input border colour,
|
|
@@ -560,3 +560,29 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
560
560
|
</div>)
|
|
561
561
|
}
|
|
562
562
|
```
|
|
563
|
+
|
|
564
|
+
### FocusIndicatorNeutralDark
|
|
565
|
+
|
|
566
|
+
```tsx
|
|
567
|
+
{
|
|
568
|
+
globals: { theme: "dark", density: "comfortable", preset: "shadcn" },
|
|
569
|
+
render: () => (<div className="flex flex-wrap items-center gap-4 p-panel">
|
|
570
|
+
{filledVariants.map((variant) => (<Button key={variant} variant={variant}>
|
|
571
|
+
{`Focus ${variant}`}
|
|
572
|
+
</Button>))}
|
|
573
|
+
</div>)
|
|
574
|
+
}
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### FocusIndicatorNeutralLight
|
|
578
|
+
|
|
579
|
+
```tsx
|
|
580
|
+
{
|
|
581
|
+
globals: { theme: "light", density: "comfortable", preset: "shadcn" },
|
|
582
|
+
render: () => (<div className="flex flex-wrap items-center gap-4 p-panel">
|
|
583
|
+
{filledVariants.map((variant) => (<Button key={variant} variant={variant}>
|
|
584
|
+
{`Focus ${variant}`}
|
|
585
|
+
</Button>))}
|
|
586
|
+
</div>)
|
|
587
|
+
}
|
|
588
|
+
```
|
|
@@ -141,6 +141,37 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
141
141
|
}
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
+
### SwatchStates
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
{
|
|
148
|
+
render: function Example(): ReactElement {
|
|
149
|
+
return (<Toolbar aria-label="Colors">
|
|
150
|
+
<ControlledChip label="Red" swatch="#e5484d" hideLabel/>
|
|
151
|
+
<ControlledChip label="Yellow" swatch="#ffe629" hideLabel/>
|
|
152
|
+
<ControlledChip label="Navy" swatch="#1b2a4a"/>
|
|
153
|
+
</Toolbar>);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### IndicatorOnCaps
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
{
|
|
162
|
+
render: () => alignedChips
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### IndicatorOnCapsNeutral
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
{
|
|
170
|
+
globals: { preset: "shadcn" },
|
|
171
|
+
render: () => alignedChips
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
144
175
|
### StableAcrossStates
|
|
145
176
|
|
|
146
177
|
```tsx
|
package/llms/setup.md
CHANGED
|
@@ -211,7 +211,7 @@ Use `<DensityProvider density="desktop" touchOnMobile>` for 17px base text, 15px
|
|
|
211
211
|
|
|
212
212
|
`useTheme()` returns `theme`, `resolvedTheme`, `setTheme`, and `preset`. Call `setTheme("light")`, `setTheme("dark")`, or `setTheme("system")` from a component inside the provider.
|
|
213
213
|
|
|
214
|
-
Use `<ThemeProvider preset="shadcn" defaultTheme="system">` for the [default shadcn Neutral palette](https://ui.shadcn.com/docs/theming), system sans-serif text, and its rounded corner scale. The default `devhost` preset uses the package's monospace design and sharp corners. Both presets support light, dark, and system modes, including portaled content. Code retains the monospace font. Density, component composition, and package-specific status colors remain independent of the preset.
|
|
214
|
+
Use `<ThemeProvider preset="shadcn" defaultTheme="system">` for the [default shadcn Neutral palette](https://ui.shadcn.com/docs/theming), system sans-serif text, and its rounded corner scale. The default `devhost` preset uses the package's monospace design and sharp corners. Both presets support light, dark, and system modes, including portaled content. The Neutral preset follows upstream's token values with one exception: its light focus ring is `oklch(0.556 0 0)` instead of upstream's `oklch(0.708 0 0)`, because upstream's measures about 2.6:1 on white and a focus indicator needs at least 3:1 (WCAG 2.2 SC 1.4.11). Code retains the monospace font. Density, component composition, and package-specific status colors remain independent of the preset.
|
|
215
215
|
|
|
216
216
|
The preset is controlled by the prop; changing it updates the document without changing the saved color-mode preference. Persist that prop in your application if needed. Storybook exposes the same choice in its **Design** toolbar. For a page styled before React mounts, set `data-theme-preset="shadcn"` and `data-theme="light"` or `"dark"` on `<html>` to match the provider. The existing `theme.css` import and `@source` setup cover both presets.
|
|
217
217
|
|