@stackshift-ui/switch 1.0.0-beta.1 → 1.0.0-beta.4

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.
@@ -0,0 +1,34 @@
1
+ // src/switch.tsx
2
+ import * as SwitchPrimitive from "@radix-ui/react-switch";
3
+ import { cn, DefaultComponent, useStackShiftUIComponents } from "@stackshift-ui/system";
4
+ import { jsx } from "react/jsx-runtime";
5
+ var displayName = "Switch";
6
+ function Switch({ className, ...props }) {
7
+ const { [displayName]: Component = DefaultComponent } = useStackShiftUIComponents();
8
+ return /* @__PURE__ */ jsx(
9
+ Component,
10
+ {
11
+ as: SwitchPrimitive.Root,
12
+ "data-slot": "switch",
13
+ className: cn(
14
+ "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
15
+ className
16
+ ),
17
+ ...props,
18
+ children: /* @__PURE__ */ jsx(
19
+ SwitchPrimitive.Thumb,
20
+ {
21
+ "data-slot": "switch-thumb",
22
+ className: cn(
23
+ "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
24
+ )
25
+ }
26
+ )
27
+ }
28
+ );
29
+ }
30
+ Switch.displayName = displayName;
31
+
32
+ export {
33
+ Switch
34
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stackshift-ui/switch",
3
3
  "description": "A control that allows the user to toggle between checked and not checked.",
4
- "version": "1.0.0-beta.1",
4
+ "version": "1.0.0-beta.4",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
@@ -29,17 +29,17 @@
29
29
  "typescript": "^5.6.2",
30
30
  "vite-tsconfig-paths": "^5.0.1",
31
31
  "vitest": "^2.1.1",
32
- "@stackshift-ui/eslint-config": "6.0.10",
33
- "@stackshift-ui/typescript-config": "6.0.10"
32
+ "@stackshift-ui/typescript-config": "6.0.10",
33
+ "@stackshift-ui/eslint-config": "6.0.10"
34
34
  },
35
35
  "dependencies": {
36
36
  "@radix-ui/react-switch": "^1.2.5",
37
37
  "classnames": "^2.5.1",
38
- "@stackshift-ui/scripts": "6.1.0-beta.0",
39
- "@stackshift-ui/system": "6.1.0-beta.0"
38
+ "@stackshift-ui/scripts": "6.1.0-beta.2",
39
+ "@stackshift-ui/system": "6.1.0-beta.3"
40
40
  },
41
41
  "peerDependencies": {
42
- "@stackshift-ui/system": ">=6.1.0-beta.0",
42
+ "@stackshift-ui/system": ">=6.1.0-beta.3",
43
43
  "@types/react": "16.8 - 19",
44
44
  "next": "10 - 14",
45
45
  "react": "16.8 - 19",