diff --git a/packages/shadcn-vue/package.json b/packages/shadcn-vue/package.json
index 1f175730..05c826e9 100644
--- a/packages/shadcn-vue/package.json
+++ b/packages/shadcn-vue/package.json
@@ -23,6 +23,7 @@
"@headlessui-float/vue": "^0.11.2",
"@headlessui/vue": "^1.7.14",
"@morev/vue-transitions": "^2.3.6",
+ "@vueuse/core": "^10.2.1",
"class-variance-authority": "^0.6.1",
"radix-vue": "^0.1.6",
"vue": "^3.2.47"
diff --git a/packages/shadcn-vue/src/App.vue b/packages/shadcn-vue/src/App.vue
index c901b9cf..e24a3e73 100644
--- a/packages/shadcn-vue/src/App.vue
+++ b/packages/shadcn-vue/src/App.vue
@@ -46,6 +46,7 @@ import { Separator } from "./components/ui/Separator";
import { Tooltip, TooltipTrigger } from "./components/ui/Tooltip";
import { RadioGroup, RadioGroupItem } from "./components/ui/RadioGroup";
import AccordionDemo2 from "./components/uiv2/AccordionDemo.vue"
+import SwitchDemo2 from "./components/uiv2/SwitchDemo.vue"
const alertDialogIsOpen = ref(false);
const dialogIsOpen = ref(false);
@@ -167,6 +168,9 @@ const components = [
+
+
+
diff --git a/packages/shadcn-vue/src/components/uiv2/Switch.vue b/packages/shadcn-vue/src/components/uiv2/Switch.vue
new file mode 100644
index 00000000..8ed66fb8
--- /dev/null
+++ b/packages/shadcn-vue/src/components/uiv2/Switch.vue
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
diff --git a/packages/shadcn-vue/src/components/uiv2/SwitchDemo.vue b/packages/shadcn-vue/src/components/uiv2/SwitchDemo.vue
new file mode 100644
index 00000000..a9e22b16
--- /dev/null
+++ b/packages/shadcn-vue/src/components/uiv2/SwitchDemo.vue
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/packages/shadcn-vue/src/components/uiv2/cva.ts b/packages/shadcn-vue/src/components/uiv2/cva.ts
index 7d5bb13a..3bee8900 100644
--- a/packages/shadcn-vue/src/components/uiv2/cva.ts
+++ b/packages/shadcn-vue/src/components/uiv2/cva.ts
@@ -42,3 +42,30 @@ export const AccordionClass = cva("", {
});
export type AccordionClassProps = VariantProps;
+
+export const SwitchClass = cva("", {
+ variants: {
+ variant: {
+ default: "",
+ },
+ size: {
+ 1: "",
+ 2: "",
+ },
+ component: {
+ root: "unset box-border select-none [&::before]:box-border [&::after]:box-border inline-flex items-center justify-center leading-none m-0 outline-none bg-[#e6e8eb] rounded-full relative focus-within:shadow-[0_0_0_2px_#c1c8cd] data-[state=checked]:bg-[#0091ff] data-[state=checked]:focus-within:shadow-[0_0_0_2px_#5eb0ef]",
+ thumb: "absolute left-0 bg-white rounded-full shadow-switch transition-transform duration-100 ease-[cubic-bezier(0.22,_1,_0.36,_1)]",
+ },
+ },
+ compoundVariants: [
+ { size: 1, component: "root", class: "w-[25px] h-[15px]" },
+ { size: 2, component: "root", class: "w-[45px] h-[25px]" },
+ { size: 1, component: "thumb", class: "w-[13px] h-[13px] translate-x-[1px] data-[state=checked]:translate-x-[11px]" },
+ { size: 2, component: "thumb", class: "w-[21px] h-[21px] translate-x-0.5 data-[state=checked]:translate-x-[22px]" },
+ ],
+ defaultVariants: {
+ variant: "default",
+ size: 1,
+ },
+});
+export type SwitchClassProps = VariantProps;
\ No newline at end of file
diff --git a/packages/shadcn-vue/tailwind.config.js b/packages/shadcn-vue/tailwind.config.js
index c1784e38..66bb1447 100644
--- a/packages/shadcn-vue/tailwind.config.js
+++ b/packages/shadcn-vue/tailwind.config.js
@@ -50,6 +50,10 @@ export default {
md: `calc(var(--radius) - 2px)`,
sm: "calc(var(--radius) - 4px)",
},
+ boxShadow: {
+ switch:
+ "rgba(0, 0, 0, 0.3) 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 1px 2px",
+ },
keyframes: {
"accordion-down": {
from: { height: 0 },
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0273c5ad..745ca85d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -17,6 +17,9 @@ importers:
'@morev/vue-transitions':
specifier: ^2.3.6
version: 2.3.6(vue@3.2.47)
+ '@vueuse/core':
+ specifier: ^10.2.1
+ version: 10.2.1(vue@3.2.47)
class-variance-authority:
specifier: ^0.6.1
version: 0.6.1
@@ -665,6 +668,10 @@ packages:
resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==}
dev: false
+ /@types/web-bluetooth@0.0.17:
+ resolution: {integrity: sha512-4p9vcSmxAayx72yn70joFoL44c9MO/0+iVEBIQXe3v2h2SiAsEIo/G5v6ObFWvNKRFjbrVadNf9LqEEZeQPzdA==}
+ dev: false
+
/@vitejs/plugin-vue@4.1.0(vite@4.3.9)(vue@3.2.47):
resolution: {integrity: sha512-++9JOAFdcXI3lyer9UKUV4rfoQ3T1RN8yDqoCLar86s0xQct5yblxAE+yWgRnU5/0FOlVCpTZpYSBV/bGWrSrQ==}
engines: {node: ^14.18.0 || >=16.0.0}
@@ -851,6 +858,31 @@ packages:
resolution: {integrity: sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==}
dev: true
+ /@vueuse/core@10.2.1(vue@3.2.47):
+ resolution: {integrity: sha512-c441bfMbkAwTNwVRHQ0zdYZNETK//P84rC01aP2Uy/aRFCiie9NE/k9KdIXbno0eDYP5NPUuWv0aA/I4Unr/7w==}
+ dependencies:
+ '@types/web-bluetooth': 0.0.17
+ '@vueuse/metadata': 10.2.1
+ '@vueuse/shared': 10.2.1(vue@3.2.47)
+ vue-demi: 0.14.5(vue@3.2.47)
+ transitivePeerDependencies:
+ - '@vue/composition-api'
+ - vue
+ dev: false
+
+ /@vueuse/metadata@10.2.1:
+ resolution: {integrity: sha512-3Gt68mY/i6bQvFqx7cuGBzrCCQu17OBaGWS5JdwISpMsHnMKKjC2FeB5OAfMcCQ0oINfADP3i9A4PPRo0peHdQ==}
+ dev: false
+
+ /@vueuse/shared@10.2.1(vue@3.2.47):
+ resolution: {integrity: sha512-QWHq2bSuGptkcxx4f4M/fBYC3Y8d3M2UYyLsyzoPgEoVzJURQ0oJeWXu79OiLlBb8gTKkqe4mO85T/sf39mmiw==}
+ dependencies:
+ vue-demi: 0.14.5(vue@3.2.47)
+ transitivePeerDependencies:
+ - '@vue/composition-api'
+ - vue
+ dev: false
+
/acorn@8.9.0:
resolution: {integrity: sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ==}
engines: {node: '>=0.4.0'}
@@ -2052,6 +2084,21 @@ packages:
vue: 3.2.47
dev: false
+ /vue-demi@0.14.5(vue@3.2.47):
+ resolution: {integrity: sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==}
+ engines: {node: '>=12'}
+ hasBin: true
+ requiresBuild: true
+ peerDependencies:
+ '@vue/composition-api': ^1.0.0-rc.1
+ vue: ^3.0.0-0 || ^2.6.0
+ peerDependenciesMeta:
+ '@vue/composition-api':
+ optional: true
+ dependencies:
+ vue: 3.2.47
+ dev: false
+
/vue-template-compiler@2.7.14:
resolution: {integrity: sha512-zyA5Y3ArvVG0NacJDkkzJuPQDF8RFeRlzV2vLeSnhSpieO6LK2OVbdLPi5MPPs09Ii+gMO8nY4S3iKQxBxDmWQ==}
dependencies: