@agentero/design-system 0.11.0 → 0.12.0
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/mcp/manifests/components.html +176 -11
- package/mcp/manifests/components.json +1 -1
- package/package.json +6 -1
- package/src/switch/index.d.ts +2 -0
- package/src/switch/index.js +2 -0
- package/src/switch/switch.d.ts +59 -0
- package/src/switch/switch.js +42 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentero/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "A React component library built with Tailwind CSS v4 and Radix UI primitives",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -57,6 +57,10 @@
|
|
|
57
57
|
"types": "./src/pagination/index.d.ts",
|
|
58
58
|
"import": "./src/pagination/index.js"
|
|
59
59
|
},
|
|
60
|
+
"./switch": {
|
|
61
|
+
"types": "./src/switch/index.d.ts",
|
|
62
|
+
"import": "./src/switch/index.js"
|
|
63
|
+
},
|
|
60
64
|
"./tag": {
|
|
61
65
|
"types": "./src/tag/index.d.ts",
|
|
62
66
|
"import": "./src/tag/index.js"
|
|
@@ -88,6 +92,7 @@
|
|
|
88
92
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
89
93
|
"@radix-ui/react-separator": "^1.1.8",
|
|
90
94
|
"@radix-ui/react-slot": "^1.2.4",
|
|
95
|
+
"@radix-ui/react-switch": "^1.3.2",
|
|
91
96
|
"clsx": "^2.1.1",
|
|
92
97
|
"sonner": "^2.0.7",
|
|
93
98
|
"tailwind-merge": "^3.5.0",
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { VariantProps } from 'tailwind-variants';
|
|
3
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
4
|
+
export declare const switchRecipe: import('tailwind-variants').TVReturnType<{
|
|
5
|
+
size: {
|
|
6
|
+
sm: {
|
|
7
|
+
root: string;
|
|
8
|
+
thumb: string;
|
|
9
|
+
};
|
|
10
|
+
md: {
|
|
11
|
+
root: string;
|
|
12
|
+
thumb: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
}, {
|
|
16
|
+
root: string[];
|
|
17
|
+
thumb: string;
|
|
18
|
+
}, undefined, {
|
|
19
|
+
size: {
|
|
20
|
+
sm: {
|
|
21
|
+
root: string;
|
|
22
|
+
thumb: string;
|
|
23
|
+
};
|
|
24
|
+
md: {
|
|
25
|
+
root: string;
|
|
26
|
+
thumb: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}, {
|
|
30
|
+
root: string[];
|
|
31
|
+
thumb: string;
|
|
32
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
33
|
+
size: {
|
|
34
|
+
sm: {
|
|
35
|
+
root: string;
|
|
36
|
+
thumb: string;
|
|
37
|
+
};
|
|
38
|
+
md: {
|
|
39
|
+
root: string;
|
|
40
|
+
thumb: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}, {
|
|
44
|
+
root: string[];
|
|
45
|
+
thumb: string;
|
|
46
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
47
|
+
export type SwitchSize = NonNullable<VariantProps<typeof switchRecipe>['size']>;
|
|
48
|
+
export type SwitchProps = ComponentPropsWithRef<typeof SwitchPrimitive.Root> & VariantProps<typeof switchRecipe>;
|
|
49
|
+
/**
|
|
50
|
+
* Instant-effect on/off toggle built on Radix Switch. Reach for it over a
|
|
51
|
+
* Checkbox when flipping a single boolean that applies immediately. Renders
|
|
52
|
+
* only the toggle — pair it with a `<label htmlFor>` for an accessible name.
|
|
53
|
+
*
|
|
54
|
+
* @summary Instant-effect on/off toggle built on Radix Switch
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* <Switch checked={enabled} onCheckedChange={setEnabled} />
|
|
58
|
+
*/
|
|
59
|
+
export declare const Switch: ({ className, size, ref, ...props }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { tv as t } from "tailwind-variants";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import * as r from "@radix-ui/react-switch";
|
|
6
|
+
//#region src/switch/switch.tsx
|
|
7
|
+
var i = t({
|
|
8
|
+
slots: {
|
|
9
|
+
root: [
|
|
10
|
+
"inline-flex shrink-0 cursor-pointer items-center rounded-full transition-colors",
|
|
11
|
+
"bg-bg-default-base-tertiary data-[state=checked]:bg-bg-default-base-inverse-primary",
|
|
12
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring-button-primary",
|
|
13
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
14
|
+
],
|
|
15
|
+
thumb: "block translate-x-0 rounded-full bg-bg-default-base-primary shadow-sm transition-transform"
|
|
16
|
+
},
|
|
17
|
+
variants: { size: {
|
|
18
|
+
sm: {
|
|
19
|
+
root: "h-4 w-7.5 p-0.5",
|
|
20
|
+
thumb: "size-3 data-[state=checked]:translate-x-3.5"
|
|
21
|
+
},
|
|
22
|
+
md: {
|
|
23
|
+
root: "h-6 w-12 p-0.75",
|
|
24
|
+
thumb: "size-4.5 data-[state=checked]:translate-x-6"
|
|
25
|
+
}
|
|
26
|
+
} },
|
|
27
|
+
defaultVariants: { size: "md" }
|
|
28
|
+
}), a = ({ className: t, size: a, ref: o, ...s }) => {
|
|
29
|
+
let c = i({ size: a });
|
|
30
|
+
return /* @__PURE__ */ n(r.Root, {
|
|
31
|
+
ref: o,
|
|
32
|
+
"data-slot": "switch",
|
|
33
|
+
className: e(c.root(), t),
|
|
34
|
+
...s,
|
|
35
|
+
children: /* @__PURE__ */ n(r.Thumb, {
|
|
36
|
+
"data-slot": "switch-thumb",
|
|
37
|
+
className: c.thumb()
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { a as Switch, i as switchRecipe };
|