vuestic-ui
Version:
Vue 3 UI Framework
1 lines • 1.72 kB
Source Map (JSON)
{"version":3,"file":"useInputFieldAria.mjs","sources":["../../../../../../src/components/va-input-wrapper/hooks/useInputFieldAria.ts"],"sourcesContent":["import { ExtractPropTypes, Ref, computed } from 'vue'\nimport { useComponentUuid } from '../../../composables/useComponentUuid'\nimport { useTranslationProp } from '../../../composables'\n\nexport const useInputFieldAriaProps = {\n label: { type: String, default: '' },\n inputAriaLabel: useTranslationProp('$t:inputField'),\n inputAriaLabelledby: { type: String },\n inputAriaDescribedby: { type: String },\n}\n\nexport const useInputFieldAria = (props: ExtractPropTypes<typeof useInputFieldAriaProps>) => {\n const id = useComponentUuid()\n\n const labelId = `input-label-${id}`\n const characterCountId = `input-character-count-${id}`\n\n const ariaAttributes = computed(() => ({\n 'aria-label': props.label !== '' ? props.label : props.inputAriaLabel,\n 'aria-labelledby': props.inputAriaLabelledby ? props.inputAriaLabelledby : labelId,\n 'aria-describedby': props.inputAriaDescribedby ? props.inputAriaDescribedby : characterCountId,\n }))\n\n return {\n labelId,\n characterCountId,\n ariaAttributes,\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,yBAAyB;AAAA,EACpC,OAAO,EAAE,MAAM,QAAQ,SAAS,GAAG;AAAA,EACnC,gBAAgB,mBAAmB,eAAe;AAAA,EAClD,qBAAqB,EAAE,MAAM,OAAO;AAAA,EACpC,sBAAsB,EAAE,MAAM,OAAO;AACvC;AAEa,MAAA,oBAAoB,CAAC,UAA2D;AAC3F,QAAM,KAAK;AAEL,QAAA,UAAU,eAAe,EAAE;AAC3B,QAAA,mBAAmB,yBAAyB,EAAE;AAE9C,QAAA,iBAAiB,SAAS,OAAO;AAAA,IACrC,cAAc,MAAM,UAAU,KAAK,MAAM,QAAQ,MAAM;AAAA,IACvD,mBAAmB,MAAM,sBAAsB,MAAM,sBAAsB;AAAA,IAC3E,oBAAoB,MAAM,uBAAuB,MAAM,uBAAuB;AAAA,EAC9E,EAAA;AAEK,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}