{"version":3,"file":"segmented.mjs","sources":["../../../../../../../packages/components/segmented/src/segmented.ts"],"sourcesContent":["import {\n  buildProps,\n  definePropType,\n  isBoolean,\n  isNumber,\n  isString,\n} from '@hd-front-end/utils'\nimport { useAriaProps, useSizeProp } from '@hd-front-end/hooks'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@hd-front-end/constants'\n\nimport type { Option } from './types'\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type Segmented from './segmented.vue'\n\nexport interface Props {\n  label?: string\n  value?: string\n  disabled?: string\n}\n\nexport const defaultProps: Required<Props> = {\n  label: 'label',\n  value: 'value',\n  disabled: 'disabled',\n}\n\nexport const segmentedProps = buildProps({\n  direction: {\n    type: definePropType<'vertical' | 'horizontal'>(String),\n    default: 'horizontal',\n  },\n  /**\n   * @description options of segmented\n   */\n  options: {\n    type: definePropType<Option[]>(Array),\n    default: () => [],\n  },\n  /**\n   * @description binding value\n   */\n  modelValue: {\n    type: [String, Number, Boolean],\n    default: undefined,\n  },\n  /**\n   * @description configuration options, see the following table\n   */\n  props: {\n    type: definePropType<Props>(Object),\n    default: () => defaultProps,\n  },\n  /**\n   * @description fit width of parent content\n   */\n  block: Boolean,\n  /**\n   * @description size of component\n   */\n  size: useSizeProp,\n  /**\n   * @description whether segmented is disabled\n   */\n  disabled: Boolean,\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description native input id\n   */\n  id: String,\n  /**\n   * @description native `name` attribute\n   */\n  name: String,\n  ...useAriaProps(['ariaLabel']),\n})\n\nexport type SegmentedProps = ExtractPropTypes<typeof segmentedProps>\nexport type SegmentedPropsPublic = __ExtractPublicPropTypes<\n  typeof segmentedProps\n>\n\nexport const segmentedEmits = {\n  [UPDATE_MODEL_EVENT]: (val: any) =>\n    isString(val) || isNumber(val) || isBoolean(val),\n  [CHANGE_EVENT]: (val: any) =>\n    isString(val) || isNumber(val) || isBoolean(val),\n}\nexport type SegmentedEmits = typeof segmentedEmits\n\nexport type SegmentedInstance = InstanceType<typeof Segmented> & unknown\n"],"names":[],"mappings":";;;;;;;AAoBO,MAAM,YAAgC,GAAA;AAAA,EAC3C,KAAO,EAAA,OAAA;AAAA,EACP,KAAO,EAAA,OAAA;AAAA,EACP,QAAU,EAAA,UAAA;AACZ,EAAA;AAEO,MAAM,iBAAiB,UAAW,CAAA;AAAA,EACvC,SAAW,EAAA;AAAA,IACT,IAAA,EAAM,eAA0C,MAAM,CAAA;AAAA,IACtD,OAAS,EAAA,YAAA;AAAA,GACX;AAAA,EAIA,OAAS,EAAA;AAAA,IACP,IAAA,EAAM,eAAyB,KAAK,CAAA;AAAA,IACpC,OAAA,EAAS,MAAM,EAAC;AAAA,GAClB;AAAA,EAIA,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,CAAC,MAAQ,EAAA,MAAA,EAAQ,OAAO,CAAA;AAAA,IAC9B,OAAS,EAAA,KAAA,CAAA;AAAA,GACX;AAAA,EAIA,KAAO,EAAA;AAAA,IACL,IAAA,EAAM,eAAsB,MAAM,CAAA;AAAA,IAClC,SAAS,MAAM,YAAA;AAAA,GACjB;AAAA,EAIA,KAAO,EAAA,OAAA;AAAA,EAIP,IAAM,EAAA,WAAA;AAAA,EAIN,QAAU,EAAA,OAAA;AAAA,EAIV,aAAe,EAAA;AAAA,IACb,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AAAA,EAIA,EAAI,EAAA,MAAA;AAAA,EAIJ,IAAM,EAAA,MAAA;AAAA,EACN,GAAG,YAAA,CAAa,CAAC,WAAW,CAAC,CAAA;AAC/B,CAAC,EAAA;AAOM,MAAM,cAAiB,GAAA;AAAA,EAC5B,CAAC,kBAAqB,GAAA,CAAC,GACrB,KAAA,QAAA,CAAS,GAAG,CAAA,IAAK,QAAS,CAAA,GAAG,CAAK,IAAA,SAAA,CAAU,GAAG,CAAA;AAAA,EACjD,CAAC,YAAe,GAAA,CAAC,GACf,KAAA,QAAA,CAAS,GAAG,CAAA,IAAK,QAAS,CAAA,GAAG,CAAK,IAAA,SAAA,CAAU,GAAG,CAAA;AACnD;;;;"}