@vertz/theme-shadcn 0.2.1 → 0.2.5
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/index.d.ts +4 -8
- package/dist/index.js +50 -24
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GlobalCSSOutput, Theme, VariantFunction as VariantFunction5 } from "@vertz/ui";
|
|
2
|
-
import { CheckboxElements, CheckboxOptions, CheckboxState, ProgressElements, ProgressOptions, ProgressState, RadioOptions as RadioOptions2, SliderElements, SliderOptions, SliderState,
|
|
2
|
+
import { CheckboxElements, CheckboxOptions, CheckboxState, ProgressElements, ProgressOptions, ProgressState, RadioOptions as RadioOptions2, SliderElements, SliderOptions, SliderState, ToastOptions as ToastOptions2 } from "@vertz/ui-primitives";
|
|
3
3
|
import { ChildValue } from "@vertz/ui";
|
|
4
4
|
interface AlertProps {
|
|
5
5
|
variant?: "default" | "destructive";
|
|
@@ -472,13 +472,11 @@ type ThemedToastResult = ToastElements & {
|
|
|
472
472
|
announce: (content: string) => ToastMessage;
|
|
473
473
|
dismiss: (id: string) => void;
|
|
474
474
|
};
|
|
475
|
-
import {
|
|
475
|
+
import { ToggleOptions } from "@vertz/ui-primitives";
|
|
476
476
|
interface ToggleStyleClasses {
|
|
477
477
|
readonly root: string;
|
|
478
478
|
}
|
|
479
|
-
declare function createThemedToggle(styles: ToggleStyleClasses): (options?: ToggleOptions) =>
|
|
480
|
-
state: ToggleState;
|
|
481
|
-
};
|
|
479
|
+
declare function createThemedToggle(styles: ToggleStyleClasses): (options?: ToggleOptions) => HTMLElement;
|
|
482
480
|
import { ToggleGroupElements, ToggleGroupOptions, ToggleGroupState } from "@vertz/ui-primitives";
|
|
483
481
|
interface ToggleGroupStyleClasses {
|
|
484
482
|
readonly root: string;
|
|
@@ -976,9 +974,7 @@ interface ThemedPrimitives {
|
|
|
976
974
|
state: CheckboxState;
|
|
977
975
|
};
|
|
978
976
|
/** Themed Switch — wraps @vertz/ui-primitives Switch with shadcn styles. */
|
|
979
|
-
switch: (options?: ThemedSwitchOptions) =>
|
|
980
|
-
state: SwitchState2;
|
|
981
|
-
};
|
|
977
|
+
switch: (options?: ThemedSwitchOptions) => HTMLElement;
|
|
982
978
|
/** Themed Popover — composable JSX component with Popover.Trigger, Popover.Content. */
|
|
983
979
|
Popover: ThemedPopoverComponent;
|
|
984
980
|
/** Themed Progress — wraps @vertz/ui-primitives Progress with shadcn styles. */
|
package/dist/index.js
CHANGED
|
@@ -1718,23 +1718,23 @@ import { Switch } from "@vertz/ui-primitives";
|
|
|
1718
1718
|
function createThemedSwitch(styles) {
|
|
1719
1719
|
return function themedSwitch(options) {
|
|
1720
1720
|
const { size, ...primitiveOptions } = options ?? {};
|
|
1721
|
-
const
|
|
1722
|
-
|
|
1721
|
+
const root = Switch.Root(primitiveOptions);
|
|
1722
|
+
root.classList.add(size === "sm" ? styles.rootSm : styles.root);
|
|
1723
1723
|
const thumb = document.createElement("span");
|
|
1724
1724
|
thumb.classList.add(size === "sm" ? styles.thumbSm : styles.thumb);
|
|
1725
|
-
const initialState =
|
|
1725
|
+
const initialState = root.getAttribute("data-state") ?? "unchecked";
|
|
1726
1726
|
thumb.setAttribute("data-state", initialState);
|
|
1727
1727
|
const observer = new MutationObserver((mutations) => {
|
|
1728
1728
|
for (const mutation of mutations) {
|
|
1729
1729
|
if (mutation.attributeName === "data-state") {
|
|
1730
|
-
const newState =
|
|
1730
|
+
const newState = root.getAttribute("data-state") ?? "unchecked";
|
|
1731
1731
|
thumb.setAttribute("data-state", newState);
|
|
1732
1732
|
}
|
|
1733
1733
|
}
|
|
1734
1734
|
});
|
|
1735
|
-
observer.observe(
|
|
1736
|
-
|
|
1737
|
-
return
|
|
1735
|
+
observer.observe(root, { attributes: true, attributeFilter: ["data-state"] });
|
|
1736
|
+
root.appendChild(thumb);
|
|
1737
|
+
return root;
|
|
1738
1738
|
};
|
|
1739
1739
|
}
|
|
1740
1740
|
|
|
@@ -1852,9 +1852,9 @@ function createThemedToast(styles) {
|
|
|
1852
1852
|
import { Toggle } from "@vertz/ui-primitives";
|
|
1853
1853
|
function createThemedToggle(styles) {
|
|
1854
1854
|
return function themedToggle(options) {
|
|
1855
|
-
const
|
|
1856
|
-
|
|
1857
|
-
return
|
|
1855
|
+
const root = Toggle.Root(options);
|
|
1856
|
+
root.classList.add(styles.root);
|
|
1857
|
+
return root;
|
|
1858
1858
|
};
|
|
1859
1859
|
}
|
|
1860
1860
|
|
|
@@ -4238,12 +4238,8 @@ function createSwitchStyles() {
|
|
|
4238
4238
|
"cursor:pointer",
|
|
4239
4239
|
"bg:input",
|
|
4240
4240
|
"transition:colors",
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
{ property: "height", value: "18.4px" },
|
|
4244
|
-
{ property: "width", value: "32px" }
|
|
4245
|
-
]
|
|
4246
|
-
},
|
|
4241
|
+
"h:5",
|
|
4242
|
+
"w:8",
|
|
4247
4243
|
{ [DARK]: [bgOpacity("input", 80)] },
|
|
4248
4244
|
focusRing13,
|
|
4249
4245
|
{ "&:disabled": ["pointer-events-none", "opacity:0.5"] },
|
|
@@ -4258,13 +4254,30 @@ function createSwitchStyles() {
|
|
|
4258
4254
|
"w:4",
|
|
4259
4255
|
"rounded:full",
|
|
4260
4256
|
"bg:background",
|
|
4261
|
-
|
|
4257
|
+
{
|
|
4258
|
+
"&": [
|
|
4259
|
+
{
|
|
4260
|
+
property: "transition",
|
|
4261
|
+
value: "transform 150ms cubic-bezier(0.4, 0, 0.2, 1), width 150ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
4262
|
+
}
|
|
4263
|
+
]
|
|
4264
|
+
},
|
|
4262
4265
|
{
|
|
4263
4266
|
'&[data-state="unchecked"]': [{ property: "transform", value: "translateX(0)" }],
|
|
4264
4267
|
'&[data-state="checked"]': [
|
|
4265
4268
|
{ property: "transform", value: "translateX(calc(100% - 2px))" }
|
|
4266
4269
|
]
|
|
4267
4270
|
},
|
|
4271
|
+
{
|
|
4272
|
+
'button:active > &[data-state="unchecked"]': [
|
|
4273
|
+
"w:5",
|
|
4274
|
+
{ property: "transform", value: "translateX(0)" }
|
|
4275
|
+
],
|
|
4276
|
+
'button:active > &[data-state="checked"]': [
|
|
4277
|
+
"w:5",
|
|
4278
|
+
{ property: "transform", value: "translateX(0.625rem)" }
|
|
4279
|
+
]
|
|
4280
|
+
},
|
|
4268
4281
|
{
|
|
4269
4282
|
[`${DARK}[data-state="unchecked"]`]: [
|
|
4270
4283
|
{ property: "background-color", value: "var(--color-foreground)" }
|
|
@@ -4286,12 +4299,8 @@ function createSwitchStyles() {
|
|
|
4286
4299
|
"cursor:pointer",
|
|
4287
4300
|
"bg:input",
|
|
4288
4301
|
"transition:colors",
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
{ property: "height", value: "14px" },
|
|
4292
|
-
{ property: "width", value: "24px" }
|
|
4293
|
-
]
|
|
4294
|
-
},
|
|
4302
|
+
"h:3.5",
|
|
4303
|
+
"w:6",
|
|
4295
4304
|
{ [DARK]: [bgOpacity("input", 80)] },
|
|
4296
4305
|
focusRing13,
|
|
4297
4306
|
{ "&:disabled": ["pointer-events-none", "opacity:0.5"] },
|
|
@@ -4306,13 +4315,30 @@ function createSwitchStyles() {
|
|
|
4306
4315
|
"w:3",
|
|
4307
4316
|
"rounded:full",
|
|
4308
4317
|
"bg:background",
|
|
4309
|
-
|
|
4318
|
+
{
|
|
4319
|
+
"&": [
|
|
4320
|
+
{
|
|
4321
|
+
property: "transition",
|
|
4322
|
+
value: "transform 150ms cubic-bezier(0.4, 0, 0.2, 1), width 150ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
4323
|
+
}
|
|
4324
|
+
]
|
|
4325
|
+
},
|
|
4310
4326
|
{
|
|
4311
4327
|
'&[data-state="unchecked"]': [{ property: "transform", value: "translateX(0)" }],
|
|
4312
4328
|
'&[data-state="checked"]': [
|
|
4313
4329
|
{ property: "transform", value: "translateX(calc(100% - 2px))" }
|
|
4314
4330
|
]
|
|
4315
4331
|
},
|
|
4332
|
+
{
|
|
4333
|
+
'button:active > &[data-state="unchecked"]': [
|
|
4334
|
+
"w:3.5",
|
|
4335
|
+
{ property: "transform", value: "translateX(0)" }
|
|
4336
|
+
],
|
|
4337
|
+
'button:active > &[data-state="checked"]': [
|
|
4338
|
+
"w:3.5",
|
|
4339
|
+
{ property: "transform", value: "translateX(0.5rem)" }
|
|
4340
|
+
]
|
|
4341
|
+
},
|
|
4316
4342
|
{
|
|
4317
4343
|
[`${DARK}[data-state="unchecked"]`]: [
|
|
4318
4344
|
{ property: "background-color", value: "var(--color-foreground)" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertz/theme-shadcn",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Shadcn-inspired theme for Vertz — pre-built style definitions using variants() and css()",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"typecheck": "tsc --noEmit"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@vertz/ui": "0.2.
|
|
39
|
-
"@vertz/ui-primitives": "0.2.
|
|
38
|
+
"@vertz/ui": "^0.2.2",
|
|
39
|
+
"@vertz/ui-primitives": "^0.2.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@happy-dom/global-registrator": "^20.7.0",
|
|
43
|
-
"bunup": "
|
|
43
|
+
"bunup": "^0.16.31",
|
|
44
44
|
"happy-dom": "^20.7.0",
|
|
45
45
|
"typescript": "^5.7.0"
|
|
46
46
|
},
|