{"version":3,"file":"button2.mjs","sources":["../../../../../../packages/components/button/src/button.vue"],"sourcesContent":["<template>\n  <component\n    :is=\"tag\"\n    ref=\"_ref\"\n    :class=\"[\n      ns.b(),\n      ns.m(_type),\n      ns.m(_size),\n      ns.is('disabled', _disabled),\n      ns.is('loading', loading),\n      ns.is('rounded', _rounded),\n      ns.is('icon', Boolean(icon || $slots.icon)),\n    ]\"\n    :aria-disabled=\"_disabled || loading\"\n    :disabled=\"_disabled || loading\"\n    :autofocus=\"autofocus\"\n    :type=\"nativeType\"\n    :data-test-name=\"Boolean(icon || $slots.icon) ? 'button-icon' : 'button'\"\n    :data-test-variant=\"_type\"\n    data-test-state=\"\"\n    @click=\"handleClick\"\n  >\n    <template v-if=\"loading\">\n      <slot v-if=\"$slots.loading\" name=\"loading\" />\n      <b-icon v-else :class=\"ns.is('loading')\">\n        <component :is=\"loadingIcon\" />\n      </b-icon>\n    </template>\n    <b-icon v-if=\"icon || $slots.icon\">\n      <component :is=\"icon\" v-if=\"icon\" />\n      <slot v-else name=\"icon\" />\n    </b-icon>\n    <template v-else>\n      <b-icon v-if=\"prefixIcon || $slots.prefixIcon\">\n        <component :is=\"prefixIcon\" v-if=\"prefixIcon\" />\n        <slot v-else name=\"prefixIcon\" />\n      </b-icon>\n      <span>\n        <slot />\n      </span>\n      <b-icon v-if=\"suffixIcon || $slots.suffixIcon\">\n        <component :is=\"suffixIcon\" v-if=\"suffixIcon\" />\n        <slot v-else name=\"suffixIcon\" />\n      </b-icon>\n    </template>\n  </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, ref } from 'vue'\nimport { BIcon } from '@bigin/components/icon'\nimport { useDisabled, useNamespace, useSize } from '@bigin/hooks'\nimport { buttonGroupContextKey } from '@bigin/tokens'\nimport { buttonEmits, buttonProps } from './button'\n\ndefineOptions({\n  name: 'BButton',\n})\n\nconst props = defineProps(buttonProps)\nconst emit = defineEmits(buttonEmits)\n\nconst buttonGroupContext = inject(buttonGroupContextKey, undefined)\nconst ns = useNamespace('button')\nconst _size = useSize(\n  computed(\n    () =>\n      (props.xlarge && 'xlarge') ||\n      (props.large && 'large') ||\n      (props.small && 'small') ||\n      (props.xsmall && 'xsmall') ||\n      (props.xxsmall && 'xxsmall') ||\n      props.size ||\n      buttonGroupContext?.size\n  )\n)\nconst _disabled = useDisabled()\nconst _ref = ref<HTMLButtonElement>()\n\nconst _type = computed(\n  () =>\n    (props.primary && 'primary') ||\n    (props.secondary && 'secondary') ||\n    (props.ghost && 'ghost') ||\n    (props.danger && 'danger') ||\n    (props.semiDanger && 'semi-danger') ||\n    props.type ||\n    buttonGroupContext?.type ||\n    ''\n)\n\nconst _rounded = computed(() => props.rounded || buttonGroupContext?.rounded)\n\n// const buttonStyle = useButtonCustomStyle(props)\n\nconst handleClick = (evt: MouseEvent) => {\n  emit('click', evt)\n}\n\ndefineExpose({\n  /** @description button html element */\n  ref: _ref,\n  /** @description button size */\n  size: _size,\n  /** @description button type */\n  type: _type,\n  /** @description button disabled */\n  disabled: _disabled,\n  /** @description button rounded */\n  rounded: _rounded,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;mCAuDc,CAAA;AAAA,EACZ,IAAM,EAAA,SAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKM,IAAA,MAAA,kBAAA,GAAqB,MAAO,CAAA,qBAAA,EAAuB,KAAS,CAAA,CAAA,CAAA;AAC5D,IAAA,MAAA,EAAA,GAAK,aAAa,QAAQ,CAAA,CAAA;AAChC,IAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,MACZ,QAAA;AAAA,QACE,MACG,KAAM,CAAA,MAAA,IAAU,YAChB,KAAM,CAAA,KAAA,IAAS,WACf,KAAM,CAAA,KAAA,IAAS,OACf,IAAA,KAAA,CAAM,UAAU,QAChB,IAAA,KAAA,CAAM,WAAW,SAClB,IAAA,KAAA,CAAM,QACN,kBAAoB,EAAA,IAAA;AAAA,OACxB;AAAA,KACF,CAAA;AACA,IAAA,MAAM,YAAY,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