{"version":3,"file":"UModal.mjs","names":["makeComponentProps","computed","ref","Transition","UIcon","UButton","UModalActions","UntitledColorTypes","genericComponent","propsFactory","useRender","makeUModalProps","_objectSpread","isActive","Boolean","prependIcon","String","iconColor","position","destructive","dualAction","checkboxControl","smallActions","unclosable","type","text","supportingText","primaryButtonText","secondaryButtonText","checkboxText","UModal","name","props","emits","click","e","close","check","isChecked","action","isPrimary","updateIsActive","setup","_ref","emit","slots","modalContainer","modalContentContainer","onClick","closeModal","checkboxChange","actionsClick","backgroundClasses","contentClasses","concat","closeButtonClasses","headerSlotClasses","textContainerClasses","modalActionsContainerClasses","defaultSlotClasses","iconTextClasses","getIconColor","iconClasses","textClasses","supportingTextClasses","_slots$header","_slots$default","_createVNode","_default","value","header","call","linkGray"],"sources":["../../../src/components/UModal/UModal.tsx"],"sourcesContent":["import { makeComponentProps } from '@/composables/component'\nimport { computed, ref, Transition } from 'vue'\nimport ColorName from '@/types/colors'\n\nimport { UIcon } from '@/components/UIcon/UIcon'\nimport { UButton } from '@/components/UButton/UButton'\nimport { UModalActions } from '@/components/UModal/UModalActions'\nimport '@/components/UModal/transition.scss'\nimport UntitledColorTypes from '@/types/untitledColorTypes'\n\nimport { genericComponent, propsFactory, useRender } from '@/utils'\n\nexport const makeUModalProps = propsFactory(\n  {\n    isActive: Boolean,\n    prependIcon: String,\n    iconColor: String,\n    position: String,\n    destructive: Boolean,\n    dualAction: Boolean,\n    checkboxControl: Boolean,\n    smallActions: Boolean,\n    unclosable: { type: Boolean, default: false },\n    text: String,\n    supportingText: String,\n    primaryButtonText: String,\n    secondaryButtonText: String,\n    checkboxText: String,\n\n    ...makeComponentProps(),\n  },\n  'UModal'\n)\n\nexport type UModalSlots = {\n  default: never\n  header: never\n}\n\nexport const UModal = genericComponent<UModalSlots>()({\n  name: 'UModal',\n\n  props: makeUModalProps(),\n\n  emits: {\n    click: (e: MouseEvent) => true,\n    close: () => true,\n    check: (isChecked: boolean) => true,\n    action: (isPrimary: boolean) => true,\n    'update:isActive': (isActive: boolean) => true,\n  },\n\n  setup(props, { emit, slots }) {\n    const modalContainer = ref<HTMLElement | null>(null)\n    const modalContentContainer = ref<HTMLElement | null>(null)\n\n    const onClick = (e: MouseEvent) => {\n      emit('click', e)\n    }\n\n    const closeModal = () => {\n      emit('update:isActive', false)\n      emit('close')\n    }\n\n    const checkboxChange = (isChecked: boolean) => {\n      emit('check', isChecked)\n    }\n\n    const actionsClick = (isPrimary: boolean) => {\n      emit('action', isPrimary)\n    }\n\n    const backgroundClasses = computed<string>(\n      () => `modal-container absolute top-0 left-0 w-full h-full \n      flex items-center justify-center backdrop-blur-[8px] px-4\n      bg-[#344054] bg-opacity-70`\n    )\n\n    const contentClasses = computed<string>(\n      () => `box-border flex flex-col \n      relative ${\n        props.position == 'horizontal'\n          ? `max-w-[544px] items-center :sm:items-start`\n          : `max-w-[400px] items-${props.position}`\n      } bg-white p-6 rounded-md w-full sm:min-w-[400px]`\n    )\n\n    const closeButtonClasses = computed<string>(\n      () => `absolute top-[24px] right-[24px]`\n    )\n\n    const headerSlotClasses = computed<string>(\n      () => `w-full ${props.text || props.supportingText ? 'mb-[20px]' : ``}`\n    )\n\n    const textContainerClasses = computed<string>(() => `flex flex-col gap-2`)\n\n    const modalActionsContainerClasses = computed<string>(() => `w-full`)\n\n    const defaultSlotClasses = computed<string>(\n      () =>\n        `${\n          props.prependIcon || props.text || props.supportingText\n            ? 'mt-[20px]'\n            : ``\n        }`\n    )\n\n    const iconTextClasses = computed<string>(\n      () => `${\n        props.position == 'horizontal'\n          ? 'flex flex-col sm:flex-row gap-x-[28px] items-center sm:items-start'\n          : `flex-col items-${props.position}`\n      }\n      flex items-${props.position}`\n    )\n\n    const getIconColor = computed(() => {\n      return props.destructive\n        ? ('error-600' as ColorName)\n        : ((props.iconColor + '-600') as ColorName)\n    })\n\n    const iconClasses = computed<string>(\n      () =>\n        `w-[40px] h-[40px]\n      flex shrink-0 items-center justify-center\n      rounded-full\n      ${props.destructive ? 'bg-error-100' : `bg-${props.iconColor}-100`}\n      shadow-md-icon ${\n        props.destructive ? 'shadow-error-50' : `shadow-${props.iconColor}-50`\n      } mb-4`\n    )\n\n    const textClasses = computed<string>(\n      () => `text-text-lg font-semibold text-gray-900\n      ${\n        props.position == 'horizontal'\n          ? 'text-center sm:text-left'\n          : `text-${props.position}`\n      }`\n    )\n\n    const supportingTextClasses = computed<string>(\n      () => `text-text-sm text-${props.position} font-regular text-gray-600 \n      ${\n        props.position == 'horizontal'\n          ? 'text-center sm:text-left'\n          : `text-${props.position}`\n      }`\n    )\n\n    useRender(() => (\n      <Transition name=\"display\">\n        {props.isActive ? (\n          <div\n            ref={modalContainer}\n            class={backgroundClasses.value}\n            onClick={() => props.unclosable === false && closeModal()}\n          >\n            <div\n              ref={modalContentContainer}\n              class={contentClasses.value}\n              onClick={onClick}\n            >\n              <div class={iconTextClasses.value}>\n                {props.prependIcon ? (\n                  <div class={iconClasses.value}>\n                    <UIcon\n                      size=\"24\"\n                      color={getIconColor.value}\n                      icon={`$${props.prependIcon}`}\n                    ></UIcon>\n                  </div>\n                ) : null}\n\n                {slots.header ? (\n                  <div class={headerSlotClasses.value}>{slots.header?.()}</div>\n                ) : null}\n\n                {props.unclosable === false ? (\n                  <div class={closeButtonClasses.value}>\n                    <UButton type={UntitledColorTypes.linkGray}>\n                      <div class=\"close\" onClick={closeModal}>\n                        <UIcon\n                          size=\"24\"\n                          color=\"gray-500\"\n                          icon=\"$xClose\"\n                        ></UIcon>\n                      </div>\n                    </UButton>\n                  </div>\n                ) : null}\n                {props.text || props.supportingText ? (\n                  <div>\n                    <div class={textContainerClasses.value}>\n                      {props.text ? (\n                        <div class={textClasses.value}>{props.text}</div>\n                      ) : null}\n\n                      {props.supportingText ? (\n                        <div class={supportingTextClasses.value}>\n                          {props.supportingText}\n                        </div>\n                      ) : null}\n                    </div>\n                  </div>\n                ) : null}\n\n                {slots.default ? (\n                  <div class={defaultSlotClasses.value}>\n                    {slots.default?.()}\n                  </div>\n                ) : null}\n              </div>\n\n              {props.primaryButtonText ? (\n                <div class={modalActionsContainerClasses.value}>\n                  <UModalActions\n                    onAction={actionsClick}\n                    onCheck={checkboxChange}\n                    destructive={props.destructive}\n                    dualAction={props.dualAction}\n                    checkboxControl={props.checkboxControl}\n                    smallActions={props.smallActions}\n                    primaryButtonText={props.primaryButtonText}\n                    secondaryButtonText={props.secondaryButtonText}\n                    checkboxText={props.checkboxText}\n                  ></UModalActions>\n                </div>\n              ) : null}\n            </div>\n          </div>\n        ) : null}\n      </Transition>\n    ))\n    return {\n      closeModal,\n    }\n  },\n})\n\nexport type UModal = InstanceType<typeof UModal>\n"],"mappings":";;;;;;;SAASA,kBAAkB;AAC3B,SAASC,QAAQ,EAAEC,GAAG,EAAEC,UAAU,QAAQ,KAAK;AAAA,SAGtCC,KAAK;AAAA,SACLC,OAAO;AAAA,SACPC,aAAa;AAAA;AAAA,OAEfC,kBAAkB;AAAA,SAEhBC,gBAAgB,EAAEC,YAAY,EAAEC,SAAS;AAElD,OAAO,IAAMC,eAAe,GAAGF,YAAY,CAAAG,aAAA;EAEvCC,QAAQ,EAAEC,OAAO;EACjBC,WAAW,EAAEC,MAAM;EACnBC,SAAS,EAAED,MAAM;EACjBE,QAAQ,EAAEF,MAAM;EAChBG,WAAW,EAAEL,OAAO;EACpBM,UAAU,EAAEN,OAAO;EACnBO,eAAe,EAAEP,OAAO;EACxBQ,YAAY,EAAER,OAAO;EACrBS,UAAU,EAAE;IAAEC,IAAI,EAAEV,OAAO;IAAE,WAAS;EAAM,CAAC;EAC7CW,IAAI,EAAET,MAAM;EACZU,cAAc,EAAEV,MAAM;EACtBW,iBAAiB,EAAEX,MAAM;EACzBY,mBAAmB,EAAEZ,MAAM;EAC3Ba,YAAY,EAAEb;AAAM,GAEjBhB,kBAAkB,CAAC,CAAC,GAEzB,QACF,CAAC;AAOD,OAAO,IAAM8B,MAAM,GAAGtB,gBAAgB,CAAc,CAAC,CAAC;EACpDuB,IAAI,EAAE,QAA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