1 |
- {"version":3,"file":"VCheckboxBtn.mjs","names":["makeVSelectionControlProps","VSelectionControl","IconValue","useProxiedModel","computed","genericComponent","propsFactory","useRender","makeVCheckboxBtnProps","indeterminate","Boolean","indeterminateIcon","type","default","falseIcon","trueIcon","VCheckboxBtn","name","props","emits","value","val","setup","_ref","slots","model","onChange","v","_createVNode","_mergeProps","$event","class","style","undefined"],"sources":["../../../src/components/VCheckbox/VCheckboxBtn.tsx"],"sourcesContent":["// Components\nimport { makeVSelectionControlProps, VSelectionControl } from '@/components/VSelectionControl/VSelectionControl'\n\n// Composables\nimport { IconValue } from '@/composables/icons'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed } from 'vue'\nimport { genericComponent, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { VSelectionControlSlots } from '@/components/VSelectionControl/VSelectionControl'\n\nexport const makeVCheckboxBtnProps = propsFactory({\n indeterminate: Boolean,\n indeterminateIcon: {\n type: IconValue,\n default: '$checkboxIndeterminate',\n },\n\n ...makeVSelectionControlProps({\n falseIcon: '$checkboxOff',\n trueIcon: '$checkboxOn',\n }),\n}, 'VCheckboxBtn')\n\nexport const VCheckboxBtn = genericComponent<VSelectionControlSlots>()({\n name: 'VCheckboxBtn',\n\n props: makeVCheckboxBtnProps(),\n\n emits: {\n 'update:modelValue': (value: any) => true,\n 'update:indeterminate': (val: boolean) => true,\n },\n\n setup (props, { slots }) {\n const indeterminate = useProxiedModel(props, 'indeterminate')\n const model = useProxiedModel(props, 'modelValue')\n\n function onChange (v: any) {\n if (indeterminate.value) {\n indeterminate.value = false\n }\n }\n\n const falseIcon = computed(() => {\n return indeterminate.value\n ? props.indeterminateIcon\n : props.falseIcon\n })\n\n const trueIcon = computed(() => {\n return indeterminate.value\n ? props.indeterminateIcon\n : props.trueIcon\n })\n\n useRender(() => (\n <VSelectionControl\n { ...props }\n v-model={ model.value }\n class={[\n 'v-checkbox-btn',\n props.class,\n ]}\n style={ props.style }\n type=\"checkbox\"\n onUpdate:modelValue={ onChange }\n falseIcon={ falseIcon.value }\n trueIcon={ trueIcon.value }\n aria-checked={ indeterminate.value ? 'mixed' : undefined }\n v-slots={ slots }\n />\n ))\n\n return {}\n },\n})\n\nexport type VCheckboxBtn = InstanceType<typeof VCheckboxBtn>\n"],"mappings":";AAAA;AAAA,SACSA,0BAA0B,EAAEC,iBAAiB,sDAEtD;AAAA,SACSC,SAAS;AAAA,SACTC,eAAe,8CAExB;AACA,SAASC,QAAQ,QAAQ,KAAK;AAAA,SACrBC,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,gCAElD;AAGA,OAAO,MAAMC,qBAAqB,GAAGF,YAAY,CAAC;EAChDG,aAAa,EAAEC,OAAO;EACtBC,iBAAiB,EAAE;IACjBC,IAAI,EAAEV,SAAS;IACfW,OAAO,EAAE;EACX,CAAC;EAED,GAAGb,0BAA0B,CAAC;IAC5Bc,SAAS,EAAE,cAAc;IACzBC,QAAQ,EAAE;EACZ,CAAC;AACH,CAAC,EAAE,cAAc,CAAC;AAElB,OAAO,MAAMC,YAAY,GAAGX,gBAAgB,EAA0B,CAAC;EACrEY,IAAI,EAAE,cAAc;EAEpBC,KAAK,EAAEV,qBAAqB,EAAE;EAE9BW,KAAK,EAAE;IACL,mBAAmB,EAAGC,KAAU,IAAK,IAAI;IACzC,sBAAsB,EAAGC,GAAY,IAAK;EAC5C,CAAC;EAEDC,KAAKA,CAAEJ,KAAK,EAAAK,IAAA,EAAa;IAAA,IAAX;MAAEC;IAAM,CAAC,GAAAD,IAAA;IACrB,MAAMd,aAAa,GAAGN,eAAe,CAACe,KAAK,EAAE,eAAe,CAAC;IAC7D,MAAMO,KAAK,GAAGtB,eAAe,CAACe,KAAK,EAAE,YAAY,CAAC;IAElD,SAASQ,QAAQA,CAAEC,CAAM,EAAE;MACzB,IAAIlB,aAAa,CAACW,KAAK,EAAE;QACvBX,aAAa,CAACW,KAAK,GAAG,KAAK;MAC7B;IACF;IAEA,MAAMN,SAAS,GAAG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