@rynx-ai/ui 0.1.9 → 0.1.10-beta.2
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/components/switch.d.ts +6 -0
- package/dist/components/switch.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +7 -1
- package/src/components/switch.tsx +31 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface SwitchProps extends React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> {
|
|
4
|
+
size?: "sm" | "default";
|
|
5
|
+
}
|
|
6
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
export const Switch = React.forwardRef(({ className, size = "default", ...props }, ref) => (_jsx(SwitchPrimitive.Root, { ref: ref, "data-slot": "switch", "data-size": size, className: cn("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent outline-none transition-all after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-[state=unchecked]:bg-input/80", className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: "pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0 group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground" }) })));
|
|
6
|
+
Switch.displayName = SwitchPrimitive.Root.displayName;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./components/interaction-question.js";
|
|
|
7
7
|
export * from "./components/native-select.js";
|
|
8
8
|
export * from "./components/scroll-area.js";
|
|
9
9
|
export * from "./components/select.js";
|
|
10
|
+
export * from "./components/switch.js";
|
|
10
11
|
export * from "./components/tabs.js";
|
|
11
12
|
export * from "./components/textarea.js";
|
|
12
13
|
export * from "./lib/utils.js";
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./components/interaction-question.js";
|
|
|
7
7
|
export * from "./components/native-select.js";
|
|
8
8
|
export * from "./components/scroll-area.js";
|
|
9
9
|
export * from "./components/select.js";
|
|
10
|
+
export * from "./components/switch.js";
|
|
10
11
|
export * from "./components/tabs.js";
|
|
11
12
|
export * from "./components/textarea.js";
|
|
12
13
|
export * from "./lib/utils.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rynx-ai/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10-beta.2",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/rynx-ai/rynx.git",
|
|
7
|
+
"directory": "packages/ui"
|
|
8
|
+
},
|
|
4
9
|
"description": "Shared Rynx web design tokens and shadcn/Radix UI primitives.",
|
|
5
10
|
"license": "MIT",
|
|
6
11
|
"type": "module",
|
|
@@ -46,6 +51,7 @@
|
|
|
46
51
|
"@radix-ui/react-scroll-area": "^1.2.15",
|
|
47
52
|
"@radix-ui/react-select": "^2.1.6",
|
|
48
53
|
"@radix-ui/react-slot": "^1.1.2",
|
|
54
|
+
"@radix-ui/react-switch": "1.3.5",
|
|
49
55
|
"@radix-ui/react-tabs": "^1.1.3",
|
|
50
56
|
"class-variance-authority": "^0.7.1",
|
|
51
57
|
"clsx": "^2.1.1",
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
|
+
|
|
6
|
+
export interface SwitchProps
|
|
7
|
+
extends React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root> {
|
|
8
|
+
size?: "sm" | "default";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Switch = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof SwitchPrimitive.Root>,
|
|
13
|
+
SwitchProps
|
|
14
|
+
>(({ className, size = "default", ...props }, ref) => (
|
|
15
|
+
<SwitchPrimitive.Root
|
|
16
|
+
ref={ref}
|
|
17
|
+
data-slot="switch"
|
|
18
|
+
data-size={size}
|
|
19
|
+
className={cn(
|
|
20
|
+
"peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent outline-none transition-all after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-[state=unchecked]:bg-input/80",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
>
|
|
25
|
+
<SwitchPrimitive.Thumb
|
|
26
|
+
data-slot="switch-thumb"
|
|
27
|
+
className="pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0 group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground"
|
|
28
|
+
/>
|
|
29
|
+
</SwitchPrimitive.Root>
|
|
30
|
+
));
|
|
31
|
+
Switch.displayName = SwitchPrimitive.Root.displayName;
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./components/interaction-question.js";
|
|
|
7
7
|
export * from "./components/native-select.js";
|
|
8
8
|
export * from "./components/scroll-area.js";
|
|
9
9
|
export * from "./components/select.js";
|
|
10
|
+
export * from "./components/switch.js";
|
|
10
11
|
export * from "./components/tabs.js";
|
|
11
12
|
export * from "./components/textarea.js";
|
|
12
13
|
export * from "./lib/utils.js";
|