{"version":3,"file":"collapse.mjs","names":[],"sources":["../../../../../../packages/components/collapse/src/collapse.ts"],"sourcesContent":["import {\n  buildProps,\n  definePropType,\n  isArray,\n  isNumber,\n  isString,\n  mutable,\n} from '@element-plus/utils'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\n\nimport type { ExtractPublicPropTypes } from 'vue'\nimport type { Arrayable, Awaitable } from '@element-plus/utils'\n\nexport type CollapseActiveName = string | number\nexport type CollapseModelValue = Arrayable<CollapseActiveName>\n\nexport type CollapseIconPositionType = 'left' | 'right'\n\nexport const emitChangeFn = (value: CollapseModelValue) =>\n  isNumber(value) || isString(value) || isArray(value)\n\nexport interface CollapseProps {\n  /**\n   * @description whether to activate accordion mode\n   */\n  accordion?: boolean\n  /**\n   * @description currently active panel, the type is `string` in accordion mode, otherwise it is `array`\n   */\n  modelValue?: CollapseModelValue\n  /**\n   * @description set expand icon position\n   */\n  expandIconPosition?: CollapseIconPositionType\n  /**\n   * @description before-collapse hook before the collapse state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop collapsing\n   */\n  beforeCollapse?: (name: CollapseActiveName) => Awaitable<boolean>\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `CollapseProps` instead.\n */\nexport const collapseProps = buildProps({\n  /**\n   * @description whether to activate accordion mode\n   */\n  accordion: Boolean,\n  /**\n   * @description currently active panel, the type is `string` in accordion mode, otherwise it is `array`\n   */\n  modelValue: {\n    type: definePropType<CollapseModelValue>([Array, String, Number]),\n    default: () => mutable([] as const),\n  },\n  /**\n   * @description set expand icon position\n   */\n  expandIconPosition: {\n    type: definePropType<CollapseIconPositionType>([String]),\n    default: 'right',\n  },\n  /**\n   * @description before-collapse hook before the collapse state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop collapsing\n   */\n  beforeCollapse: {\n    type: definePropType<(name: CollapseActiveName) => Awaitable<boolean>>(\n      Function\n    ),\n  },\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `CollapseProps` instead.\n */\nexport type CollapsePropsPublic = ExtractPublicPropTypes<typeof collapseProps>\n\nexport const collapseEmits = {\n  [UPDATE_MODEL_EVENT]: emitChangeFn,\n  [CHANGE_EVENT]: emitChangeFn,\n}\nexport type CollapseEmits = typeof collapseEmits\n"],"mappings":";;;;;;AAkBA,MAAa,gBAAgB,UAC3B,SAAS,MAAM,IAAI,SAAS,MAAM,IAAI,QAAQ,MAAM;;;;AAwBtD,MAAa,gBAAgB,WAAW;CAItC,WAAW;CAIX,YAAY;EACV,MAAM,eAAmC;GAAC;GAAO;GAAQ;GAAO,CAAC;EACjE,eAAe,QAAQ,EAAE,CAAU;EACpC;CAID,oBAAoB;EAClB,MAAM,eAAyC,CAAC,OAAO,CAAC;EACxD,SAAS;EACV;CAID,gBAAgB,EACd,MAAM,eACJ,SACD,EACF;CACF,CAAU;AAOX,MAAa,gBAAgB;EAC1B,qBAAqB;EACrB,eAAe;CACjB"}