{"version":3,"file":"dialog.mjs","sources":["../../../../../../../packages/components/dialog/src/dialog.ts"],"sourcesContent":["import { buildProps, definePropType, isBoolean } from '@hd-front-end/utils'\nimport { UPDATE_MODEL_EVENT } from '@hd-front-end/constants'\nimport { teleportProps } from '@hd-front-end/components/teleport'\nimport { dialogContentProps } from './dialog-content'\n\nimport type {\n  ExtractPropTypes,\n  InjectionKey,\n  TransitionProps,\n  __ExtractPublicPropTypes,\n} from 'vue'\nimport type Dialog from './dialog.vue'\n\ntype DoneFn = (cancel?: boolean) => void\n\nexport type DialogBeforeCloseFn = (done: DoneFn) => void\n\nexport type DialogTransition = string | TransitionProps\n\nexport const dialogProps = buildProps({\n  ...dialogContentProps,\n  /**\n   * @description whether to append Dialog itself to body. A nested Dialog should have this attribute set to `true`\n   */\n  appendToBody: Boolean,\n  /**\n   * @description which element the Dialog appends to\n   */\n  appendTo: {\n    type: teleportProps.to.type,\n    default: 'body',\n  },\n  /**\n   * @description callback before Dialog closes, and it will prevent Dialog from closing, use done to close the dialog\n   */\n  beforeClose: {\n    type: definePropType<DialogBeforeCloseFn>(Function),\n  },\n  /**\n   * @description destroy elements in Dialog when closed\n   */\n  destroyOnClose: Boolean,\n  /**\n   * @description whether the Dialog can be closed by clicking the mask\n   */\n  closeOnClickModal: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description whether the Dialog can be closed by pressing ESC\n   */\n  closeOnPressEscape: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description whether scroll of body is disabled while Dialog is displayed\n   */\n  lockScroll: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description whether a mask is displayed\n   */\n  modal: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description whether the mask is penetrable\n   */\n  modalPenetrable: Boolean,\n  /**\n   * @description the Time(milliseconds) before open\n   */\n  openDelay: {\n    type: Number,\n    default: 0,\n  },\n  /**\n   * @description the Time(milliseconds) before close\n   */\n  closeDelay: {\n    type: Number,\n    default: 0,\n  },\n  /**\n   * @description value for `margin-top` of Dialog CSS, default is 15vh\n   */\n  top: {\n    type: String,\n  },\n  /**\n   * @description visibility of Dialog\n   */\n  modelValue: Boolean,\n  /**\n   * @description custom class names for mask\n   */\n  modalClass: String,\n  /**\n   * @description custom class names for header wrapper\n   */\n  headerClass: String,\n  /**\n   * @description custom class names for body wrapper\n   */\n  bodyClass: String,\n  /**\n   * @description custom class names for footer wrapper\n   */\n  footerClass: String,\n  /**\n   * @description width of Dialog, default is 50%\n   */\n  width: {\n    type: [String, Number],\n  },\n  /**\n   * @description same as z-index in native CSS, z-order of dialog\n   */\n  zIndex: {\n    type: Number,\n  },\n  trapFocus: Boolean,\n  /**\n   * @description header's aria-level attribute\n   */\n  headerAriaLevel: {\n    type: String,\n    default: '2',\n  },\n  /**\n   * @description custom transition configuration for dialog animation, it can be a string (transition name) or an object with Vue transition props\n   */\n  transition: {\n    type: definePropType<DialogTransition>([String, Object]),\n    default: undefined,\n  },\n} as const)\n\nexport type DialogProps = ExtractPropTypes<typeof dialogProps>\nexport type DialogPropsPublic = __ExtractPublicPropTypes<typeof dialogProps>\n\nexport const dialogEmits = {\n  open: () => true,\n  opened: () => true,\n  close: () => true,\n  closed: () => true,\n  [UPDATE_MODEL_EVENT]: (value: boolean) => isBoolean(value),\n  openAutoFocus: () => true,\n  closeAutoFocus: () => true,\n}\nexport type DialogEmits = typeof dialogEmits\nexport type DialogInstance = InstanceType<typeof Dialog> & unknown\nexport interface DialogConfigContext {\n  alignCenter?: boolean\n  draggable?: boolean\n  overflow?: boolean\n  transition?: DialogTransition\n}\n\nexport const dialogContextKey: InjectionKey<DialogConfigContext> =\n  Symbol('dialogContextKey')\n"],"names":[],"mappings":";;;;;;AAmBO,MAAM,cAAc,UAAW,CAAA;AAAA,EACpC,GAAG,kBAAA;AAAA,EAIH,YAAc,EAAA,OAAA;AAAA,EAId,QAAU,EAAA;AAAA,IACR,IAAA,EAAM,cAAc,EAAG,CAAA,IAAA;AAAA,IACvB,OAAS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