@davincihealthcare/elty-design-system-vue 1.85.1 → 1.87.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/dist/ElAccordion.vue.d.ts +6 -2
- package/dist/forms/ElInputSwitch.vue.d.ts +5 -0
- package/dist/src/ElAccordion.vue.cjs2.js +1 -1
- package/dist/src/ElAccordion.vue.cjs2.js.map +1 -1
- package/dist/src/ElAccordion.vue.esm2.js +1 -1
- package/dist/src/ElAccordion.vue.esm2.js.map +1 -1
- package/dist/src/forms/ElInputSwitch.vue.cjs2.js +1 -1
- package/dist/src/forms/ElInputSwitch.vue.cjs2.js.map +1 -1
- package/dist/src/forms/ElInputSwitch.vue.esm2.js +1 -1
- package/dist/src/forms/ElInputSwitch.vue.esm2.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
export declare const elAccordionColors: readonly ["primary", "secondary"];
|
|
2
2
|
export type ElAccordionColor = (typeof elAccordionColors)[number];
|
|
3
3
|
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
-
label
|
|
4
|
+
label?: string;
|
|
5
5
|
open?: boolean;
|
|
6
6
|
color?: ElAccordionColor;
|
|
7
7
|
}>, {
|
|
8
|
+
label: undefined;
|
|
8
9
|
color: string;
|
|
9
10
|
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
10
11
|
"update:open": (open?: boolean | undefined) => void;
|
|
11
12
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
12
|
-
label
|
|
13
|
+
label?: string;
|
|
13
14
|
open?: boolean;
|
|
14
15
|
color?: ElAccordionColor;
|
|
15
16
|
}>, {
|
|
17
|
+
label: undefined;
|
|
16
18
|
color: string;
|
|
17
19
|
}>>> & {
|
|
18
20
|
"onUpdate:open"?: ((open?: boolean | undefined) => any) | undefined;
|
|
19
21
|
}, {
|
|
22
|
+
label: string;
|
|
20
23
|
color: ElAccordionColor;
|
|
21
24
|
}, {}>, {
|
|
25
|
+
header?(_: {}): any;
|
|
22
26
|
default?(_: {}): any;
|
|
23
27
|
}>;
|
|
24
28
|
export default _default;
|
|
@@ -10,10 +10,12 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
10
10
|
size?: ElSwitchSizes;
|
|
11
11
|
color?: ElSwitchColors;
|
|
12
12
|
align?: ElSwitchAligns;
|
|
13
|
+
disabled?: boolean;
|
|
13
14
|
}>, {
|
|
14
15
|
size: string;
|
|
15
16
|
color: string;
|
|
16
17
|
align: string;
|
|
18
|
+
disabled: boolean;
|
|
17
19
|
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
18
20
|
"update:modelValue": (val: boolean) => void;
|
|
19
21
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
@@ -22,15 +24,18 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
22
24
|
size?: ElSwitchSizes;
|
|
23
25
|
color?: ElSwitchColors;
|
|
24
26
|
align?: ElSwitchAligns;
|
|
27
|
+
disabled?: boolean;
|
|
25
28
|
}>, {
|
|
26
29
|
size: string;
|
|
27
30
|
color: string;
|
|
28
31
|
align: string;
|
|
32
|
+
disabled: boolean;
|
|
29
33
|
}>>> & {
|
|
30
34
|
"onUpdate:modelValue"?: ((val: boolean) => any) | undefined;
|
|
31
35
|
}, {
|
|
32
36
|
size: ElSwitchSizes;
|
|
33
37
|
color: ElSwitchColors;
|
|
38
|
+
disabled: boolean;
|
|
34
39
|
align: ElSwitchAligns;
|
|
35
40
|
}, {}>;
|
|
36
41
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("./ElIcon.vue.cjs2.js"),d={class:"relative rounded-md bg-white overflow-hidden"},v={key:0,class:"text-sm font-medium"},p={key:1,class:"text-ellipsis whitespace-nowrap overflow-hidden text-sm font-medium"},m={class:"overflow-hidden w-full"},f={class:"transform duration-100 w-full flex flex-col gap-2 p-2 bg-white"},h=["primary","secondary"],y=e.defineComponent({__name:"ElAccordion",props:{label:{default:void 0},open:{type:Boolean},color:{default:"primary"}},emits:["update:open"],setup(a,{emit:n}){const s=e.useSlots(),c=a,i=n,l=e.ref(!1),o=e.computed({set(t){i("update:open",t),l.value=t},get(){return c.open||l.value}});return(t,r)=>(e.openBlock(),e.createElementBlock("div",d,[e.createElementVNode("button",{class:"w-full h-10",onClick:r[0]||(r[0]=e.withModifiers(w=>o.value=!o.value,["prevent"]))},[e.createElementVNode("div",{class:e.normalizeClass(["h-full w-full flex justify-between items-center rounded-md cursor-pointer px-2 select-none active:bg-neutral-pressed active:text-neutral-darker hover:bg-neutral-hover",[t.color==="primary"&&!o.value&&"bg-neutral-surface text-neutral-darker",t.color==="primary"&&o.value&&"bg-neutral-active text-primary-active",t.color==="secondary"&&!o.value&&"bg-neutral-surface text-neutral-darker",t.color==="secondary"&&o.value&&"bg-neutral-active text-secondary-active"]])},[e.unref(s).header?(e.openBlock(),e.createElementBlock("span",v,[e.renderSlot(t.$slots,"header")])):(e.openBlock(),e.createElementBlock("span",p,e.toDisplayString(t.label),1)),e.createVNode(u.default,{solid:"",name:o.value?"ChevronUpIcon":"ChevronDownIcon",class:"w-4 h-4"},null,8,["name"])],2)]),e.createElementVNode("div",m,[e.createVNode(e.Transition,{"enter-active-class":"ease-out","enter-from-class":"-translate-y-full","enter-to-class":"translate-y-0","leave-active-class":"ease-in","leave-from-class":"translate-y-0","leave-to-class":"-translate-y-full",duration:100},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",f,[e.renderSlot(t.$slots,"default")],512),[[e.vShow,o.value]])]),_:3})])]))}});exports.default=y;exports.elAccordionColors=h;
|
|
2
2
|
//# sourceMappingURL=ElAccordion.vue.cjs2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElAccordion.vue.cjs2.js","sources":["../../src/ElAccordion.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elAccordionColors = ['primary', 'secondary'] as const;\nexport type ElAccordionColor = (typeof elAccordionColors)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, computed } from 'vue';\nimport ElIcon from '@/ElIcon.vue';\n\nconst props = withDefaults(\n defineProps<{\n label
|
|
1
|
+
{"version":3,"file":"ElAccordion.vue.cjs2.js","sources":["../../src/ElAccordion.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elAccordionColors = ['primary', 'secondary'] as const;\nexport type ElAccordionColor = (typeof elAccordionColors)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, computed, useSlots } from 'vue';\nimport ElIcon from '@/ElIcon.vue';\n\nconst slots = useSlots();\n\nconst props = withDefaults(\n defineProps<{\n label?: string;\n open?: boolean;\n color?: ElAccordionColor;\n }>(),\n {\n label: undefined,\n color: 'primary',\n },\n);\n\nconst emit = defineEmits<{\n (event: 'update:open', open?: boolean): void;\n}>();\n\nconst openLocal = ref<boolean>(false);\n\nconst openProxy = computed<boolean>({\n set(open: boolean) {\n emit('update:open', open);\n openLocal.value = open;\n },\n get(): boolean {\n return props.open || openLocal.value;\n },\n});\n</script>\n\n<template>\n <div class=\"relative rounded-md bg-white overflow-hidden\">\n <button class=\"w-full h-10\" @click.prevent=\"openProxy = !openProxy\">\n <div\n class=\"h-full w-full flex justify-between items-center rounded-md cursor-pointer px-2 select-none active:bg-neutral-pressed active:text-neutral-darker hover:bg-neutral-hover\"\n :class=\"[\n color === 'primary' && !openProxy && 'bg-neutral-surface text-neutral-darker',\n color === 'primary' && openProxy && 'bg-neutral-active text-primary-active',\n color === 'secondary' && !openProxy && 'bg-neutral-surface text-neutral-darker',\n color === 'secondary' && openProxy && 'bg-neutral-active text-secondary-active',\n ]\"\n >\n <span v-if=\"slots.header\" class=\"text-sm font-medium\"><slot name=\"header\" /></span>\n <span v-else class=\"text-ellipsis whitespace-nowrap overflow-hidden text-sm font-medium\">{{ label }}</span>\n\n <ElIcon solid :name=\"openProxy ? 'ChevronUpIcon' : 'ChevronDownIcon'\" class=\"w-4 h-4\" />\n </div>\n </button>\n\n <div class=\"overflow-hidden w-full\">\n <Transition\n enter-active-class=\"ease-out\"\n enter-from-class=\"-translate-y-full\"\n enter-to-class=\"translate-y-0\"\n leave-active-class=\"ease-in\"\n leave-from-class=\"translate-y-0\"\n leave-to-class=\"-translate-y-full\"\n :duration=\"100\"\n >\n <div v-show=\"openProxy\" class=\"transform duration-100 w-full flex flex-col gap-2 p-2 bg-white\">\n <slot />\n </div>\n </Transition>\n </div>\n </div>\n</template>\n"],"names":["elAccordionColors","slots","useSlots","props","__props","emit","__emit","openLocal","ref","openProxy","computed","open"],"mappings":"wcACaA,EAAoB,CAAC,UAAW,WAAW,iKAQxD,MAAMC,EAAQC,EAAAA,WAERC,EAAQC,EAYRC,EAAOC,EAIPC,EAAYC,MAAa,EAAK,EAE9BC,EAAYC,EAAAA,SAAkB,CAClC,IAAIC,EAAe,CACjBN,EAAK,cAAeM,CAAI,EACxBJ,EAAU,MAAQI,CACpB,EACA,KAAe,CACN,OAAAR,EAAM,MAAQI,EAAU,KACjC,CAAA,CACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defineComponent as
|
|
1
|
+
import{defineComponent as f,useSlots as m,ref as h,computed as y,openBlock as a,createElementBlock as l,createElementVNode as o,withModifiers as w,normalizeClass as b,unref as g,renderSlot as n,toDisplayString as _,createVNode as i,Transition as x,withCtx as k,withDirectives as C,vShow as S}from"vue";import $ from"./ElIcon.vue.esm2.js";const B={class:"relative rounded-md bg-white overflow-hidden"},D={key:0,class:"text-sm font-medium"},E={key:1,class:"text-ellipsis whitespace-nowrap overflow-hidden text-sm font-medium"},A={class:"overflow-hidden w-full"},I={class:"transform duration-100 w-full flex flex-col gap-2 p-2 bg-white"},z=["primary","secondary"],L=f({__name:"ElAccordion",props:{label:{default:void 0},open:{type:Boolean},color:{default:"primary"}},emits:["update:open"],setup(c,{emit:u}){const d=m(),v=c,p=u,r=h(!1),t=y({set(e){p("update:open",e),r.value=e},get(){return v.open||r.value}});return(e,s)=>(a(),l("div",B,[o("button",{class:"w-full h-10",onClick:s[0]||(s[0]=w(N=>t.value=!t.value,["prevent"]))},[o("div",{class:b(["h-full w-full flex justify-between items-center rounded-md cursor-pointer px-2 select-none active:bg-neutral-pressed active:text-neutral-darker hover:bg-neutral-hover",[e.color==="primary"&&!t.value&&"bg-neutral-surface text-neutral-darker",e.color==="primary"&&t.value&&"bg-neutral-active text-primary-active",e.color==="secondary"&&!t.value&&"bg-neutral-surface text-neutral-darker",e.color==="secondary"&&t.value&&"bg-neutral-active text-secondary-active"]])},[g(d).header?(a(),l("span",D,[n(e.$slots,"header")])):(a(),l("span",E,_(e.label),1)),i($,{solid:"",name:t.value?"ChevronUpIcon":"ChevronDownIcon",class:"w-4 h-4"},null,8,["name"])],2)]),o("div",A,[i(x,{"enter-active-class":"ease-out","enter-from-class":"-translate-y-full","enter-to-class":"translate-y-0","leave-active-class":"ease-in","leave-from-class":"translate-y-0","leave-to-class":"-translate-y-full",duration:100},{default:k(()=>[C(o("div",I,[n(e.$slots,"default")],512),[[S,t.value]])]),_:3})])]))}});export{L as default,z as elAccordionColors};
|
|
2
2
|
//# sourceMappingURL=ElAccordion.vue.esm2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElAccordion.vue.esm2.js","sources":["../../src/ElAccordion.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elAccordionColors = ['primary', 'secondary'] as const;\nexport type ElAccordionColor = (typeof elAccordionColors)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, computed } from 'vue';\nimport ElIcon from '@/ElIcon.vue';\n\nconst props = withDefaults(\n defineProps<{\n label
|
|
1
|
+
{"version":3,"file":"ElAccordion.vue.esm2.js","sources":["../../src/ElAccordion.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elAccordionColors = ['primary', 'secondary'] as const;\nexport type ElAccordionColor = (typeof elAccordionColors)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, computed, useSlots } from 'vue';\nimport ElIcon from '@/ElIcon.vue';\n\nconst slots = useSlots();\n\nconst props = withDefaults(\n defineProps<{\n label?: string;\n open?: boolean;\n color?: ElAccordionColor;\n }>(),\n {\n label: undefined,\n color: 'primary',\n },\n);\n\nconst emit = defineEmits<{\n (event: 'update:open', open?: boolean): void;\n}>();\n\nconst openLocal = ref<boolean>(false);\n\nconst openProxy = computed<boolean>({\n set(open: boolean) {\n emit('update:open', open);\n openLocal.value = open;\n },\n get(): boolean {\n return props.open || openLocal.value;\n },\n});\n</script>\n\n<template>\n <div class=\"relative rounded-md bg-white overflow-hidden\">\n <button class=\"w-full h-10\" @click.prevent=\"openProxy = !openProxy\">\n <div\n class=\"h-full w-full flex justify-between items-center rounded-md cursor-pointer px-2 select-none active:bg-neutral-pressed active:text-neutral-darker hover:bg-neutral-hover\"\n :class=\"[\n color === 'primary' && !openProxy && 'bg-neutral-surface text-neutral-darker',\n color === 'primary' && openProxy && 'bg-neutral-active text-primary-active',\n color === 'secondary' && !openProxy && 'bg-neutral-surface text-neutral-darker',\n color === 'secondary' && openProxy && 'bg-neutral-active text-secondary-active',\n ]\"\n >\n <span v-if=\"slots.header\" class=\"text-sm font-medium\"><slot name=\"header\" /></span>\n <span v-else class=\"text-ellipsis whitespace-nowrap overflow-hidden text-sm font-medium\">{{ label }}</span>\n\n <ElIcon solid :name=\"openProxy ? 'ChevronUpIcon' : 'ChevronDownIcon'\" class=\"w-4 h-4\" />\n </div>\n </button>\n\n <div class=\"overflow-hidden w-full\">\n <Transition\n enter-active-class=\"ease-out\"\n enter-from-class=\"-translate-y-full\"\n enter-to-class=\"translate-y-0\"\n leave-active-class=\"ease-in\"\n leave-from-class=\"translate-y-0\"\n leave-to-class=\"-translate-y-full\"\n :duration=\"100\"\n >\n <div v-show=\"openProxy\" class=\"transform duration-100 w-full flex flex-col gap-2 p-2 bg-white\">\n <slot />\n </div>\n </Transition>\n </div>\n </div>\n</template>\n"],"names":["elAccordionColors","slots","useSlots","props","__props","emit","__emit","openLocal","ref","openProxy","computed","open"],"mappings":"2nBACaA,EAAoB,CAAC,UAAW,WAAW,iJAQxD,MAAMC,EAAQC,IAERC,EAAQC,EAYRC,EAAOC,EAIPC,EAAYC,EAAa,EAAK,EAE9BC,EAAYC,EAAkB,CAClC,IAAIC,EAAe,CACjBN,EAAK,cAAeM,CAAI,EACxBJ,EAAU,MAAQI,CACpB,EACA,KAAe,CACN,OAAAR,EAAM,MAAQI,EAAU,KACjC,CAAA,CACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("./ElInputContainer.vue.cjs2.js"),c=require("./input.cjs.js"),m=["id","checked","disabled","data-cy"],f=["for"],p=["xs","xxs"],h=["primary","secondary"],b=["left","right"],g=e.defineComponent({__name:"ElInputSwitch",props:{modelValue:{type:Boolean},label:{},size:{default:"xs"},color:{default:"primary"},align:{default:"left"},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(o,{emit:n}){const t=o,i=n,{modelValue:a}=e.toRefs(t),r=c.UniqueID().getID(),s=e.ref(a.value);e.watch(a,()=>{s.value=a.value,i("update:modelValue",s.value)});const d=()=>{t.disabled||(s.value=!s.value,i("update:modelValue",s.value))};return(l,w)=>(e.openBlock(),e.createBlock(u.default,e.mergeProps(l.$attrs,{"no-icon":!0,name:e.unref(r)}),{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["w-full flex",{"justify-start":l.align==="left","justify-end":l.align==="right"}])},[e.createElementVNode("input",{id:e.unref(r),checked:e.unref(a),type:"checkbox",class:"sr-only",disabled:l.disabled,"data-cy":l.label?`${l.label.trim().replaceAll(" ","")}-switch`:"switch"},null,8,m),e.createElementVNode("button",{class:e.normalizeClass(["flex items-center justify-center gap-2",{"cursor-not-allowed":l.disabled,"cursor-pointer":!l.disabled}]),onClick:d},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center shrink-0",{"w-9 h-[1.375rem]":l.size==="xs","w-[1.625rem] h-4":l.size==="xxs","order-1":l.align==="left","order-2":l.align==="right"}])},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full rounded-full duration-200",{"w-9 h-[1.375rem]":l.size==="xs","w-[1.625rem] h-4":l.size==="xxs","bg-neutral-300":!e.unref(a)&&!l.disabled,"bg-neutral-inactive":l.disabled,"bg-primary-active":l.color==="primary"&&e.unref(a)&&!l.disabled,"bg-secondary-active":l.color==="secondary"&&e.unref(a)&&!l.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["absolute top-[0.125rem] bg-white rounded-full duration-200 drop-shadow",{"w-[1.125rem] h-[1.125rem]":l.size==="xs","w-3 h-3":l.size==="xxs","left-[0.125rem]":!e.unref(a),"left-4":l.size==="xs"&&e.unref(a),"left-3":l.size==="xxs"&&e.unref(a)}])},null,2)],2)],2),l.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(r),class:e.normalizeClass({"text-base":l.size==="xs","text-sm":l.size==="xxs","order-2":l.align==="left","order-1":l.align==="right","text-neutral-darker cursor-pointer":!l.disabled,"text-neutral-inactive cursor-not-allowed":l.disabled})},e.toDisplayString(l.label),11,f)):e.createCommentVNode("",!0)],2)],2)]),_:1},16,["name"]))}});exports.default=g;exports.elSwitchAligns=b;exports.elSwitchColors=h;exports.elSwitchSizes=p;
|
|
2
2
|
//# sourceMappingURL=ElInputSwitch.vue.cjs2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElInputSwitch.vue.cjs2.js","sources":["../../../src/forms/ElInputSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elSwitchSizes = ['xs', 'xxs'] as const;\ntype ElSwitchSizes = (typeof elSwitchSizes)[number];\n\nexport const elSwitchColors = ['primary', 'secondary'] as const;\ntype ElSwitchColors = (typeof elSwitchColors)[number];\n\nexport const elSwitchAligns = ['left', 'right'] as const;\ntype ElSwitchAligns = (typeof elSwitchAligns)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, toRefs, watch } from 'vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { UniqueID } from '@/forms/input';\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: boolean;\n label: string;\n size?: ElSwitchSizes;\n color?: ElSwitchColors;\n align?: ElSwitchAligns;\n }>(),\n {\n size: 'xs',\n color: 'primary',\n align: 'left',\n },\n);\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', val: boolean): void;\n}>();\n\nconst { modelValue } = toRefs(props);\nconst uuid = UniqueID().getID();\nconst value = ref<boolean>(modelValue.value);\n\nwatch(modelValue, () => {\n value.value = modelValue.value;\n emit('update:modelValue', value.value);\n});\n\nconst toggleSwitch = () => {\n value.value = !value.value;\n emit('update:modelValue', value.value);\n};\n</script>\n\n<template>\n <ElInputContainer v-bind=\"$attrs\" :no-icon=\"true\" :name=\"uuid\">\n <div\n class=\"w-full flex\"\n :class=\"{\n 'justify-start': align === 'left',\n 'justify-end': align === 'right',\n }\"\n >\n <input\n :id=\"uuid\"\n :checked=\"modelValue\"\n type=\"checkbox\"\n class=\"sr-only\"\n :data-cy=\"label ? `${label.trim().replaceAll(' ', '')}-switch` : 'switch'\"\n />\n\n <button
|
|
1
|
+
{"version":3,"file":"ElInputSwitch.vue.cjs2.js","sources":["../../../src/forms/ElInputSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elSwitchSizes = ['xs', 'xxs'] as const;\ntype ElSwitchSizes = (typeof elSwitchSizes)[number];\n\nexport const elSwitchColors = ['primary', 'secondary'] as const;\ntype ElSwitchColors = (typeof elSwitchColors)[number];\n\nexport const elSwitchAligns = ['left', 'right'] as const;\ntype ElSwitchAligns = (typeof elSwitchAligns)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, toRefs, watch } from 'vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { UniqueID } from '@/forms/input';\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: boolean;\n label: string;\n size?: ElSwitchSizes;\n color?: ElSwitchColors;\n align?: ElSwitchAligns;\n disabled?: boolean;\n }>(),\n {\n size: 'xs',\n color: 'primary',\n align: 'left',\n disabled: false,\n },\n);\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', val: boolean): void;\n}>();\n\nconst { modelValue } = toRefs(props);\nconst uuid = UniqueID().getID();\nconst value = ref<boolean>(modelValue.value);\n\nwatch(modelValue, () => {\n value.value = modelValue.value;\n emit('update:modelValue', value.value);\n});\n\nconst toggleSwitch = () => {\n if (props.disabled) return;\n value.value = !value.value;\n emit('update:modelValue', value.value);\n};\n</script>\n\n<template>\n <ElInputContainer v-bind=\"$attrs\" :no-icon=\"true\" :name=\"uuid\">\n <div\n class=\"w-full flex\"\n :class=\"{\n 'justify-start': align === 'left',\n 'justify-end': align === 'right',\n }\"\n >\n <input\n :id=\"uuid\"\n :checked=\"modelValue\"\n type=\"checkbox\"\n class=\"sr-only\"\n :disabled=\"disabled\"\n :data-cy=\"label ? `${label.trim().replaceAll(' ', '')}-switch` : 'switch'\"\n />\n\n <button\n class=\"flex items-center justify-center gap-2\"\n :class=\"{ 'cursor-not-allowed': disabled, 'cursor-pointer': !disabled }\"\n @click=\"toggleSwitch\"\n >\n <div\n class=\"flex items-center shrink-0\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'order-1': align === 'left',\n 'order-2': align === 'right',\n }\"\n >\n <div\n class=\"relative w-full rounded-full duration-200\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'bg-neutral-300': !modelValue && !disabled,\n 'bg-neutral-inactive': disabled,\n 'bg-primary-active': color === 'primary' && modelValue && !disabled,\n 'bg-secondary-active': color === 'secondary' && modelValue && !disabled,\n }\"\n >\n <div\n class=\"absolute top-[0.125rem] bg-white rounded-full duration-200 drop-shadow\"\n :class=\"{\n 'w-[1.125rem] h-[1.125rem]': size === 'xs',\n 'w-3 h-3': size === 'xxs',\n 'left-[0.125rem]': !modelValue,\n 'left-4': size === 'xs' && modelValue,\n 'left-3': size === 'xxs' && modelValue,\n }\"\n ></div>\n </div>\n </div>\n\n <label\n v-if=\"label\"\n :for=\"uuid\"\n :class=\"{\n 'text-base': size === 'xs',\n 'text-sm': size === 'xxs',\n 'order-2': align === 'left',\n 'order-1': align === 'right',\n 'text-neutral-darker cursor-pointer': !disabled,\n 'text-neutral-inactive cursor-not-allowed': disabled,\n }\"\n >\n {{ label }}\n </label>\n </button>\n </div>\n </ElInputContainer>\n</template>\n"],"names":["elSwitchSizes","elSwitchColors","elSwitchAligns","props","__props","emit","__emit","modelValue","toRefs","uuid","UniqueID","value","ref","watch","toggleSwitch"],"mappings":"6PACaA,EAAgB,CAAC,KAAM,KAAK,EAG5BC,EAAiB,CAAC,UAAW,WAAW,EAGxCC,EAAiB,CAAC,OAAQ,OAAO,+OAS9C,MAAMC,EAAQC,EAiBRC,EAAOC,EAIP,CAAE,WAAAC,CAAA,EAAeC,EAAA,OAAOL,CAAK,EAC7BM,EAAOC,EAAAA,WAAW,QAClBC,EAAQC,EAAAA,IAAaL,EAAW,KAAK,EAE3CM,EAAA,MAAMN,EAAY,IAAM,CACtBI,EAAM,MAAQJ,EAAW,MACpBF,EAAA,oBAAqBM,EAAM,KAAK,CAAA,CACtC,EAED,MAAMG,EAAe,IAAM,CACrBX,EAAM,WACJQ,EAAA,MAAQ,CAACA,EAAM,MAChBN,EAAA,oBAAqBM,EAAM,KAAK,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defineComponent as
|
|
1
|
+
import{defineComponent as c,toRefs as p,ref as b,watch as h,openBlock as n,createBlock as g,mergeProps as w,unref as a,withCtx as y,createElementVNode as s,normalizeClass as r,createElementBlock as v,toDisplayString as z,createCommentVNode as k}from"vue";import S from"./ElInputContainer.vue.esm2.js";import{UniqueID as V}from"./input.esm.js";const C=["id","checked","disabled","data-cy"],B=["for"],$=["xs","xxs"],A=["primary","secondary"],N=["left","right"],q=c({__name:"ElInputSwitch",props:{modelValue:{type:Boolean},label:{},size:{default:"xs"},color:{default:"primary"},align:{default:"left"},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(u,{emit:m}){const o=u,d=m,{modelValue:l}=p(o),t=V().getID(),i=b(l.value);h(l,()=>{i.value=l.value,d("update:modelValue",i.value)});const f=()=>{o.disabled||(i.value=!i.value,d("update:modelValue",i.value))};return(e,j)=>(n(),g(S,w(e.$attrs,{"no-icon":!0,name:a(t)}),{default:y(()=>[s("div",{class:r(["w-full flex",{"justify-start":e.align==="left","justify-end":e.align==="right"}])},[s("input",{id:a(t),checked:a(l),type:"checkbox",class:"sr-only",disabled:e.disabled,"data-cy":e.label?`${e.label.trim().replaceAll(" ","")}-switch`:"switch"},null,8,C),s("button",{class:r(["flex items-center justify-center gap-2",{"cursor-not-allowed":e.disabled,"cursor-pointer":!e.disabled}]),onClick:f},[s("div",{class:r(["flex items-center shrink-0",{"w-9 h-[1.375rem]":e.size==="xs","w-[1.625rem] h-4":e.size==="xxs","order-1":e.align==="left","order-2":e.align==="right"}])},[s("div",{class:r(["relative w-full rounded-full duration-200",{"w-9 h-[1.375rem]":e.size==="xs","w-[1.625rem] h-4":e.size==="xxs","bg-neutral-300":!a(l)&&!e.disabled,"bg-neutral-inactive":e.disabled,"bg-primary-active":e.color==="primary"&&a(l)&&!e.disabled,"bg-secondary-active":e.color==="secondary"&&a(l)&&!e.disabled}])},[s("div",{class:r(["absolute top-[0.125rem] bg-white rounded-full duration-200 drop-shadow",{"w-[1.125rem] h-[1.125rem]":e.size==="xs","w-3 h-3":e.size==="xxs","left-[0.125rem]":!a(l),"left-4":e.size==="xs"&&a(l),"left-3":e.size==="xxs"&&a(l)}])},null,2)],2)],2),e.label?(n(),v("label",{key:0,for:a(t),class:r({"text-base":e.size==="xs","text-sm":e.size==="xxs","order-2":e.align==="left","order-1":e.align==="right","text-neutral-darker cursor-pointer":!e.disabled,"text-neutral-inactive cursor-not-allowed":e.disabled})},z(e.label),11,B)):k("",!0)],2)],2)]),_:1},16,["name"]))}});export{q as default,N as elSwitchAligns,A as elSwitchColors,$ as elSwitchSizes};
|
|
2
2
|
//# sourceMappingURL=ElInputSwitch.vue.esm2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElInputSwitch.vue.esm2.js","sources":["../../../src/forms/ElInputSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elSwitchSizes = ['xs', 'xxs'] as const;\ntype ElSwitchSizes = (typeof elSwitchSizes)[number];\n\nexport const elSwitchColors = ['primary', 'secondary'] as const;\ntype ElSwitchColors = (typeof elSwitchColors)[number];\n\nexport const elSwitchAligns = ['left', 'right'] as const;\ntype ElSwitchAligns = (typeof elSwitchAligns)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, toRefs, watch } from 'vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { UniqueID } from '@/forms/input';\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: boolean;\n label: string;\n size?: ElSwitchSizes;\n color?: ElSwitchColors;\n align?: ElSwitchAligns;\n }>(),\n {\n size: 'xs',\n color: 'primary',\n align: 'left',\n },\n);\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', val: boolean): void;\n}>();\n\nconst { modelValue } = toRefs(props);\nconst uuid = UniqueID().getID();\nconst value = ref<boolean>(modelValue.value);\n\nwatch(modelValue, () => {\n value.value = modelValue.value;\n emit('update:modelValue', value.value);\n});\n\nconst toggleSwitch = () => {\n value.value = !value.value;\n emit('update:modelValue', value.value);\n};\n</script>\n\n<template>\n <ElInputContainer v-bind=\"$attrs\" :no-icon=\"true\" :name=\"uuid\">\n <div\n class=\"w-full flex\"\n :class=\"{\n 'justify-start': align === 'left',\n 'justify-end': align === 'right',\n }\"\n >\n <input\n :id=\"uuid\"\n :checked=\"modelValue\"\n type=\"checkbox\"\n class=\"sr-only\"\n :data-cy=\"label ? `${label.trim().replaceAll(' ', '')}-switch` : 'switch'\"\n />\n\n <button
|
|
1
|
+
{"version":3,"file":"ElInputSwitch.vue.esm2.js","sources":["../../../src/forms/ElInputSwitch.vue"],"sourcesContent":["<script lang=\"ts\">\nexport const elSwitchSizes = ['xs', 'xxs'] as const;\ntype ElSwitchSizes = (typeof elSwitchSizes)[number];\n\nexport const elSwitchColors = ['primary', 'secondary'] as const;\ntype ElSwitchColors = (typeof elSwitchColors)[number];\n\nexport const elSwitchAligns = ['left', 'right'] as const;\ntype ElSwitchAligns = (typeof elSwitchAligns)[number];\n</script>\n\n<script lang=\"ts\" setup>\nimport { ref, toRefs, watch } from 'vue';\nimport ElInputContainer from '@/forms/ElInputContainer.vue';\nimport { UniqueID } from '@/forms/input';\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: boolean;\n label: string;\n size?: ElSwitchSizes;\n color?: ElSwitchColors;\n align?: ElSwitchAligns;\n disabled?: boolean;\n }>(),\n {\n size: 'xs',\n color: 'primary',\n align: 'left',\n disabled: false,\n },\n);\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', val: boolean): void;\n}>();\n\nconst { modelValue } = toRefs(props);\nconst uuid = UniqueID().getID();\nconst value = ref<boolean>(modelValue.value);\n\nwatch(modelValue, () => {\n value.value = modelValue.value;\n emit('update:modelValue', value.value);\n});\n\nconst toggleSwitch = () => {\n if (props.disabled) return;\n value.value = !value.value;\n emit('update:modelValue', value.value);\n};\n</script>\n\n<template>\n <ElInputContainer v-bind=\"$attrs\" :no-icon=\"true\" :name=\"uuid\">\n <div\n class=\"w-full flex\"\n :class=\"{\n 'justify-start': align === 'left',\n 'justify-end': align === 'right',\n }\"\n >\n <input\n :id=\"uuid\"\n :checked=\"modelValue\"\n type=\"checkbox\"\n class=\"sr-only\"\n :disabled=\"disabled\"\n :data-cy=\"label ? `${label.trim().replaceAll(' ', '')}-switch` : 'switch'\"\n />\n\n <button\n class=\"flex items-center justify-center gap-2\"\n :class=\"{ 'cursor-not-allowed': disabled, 'cursor-pointer': !disabled }\"\n @click=\"toggleSwitch\"\n >\n <div\n class=\"flex items-center shrink-0\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'order-1': align === 'left',\n 'order-2': align === 'right',\n }\"\n >\n <div\n class=\"relative w-full rounded-full duration-200\"\n :class=\"{\n 'w-9 h-[1.375rem]': size === 'xs',\n 'w-[1.625rem] h-4': size === 'xxs',\n 'bg-neutral-300': !modelValue && !disabled,\n 'bg-neutral-inactive': disabled,\n 'bg-primary-active': color === 'primary' && modelValue && !disabled,\n 'bg-secondary-active': color === 'secondary' && modelValue && !disabled,\n }\"\n >\n <div\n class=\"absolute top-[0.125rem] bg-white rounded-full duration-200 drop-shadow\"\n :class=\"{\n 'w-[1.125rem] h-[1.125rem]': size === 'xs',\n 'w-3 h-3': size === 'xxs',\n 'left-[0.125rem]': !modelValue,\n 'left-4': size === 'xs' && modelValue,\n 'left-3': size === 'xxs' && modelValue,\n }\"\n ></div>\n </div>\n </div>\n\n <label\n v-if=\"label\"\n :for=\"uuid\"\n :class=\"{\n 'text-base': size === 'xs',\n 'text-sm': size === 'xxs',\n 'order-2': align === 'left',\n 'order-1': align === 'right',\n 'text-neutral-darker cursor-pointer': !disabled,\n 'text-neutral-inactive cursor-not-allowed': disabled,\n }\"\n >\n {{ label }}\n </label>\n </button>\n </div>\n </ElInputContainer>\n</template>\n"],"names":["elSwitchSizes","elSwitchColors","elSwitchAligns","props","__props","emit","__emit","modelValue","toRefs","uuid","UniqueID","value","ref","watch","toggleSwitch"],"mappings":"+YACaA,EAAgB,CAAC,KAAM,KAAK,EAG5BC,EAAiB,CAAC,UAAW,WAAW,EAGxCC,EAAiB,CAAC,OAAQ,OAAO,+NAS9C,MAAMC,EAAQC,EAiBRC,EAAOC,EAIP,CAAE,WAAAC,CAAA,EAAeC,EAAOL,CAAK,EAC7BM,EAAOC,IAAW,QAClBC,EAAQC,EAAaL,EAAW,KAAK,EAE3CM,EAAMN,EAAY,IAAM,CACtBI,EAAM,MAAQJ,EAAW,MACpBF,EAAA,oBAAqBM,EAAM,KAAK,CAAA,CACtC,EAED,MAAMG,EAAe,IAAM,CACrBX,EAAM,WACJQ,EAAA,MAAQ,CAACA,EAAM,MAChBN,EAAA,oBAAqBM,EAAM,KAAK,EAAA"}
|