{"version":3,"file":"empty-state.cjs","sources":["../../../components/empty_state/empty_state.vue"],"sourcesContent":["<template>\n  <dt-stack\n    :class=\"emptyStateClasses\"\n  >\n    <span\n      v-if=\"showIllustration\"\n      class=\"d-empty-state__illustration\"\n    >\n      <!-- @slot Slot for the illustration. Displays when size is 'lg' or 'md'. Overrides icon. -->\n      <slot name=\"illustration\" />\n    </span>\n\n    <span\n      v-if=\"showIcon\"\n      class=\"d-empty-state__icon\"\n    >\n      <!-- @slot Slot for the icon. Displayed if illustration is not provided. -->\n      <slot\n        name=\"icon\"\n        :icon-size=\"'800'\"\n      />\n    </span>\n\n    <dt-stack\n      gap=\"450\"\n      :class=\"['d-empty-state__content', contentClass]\"\n    >\n      <div :class=\"['d-empty-state__header-text', headlineClass]\">\n        {{ headerText }}\n      </div>\n\n      <p\n        v-if=\"bodyText\"\n        :class=\"['d-empty-state__body-text', bodyClass]\"\n      >\n        {{ bodyText }}\n      </p>\n    </dt-stack>\n\n    <slot name=\"body\" />\n  </dt-stack>\n</template>\n\n<script setup>\nimport { useSlots, computed, onMounted } from 'vue';\nimport { DtStack } from '@/components/stack';\nimport { hasSlotContent } from '@/common/utils';\nimport {\n  EMPTY_STATE_BODY_SIZE_MODIFIERS,\n  EMPTY_STATE_CONTENT_SIZE_MODIFIERS,\n  EMPTY_STATE_HEADLINE_SIZE_MODIFIERS,\n  EMPTY_STATE_SIZE_MODIFIERS,\n} from './empty_state_constants.js';\n\nconst slots = useSlots();\n\nconst props = defineProps({\n  /**\n    * The empty state size.\n    * @values 'sm', 'md', 'lg'\n    */\n  size: {\n    type: String,\n    default: 'lg',\n    validator: (s) => Object.keys(EMPTY_STATE_SIZE_MODIFIERS).includes(s),\n  },\n\n  /**\n    * Header text\n    * @type {String}\n    */\n  headerText: {\n    type: String,\n    required: true,\n  },\n\n  /**\n    * Body text\n    * @type {String}\n    */\n  bodyText: {\n    type: String,\n    default: null,\n  },\n});\n\nconst hasIcon = computed(() => {\n  return hasSlotContent(slots.icon);\n});\nconst hasIllustration = computed(() => hasSlotContent(slots.illustration));\nconst isSmallSize = computed(() => props.size === 'sm');\n\n/**\n * Icon will be shown in lg and md size only if illustration is not provided\n * Icon will always be shown in sm size\n */\nconst showIcon = computed(() => hasIcon.value && (!hasIllustration.value || isSmallSize.value));\n\n/**\n * Illustration will always be shown in lg and md size\n * Illustration will not be shown in sm size\n */\nconst showIllustration = computed(() => hasIllustration.value && !isSmallSize.value);\n\nconst sizeClass = computed(() => EMPTY_STATE_SIZE_MODIFIERS[props.size]);\n\nconst emptyStateClasses = computed(() => ['d-empty-state', sizeClass.value]);\n\nconst contentClass = computed(() => EMPTY_STATE_CONTENT_SIZE_MODIFIERS[props.size]);\n\nconst headlineClass = computed(() => EMPTY_STATE_HEADLINE_SIZE_MODIFIERS[props.size]);\n\nconst bodyClass = computed(() => EMPTY_STATE_BODY_SIZE_MODIFIERS[props.size]);\n\nonMounted(() => {\n  if (!props.bodyText && !hasSlotContent(slots.body)) {\n    console.error('DtEmptyState: You should provide either bodyText or content on body slot.');\n  }\n});\n</script>\n"],"names":["slots","useSlots","props","__props","hasIcon","computed","hasSlotContent","hasIllustration","isSmallSize","showIcon","showIllustration","sizeClass","EMPTY_STATE_SIZE_MODIFIERS","emptyStateClasses","contentClass","EMPTY_STATE_CONTENT_SIZE_MODIFIERS","headlineClass","EMPTY_STATE_HEADLINE_SIZE_MODIFIERS","bodyClass","EMPTY_STATE_BODY_SIZE_MODIFIERS","onMounted"],"mappings":"+hBAsDA,MAAMA,EAAQC,EAAAA,SAAQ,EAEhBC,EAAQC,EA8BRC,EAAUC,EAAAA,SAAS,IAChBC,EAAAA,eAAeN,EAAM,IAAI,CACjC,EACKO,EAAkBF,EAAAA,SAAS,IAAMC,EAAAA,eAAeN,EAAM,YAAY,CAAC,EACnEQ,EAAcH,EAAAA,SAAS,IAAMH,EAAM,OAAS,IAAI,EAMhDO,EAAWJ,EAAAA,SAAS,IAAMD,EAAQ,QAAU,CAACG,EAAgB,OAASC,EAAY,MAAM,EAMxFE,EAAmBL,EAAAA,SAAS,IAAME,EAAgB,OAAS,CAACC,EAAY,KAAK,EAE7EG,EAAYN,EAAAA,SAAS,IAAMO,EAAAA,2BAA2BV,EAAM,IAAI,CAAC,EAEjEW,EAAoBR,EAAAA,SAAS,IAAM,CAAC,gBAAiBM,EAAU,KAAK,CAAC,EAErEG,EAAeT,EAAAA,SAAS,IAAMU,EAAAA,mCAAmCb,EAAM,IAAI,CAAC,EAE5Ec,EAAgBX,EAAAA,SAAS,IAAMY,EAAAA,oCAAoCf,EAAM,IAAI,CAAC,EAE9EgB,EAAYb,EAAAA,SAAS,IAAMc,EAAAA,gCAAgCjB,EAAM,IAAI,CAAC,EAE5EkB,OAAAA,EAAAA,UAAU,IAAM,CACV,CAAClB,EAAM,UAAY,CAACI,EAAAA,eAAeN,EAAM,IAAI,GAC/C,QAAQ,MAAM,2EAA2E,CAE7F,CAAC"}