ropav 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/accordion.js +0 -2
  2. package/dist/badge.js +0 -2
  3. package/dist/bem.js +0 -2
  4. package/dist/button-group.js +0 -2
  5. package/dist/button.js +0 -2
  6. package/dist/card.css +40 -20
  7. package/dist/card.js +69 -38
  8. package/dist/checkbox.js +0 -2
  9. package/dist/collapse.css +6 -6
  10. package/dist/collapse.js +3 -9
  11. package/dist/componentColors.js +0 -2
  12. package/dist/components/card/card.d.ts +4 -0
  13. package/dist/components/card/types.d.ts +4 -0
  14. package/dist/components/collapse/types.d.ts +0 -2
  15. package/dist/components/field/useField.d.ts +1 -0
  16. package/dist/components/modal/types.d.ts +0 -1
  17. package/dist/components/popover/types.d.ts +4 -1
  18. package/dist/components/popover/usePopover.d.ts +5 -2
  19. package/dist/dropdown-menu.js +0 -2
  20. package/dist/field.css +11 -8
  21. package/dist/field.js +46 -23
  22. package/dist/icon-button.js +0 -2
  23. package/dist/input.js +0 -2
  24. package/dist/modal.css +28 -28
  25. package/dist/modal.js +9 -15
  26. package/dist/overlay.js +0 -2
  27. package/dist/popover.css +16 -16
  28. package/dist/popover.js +17 -7
  29. package/dist/progress.js +0 -2
  30. package/dist/radio.js +0 -2
  31. package/dist/select.js +0 -2
  32. package/dist/slider.js +0 -2
  33. package/dist/switch.js +0 -2
  34. package/dist/tabs.js +0 -2
  35. package/dist/textarea.js +0 -2
  36. package/dist/tooltip.js +0 -2
  37. package/dist/useButtonColor.js +0 -2
  38. package/dist/useClickOutside.js +0 -2
  39. package/dist/useCollapse.js +1 -3
  40. package/dist/useControlState.js +0 -2
  41. package/dist/useRequiredInject.js +0 -2
  42. package/dist/x.js +0 -2
  43. package/package.json +6 -2
  44. package/dist/accordion.js.map +0 -1
  45. package/dist/badge.js.map +0 -1
  46. package/dist/bem.js.map +0 -1
  47. package/dist/button-group.js.map +0 -1
  48. package/dist/button.js.map +0 -1
  49. package/dist/card.js.map +0 -1
  50. package/dist/checkbox.js.map +0 -1
  51. package/dist/collapse.js.map +0 -1
  52. package/dist/componentColors.js.map +0 -1
  53. package/dist/dropdown-menu.js.map +0 -1
  54. package/dist/field.js.map +0 -1
  55. package/dist/icon-button.js.map +0 -1
  56. package/dist/input.js.map +0 -1
  57. package/dist/modal.js.map +0 -1
  58. package/dist/overlay.js.map +0 -1
  59. package/dist/popover.js.map +0 -1
  60. package/dist/progress.js.map +0 -1
  61. package/dist/radio.js.map +0 -1
  62. package/dist/select.js.map +0 -1
  63. package/dist/slider.js.map +0 -1
  64. package/dist/switch.js.map +0 -1
  65. package/dist/tabs.js.map +0 -1
  66. package/dist/textarea.js.map +0 -1
  67. package/dist/tooltip.js.map +0 -1
  68. package/dist/useButtonColor.js.map +0 -1
  69. package/dist/useClickOutside.js.map +0 -1
  70. package/dist/useCollapse.js.map +0 -1
  71. package/dist/useControlState.js.map +0 -1
  72. package/dist/useRequiredInject.js.map +0 -1
  73. package/dist/x.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkbox.js","names":[],"sources":["../src/components/checkbox/useCheckbox.ts","../src/components/checkbox/checkbox.vue","../src/components/checkbox/checkbox.vue"],"sourcesContent":["import { computed, type CSSProperties } from 'vue';\nimport { useControlState } from '@/composables/useControlState';\nimport { getComponentCustomColor, isComponentPresetColor } from '@/utils/componentColors';\nimport { bem } from '@/utils/bem';\nimport type { CheckboxProps } from './types';\n\nfunction getCheckboxColorStyle(color: CheckboxProps['color']) {\n const customColor = getComponentCustomColor(color);\n if (!customColor) return undefined;\n\n return {\n '--_rp-checkbox-custom-color': customColor,\n '--_rp-checkbox-custom-on-color': 'var(--rp-color-on-primary)',\n } satisfies CSSProperties;\n}\n\nexport function useCheckbox(props: Readonly<CheckboxProps>, emitUpdate: (value: boolean) => void) {\n const control = useControlState(props);\n\n const rootClass = computed(() =>\n bem('rp-checkbox', {\n checked: props.modelValue,\n indeterminate: props.indeterminate,\n disabled: control.disabled,\n invalid: control.invalid,\n [props.variant ?? '']: Boolean(props.variant),\n [`color-${props.color}`]: isComponentPresetColor(props.color),\n [`size-${props.size}`]: Boolean(props.size),\n [`radius-${props.radius}`]: Boolean(props.radius),\n }),\n );\n\n const rootStyle = computed(() => getCheckboxColorStyle(props.color));\n\n function onChange(e: Event) {\n emitUpdate((e.target as HTMLInputElement).checked);\n }\n\n return {\n control,\n rootClass,\n rootStyle,\n onChange,\n };\n}\n","<template>\n <label\n :class=\"rootClass\"\n :style=\"rootStyle\"\n :data-disabled=\"control.disabled || undefined\"\n :data-state=\"indeterminate ? 'indeterminate' : modelValue ? 'checked' : 'unchecked'\"\n >\n <input\n :id=\"control.id\"\n :name=\"name\"\n type=\"checkbox\"\n class=\"rp-checkbox__native\"\n :checked=\"modelValue\"\n :disabled=\"control.disabled || undefined\"\n :required=\"control.required || undefined\"\n :indeterminate=\"indeterminate\"\n :aria-checked=\"indeterminate ? 'mixed' : modelValue\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :aria-invalid=\"control.invalid || undefined\"\n :aria-required=\"control.required || undefined\"\n @change=\"onChange\"\n />\n <span class=\"rp-checkbox__box\">\n <Transition name=\"rp-checkbox-icon\" mode=\"out-in\">\n <MinusIcon v-if=\"indeterminate\" key=\"minus\" class=\"rp-checkbox__icon\" />\n <CheckIcon v-else-if=\"modelValue\" key=\"check\" class=\"rp-checkbox__icon\" />\n </Transition>\n </span>\n <span v-if=\"$slots.default\" class=\"rp-checkbox__label\">\n <slot />\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport CheckIcon from '~icons/lucide/check';\nimport MinusIcon from '~icons/lucide/minus';\nimport { useCheckbox } from './useCheckbox';\nimport type { CheckboxProps } from './types';\n\ndefineOptions({ name: 'RpCheckbox' });\n\nconst props = withDefaults(defineProps<CheckboxProps>(), {\n disabled: undefined,\n required: undefined,\n invalid: undefined,\n indeterminate: false,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: boolean];\n}>();\n\nconst { control, rootClass, rootStyle, onChange } = useCheckbox(props, (value) => {\n emit('update:modelValue', value);\n});\n</script>\n\n<style src=\"./checkbox.scss\" lang=\"scss\" scoped></style>\n","<template>\n <label\n :class=\"rootClass\"\n :style=\"rootStyle\"\n :data-disabled=\"control.disabled || undefined\"\n :data-state=\"indeterminate ? 'indeterminate' : modelValue ? 'checked' : 'unchecked'\"\n >\n <input\n :id=\"control.id\"\n :name=\"name\"\n type=\"checkbox\"\n class=\"rp-checkbox__native\"\n :checked=\"modelValue\"\n :disabled=\"control.disabled || undefined\"\n :required=\"control.required || undefined\"\n :indeterminate=\"indeterminate\"\n :aria-checked=\"indeterminate ? 'mixed' : modelValue\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :aria-invalid=\"control.invalid || undefined\"\n :aria-required=\"control.required || undefined\"\n @change=\"onChange\"\n />\n <span class=\"rp-checkbox__box\">\n <Transition name=\"rp-checkbox-icon\" mode=\"out-in\">\n <MinusIcon v-if=\"indeterminate\" key=\"minus\" class=\"rp-checkbox__icon\" />\n <CheckIcon v-else-if=\"modelValue\" key=\"check\" class=\"rp-checkbox__icon\" />\n </Transition>\n </span>\n <span v-if=\"$slots.default\" class=\"rp-checkbox__label\">\n <slot />\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport CheckIcon from '~icons/lucide/check';\nimport MinusIcon from '~icons/lucide/minus';\nimport { useCheckbox } from './useCheckbox';\nimport type { CheckboxProps } from './types';\n\ndefineOptions({ name: 'RpCheckbox' });\n\nconst props = withDefaults(defineProps<CheckboxProps>(), {\n disabled: undefined,\n required: undefined,\n invalid: undefined,\n indeterminate: false,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: boolean];\n}>();\n\nconst { control, rootClass, rootStyle, onChange } = useCheckbox(props, (value) => {\n emit('update:modelValue', value);\n});\n</script>\n\n<style src=\"./checkbox.scss\" lang=\"scss\" scoped></style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,sBAAsB,OAA+B;CAC1D,MAAM,cAAc,wBAAwB,KAAK;CACjD,IAAI,CAAC,aAAa,OAAO,KAAA;CAEzB,OAAO;EACH,+BAA+B;EAC/B,kCAAkC;CACtC;AACJ;AAEA,SAAgB,YAAY,OAAgC,YAAsC;CAC9F,MAAM,UAAU,gBAAgB,KAAK;CAErC,MAAM,YAAY,eACd,IAAI,eAAe;EACf,SAAS,MAAM;EACf,eAAe,MAAM;EACrB,UAAU,QAAQ;EAClB,SAAS,QAAQ;GAChB,MAAM,WAAW,KAAK,QAAQ,MAAM,OAAO;GAC3C,SAAS,MAAM,UAAU,uBAAuB,MAAM,KAAK;GAC3D,QAAQ,MAAM,SAAS,QAAQ,MAAM,IAAI;GACzC,UAAU,MAAM,WAAW,QAAQ,MAAM,MAAM;CACpD,CAAC,CACL;CAEA,MAAM,YAAY,eAAe,sBAAsB,MAAM,KAAK,CAAC;CAEnE,SAAS,SAAS,GAAU;EACxB,WAAY,EAAE,OAA4B,OAAO;CACrD;CAEA,OAAO;EACH;EACA;EACA;EACA;CACJ;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECAA,MAAM,QAAQ;EAOd,MAAM,OAAO;EAIb,MAAM,EAAE,SAAS,WAAW,WAAW,aAAa,YAAY,QAAQ,UAAU;GAC9E,KAAK,qBAAqB,KAAK;EACnC,CAAC;;;;SAnCY,WAAM,MAAE,MAAA,QAAA,CAAQ,CAAA,CAAA,CAAA;;;;;;;iBApBb,MAAA,SAAA,CAAS;iBACT,MAAA,SAAA,CAAS;gBAChB,iBAAe,qBAAoB,KAAA,CAAS;gBAC5C,cAAY,iBAAa,kBAAqB,cAAU,YAAA,WAAA;eAGpD,MAAI,SAAO,EAAA;eACX,QAAM,QAAA,IAAI;eAGV,WAAS,WAAU;eACnB,YAAU,qBAAoB,KAAA,CAAS;eACvC,YAAU,qBAAoB,KAAA,CAAS;eACvC,iBAAe,cAAa;eAC5B,gBAAc,iBAAa,UAAa,WAAU;eAClD,cAAY,QAAA,aAAa,KAAA,CAAS;eAClC,mBAAiB,SAAO,cAAA;eACxB,oBAAkB,SAAO,eAAA;eACzB,gBAAc,SAAO,WAAY,KAAA,CAAS;eAC1C,iBAAe,qBAAoB,KAAA,CAAS;;;;GAIjC,MAAK;GAAmB,MAAK;;yBACpB,QAAA,qBAAa;uDAAc,OAAM,oBAAmB,CAAA;oBAAjC,OAAO;;2BACrB,QAAA,kBAAU;uDAAc,OAAM,oBAAmB,CAAA;oBAAjC,OAAO;;;;;iBAGzC,OAAM,eAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"collapse.js","names":[],"sources":["../src/components/collapse/collapse.vue","../src/components/collapse/collapse.vue"],"sourcesContent":["<template>\n <div v-bind=\"rootProps\">\n <slot name=\"trigger\" v-bind=\"triggerSlotProps\" />\n\n <Transition name=\"rp-collapse-content\">\n <section v-if=\"shouldRenderContent\" v-show=\"isOpen\" v-bind=\"contentProps\">\n <div class=\"rp-collapse__inner\">\n <slot v-bind=\"contentSlotProps\" />\n </div>\n </section>\n </Transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useCollapse } from './useCollapse';\nimport type { CollapseProps } from './types';\n\ndefineOptions({ name: 'RpCollapse' });\n\nconst props = withDefaults(defineProps<CollapseProps>(), {\n open: undefined,\n defaultOpen: false,\n disabled: false,\n unmountOnExit: false,\n role: 'region',\n});\n\nconst emit = defineEmits<{\n 'update:open': [value: boolean];\n}>();\n\nconst { isOpen, shouldRenderContent, rootProps, contentProps, triggerSlotProps, contentSlotProps } =\n useCollapse(props, (open) => {\n emit('update:open', open);\n });\n</script>\n\n<style src=\"./collapse.scss\" lang=\"scss\" scoped></style>\n","<template>\n <div v-bind=\"rootProps\">\n <slot name=\"trigger\" v-bind=\"triggerSlotProps\" />\n\n <Transition name=\"rp-collapse-content\">\n <section v-if=\"shouldRenderContent\" v-show=\"isOpen\" v-bind=\"contentProps\">\n <div class=\"rp-collapse__inner\">\n <slot v-bind=\"contentSlotProps\" />\n </div>\n </section>\n </Transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useCollapse } from './useCollapse';\nimport type { CollapseProps } from './types';\n\ndefineOptions({ name: 'RpCollapse' });\n\nconst props = withDefaults(defineProps<CollapseProps>(), {\n open: undefined,\n defaultOpen: false,\n disabled: false,\n unmountOnExit: false,\n role: 'region',\n});\n\nconst emit = defineEmits<{\n 'update:open': [value: boolean];\n}>();\n\nconst { isOpen, shouldRenderContent, rootProps, contentProps, triggerSlotProps, contentSlotProps } =\n useCollapse(props, (open) => {\n emit('update:open', open);\n });\n</script>\n\n<style src=\"./collapse.scss\" lang=\"scss\" scoped></style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAIb,MAAM,EAAE,QAAQ,qBAAqB,WAAW,cAAc,kBAAkB,qBAC5E,YAAY,QAAQ,SAAS;GACzB,KAAK,eAAe,IAAI;EAC5B,CAAC;;0CAlCY,MAAA,SAAA,CAAS,CAAA,CAAA;;aACZ,WAAc,EAAA,GAAA,OAAS,MAAA,gBAAA,CAAA,EAAA,GAAA,MAAA,CAAA;;;GAEjB,MAAK;GAAjB,WAMa;;yBALM,MAAA,mBAAA,SAAmB;;;4CAA0B,MAAA,YAAA,CAAY,CAAA,CAAA;;sCAElD,MAAA,gBAAA,CAAA,EAAA,GAAA,MAAA,CAAA;yBAFsB,MAAA,MAAA,CAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"componentColors.js","names":[],"sources":["../src/utils/componentColors.ts"],"sourcesContent":["export const componentColors = [\n 'primary',\n 'secondary',\n 'success',\n 'warning',\n 'danger',\n 'info',\n 'neutral',\n] as const;\n\nexport type ComponentColor = (typeof componentColors)[number];\n\nexport type ComponentColorValue = ComponentColor | (string & {});\n\nconst componentColorNames = new Set<string>(componentColors);\n\nexport function isComponentPresetColor(\n color: ComponentColorValue | undefined,\n): color is ComponentColor {\n return Boolean(color && componentColorNames.has(color));\n}\n\nexport function getComponentCustomColor(color: ComponentColorValue | undefined) {\n if (!color || isComponentPresetColor(color)) return undefined;\n\n return color;\n}\n"],"mappings":";AAAA,IAAa,kBAAkB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAMA,IAAM,sBAAsB,IAAI,IAAY,eAAe;AAE3D,SAAgB,uBACZ,OACuB;CACvB,OAAO,QAAQ,SAAS,oBAAoB,IAAI,KAAK,CAAC;AAC1D;AAEA,SAAgB,wBAAwB,OAAwC;CAC5E,IAAI,CAAC,SAAS,uBAAuB,KAAK,GAAG,OAAO,KAAA;CAEpD,OAAO;AACX"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dropdown-menu.js","names":[],"sources":["../src/components/dropdown-menu/dropdown-menu-items.ts","../src/components/dropdown-menu/dropdown-menu-utils.ts","../src/components/dropdown-menu/useDropdownMenuDisclosure.ts","../src/components/dropdown-menu/useDropdownMenuDom.ts","../src/components/dropdown-menu/useDropdownMenuHoverIntent.ts","../src/components/dropdown-menu/useDropdownMenuInteractions.ts","../src/components/dropdown-menu/useDropdownMenuNavigation.ts","../src/components/dropdown-menu/useDropdownMenuRenderItems.ts","../src/components/dropdown-menu/useDropdownSubmenus.ts","../src/components/dropdown-menu/useDropdownMenu.ts","../src/components/dropdown-menu/dropdown-menu.vue","../src/components/dropdown-menu/dropdown-menu.vue"],"sourcesContent":["import { defineComponent, h, type PropType } from 'vue';\nimport type { DropdownMenuItemSlotProps, DropdownMenuRenderedItem } from './types';\n\nexport default defineComponent({\n name: 'RpDropdownMenuItems',\n props: {\n items: {\n type: Array as PropType<DropdownMenuRenderedItem[]>,\n required: true,\n },\n },\n setup(props, { slots }) {\n function renderItems(items: DropdownMenuRenderedItem[]) {\n return items.map((renderedItem) => {\n const children = [\n h(\n 'button',\n renderedItem.props,\n slots.item?.(renderedItem.slotProps as DropdownMenuItemSlotProps),\n ),\n ];\n\n if (renderedItem.hasSubmenu && renderedItem.submenuOpen) {\n children.push(\n h('div', renderedItem.submenuProps, renderItems(renderedItem.children)),\n );\n }\n\n return h(\n 'div',\n {\n key: renderedItem.key,\n class: 'rp-dropdown-menu__item-wrap',\n role: 'none',\n },\n children,\n );\n });\n }\n\n return () => renderItems(props.items);\n },\n});\n","import { bem } from '@/utils/bem';\nimport type {\n DropdownMenuFocusTarget,\n DropdownMenuItem,\n DropdownMenuItemPath,\n DropdownMenuOpenOptions,\n DropdownMenuPlacement,\n} from './types';\n\nexport const DEFAULT_PLACEMENT: DropdownMenuPlacement = 'bottom-start';\nexport const DEFAULT_FOCUS_TARGET: DropdownMenuFocusTarget = 'first';\n\nexport type ItemPath = DropdownMenuItemPath;\nexport type SubmenuFocusTarget = DropdownMenuFocusTarget | false;\n\nexport type PointerPoint = {\n x: number;\n y: number;\n};\n\nexport function getOpenFocusTarget(\n options: DropdownMenuOpenOptions | DropdownMenuFocusTarget | undefined,\n) {\n if (typeof options === 'string') return options;\n return options?.focus ?? DEFAULT_FOCUS_TARGET;\n}\n\nexport function getItemClass(\n item: DropdownMenuItem,\n focused: boolean,\n disabled: boolean,\n hasSubmenu: boolean,\n submenuOpen: boolean,\n) {\n return bem('rp-dropdown-menu__item', {\n focused,\n disabled,\n destructive: item.destructive,\n submenu: hasSubmenu,\n open: submenuOpen,\n });\n}\n\nexport function hasItemSubmenu(item: DropdownMenuItem) {\n return (item.children?.length ?? 0) > 0;\n}\n\nexport function hasNestedItems(items: DropdownMenuItem[]): boolean {\n return items.some((item) => hasItemSubmenu(item) || hasNestedItems(item.children ?? []));\n}\n\nexport function getPathKey(path: ItemPath) {\n return path.length === 0 ? 'root' : path.join('-');\n}\n\nexport function getParentPath(path: ItemPath) {\n return path.slice(0, -1);\n}\n\nexport function arePathsEqual(a: ItemPath, b: ItemPath) {\n return a.length === b.length && a.every((part, index) => part === b[index]);\n}\n\nexport function isPathPrefix(prefix: ItemPath, path: ItemPath) {\n return prefix.length <= path.length && prefix.every((part, index) => part === path[index]);\n}\n\nexport function normalizePath(indexOrPath: number | ItemPath): ItemPath {\n return Array.isArray(indexOrPath) ? indexOrPath : [indexOrPath];\n}\n\nexport function getEventPoint(event: MouseEvent): PointerPoint {\n return {\n x: event.clientX,\n y: event.clientY,\n };\n}\n\nexport function hasMeasuredRect(rect: DOMRect) {\n return rect.width > 0 || rect.height > 0;\n}\n\nexport function isPointInRect(point: PointerPoint, rect: DOMRect, padding = 0) {\n return (\n point.x >= rect.left - padding &&\n point.x <= rect.right + padding &&\n point.y >= rect.top - padding &&\n point.y <= rect.bottom + padding\n );\n}\n\nexport function getEnabledIndexes(items: DropdownMenuItem[]) {\n return items.map((item, index) => (item.disabled ? -1 : index)).filter((index) => index >= 0);\n}\n\nexport function getNextEnabledIndex(items: DropdownMenuItem[], index: number, direction: 1 | -1) {\n const enabledIndexes = getEnabledIndexes(items);\n if (enabledIndexes.length === 0) return undefined;\n\n if (direction === 1) {\n return enabledIndexes.find((candidate) => candidate > index) ?? enabledIndexes[0];\n }\n\n for (let i = enabledIndexes.length - 1; i >= 0; i -= 1) {\n const candidate = enabledIndexes[i]!;\n if (candidate < index) return candidate;\n }\n\n return enabledIndexes[enabledIndexes.length - 1];\n}\n","import { watch, type Ref } from 'vue';\nimport { useClickOutside } from '@/composables/useClickOutside';\nimport type {\n DropdownMenuCloseOptions,\n DropdownMenuFocusTarget,\n DropdownMenuItem,\n DropdownMenuOpenOptions,\n DropdownMenuProps,\n} from './types';\nimport { DEFAULT_FOCUS_TARGET, getOpenFocusTarget, type ItemPath } from './dropdown-menu-utils';\n\ntype BooleanSource = Readonly<Ref<boolean>>;\n\ntype UseDropdownMenuDisclosureOptions = {\n props: Readonly<DropdownMenuProps>;\n emit: {\n openChange?: (open: boolean) => void;\n select?: (item: DropdownMenuItem) => void;\n };\n rootRef: Ref<HTMLElement | null>;\n uncontrolledOpen: Ref<boolean>;\n isDisabled: BooleanSource;\n isOpen: BooleanSource;\n isVisible: BooleanSource;\n focusedPath: Ref<ItemPath>;\n resetFocus: () => void;\n resetSubmenus: () => void;\n resetHoverIntent: () => void;\n focusItem: (target: DropdownMenuFocusTarget, menuPath?: ItemPath) => boolean;\n focusMenu: () => void;\n focusTrigger: () => void;\n};\n\nexport function useDropdownMenuDisclosure({\n props,\n emit,\n rootRef,\n uncontrolledOpen,\n isDisabled,\n isOpen,\n isVisible,\n focusedPath,\n resetFocus,\n resetSubmenus,\n resetHoverIntent,\n focusItem,\n focusMenu,\n focusTrigger,\n}: UseDropdownMenuDisclosureOptions) {\n function setOpen(nextOpen: boolean) {\n if (nextOpen && isDisabled.value) return;\n\n const previousOpen = isOpen.value;\n if (props.open === undefined) uncontrolledOpen.value = nextOpen;\n if (previousOpen !== nextOpen) emit.openChange?.(nextOpen);\n }\n\n function resetMenuFocus() {\n resetFocus();\n resetSubmenus();\n resetHoverIntent();\n }\n\n function open(options?: DropdownMenuOpenOptions | DropdownMenuFocusTarget) {\n if (isDisabled.value) return;\n\n setOpen(true);\n focusItem(getOpenFocusTarget(options));\n resetSubmenus();\n resetHoverIntent();\n focusMenu();\n }\n\n function close(options: DropdownMenuCloseOptions = {}) {\n setOpen(false);\n resetMenuFocus();\n if (options.focusTrigger) focusTrigger();\n }\n\n function toggle() {\n if (isVisible.value) {\n close({ focusTrigger: true });\n } else {\n open();\n }\n }\n\n watch(isDisabled, (disabled) => {\n if (disabled) close();\n });\n\n watch(isVisible, (visible) => {\n if (visible) {\n if (focusedPath.value.length === 0) focusItem(DEFAULT_FOCUS_TARGET);\n focusMenu();\n } else {\n resetMenuFocus();\n }\n });\n\n useClickOutside(rootRef, isVisible, () => close());\n\n return {\n open,\n close,\n toggle,\n resetMenuFocus,\n };\n}\n","import { computed, nextTick, watch, type Ref } from 'vue';\nimport type { DropdownMenuPlacement } from './types';\nimport {\n arePathsEqual,\n getParentPath,\n getPathKey,\n hasMeasuredRect,\n normalizePath,\n type ItemPath,\n} from './dropdown-menu-utils';\n\ntype StringSource = {\n readonly value: string;\n};\ntype PlacementSource = {\n readonly value: DropdownMenuPlacement;\n};\n\ntype UseDropdownMenuDomOptions = {\n menuId: StringSource;\n rootRef: Ref<HTMLElement | null>;\n menuRef: Ref<HTMLElement | null>;\n placement: PlacementSource;\n focusedPath: Ref<ItemPath>;\n};\n\nexport function useDropdownMenuDom({\n menuId,\n rootRef,\n menuRef,\n placement,\n focusedPath,\n}: UseDropdownMenuDomOptions) {\n const activeDescendantId = computed(() =>\n focusedPath.value.length === 0 ? undefined : getItemId(focusedPath.value),\n );\n\n function focusMenu() {\n nextTick(() => menuRef.value?.focus());\n }\n\n function focusTrigger() {\n nextTick(() => {\n const trigger = rootRef.value?.querySelector<HTMLElement>('[aria-haspopup=\"menu\"]');\n trigger?.focus();\n });\n }\n\n function getItemId(indexOrPath: number | ItemPath) {\n return `${menuId.value}-item-${getPathKey(normalizePath(indexOrPath))}`;\n }\n\n function getSubmenuId(path: ItemPath) {\n return `${menuId.value}-submenu-${getPathKey(path)}`;\n }\n\n function getItemElement(path: ItemPath) {\n return document.getElementById(getItemId(path));\n }\n\n function getSubmenuElement(path: ItemPath) {\n return document.getElementById(getSubmenuId(path));\n }\n\n function isSubmenuOpeningLeft(path: ItemPath) {\n const submenuRect = getSubmenuElement(path)?.getBoundingClientRect();\n const itemRect = getItemElement(path)?.getBoundingClientRect();\n\n if (submenuRect && itemRect && hasMeasuredRect(submenuRect) && hasMeasuredRect(itemRect)) {\n return submenuRect.right <= itemRect.left;\n }\n\n return placement.value.endsWith('end');\n }\n\n function getMenuActiveDescendant(menuPath: ItemPath) {\n return arePathsEqual(getParentPath(focusedPath.value), menuPath)\n ? getItemId(focusedPath.value)\n : undefined;\n }\n\n watch(focusedPath, (path) => {\n if (path.length === 0) return;\n\n const targetPath = [...path];\n nextTick(() => {\n if (!arePathsEqual(targetPath, focusedPath.value)) return;\n getItemElement(targetPath)?.scrollIntoView?.({ block: 'nearest' });\n });\n });\n\n return {\n activeDescendantId,\n focusMenu,\n focusTrigger,\n getItemId,\n getSubmenuId,\n getItemElement,\n getSubmenuElement,\n isSubmenuOpeningLeft,\n getMenuActiveDescendant,\n };\n}\n","import { onUnmounted, ref, type Ref } from 'vue';\nimport type { DropdownMenuItem } from './types';\nimport {\n arePathsEqual,\n getEventPoint,\n hasMeasuredRect,\n isPathPrefix,\n isPointInRect,\n type ItemPath,\n type PointerPoint,\n} from './dropdown-menu-utils';\n\nconst SAFE_TRIANGLE_PADDING = 2;\nconst SAFE_TRIANGLE_ORIGIN_OFFSET = 2;\nconst SAFE_TRIANGLE_TIMEOUT = 400;\n\nexport type SafeTriangle = [PointerPoint, PointerPoint, PointerPoint];\ntype GetSafeTriangleOptions = {\n itemRect: DOMRect | null;\n submenuRect: DOMRect;\n origin: PointerPoint;\n};\ntype PendingHover = {\n item: DropdownMenuItem;\n path: ItemPath;\n};\ntype HoverCommit = (item: DropdownMenuItem, path: ItemPath, point?: PointerPoint) => void;\n\ntype UseDropdownMenuHoverIntentOptions = {\n openSubmenuPath: Ref<ItemPath>;\n getItemElement: (path: ItemPath) => HTMLElement | null;\n getSubmenuElement: (path: ItemPath) => HTMLElement | null;\n};\n\nfunction getTriangleArea(a: PointerPoint, b: PointerPoint, c: PointerPoint) {\n return Math.abs((a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y)) / 2);\n}\n\nfunction isPointInTriangle(point: PointerPoint, triangle: SafeTriangle) {\n const [a, b, c] = triangle;\n const area = getTriangleArea(a, b, c);\n const area1 = getTriangleArea(point, b, c);\n const area2 = getTriangleArea(a, point, c);\n const area3 = getTriangleArea(a, b, point);\n\n return Math.abs(area - (area1 + area2 + area3)) < 0.5;\n}\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.min(Math.max(value, min), max);\n}\n\nfunction clampPointToRect(point: PointerPoint, rect: DOMRect): PointerPoint {\n return {\n x: clamp(point.x, rect.left, rect.right),\n y: clamp(point.y, rect.top, rect.bottom),\n };\n}\n\nexport function getDropdownMenuSafeTriangle({\n itemRect,\n submenuRect,\n origin,\n}: GetSafeTriangleOptions): SafeTriangle {\n const measuredItemRect = itemRect && hasMeasuredRect(itemRect) ? itemRect : null;\n const opensRight = !measuredItemRect || submenuRect.left >= measuredItemRect.right;\n const edgeX = opensRight ? submenuRect.left : submenuRect.right;\n const boundedOrigin = measuredItemRect ? clampPointToRect(origin, measuredItemRect) : origin;\n const expandedOrigin = {\n x:\n boundedOrigin.x +\n (opensRight ? -SAFE_TRIANGLE_ORIGIN_OFFSET : SAFE_TRIANGLE_ORIGIN_OFFSET),\n y: boundedOrigin.y,\n };\n\n return [\n expandedOrigin,\n {\n x: edgeX,\n y: submenuRect.top - SAFE_TRIANGLE_PADDING,\n },\n {\n x: edgeX,\n y: submenuRect.bottom + SAFE_TRIANGLE_PADDING,\n },\n ];\n}\n\nexport function useDropdownMenuHoverIntent({\n openSubmenuPath,\n getItemElement,\n getSubmenuElement,\n}: UseDropdownMenuHoverIntentOptions) {\n const safeTriangleOrigin = ref<PointerPoint | null>(null);\n let latestPointerPoint: PointerPoint | null = null;\n let pendingHover: PendingHover | null = null;\n let pendingHoverTimer: number | undefined;\n\n function clearPendingHover() {\n pendingHover = null;\n if (pendingHoverTimer !== undefined) {\n window.clearTimeout(pendingHoverTimer);\n pendingHoverTimer = undefined;\n }\n }\n\n function resetHoverIntent() {\n safeTriangleOrigin.value = null;\n latestPointerPoint = null;\n clearPendingHover();\n }\n\n function getFallbackTriangleOrigin(path: ItemPath): PointerPoint | null {\n const itemRect = getItemElement(path)?.getBoundingClientRect();\n if (!itemRect) return null;\n\n const submenuRect = getSubmenuElement(path)?.getBoundingClientRect();\n const opensRight = !submenuRect || submenuRect.left >= itemRect.right;\n return {\n x: opensRight ? itemRect.right : itemRect.left,\n y: itemRect.top + itemRect.height / 2,\n };\n }\n\n function trackSubmenuOpen(path: ItemPath, point?: PointerPoint) {\n safeTriangleOrigin.value = point ?? getFallbackTriangleOrigin(path);\n clearPendingHover();\n }\n\n function isPointInCurrentSubmenu(point: PointerPoint) {\n if (openSubmenuPath.value.length === 0) return false;\n\n const submenuRect = getSubmenuElement(openSubmenuPath.value)?.getBoundingClientRect();\n return submenuRect ? isPointInRect(point, submenuRect, SAFE_TRIANGLE_PADDING) : false;\n }\n\n function getSafeTriangle(path: ItemPath): SafeTriangle | null {\n const submenuRect = getSubmenuElement(path)?.getBoundingClientRect();\n const itemRect = getItemElement(path)?.getBoundingClientRect();\n const origin = safeTriangleOrigin.value ?? getFallbackTriangleOrigin(path);\n\n if (!submenuRect || !origin) return null;\n\n return getDropdownMenuSafeTriangle({\n itemRect: itemRect ?? null,\n submenuRect,\n origin,\n });\n }\n\n function updateSafeTriangleOrigin(point: PointerPoint) {\n if (openSubmenuPath.value.length === 0) return;\n\n const itemRect = getItemElement(openSubmenuPath.value)?.getBoundingClientRect();\n if (itemRect && isPointInRect(point, itemRect)) {\n safeTriangleOrigin.value = point;\n }\n }\n\n function shouldDelayHover(path: ItemPath, point: PointerPoint) {\n if (openSubmenuPath.value.length === 0) return false;\n if (arePathsEqual(path, openSubmenuPath.value)) return false;\n if (isPathPrefix(openSubmenuPath.value, path)) return false;\n if (isPointInCurrentSubmenu(point)) return true;\n\n const triangle = getSafeTriangle(openSubmenuPath.value);\n return triangle ? isPointInTriangle(point, triangle) : false;\n }\n\n function delayHoveredItem(item: DropdownMenuItem, path: ItemPath, commit: HoverCommit) {\n pendingHover = {\n item,\n path,\n };\n\n if (pendingHoverTimer !== undefined) window.clearTimeout(pendingHoverTimer);\n pendingHoverTimer = window.setTimeout(() => {\n if (!pendingHover) return;\n\n const nextHover = pendingHover;\n if (latestPointerPoint && isPointInCurrentSubmenu(latestPointerPoint)) {\n clearPendingHover();\n return;\n }\n\n commit(nextHover.item, nextHover.path);\n }, SAFE_TRIANGLE_TIMEOUT);\n }\n\n function handleItemHover(\n item: DropdownMenuItem,\n path: ItemPath,\n event: MouseEvent | undefined,\n commit: HoverCommit,\n ) {\n const point = event ? getEventPoint(event) : undefined;\n latestPointerPoint = point ?? latestPointerPoint;\n\n if (point && shouldDelayHover(path, point)) {\n delayHoveredItem(item, path, commit);\n return;\n }\n\n commit(item, path, point);\n }\n\n function handleMenuMousemove(event: MouseEvent, commit: HoverCommit) {\n const point = getEventPoint(event);\n latestPointerPoint = point;\n updateSafeTriangleOrigin(point);\n if (!pendingHover) return;\n\n if (shouldDelayHover(pendingHover.path, point)) return;\n\n const nextHover = pendingHover;\n commit(nextHover.item, nextHover.path, point);\n }\n\n onUnmounted(clearPendingHover);\n\n return {\n clearPendingHover,\n resetHoverIntent,\n trackSubmenuOpen,\n handleItemHover,\n handleMenuMousemove,\n };\n}\n","import type { Ref } from 'vue';\nimport type {\n DropdownMenuCloseOptions,\n DropdownMenuFocusTarget,\n DropdownMenuItem,\n DropdownMenuOpenOptions,\n DropdownMenuProps,\n} from './types';\nimport {\n arePathsEqual,\n DEFAULT_FOCUS_TARGET,\n getEventPoint,\n getParentPath,\n hasItemSubmenu,\n normalizePath,\n type ItemPath,\n type PointerPoint,\n type SubmenuFocusTarget,\n} from './dropdown-menu-utils';\n\ntype BooleanSource = Readonly<Ref<boolean>>;\n\ntype DisclosureControls = {\n open: (options?: DropdownMenuOpenOptions | DropdownMenuFocusTarget) => void;\n close: (options?: DropdownMenuCloseOptions) => void;\n toggle: () => void;\n};\n\ntype SubmenuControls = {\n closeSubmenusAfter: (menuPath: ItemPath) => void;\n openSubmenu: (path: ItemPath, focus?: SubmenuFocusTarget) => boolean;\n closeSubmenu: (path: ItemPath) => boolean;\n closeCurrentSubmenu: () => boolean;\n};\n\ntype HoverIntentControls = {\n clearPendingHover: () => void;\n resetHoverIntent: () => void;\n trackSubmenuOpen: (path: ItemPath, point?: PointerPoint) => void;\n handleItemHover: (\n item: DropdownMenuItem,\n path: ItemPath,\n event: MouseEvent | undefined,\n commit: (item: DropdownMenuItem, path: ItemPath, point?: PointerPoint) => void,\n ) => void;\n handleMenuMousemove: (\n event: MouseEvent,\n commit: (item: DropdownMenuItem, path: ItemPath, point?: PointerPoint) => void,\n ) => void;\n};\n\ntype UseDropdownMenuInteractionsOptions = {\n props: Readonly<DropdownMenuProps>;\n emit: {\n select?: (item: DropdownMenuItem) => void;\n };\n isDisabled: BooleanSource;\n focusedPath: Ref<ItemPath>;\n openSubmenuPath: Ref<ItemPath>;\n getItemAtPath: (path: ItemPath) => DropdownMenuItem | undefined;\n focusItem: (target: DropdownMenuFocusTarget, menuPath?: ItemPath) => boolean;\n moveFocus: (direction: 1 | -1) => ItemPath | undefined;\n submenus: SubmenuControls;\n hoverIntent: HoverIntentControls;\n disclosure: DisclosureControls;\n isSubmenuOpeningLeft: (path: ItemPath) => boolean;\n};\n\nexport function useDropdownMenuInteractions({\n props,\n emit,\n isDisabled,\n focusedPath,\n openSubmenuPath,\n getItemAtPath,\n focusItem,\n moveFocus,\n submenus,\n hoverIntent,\n disclosure,\n isSubmenuOpeningLeft,\n}: UseDropdownMenuInteractionsOptions) {\n function activateItem(item: DropdownMenuItem, path: ItemPath, event?: MouseEvent) {\n if (item.disabled) return;\n\n if (hasItemSubmenu(item)) {\n openSubmenu(path, DEFAULT_FOCUS_TARGET, event ? getEventPoint(event) : undefined);\n return;\n }\n\n selectItem(item);\n }\n\n function selectItem(item: DropdownMenuItem) {\n if (item.disabled) return;\n\n emit.select?.(item);\n if (props.closeOnSelect !== false) {\n disclosure.close({ focusTrigger: true });\n }\n }\n\n function closeSubmenusAfter(menuPath: ItemPath) {\n submenus.closeSubmenusAfter(menuPath);\n hoverIntent.resetHoverIntent();\n }\n\n function openSubmenu(\n path: ItemPath,\n focus: SubmenuFocusTarget = DEFAULT_FOCUS_TARGET,\n point?: PointerPoint,\n ) {\n const opened = submenus.openSubmenu(path, focus);\n if (opened) hoverIntent.trackSubmenuOpen(path, point);\n return opened;\n }\n\n function closeSubmenu(path: ItemPath) {\n const closed = submenus.closeSubmenu(path);\n if (closed) hoverIntent.resetHoverIntent();\n return closed;\n }\n\n function closeCurrentSubmenu() {\n const closed = submenus.closeCurrentSubmenu();\n if (closed) hoverIntent.resetHoverIntent();\n return closed;\n }\n\n function commitHoveredItem(item: DropdownMenuItem, path: ItemPath, point?: PointerPoint) {\n hoverIntent.clearPendingHover();\n focusedPath.value = [...path];\n\n if (hasItemSubmenu(item)) {\n openSubmenu(path, false, point);\n } else {\n closeSubmenusAfter(getParentPath(path));\n }\n }\n\n function focusHoveredItem(\n item: DropdownMenuItem,\n indexOrPath: number | ItemPath,\n event?: MouseEvent,\n ) {\n if (item.disabled) return;\n\n const path = normalizePath(indexOrPath);\n hoverIntent.handleItemHover(item, path, event, commitHoveredItem);\n }\n\n function selectFocusedItem() {\n const item = getItemAtPath(focusedPath.value);\n if (!item) return;\n activateItem(item, focusedPath.value);\n }\n\n function moveFocusedItem(direction: 1 | -1) {\n const menuPath = moveFocus(direction);\n if (menuPath) closeSubmenusAfter(menuPath);\n }\n\n function onTriggerClick() {\n disclosure.toggle();\n }\n\n function onTriggerKeydown(event: KeyboardEvent) {\n if (isDisabled.value) return;\n\n switch (event.key) {\n case 'Enter':\n case ' ':\n case 'ArrowDown':\n event.preventDefault();\n disclosure.open();\n break;\n case 'ArrowUp':\n event.preventDefault();\n disclosure.open({ focus: 'last' });\n break;\n case 'Escape':\n disclosure.close({ focusTrigger: true });\n break;\n }\n }\n\n function onMenuKeydown(event: KeyboardEvent) {\n hoverIntent.resetHoverIntent();\n\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n moveFocusedItem(1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n moveFocusedItem(-1);\n break;\n case 'Home':\n event.preventDefault();\n focusItem('first', getParentPath(focusedPath.value));\n break;\n case 'End':\n event.preventDefault();\n focusItem('last', getParentPath(focusedPath.value));\n break;\n case 'ArrowRight':\n case 'ArrowLeft':\n onMenuHorizontalKeydown(event);\n break;\n case 'Enter':\n case ' ':\n event.preventDefault();\n selectFocusedItem();\n break;\n case 'Escape':\n event.preventDefault();\n if (!closeCurrentSubmenu()) disclosure.close({ focusTrigger: true });\n break;\n case 'Tab':\n disclosure.close();\n break;\n }\n }\n\n function onMenuHorizontalKeydown(event: KeyboardEvent) {\n const isRight = event.key === 'ArrowRight';\n const currentMenuPath = getParentPath(focusedPath.value);\n const closePath =\n focusedPath.value.length > 1\n ? currentMenuPath\n : arePathsEqual(focusedPath.value, openSubmenuPath.value)\n ? focusedPath.value\n : undefined;\n\n if (closePath && isRight === isSubmenuOpeningLeft(closePath)) {\n event.preventDefault();\n closeSubmenu(closePath);\n return;\n }\n\n const item = getItemAtPath(focusedPath.value);\n if (!item || item.disabled || !hasItemSubmenu(item)) return;\n\n const nextSubmenuOpensLeft = isSubmenuOpeningLeft(focusedPath.value);\n if (isRight === nextSubmenuOpensLeft) return;\n\n event.preventDefault();\n openSubmenu(focusedPath.value);\n }\n\n function onMenuMousemove(event: MouseEvent) {\n hoverIntent.handleMenuMousemove(event, commitHoveredItem);\n }\n\n function onMenuMouseleave() {\n hoverIntent.resetHoverIntent();\n }\n\n return {\n activateItem,\n selectItem,\n openSubmenu,\n closeSubmenu,\n focusHoveredItem,\n onTriggerClick,\n onTriggerKeydown,\n onMenuKeydown,\n onMenuMousemove,\n onMenuMouseleave,\n };\n}\n","import { computed, ref } from 'vue';\nimport type { DropdownMenuFocusTarget, DropdownMenuItem } from './types';\nimport {\n arePathsEqual,\n getEnabledIndexes,\n getNextEnabledIndex,\n getParentPath,\n normalizePath,\n type ItemPath,\n} from './dropdown-menu-utils';\n\ntype DropdownMenuItemsSource = {\n readonly value: DropdownMenuItem[];\n};\n\nexport function useDropdownMenuNavigation(items: DropdownMenuItemsSource) {\n const focusedPath = ref<ItemPath>([]);\n const focusedIndex = computed(() => focusedPath.value[0] ?? -1);\n\n function getItemsAtPath(path: ItemPath) {\n let currentItems = items.value;\n for (const index of path) {\n const item = currentItems[index];\n if (!item) return [];\n currentItems = item.children ?? [];\n }\n return currentItems;\n }\n\n function getItemAtPath(path: ItemPath) {\n if (path.length === 0) return undefined;\n const parentItems = getItemsAtPath(getParentPath(path));\n return parentItems[path[path.length - 1]];\n }\n\n function focusItem(target: DropdownMenuFocusTarget, menuPath: ItemPath = []) {\n const enabledIndexes = getEnabledIndexes(getItemsAtPath(menuPath));\n const index =\n target === 'last' ? enabledIndexes[enabledIndexes.length - 1] : enabledIndexes[0];\n\n if (index === undefined) {\n if (menuPath.length === 0) focusedPath.value = [];\n return false;\n }\n\n focusedPath.value = [...menuPath, index];\n return true;\n }\n\n function resetFocus() {\n focusedPath.value = [];\n }\n\n function isItemFocused(indexOrPath: number | ItemPath) {\n return arePathsEqual(normalizePath(indexOrPath), focusedPath.value);\n }\n\n function moveFocus(direction: 1 | -1) {\n const menuPath = getParentPath(focusedPath.value);\n const itemsAtPath = getItemsAtPath(menuPath);\n const currentIndex =\n focusedPath.value.length === 0\n ? direction === 1\n ? -1\n : itemsAtPath.length\n : focusedPath.value[focusedPath.value.length - 1]!;\n const nextIndex = getNextEnabledIndex(itemsAtPath, currentIndex, direction);\n\n if (nextIndex === undefined) {\n focusedPath.value = [];\n return undefined;\n }\n\n focusedPath.value = [...menuPath, nextIndex];\n return menuPath;\n }\n\n return {\n focusedPath,\n focusedIndex,\n getItemsAtPath,\n getItemAtPath,\n focusItem,\n resetFocus,\n isItemFocused,\n moveFocus,\n };\n}\n","import { computed } from 'vue';\nimport { bem } from '@/utils/bem';\nimport type {\n DropdownMenuCloseOptions,\n DropdownMenuFocusTarget,\n DropdownMenuItem,\n DropdownMenuItemProps,\n DropdownMenuItemSlotProps,\n DropdownMenuRenderedItem,\n DropdownMenuSubmenuProps,\n} from './types';\nimport {\n DEFAULT_FOCUS_TARGET,\n getItemClass,\n getPathKey,\n hasItemSubmenu,\n hasNestedItems,\n normalizePath,\n type ItemPath,\n} from './dropdown-menu-utils';\n\ntype DropdownMenuItemsSource = {\n readonly value: DropdownMenuItem[];\n};\n\ntype UseDropdownMenuRenderItemsOptions = {\n items: DropdownMenuItemsSource;\n getItemId: (path: ItemPath) => string;\n getSubmenuId: (path: ItemPath) => string;\n getMenuActiveDescendant: (path: ItemPath) => string | undefined;\n isItemFocused: (indexOrPath: number | ItemPath) => boolean;\n isSubmenuOpen: (path: ItemPath) => boolean;\n activateItem: (item: DropdownMenuItem, path: ItemPath, event?: MouseEvent) => void;\n focusHoveredItem: (\n item: DropdownMenuItem,\n indexOrPath: number | ItemPath,\n event?: MouseEvent,\n ) => void;\n selectItem: (item: DropdownMenuItem) => void;\n openSubmenu: (path: ItemPath, focus?: DropdownMenuFocusTarget) => void;\n closeSubmenu: (path: ItemPath) => void;\n close: (options?: DropdownMenuCloseOptions) => void;\n};\n\nexport function useDropdownMenuRenderItems({\n items,\n getItemId,\n getSubmenuId,\n getMenuActiveDescendant,\n isItemFocused,\n isSubmenuOpen,\n activateItem,\n focusHoveredItem,\n selectItem,\n openSubmenu,\n closeSubmenu,\n close,\n}: UseDropdownMenuRenderItemsOptions) {\n const renderedItems = computed<DropdownMenuRenderedItem[]>(() => getRenderedItems(items.value));\n\n function getRenderedItems(\n dropdownItems: DropdownMenuItem[],\n parentPath: ItemPath = [],\n ): DropdownMenuRenderedItem[] {\n return dropdownItems.map((item, index) => {\n const path = [...parentPath, index];\n const level = parentPath.length;\n const focused = isItemFocused(path);\n const disabled = Boolean(item.disabled);\n const hasSubmenu = hasItemSubmenu(item);\n const submenuOpen = hasSubmenu && isSubmenuOpen(path);\n\n return {\n item,\n index,\n key: `${getPathKey(path)}:${String(item.value)}`,\n path,\n level,\n focused,\n disabled,\n hasSubmenu,\n submenuOpen,\n props: getItemProps(item, path, focused, disabled),\n submenuProps: hasSubmenu ? getSubmenuProps(item, path) : undefined,\n slotProps: getItemSlotProps(item, path, focused, disabled),\n children: hasSubmenu ? getRenderedItems(item.children ?? [], path) : [],\n };\n });\n }\n\n function getItemProps(\n item: DropdownMenuItem,\n indexOrPath: number | ItemPath,\n focused = isItemFocused(indexOrPath),\n disabled = Boolean(item.disabled),\n ): DropdownMenuItemProps {\n const path = normalizePath(indexOrPath);\n const hasSubmenu = hasItemSubmenu(item);\n const submenuOpen = hasSubmenu && isSubmenuOpen(path);\n\n return {\n id: getItemId(path),\n type: 'button',\n role: 'menuitem',\n tabindex: -1,\n class: getItemClass(item, focused, disabled, hasSubmenu, submenuOpen),\n 'aria-controls': hasSubmenu ? getSubmenuId(path) : undefined,\n 'aria-expanded': hasSubmenu ? submenuOpen : undefined,\n 'aria-haspopup': hasSubmenu ? 'menu' : undefined,\n 'aria-disabled': disabled || undefined,\n 'data-disabled': disabled || undefined,\n 'data-focused': focused || undefined,\n 'data-submenu': hasSubmenu || undefined,\n onClick: (event) => activateItem(item, path, event),\n onMouseenter: (event) => focusHoveredItem(item, path, event),\n };\n }\n\n function getSubmenuProps(item: DropdownMenuItem, path: ItemPath): DropdownMenuSubmenuProps {\n return {\n id: getSubmenuId(path),\n role: 'menu',\n class: bem('rp-dropdown-menu__submenu', {\n open: isSubmenuOpen(path),\n 'has-submenu': hasNestedItems(item.children ?? []),\n }),\n 'aria-label': item.label,\n 'aria-activedescendant': getMenuActiveDescendant(path),\n };\n }\n\n function getItemSlotProps(\n item: DropdownMenuItem,\n indexOrPath: number | ItemPath,\n focused = isItemFocused(indexOrPath),\n disabled = Boolean(item.disabled),\n ): DropdownMenuItemSlotProps {\n const path = normalizePath(indexOrPath);\n const hasSubmenu = hasItemSubmenu(item);\n\n return {\n item,\n index: path[path.length - 1] ?? -1,\n path,\n level: path.length - 1,\n focused,\n disabled,\n hasSubmenu,\n isSubmenuOpen: hasSubmenu && isSubmenuOpen(path),\n select: () => selectItem(item),\n openSubmenu: (focus = DEFAULT_FOCUS_TARGET) => openSubmenu(path, focus),\n closeSubmenu: () => closeSubmenu(path),\n close,\n };\n }\n\n return {\n renderedItems,\n getItemProps,\n getItemSlotProps,\n };\n}\n","import { ref, type Ref } from 'vue';\nimport type { DropdownMenuItem } from './types';\nimport {\n DEFAULT_FOCUS_TARGET,\n getParentPath,\n hasItemSubmenu,\n isPathPrefix,\n type ItemPath,\n type SubmenuFocusTarget,\n} from './dropdown-menu-utils';\n\ntype UseDropdownSubmenusOptions = {\n focusedPath: Ref<ItemPath>;\n getItemAtPath: (path: ItemPath) => DropdownMenuItem | undefined;\n focusItem: (target: Exclude<SubmenuFocusTarget, false>, menuPath?: ItemPath) => boolean;\n};\n\nexport function useDropdownSubmenus({\n focusedPath,\n getItemAtPath,\n focusItem,\n}: UseDropdownSubmenusOptions) {\n const openSubmenuPath = ref<ItemPath>([]);\n\n function resetSubmenus() {\n openSubmenuPath.value = [];\n }\n\n function isSubmenuOpen(path: ItemPath) {\n return path.length > 0 && isPathPrefix(path, openSubmenuPath.value);\n }\n\n function closeSubmenusAfter(menuPath: ItemPath) {\n openSubmenuPath.value = [...menuPath];\n }\n\n function openSubmenu(path: ItemPath, focus: SubmenuFocusTarget = DEFAULT_FOCUS_TARGET) {\n const item = getItemAtPath(path);\n if (!item || item.disabled || !hasItemSubmenu(item)) return false;\n\n openSubmenuPath.value = [...path];\n if (focus && !focusItem(focus, path)) focusedPath.value = [...path];\n return true;\n }\n\n function closeSubmenu(path: ItemPath) {\n if (!isSubmenuOpen(path)) return false;\n\n openSubmenuPath.value = getParentPath(path);\n if (isPathPrefix(path, focusedPath.value) && focusedPath.value.length > path.length) {\n focusedPath.value = [...path];\n }\n return true;\n }\n\n function closeCurrentSubmenu() {\n const path =\n focusedPath.value.length > 1 ? getParentPath(focusedPath.value) : focusedPath.value;\n\n if (path.length === 0 || !isSubmenuOpen(path)) return false;\n\n return closeSubmenu(path);\n }\n\n return {\n openSubmenuPath,\n resetSubmenus,\n isSubmenuOpen,\n closeSubmenusAfter,\n openSubmenu,\n closeSubmenu,\n closeCurrentSubmenu,\n };\n}\n","import { computed, ref, useId } from 'vue';\nimport { bem } from '@/utils/bem';\nimport type {\n DropdownMenuContentProps,\n DropdownMenuItem,\n DropdownMenuProps,\n DropdownMenuSlotProps,\n DropdownMenuTriggerProps,\n} from './types';\nimport { DEFAULT_PLACEMENT, hasNestedItems } from './dropdown-menu-utils';\nimport { useDropdownMenuDisclosure } from './useDropdownMenuDisclosure';\nimport { useDropdownMenuDom } from './useDropdownMenuDom';\nimport { useDropdownMenuHoverIntent } from './useDropdownMenuHoverIntent';\nimport { useDropdownMenuInteractions } from './useDropdownMenuInteractions';\nimport { useDropdownMenuNavigation } from './useDropdownMenuNavigation';\nimport { useDropdownMenuRenderItems } from './useDropdownMenuRenderItems';\nimport { useDropdownSubmenus } from './useDropdownSubmenus';\n\nexport function useDropdownMenu(\n props: Readonly<DropdownMenuProps>,\n emit: {\n openChange?: (open: boolean) => void;\n select?: (item: DropdownMenuItem) => void;\n } = {},\n) {\n const rootRef = ref<HTMLElement | null>(null);\n const menuRef = ref<HTMLElement | null>(null);\n const uncontrolledOpen = ref(false);\n\n const generatedId = useId();\n const menuId = computed(() => props.id ?? `${generatedId}-menu`);\n const placement = computed(() => props.placement ?? DEFAULT_PLACEMENT);\n const visibleItems = computed(() => props.items ?? []);\n const isDisabled = computed(() => Boolean(props.disabled));\n const isOpen = computed(() => props.open ?? uncontrolledOpen.value);\n const isVisible = computed(() => isOpen.value && !isDisabled.value);\n const contentHasSubmenu = computed(() => hasNestedItems(visibleItems.value));\n const isEmpty = computed(() => visibleItems.value.length === 0);\n\n const {\n focusedPath,\n focusedIndex,\n getItemAtPath,\n focusItem,\n resetFocus,\n isItemFocused,\n moveFocus,\n } = useDropdownMenuNavigation(visibleItems);\n\n const submenus = useDropdownSubmenus({\n focusedPath,\n getItemAtPath,\n focusItem,\n });\n const { openSubmenuPath, isSubmenuOpen } = submenus;\n\n const {\n activeDescendantId,\n focusMenu,\n focusTrigger,\n getItemId,\n getSubmenuId,\n getItemElement,\n getSubmenuElement,\n isSubmenuOpeningLeft,\n getMenuActiveDescendant,\n } = useDropdownMenuDom({\n menuId,\n rootRef,\n menuRef,\n placement,\n focusedPath,\n });\n\n const hoverIntent = useDropdownMenuHoverIntent({\n openSubmenuPath,\n getItemElement,\n getSubmenuElement,\n });\n\n const disclosure = useDropdownMenuDisclosure({\n props,\n emit,\n rootRef,\n uncontrolledOpen,\n isDisabled,\n isOpen,\n isVisible,\n focusedPath,\n resetFocus,\n resetSubmenus: submenus.resetSubmenus,\n resetHoverIntent: hoverIntent.resetHoverIntent,\n focusItem,\n focusMenu,\n focusTrigger,\n });\n const { open, close, toggle } = disclosure;\n\n const {\n activateItem,\n selectItem,\n openSubmenu,\n closeSubmenu,\n focusHoveredItem,\n onTriggerClick,\n onTriggerKeydown,\n onMenuKeydown,\n onMenuMousemove,\n onMenuMouseleave,\n } = useDropdownMenuInteractions({\n props,\n emit,\n isDisabled,\n focusedPath,\n openSubmenuPath,\n getItemAtPath,\n focusItem,\n moveFocus,\n submenus,\n hoverIntent,\n disclosure,\n isSubmenuOpeningLeft,\n });\n\n const rootClass = computed(() =>\n bem('rp-dropdown-menu', {\n [`placement-${placement.value}`]: true,\n open: isVisible.value,\n disabled: isDisabled.value,\n }),\n );\n\n const contentClass = computed(() =>\n bem('rp-dropdown-menu__content', {\n 'has-submenu': contentHasSubmenu.value,\n }),\n );\n\n const triggerProps = computed<DropdownMenuTriggerProps>(() => ({\n 'aria-controls': isDisabled.value ? undefined : menuId.value,\n 'aria-expanded': isDisabled.value ? undefined : isVisible.value,\n 'aria-haspopup': 'menu',\n disabled: isDisabled.value || undefined,\n onClick: onTriggerClick,\n onKeydown: onTriggerKeydown,\n }));\n\n const contentProps = computed<DropdownMenuContentProps>(() => ({\n id: menuId.value,\n role: 'menu',\n tabindex: -1,\n 'aria-label': props.ariaLabel || undefined,\n 'aria-activedescendant': activeDescendantId.value,\n onKeydown: onMenuKeydown,\n onMousemove: onMenuMousemove,\n onMouseleave: onMenuMouseleave,\n }));\n\n const slotProps = computed<DropdownMenuSlotProps>(() => ({\n triggerProps: triggerProps.value,\n isOpen: isVisible.value,\n open,\n close,\n toggle,\n }));\n\n const { renderedItems, getItemProps, getItemSlotProps } = useDropdownMenuRenderItems({\n items: visibleItems,\n getItemId,\n getSubmenuId,\n getMenuActiveDescendant,\n isItemFocused,\n isSubmenuOpen,\n activateItem,\n focusHoveredItem,\n selectItem,\n openSubmenu,\n closeSubmenu,\n close,\n });\n\n return {\n rootRef,\n menuRef,\n menuId,\n isVisible,\n isEmpty,\n visibleItems,\n renderedItems,\n focusedIndex,\n focusedPath,\n activeDescendantId,\n rootClass,\n contentClass,\n triggerProps,\n contentProps,\n slotProps,\n open,\n close,\n toggle,\n selectItem,\n openSubmenu,\n closeSubmenu,\n onItemMouseenter: focusHoveredItem,\n onTriggerKeydown,\n onMenuKeydown,\n getItemProps,\n getItemSlotProps,\n };\n}\n","<template>\n <span ref=\"rootRef\" :class=\"rootClass\">\n <slot v-bind=\"slotProps\" />\n\n <Transition name=\"rp-dropdown-menu-content\">\n <div v-if=\"isVisible\" ref=\"menuRef\" :class=\"contentClass\" v-bind=\"contentProps\">\n <div v-if=\"isEmpty\" class=\"rp-dropdown-menu__empty\">\n <slot name=\"empty\">No actions</slot>\n </div>\n\n <DropdownMenuItems :items=\"renderedItems\">\n <template #item=\"itemSlotProps\">\n <slot name=\"item\" v-bind=\"itemSlotProps\">\n <span class=\"rp-dropdown-menu__label\">{{\n itemSlotProps.item.label\n }}</span>\n <kbd\n v-if=\"itemSlotProps.item.shortcut\"\n class=\"rp-dropdown-menu__shortcut\"\n >\n {{ itemSlotProps.item.shortcut }}\n </kbd>\n </slot>\n <span\n v-if=\"itemSlotProps.hasSubmenu\"\n class=\"rp-dropdown-menu__submenu-icon\"\n aria-hidden=\"true\"\n >\n <IconChevronRight />\n </span>\n </template>\n </DropdownMenuItems>\n </div>\n </Transition>\n </span>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport IconChevronRight from '~icons/lucide/chevron-right';\nimport DropdownMenuItems from './dropdown-menu-items';\nimport { useDropdownMenu } from './useDropdownMenu';\nimport type {\n DropdownMenuItem,\n DropdownMenuItemSlotProps,\n DropdownMenuProps,\n DropdownMenuSlotProps,\n} from './types';\n\ndefineOptions({ name: 'RpDropdownMenu' });\n\nconst props = withDefaults(defineProps<DropdownMenuProps>(), {\n items: () => [],\n placement: 'bottom-start',\n open: undefined,\n disabled: false,\n closeOnSelect: true,\n});\n\nconst emit = defineEmits<{\n 'update:open': [value: boolean];\n select: [item: DropdownMenuItem];\n}>();\n\ndefineSlots<{\n default(props: DropdownMenuSlotProps): unknown;\n item?(props: DropdownMenuItemSlotProps): unknown;\n empty?(): unknown;\n}>();\n\nconst {\n rootRef,\n menuRef,\n isVisible,\n isEmpty,\n renderedItems,\n rootClass,\n contentClass,\n contentProps,\n slotProps,\n} = useDropdownMenu(props, {\n openChange: (open) => emit('update:open', open),\n select: (item) => emit('select', item),\n});\n\nvoid rootRef;\nvoid menuRef;\n</script>\n\n<style src=\"./dropdown-menu.scss\" lang=\"scss\"></style>\n","<template>\n <span ref=\"rootRef\" :class=\"rootClass\">\n <slot v-bind=\"slotProps\" />\n\n <Transition name=\"rp-dropdown-menu-content\">\n <div v-if=\"isVisible\" ref=\"menuRef\" :class=\"contentClass\" v-bind=\"contentProps\">\n <div v-if=\"isEmpty\" class=\"rp-dropdown-menu__empty\">\n <slot name=\"empty\">No actions</slot>\n </div>\n\n <DropdownMenuItems :items=\"renderedItems\">\n <template #item=\"itemSlotProps\">\n <slot name=\"item\" v-bind=\"itemSlotProps\">\n <span class=\"rp-dropdown-menu__label\">{{\n itemSlotProps.item.label\n }}</span>\n <kbd\n v-if=\"itemSlotProps.item.shortcut\"\n class=\"rp-dropdown-menu__shortcut\"\n >\n {{ itemSlotProps.item.shortcut }}\n </kbd>\n </slot>\n <span\n v-if=\"itemSlotProps.hasSubmenu\"\n class=\"rp-dropdown-menu__submenu-icon\"\n aria-hidden=\"true\"\n >\n <IconChevronRight />\n </span>\n </template>\n </DropdownMenuItems>\n </div>\n </Transition>\n </span>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport IconChevronRight from '~icons/lucide/chevron-right';\nimport DropdownMenuItems from './dropdown-menu-items';\nimport { useDropdownMenu } from './useDropdownMenu';\nimport type {\n DropdownMenuItem,\n DropdownMenuItemSlotProps,\n DropdownMenuProps,\n DropdownMenuSlotProps,\n} from './types';\n\ndefineOptions({ name: 'RpDropdownMenu' });\n\nconst props = withDefaults(defineProps<DropdownMenuProps>(), {\n items: () => [],\n placement: 'bottom-start',\n open: undefined,\n disabled: false,\n closeOnSelect: true,\n});\n\nconst emit = defineEmits<{\n 'update:open': [value: boolean];\n select: [item: DropdownMenuItem];\n}>();\n\ndefineSlots<{\n default(props: DropdownMenuSlotProps): unknown;\n item?(props: DropdownMenuItemSlotProps): unknown;\n empty?(): unknown;\n}>();\n\nconst {\n rootRef,\n menuRef,\n isVisible,\n isEmpty,\n renderedItems,\n rootClass,\n contentClass,\n contentProps,\n slotProps,\n} = useDropdownMenu(props, {\n openChange: (open) => emit('update:open', open),\n select: (item) => emit('select', item),\n});\n\nvoid rootRef;\nvoid menuRef;\n</script>\n\n<style src=\"./dropdown-menu.scss\" lang=\"scss\"></style>\n"],"mappings":";;;;;;;;;;;;;;AAGA,IAAA,8BAAe,gBAAgB;CAC3B,MAAM;CACN,OAAO,EACH,OAAO;EACH,MAAM;EACN,UAAU;CACd,EACJ;CACA,MAAM,OAAO,EAAE,SAAS;EACpB,SAAS,YAAY,OAAmC;GACpD,OAAO,MAAM,KAAK,iBAAiB;IAC/B,MAAM,WAAW,CACb,EACI,UACA,aAAa,OACb,MAAM,OAAO,aAAa,SAAsC,CACpE,CACJ;IAEA,IAAI,aAAa,cAAc,aAAa,aACxC,SAAS,KACL,EAAE,OAAO,aAAa,cAAc,YAAY,aAAa,QAAQ,CAAC,CAC1E;IAGJ,OAAO,EACH,OACA;KACI,KAAK,aAAa;KAClB,OAAO;KACP,MAAM;IACV,GACA,QACJ;GACJ,CAAC;EACL;EAEA,aAAa,YAAY,MAAM,KAAK;CACxC;AACJ,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ACA;CACJ,EAAE;CAEF,MAAM,EAAE,eAAe,cAAc,qBAAqB,2BAA2B;EACjF,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACJ,CAAC;CAED,OAAO;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAkB;EAClB;EACA;EACA;EACA;CACJ;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EC/JA,MAAM,QAAQ;EAQd,MAAM,OAAO;EAWb,MAAM,EACF,SACA,SACA,WACA,SACA,eACA,WACA,cACA,cACA,cACA,gBAAgB,OAAO;GACvB,aAAa,SAAS,KAAK,eAAe,IAAI;GAC9C,SAAS,SAAS,KAAK,UAAU,IAAI;EACzC,CAAC;;;mCAjF+B,MAAA,SAAA,CAAS,CAAA;;oCACnB,MAAA,SAAA,CAAA,EAAA,CAAA;;qCAEF,MAAK,2BAA0B,GAAA,aAAA;yBAC5B,MAAA,SAAA,SAAS;;+CAAiB,OAAO,MAAA,YAAA,EAAY,GAAU,MAAA,YAAA,CAAY,CAAA,CAAA;;mBAC/D,MAAA,OAAA,SAAO;;;gBACR,SAAY,YAAA;;;;;;0DAGF,aAAO,MAAA,aAAA,EAAa,GAAA,EAAA,QAAA,QAAA,kBAAA;wBAE1B,QAAW,EAAA,GAAA,OAAS,aAAA,EAAA,SAAA;;;sDAElB,cAAa,KAAA,KAAA,CAAA,CAAA;kCAGP,cAAa,KAAA,gBAAA;;;uDAGhB,cAAa,KAAA,QAAA,CAAA,CAAA;;;wBAId,cAAa,kBAAA"}
