{"version":3,"file":"separator.mjs","sources":["../src/separator/Separator.ts","../src/separator/Separator.vue"],"sourcesContent":["import { mergePrimitiveAttrs, type PrimitiveDefaultProps, type PrimitiveElAttrs, type RadixPrimitiveReturns } from '../shared/index.ts'\n\nexport interface SeparatorProps {\n  /**\n   * Either `vertical` or `horizontal`. Defaults to `horizontal`.\n   */\n  orientation?: 'vertical' | 'horizontal'\n  /**\n   * Whether or not the component is purely decorative. When true, accessibility-related attributes\n   * are updated so that that the rendered element is removed from the accessibility tree.\n   */\n  decorative?: boolean\n}\n\nexport const DEFAULT_SEPARATOR_PROPS = {\n  decorative: undefined,\n} satisfies PrimitiveDefaultProps<SeparatorProps>\n\nexport interface UseSeparatorProps {\n  decorative?: SeparatorProps['decorative']\n  orientation?: SeparatorProps['orientation']\n}\n\nexport function useSeparator(props: UseSeparatorProps): RadixPrimitiveReturns {\n  const { orientation = 'horizontal' } = props\n\n  return {\n    attrs(extraAttrs) {\n      const attrs: PrimitiveElAttrs = props.decorative\n        ? {\n            'role': 'none',\n            'data-orientation': orientation,\n          }\n        : {\n            'aria-orientation': orientation === 'vertical' ? orientation : undefined,\n            'role': 'separator',\n            'data-orientation': orientation,\n          }\n\n      if (extraAttrs && extraAttrs.length > 0) {\n        mergePrimitiveAttrs(attrs, extraAttrs)\n      }\n\n      return attrs\n    },\n  }\n}\n","<script setup lang=\"ts\">\nimport { Primitive } from '../primitive/index.ts'\nimport { convertPropsToHookProps, normalizeAttrs } from '../shared/index.ts'\nimport { DEFAULT_SEPARATOR_PROPS, type SeparatorProps, useSeparator } from './Separator.ts'\n\ndefineOptions({\n  name: 'Separator',\n})\n\nconst props = withDefaults(defineProps<SeparatorProps>(), DEFAULT_SEPARATOR_PROPS)\n\nconst separator = useSeparator(convertPropsToHookProps(props))\n</script>\n\n<template>\n  <Primitive v-bind=\"normalizeAttrs(separator.attrs([$attrs]))\">\n    <slot />\n  </Primitive>\n</template>\n"],"names":[],"mappings":";;;;AAcO,MAAM,uBAA0B,GAAA;AAAA,EACrC,UAAY,EAAA,KAAA;AACd;AAOO,SAAS,aAAa,KAAiD,EAAA;AAC5E,EAAM,MAAA,EAAE,WAAc,GAAA,YAAA,EAAiB,GAAA,KAAA;AAEvC,EAAO,OAAA;AAAA,IACL,MAAM,UAAY,EAAA;AAChB,MAAM,MAAA,KAAA,GAA0B,MAAM,UAClC,GAAA;AAAA,QACE,MAAQ,EAAA,MAAA;AAAA,QACR,kBAAoB,EAAA;AAAA,OAEtB,GAAA;AAAA,QACE,kBAAA,EAAoB,WAAgB,KAAA,UAAA,GAAa,WAAc,GAAA,KAAA,CAAA;AAAA,QAC/D,MAAQ,EAAA,WAAA;AAAA,QACR,kBAAoB,EAAA;AAAA,OACtB;AAEJ,MAAI,IAAA,UAAA,IAAc,UAAW,CAAA,MAAA,GAAS,CAAG,EAAA;AACvC,QAAA,mBAAA,CAAoB,OAAO,UAAU,CAAA;AAAA;AAGvC,MAAO,OAAA,KAAA;AAAA;AACT,GACF;AACF;;;;;;;;;;;;ACrCA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAEd,IAAA,MAAM,SAAY,GAAA,YAAA,CAAa,uBAAwB,CAAA,KAAK,CAAC,CAAA;;;;;;;;;;;;;;"}