{"version":3,"file":"UPO7Yntd.js","sources":["../../../../node_modules/quasar/src/components/chip/QChip.js"],"sourcesContent":["import { h, computed, getCurrentInstance } from 'vue'\n\nimport QIcon from '../icon/QIcon.js'\n\nimport Ripple from '../../directives/ripple/Ripple.js'\n\nimport useDark, { useDarkProps } from '../../composables/private.use-dark/use-dark.js'\nimport useSize, { useSizeProps } from '../../composables/private.use-size/use-size.js'\n\nimport { createComponent } from '../../utils/private.create/create.js'\nimport { stopAndPrevent } from '../../utils/event/event.js'\nimport { hMergeSlotSafely, hDir } from '../../utils/private.render/render.js'\n\nexport const defaultSizes = {\n xs: 8,\n sm: 10,\n md: 14,\n lg: 20,\n xl: 24\n}\n\nexport default createComponent({\n name: 'QChip',\n\n props: {\n ...useDarkProps,\n ...useSizeProps,\n\n dense: Boolean,\n\n icon: String,\n iconRight: String,\n iconRemove: String,\n iconSelected: String,\n label: [ String, Number ],\n\n color: String,\n textColor: String,\n\n modelValue: {\n type: Boolean,\n default: true\n },\n selected: {\n type: Boolean,\n default: null\n },\n\n square: Boolean,\n outline: Boolean,\n clickable: Boolean,\n removable: Boolean,\n\n removeAriaLabel: String,\n\n tabindex: [ String, Number ],\n disable: Boolean,\n\n ripple: {\n type: [ Boolean, Object ],\n default: true\n }\n },\n\n emits: [ 'update:modelValue', 'update:selected', 'remove', 'click' ],\n\n setup (props, { slots, emit }) {\n const { proxy: { $q } } = getCurrentInstance()\n\n const isDark = useDark(props, $q)\n const sizeStyle = useSize(props, defaultSizes)\n\n const hasLeftIcon = computed(() => props.selected === true || props.icon !== void 0)\n\n const leftIcon = computed(() => (\n props.selected === true\n ? props.iconSelected || $q.iconSet.chip.selected\n : props.icon\n ))\n\n const removeIcon = computed(() => props.iconRemove || $q.iconSet.chip.remove)\n\n const isClickable = computed(() =>\n props.disable === false\n && (props.clickable === true || props.selected !== null)\n )\n\n const classes = computed(() => {\n const text = props.outline === true\n ? props.color || props.textColor\n : props.textColor\n\n return 'q-chip row inline no-wrap items-center'\n + (props.outline === false && props.color !== void 0 ? ` bg-${ props.color }` : '')\n + (text ? ` text-${ text } q-chip--colored` : '')\n + (props.disable === true ? ' disabled' : '')\n + (props.dense === true ? ' q-chip--dense' : '')\n + (props.outline === true ? ' q-chip--outline' : '')\n + (props.selected === true ? ' q-chip--selected' : '')\n + (isClickable.value === true ? ' q-chip--clickable cursor-pointer non-selectable q-hoverable' : '')\n + (props.square === true ? ' q-chip--square' : '')\n + (isDark.value === true ? ' q-chip--dark q-dark' : '')\n })\n\n const attributes = computed(() => {\n const chip = props.disable === true\n ? { tabindex: -1, 'aria-disabled': 'true' }\n : { tabindex: props.tabindex || 0 }\n\n const remove = {\n ...chip,\n role: 'button',\n 'aria-hidden': 'false',\n 'aria-label': props.removeAriaLabel || $q.lang.label.remove\n }\n\n return { chip, remove }\n })\n\n function onKeyup (e) {\n e.keyCode === 13 /* ENTER */ && onClick(e)\n }\n\n function onClick (e) {\n if (!props.disable) {\n emit('update:selected', !props.selected)\n emit('click', e)\n }\n }\n\n function onRemove (e) {\n if (e.keyCode === void 0 || e.keyCode === 13) {\n stopAndPrevent(e)\n if (props.disable === false) {\n emit('update:modelValue', false)\n emit('remove')\n }\n }\n }\n\n function getContent () {\n const child = []\n\n isClickable.value === true && child.push(\n h('div', { class: 'q-focus-helper' })\n )\n\n hasLeftIcon.value === true && child.push(\n h(QIcon, {\n class: 'q-chip__icon q-chip__icon--left',\n name: leftIcon.value\n })\n )\n\n const label = props.label !== void 0\n ? [ h('div', { class: 'ellipsis' }, [ props.label ]) ]\n : void 0\n\n child.push(\n h('div', {\n class: 'q-chip__content col row no-wrap items-center q-anchor--skip'\n }, hMergeSlotSafely(slots.default, label))\n )\n\n props.iconRight && child.push(\n h(QIcon, {\n class: 'q-chip__icon q-chip__icon--right',\n name: props.iconRight\n })\n )\n\n props.removable === true && child.push(\n h(QIcon, {\n class: 'q-chip__icon q-chip__icon--remove cursor-pointer',\n name: removeIcon.value,\n ...attributes.value.remove,\n onClick: onRemove,\n onKeyup: onRemove\n })\n )\n\n return child\n }\n\n return () => {\n if (props.modelValue === false) return\n\n const data = {\n class: classes.value,\n style: sizeStyle.value\n }\n\n isClickable.value === true && Object.assign(\n data,\n attributes.value.chip,\n { onClick, onKeyup }\n )\n\n return hDir(\n 'div',\n data,\n getContent(),\n 'ripple',\n props.ripple !== false && props.disable !== true,\n () => [ [ Ripple, props.ripple ] ]\n )\n }\n }\n})\n"],"names":["defaultSizes","__nuxt_component_10","createComponent","useDarkProps","useSizeProps","props","slots","emit","$q","getCurrentInstance","isDark","useDark","sizeStyle","useSize","hasLeftIcon","computed","leftIcon","removeIcon","isClickable","classes","text","attributes","chip","remove","onKeyup","e","onClick","onRemove","stopAndPrevent","getContent","child","h","QIcon","label","hMergeSlotSafely","data","hDir","Ripple"],"mappings":"6HAaO,MAAMA,EAAe,CAC1B,GAAI,EACJ,GAAI,GACJ,GAAI,GACJ,GAAI,GACJ,GAAI,EACN,EAEAC,EAAeC,EAAgB,CAC7B,KAAM,QAEN,MAAO,CACL,GAAGC,EACH,GAAGC,EAEH,MAAO,QAEP,KAAM,OACN,UAAW,OACX,WAAY,OACZ,aAAc,OACd,MAAO,CAAE,OAAQ,MAAQ,EAEzB,MAAO,OACP,UAAW,OAEX,WAAY,CACV,KAAM,QACN,QAAS,EACV,EACD,SAAU,CACR,KAAM,QACN,QAAS,IACV,EAED,OAAQ,QACR,QAAS,QACT,UAAW,QACX,UAAW,QAEX,gBAAiB,OAEjB,SAAU,CAAE,OAAQ,MAAQ,EAC5B,QAAS,QAET,OAAQ,CACN,KAAM,CAAE,QAAS,MAAQ,EACzB,QAAS,EACV,CACF,EAED,MAAO,CAAE,oBAAqB,kBAAmB,SAAU,OAAS,EAEpE,MAAOC,EAAO,CAAE,MAAAC,EAAO,KAAAC,CAAI,EAAI,CAC7B,KAAM,CAAE,MAAO,CAAE,GAAAC,CAAI,CAAA,EAAKC,EAAoB,EAExCC,EAASC,EAAQN,EAAOG,CAAE,EAC1BI,EAAYC,EA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