{"version":3,"file":"variant.mjs","names":["useColor","computed","unref","getCurrentInstanceName","propsFactory","allowedVariants","genOverlays","isClickable","name","_createVNode","_Fragment","makeVariantProps","color","String","variant","type","default","validator","v","includes","useVariant","props","arguments","length","undefined","variantClasses","colorClasses","colorStyles"],"sources":["../../src/composables/variant.tsx"],"sourcesContent":["// Composables\nimport { useColor } from '@/composables/color'\n\n// Utilities\nimport { computed, unref } from 'vue'\nimport { getCurrentInstanceName, propsFactory } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { MaybeRef } from '@/util'\n\nexport const allowedVariants = [\n 'elevated',\n 'flat',\n 'tonal',\n 'outlined',\n 'text',\n 'plain',\n] as const\n\nexport type Variant = typeof allowedVariants[number]\n\nexport interface VariantProps {\n color?: string\n variant: Variant\n}\n\nexport function genOverlays (isClickable: boolean, name: string) {\n return (\n <>\n { isClickable && }\n\n \n \n )\n}\n\nexport const makeVariantProps = propsFactory({\n color: String,\n variant: {\n type: String as PropType,\n default: 'elevated',\n validator: (v: any) => allowedVariants.includes(v),\n },\n}, 'variant')\n\nexport function useVariant (\n props: MaybeRef,\n name = getCurrentInstanceName(),\n) {\n const variantClasses = computed(() => {\n const { variant } = unref(props)\n return `${name}--variant-${variant}`\n })\n\n const { colorClasses, colorStyles } = useColor(computed(() => {\n const { variant, color } = unref(props)\n return {\n [['elevated', 'flat'].includes(variant) ? 'background' : 'text']: color,\n }\n }))\n\n return { colorClasses, colorStyles, variantClasses }\n}\n"],"mappings":";AAAA;AAAA,SACSA,QAAQ,uBAEjB;AACA,SAASC,QAAQ,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAC5BC,sBAAsB,EAAEC,YAAY,6BAE7C;AAIA,OAAO,MAAMC,eAAe,GAAG,CAC7B,UAAU,EACV,MAAM,EACN,OAAO,EACP,UAAU,EACV,MAAM,EACN,OAAO,CACC;AASV,OAAO,SAASC,WAAWA,CAAEC,WAAoB,EAAEC,IAAY,EAAE;EAC/D,OAAAC,YAAA,CAAA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