yuyeon 0.1.0-rc.5 → 0.1.0-rc.6
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.
|
@@ -145,6 +145,7 @@ export const YSwitch = defineComponent({
|
|
|
145
145
|
const {
|
|
146
146
|
checked
|
|
147
147
|
} = $checkbox;
|
|
148
|
+
$event.stopImmediatePropagation();
|
|
148
149
|
this.changeInput(checked, $event);
|
|
149
150
|
},
|
|
150
151
|
changeInput(checked, event) {
|
|
@@ -218,7 +219,7 @@ export const YSwitch = defineComponent({
|
|
|
218
219
|
"class": "y-switch__thumb"
|
|
219
220
|
}, [loading && _createVNode("div", {
|
|
220
221
|
"class": "y-switch__spinner"
|
|
221
|
-
}, null)])]), _createVNode("label", {
|
|
222
|
+
}, null)])]), $slots.label && _createVNode("label", {
|
|
222
223
|
"for": inputId,
|
|
223
224
|
"class": "y-switch__label"
|
|
224
225
|
}, [$slots.label?.(), _createVNode("input", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YSwitch.mjs","names":["defineComponent","withModifiers","uidCounter","YSwitch","name","model","prop","event","props","input","type","Boolean","Array","default","value","String","Number","Object","max","loading","disabled","stickOut","stateLabel","color","labelOn","labelOff","data","innerValue","counterId","focused","created","iid","toString","isArray","inputByValue","computed","isMultipleInput","multipleInputIndex","findIndex","inp","inputId","id","trackStyles","backgroundColor","classes","methods","found","find","undefined","changeMultipleInput","checked","multipleInput","slice","length","$emit","nextChange","push","splice","$nextTick","onClick","$event","changeInput","onFocus","onBlur","onKeydown","onChange","$checkbox","target","watch","render","$slots","_createVNode","label"],"sources":["../../../src/components/switch/YSwitch.tsx"],"sourcesContent":["import { PropType, defineComponent, withModifiers } from 'vue';\r\n\r\nimport './YSwitch.scss';\r\n\r\nlet uidCounter = 0;\r\n\r\nexport const YSwitch = defineComponent({\r\n name: 'YSwitch',\r\n model: {\r\n prop: 'input',\r\n event: 'change',\r\n },\r\n props: {\r\n input: {\r\n type: [Boolean, Array] as PropType<boolean | any[]>,\r\n default: false,\r\n },\r\n value: {\r\n type: [String, Number, Object] as PropType<any>,\r\n },\r\n max: {\r\n type: Number,\r\n },\r\n loading: {\r\n type: Boolean,\r\n },\r\n disabled: {\r\n type: Boolean,\r\n },\r\n stickOut: {\r\n type: Boolean,\r\n },\r\n stateLabel: {\r\n type: Boolean,\r\n },\r\n color: {\r\n type: String,\r\n },\r\n labelOn: {\r\n type: String,\r\n default: 'ON',\r\n },\r\n labelOff: {\r\n type: String,\r\n default: 'OFF',\r\n },\r\n },\r\n data() {\r\n return {\r\n innerValue: false,\r\n counterId: '',\r\n focused: false,\r\n };\r\n },\r\n created() {\r\n const iid = uidCounter.toString();\r\n uidCounter += 1;\r\n this.counterId = iid;\r\n if (Array.isArray(this.input)) {\r\n this.inputByValue();\r\n } else {\r\n this.innerValue = this.input;\r\n }\r\n },\r\n computed: {\r\n isMultipleInput() {\r\n return Array.isArray(this.input);\r\n },\r\n multipleInputIndex() {\r\n if (!Array.isArray(this.input)) {\r\n return -1;\r\n }\r\n return this.input.findIndex((inp) => {\r\n return inp === this.value;\r\n });\r\n },\r\n inputId() {\r\n const id = this.counterId;\r\n return `y-switch--${id}`;\r\n },\r\n trackStyles() {\r\n return {\r\n backgroundColor: this.color,\r\n };\r\n },\r\n classes() {\r\n return {\r\n 'y-switch--disabled': this.disabled,\r\n 'y-switch--loading': this.loading,\r\n 'y-switch--active': this.innerValue,\r\n 'y-switch--stick-out': this.stickOut,\r\n 'y-switch--focused': this.focused,\r\n };\r\n },\r\n },\r\n methods: {\r\n inputByValue() {\r\n if (Array.isArray(this.input)) {\r\n const found = this.input.find((inp: any) => {\r\n return inp === this.value;\r\n });\r\n\r\n if (found !== undefined) {\r\n this.innerValue = true;\r\n } else {\r\n this.innerValue = false;\r\n }\r\n } else if (typeof this.input === 'boolean') {\r\n this.innerValue = this.input;\r\n }\r\n },\r\n changeMultipleInput(checked: boolean) {\r\n if (Array.isArray(this.input)) {\r\n const multipleInput = this.input.slice();\r\n if (\r\n checked &&\r\n this.max !== undefined &&\r\n multipleInput.length >= this.max\r\n ) {\r\n this.$emit('overmax');\r\n this.nextChange(false, multipleInput);\r\n return;\r\n }\r\n if (checked && this.multipleInputIndex < 0) {\r\n multipleInput.push(this.value);\r\n } else if (this.multipleInputIndex > -1) {\r\n multipleInput.splice(this.multipleInputIndex, 1);\r\n }\r\n this.$emit('change', multipleInput);\r\n }\r\n },\r\n nextChange(checked: boolean, value: any) {\r\n this.$nextTick(() => {\r\n this.innerValue = checked;\r\n });\r\n },\r\n onClick($event: Event) {\r\n if (this.disabled || this.loading) return;\r\n this.changeInput(!this.innerValue, $event);\r\n },\r\n onFocus() {\r\n this.focused = true;\r\n },\r\n onBlur() {\r\n this.focused = false;\r\n },\r\n onKeydown($event: KeyboardEvent) {\r\n // nothing\r\n },\r\n onChange($event: Event) {\r\n const $checkbox = $event.target as HTMLInputElement;\r\n const { checked } = $checkbox;\r\n this.changeInput(checked, $event);\r\n },\r\n changeInput(checked: boolean, event?: Event) {\r\n this.innerValue = checked;\r\n if (this.isMultipleInput) {\r\n this.changeMultipleInput(checked);\r\n } else {\r\n this.$emit('change', checked);\r\n }\r\n },\r\n },\r\n watch: {\r\n input() {\r\n this.inputByValue();\r\n },\r\n },\r\n render() {\r\n const {\r\n $slots,\r\n classes,\r\n onClick,\r\n onKeydown,\r\n onFocus,\r\n onBlur,\r\n onChange,\r\n inputId,\r\n innerValue,\r\n disabled,\r\n trackStyles,\r\n stateLabel,\r\n labelOn,\r\n labelOff,\r\n loading,\r\n } = this;\r\n return (\r\n <div class={{ 'y-switch': true, ...classes }}>\r\n <div class=\"y-switch__slot\">\r\n <div\r\n class=\"y-switch__input\"\r\n onClick={withModifiers(onClick, ['exact'])}\r\n onKeydown={onKeydown}\r\n >\r\n <input\r\n id={inputId}\r\n aria-checked={innerValue}\r\n type=\"checkbox\"\r\n role=\"switch\"\r\n onFocus={onFocus}\r\n onBlur={onBlur}\r\n onChange={onChange}\r\n disabled={disabled}\r\n checked={innerValue}\r\n ref=\"checkbox\"\r\n />\r\n <div class=\"y-switch__track\" style={trackStyles}>\r\n {stateLabel && (\r\n <div class=\"y-switch__state\">\r\n <span class=\"y-switch__state-label y-switch__state-label--on\">\r\n {{ labelOn }}\r\n </span>\r\n <span class=\"y-switch__state-label y-switch__state-label--off\">\r\n {{ labelOff }}\r\n </span>\r\n </div>\r\n )}\r\n </div>\r\n <div class=\"y-switch__thumb\">\r\n {loading && <div class=\"y-switch__spinner\"></div>}\r\n </div>\r\n </div>\r\n <label for={inputId} class=\"y-switch__label\">\r\n {$slots.label?.()}\r\n <input hidden />\r\n </label>\r\n </div>\r\n </div>\r\n );\r\n },\r\n});\r\n\r\nexport type YSwitch = InstanceType<typeof YSwitch>;\r\n"],"mappings":";AAAA,SAAmBA,eAAe,EAAEC,aAAa,QAAQ,KAAK;AAE9D;AAEA,IAAIC,UAAU,GAAG,CAAC;AAElB,OAAO,MAAMC,OAAO,GAAGH,eAAe,CAAC;EACrCI,IAAI,EAAE,SAAS;EACfC,KAAK,EAAE;IACLC,IAAI,EAAE,OAAO;IACbC,KAAK,EAAE;EACT,CAAC;EACDC,KAAK,EAAE;IACLC,KAAK,EAAE;MACLC,IAAI,EAAE,CAACC,OAAO,EAAEC,KAAK,CAA8B;MACnDC,OAAO,EAAE;IACX,CAAC;IACDC,KAAK,EAAE;MACLJ,IAAI,EAAE,CAACK,MAAM,EAAEC,MAAM,EAAEC,MAAM;IAC/B,CAAC;IACDC,GAAG,EAAE;MACHR,IAAI,EAAEM;IACR,CAAC;IACDG,OAAO,EAAE;MACPT,IAAI,EAAEC;IACR,CAAC;IACDS,QAAQ,EAAE;MACRV,IAAI,EAAEC;IACR,CAAC;IACDU,QAAQ,EAAE;MACRX,IAAI,EAAEC;IACR,CAAC;IACDW,UAAU,EAAE;MACVZ,IAAI,EAAEC;IACR,CAAC;IACDY,KAAK,EAAE;MACLb,IAAI,EAAEK;IACR,CAAC;IACD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ch","name","model","prop","event","props","input","type","Boolean","Array","default","value","String","Number","Object","max","loading","disabled","stickOut","stateLabel","color","labelOn","labelOff","data","innerValue","counterId","focused","created","iid","toString","isArray","inputByValue","computed","isMultipleInput","multipleInputIndex","findIndex","inp","inputId","id","trackStyles","backgroundColor","classes","methods","found","find","undefined","changeMultipleInput","checked","multipleInput","slice","length","$emit","nextChange","push","splice","$nextTick","onClick","$event","changeInput","onFocus","onBlur","onKeydown","onChange","$checkbox","target","stopImmediatePropagation","watch","render","$slots","_createVNode","label"],"sources":["../../../src/components/switch/YSwitch.tsx"],"sourcesContent":["import { PropType, defineComponent, withModifiers } from 'vue';\n\nimport './YSwitch.scss';\n\nlet uidCounter = 0;\n\nexport const YSwitch = defineComponent({\n name: 'YSwitch',\n model: {\n prop: 'input',\n event: 'change',\n },\n props: {\n input: {\n type: [Boolean, Array] as PropType<boolean | any[]>,\n default: false,\n },\n value: {\n type: [String, Number, Object] as PropType<any>,\n },\n max: {\n type: Number,\n },\n loading: {\n type: Boolean,\n },\n disabled: {\n type: Boolean,\n },\n stickOut: {\n type: Boolean,\n },\n stateLabel: {\n type: Boolean,\n },\n color: {\n type: String,\n },\n labelOn: {\n type: String,\n default: 'ON',\n },\n labelOff: {\n type: String,\n default: 'OFF',\n },\n },\n data() {\n return {\n innerValue: false,\n counterId: '',\n focused: false,\n };\n },\n created() {\n const iid = uidCounter.toString();\n uidCounter += 1;\n this.counterId = iid;\n if (Array.isArray(this.input)) {\n this.inputByValue();\n } else {\n this.innerValue = this.input;\n }\n },\n computed: {\n isMultipleInput() {\n return Array.isArray(this.input);\n },\n multipleInputIndex() {\n if (!Array.isArray(this.input)) {\n return -1;\n }\n return this.input.findIndex((inp) => {\n return inp === this.value;\n });\n },\n inputId() {\n const id = this.counterId;\n return `y-switch--${id}`;\n },\n trackStyles() {\n return {\n backgroundColor: this.color,\n };\n },\n classes() {\n return {\n 'y-switch--disabled': this.disabled,\n 'y-switch--loading': this.loading,\n 'y-switch--active': this.innerValue,\n 'y-switch--stick-out': this.stickOut,\n 'y-switch--focused': this.focused,\n };\n },\n },\n methods: {\n inputByValue() {\n if (Array.isArray(this.input)) {\n const found = this.input.find((inp: any) => {\n return inp === this.value;\n });\n\n if (found !== undefined) {\n this.innerValue = true;\n } else {\n this.innerValue = false;\n }\n } else if (typeof this.input === 'boolean') {\n this.innerValue = this.input;\n }\n },\n changeMultipleInput(checked: boolean) {\n if (Array.isArray(this.input)) {\n const multipleInput = this.input.slice();\n if (\n checked &&\n this.max !== undefined &&\n multipleInput.length >= this.max\n ) {\n this.$emit('overmax');\n this.nextChange(false, multipleInput);\n return;\n }\n if (checked && this.multipleInputIndex < 0) {\n multipleInput.push(this.value);\n } else if (this.multipleInputIndex > -1) {\n multipleInput.splice(this.multipleInputIndex, 1);\n }\n this.$emit('change', multipleInput);\n }\n },\n nextChange(checked: boolean, value: any) {\n this.$nextTick(() => {\n this.innerValue = checked;\n });\n },\n onClick($event: Event) {\n if (this.disabled || this.loading) return;\n this.changeInput(!this.innerValue, $event);\n },\n onFocus() {\n this.focused = true;\n },\n onBlur() {\n this.focused = false;\n },\n onKeydown($event: KeyboardEvent) {\n // nothing\n },\n onChange($event: Event) {\n const $checkbox = $event.target as HTMLInputElement;\n const { checked } = $checkbox;\n $event.stopImmediatePropagation();\n this.changeInput(checked, $event);\n },\n changeInput(checked: boolean, event?: Event) {\n this.innerValue = checked;\n if (this.isMultipleInput) {\n this.changeMultipleInput(checked);\n } else {\n this.$emit('change', checked);\n }\n },\n },\n watch: {\n input() {\n this.inputByValue();\n },\n },\n render() {\n const {\n $slots,\n classes,\n onClick,\n onKeydown,\n onFocus,\n onBlur,\n onChange,\n inputId,\n innerValue,\n disabled,\n trackStyles,\n stateLabel,\n labelOn,\n labelOff,\n loading,\n } = this;\n return (\n <div class={{ 'y-switch': true, ...classes }}>\n <div class=\"y-switch__slot\">\n <div\n class=\"y-switch__input\"\n onClick={withModifiers(onClick, ['exact'])}\n onKeydown={onKeydown}\n >\n <input\n id={inputId}\n aria-checked={innerValue}\n type=\"checkbox\"\n role=\"switch\"\n onFocus={onFocus}\n onBlur={onBlur}\n onChange={onChange}\n disabled={disabled}\n checked={innerValue}\n ref=\"checkbox\"\n />\n <div class=\"y-switch__track\" style={trackStyles}>\n {stateLabel && (\n <div class=\"y-switch__state\">\n <span class=\"y-switch__state-label y-switch__state-label--on\">\n {{ labelOn }}\n </span>\n <span class=\"y-switch__state-label y-switch__state-label--off\">\n {{ labelOff }}\n </span>\n </div>\n )}\n </div>\n <div class=\"y-switch__thumb\">\n {loading && <div class=\"y-switch__spinner\"></div>}\n </div>\n </div>\n {$slots.label && (\n <label for={inputId} class=\"y-switch__label\">\n {$slots.label?.()}\n <input hidden />\n </label>\n )}\n </div>\n </div>\n );\n },\n});\n\nexport type YSwitch = InstanceType<typeof YSwitch>;\n"],"mappings":";AAAA,SAAmBA,eAAe,EAAEC,aAAa,QAAQ,KAAK;AAE9D;AAEA,IAAIC,UAAU,GAAG,CAAC;AAElB,OAAO,MAAMC,OAAO,GAAGH,eAAe,CAAC;EACrCI,IAAI,EAAE,SAAS;EACfC,KAAK,EAAE;IACLC,IAAI,EAAE,OAAO;IACbC,KAAK,EAAE;EACT,CAAC;EACDC,KAAK,EAAE;IACLC,KAAK,EAAE;MACLC,IAAI,EAAE,CAACC,OAAO,EAAEC,KAAK,CAA8B;MACnDC,OAAO,EAAE;IACX,CAAC;IACDC,KAAK,EAAE;MACLJ,IAAI,EAAE,CAACK,MAAM,EAAEC,MAAM,EAAEC,MAAM;IAC/B,CAAC;IACDC,GAAG,EAAE;MACHR,IAAI,EAAEM;IACR,CAAC;IACDG,OAAO,EAAE;MACPT,IAAI,EAAEC;IACR,CAAC;IACDS,QAAQ,EAAE;MACRV,IAAI,EAAEC;IACR,CAAC;IACDU,QAAQ,EAAE;MACRX,IAAI,EAAEC;IACR,CAAC;IACDW,UAAU,EAAE;MACVZ,IAAI,EAAEC;IACR,CAAC;IACDY,KAAK,EAAE;MACLb,IA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