@nucleux/switch 0.1.1
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/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/index.cjs +82 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nucleux
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @nucleux/switch
|
|
2
|
+
|
|
3
|
+
Accessible on/off toggle — Nucleux agentic UI for React.
|
|
4
|
+
|
|
5
|
+
Part of **[Nucleux](https://github.com/intelligaia-open-labs/nucleux)** — agentic UI components for React. Install a single component, or the full kit via [`@nucleux/react`](https://www.npmjs.com/package/@nucleux/react).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @nucleux/switch @nucleux/tokens
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`react` / `react-dom` are peer dependencies.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Switch } from "@nucleux/switch";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Requires the theme once in your app: `import "@nucleux/tokens/styles.css";`
|
|
22
|
+
and the Tailwind preset from `@nucleux/tokens/preset`.
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
MIT © Nucleux
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('@nucleux/utils');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
28
|
+
// src/index.tsx
|
|
29
|
+
var track = {
|
|
30
|
+
sm: "h-4 w-7",
|
|
31
|
+
md: "h-5 w-9"
|
|
32
|
+
};
|
|
33
|
+
var thumb = {
|
|
34
|
+
sm: "size-3 data-[state=checked]:translate-x-[14px] data-[state=unchecked]:translate-x-0.5",
|
|
35
|
+
md: "size-4 data-[state=checked]:translate-x-[18px] data-[state=unchecked]:translate-x-0.5"
|
|
36
|
+
};
|
|
37
|
+
var Switch = React__namespace.forwardRef(
|
|
38
|
+
({ checked, defaultChecked = false, onCheckedChange, size = "md", disabled, className, ...props }, ref) => {
|
|
39
|
+
const [internal, setInternal] = React__namespace.useState(defaultChecked);
|
|
40
|
+
const isControlled = checked != null;
|
|
41
|
+
const value = isControlled ? checked : internal;
|
|
42
|
+
const toggle = () => {
|
|
43
|
+
if (disabled) return;
|
|
44
|
+
if (!isControlled) setInternal(!value);
|
|
45
|
+
onCheckedChange?.(!value);
|
|
46
|
+
};
|
|
47
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
+
"button",
|
|
49
|
+
{
|
|
50
|
+
ref,
|
|
51
|
+
type: "button",
|
|
52
|
+
role: "switch",
|
|
53
|
+
"aria-checked": value,
|
|
54
|
+
disabled,
|
|
55
|
+
"data-state": value ? "checked" : "unchecked",
|
|
56
|
+
onClick: toggle,
|
|
57
|
+
className: utils.cn(
|
|
58
|
+
"inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",
|
|
59
|
+
value ? "bg-primary" : "bg-input",
|
|
60
|
+
track[size],
|
|
61
|
+
className
|
|
62
|
+
),
|
|
63
|
+
...props,
|
|
64
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
+
"span",
|
|
66
|
+
{
|
|
67
|
+
"data-state": value ? "checked" : "unchecked",
|
|
68
|
+
className: utils.cn(
|
|
69
|
+
"pointer-events-none inline-block rounded-full bg-background shadow-sm ring-0 transition-transform",
|
|
70
|
+
thumb[size]
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
Switch.displayName = "Switch";
|
|
79
|
+
|
|
80
|
+
exports.Switch = Switch;
|
|
81
|
+
//# sourceMappingURL=index.cjs.map
|
|
82
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"names":["React","jsx","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,IAAM,KAAA,GAAoC;AAAA,EACxC,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AACA,IAAM,KAAA,GAAoC;AAAA,EACxC,EAAA,EAAI,uFAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAGO,IAAM,MAAA,GAAeA,gBAAA,CAAA,UAAA;AAAA,EAC1B,CACE,EAAE,OAAA,EAAS,cAAA,GAAiB,KAAA,EAAO,eAAA,EAAiB,IAAA,GAAO,IAAA,EAAM,QAAA,EAAU,SAAA,EAAW,GAAG,KAAA,IACzF,GAAA,KACG;AACH,IAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAUA,0BAAS,cAAc,CAAA;AAC7D,IAAA,MAAM,eAAe,OAAA,IAAW,IAAA;AAChC,IAAA,MAAM,KAAA,GAAQ,eAAe,OAAA,GAAU,QAAA;AAEvC,IAAA,MAAM,SAAS,MAAM;AACnB,MAAA,IAAI,QAAA,EAAU;AACd,MAAA,IAAI,CAAC,YAAA,EAAc,WAAA,CAAY,CAAC,KAAK,CAAA;AACrC,MAAA,eAAA,GAAkB,CAAC,KAAK,CAAA;AAAA,IAC1B,CAAA;AAEA,IAAA,uBACEC,cAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,IAAA,EAAK,QAAA;AAAA,QACL,IAAA,EAAK,QAAA;AAAA,QACL,cAAA,EAAc,KAAA;AAAA,QACd,QAAA;AAAA,QACA,YAAA,EAAY,QAAQ,SAAA,GAAY,WAAA;AAAA,QAChC,OAAA,EAAS,MAAA;AAAA,QACT,SAAA,EAAWC,QAAA;AAAA,UACT,sSAAA;AAAA,UACA,QAAQ,YAAA,GAAe,UAAA;AAAA,UACvB,MAAM,IAAI,CAAA;AAAA,UACV;AAAA,SACF;AAAA,QACC,GAAG,KAAA;AAAA,QAEJ,QAAA,kBAAAD,cAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,YAAA,EAAY,QAAQ,SAAA,GAAY,WAAA;AAAA,YAChC,SAAA,EAAWC,QAAA;AAAA,cACT,mGAAA;AAAA,cACA,MAAM,IAAI;AAAA;AACZ;AAAA;AACF;AAAA,KACF;AAAA,EAEJ;AACF;AACA,MAAA,CAAO,WAAA,GAAc,QAAA","file":"index.cjs","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\n\nexport type SwitchSize = \"sm\" | \"md\";\n\nexport interface SwitchProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"onChange\" | \"value\"> {\n /** Controlled on/off state. */\n checked?: boolean;\n /** Initial state when uncontrolled. */\n defaultChecked?: boolean;\n /** Called with the next state when toggled. */\n onCheckedChange?: (checked: boolean) => void;\n size?: SwitchSize;\n}\n\nconst track: Record<SwitchSize, string> = {\n sm: \"h-4 w-7\",\n md: \"h-5 w-9\",\n};\nconst thumb: Record<SwitchSize, string> = {\n sm: \"size-3 data-[state=checked]:translate-x-[14px] data-[state=unchecked]:translate-x-0.5\",\n md: \"size-4 data-[state=checked]:translate-x-[18px] data-[state=unchecked]:translate-x-0.5\",\n};\n\n/** Accessible on/off toggle. Controlled via `checked`, or uncontrolled via `defaultChecked`. */\nexport const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>(\n (\n { checked, defaultChecked = false, onCheckedChange, size = \"md\", disabled, className, ...props },\n ref,\n ) => {\n const [internal, setInternal] = React.useState(defaultChecked);\n const isControlled = checked != null;\n const value = isControlled ? checked : internal;\n\n const toggle = () => {\n if (disabled) return;\n if (!isControlled) setInternal(!value);\n onCheckedChange?.(!value);\n };\n\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"switch\"\n aria-checked={value}\n disabled={disabled}\n data-state={value ? \"checked\" : \"unchecked\"}\n onClick={toggle}\n className={cn(\n \"inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50\",\n value ? \"bg-primary\" : \"bg-input\",\n track[size],\n className,\n )}\n {...props}\n >\n <span\n data-state={value ? \"checked\" : \"unchecked\"}\n className={cn(\n \"pointer-events-none inline-block rounded-full bg-background shadow-sm ring-0 transition-transform\",\n thumb[size],\n )}\n />\n </button>\n );\n },\n);\nSwitch.displayName = \"Switch\";\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type SwitchSize = "sm" | "md";
|
|
4
|
+
interface SwitchProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "value"> {
|
|
5
|
+
/** Controlled on/off state. */
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
/** Initial state when uncontrolled. */
|
|
8
|
+
defaultChecked?: boolean;
|
|
9
|
+
/** Called with the next state when toggled. */
|
|
10
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
11
|
+
size?: SwitchSize;
|
|
12
|
+
}
|
|
13
|
+
/** Accessible on/off toggle. Controlled via `checked`, or uncontrolled via `defaultChecked`. */
|
|
14
|
+
declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
|
|
16
|
+
export { Switch, type SwitchProps, type SwitchSize };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type SwitchSize = "sm" | "md";
|
|
4
|
+
interface SwitchProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "value"> {
|
|
5
|
+
/** Controlled on/off state. */
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
/** Initial state when uncontrolled. */
|
|
8
|
+
defaultChecked?: boolean;
|
|
9
|
+
/** Called with the next state when toggled. */
|
|
10
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
11
|
+
size?: SwitchSize;
|
|
12
|
+
}
|
|
13
|
+
/** Accessible on/off toggle. Controlled via `checked`, or uncontrolled via `defaultChecked`. */
|
|
14
|
+
declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
|
|
16
|
+
export { Switch, type SwitchProps, type SwitchSize };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '@nucleux/utils';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/index.tsx
|
|
7
|
+
var track = {
|
|
8
|
+
sm: "h-4 w-7",
|
|
9
|
+
md: "h-5 w-9"
|
|
10
|
+
};
|
|
11
|
+
var thumb = {
|
|
12
|
+
sm: "size-3 data-[state=checked]:translate-x-[14px] data-[state=unchecked]:translate-x-0.5",
|
|
13
|
+
md: "size-4 data-[state=checked]:translate-x-[18px] data-[state=unchecked]:translate-x-0.5"
|
|
14
|
+
};
|
|
15
|
+
var Switch = React.forwardRef(
|
|
16
|
+
({ checked, defaultChecked = false, onCheckedChange, size = "md", disabled, className, ...props }, ref) => {
|
|
17
|
+
const [internal, setInternal] = React.useState(defaultChecked);
|
|
18
|
+
const isControlled = checked != null;
|
|
19
|
+
const value = isControlled ? checked : internal;
|
|
20
|
+
const toggle = () => {
|
|
21
|
+
if (disabled) return;
|
|
22
|
+
if (!isControlled) setInternal(!value);
|
|
23
|
+
onCheckedChange?.(!value);
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
"button",
|
|
27
|
+
{
|
|
28
|
+
ref,
|
|
29
|
+
type: "button",
|
|
30
|
+
role: "switch",
|
|
31
|
+
"aria-checked": value,
|
|
32
|
+
disabled,
|
|
33
|
+
"data-state": value ? "checked" : "unchecked",
|
|
34
|
+
onClick: toggle,
|
|
35
|
+
className: cn(
|
|
36
|
+
"inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",
|
|
37
|
+
value ? "bg-primary" : "bg-input",
|
|
38
|
+
track[size],
|
|
39
|
+
className
|
|
40
|
+
),
|
|
41
|
+
...props,
|
|
42
|
+
children: /* @__PURE__ */ jsx(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
"data-state": value ? "checked" : "unchecked",
|
|
46
|
+
className: cn(
|
|
47
|
+
"pointer-events-none inline-block rounded-full bg-background shadow-sm ring-0 transition-transform",
|
|
48
|
+
thumb[size]
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
Switch.displayName = "Switch";
|
|
57
|
+
|
|
58
|
+
export { Switch };
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"names":[],"mappings":";;;;;AAgBA,IAAM,KAAA,GAAoC;AAAA,EACxC,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AACA,IAAM,KAAA,GAAoC;AAAA,EACxC,EAAA,EAAI,uFAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAGO,IAAM,MAAA,GAAe,KAAA,CAAA,UAAA;AAAA,EAC1B,CACE,EAAE,OAAA,EAAS,cAAA,GAAiB,KAAA,EAAO,eAAA,EAAiB,IAAA,GAAO,IAAA,EAAM,QAAA,EAAU,SAAA,EAAW,GAAG,KAAA,IACzF,GAAA,KACG;AACH,IAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAU,eAAS,cAAc,CAAA;AAC7D,IAAA,MAAM,eAAe,OAAA,IAAW,IAAA;AAChC,IAAA,MAAM,KAAA,GAAQ,eAAe,OAAA,GAAU,QAAA;AAEvC,IAAA,MAAM,SAAS,MAAM;AACnB,MAAA,IAAI,QAAA,EAAU;AACd,MAAA,IAAI,CAAC,YAAA,EAAc,WAAA,CAAY,CAAC,KAAK,CAAA;AACrC,MAAA,eAAA,GAAkB,CAAC,KAAK,CAAA;AAAA,IAC1B,CAAA;AAEA,IAAA,uBACE,GAAA;AAAA,MAAC,QAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,IAAA,EAAK,QAAA;AAAA,QACL,IAAA,EAAK,QAAA;AAAA,QACL,cAAA,EAAc,KAAA;AAAA,QACd,QAAA;AAAA,QACA,YAAA,EAAY,QAAQ,SAAA,GAAY,WAAA;AAAA,QAChC,OAAA,EAAS,MAAA;AAAA,QACT,SAAA,EAAW,EAAA;AAAA,UACT,sSAAA;AAAA,UACA,QAAQ,YAAA,GAAe,UAAA;AAAA,UACvB,MAAM,IAAI,CAAA;AAAA,UACV;AAAA,SACF;AAAA,QACC,GAAG,KAAA;AAAA,QAEJ,QAAA,kBAAA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,YAAA,EAAY,QAAQ,SAAA,GAAY,WAAA;AAAA,YAChC,SAAA,EAAW,EAAA;AAAA,cACT,mGAAA;AAAA,cACA,MAAM,IAAI;AAAA;AACZ;AAAA;AACF;AAAA,KACF;AAAA,EAEJ;AACF;AACA,MAAA,CAAO,WAAA,GAAc,QAAA","file":"index.js","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\n\nexport type SwitchSize = \"sm\" | \"md\";\n\nexport interface SwitchProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"onChange\" | \"value\"> {\n /** Controlled on/off state. */\n checked?: boolean;\n /** Initial state when uncontrolled. */\n defaultChecked?: boolean;\n /** Called with the next state when toggled. */\n onCheckedChange?: (checked: boolean) => void;\n size?: SwitchSize;\n}\n\nconst track: Record<SwitchSize, string> = {\n sm: \"h-4 w-7\",\n md: \"h-5 w-9\",\n};\nconst thumb: Record<SwitchSize, string> = {\n sm: \"size-3 data-[state=checked]:translate-x-[14px] data-[state=unchecked]:translate-x-0.5\",\n md: \"size-4 data-[state=checked]:translate-x-[18px] data-[state=unchecked]:translate-x-0.5\",\n};\n\n/** Accessible on/off toggle. Controlled via `checked`, or uncontrolled via `defaultChecked`. */\nexport const Switch = React.forwardRef<HTMLButtonElement, SwitchProps>(\n (\n { checked, defaultChecked = false, onCheckedChange, size = \"md\", disabled, className, ...props },\n ref,\n ) => {\n const [internal, setInternal] = React.useState(defaultChecked);\n const isControlled = checked != null;\n const value = isControlled ? checked : internal;\n\n const toggle = () => {\n if (disabled) return;\n if (!isControlled) setInternal(!value);\n onCheckedChange?.(!value);\n };\n\n return (\n <button\n ref={ref}\n type=\"button\"\n role=\"switch\"\n aria-checked={value}\n disabled={disabled}\n data-state={value ? \"checked\" : \"unchecked\"}\n onClick={toggle}\n className={cn(\n \"inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50\",\n value ? \"bg-primary\" : \"bg-input\",\n track[size],\n className,\n )}\n {...props}\n >\n <span\n data-state={value ? \"checked\" : \"unchecked\"}\n className={cn(\n \"pointer-events-none inline-block rounded-full bg-background shadow-sm ring-0 transition-transform\",\n thumb[size],\n )}\n />\n </button>\n );\n },\n);\nSwitch.displayName = \"Switch\";\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nucleux/switch",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"react": ">=18",
|
|
22
|
+
"react-dom": ">=18"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@nucleux/utils": "0.1.1"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"tsup": "^8.3.5",
|
|
29
|
+
"typescript": "^5.7.2",
|
|
30
|
+
"@types/react": "^18.3.18",
|
|
31
|
+
"react": "^18.3.1",
|
|
32
|
+
"lucide-react": "^0.469.0"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/intelligaia-open-labs/nucleux.git",
|
|
41
|
+
"directory": "packages/switch"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/intelligaia-open-labs/nucleux#readme",
|
|
44
|
+
"description": "Accessible on/off toggle — Nucleux agentic UI for React.",
|
|
45
|
+
"keywords": [
|
|
46
|
+
"nucleux",
|
|
47
|
+
"react",
|
|
48
|
+
"ui",
|
|
49
|
+
"components",
|
|
50
|
+
"agentic",
|
|
51
|
+
"ai",
|
|
52
|
+
"tailwind",
|
|
53
|
+
"switch"
|
|
54
|
+
],
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsup"
|
|
57
|
+
}
|
|
58
|
+
}
|