package/dist/field.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"field.js","names":[],"sources":["../src/components/field/useField.ts","../src/components/field/field.vue","../src/components/field/field.vue"],"sourcesContent":["import { computed, useId, useSlots } from 'vue';\nimport { bem } from '@/utils/bem';\nimport type { FieldControlProps, FieldProps } from './types';\n\nexport function useField(props: Readonly<FieldProps>) {\n const slots = useSlots();\n const generatedId = useId();\n\n const controlId = computed(() => props.id ?? `${generatedId}-control`);\n const labelId = computed(() => `${controlId.value}-label`);\n const descriptionId = computed(() => `${controlId.value}-description`);\n const messageId = computed(() => `${controlId.value}-message`);\n\n const isInvalid = computed(() => Boolean(props.invalid || props.error));\n const messageText = computed(() => props.error || props.message);\n\n const hasLabel = computed(() => Boolean(props.label || slots.label));\n const hasDescription = computed(() => Boolean(props.description || slots.description));\n const hasMessage = computed(() => Boolean(messageText.value || slots.message));\n\n const controlLabelledby = computed(() => (hasLabel.value ? labelId.value : undefined));\n const controlDescribedby = computed(\n () =>\n [\n hasDescription.value ? descriptionId.value : undefined,\n hasMessage.value ? messageId.value : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n );\n\n const rootClass = computed(() =>\n bem('rp-field', {\n disabled: props.disabled,\n required: props.required,\n invalid: isInvalid.value,\n }),\n );\n\n const controlProps = computed<FieldControlProps>(() => ({\n id: controlId.value,\n disabled: props.disabled || undefined,\n required: props.required || undefined,\n invalid: isInvalid.value || undefined,\n labelledby: controlLabelledby.value,\n describedby: controlDescribedby.value,\n }));\n\n return {\n controlId,\n labelId,\n descriptionId,\n messageId,\n isInvalid,\n messageText,\n hasLabel,\n hasDescription,\n hasMessage,\n controlLabelledby,\n controlDescribedby,\n rootClass,\n controlProps,\n };\n}\n","<template>\n <div :class=\"rootClass\">\n <label v-if=\"hasLabel\" :id=\"labelId\" class=\"rp-field__label\" :for=\"controlId\">\n <slot name=\"label\">{{ label }}</slot>\n <span v-if=\"required\" class=\"rp-field__required\" aria-hidden=\"true\">*</span>\n </label>\n\n <div class=\"rp-field__control\">\n <slot\n :id=\"controlId\"\n :disabled=\"disabled || undefined\"\n :required=\"required || undefined\"\n :invalid=\"isInvalid || undefined\"\n :labelledby=\"controlLabelledby\"\n :describedby=\"controlDescribedby\"\n :control-props=\"controlProps\"\n />\n </div>\n\n <p v-if=\"hasDescription\" :id=\"descriptionId\" class=\"rp-field__description\">\n <slot name=\"description\">{{ description }}</slot>\n </p>\n\n <p\n v-if=\"hasMessage\"\n :id=\"messageId\"\n class=\"rp-field__message\"\n :role=\"isInvalid ? 'alert' : undefined\"\n >\n <slot name=\"message\">{{ messageText }}</slot>\n </p>\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useField } from './useField';\nimport type { FieldProps } from './types';\n\ndefineOptions({ name: 'RpField' });\n\nconst props = withDefaults(defineProps<FieldProps>(), {\n label: '',\n description: '',\n message: '',\n error: '',\n disabled: undefined,\n required: false,\n invalid: undefined,\n});\n\nconst {\n controlId,\n labelId,\n descriptionId,\n messageId,\n isInvalid,\n messageText,\n hasLabel,\n hasDescription,\n hasMessage,\n controlLabelledby,\n controlDescribedby,\n rootClass,\n controlProps,\n} = useField(props);\n</script>\n\n<style src=\"./field.scss\" lang=\"scss\" scoped></style>\n","<template>\n <div :class=\"rootClass\">\n <label v-if=\"hasLabel\" :id=\"labelId\" class=\"rp-field__label\" :for=\"controlId\">\n <slot name=\"label\">{{ label }}</slot>\n <span v-if=\"required\" class=\"rp-field__required\" aria-hidden=\"true\">*</span>\n </label>\n\n <div class=\"rp-field__control\">\n <slot\n :id=\"controlId\"\n :disabled=\"disabled || undefined\"\n :required=\"required || undefined\"\n :invalid=\"isInvalid || undefined\"\n :labelledby=\"controlLabelledby\"\n :describedby=\"controlDescribedby\"\n :control-props=\"controlProps\"\n />\n </div>\n\n <p v-if=\"hasDescription\" :id=\"descriptionId\" class=\"rp-field__description\">\n <slot name=\"description\">{{ description }}</slot>\n </p>\n\n <p\n v-if=\"hasMessage\"\n :id=\"messageId\"\n class=\"rp-field__message\"\n :role=\"isInvalid ? 'alert' : undefined\"\n >\n <slot name=\"message\">{{ messageText }}</slot>\n </p>\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useField } from './useField';\nimport type { FieldProps } from './types';\n\ndefineOptions({ name: 'RpField' });\n\nconst props = withDefaults(defineProps<FieldProps>(), {\n label: '',\n description: '',\n message: '',\n error: '',\n disabled: undefined,\n required: false,\n invalid: undefined,\n});\n\nconst {\n controlId,\n labelId,\n descriptionId,\n messageId,\n isInvalid,\n messageText,\n hasLabel,\n hasDescription,\n hasMessage,\n controlLabelledby,\n controlDescribedby,\n rootClass,\n controlProps,\n} = useField(props);\n</script>\n\n<style src=\"./field.scss\" lang=\"scss\" scoped></style>\n"],"mappings":";;;;AAIA,SAAgB,SAAS,OAA6B;CAClD,MAAM,QAAQ,SAAS;CACvB,MAAM,cAAc,MAAM;CAE1B,MAAM,YAAY,eAAe,MAAM,MAAM,GAAG,YAAY,SAAS;CACrE,MAAM,UAAU,eAAe,GAAG,UAAU,MAAM,OAAO;CACzD,MAAM,gBAAgB,eAAe,GAAG,UAAU,MAAM,aAAa;CACrE,MAAM,YAAY,eAAe,GAAG,UAAU,MAAM,SAAS;CAE7D,MAAM,YAAY,eAAe,QAAQ,MAAM,WAAW,MAAM,KAAK,CAAC;CACtE,MAAM,cAAc,eAAe,MAAM,SAAS,MAAM,OAAO;CAE/D,MAAM,WAAW,eAAe,QAAQ,MAAM,SAAS,MAAM,KAAK,CAAC;CACnE,MAAM,iBAAiB,eAAe,QAAQ,MAAM,eAAe,MAAM,WAAW,CAAC;CACrF,MAAM,aAAa,eAAe,QAAQ,YAAY,SAAS,MAAM,OAAO,CAAC;CAE7E,MAAM,oBAAoB,eAAgB,SAAS,QAAQ,QAAQ,QAAQ,KAAA,CAAU;CACrF,MAAM,qBAAqB,eAEnB,CACI,eAAe,QAAQ,cAAc,QAAQ,KAAA,GAC7C,WAAW,QAAQ,UAAU,QAAQ,KAAA,CACzC,CAAC,CACI,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,KAAK,KAAA,CAC1B;CAmBA,OAAO;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WA7Bc,eACd,IAAI,YAAY;GACZ,UAAU,MAAM;GAChB,UAAU,MAAM;GAChB,SAAS,UAAU;EACvB,CAAC,CAwBD;EACA,cAtBiB,gBAAmC;GACpD,IAAI,UAAU;GACd,UAAU,MAAM,YAAY,KAAA;GAC5B,UAAU,MAAM,YAAY,KAAA;GAC5B,SAAS,UAAU,SAAS,KAAA;GAC5B,YAAY,kBAAkB;GAC9B,aAAa,mBAAmB;EACpC,EAeI;CACJ;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ECbA,MAAM,EACF,WACA,SACA,eACA,WACA,WACA,aACA,UACA,gBACA,YACA,mBACA,oBACA,WACA,iBACA,SAAS,OAAK;;;mCA/DD,MAAA,SAAA,CAAS,CAAA;;iBACL,MAAA,QAAA,SAAQ;;;gBAAG,MAAI,MAAA,OAAA,CAAO;gBAA2B,OAAK,MAAA,SAAA,CAAS;;;cAClE,SAAY,YAAA;;mDAAI,QAAA,KAAK,CAAA,CAAA;;;;kBACf,QAAA,gBAAQ;;;;;;;GAKf,UAAI,MAAA,SAAA;GACJ,gBAAU,QAAA,YAAY,KAAA;GACtB,gBAAU,QAAA,YAAY,KAAA;GACtB,eAAS,MAAA,SAAA,KAAa,KAAA;GACtB,kBAAY,MAAA,iBAAA;GACZ,mBAAa,MAAA,kBAAA;GACb,oBAAe,MAAA,YAAA;;;iBAIf,MAAA,cAAA,SAAc;;mCAAG,MAAI,MAAA,aAAA,CAAa,CAAA;;cACjC,eAAkB,YAAA;;oDAAI,QAAA,WAAW,CAAA,CAAA;;;;;;iBAIjC,MAAA,UAAA,SAAU;;;iBACf,MAAI,MAAA,SAAA,CAAS;iBAEb,QAAM,MAAA,SAAA,IAAS,UAAa,KAAA,CAAS;;;cAEhC,WAAc,YAAA;;oDAAI,MAAA,WAAA,CAAW,CAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"icon-button.js","names":[],"sources":["../src/components/icon-button/icon-button.vue","../src/components/icon-button/icon-button.vue"],"sourcesContent":["<template>\n <button\n :class=\"rootClass\"\n :style=\"rootStyle\"\n :disabled=\"disabled || loading || undefined\"\n :type=\"type\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-busy=\"loading || undefined\"\n >\n <IconLoaderCircle v-if=\"loading\" class=\"rp-icon-button__spinner\" aria-hidden=\"true\" />\n <span v-else class=\"rp-icon-button__icon\" aria-hidden=\"true\">\n <slot />\n </span>\n </button>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { computed } from 'vue';\nimport IconLoaderCircle from '~icons/lucide/loader-circle';\nimport { isComponentPresetColor } from '@/utils/componentColors';\nimport { bem } from '@/utils/bem';\nimport { getButtonColorStyle } from '../button/useButtonColor';\nimport type { IconButtonProps } from './types';\n\ndefineOptions({ name: 'RpIconButton' });\n\nconst props = withDefaults(defineProps<IconButtonProps>(), {\n type: 'button',\n disabled: false,\n loading: false,\n});\n\nconst rootClass = computed(() => [\n ...bem('rp-button', {\n [props.variant ?? '']: Boolean(props.variant),\n [`color-${props.color}`]: isComponentPresetColor(props.color),\n [`size-${props.size}`]: Boolean(props.size),\n [`radius-${props.radius}`]: Boolean(props.radius),\n }),\n 'rp-icon-button',\n]);\n\nconst rootStyle = computed(() => getButtonColorStyle(props.color));\n</script>\n\n<style src=\"../button/button.scss\" lang=\"scss\" scoped></style>\n<style src=\"./icon-button.scss\" lang=\"scss\" scoped></style>\n","<template>\n <button\n :class=\"rootClass\"\n :style=\"rootStyle\"\n :disabled=\"disabled || loading || undefined\"\n :type=\"type\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-busy=\"loading || undefined\"\n >\n <IconLoaderCircle v-if=\"loading\" class=\"rp-icon-button__spinner\" aria-hidden=\"true\" />\n <span v-else class=\"rp-icon-button__icon\" aria-hidden=\"true\">\n <slot />\n </span>\n </button>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { computed } from 'vue';\nimport IconLoaderCircle from '~icons/lucide/loader-circle';\nimport { isComponentPresetColor } from '@/utils/componentColors';\nimport { bem } from '@/utils/bem';\nimport { getButtonColorStyle } from '../button/useButtonColor';\nimport type { IconButtonProps } from './types';\n\ndefineOptions({ name: 'RpIconButton' });\n\nconst props = withDefaults(defineProps<IconButtonProps>(), {\n type: 'button',\n disabled: false,\n loading: false,\n});\n\nconst rootClass = computed(() => [\n ...bem('rp-button', {\n [props.variant ?? '']: Boolean(props.variant),\n [`color-${props.color}`]: isComponentPresetColor(props.color),\n [`size-${props.size}`]: Boolean(props.size),\n [`radius-${props.radius}`]: Boolean(props.radius),\n }),\n 'rp-icon-button',\n]);\n\nconst rootStyle = computed(() => getButtonColorStyle(props.color));\n</script>\n\n<style src=\"../button/button.scss\" lang=\"scss\" scoped></style>\n<style src=\"./icon-button.scss\" lang=\"scss\" scoped></style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BA,MAAM,QAAQ;EAMd,MAAM,YAAY,eAAe,CAC7B,GAAG,IAAI,aAAa;IACf,MAAM,WAAW,KAAK,QAAQ,MAAM,OAAO;IAC3C,SAAS,MAAM,UAAU,uBAAuB,MAAM,KAAK;IAC3D,QAAQ,MAAM,SAAS,QAAQ,MAAM,IAAI;IACzC,UAAU,MAAM,WAAW,QAAQ,MAAM,MAAM;EACpD,CAAC,GACD,gBACJ,CAAC;EAED,MAAM,YAAY,eAAe,oBAAoB,MAAM,KAAK,CAAC;;;;gBAxCjD,UAAA,KAAS;gBACT,UAAA,KAAS;eAChB,YAAU,QAAA,YAAY,YAAW,KAAA,CAAS;eAC1C,QAAM,QAAA,IAAI;eACV,cAAY,QAAA,aAAa,KAAA,CAAS;eAClC,aAAW,YAAW,KAAA,CAAS;;;iBAER,QAAA,eAAO;;IAAE,OAAM;IAA0B,eAAY"}
package/dist/input.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.js","names":[],"sources":["../src/components/input/useInput.ts","../src/components/input/input.vue","../src/components/input/input.vue"],"sourcesContent":["import { computed, ref } from 'vue';\nimport { useControlState } from '@/composables/useControlState';\nimport { bem } from '@/utils/bem';\nimport type { InputProps } from './types';\n\nconst NATIVE_INPUT_SELECTOR = '.rp-input__native';\nconst INTERACTIVE_SELECTOR = [\n 'button',\n 'a[href]',\n `input:not(${NATIVE_INPUT_SELECTOR})`,\n 'select',\n 'textarea',\n '[contenteditable=\"true\"]',\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(',');\n\nfunction isInteractiveElement(target: Element) {\n return Boolean(target.closest(INTERACTIVE_SELECTOR));\n}\n\nexport function useInput(props: Readonly<InputProps>, emitUpdate: (value: string) => void) {\n const inputRef = ref<HTMLInputElement | null>(null);\n const control = useControlState(props);\n\n const rootClass = computed(() =>\n bem('rp-input', {\n [`size-${props.size}`]: Boolean(props.size),\n [`radius-${props.radius}`]: Boolean(props.radius),\n disabled: control.disabled,\n invalid: control.invalid,\n valid: control.valid && !control.invalid,\n readonly: props.readonly,\n }),\n );\n\n function onInput(e: Event) {\n emitUpdate((e.target as HTMLInputElement).value);\n }\n\n function focusInput(e: MouseEvent) {\n if (control.disabled) return;\n\n const target = e.target;\n if (target instanceof Element && isInteractiveElement(target)) return;\n\n inputRef.value?.focus();\n }\n\n return {\n inputRef,\n control,\n rootClass,\n onInput,\n focusInput,\n };\n}\n","<template>\n <label :class=\"rootClass\" @mousedown=\"focusInput\">\n <span v-if=\"$slots.left\" class=\"rp-input__left\">\n <slot name=\"left\" />\n </span>\n <input\n :id=\"control.id\"\n ref=\"inputRef\"\n :name=\"name\"\n class=\"rp-input__native\"\n :type=\"type\"\n :value=\"modelValue\"\n :placeholder=\"placeholder\"\n :disabled=\"control.disabled || undefined\"\n :readonly=\"readonly || undefined\"\n :required=\"control.required || undefined\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :aria-invalid=\"control.invalid || undefined\"\n :aria-required=\"control.required || undefined\"\n @input=\"onInput\"\n />\n <span v-if=\"$slots.right\" class=\"rp-input__right\">\n <slot name=\"right\" />\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useInput } from './useInput';\nimport type { InputProps } from './types';\n\ndefineOptions({ name: 'RpInput' });\n\nconst props = withDefaults(defineProps<InputProps>(), {\n type: 'text',\n placeholder: '',\n disabled: undefined,\n required: undefined,\n invalid: undefined,\n valid: undefined,\n readonly: false,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string];\n}>();\n\nconst { inputRef, control, rootClass, onInput, focusInput } = useInput(props, (value) => {\n emit('update:modelValue', value);\n});\n\nvoid inputRef;\n</script>\n\n<style src=\"./input.scss\" lang=\"scss\" scoped></style>\n","<template>\n <label :class=\"rootClass\" @mousedown=\"focusInput\">\n <span v-if=\"$slots.left\" class=\"rp-input__left\">\n <slot name=\"left\" />\n </span>\n <input\n :id=\"control.id\"\n ref=\"inputRef\"\n :name=\"name\"\n class=\"rp-input__native\"\n :type=\"type\"\n :value=\"modelValue\"\n :placeholder=\"placeholder\"\n :disabled=\"control.disabled || undefined\"\n :readonly=\"readonly || undefined\"\n :required=\"control.required || undefined\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :aria-invalid=\"control.invalid || undefined\"\n :aria-required=\"control.required || undefined\"\n @input=\"onInput\"\n />\n <span v-if=\"$slots.right\" class=\"rp-input__right\">\n <slot name=\"right\" />\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useInput } from './useInput';\nimport type { InputProps } from './types';\n\ndefineOptions({ name: 'RpInput' });\n\nconst props = withDefaults(defineProps<InputProps>(), {\n type: 'text',\n placeholder: '',\n disabled: undefined,\n required: undefined,\n invalid: undefined,\n valid: undefined,\n readonly: false,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string];\n}>();\n\nconst { inputRef, control, rootClass, onInput, focusInput } = useInput(props, (value) => {\n emit('update:modelValue', value);\n});\n\nvoid inputRef;\n</script>\n\n<style src=\"./input.scss\" lang=\"scss\" scoped></style>\n"],"mappings":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U,SAAO,YAAa,KAAA,CAAS;eACvC,YAAU,QAAA,YAAY,KAAA,CAAS;eAC/B,YAAU,qBAAoB,KAAA,CAAS;eACvC,cAAY,QAAA,aAAa,KAAA,CAAS;eAClC,mBAAiB,SAAO,cAAA;eACxB,oBAAkB,SAAO,eAAA;eACzB,gBAAc,SAAO,WAAY,KAAA,CAAS;eAC1C,iBAAe,qBAAoB,KAAA,CAAS;;;iBAGrC,OAAM,aAAA;;;cACR,SAAY,MAAA,MAAA,CAAA;;;0CAvBY,MAAA,UAAA,CAAU,CAAA,CAAA,CAAA"}
package/dist/modal.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"modal.js","names":[],"sources":["../src/components/modal/useModal.ts","../src/components/modal/modal.vue","../src/components/modal/modal.vue"],"sourcesContent":["import {\n computed,\n isRef,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n useSlots,\n useId,\n watch,\n type CSSProperties,\n} from 'vue';\nimport { bem } from '@/utils/bem';\nimport type {\n ModalInitialFocus,\n ModalPresetSize,\n ModalProps,\n ModalRole,\n ModalSize,\n ModalSlotProps,\n} from './types';\n\nlet bodyScrollLockCount = 0;\nlet previousBodyOverflow = '';\nconst activeModalStack: symbol[] = [];\n\ntype Cleanup = () => void;\n\nconst DEFAULT_ROLE: ModalRole = 'dialog';\nconst DEFAULT_SIZE: ModalSize = 'md';\n\nconst FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'button:not([disabled])',\n 'textarea:not([disabled])',\n 'input:not([disabled])',\n 'select:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(',');\n\nconst MODAL_PRESET_SIZES = new Set<ModalPresetSize>(['sm', 'md', 'lg', 'xl', 'full']);\n\nfunction isHTMLElement(value: unknown): value is HTMLElement {\n return typeof HTMLElement !== 'undefined' && value instanceof HTMLElement;\n}\n\nfunction isModalPresetSize(size: string): size is ModalPresetSize {\n return MODAL_PRESET_SIZES.has(size as ModalPresetSize);\n}\n\nfunction isFocusable(element: HTMLElement) {\n if (element.getAttribute('aria-hidden') === 'true') return false;\n if (element.hasAttribute('disabled')) return false;\n return element.tabIndex >= 0;\n}\n\nfunction getFocusableElements(panel: HTMLElement | null) {\n if (!panel) return [];\n return [...panel.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)].filter(isFocusable);\n}\n\nfunction focusElement(element: HTMLElement | null | undefined) {\n if (!element) return;\n\n try {\n element.focus({ preventScroll: true });\n } catch {\n element.focus();\n }\n}\n\nfunction lockBodyScroll(): Cleanup | undefined {\n if (typeof document === 'undefined') return undefined;\n\n if (bodyScrollLockCount === 0) {\n previousBodyOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n }\n\n bodyScrollLockCount += 1;\n\n return () => {\n bodyScrollLockCount = Math.max(0, bodyScrollLockCount - 1);\n if (bodyScrollLockCount === 0) document.body.style.overflow = previousBodyOverflow;\n };\n}\n\nfunction readInitialFocus(initialFocus: ModalInitialFocus | null | undefined) {\n return isRef(initialFocus) ? initialFocus.value : initialFocus;\n}\n\nfunction queryPanelElement(panel: HTMLElement, selector: string) {\n try {\n const element = panel.querySelector(selector);\n return isHTMLElement(element) ? element : null;\n } catch {\n return null;\n }\n}\n\nexport function useModal(props: Readonly<ModalProps>, emitOpenChange?: (open: boolean) => void) {\n const slots = useSlots();\n const generatedId = useId();\n const panelRef = ref<HTMLElement | null>(null);\n const uncontrolledOpen = ref(Boolean(props.defaultOpen));\n const modalToken = Symbol('modal');\n\n let isMounted = false;\n let isActiveModal = false;\n let previousActiveElement: HTMLElement | null = null;\n let removeDocumentListeners: Cleanup | undefined;\n let unlockScroll: Cleanup | undefined;\n\n const modalId = computed(() => props.id ?? `${generatedId}-modal`);\n const titleId = computed(() => `${modalId.value}-title`);\n const descriptionId = computed(() => `${modalId.value}-description`);\n const role = computed(() => props.role ?? DEFAULT_ROLE);\n const size = computed(() => props.size || DEFAULT_SIZE);\n const isPresetSize = computed(() => isModalPresetSize(size.value));\n const isOpen = computed(() => props.open ?? uncontrolledOpen.value);\n const shouldRender = computed(() => Boolean(props.keepMounted || isOpen.value));\n const hasCustomHeader = computed(() => Boolean(slots.header));\n const hasHeader = computed(() =>\n Boolean(hasCustomHeader.value || props.title || props.description),\n );\n const hasFooter = computed(() => Boolean(slots.footer));\n const showCloseButton = computed(() => props.showCloseButton);\n\n const headerId = computed(() =>\n hasCustomHeader.value && !props.ariaLabel ? titleId.value : undefined,\n );\n const ariaLabelledby = computed(() => {\n if (props.ariaLabel) return undefined;\n return hasCustomHeader.value || props.title ? titleId.value : undefined;\n });\n const ariaDescribedby = computed(() =>\n props.description && !hasCustomHeader.value ? descriptionId.value : undefined,\n );\n const ariaLabel = computed(() =>\n ariaLabelledby.value ? undefined : props.ariaLabel || undefined,\n );\n\n const rootClass = computed(() =>\n bem('rp-modal', {\n [`size-${size.value}`]: isPresetSize.value,\n 'size-custom': !isPresetSize.value,\n open: isOpen.value,\n }),\n );\n\n const rootStyle = computed<CSSProperties | undefined>(() => {\n if (isPresetSize.value) return undefined;\n\n return {\n '--_rp-modal-width': size.value,\n };\n });\n\n const stateClass = computed(() => ({\n 'rp-modal--closable': showCloseButton.value,\n 'rp-modal--headerless': !hasHeader.value,\n }));\n\n const slotProps = computed<ModalSlotProps>(() => ({\n isOpen: isOpen.value,\n open: openModal,\n close: closeModal,\n toggle: toggleModal,\n }));\n\n function setOpen(nextOpen: boolean) {\n if (nextOpen === isOpen.value) return;\n if (props.open === undefined) uncontrolledOpen.value = nextOpen;\n emitOpenChange?.(nextOpen);\n }\n\n function openModal() {\n setOpen(true);\n }\n\n function closeModal() {\n setOpen(false);\n }\n\n function toggleModal() {\n setOpen(!isOpen.value);\n }\n\n function resolveInitialFocus() {\n const initialFocus = readInitialFocus(props.initialFocus);\n const panel = panelRef.value;\n if (!initialFocus || !panel) return null;\n\n if (typeof initialFocus === 'string') {\n return queryPanelElement(panel, initialFocus);\n }\n\n return panel.contains(initialFocus) ? initialFocus : null;\n }\n\n function focusInitialElement() {\n const firstFocusable = getFocusableElements(panelRef.value)[0];\n focusElement(resolveInitialFocus() ?? firstFocusable ?? panelRef.value);\n }\n\n function addToStack() {\n if (!activeModalStack.includes(modalToken)) activeModalStack.push(modalToken);\n }\n\n function removeFromStack() {\n const index = activeModalStack.indexOf(modalToken);\n if (index !== -1) activeModalStack.splice(index, 1);\n }\n\n function isTopModal() {\n return activeModalStack[activeModalStack.length - 1] === modalToken;\n }\n\n function trapFocus(event: KeyboardEvent) {\n const panel = panelRef.value;\n if (!panel) return;\n\n const focusableElements = getFocusableElements(panel);\n if (focusableElements.length === 0) {\n event.preventDefault();\n focusElement(panel);\n return;\n }\n\n const firstElement = focusableElements[0];\n const lastElement = focusableElements[focusableElements.length - 1];\n const activeElement = document.activeElement;\n const isInsidePanel = activeElement instanceof Node && panel.contains(activeElement);\n\n if (!isInsidePanel) {\n event.preventDefault();\n focusElement(firstElement);\n return;\n }\n\n if (event.shiftKey && activeElement === firstElement) {\n event.preventDefault();\n focusElement(lastElement);\n return;\n }\n\n if (!event.shiftKey && activeElement === lastElement) {\n event.preventDefault();\n focusElement(firstElement);\n }\n }\n\n function onDocumentKeydown(event: KeyboardEvent) {\n if (!isOpen.value || !isTopModal()) return;\n\n if (event.key === 'Escape') {\n if (props.closeOnEscape === false) return;\n event.preventDefault();\n closeModal();\n return;\n }\n\n if (event.key === 'Tab') trapFocus(event);\n }\n\n function bindDocumentListeners() {\n if (typeof document === 'undefined' || removeDocumentListeners) return;\n\n document.addEventListener('keydown', onDocumentKeydown);\n\n removeDocumentListeners = () => {\n document.removeEventListener('keydown', onDocumentKeydown);\n removeDocumentListeners = undefined;\n };\n }\n\n function restoreFocus() {\n if (props.returnFocus === false) {\n previousActiveElement = null;\n return;\n }\n\n if (previousActiveElement?.isConnected) focusElement(previousActiveElement);\n previousActiveElement = null;\n }\n\n function activateModal() {\n if (isActiveModal) return;\n\n isActiveModal = true;\n addToStack();\n\n if (typeof document !== 'undefined') {\n const activeElement = document.activeElement;\n previousActiveElement = isHTMLElement(activeElement) ? activeElement : null;\n }\n\n bindDocumentListeners();\n if (props.preventScroll !== false) unlockScroll = lockBodyScroll();\n void nextTick(() => {\n if (isActiveModal) focusInitialElement();\n });\n }\n\n function deactivateModal() {\n if (!isActiveModal) return;\n\n isActiveModal = false;\n removeFromStack();\n removeDocumentListeners?.();\n unlockScroll?.();\n unlockScroll = undefined;\n restoreFocus();\n }\n\n function onOverlayClick(event: MouseEvent) {\n if (props.closeOnOverlayClick === false || event.target !== event.currentTarget) return;\n closeModal();\n }\n\n onMounted(() => {\n isMounted = true;\n if (isOpen.value) activateModal();\n });\n\n onBeforeUnmount(() => {\n deactivateModal();\n });\n\n watch(isOpen, (nextOpen) => {\n if (!isMounted) return;\n if (nextOpen) activateModal();\n else deactivateModal();\n });\n\n return {\n panelRef,\n modalId,\n titleId,\n descriptionId,\n role,\n isOpen,\n shouldRender,\n hasHeader,\n hasFooter,\n showCloseButton,\n headerId,\n ariaLabelledby,\n ariaDescribedby,\n ariaLabel,\n rootClass,\n rootStyle,\n stateClass,\n slotProps,\n openModal,\n closeModal,\n toggleModal,\n onOverlayClick,\n };\n}\n","<template>\n <Transition name=\"rp-modal\">\n <div\n v-if=\"shouldRender\"\n v-show=\"isOpen\"\n :class=\"[rootClass, stateClass]\"\n :style=\"rootStyle\"\n >\n <Overlay\n v-bind=\"overlayProps\"\n class=\"rp-modal__overlay\"\n :z-index=\"0\"\n interactive\n @click=\"onOverlayClick\"\n />\n\n <section\n :id=\"modalId\"\n ref=\"panelRef\"\n class=\"rp-modal__panel\"\n :role=\"role\"\n aria-modal=\"true\"\n :aria-label=\"ariaLabel\"\n :aria-labelledby=\"ariaLabelledby\"\n :aria-describedby=\"ariaDescribedby\"\n tabindex=\"-1\"\n >\n <div v-if=\"hasHeader\" class=\"rp-modal__header\" :id=\"headerId\">\n <slot name=\"header\" v-bind=\"slotProps\">\n <div class=\"rp-modal__heading\">\n <h2 v-if=\"title\" :id=\"titleId\" class=\"rp-modal__title\">\n {{ title }}\n </h2>\n <p v-if=\"description\" :id=\"descriptionId\" class=\"rp-modal__description\">\n {{ description }}\n </p>\n </div>\n </slot>\n </div>\n\n <IconButton\n v-if=\"showCloseButton\"\n class=\"rp-modal__close\"\n :ariaLabel=\"closeLabel\"\n variant=\"ghost\"\n size=\"sm\"\n @click=\"closeModal\"\n >\n <IconX />\n </IconButton>\n\n <div v-if=\"$slots.default\" class=\"rp-modal__body\">\n <slot v-bind=\"slotProps\" />\n </div>\n\n <div v-if=\"hasFooter\" class=\"rp-modal__footer\">\n <slot name=\"footer\" v-bind=\"slotProps\" />\n </div>\n </section>\n </div>\n </Transition>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport IconX from '~icons/lucide/x';\nimport IconButton from '../icon-button/icon-button.vue';\nimport Overlay from '../overlay/overlay.vue';\nimport { useModal } from './useModal';\nimport type { ModalProps } from './types';\n\ndefineOptions({ name: 'RpModal' });\n\nconst props = withDefaults(defineProps<ModalProps>(), {\n open: undefined,\n defaultOpen: false,\n title: '',\n description: '',\n ariaLabel: '',\n closeLabel: 'Close modal',\n role: 'dialog',\n size: 'md',\n initialFocus: null,\n closeOnOverlayClick: true,\n closeOnEscape: true,\n showCloseButton: true,\n overlayProps: () => ({}),\n preventScroll: true,\n returnFocus: true,\n keepMounted: false,\n});\n\nconst emit = defineEmits<{\n 'update:open': [value: boolean];\n}>();\n\nconst {\n panelRef,\n modalId,\n titleId,\n descriptionId,\n role,\n isOpen,\n shouldRender,\n hasHeader,\n hasFooter,\n showCloseButton,\n headerId,\n ariaLabelledby,\n ariaDescribedby,\n ariaLabel,\n rootClass,\n rootStyle,\n stateClass,\n slotProps,\n closeModal,\n onOverlayClick,\n} = useModal(props, (open) => {\n emit('update:open', open);\n});\n\nvoid panelRef;\n</script>\n\n<style src=\"./modal.scss\" lang=\"scss\" scoped></style>\n","<template>\n <Transition name=\"rp-modal\">\n <div\n v-if=\"shouldRender\"\n v-show=\"isOpen\"\n :class=\"[rootClass, stateClass]\"\n :style=\"rootStyle\"\n >\n <Overlay\n v-bind=\"overlayProps\"\n class=\"rp-modal__overlay\"\n :z-index=\"0\"\n interactive\n @click=\"onOverlayClick\"\n />\n\n <section\n :id=\"modalId\"\n ref=\"panelRef\"\n class=\"rp-modal__panel\"\n :role=\"role\"\n aria-modal=\"true\"\n :aria-label=\"ariaLabel\"\n :aria-labelledby=\"ariaLabelledby\"\n :aria-describedby=\"ariaDescribedby\"\n tabindex=\"-1\"\n >\n <div v-if=\"hasHeader\" class=\"rp-modal__header\" :id=\"headerId\">\n <slot name=\"header\" v-bind=\"slotProps\">\n <div class=\"rp-modal__heading\">\n <h2 v-if=\"title\" :id=\"titleId\" class=\"rp-modal__title\">\n {{ title }}\n </h2>\n <p v-if=\"description\" :id=\"descriptionId\" class=\"rp-modal__description\">\n {{ description }}\n </p>\n </div>\n </slot>\n </div>\n\n <IconButton\n v-if=\"showCloseButton\"\n class=\"rp-modal__close\"\n :ariaLabel=\"closeLabel\"\n variant=\"ghost\"\n size=\"sm\"\n @click=\"closeModal\"\n >\n <IconX />\n </IconButton>\n\n <div v-if=\"$slots.default\" class=\"rp-modal__body\">\n <slot v-bind=\"slotProps\" />\n </div>\n\n <div v-if=\"hasFooter\" class=\"rp-modal__footer\">\n <slot name=\"footer\" v-bind=\"slotProps\" />\n </div>\n </section>\n </div>\n </Transition>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport IconX from '~icons/lucide/x';\nimport IconButton from '../icon-button/icon-button.vue';\nimport Overlay from '../overlay/overlay.vue';\nimport { useModal } from './useModal';\nimport type { ModalProps } from './types';\n\ndefineOptions({ name: 'RpModal' });\n\nconst props = withDefaults(defineProps<ModalProps>(), {\n open: undefined,\n defaultOpen: false,\n title: '',\n description: '',\n ariaLabel: '',\n closeLabel: 'Close modal',\n role: 'dialog',\n size: 'md',\n initialFocus: null,\n closeOnOverlayClick: true,\n closeOnEscape: true,\n showCloseButton: true,\n overlayProps: () => ({}),\n preventScroll: true,\n returnFocus: true,\n keepMounted: false,\n});\n\nconst emit = defineEmits<{\n 'update:open': [value: boolean];\n}>();\n\nconst {\n panelRef,\n modalId,\n titleId,\n descriptionId,\n role,\n isOpen,\n shouldRender,\n hasHeader,\n hasFooter,\n showCloseButton,\n headerId,\n ariaLabelledby,\n ariaDescribedby,\n ariaLabel,\n rootClass,\n rootStyle,\n stateClass,\n slotProps,\n closeModal,\n onOverlayClick,\n} = useModal(props, (open) => {\n emit('update:open', open);\n});\n\nvoid panelRef;\n</script>\n\n<style src=\"./modal.scss\" lang=\"scss\" scoped></style>\n"],"mappings":";;;;;;;AAsBA,IAAI,sBAAsB;AAC1B,IAAI,uBAAuB;AAC3B,IAAM,mBAA6B,CAAC;AAIpC,IAAM,eAA0B;AAChC,IAAM,eAA0B;AAEhC,IAAM,qBAAqB;CACvB;CACA;CACA;CACA;CACA;CACA;AACJ,CAAC,CAAC,KAAK,GAAG;AAEV,IAAM,qCAAqB,IAAI,IAAqB;CAAC;CAAM;CAAM;CAAM;CAAM;AAAM,CAAC;AAEpF,SAAS,cAAc,OAAsC;CACzD,OAAO,OAAO,gBAAgB,eAAe,iBAAiB;AAClE;AAEA,SAAS,kBAAkB,MAAuC;CAC9D,OAAO,mBAAmB,IAAI,IAAuB;AACzD;AAEA,SAAS,YAAY,SAAsB;CACvC,IAAI,QAAQ,aAAa,aAAa,MAAM,QAAQ,OAAO;CAC3D,IAAI,QAAQ,aAAa,UAAU,GAAG,OAAO;CAC7C,OAAO,QAAQ,YAAY;AAC/B;AAEA,SAAS,qBAAqB,OAA2B;CACrD,IAAI,CAAC,OAAO,OAAO,CAAC;CACpB,OAAO,CAAC,GAAG,MAAM,iBAA8B,kBAAkB,CAAC,CAAC,CAAC,OAAO,WAAW;AAC1F;AAEA,SAAS,aAAa,SAAyC;CAC3D,IAAI,CAAC,SAAS;CAEd,IAAI;EACA,QAAQ,MAAM,EAAE,eAAe,KAAK,CAAC;CACzC,QAAQ;EACJ,QAAQ,MAAM;CAClB;AACJ;AAEA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BAAW,QAAA;MACZ,SAAQ;MACR,MAAK;MACJ,eAAO,MAAA,UAAA;;;;;;mBAKD,OAAM,eAAA;;;uCACC,MAAA,SAAA,CAAA,EAAA,GAAA,MAAA,CAAA;;;;mBAGP,MAAA,SAAA,SAAS;;;gBACV,UAAa,EAAA,GAAA,OAAS,MAAA,SAAA,CAAA,EAAA,GAAA,MAAA,CAAA;;;;0BApD5B,MAAA,MAAA,CAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlay.js","names":[],"sources":["../src/components/overlay/useOverlay.ts","../src/components/overlay/overlay.vue","../src/components/overlay/overlay.vue"],"sourcesContent":["import { computed, type CSSProperties } from 'vue';\nimport { bem } from '@/utils/bem';\nimport type { OverlayProps } from './types';\n\nfunction getBlurValue(blur: OverlayProps['blur']) {\n if (blur == null || blur === '') return undefined;\n\n if (typeof blur === 'number') {\n if (!Number.isFinite(blur) || blur < 0) return undefined;\n\n return `${blur}px`;\n }\n\n return blur;\n}\n\nexport function useOverlay(props: Readonly<OverlayProps>) {\n const isRendered = computed(() => !props.disabled);\n const hasGradient = computed(() => Boolean(props.gradient));\n\n const normalizedOpacity = computed(() => {\n const opacity = props.opacity;\n if (opacity === undefined || !Number.isFinite(opacity)) return 1;\n\n return Math.min(1, Math.max(0, opacity));\n });\n\n const blurValue = computed(() => getBlurValue(props.blur));\n const hasBlur = computed(() => Boolean(blurValue.value));\n\n const rootClass = computed(() =>\n bem('rp-overlay', {\n gradient: hasGradient.value,\n blurred: hasBlur.value,\n interactive: props.interactive,\n }),\n );\n\n const rootStyle = computed<CSSProperties>(() => {\n const style: CSSProperties = {\n '--_rp-overlay-z-index': props.zIndex,\n };\n\n if (blurValue.value) {\n style['--_rp-overlay-blur'] = blurValue.value;\n }\n\n if (hasGradient.value) {\n return {\n ...style,\n backgroundImage: props.gradient,\n };\n }\n\n return {\n ...style,\n '--_rp-overlay-color': props.color,\n '--_rp-overlay-opacity': normalizedOpacity.value,\n };\n });\n\n return {\n isRendered,\n rootClass,\n rootStyle,\n };\n}\n","<template>\n <div v-if=\"isRendered\" :class=\"rootClass\" :style=\"rootStyle\" aria-hidden=\"true\" />\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useOverlay } from './useOverlay';\nimport type { OverlayProps } from './types';\n\ndefineOptions({ name: 'RpOverlay' });\n\nconst props = withDefaults(defineProps<OverlayProps>(), {\n color: 'var(--rp-color-overlay)',\n opacity: 1,\n gradient: '',\n zIndex: 1,\n interactive: false,\n disabled: false,\n});\n\nconst { isRendered, rootClass, rootStyle } = useOverlay(props);\n</script>\n\n<style src=\"./overlay.scss\" lang=\"scss\" scoped></style>\n","<template>\n <div v-if=\"isRendered\" :class=\"rootClass\" :style=\"rootStyle\" aria-hidden=\"true\" />\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useOverlay } from './useOverlay';\nimport type { OverlayProps } from './types';\n\ndefineOptions({ name: 'RpOverlay' });\n\nconst props = withDefaults(defineProps<OverlayProps>(), {\n color: 'var(--rp-color-overlay)',\n opacity: 1,\n gradient: '',\n zIndex: 1,\n interactive: false,\n disabled: false,\n});\n\nconst { isRendered, rootClass, rootStyle } = useOverlay(props);\n</script>\n\n<style src=\"./overlay.scss\" lang=\"scss\" scoped></style>\n"],"mappings":";;;;AAIA,SAAS,aAAa,MAA4B;CAC9C,IAAI,QAAQ,QAAQ,SAAS,IAAI,OAAO,KAAA;CAExC,IAAI,OAAO,SAAS,UAAU;EAC1B,IAAI,CAAC,OAAO,SAAS,IAAI,KAAK,OAAO,GAAG,OAAO,KAAA;EAE/C,OAAO,GAAG,KAAK;CACnB;CAEA,OAAO;AACX;AAEA,SAAgB,WAAW,OAA+B;CACtD,MAAM,aAAa,eAAe,CAAC,MAAM,QAAQ;CACjD,MAAM,cAAc,eAAe,QAAQ,MAAM,QAAQ,CAAC;CAE1D,MAAM,oBAAoB,eAAe;EACrC,MAAM,UAAU,MAAM;EACtB,IAAI,YAAY,KAAA,KAAa,CAAC,OAAO,SAAS,OAAO,GAAG,OAAO;EAE/D,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC;CAC3C,CAAC;CAED,MAAM,YAAY,eAAe,aAAa,MAAM,IAAI,CAAC;CACzD,MAAM,UAAU,eAAe,QAAQ,UAAU,KAAK,CAAC;CAiCvD,OAAO;EACH;EACA,WAjCc,eACd,IAAI,cAAc;GACd,UAAU,YAAY;GACtB,SAAS,QAAQ;GACjB,aAAa,MAAM;EACvB,CAAC,CA4BD;EACA,WA1Bc,eAA8B;GAC5C,MAAM,QAAuB,EACzB,yBAAyB,MAAM,OACnC;GAEA,IAAI,UAAU,OACV,MAAM,wBAAwB,UAAU;GAG5C,IAAI,YAAY,OACZ,OAAO;IACH,GAAG;IACH,iBAAiB,MAAM;GAC3B;GAGJ,OAAO;IACH,GAAG;IACH,uBAAuB,MAAM;IAC7B,yBAAyB,kBAAkB;GAC/C;EACJ,CAKI;CACJ;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;EC/CA,MAAM,EAAE,YAAY,WAAW,cAAc,WAAW,OAAK;wBAlB9C,MAAA,UAAA,SAAU;;;iBAAU,MAAA,SAAA,CAAS;iBAAU,MAAA,SAAA,CAAS"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"popover.js","names":[],"sources":["../src/components/popover/usePopover.ts","../src/components/popover/popover.vue","../src/components/popover/popover.vue"],"sourcesContent":["import { computed, isRef, onMounted, ref, useId, useSlots, watch, type CSSProperties } from 'vue';\nimport { bem } from '@/utils/bem';\nimport type {\n PopoverContentSlotProps,\n PopoverOffset,\n PopoverPlacement,\n PopoverProps,\n PopoverRole,\n PopoverSlotProps,\n PopoverTriggerProps,\n} from './types';\n\ninterface PopoverPosition {\n x: number;\n y: number;\n}\n\ntype PopoverCssVariable =\n | '--_rp-popover-main-axis-offset'\n | '--_rp-popover-cross-axis-offset'\n | '--_rp-popover-target-x'\n | '--_rp-popover-target-y';\n\nconst DEFAULT_PLACEMENT: PopoverPlacement = 'bottom';\nconst DEFAULT_ROLE: PopoverRole = 'dialog';\nconst TARGET_ATTRIBUTES = ['aria-controls', 'aria-expanded', 'aria-haspopup'] as const;\n\ntype TargetAttribute = (typeof TARGET_ATTRIBUTES)[number];\n\nfunction isHTMLElement(value: unknown): value is HTMLElement {\n return typeof HTMLElement !== 'undefined' && value instanceof HTMLElement;\n}\n\nfunction getTargetPosition(rect: DOMRect, placement: PopoverPlacement): PopoverPosition {\n const centerX = rect.left + rect.width / 2;\n const centerY = rect.top + rect.height / 2;\n\n switch (placement) {\n case 'right':\n return { x: rect.right, y: centerY };\n case 'bottom':\n return { x: centerX, y: rect.bottom };\n case 'left':\n return { x: rect.left, y: centerY };\n case 'top':\n default:\n return { x: centerX, y: rect.top };\n }\n}\n\nfunction setPixelVar(\n style: CSSProperties,\n variable: PopoverCssVariable,\n value: number | undefined,\n) {\n if (value != null) style[variable] = `${value}px`;\n}\n\nfunction styleOrUndefined(style: CSSProperties): CSSProperties | undefined {\n return Object.keys(style).length > 0 ? style : undefined;\n}\n\nfunction resolveOffsetStyle(offset: PopoverOffset | undefined): CSSProperties | undefined {\n if (offset == null) return undefined;\n\n const style: CSSProperties = {};\n\n if (typeof offset === 'number') {\n setPixelVar(style, '--_rp-popover-main-axis-offset', offset);\n return style;\n }\n\n setPixelVar(style, '--_rp-popover-main-axis-offset', offset.mainAxis);\n setPixelVar(style, '--_rp-popover-cross-axis-offset', offset.crossAxis);\n\n return styleOrUndefined(style);\n}\n\nfunction addIdReference(currentValue: string | null, id: string) {\n const ids = (currentValue ?? '').split(/\\s+/).filter(Boolean);\n if (!ids.includes(id)) ids.push(id);\n return ids.join(' ');\n}\n\nfunction snapshotAttributes(element: HTMLElement) {\n const snapshot = {} as Record<TargetAttribute, string | null>;\n\n for (const attribute of TARGET_ATTRIBUTES) {\n snapshot[attribute] = element.getAttribute(attribute);\n }\n\n return snapshot;\n}\n\nfunction restoreAttributes(element: HTMLElement, snapshot: Record<TargetAttribute, string | null>) {\n for (const attribute of TARGET_ATTRIBUTES) {\n const value = snapshot[attribute];\n if (value == null) element.removeAttribute(attribute);\n else element.setAttribute(attribute, value);\n }\n}\n\nfunction applyTargetAttributes(\n element: HTMLElement,\n snapshot: Record<TargetAttribute, string | null>,\n options: {\n id: string;\n expanded: boolean;\n role: PopoverRole;\n },\n) {\n element.setAttribute('aria-controls', addIdReference(snapshot['aria-controls'], options.id));\n element.setAttribute('aria-expanded', String(options.expanded));\n element.setAttribute('aria-haspopup', options.role);\n}\n\nfunction resolveTargetElement(target: string | HTMLElement | null | undefined): HTMLElement | null {\n if (!target) return null;\n\n if (typeof target !== 'string') return isHTMLElement(target) ? target : null;\n if (typeof document === 'undefined') return null;\n\n try {\n const element = document.querySelector(target);\n return isHTMLElement(element) ? element : null;\n } catch {\n return null;\n }\n}\n\nexport function usePopover(\n props: Readonly<PopoverProps>,\n emitOpenChange?: (open: boolean) => void,\n) {\n const slots = useSlots();\n const generatedId = useId();\n const rootRef = ref<HTMLElement | null>(null);\n const targetElement = ref<HTMLElement | null>(null);\n const targetPosition = ref<PopoverPosition | null>(null);\n const uncontrolledOpen = ref(false);\n\n const popoverId = computed(() => props.id ?? `${generatedId}-popover`);\n const placement = computed(() => props.placement ?? DEFAULT_PLACEMENT);\n const popoverRole = computed(() => props.role ?? DEFAULT_ROLE);\n const isTargetMode = computed(() => props.target != null && props.target !== '');\n const hasContent = computed(() =>\n Boolean(slots.content || (isTargetMode.value && slots.default)),\n );\n const isDisabled = computed(() => Boolean(props.disabled || !hasContent.value));\n const isOpen = computed(() => props.open ?? uncontrolledOpen.value);\n const isVisible = computed(() => isOpen.value && !isDisabled.value);\n const shouldRenderContent = computed(() => !isDisabled.value);\n const shouldWireTarget = computed(() => isTargetMode.value && !isDisabled.value);\n\n const rootClass = computed(() =>\n bem('rp-popover', {\n [`placement-${placement.value}`]: true,\n target: isTargetMode.value,\n open: isVisible.value,\n disabled: props.disabled,\n }),\n );\n\n const contentStyle = computed<CSSProperties | undefined>(() => {\n const style: CSSProperties = {\n ...resolveOffsetStyle(props.offset),\n };\n\n if (isTargetMode.value && targetPosition.value) {\n setPixelVar(style, '--_rp-popover-target-x', targetPosition.value.x);\n setPixelVar(style, '--_rp-popover-target-y', targetPosition.value.y);\n }\n\n return styleOrUndefined(style);\n });\n\n const triggerProps = computed<PopoverTriggerProps>(() => ({\n 'aria-controls': isDisabled.value ? undefined : popoverId.value,\n 'aria-expanded': isDisabled.value ? undefined : isVisible.value,\n 'aria-haspopup': isDisabled.value ? undefined : popoverRole.value,\n onClick: onTriggerClick,\n onKeydown: onTriggerKeydown,\n }));\n\n const contentSlotProps = computed<PopoverContentSlotProps>(() => ({\n isOpen: isVisible.value,\n open: openPopover,\n close: closePopover,\n toggle: togglePopover,\n }));\n\n const slotProps = computed<PopoverSlotProps>(() => ({\n triggerProps: triggerProps.value,\n ...contentSlotProps.value,\n }));\n\n function setOpen(nextOpen: boolean) {\n const previousOpen = isOpen.value;\n if (props.open === undefined) uncontrolledOpen.value = nextOpen;\n if (previousOpen !== nextOpen) emitOpenChange?.(nextOpen);\n }\n\n function openPopover() {\n if (isDisabled.value) return;\n updateTargetPosition();\n setOpen(true);\n }\n\n function closePopover() {\n setOpen(false);\n }\n\n function togglePopover() {\n if (isVisible.value) closePopover();\n else openPopover();\n }\n\n function onTriggerClick() {\n togglePopover();\n }\n\n function onTriggerKeydown(event: KeyboardEvent) {\n if (event.key !== 'Escape') return;\n event.stopPropagation();\n closePopover();\n }\n\n function onTargetClick() {\n togglePopover();\n }\n\n function readTarget() {\n return isRef(props.target) ? props.target.value : props.target;\n }\n\n function updateTargetPosition() {\n if (!isTargetMode.value || !targetElement.value) {\n targetPosition.value = null;\n return;\n }\n\n targetPosition.value = getTargetPosition(\n targetElement.value.getBoundingClientRect(),\n placement.value,\n );\n }\n\n function isEventInsidePopover(event: Event) {\n const eventTarget = event.target;\n if (typeof Node === 'undefined' || !(eventTarget instanceof Node)) return false;\n\n return Boolean(\n rootRef.value?.contains(eventTarget) || targetElement.value?.contains(eventTarget),\n );\n }\n\n function onDocumentClick(event: MouseEvent) {\n if (props.closeOnOutsideClick === false || isEventInsidePopover(event)) return;\n closePopover();\n }\n\n function onDocumentKeydown(event: KeyboardEvent) {\n if (props.closeOnEscape === false || event.key !== 'Escape') return;\n closePopover();\n }\n\n function syncTargetElement() {\n const nextTarget = isTargetMode.value ? resolveTargetElement(readTarget()) : null;\n\n if (targetElement.value !== nextTarget) {\n targetElement.value = nextTarget;\n }\n\n if (!nextTarget) {\n targetPosition.value = null;\n return;\n }\n\n if (isVisible.value) updateTargetPosition();\n }\n\n watch(isDisabled, (disabled) => {\n if (disabled) closePopover();\n });\n\n watch(\n () => readTarget(),\n () => syncTargetElement(),\n { flush: 'post' },\n );\n\n watch(\n [shouldWireTarget, targetElement],\n ([shouldWire, target], _previous, onCleanup) => {\n if (!shouldWire || !target) return;\n\n target.addEventListener('click', onTargetClick);\n onCleanup(() => {\n target.removeEventListener('click', onTargetClick);\n });\n },\n { flush: 'sync' },\n );\n\n watch(\n [shouldWireTarget, targetElement, popoverId, popoverRole, isVisible],\n ([shouldWire, target], _previous, onCleanup) => {\n if (!shouldWire || !target) return;\n\n const snapshot = snapshotAttributes(target);\n applyTargetAttributes(target, snapshot, {\n id: popoverId.value,\n expanded: isVisible.value,\n role: popoverRole.value,\n });\n\n onCleanup(() => {\n restoreAttributes(target, snapshot);\n });\n },\n { flush: 'sync' },\n );\n\n watch(\n [isVisible, isTargetMode, targetElement],\n ([visible, targetMode, target], _previous, onCleanup) => {\n if (!visible || !targetMode || !target || typeof window === 'undefined') return;\n\n window.addEventListener('resize', updateTargetPosition);\n window.addEventListener('scroll', updateTargetPosition, true);\n\n onCleanup(() => {\n window.removeEventListener('resize', updateTargetPosition);\n window.removeEventListener('scroll', updateTargetPosition, true);\n });\n },\n { flush: 'sync' },\n );\n\n watch(\n isVisible,\n (visible, _previous, onCleanup) => {\n if (!visible || typeof document === 'undefined') return;\n\n document.addEventListener('click', onDocumentClick, true);\n document.addEventListener('keydown', onDocumentKeydown);\n\n onCleanup(() => {\n document.removeEventListener('click', onDocumentClick, true);\n document.removeEventListener('keydown', onDocumentKeydown);\n });\n },\n { flush: 'sync', immediate: true },\n );\n\n watch(\n [targetElement, placement, isVisible],\n () => {\n if (isVisible.value) updateTargetPosition();\n },\n { flush: 'sync' },\n );\n\n onMounted(syncTargetElement);\n\n return {\n rootRef,\n popoverId,\n isOpen,\n isVisible,\n isTargetMode,\n popoverRole,\n shouldRenderContent,\n rootClass,\n contentStyle,\n triggerProps,\n slotProps,\n contentSlotProps,\n openPopover,\n closePopover,\n togglePopover,\n onTriggerKeydown,\n };\n}\n","<template>\n <span ref=\"rootRef\" :class=\"rootClass\">\n <slot\n v-if=\"!isTargetMode\"\n :trigger-props=\"slotProps.triggerProps\"\n :is-open=\"slotProps.isOpen\"\n :open=\"slotProps.open\"\n :close=\"slotProps.close\"\n :toggle=\"slotProps.toggle\"\n />\n\n <Transition name=\"rp-popover-content\">\n <section\n v-if=\"shouldRenderContent\"\n v-show=\"isVisible\"\n :id=\"popoverId\"\n class=\"rp-popover__content\"\n :role=\"popoverRole\"\n :style=\"contentStyle\"\n >\n <slot\n name=\"content\"\n :is-open=\"contentSlotProps.isOpen\"\n :open=\"contentSlotProps.open\"\n :close=\"contentSlotProps.close\"\n :toggle=\"contentSlotProps.toggle\"\n >\n <slot\n v-if=\"isTargetMode\"\n :is-open=\"contentSlotProps.isOpen\"\n :open=\"contentSlotProps.open\"\n :close=\"contentSlotProps.close\"\n :toggle=\"contentSlotProps.toggle\"\n />\n </slot>\n </section>\n </Transition>\n </span>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { usePopover } from './usePopover';\nimport type { PopoverProps } from './types';\n\ndefineOptions({ name: 'RpPopover' });\n\nconst props = withDefaults(defineProps<PopoverProps>(), {\n placement: 'bottom',\n open: undefined,\n disabled: false,\n role: 'dialog',\n closeOnOutsideClick: true,\n closeOnEscape: true,\n});\n\nconst emit = defineEmits<{\n 'update:open': [value: boolean];\n}>();\n\nconst {\n rootRef,\n popoverId,\n isVisible,\n isTargetMode,\n popoverRole,\n shouldRenderContent,\n rootClass,\n contentStyle,\n slotProps,\n contentSlotProps,\n} = usePopover(props, (open) => {\n emit('update:open', open);\n});\n\nvoid rootRef;\n</script>\n\n<style src=\"./popover.scss\" lang=\"scss\" scoped></style>\n","<template>\n <span ref=\"rootRef\" :class=\"rootClass\">\n <slot\n v-if=\"!isTargetMode\"\n :trigger-props=\"slotProps.triggerProps\"\n :is-open=\"slotProps.isOpen\"\n :open=\"slotProps.open\"\n :close=\"slotProps.close\"\n :toggle=\"slotProps.toggle\"\n />\n\n <Transition name=\"rp-popover-content\">\n <section\n v-if=\"shouldRenderContent\"\n v-show=\"isVisible\"\n :id=\"popoverId\"\n class=\"rp-popover__content\"\n :role=\"popoverRole\"\n :style=\"contentStyle\"\n >\n <slot\n name=\"content\"\n :is-open=\"contentSlotProps.isOpen\"\n :open=\"contentSlotProps.open\"\n :close=\"contentSlotProps.close\"\n :toggle=\"contentSlotProps.toggle\"\n >\n <slot\n v-if=\"isTargetMode\"\n :is-open=\"contentSlotProps.isOpen\"\n :open=\"contentSlotProps.open\"\n :close=\"contentSlotProps.close\"\n :toggle=\"contentSlotProps.toggle\"\n />\n </slot>\n </section>\n </Transition>\n </span>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { usePopover } from './usePopover';\nimport type { PopoverProps } from './types';\n\ndefineOptions({ name: 'RpPopover' });\n\nconst props = withDefaults(defineProps<PopoverProps>(), {\n placement: 'bottom',\n open: undefined,\n disabled: false,\n role: 'dialog',\n closeOnOutsideClick: true,\n closeOnEscape: true,\n});\n\nconst emit = defineEmits<{\n 'update:open': [value: boolean];\n}>();\n\nconst {\n rootRef,\n popoverId,\n isVisible,\n isTargetMode,\n popoverRole,\n shouldRenderContent,\n rootClass,\n contentStyle,\n slotProps,\n contentSlotProps,\n} = usePopover(props, (open) => {\n emit('update:open', open);\n});\n\nvoid rootRef;\n</script>\n\n<style src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AAA,gBAAA,CAAgB,CAAA;OACzB,YAAM,MAAA,gBAAA,CAAgB,CAAA;OACtB,aAAO,MAAA,gBAAA,CAAgB,CAAA;OACvB,cAAQ,MAAA,gBAAA,CAAgB,CAAA;;;;0BAlBzB,MAAA,SAAA,CAAS"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"progress.js","names":[],"sources":["../src/components/progress/useProgress.ts","../src/components/progress/progress.vue","../src/components/progress/progress.vue","../src/components/progress/types.ts"],"sourcesContent":["import { computed, type CSSProperties } from 'vue';\nimport { useControlState } from '@/composables/useControlState';\nimport { bem } from '@/utils/bem';\nimport { getComponentCustomColor, isComponentPresetColor } from '@/utils/componentColors';\nimport type { ProgressProps } from './types';\n\ntype ProgressStateProps = Readonly<\n ProgressProps & {\n min: number;\n max: number;\n indeterminate: boolean;\n showValue: boolean;\n }\n>;\n\nexport function normalizeProgressBounds(min: number, max: number) {\n const safeMin = Number.isFinite(min) ? min : 0;\n const safeMax = Number.isFinite(max) ? max : 100;\n\n return safeMax >= safeMin ? { min: safeMin, max: safeMax } : { min: safeMax, max: safeMin };\n}\n\nexport function normalizeProgressValue(value: number | null | undefined, min: number, max: number) {\n const safeValue = Number.isFinite(value) ? Number(value) : min;\n\n return Math.min(max, Math.max(min, safeValue));\n}\n\nexport function getProgressValuePercent(value: number, min: number, max: number) {\n if (max <= min) return 0;\n\n const percent = ((value - min) / (max - min)) * 100;\n return Math.min(100, Math.max(0, percent));\n}\n\nfunction getFormattedProgressValue(\n value: number,\n percent: number,\n formatter: ProgressProps['formatValue'],\n) {\n return formatter ? formatter(value, percent) : `${Math.round(percent)}%`;\n}\n\nfunction getProgressAriaValueText(\n value: number,\n percent: number,\n ariaValueText: ProgressProps['ariaValueText'],\n formatter: ProgressProps['formatValue'],\n) {\n if (typeof ariaValueText === 'function') return String(ariaValueText(value, percent));\n if (ariaValueText != null && ariaValueText !== '') return String(ariaValueText);\n if (formatter) return String(formatter(value, percent));\n\n return undefined;\n}\n\nfunction setProgressStyleValue(\n style: CSSProperties,\n property: `--_rp-progress-${string}`,\n value: string | undefined,\n) {\n if (value) {\n style[property] = value;\n }\n}\n\nexport function useProgress(props: ProgressStateProps) {\n const control = useControlState(props);\n\n const bounds = computed(() => normalizeProgressBounds(props.min, props.max));\n const isIndeterminate = computed(() => props.indeterminate || props.value == null);\n const normalizedValue = computed(() =>\n normalizeProgressValue(props.value, bounds.value.min, bounds.value.max),\n );\n const valuePercent = computed(() =>\n getProgressValuePercent(normalizedValue.value, bounds.value.min, bounds.value.max),\n );\n const formattedValue = computed(() =>\n getFormattedProgressValue(normalizedValue.value, valuePercent.value, props.formatValue),\n );\n const ariaValueText = computed(() =>\n isIndeterminate.value\n ? undefined\n : getProgressAriaValueText(\n normalizedValue.value,\n valuePercent.value,\n props.ariaValueText,\n props.formatValue,\n ),\n );\n const rootClass = computed(() =>\n bem('rp-progress', {\n [`color-${props.color}`]: isComponentPresetColor(props.color),\n [`size-${props.size}`]: Boolean(props.size),\n [`radius-${props.radius}`]: Boolean(props.radius),\n indeterminate: isIndeterminate.value,\n }),\n );\n const rootStyle = computed<CSSProperties>(() => {\n const style: CSSProperties = {\n '--_rp-progress-value': `${valuePercent.value}%`,\n '--_rp-progress-ratio': `${valuePercent.value / 100}`,\n };\n\n setProgressStyleValue(\n style,\n '--_rp-progress-custom-color',\n getComponentCustomColor(props.color),\n );\n\n return style;\n });\n\n return {\n control,\n rootClass,\n rootStyle,\n isIndeterminate,\n normalizedValue,\n valuePercent,\n formattedValue,\n ariaValueText,\n ariaValueMin: computed(() => (isIndeterminate.value ? undefined : bounds.value.min)),\n ariaValueMax: computed(() => (isIndeterminate.value ? undefined : bounds.value.max)),\n ariaValueNow: computed(() => (isIndeterminate.value ? undefined : normalizedValue.value)),\n };\n}\n","<template>\n <div\n :id=\"control.id\"\n :class=\"rootClass\"\n :style=\"rootStyle\"\n role=\"progressbar\"\n :data-state=\"isIndeterminate ? 'indeterminate' : 'determinate'\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :aria-valuemin=\"ariaValueMin\"\n :aria-valuemax=\"ariaValueMax\"\n :aria-valuenow=\"ariaValueNow\"\n :aria-valuetext=\"ariaValueText\"\n >\n <span\n v-if=\"$slots.default || (!isIndeterminate && ($slots.value || showValue))\"\n class=\"rp-progress__header\"\n >\n <span v-if=\"$slots.default\" class=\"rp-progress__label\">\n <slot />\n </span>\n <span\n v-if=\"!isIndeterminate && ($slots.value || showValue)\"\n class=\"rp-progress__value\"\n aria-hidden=\"true\"\n >\n <slot\n v-if=\"$slots.value\"\n name=\"value\"\n :value=\"normalizedValue\"\n :formatted-value=\"formattedValue\"\n :percent=\"valuePercent\"\n />\n <template v-else>{{ formattedValue }}</template>\n </span>\n </span>\n <span class=\"rp-progress__track\" aria-hidden=\"true\">\n <span class=\"rp-progress__indicator\" />\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport type { ProgressProps } from './types';\nimport { useProgress } from './useProgress';\n\ndefineOptions({ name: 'RpProgress' });\n\nconst props = withDefaults(defineProps<ProgressProps>(), {\n min: 0,\n max: 100,\n indeterminate: false,\n showValue: false,\n});\n\nconst {\n control,\n rootClass,\n rootStyle,\n isIndeterminate,\n normalizedValue,\n valuePercent,\n formattedValue,\n ariaValueText,\n ariaValueMin,\n ariaValueMax,\n ariaValueNow,\n} = useProgress(props);\n</script>\n\n<style src=\"./progress.scss\" lang=\"scss\" scoped></style>\n","<template>\n <div\n :id=\"control.id\"\n :class=\"rootClass\"\n :style=\"rootStyle\"\n role=\"progressbar\"\n :data-state=\"isIndeterminate ? 'indeterminate' : 'determinate'\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :aria-valuemin=\"ariaValueMin\"\n :aria-valuemax=\"ariaValueMax\"\n :aria-valuenow=\"ariaValueNow\"\n :aria-valuetext=\"ariaValueText\"\n >\n <span\n v-if=\"$slots.default || (!isIndeterminate && ($slots.value || showValue))\"\n class=\"rp-progress__header\"\n >\n <span v-if=\"$slots.default\" class=\"rp-progress__label\">\n <slot />\n </span>\n <span\n v-if=\"!isIndeterminate && ($slots.value || showValue)\"\n class=\"rp-progress__value\"\n aria-hidden=\"true\"\n >\n <slot\n v-if=\"$slots.value\"\n name=\"value\"\n :value=\"normalizedValue\"\n :formatted-value=\"formattedValue\"\n :percent=\"valuePercent\"\n />\n <template v-else>{{ formattedValue }}</template>\n </span>\n </span>\n <span class=\"rp-progress__track\" aria-hidden=\"true\">\n <span class=\"rp-progress__indicator\" />\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport type { ProgressProps } from './types';\nimport { useProgress } from './useProgress';\n\ndefineOptions({ name: 'RpProgress' });\n\nconst props = withDefaults(defineProps<ProgressProps>(), {\n min: 0,\n max: 100,\n indeterminate: false,\n showValue: false,\n});\n\nconst {\n control,\n rootClass,\n rootStyle,\n isIndeterminate,\n normalizedValue,\n valuePercent,\n formattedValue,\n ariaValueText,\n ariaValueMin,\n ariaValueMax,\n ariaValueNow,\n} = useProgress(props);\n</script>\n\n<style src=\"./progress.scss\" lang=\"scss\" scoped></style>\n","import { componentColors, type ComponentColorValue } from '../../utils/componentColors';\n\nexport const progressColors = componentColors;\n\nexport const progressSizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;\n\nexport const progressRadiuses = ['none', 'xs', 'sm', 'md', 'lg', 'xl', 'full'] as const;\n\nexport type ProgressColor = ComponentColorValue;\n\nexport type ProgressSize = (typeof progressSizes)[number];\n\nexport type ProgressRadius = (typeof progressRadiuses)[number];\n\nexport type ProgressValueFormatter = (value: number, percent: number) => string | number;\n\nexport interface ProgressProps {\n id?: string;\n value?: number | null;\n min?: number;\n max?: number;\n color?: ProgressColor;\n size?: ProgressSize;\n radius?: ProgressRadius;\n indeterminate?: boolean;\n showValue?: boolean;\n formatValue?: ProgressValueFormatter;\n aria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BAEhB,cAAY,MAAA,eAAA,IAAe,kBAAA,aAAA;gBAC3B,cAAY,QAAA,aAAa,KAAA,CAAS;gBAClC,mBAAiB,SAAO,cAAA;gBACxB,oBAAkB,SAAO,eAAA;gBACzB,iBAAe,MAAA,YAAA,CAAY;gBAC3B,iBAAe,MAAA,YAAA,CAAY;gBAC3B,iBAAe,MAAA,YAAA,CAAY;gBAC3B,kBAAgB,MAAA,aAAA,CAAa;;;iBAGpB,OAAM,WAAA,CAAc,MAAA,eAAA,MAAoB,OAAM,SAAU,QAAA,kBAAS;;;kBAG3D,OAAM,eAAA;;;;;;;mBAIP,MAAA,eAAA,MAAoB,OAAM,SAAU,QAAA,kBAAS;;;mBAK1C,OAAM,aAAA;uBACZ,SAAY;MACX,aAAO,MAAA,eAAA;MACP,sBAAiB,MAAA,cAAA;MACjB,eAAS,MAAA,YAAA;;;;qDAEM,MAAA,cAAA,CAAc,CAAA,CAAA;;;;;;;;;;;;AEhClD,IAAa,iBAAiB;AAE9B,IAAa,gBAAgB;CAAC;CAAM;CAAM;CAAM;CAAM;AAAI;AAE1D,IAAa,mBAAmB;CAAC;CAAQ;CAAM;CAAM;CAAM;CAAM;CAAM;AAAM"}
package/dist/radio.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"radio.js","names":[],"sources":["../src/components/radio/types.ts","../src/components/radio/useRadio.ts","../src/components/radio/radio.vue","../src/components/radio/radio.vue","../src/components/radio/radio-group.vue","../src/components/radio/radio-group.vue"],"sourcesContent":["import type { InjectionKey } from 'vue';\nimport type { ComponentColorValue } from '../../utils/componentColors';\n\nexport type RadioColor = ComponentColorValue;\n\nexport type RadioSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\nexport type RadioVariant = 'solid' | 'outline';\n\nexport interface RadioProps {\n value: string | number;\n variant?: RadioVariant;\n color?: RadioColor;\n size?: RadioSize;\n disabled?: boolean;\n}\n\nexport interface RadioGroupProps {\n id?: string;\n name?: string;\n modelValue: string | number | null;\n variant?: RadioVariant;\n color?: RadioColor;\n size?: RadioSize;\n disabled?: boolean;\n required?: boolean;\n invalid?: boolean;\n ariaLabel?: string;\n describedby?: string;\n labelledby?: string;\n}\n\nexport interface RadioGroupContext {\n modelValue: string | number | null;\n name: string;\n disabled: boolean;\n required: boolean;\n variant?: RadioVariant;\n color?: RadioColor;\n size?: RadioSize;\n select: (value: string | number) => void;\n}\n\nexport const radioGroupKey = Symbol('radioGroup') as InjectionKey<RadioGroupContext>;\n","import { computed, provide, useId, type CSSProperties } from 'vue';\nimport { useControlState } from '@/composables/useControlState';\nimport { useRequiredInject } from '@/composables/useRequiredInject';\nimport { getComponentCustomColor, isComponentPresetColor } from '@/utils/componentColors';\nimport { bem } from '@/utils/bem';\nimport { radioGroupKey } from './types';\nimport type { RadioGroupContext, RadioGroupProps, RadioProps } from './types';\n\nfunction getRadioColorStyle(color: RadioProps['color']) {\n const customColor = getComponentCustomColor(color);\n if (!customColor) return undefined;\n\n return {\n '--_rp-radio-custom-color': customColor,\n '--_rp-radio-custom-on-color': 'var(--rp-color-on-primary)',\n } satisfies CSSProperties;\n}\n\nexport function useRadio(props: Readonly<RadioProps>) {\n const group = useRequiredInject(radioGroupKey, 'RpRadio');\n const isChecked = computed(() => group.modelValue === props.value);\n const isDisabled = computed(() => props.disabled || group.disabled);\n const variant = computed(() => props.variant ?? group.variant);\n const color = computed(() => props.color ?? group.color);\n const size = computed(() => props.size ?? group.size);\n\n const rootClass = computed(() =>\n bem('rp-radio', {\n checked: isChecked.value,\n disabled: isDisabled.value,\n [variant.value ?? '']: Boolean(variant.value),\n [`color-${color.value}`]: isComponentPresetColor(color.value),\n [`size-${size.value}`]: Boolean(size.value),\n }),\n );\n\n const rootStyle = computed(() => getRadioColorStyle(color.value));\n\n function onSelect() {\n if (isDisabled.value) return;\n group.select(props.value);\n }\n\n return {\n group,\n isChecked,\n isDisabled,\n rootClass,\n rootStyle,\n onSelect,\n };\n}\n\nexport function useRadioGroup(\n props: Readonly<RadioGroupProps>,\n emitUpdate: (value: string | number | null) => void,\n) {\n const control = useControlState(props);\n\n const rootClass = computed(() =>\n bem('rp-radio-group', {\n disabled: control.disabled,\n invalid: control.invalid,\n }),\n );\n\n const generatedName = useId();\n const groupName = computed(() => props.name ?? `${control.id ?? generatedName}-radio`);\n\n provide<RadioGroupContext>(radioGroupKey, {\n get modelValue() {\n return props.modelValue;\n },\n get name() {\n return groupName.value;\n },\n get disabled() {\n return control.disabled;\n },\n get required() {\n return control.required;\n },\n get variant() {\n return props.variant;\n },\n get color() {\n return props.color;\n },\n get size() {\n return props.size;\n },\n select(value) {\n emitUpdate(value);\n },\n });\n\n return {\n control,\n rootClass,\n };\n}\n","<template>\n <label\n :class=\"rootClass\"\n :style=\"rootStyle\"\n :data-disabled=\"isDisabled || undefined\"\n :data-state=\"isChecked ? 'checked' : 'unchecked'\"\n >\n <input\n type=\"radio\"\n class=\"rp-radio__native\"\n :name=\"group.name\"\n :value=\"value\"\n :checked=\"isChecked\"\n :disabled=\"isDisabled || undefined\"\n :required=\"group.required || undefined\"\n @change=\"onSelect\"\n />\n <span class=\"rp-radio__dot\" />\n <span v-if=\"$slots.default\" class=\"rp-radio__label\">\n <slot />\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useRadio } from './useRadio';\nimport type { RadioProps } from './types';\n\ndefineOptions({ name: 'RpRadio' });\n\nconst props = withDefaults(defineProps<RadioProps>(), {\n variant: undefined,\n color: undefined,\n size: undefined,\n disabled: false,\n});\n\nconst { group, isChecked, isDisabled, rootClass, rootStyle, onSelect } = useRadio(props);\n</script>\n\n<style src=\"./radio.scss\" lang=\"scss\" scoped></style>\n","<template>\n <label\n :class=\"rootClass\"\n :style=\"rootStyle\"\n :data-disabled=\"isDisabled || undefined\"\n :data-state=\"isChecked ? 'checked' : 'unchecked'\"\n >\n <input\n type=\"radio\"\n class=\"rp-radio__native\"\n :name=\"group.name\"\n :value=\"value\"\n :checked=\"isChecked\"\n :disabled=\"isDisabled || undefined\"\n :required=\"group.required || undefined\"\n @change=\"onSelect\"\n />\n <span class=\"rp-radio__dot\" />\n <span v-if=\"$slots.default\" class=\"rp-radio__label\">\n <slot />\n </span>\n </label>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useRadio } from './useRadio';\nimport type { RadioProps } from './types';\n\ndefineOptions({ name: 'RpRadio' });\n\nconst props = withDefaults(defineProps<RadioProps>(), {\n variant: undefined,\n color: undefined,\n size: undefined,\n disabled: false,\n});\n\nconst { group, isChecked, isDisabled, rootClass, rootStyle, onSelect } = useRadio(props);\n</script>\n\n<style src=\"./radio.scss\" lang=\"scss\" scoped></style>\n","<template>\n <div\n :id=\"control.id\"\n :class=\"rootClass\"\n role=\"radiogroup\"\n :data-disabled=\"control.disabled || undefined\"\n :data-invalid=\"control.invalid || undefined\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :aria-invalid=\"control.invalid || undefined\"\n :aria-required=\"control.required || undefined\"\n >\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useRadioGroup } from './useRadio';\nimport type { RadioGroupProps } from './types';\n\ndefineOptions({ name: 'RpRadioGroup' });\n\nconst props = withDefaults(defineProps<RadioGroupProps>(), {\n variant: undefined,\n color: undefined,\n size: undefined,\n disabled: undefined,\n required: undefined,\n invalid: undefined,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string | number | null];\n}>();\n\nconst { control, rootClass } = useRadioGroup(props, (value) => {\n emit('update:modelValue', value);\n});\n</script>\n\n<style src=\"./radio-group.scss\" lang=\"scss\" scoped></style>\n","<template>\n <div\n :id=\"control.id\"\n :class=\"rootClass\"\n role=\"radiogroup\"\n :data-disabled=\"control.disabled || undefined\"\n :data-invalid=\"control.invalid || undefined\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :aria-invalid=\"control.invalid || undefined\"\n :aria-required=\"control.required || undefined\"\n >\n <slot />\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport { useRadioGroup } from './useRadio';\nimport type { RadioGroupProps } from './types';\n\ndefineOptions({ name: 'RpRadioGroup' });\n\nconst props = withDefaults(defineProps<RadioGroupProps>(), {\n variant: undefined,\n color: undefined,\n size: undefined,\n disabled: undefined,\n required: undefined,\n invalid: undefined,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string | number | null];\n}>();\n\nconst { control, rootClass } = useRadioGroup(props, (value) => {\n emit('update:modelValue', value);\n});\n</script>\n\n<style src=\"./radio-group.scss\" lang=\"scss\" scoped></style>\n"],"mappings":";;;;;;;AA2CA,IAAa,gBAAgB,OAAO,YAAY;;;ACnChD,SAAS,mBAAmB,OAA4B;CACpD,MAAM,cAAc,wBAAwB,KAAK;CACjD,IAAI,CAAC,aAAa,OAAO,KAAA;CAEzB,OAAO;EACH,4BAA4B;EAC5B,+BAA+B;CACnC;AACJ;AAEA,SAAgB,SAAS,OAA6B;CAClD,MAAM,QAAQ,kBAAkB,eAAe,SAAS;CACxD,MAAM,YAAY,eAAe,MAAM,eAAe,MAAM,KAAK;CACjE,MAAM,aAAa,eAAe,MAAM,YAAY,MAAM,QAAQ;CAClE,MAAM,UAAU,eAAe,MAAM,WAAW,MAAM,OAAO;CAC7D,MAAM,QAAQ,eAAe,MAAM,SAAS,MAAM,KAAK;CACvD,MAAM,OAAO,eAAe,MAAM,QAAQ,MAAM,IAAI;CAEpD,MAAM,YAAY,eACd,IAAI,YAAY;EACZ,SAAS,UAAU;EACnB,UAAU,WAAW;GACpB,QAAQ,SAAS,KAAK,QAAQ,QAAQ,KAAK;GAC3C,SAAS,MAAM,UAAU,uBAAuB,MAAM,KAAK;GAC3D,QAAQ,KAAK,UAAU,QAAQ,KAAK,KAAK;CAC9C,CAAC,CACL;CAEA,MAAM,YAAY,eAAe,mBAAmB,MAAM,KAAK,CAAC;CAEhE,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;;;;;;;;;;;;;;;;;EEK1B,MAAM,QAAQ;EASd,MAAM,OAAO;EAIb,MAAM,EAAE,SAAS,cAAc,cAAc,QAAQ,UAAU;GAC3D,KAAK,qBAAqB,KAAK;EACnC,CAAC;;;;;eApCQ,MAAI,SAAO,EAAA;gBACJ,MAAA,SAAA,CAAS;eAEhB,iBAAe,SAAO,YAAa,KAAA,CAAS;eAC5C,gBAAc,oBAAmB,KAAA,CAAS;eAC1C,cAAY,QAAA,aAAa,KAAA,CAAS;eAClC,mBAAiB,SAAO,cAAA;eACxB,oBAAkB,SAAO,eAAA;eACzB,gBAAc,oBAAmB,KAAA,CAAS;eAC1C,iBAAe,SAAO,YAAa,KAAA,CAAS"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"select.js","names":[],"sources":["../src/composables/useListNavigation.ts","../src/components/select/useSelect.ts","../src/components/select/select.vue","../src/components/select/select.vue"],"sourcesContent":["import { computed, ref } from 'vue';\n\nexport interface ListNavigationItem {\n disabled?: boolean;\n}\n\nexport interface UseListNavigationOptions<T extends ListNavigationItem> {\n items: () => T[];\n isSelected?: (item: T) => boolean;\n loop?: boolean;\n}\n\nexport function useListNavigation<T extends ListNavigationItem>(\n options: UseListNavigationOptions<T>,\n) {\n const localFocusedIndex = ref(-1);\n const loop = options.loop ?? true;\n\n const enabledIndexes = computed(() =>\n options\n .items()\n .map((item, index) => (item.disabled ? -1 : index))\n .filter((index) => index >= 0),\n );\n\n function resetFocus() {\n localFocusedIndex.value = -1;\n }\n\n function setNearest(index: number, direction: 1 | -1) {\n const indexes = enabledIndexes.value;\n if (indexes.length === 0) {\n resetFocus();\n return;\n }\n\n if (options.items()[index] && !options.items()[index]?.disabled) {\n localFocusedIndex.value = index;\n return;\n }\n\n let next: number | undefined;\n if (direction === 1) {\n next = indexes.find((i) => i > index);\n } else {\n for (let i = indexes.length - 1; i >= 0; i -= 1) {\n const candidate = indexes[i]!;\n if (candidate < index) {\n next = candidate;\n break;\n }\n }\n }\n\n if (next !== undefined) {\n localFocusedIndex.value = next;\n } else if (loop) {\n localFocusedIndex.value = direction === 1 ? indexes[0]! : indexes[indexes.length - 1]!;\n }\n }\n\n function focusSelected() {\n const items = options.items();\n const selectedIndex = options.isSelected\n ? items.findIndex((item) => options.isSelected!(item) && !item.disabled)\n : -1;\n if (selectedIndex >= 0) {\n localFocusedIndex.value = selectedIndex;\n } else {\n focusFirst();\n }\n }\n\n function focusFirst() {\n const first = enabledIndexes.value[0];\n localFocusedIndex.value = first ?? -1;\n }\n\n function focusLast() {\n const indexes = enabledIndexes.value;\n localFocusedIndex.value = indexes[indexes.length - 1] ?? -1;\n }\n\n function moveFocus(delta: 1 | -1) {\n if (localFocusedIndex.value < 0) {\n if (delta === 1) {\n focusFirst();\n } else {\n focusLast();\n }\n return;\n }\n setNearest(localFocusedIndex.value + delta, delta);\n }\n\n return {\n focusedIndex: localFocusedIndex,\n resetFocus,\n focusSelected,\n focusFirst,\n focusLast,\n moveFocus,\n };\n}\n","import { computed, nextTick, ref, useId } from 'vue';\nimport { useClickOutside } from '@/composables/useClickOutside';\nimport { useControlState } from '@/composables/useControlState';\nimport { useListNavigation } from '@/composables/useListNavigation';\nimport { bem } from '@/utils/bem';\nimport type { SelectOption, SelectProps } from './types';\n\ntype SelectValue = string | number | null;\n\nfunction hasSelectValue(value: SelectValue) {\n return value != null && value !== '';\n}\n\nfunction getSelectDisplayLabel(options: SelectOption[] | undefined, value: SelectValue) {\n if (!hasSelectValue(value)) return '';\n return options?.find((option) => option.value === value)?.label ?? '';\n}\n\nfunction getSelectActiveDescendantId(baseId: string, focusedIndex: number) {\n return focusedIndex < 0 ? undefined : `${baseId}-option-${focusedIndex}`;\n}\n\nexport function useSelect(props: Readonly<SelectProps>, emitUpdate: (value: SelectValue) => void) {\n const selectRef = ref<HTMLElement | null>(null);\n const triggerRef = ref<HTMLElement | null>(null);\n const isOpen = ref(false);\n\n const selectId = useId();\n const listboxId = `${selectId}-listbox`;\n\n const control = useControlState(props);\n const visibleOptions = computed(() => props.options ?? []);\n\n const navigation = useListNavigation<SelectOption>({\n items: () => visibleOptions.value,\n isSelected: (item) => item.value === props.modelValue,\n });\n\n const focusedIndex = navigation.focusedIndex;\n const activeDescendantId = computed(() =>\n getSelectActiveDescendantId(selectId, focusedIndex.value),\n );\n\n const rootClass = computed(() =>\n bem('rp-select', {\n open: isOpen.value,\n [`radius-${props.radius}`]: Boolean(props.radius),\n disabled: control.disabled,\n invalid: control.invalid,\n }),\n );\n\n const hasValue = computed(() => hasSelectValue(props.modelValue));\n const displayLabel = computed(() => getSelectDisplayLabel(props.options, props.modelValue));\n const canClear = computed(() =>\n Boolean(props.clearable && hasValue.value && !control.disabled),\n );\n\n function focusTrigger() {\n nextTick(() => triggerRef.value?.focus());\n }\n\n function open() {\n if (control.disabled || isOpen.value) return;\n isOpen.value = true;\n navigation.focusSelected();\n }\n\n function close() {\n isOpen.value = false;\n navigation.resetFocus();\n }\n\n function toggle() {\n if (control.disabled) return;\n if (isOpen.value) {\n close();\n focusTrigger();\n } else {\n open();\n }\n }\n\n function selectOption(option: SelectOption) {\n if (option.disabled) return;\n emitUpdate(option.value);\n close();\n focusTrigger();\n }\n\n function clearSelection() {\n if (!canClear.value) return;\n emitUpdate(null);\n close();\n focusTrigger();\n }\n\n function onOptionMouseenter(option: SelectOption, index: number) {\n if (!option.disabled) focusedIndex.value = index;\n }\n\n function selectFocusedOption() {\n if (focusedIndex.value < 0 || focusedIndex.value >= visibleOptions.value.length) return;\n selectOption(visibleOptions.value[focusedIndex.value]!);\n }\n\n function onTriggerKeydown(e: KeyboardEvent) {\n if (control.disabled) return;\n\n switch (e.key) {\n case 'Enter':\n e.preventDefault();\n if (!isOpen.value) open();\n else selectFocusedOption();\n break;\n case ' ':\n e.preventDefault();\n if (!isOpen.value) open();\n else selectFocusedOption();\n break;\n case 'ArrowDown':\n e.preventDefault();\n if (!isOpen.value) open();\n else navigation.moveFocus(1);\n break;\n case 'ArrowUp':\n e.preventDefault();\n if (!isOpen.value) {\n open();\n navigation.focusLast();\n } else {\n navigation.moveFocus(-1);\n }\n break;\n case 'Home':\n if (isOpen.value) {\n e.preventDefault();\n navigation.focusFirst();\n }\n break;\n case 'End':\n if (isOpen.value) {\n e.preventDefault();\n navigation.focusLast();\n }\n break;\n case 'Delete':\n case 'Backspace':\n if (canClear.value) {\n e.preventDefault();\n clearSelection();\n }\n break;\n case 'Escape':\n e.preventDefault();\n close();\n focusTrigger();\n break;\n }\n }\n\n useClickOutside(selectRef, isOpen, close);\n\n return {\n selectRef,\n triggerRef,\n isOpen,\n selectId,\n listboxId,\n control,\n visibleOptions,\n focusedIndex,\n activeDescendantId,\n rootClass,\n hasValue,\n displayLabel,\n canClear,\n toggle,\n selectOption,\n clearSelection,\n onOptionMouseenter,\n onTriggerKeydown,\n };\n}\n","<template>\n <div :class=\"rootClass\" ref=\"selectRef\">\n <input\n v-if=\"name\"\n type=\"hidden\"\n :name=\"name\"\n :value=\"modelValue ?? ''\"\n :disabled=\"control.disabled || undefined\"\n />\n <div\n :id=\"control.id\"\n ref=\"triggerRef\"\n class=\"rp-select__trigger\"\n role=\"combobox\"\n :aria-expanded=\"isOpen\"\n aria-haspopup=\"listbox\"\n :aria-activedescendant=\"activeDescendantId\"\n :aria-controls=\"listboxId\"\n :aria-disabled=\"control.disabled || undefined\"\n :aria-invalid=\"control.invalid || undefined\"\n :aria-required=\"control.required || undefined\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :data-state=\"isOpen ? 'open' : 'closed'\"\n :data-disabled=\"control.disabled || undefined\"\n :tabindex=\"control.disabled ? -1 : 0\"\n @click=\"toggle\"\n @keydown=\"onTriggerKeydown\"\n >\n <span class=\"rp-select__value\" :class=\"{ 'rp-select__placeholder': !hasValue }\">\n {{ displayLabel || placeholder }}\n </span>\n\n <span class=\"rp-select__indicator\">\n <button\n v-if=\"canClear\"\n type=\"button\"\n class=\"rp-select__clear\"\n aria-label=\"Clear selection\"\n tabindex=\"-1\"\n @mousedown.prevent\n @click.stop=\"clearSelection\"\n >\n <XIcon />\n </button>\n <span class=\"rp-select__arrow\" aria-hidden=\"true\">\n <ChevronsUpDownIcon />\n </span>\n </span>\n </div>\n\n <Transition name=\"rp-select-dropdown\">\n <div v-if=\"isOpen\" class=\"rp-select__dropdown\" role=\"listbox\" :id=\"listboxId\">\n <div v-if=\"visibleOptions.length === 0\" class=\"rp-select__empty\">\n <slot name=\"empty\">No options</slot>\n </div>\n <div\n v-for=\"(option, index) in visibleOptions\"\n :key=\"option.value\"\n role=\"option\"\n :id=\"`${selectId}-option-${index}`\"\n :aria-selected=\"option.value === modelValue\"\n :aria-disabled=\"option.disabled || undefined\"\n :data-selected=\"option.value === modelValue || undefined\"\n :data-disabled=\"option.disabled || undefined\"\n :class=\"[\n 'rp-select__option',\n {\n 'rp-select__option--selected': option.value === modelValue,\n 'rp-select__option--focused': index === focusedIndex,\n 'rp-select__option--disabled': option.disabled,\n },\n ]\"\n @click=\"selectOption(option)\"\n @mouseenter=\"onOptionMouseenter(option, index)\"\n >\n {{ option.label }}\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport ChevronsUpDownIcon from '~icons/lucide/chevrons-up-down';\nimport XIcon from '~icons/lucide/x';\nimport { useSelect } from './useSelect';\nimport type { SelectProps } from './types';\n\ndefineOptions({ name: 'RpSelect' });\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n options: () => [],\n placeholder: 'Select...',\n clearable: false,\n disabled: undefined,\n required: undefined,\n invalid: undefined,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string | number | null];\n}>();\n\nconst {\n selectRef,\n triggerRef,\n isOpen,\n selectId,\n listboxId,\n control,\n visibleOptions,\n focusedIndex,\n activeDescendantId,\n rootClass,\n hasValue,\n displayLabel,\n canClear,\n toggle,\n selectOption,\n clearSelection,\n onOptionMouseenter,\n onTriggerKeydown,\n} = useSelect(props, (value) => {\n emit('update:modelValue', value);\n});\n\nvoid selectRef;\nvoid triggerRef;\n</script>\n\n<style src=\"./select.scss\" lang=\"scss\" scoped></style>\n","<template>\n <div :class=\"rootClass\" ref=\"selectRef\">\n <input\n v-if=\"name\"\n type=\"hidden\"\n :name=\"name\"\n :value=\"modelValue ?? ''\"\n :disabled=\"control.disabled || undefined\"\n />\n <div\n :id=\"control.id\"\n ref=\"triggerRef\"\n class=\"rp-select__trigger\"\n role=\"combobox\"\n :aria-expanded=\"isOpen\"\n aria-haspopup=\"listbox\"\n :aria-activedescendant=\"activeDescendantId\"\n :aria-controls=\"listboxId\"\n :aria-disabled=\"control.disabled || undefined\"\n :aria-invalid=\"control.invalid || undefined\"\n :aria-required=\"control.required || undefined\"\n :aria-label=\"ariaLabel || undefined\"\n :aria-labelledby=\"control.ariaLabelledby\"\n :aria-describedby=\"control.ariaDescribedby\"\n :data-state=\"isOpen ? 'open' : 'closed'\"\n :data-disabled=\"control.disabled || undefined\"\n :tabindex=\"control.disabled ? -1 : 0\"\n @click=\"toggle\"\n @keydown=\"onTriggerKeydown\"\n >\n <span class=\"rp-select__value\" :class=\"{ 'rp-select__placeholder': !hasValue }\">\n {{ displayLabel || placeholder }}\n </span>\n\n <span class=\"rp-select__indicator\">\n <button\n v-if=\"canClear\"\n type=\"button\"\n class=\"rp-select__clear\"\n aria-label=\"Clear selection\"\n tabindex=\"-1\"\n @mousedown.prevent\n @click.stop=\"clearSelection\"\n >\n <XIcon />\n </button>\n <span class=\"rp-select__arrow\" aria-hidden=\"true\">\n <ChevronsUpDownIcon />\n </span>\n </span>\n </div>\n\n <Transition name=\"rp-select-dropdown\">\n <div v-if=\"isOpen\" class=\"rp-select__dropdown\" role=\"listbox\" :id=\"listboxId\">\n <div v-if=\"visibleOptions.length === 0\" class=\"rp-select__empty\">\n <slot name=\"empty\">No options</slot>\n </div>\n <div\n v-for=\"(option, index) in visibleOptions\"\n :key=\"option.value\"\n role=\"option\"\n :id=\"`${selectId}-option-${index}`\"\n :aria-selected=\"option.value === modelValue\"\n :aria-disabled=\"option.disabled || undefined\"\n :data-selected=\"option.value === modelValue || undefined\"\n :data-disabled=\"option.disabled || undefined\"\n :class=\"[\n 'rp-select__option',\n {\n 'rp-select__option--selected': option.value === modelValue,\n 'rp-select__option--focused': index === focusedIndex,\n 'rp-select__option--disabled': option.disabled,\n },\n ]\"\n @click=\"selectOption(option)\"\n @mouseenter=\"onOptionMouseenter(option, index)\"\n >\n {{ option.label }}\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<script lang=\"ts\" setup vapor>\nimport ChevronsUpDownIcon from '~icons/lucide/chevrons-up-down';\nimport XIcon from '~icons/lucide/x';\nimport { useSelect } from './useSelect';\nimport type { SelectProps } from './types';\n\ndefineOptions({ name: 'RpSelect' });\n\nconst props = withDefaults(defineProps<SelectProps>(), {\n options: () => [],\n placeholder: 'Select...',\n clearable: false,\n disabled: undefined,\n required: undefined,\n invalid: undefined,\n});\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string | number | null];\n}>();\n\nconst {\n selectRef,\n triggerRef,\n isOpen,\n selectId,\n listboxId,\n control,\n visibleOptions,\n focusedIndex,\n activeDescendantId,\n rootClass,\n hasValue,\n displayLabel,\n canClear,\n toggle,\n selectOption,\n clearSelection,\n onOptionMouseenter,\n onTriggerKeydown,\n} = useSelect(props, (value) => {\n emit('update:modelValue', value);\n});\n\nvoid selectRef;\nvoid triggerRef;\n</script>\n\n<style src=\"./select.scss\" lang=\"scss\" scoped></style>\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,SAAgB,kBACZ,SACF;CACE,MAAM,oBAAoB,IAAI,EAAE;CAChC,MAAM,OAAO,QAAQ,QAAQ;CAE7B,MAAM,iBAAiB,eACnB,QACK,MAAM,CAAC,CACP,KAAK,MAAM,UAAW,KAAK,WAAW,KAAK,KAAM,CAAC,CAClD,QAAQ,UAAU,SAAS,CAAC,CACrC;CAEA,SAAS,aAAa;EAClB,kBAAkB,QA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