mood-ui 0.14.1 → 0.15.0

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 (171) hide show
  1. package/README.md +1 -1
  2. package/dist/components/data-display/table/Table.cjs +1 -1
  3. package/dist/components/data-display/table/Table.cjs.map +1 -1
  4. package/dist/components/data-display/table/Table.mjs +1 -1
  5. package/dist/components/data-display/table/Table.mjs.map +1 -1
  6. package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs +37 -1
  7. package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  8. package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs +38 -2
  9. package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  10. package/dist/components/data-display/table/TablePagination.cjs.map +1 -1
  11. package/dist/components/data-display/table/TablePagination.mjs.map +1 -1
  12. package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.cjs +24 -16
  13. package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  14. package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.mjs +24 -16
  15. package/dist/components/data-display/table/TablePagination.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  16. package/dist/components/feedback/EmptyState.cjs.map +1 -1
  17. package/dist/components/feedback/EmptyState.mjs.map +1 -1
  18. package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.cjs +1 -1
  19. package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  20. package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.mjs +1 -1
  21. package/dist/components/feedback/EmptyState.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  22. package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.cjs +369 -0
  23. package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  24. package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.mjs +368 -0
  25. package/dist/components/feedback/tour/Tour.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  26. package/dist/components/feedback/tour/Tour2.cjs +6 -0
  27. package/dist/components/feedback/tour/Tour2.cjs.map +1 -0
  28. package/dist/components/feedback/tour/Tour2.mjs +7 -0
  29. package/dist/components/feedback/tour/Tour2.mjs.map +1 -0
  30. package/dist/components/feedback/tour/TourCard.cjs +6 -0
  31. package/dist/components/feedback/tour/TourCard.cjs.map +1 -0
  32. package/dist/components/feedback/tour/TourCard.mjs +7 -0
  33. package/dist/components/feedback/tour/TourCard.mjs.map +1 -0
  34. package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.cjs +102 -0
  35. package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  36. package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.mjs +101 -0
  37. package/dist/components/feedback/tour/TourCard.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  38. package/dist/components/feedback/tour/tourAnchor.cjs +75 -0
  39. package/dist/components/feedback/tour/tourAnchor.cjs.map +1 -0
  40. package/dist/components/feedback/tour/tourAnchor.mjs +72 -0
  41. package/dist/components/feedback/tour/tourAnchor.mjs.map +1 -0
  42. package/dist/components/feedback/tour/tourPlace.cjs +108 -0
  43. package/dist/components/feedback/tour/tourPlace.cjs.map +1 -0
  44. package/dist/components/feedback/tour/tourPlace.mjs +107 -0
  45. package/dist/components/feedback/tour/tourPlace.mjs.map +1 -0
  46. package/dist/components/feedback/tour/tourShape.cjs +121 -0
  47. package/dist/components/feedback/tour/tourShape.cjs.map +1 -0
  48. package/dist/components/feedback/tour/tourShape.mjs +118 -0
  49. package/dist/components/feedback/tour/tourShape.mjs.map +1 -0
  50. package/dist/components/feedback/tour/useTourSpotlight.cjs +60 -0
  51. package/dist/components/feedback/tour/useTourSpotlight.cjs.map +1 -0
  52. package/dist/components/feedback/tour/useTourSpotlight.mjs +59 -0
  53. package/dist/components/feedback/tour/useTourSpotlight.mjs.map +1 -0
  54. package/dist/components/feedback/tour/useTourSteps.cjs +108 -0
  55. package/dist/components/feedback/tour/useTourSteps.cjs.map +1 -0
  56. package/dist/components/feedback/tour/useTourSteps.mjs +107 -0
  57. package/dist/components/feedback/tour/useTourSteps.mjs.map +1 -0
  58. package/dist/components/forms/Button.cjs +1 -1
  59. package/dist/components/forms/Button.cjs.map +1 -1
  60. package/dist/components/forms/Button.mjs +1 -1
  61. package/dist/components/forms/Button.mjs.map +1 -1
  62. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs +1 -1
  63. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  64. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs +1 -1
  65. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  66. package/dist/components/forms/FileInput.cjs +1 -1
  67. package/dist/components/forms/FileInput.cjs.map +1 -1
  68. package/dist/components/forms/FileInput.mjs +1 -1
  69. package/dist/components/forms/FileInput.mjs.map +1 -1
  70. package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs +34 -17
  71. package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  72. package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs +34 -17
  73. package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  74. package/dist/components/forms/MultiSelect.cjs +1 -1
  75. package/dist/components/forms/MultiSelect.cjs.map +1 -1
  76. package/dist/components/forms/MultiSelect.mjs +1 -1
  77. package/dist/components/forms/MultiSelect.mjs.map +1 -1
  78. package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs +2 -1
  79. package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  80. package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs +2 -1
  81. package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  82. package/dist/components/forms/TagInput.cjs.map +1 -1
  83. package/dist/components/forms/TagInput.mjs.map +1 -1
  84. package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.cjs +1 -0
  85. package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  86. package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.mjs +1 -0
  87. package/dist/components/forms/TagInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  88. package/dist/components/forms/Textarea.cjs.map +1 -1
  89. package/dist/components/forms/Textarea.mjs.map +1 -1
  90. package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs +1 -1
  91. package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  92. package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs +1 -1
  93. package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  94. package/dist/components/layout/Canvas.cjs +1 -1
  95. package/dist/components/layout/Canvas.cjs.map +1 -1
  96. package/dist/components/layout/Canvas.mjs +1 -1
  97. package/dist/components/layout/Canvas.mjs.map +1 -1
  98. package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.cjs +1 -1
  99. package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  100. package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.mjs +1 -1
  101. package/dist/components/layout/Canvas.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  102. package/dist/components/layout/PopoverPanel.cjs +1 -1
  103. package/dist/components/layout/PopoverPanel.cjs.map +1 -1
  104. package/dist/components/layout/PopoverPanel.mjs +1 -1
  105. package/dist/components/layout/PopoverPanel.mjs.map +1 -1
  106. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs +1 -1
  107. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  108. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs +1 -1
  109. package/dist/components/layout/PopoverPanel.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  110. package/dist/components/layout/popover/PopoverTrigger.cjs.map +1 -1
  111. package/dist/components/layout/popover/PopoverTrigger.mjs.map +1 -1
  112. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs +1 -1
  113. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  114. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs +1 -1
  115. package/dist/components/layout/popover/PopoverTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  116. package/dist/components/navigation/DropdownMenu.cjs +1 -1
  117. package/dist/components/navigation/DropdownMenu.cjs.map +1 -1
  118. package/dist/components/navigation/DropdownMenu.mjs +1 -1
  119. package/dist/components/navigation/DropdownMenu.mjs.map +1 -1
  120. package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.cjs +1 -1
  121. package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  122. package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.mjs +1 -1
  123. package/dist/components/navigation/DropdownMenu.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  124. package/dist/components/navigation/Switcher.cjs.map +1 -1
  125. package/dist/components/navigation/Switcher.mjs.map +1 -1
  126. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs +77 -45
  127. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  128. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs +77 -45
  129. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  130. package/dist/components/navigation/menu/MenuTrigger.cjs.map +1 -1
  131. package/dist/components/navigation/menu/MenuTrigger.mjs.map +1 -1
  132. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs +1 -1
  133. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  134. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs +1 -1
  135. package/dist/components/navigation/menu/MenuTrigger.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  136. package/dist/composables/useField.cjs +28 -8
  137. package/dist/composables/useField.cjs.map +1 -1
  138. package/dist/composables/useField.mjs +28 -8
  139. package/dist/composables/useField.mjs.map +1 -1
  140. package/dist/config/ModoLocale.cjs +10 -1
  141. package/dist/config/ModoLocale.cjs.map +1 -1
  142. package/dist/config/ModoLocale.mjs +10 -1
  143. package/dist/config/ModoLocale.mjs.map +1 -1
  144. package/dist/config/locales/es.cjs +10 -1
  145. package/dist/config/locales/es.cjs.map +1 -1
  146. package/dist/config/locales/es.mjs +10 -1
  147. package/dist/config/locales/es.mjs.map +1 -1
  148. package/dist/index.cjs +4 -0
  149. package/dist/index.mjs +3 -1
  150. package/dist/mood-ui.css +289 -103
  151. package/dist/types/components/data-display/surface-card/SurfaceCardBody.vue.d.ts +1 -1
  152. package/dist/types/components/data-display/surface-card/SurfaceCardFooter.vue.d.ts +1 -1
  153. package/dist/types/components/data-display/surface-card/SurfaceCardHeader.vue.d.ts +1 -1
  154. package/dist/types/components/feedback/dialog/DialogContent.vue.d.ts +1 -1
  155. package/dist/types/components/feedback/tour/Tour.vue.d.ts +31 -0
  156. package/dist/types/components/feedback/tour/TourCard.vue.d.ts +25 -0
  157. package/dist/types/components/feedback/tour/index.d.ts +2 -0
  158. package/dist/types/components/feedback/tour/tourAnchor.d.ts +12 -0
  159. package/dist/types/components/feedback/tour/tourPlace.d.ts +60 -0
  160. package/dist/types/components/feedback/tour/tourShape.d.ts +36 -0
  161. package/dist/types/components/feedback/tour/useTourSpotlight.d.ts +14 -0
  162. package/dist/types/components/feedback/tour/useTourSteps.d.ts +31 -0
  163. package/dist/types/components/layout/Canvas.vue.d.ts +1 -1
  164. package/dist/types/components/layout/popover/PopoverContent.vue.d.ts +1 -1
  165. package/dist/types/components/navigation/menu/MenuContent.vue.d.ts +1 -1
  166. package/dist/types/composables/useField.d.ts +23 -0
  167. package/dist/types/config/ModoLocale.d.ts +14 -0
  168. package/dist/types/index.d.ts +2 -0
  169. package/dist/types/interfaces/feedback/Tour.interface.d.ts +73 -0
  170. package/dist/types/interfaces/navigation/Switcher.interface.d.ts +5 -0
  171. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Switcher.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/navigation/Switcher.vue"],"sourcesContent":["<template>\n <div class=\"modo-switcher inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <span ref=\"triggerWrapEl\" class=\"inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <slot\n name=\"trigger\"\n :activeItem=\"activeItem\"\n :isOpen=\"isOpen\"\n :toggle=\"onTriggerClick\"\n >\n <button\n ref=\"triggerEl\"\n type=\"button\"\n data-modo-switcher-trigger\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"resolvedAriaLabel\"\n :disabled=\"disabled\"\n :class=\"[\n 'inline-flex items-center gap-3 px-3 py-2 text-left transition-colors',\n 'border bg-card text-card-foreground border-border',\n 'hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60',\n radiusClass,\n fullWidth ? 'w-full' : '',\n disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span v-if=\"activeItem?.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"activeItem.avatar.src\"\n :initials=\"activeItem.avatar.initials\"\n :name=\"activeItem.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"activeItem?.icon\"\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-9 h-9 bg-accent/60 text-foreground',\n radiusClass,\n ]\"\n >\n <component :is=\"activeItem.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">\n {{ activeItem ? activeItem.title : resolvedPlaceholder }}\n </span>\n <span\n v-if=\"!compactTrigger && activeItem?.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >\n {{ activeItem.subtitle }}\n </span>\n </span>\n <ChevronUpDownIcon\n v-if=\"chevron === 'updown'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n <ChevronDownIcon\n v-else-if=\"chevron === 'down'\"\n class=\"w-4 h-4 shrink-0 text-muted-foreground\"\n aria-hidden=\"true\"\n />\n </button>\n </slot>\n </span>\n\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"resolvedRadius\"\n role=\"dialog\"\n :aria-label=\"resolvedAriaLabel\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div\n data-modo-switcher-panel\n class=\"modo-switcher-panel overflow-y-auto\"\n :style=\"{ maxHeight: panelMaxHeightStyle }\"\n >\n <div\n v-if=\"panelTitle\"\n class=\"px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider\"\n >\n {{ panelTitle }}\n </div>\n\n <div v-if=\"searchable\" class=\"px-2 pt-2 pb-1\">\n <input\n ref=\"searchInputEl\"\n v-model=\"searchQuery\"\n role=\"searchbox\"\n type=\"text\"\n :placeholder=\"resolvedSearchPlaceholder\"\n :aria-controls=\"listboxId\"\n :aria-activedescendant=\"activeDescendantId\"\n class=\"w-full px-2 py-1.5 text-body bg-background border border-border rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60\"\n @keydown=\"onSearchKeydown\"\n />\n </div>\n\n <template v-if=\"loading\">\n <slot name=\"loading\">\n <div class=\"p-2 flex flex-col gap-1\">\n <div\n v-for=\"i in 3\"\n :key=\"i\"\n data-modo-switcher-skeleton\n >\n <Skeleton height=\"44px\" />\n </div>\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"items.length === 0\">\n <slot name=\"empty\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedEmptyText }}\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"displayedItems.length === 0\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedNoResults }}\n </div>\n </template>\n\n <ul\n v-else\n role=\"listbox\"\n :id=\"listboxId\"\n class=\"flex flex-col\"\n @keydown=\"onListKeydown\"\n >\n <li\n v-for=\"(item, idx) in displayedItems\"\n :key=\"item.value\"\n :ref=\"(el) => setOptionRef(el as HTMLElement | null, idx)\"\n role=\"option\"\n :id=\"`${listboxId}-opt-${idx}`\"\n :aria-selected=\"item.value === modelValue\"\n :aria-current=\"item.value === modelValue ? 'true' : undefined\"\n :aria-disabled=\"item.disabled || undefined\"\n :data-active=\"item.value === modelValue || undefined\"\n :tabindex=\"-1\"\n class=\"modo-switcher-item flex items-center gap-3 px-3 py-2 cursor-pointer\"\n :class=\"[\n item.value === modelValue ? 'bg-accent/40' : '',\n searchable && idx === highlightedIdx ? 'bg-accent' : 'hover:bg-accent',\n item.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ]\"\n @click=\"selectItem(item)\"\n @mouseenter=\"searchable ? (highlightedIdx = idx) : null\"\n >\n <span v-if=\"item.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"item.avatar.src\"\n :initials=\"item.avatar.initials\"\n :name=\"item.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"item.icon\"\n data-modo-switcher-iconwrap\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-9 h-9 bg-accent/60 text-foreground',\n radiusClass,\n ]\"\n >\n <component :is=\"item.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">{{ item.title }}</span>\n <span\n v-if=\"item.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >{{ item.subtitle }}</span>\n </span>\n <slot\n name=\"item-trailing\"\n :item=\"item\"\n :active=\"item.value === modelValue\"\n :close=\"close\"\n >\n <CheckIcon\n v-if=\"item.value === modelValue\"\n class=\"w-4 h-4 shrink-0\"\n aria-hidden=\"true\"\n />\n </slot>\n </li>\n </ul>\n\n <template v-if=\"$slots.footer\">\n <hr\n data-modo-switcher-footer-sep\n role=\"separator\"\n class=\"my-1 border-t border-border\"\n />\n <div class=\"p-1\">\n <slot name=\"footer\" :close=\"close\" />\n </div>\n </template>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch, watchEffect } from \"vue\";\nimport { ChevronUpDownIcon, ChevronDownIcon, CheckIcon } from \"@heroicons/vue/24/outline\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Avatar from \"../data-display/avatar/Avatar.vue\";\nimport Skeleton from \"../feedback/Skeleton.vue\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport {\n useResolvedRadius,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport type {\n Switcher as SwitcherProps,\n SwitcherEmits,\n SwitcherItem,\n SwitcherValue,\n} from \"../../interfaces/navigation/Switcher.interface\";\n\nconst props = withDefaults(defineProps<SwitcherProps>(), {\n modelValue: null,\n chevron: \"updown\",\n triggerVariant: \"outline\",\n compactTrigger: false,\n fullWidth: false,\n panelWidth: \"trigger\",\n panelMinWidth: \"15rem\",\n panelMaxHeight: 320,\n placement: \"bottom-start\",\n searchable: false,\n loading: false,\n disabled: false,\n});\n\nconst emit = defineEmits<SwitcherEmits>();\n\nconst locale = useModoLocale();\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst listboxId = useId();\n\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? locale.value.switcher.placeholder,\n);\nconst resolvedAriaLabel = computed(\n () => props.ariaLabel ?? locale.value.switcher.ariaLabel,\n);\nconst resolvedEmptyText = computed(\n () => props.emptyText ?? locale.value.switcher.empty,\n);\nconst resolvedSearchPlaceholder = computed(\n () => props.searchPlaceholder ?? locale.value.switcher.searchPlaceholder,\n);\nconst resolvedNoResults = computed(\n () => props.noResultsText ?? locale.value.switcher.noResults,\n);\n\nconst searchQuery = ref(\"\");\nconst searchInputEl = ref<HTMLInputElement | null>(null);\n\nconst displayedItems = computed<SwitcherItem[]>(() => {\n if (!props.searchable) return props.items;\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return props.items;\n const fields = props.searchFields ?? [\"title\", \"subtitle\"];\n return props.items.filter((it) =>\n fields.some((f) => {\n const v = it[f];\n return typeof v === \"string\" && v.toLowerCase().includes(q);\n }),\n );\n});\n\nwatch(searchQuery, (q) => {\n emit(\"search\", q);\n});\n\nconst radiusClass = computed(() => {\n switch (resolvedRadius.value) {\n case \"none\": return \"rounded-none\";\n case \"small\": return \"rounded-sm\";\n case \"large\": return \"rounded-lg\";\n case \"full\": return \"rounded-[999px]\";\n default: return \"rounded-md\";\n }\n});\n\nconst panelMaxHeightStyle = computed(() => {\n const v = props.panelMaxHeight;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\nconst panelMinWidthStyle = computed(() => {\n const v = props.panelMinWidth;\n if (v == null) return undefined;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\n// The popover composable sizes the panel to the trigger width when\n// `panelWidth='trigger'`. A narrow trigger (e.g. an avatar-only custom\n// trigger) would otherwise crush the panel — `minWidth` floors it.\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(panelMinWidthStyle.value ? { minWidth: panelMinWidthStyle.value } : {}),\n}));\n\nconst activeItem = computed<SwitcherItem | null>(() => {\n if (props.modelValue == null) return null;\n return props.items.find((i) => i.value === props.modelValue) ?? null;\n});\n\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open,\n close,\n toggle,\n} = usePopover({\n placement: () => props.placement,\n matchTriggerWidth: () => props.panelWidth === \"trigger\",\n closeOnEscape: false,\n onOpen: () => emit(\"open\"),\n onClose: () => {\n searchQuery.value = \"\";\n emit(\"close\");\n },\n});\n\nconst triggerEl = ref<HTMLElement | null>(null);\nconst triggerWrapEl = ref<HTMLElement | null>(null);\nwatch([triggerEl, triggerWrapEl], ([btn, wrap]) => {\n triggerRef.value = (btn as HTMLElement | null) ?? (wrap as HTMLElement | null);\n});\n\nfunction focusTrigger() {\n const el = triggerEl.value ?? triggerWrapEl.value;\n el?.focus?.();\n}\n\nfunction onTriggerClick() {\n if (props.disabled) return;\n toggle();\n}\n\nfunction selectItem(item: SwitcherItem) {\n if (item.disabled || props.disabled) return;\n emit(\"update:modelValue\", item.value);\n emit(\"change\", item.value, item);\n close();\n}\n\nfunction focusableIndices(): number[] {\n return displayedItems.value\n .map((it, i) => (it.disabled ? -1 : i))\n .filter((i) => i !== -1);\n}\n\nconst optionRefs = new Map<number, HTMLElement>();\nfunction setOptionRef(el: HTMLElement | null, idx: number) {\n if (el) optionRefs.set(idx, el);\n else optionRefs.delete(idx);\n}\n\nfunction focusOptionByIdx(idx: number) {\n optionRefs.get(idx)?.focus();\n}\n\nasync function openAndFocusActive() {\n if (props.disabled) return;\n if (!isOpen.value) open();\n await nextTick();\n if (props.searchable) {\n searchInputEl.value?.focus();\n return;\n }\n const order = focusableIndices();\n if (!order.length) return;\n const activeIdx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue,\n );\n const usable =\n activeIdx >= 0 && !displayedItems.value[activeIdx].disabled\n ? activeIdx\n : order[0];\n focusOptionByIdx(usable);\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if ([\"ArrowDown\", \"ArrowUp\", \"Enter\", \" \"].includes(e.key)) {\n e.preventDefault();\n openAndFocusActive();\n } else if (e.key === \"Escape\" && isOpen.value) {\n e.preventDefault();\n close();\n }\n}\n\nfunction currentFocusedIdx(): number {\n const el = document.activeElement as HTMLElement | null;\n if (!el) return -1;\n for (const [idx, node] of optionRefs.entries()) {\n if (node === el) return idx;\n }\n return -1;\n}\n\nfunction moveFocus(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = currentFocusedIdx();\n let pos = order.indexOf(cur);\n if (pos === -1) {\n focusOptionByIdx(delta > 0 ? order[0] : order[order.length - 1]);\n return;\n }\n pos = (pos + delta + order.length) % order.length;\n focusOptionByIdx(order[pos]);\n}\n\nfunction onListKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveFocus(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveFocus(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[0]);\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[order.length - 1]);\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n const idx = currentFocusedIdx();\n if (idx >= 0) selectItem(displayedItems.value[idx]);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n } else if (\n !props.searchable &&\n e.key.length === 1 &&\n /^[a-zA-Z0-9]$/.test(e.key)\n ) {\n const order = focusableIndices();\n const letter = e.key.toLowerCase();\n const match = order.find((i) =>\n displayedItems.value[i].title.toLowerCase().startsWith(letter),\n );\n if (match !== undefined) focusOptionByIdx(match);\n }\n}\n\nwatch(isOpen, (open) => {\n if (!open) focusTrigger();\n});\n\nconst highlightedIdx = ref<number>(-1);\n\nconst activeDescendantId = computed(() =>\n highlightedIdx.value >= 0\n ? `${listboxId}-opt-${highlightedIdx.value}`\n : undefined,\n);\n\nwatch(displayedItems, () => {\n if (!props.searchable) return;\n const order = focusableIndices();\n highlightedIdx.value = order[0] ?? -1;\n});\n\nwatch(isOpen, (open) => {\n if (!open) {\n highlightedIdx.value = -1;\n return;\n }\n if (!props.searchable) return;\n const idx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue && !it.disabled,\n );\n const order = focusableIndices();\n highlightedIdx.value = idx >= 0 ? idx : order[0] ?? -1;\n});\n\nfunction moveHighlight(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = order.indexOf(highlightedIdx.value);\n if (cur === -1) {\n highlightedIdx.value = delta > 0 ? order[0] : order[order.length - 1];\n return;\n }\n const next = (cur + delta + order.length) % order.length;\n highlightedIdx.value = order[next];\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveHighlight(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveHighlight(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[0];\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[order.length - 1];\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (highlightedIdx.value >= 0) {\n selectItem(displayedItems.value[highlightedIdx.value]);\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n }\n}\n\n// Dev-only: warn once per offending item when both icon and avatar are set.\nif (import.meta.env?.DEV ?? true) {\n const warned = new Set<SwitcherValue>();\n watchEffect(() => {\n for (const item of props.items) {\n if (item.icon && item.avatar && !warned.has(item.value)) {\n warned.add(item.value);\n console.warn(\n `[Switcher] item \"${item.value}\" declares both \\`icon\\` and \\`avatar\\`; \\`avatar\\` wins. Pick one.`,\n );\n }\n }\n });\n}\n\ndefineExpose({ open, close, toggle });\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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K,UAAU,QAAA;QACvB,OAAO,MAAA,MAAK;gBAOR,CAJG,KAAK,UAAU,QAAA,cAAA,WAAA,EADvB,YAIE,MAAA,UAAA,EAAA;;QAFA,OAAM;QACN,eAAY;;;;KAMJA,KAAAA,OAAO,UAAA,WAAA,EAAvB,mBASW,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,OAAA,OAAA,OAAA,KART,mBAIE,MAAA;MAHA,iCAAA;MACA,MAAK;MACL,OAAM;oBAER,mBAEM,OAFN,aAEM,CADJ,WAAqC,KAAA,QAAA,UAAA,EAAhB,OAAO,MAAA,MAAK,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA,IAAA,mBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"Switcher.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/navigation/Switcher.vue"],"sourcesContent":["<template>\n <div class=\"modo-switcher inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <span ref=\"triggerWrapEl\" class=\"inline-flex\" :class=\"{ 'w-full': fullWidth }\">\n <slot\n name=\"trigger\"\n :activeItem=\"activeItem\"\n :isOpen=\"isOpen\"\n :toggle=\"onTriggerClick\"\n >\n <button\n ref=\"triggerEl\"\n type=\"button\"\n data-modo-switcher-trigger\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen\"\n :aria-label=\"resolvedAriaLabel\"\n :disabled=\"disabled\"\n :class=\"[\n 'inline-flex items-center text-left transition-colors',\n triggerSizeClass,\n 'border bg-card text-card-foreground border-input hover:border-input-hover',\n 'hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60',\n radiusClass,\n fullWidth ? 'w-full' : '',\n disabled ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer',\n ]\"\n @click=\"onTriggerClick\"\n @keydown=\"onTriggerKeydown\"\n >\n <span\n v-if=\"activeItem?.avatar\"\n data-modo-switcher-lead\n :class=\"['shrink-0', sized ? ['inline-flex items-center justify-center', sized.leadAvatar] : '']\"\n >\n <Avatar\n :src=\"activeItem.avatar.src\"\n :initials=\"activeItem.avatar.initials\"\n :name=\"activeItem.title\"\n :size=\"sized ? 'xsmall' : 'small'\"\n />\n </span>\n <span\n v-else-if=\"activeItem?.icon\"\n data-modo-switcher-lead\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center bg-accent/60 text-foreground',\n sized ? sized.lead : 'w-9 h-9',\n radiusClass,\n ]\"\n >\n <component\n :is=\"activeItem.icon\"\n :class=\"sized ? sized.leadIcon : 'w-5 h-5'\"\n aria-hidden=\"true\"\n />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span :class=\"['truncate font-medium', sized ? sizeTokens.text : 'text-body']\">\n {{ activeItem ? activeItem.title : resolvedPlaceholder }}\n </span>\n <span\n v-if=\"!sized && !compactTrigger && activeItem?.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >\n {{ activeItem.subtitle }}\n </span>\n </span>\n <ChevronUpDownIcon\n v-if=\"chevron === 'updown'\"\n :class=\"['shrink-0 text-muted-foreground', sized ? sizeTokens.icon : 'w-4 h-4']\"\n aria-hidden=\"true\"\n />\n <ChevronDownIcon\n v-else-if=\"chevron === 'down'\"\n :class=\"['shrink-0 text-muted-foreground', sized ? sizeTokens.icon : 'w-4 h-4']\"\n aria-hidden=\"true\"\n />\n </button>\n </slot>\n </span>\n\n <PopoverPanel\n :open=\"isOpen\"\n :style=\"mergedPanelStyle\"\n :radius=\"resolvedRadius\"\n role=\"dialog\"\n :aria-label=\"resolvedAriaLabel\"\n @update:panelRef=\"panelRef = $event\"\n >\n <div\n data-modo-switcher-panel\n class=\"modo-switcher-panel overflow-y-auto\"\n :style=\"{ maxHeight: panelMaxHeightStyle }\"\n >\n <div\n v-if=\"panelTitle\"\n class=\"px-3 pt-3 pb-2 text-caption text-muted-foreground uppercase tracking-wider\"\n >\n {{ panelTitle }}\n </div>\n\n <div v-if=\"searchable\" class=\"px-2 pt-2 pb-1\">\n <input\n ref=\"searchInputEl\"\n v-model=\"searchQuery\"\n role=\"searchbox\"\n type=\"text\"\n :placeholder=\"resolvedSearchPlaceholder\"\n :aria-controls=\"listboxId\"\n :aria-activedescendant=\"activeDescendantId\"\n class=\"w-full px-2 py-1.5 text-body bg-background border border-input rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60\"\n @keydown=\"onSearchKeydown\"\n />\n </div>\n\n <template v-if=\"loading\">\n <slot name=\"loading\">\n <div class=\"p-2 flex flex-col gap-1\">\n <div\n v-for=\"i in 3\"\n :key=\"i\"\n data-modo-switcher-skeleton\n >\n <Skeleton height=\"44px\" />\n </div>\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"items.length === 0\">\n <slot name=\"empty\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedEmptyText }}\n </div>\n </slot>\n </template>\n\n <template v-else-if=\"displayedItems.length === 0\">\n <div class=\"px-3 py-6 text-center text-muted-foreground text-body\">\n {{ resolvedNoResults }}\n </div>\n </template>\n\n <ul\n v-else\n role=\"listbox\"\n :id=\"listboxId\"\n class=\"flex flex-col\"\n @keydown=\"onListKeydown\"\n >\n <li\n v-for=\"(item, idx) in displayedItems\"\n :key=\"item.value\"\n :ref=\"(el) => setOptionRef(el as HTMLElement | null, idx)\"\n role=\"option\"\n :id=\"`${listboxId}-opt-${idx}`\"\n :aria-selected=\"item.value === modelValue\"\n :aria-current=\"item.value === modelValue ? 'true' : undefined\"\n :aria-disabled=\"item.disabled || undefined\"\n :data-active=\"item.value === modelValue || undefined\"\n :tabindex=\"-1\"\n class=\"modo-switcher-item flex items-center gap-3 px-3 py-2 cursor-pointer\"\n :class=\"[\n item.value === modelValue ? 'bg-accent/40' : '',\n searchable && idx === highlightedIdx ? 'bg-accent' : 'hover:bg-accent',\n item.disabled ? 'opacity-50 cursor-not-allowed' : '',\n ]\"\n @click=\"selectItem(item)\"\n @mouseenter=\"searchable ? (highlightedIdx = idx) : null\"\n >\n <span v-if=\"item.avatar\" class=\"shrink-0\">\n <Avatar\n :src=\"item.avatar.src\"\n :initials=\"item.avatar.initials\"\n :name=\"item.title\"\n size=\"small\"\n />\n </span>\n <span\n v-else-if=\"item.icon\"\n data-modo-switcher-iconwrap\n :class=\"[\n 'shrink-0 inline-flex items-center justify-center w-9 h-9 bg-accent/60 text-foreground',\n radiusClass,\n ]\"\n >\n <component :is=\"item.icon\" class=\"w-5 h-5\" aria-hidden=\"true\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"truncate text-body font-medium\">{{ item.title }}</span>\n <span\n v-if=\"item.subtitle\"\n class=\"truncate text-caption text-muted-foreground\"\n >{{ item.subtitle }}</span>\n </span>\n <slot\n name=\"item-trailing\"\n :item=\"item\"\n :active=\"item.value === modelValue\"\n :close=\"close\"\n >\n <CheckIcon\n v-if=\"item.value === modelValue\"\n class=\"w-4 h-4 shrink-0\"\n aria-hidden=\"true\"\n />\n </slot>\n </li>\n </ul>\n\n <template v-if=\"$slots.footer\">\n <hr\n data-modo-switcher-footer-sep\n role=\"separator\"\n class=\"my-1 border-t border-border\"\n />\n <div class=\"p-1\">\n <slot name=\"footer\" :close=\"close\" />\n </div>\n </template>\n </div>\n </PopoverPanel>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, ref, useId, watch, watchEffect } from \"vue\";\nimport { ChevronUpDownIcon, ChevronDownIcon, CheckIcon } from \"@heroicons/vue/24/outline\";\nimport PopoverPanel from \"../layout/PopoverPanel.vue\";\nimport Avatar from \"../data-display/avatar/Avatar.vue\";\nimport Skeleton from \"../feedback/Skeleton.vue\";\nimport { usePopover } from \"../../composables/usePopover\";\nimport { SIZE_TOKENS, normalizeSize } from \"../../config/sizes\";\nimport {\n useResolvedRadius,\n useModoLocale,\n} from \"../../composables/useModoConfig\";\nimport type {\n Switcher as SwitcherProps,\n SwitcherEmits,\n SwitcherItem,\n SwitcherValue,\n} from \"../../interfaces/navigation/Switcher.interface\";\n\nconst props = withDefaults(defineProps<SwitcherProps>(), {\n modelValue: null,\n chevron: \"updown\",\n triggerVariant: \"outline\",\n compactTrigger: false,\n fullWidth: false,\n panelWidth: \"trigger\",\n panelMinWidth: \"15rem\",\n panelMaxHeight: 320,\n placement: \"bottom-start\",\n searchable: false,\n loading: false,\n disabled: false,\n});\n\nconst emit = defineEmits<SwitcherEmits>();\n\nconst locale = useModoLocale();\nconst resolvedRadius = useResolvedRadius(() => props.radius);\nconst listboxId = useId();\n\nconst resolvedPlaceholder = computed(\n () => props.placeholder ?? locale.value.switcher.placeholder,\n);\nconst resolvedAriaLabel = computed(\n () => props.ariaLabel ?? locale.value.switcher.ariaLabel,\n);\nconst resolvedEmptyText = computed(\n () => props.emptyText ?? locale.value.switcher.empty,\n);\nconst resolvedSearchPlaceholder = computed(\n () => props.searchPlaceholder ?? locale.value.switcher.searchPlaceholder,\n);\nconst resolvedNoResults = computed(\n () => props.noResultsText ?? locale.value.switcher.noResults,\n);\n\nconst searchQuery = ref(\"\");\nconst searchInputEl = ref<HTMLInputElement | null>(null);\n\nconst displayedItems = computed<SwitcherItem[]>(() => {\n if (!props.searchable) return props.items;\n const q = searchQuery.value.trim().toLowerCase();\n if (!q) return props.items;\n const fields = props.searchFields ?? [\"title\", \"subtitle\"];\n return props.items.filter((it) =>\n fields.some((f) => {\n const v = it[f];\n return typeof v === \"string\" && v.toLowerCase().includes(q);\n }),\n );\n});\n\nwatch(searchQuery, (q) => {\n emit(\"search\", q);\n});\n\nconst radiusClass = computed(() => {\n switch (resolvedRadius.value) {\n case \"none\": return \"rounded-none\";\n case \"small\": return \"rounded-sm\";\n case \"large\": return \"rounded-lg\";\n case \"full\": return \"rounded-[999px]\";\n default: return \"rounded-md\";\n }\n});\n\n// Opt-in sizing: without an explicit `size` the trigger keeps its original\n// two-line look (padding-driven height). With one, it becomes a single-line\n// control that shares height / padding / font / icon tokens with Button, Input\n// and Select, and the subtitle is dropped so the line fits the control height.\nconst LEADING: Record<string, { lead: string; leadIcon: string; leadAvatar: string }> = {\n xsmall: { lead: \"w-5 h-5\", leadIcon: \"w-3 h-3\", leadAvatar: \"[&>div>*]:!w-5 [&>div>*]:!h-5\" },\n small: { lead: \"w-6 h-6\", leadIcon: \"w-3.5 h-3.5\", leadAvatar: \"[&>div>*]:!w-6 [&>div>*]:!h-6\" },\n medium: { lead: \"w-7 h-7\", leadIcon: \"w-4 h-4\", leadAvatar: \"[&>div>*]:!w-7 [&>div>*]:!h-7\" },\n large: { lead: \"w-8 h-8\", leadIcon: \"w-5 h-5\", leadAvatar: \"[&>div>*]:!w-8 [&>div>*]:!h-8\" },\n};\nconst sizeTokens = computed(() => SIZE_TOKENS[normalizeSize(props.size)]);\nconst sized = computed(() =>\n props.size ? LEADING[normalizeSize(props.size)] : null,\n);\nconst triggerSizeClass = computed(() =>\n sized.value\n ? `${sizeTokens.value.control} ${sizeTokens.value.padX} ${sizeTokens.value.gap}`\n : \"gap-3 px-3 py-2\",\n);\n\nconst panelMaxHeightStyle = computed(() => {\n const v = props.panelMaxHeight;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\nconst panelMinWidthStyle = computed(() => {\n const v = props.panelMinWidth;\n if (v == null) return undefined;\n return typeof v === \"number\" ? `${v}px` : v;\n});\n\n// The popover composable sizes the panel to the trigger width when\n// `panelWidth='trigger'`. A narrow trigger (e.g. an avatar-only custom\n// trigger) would otherwise crush the panel — `minWidth` floors it.\nconst mergedPanelStyle = computed(() => ({\n ...panelStyle.value,\n ...(panelMinWidthStyle.value ? { minWidth: panelMinWidthStyle.value } : {}),\n}));\n\nconst activeItem = computed<SwitcherItem | null>(() => {\n if (props.modelValue == null) return null;\n return props.items.find((i) => i.value === props.modelValue) ?? null;\n});\n\nconst {\n triggerRef,\n panelRef,\n isOpen,\n panelStyle,\n open,\n close,\n toggle,\n} = usePopover({\n placement: () => props.placement,\n matchTriggerWidth: () => props.panelWidth === \"trigger\",\n closeOnEscape: false,\n onOpen: () => emit(\"open\"),\n onClose: () => {\n searchQuery.value = \"\";\n emit(\"close\");\n },\n});\n\nconst triggerEl = ref<HTMLElement | null>(null);\nconst triggerWrapEl = ref<HTMLElement | null>(null);\nwatch([triggerEl, triggerWrapEl], ([btn, wrap]) => {\n triggerRef.value = (btn as HTMLElement | null) ?? (wrap as HTMLElement | null);\n});\n\nfunction focusTrigger() {\n const el = triggerEl.value ?? triggerWrapEl.value;\n el?.focus?.();\n}\n\nfunction onTriggerClick() {\n if (props.disabled) return;\n toggle();\n}\n\nfunction selectItem(item: SwitcherItem) {\n if (item.disabled || props.disabled) return;\n emit(\"update:modelValue\", item.value);\n emit(\"change\", item.value, item);\n close();\n}\n\nfunction focusableIndices(): number[] {\n return displayedItems.value\n .map((it, i) => (it.disabled ? -1 : i))\n .filter((i) => i !== -1);\n}\n\nconst optionRefs = new Map<number, HTMLElement>();\nfunction setOptionRef(el: HTMLElement | null, idx: number) {\n if (el) optionRefs.set(idx, el);\n else optionRefs.delete(idx);\n}\n\nfunction focusOptionByIdx(idx: number) {\n optionRefs.get(idx)?.focus();\n}\n\nasync function openAndFocusActive() {\n if (props.disabled) return;\n if (!isOpen.value) open();\n await nextTick();\n if (props.searchable) {\n searchInputEl.value?.focus();\n return;\n }\n const order = focusableIndices();\n if (!order.length) return;\n const activeIdx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue,\n );\n const usable =\n activeIdx >= 0 && !displayedItems.value[activeIdx].disabled\n ? activeIdx\n : order[0];\n focusOptionByIdx(usable);\n}\n\nfunction onTriggerKeydown(e: KeyboardEvent) {\n if ([\"ArrowDown\", \"ArrowUp\", \"Enter\", \" \"].includes(e.key)) {\n e.preventDefault();\n openAndFocusActive();\n } else if (e.key === \"Escape\" && isOpen.value) {\n e.preventDefault();\n close();\n }\n}\n\nfunction currentFocusedIdx(): number {\n const el = document.activeElement as HTMLElement | null;\n if (!el) return -1;\n for (const [idx, node] of optionRefs.entries()) {\n if (node === el) return idx;\n }\n return -1;\n}\n\nfunction moveFocus(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = currentFocusedIdx();\n let pos = order.indexOf(cur);\n if (pos === -1) {\n focusOptionByIdx(delta > 0 ? order[0] : order[order.length - 1]);\n return;\n }\n pos = (pos + delta + order.length) % order.length;\n focusOptionByIdx(order[pos]);\n}\n\nfunction onListKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveFocus(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveFocus(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[0]);\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) focusOptionByIdx(order[order.length - 1]);\n } else if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n const idx = currentFocusedIdx();\n if (idx >= 0) selectItem(displayedItems.value[idx]);\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n } else if (\n !props.searchable &&\n e.key.length === 1 &&\n /^[a-zA-Z0-9]$/.test(e.key)\n ) {\n const order = focusableIndices();\n const letter = e.key.toLowerCase();\n const match = order.find((i) =>\n displayedItems.value[i].title.toLowerCase().startsWith(letter),\n );\n if (match !== undefined) focusOptionByIdx(match);\n }\n}\n\nwatch(isOpen, (open) => {\n if (!open) focusTrigger();\n});\n\nconst highlightedIdx = ref<number>(-1);\n\nconst activeDescendantId = computed(() =>\n highlightedIdx.value >= 0\n ? `${listboxId}-opt-${highlightedIdx.value}`\n : undefined,\n);\n\nwatch(displayedItems, () => {\n if (!props.searchable) return;\n const order = focusableIndices();\n highlightedIdx.value = order[0] ?? -1;\n});\n\nwatch(isOpen, (open) => {\n if (!open) {\n highlightedIdx.value = -1;\n return;\n }\n if (!props.searchable) return;\n const idx = displayedItems.value.findIndex(\n (it) => it.value === props.modelValue && !it.disabled,\n );\n const order = focusableIndices();\n highlightedIdx.value = idx >= 0 ? idx : order[0] ?? -1;\n});\n\nfunction moveHighlight(delta: 1 | -1) {\n const order = focusableIndices();\n if (!order.length) return;\n const cur = order.indexOf(highlightedIdx.value);\n if (cur === -1) {\n highlightedIdx.value = delta > 0 ? order[0] : order[order.length - 1];\n return;\n }\n const next = (cur + delta + order.length) % order.length;\n highlightedIdx.value = order[next];\n}\n\nfunction onSearchKeydown(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n moveHighlight(1);\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n moveHighlight(-1);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[0];\n } else if (e.key === \"End\") {\n e.preventDefault();\n const order = focusableIndices();\n if (order.length) highlightedIdx.value = order[order.length - 1];\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n if (highlightedIdx.value >= 0) {\n selectItem(displayedItems.value[highlightedIdx.value]);\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n close();\n focusTrigger();\n }\n}\n\n// Dev-only: warn once per offending item when both icon and avatar are set.\nif (import.meta.env?.DEV ?? true) {\n const warned = new Set<SwitcherValue>();\n watchEffect(() => {\n for (const item of props.items) {\n if (item.icon && item.avatar && !warned.has(item.value)) {\n warned.add(item.value);\n console.warn(\n `[Switcher] item \"${item.value}\" declares both \\`icon\\` and \\`avatar\\`; \\`avatar\\` wins. Pick one.`,\n );\n }\n }\n });\n}\n\ndefineExpose({ open, close, toggle });\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoPA,MAAM,QAAQ;EAed,MAAM,OAAO;EAEb,MAAM,SAAS,eAAe;EAC9B,MAAM,iBAAiB,wBAAwB,MAAM,OAAO;EAC5D,MAAM,YAAY,OAAO;EAEzB,MAAM,sBAAsB,eACpB,MAAM,eAAe,OAAO,MAAM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"sources":["../../../../src/components/navigation/menu/MenuTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport Button from '../../forms/Button.vue'\nimport type { MenuTriggerProps } from '../../../interfaces/navigation/Menu.interface'\nimport { useMenuContext } from './MenuContext'\nimport { isKeyboardActivation } from '../../../utils/morph/morphHelpers'\n\ndefineOptions({\n name: 'MenuTrigger',\n})\n\nconst props = withDefaults(defineProps<MenuTriggerProps>(), {\n asChild: false,\n variant: 'outline',\n disabled: false,\n})\n\nconst { open, phase, setOpen, triggerEl, triggerId, menuId, color, radius, size } =\n useMenuContext()\nconst rootRef = ref<HTMLElement | null>(null)\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | null = null\n\nconst ownTriggerId = `${menuId}-trigger`\n\n// Same neutral outline look as the native DropdownMenu trigger: the provider\n// color only shows through on `danger` or the filled variants.\nconst neutralOutlineClass = computed(() =>\n props.variant === 'outline' && color.value !== 'danger'\n ? 'bg-card !border-border !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring'\n : '',\n)\n\nwatch(phase, (next, prev) => {\n if (prev === 'closing' && next === 'closed') {\n landed.value = true\n if (landedTimer) clearTimeout(landedTimer)\n landedTimer = setTimeout(() => {\n landed.value = false\n }, 500)\n }\n})\n\nconst morphOrigin = computed(() => {\n if (phase.value === 'closing') return 'closing'\n if (phase.value !== 'closed') return 'hidden'\n if (landed.value) return 'landed'\n return undefined\n})\n\nfunction syncTriggerEl() {\n // The watcher is immediate, so it also runs during SSR where there is no DOM.\n if (typeof HTMLElement === 'undefined') return\n const child = rootRef.value?.firstElementChild\n if (!(child instanceof HTMLElement)) {\n triggerEl.value = null\n triggerId.value = undefined\n return\n }\n if (props.asChild) {\n // The slotted element is owned by the consumer: decorate it in place so\n // it carries the morph choreography and the ARIA wiring of a trigger.\n child.classList.add('modo-morph-trigger')\n if (morphOrigin.value) {\n child.setAttribute('data-modo-morph-origin', morphOrigin.value)\n } else {\n child.removeAttribute('data-modo-morph-origin')\n }\n if (!child.id) child.id = ownTriggerId\n child.setAttribute('aria-haspopup', 'menu')\n child.setAttribute('aria-expanded', String(open.value))\n if (phase.value !== 'closed') child.setAttribute('aria-controls', menuId)\n else child.removeAttribute('aria-controls')\n }\n triggerEl.value = child\n triggerId.value = child.id || undefined\n}\n\nwatch([rootRef, morphOrigin, open, () => props.asChild], syncTriggerEl, {\n immediate: true,\n flush: 'post',\n})\n\nonBeforeUnmount(() => {\n if (landedTimer) clearTimeout(landedTimer)\n triggerEl.value = null\n triggerId.value = undefined\n})\n\nfunction handleClick(event: MouseEvent) {\n if (event.defaultPrevented) return\n syncTriggerEl()\n setOpen(!open.value)\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n if (props.asChild && isKeyboardActivation(event)) {\n event.preventDefault()\n syncTriggerEl()\n setOpen(!open.value)\n return\n }\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n syncTriggerEl()\n setOpen(true)\n }\n}\n</script>\n\n<template>\n <span\n ref=\"rootRef\"\n class=\"contents\"\n @click=\"asChild && handleClick($event)\"\n @keydown=\"asChild && handleKeyDown($event)\"\n >\n <slot v-if=\"asChild\" :open=\"open\" />\n <Button\n v-else\n :id=\"ownTriggerId\"\n :variant=\"variant\"\n :color=\"color\"\n :size=\"size\"\n :radius=\"radius\"\n :disabled=\"disabled\"\n :class=\"['modo-morph-trigger', neutralOutlineClass]\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"open\"\n :aria-controls=\"phase !== 'closed' ? menuId : undefined\"\n :data-modo-morph-origin=\"morphOrigin\"\n @click=\"handleClick\"\n @keydown=\"handleKeyDown\"\n >\n <span class=\"modo-morph-trigger__content\">\n <slot :open=\"open\" />\n </span>\n </Button>\n </span>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"MenuTrigger.cjs","names":[],"sources":["../../../../src/components/navigation/menu/MenuTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport Button from '../../forms/Button.vue'\nimport type { MenuTriggerProps } from '../../../interfaces/navigation/Menu.interface'\nimport { useMenuContext } from './MenuContext'\nimport { isKeyboardActivation } from '../../../utils/morph/morphHelpers'\n\ndefineOptions({\n name: 'MenuTrigger',\n})\n\nconst props = withDefaults(defineProps<MenuTriggerProps>(), {\n asChild: false,\n variant: 'outline',\n disabled: false,\n})\n\nconst { open, phase, setOpen, triggerEl, triggerId, menuId, color, radius, size } =\n useMenuContext()\nconst rootRef = ref<HTMLElement | null>(null)\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | null = null\n\nconst ownTriggerId = `${menuId}-trigger`\n\n// Same neutral outline look as the native DropdownMenu trigger: the provider\n// color only shows through on `danger` or the filled variants.\nconst neutralOutlineClass = computed(() =>\n props.variant === 'outline' && color.value !== 'danger'\n ? 'bg-card !border-input hover:!border-input-hover !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring'\n : '',\n)\n\nwatch(phase, (next, prev) => {\n if (prev === 'closing' && next === 'closed') {\n landed.value = true\n if (landedTimer) clearTimeout(landedTimer)\n landedTimer = setTimeout(() => {\n landed.value = false\n }, 500)\n }\n})\n\nconst morphOrigin = computed(() => {\n if (phase.value === 'closing') return 'closing'\n if (phase.value !== 'closed') return 'hidden'\n if (landed.value) return 'landed'\n return undefined\n})\n\nfunction syncTriggerEl() {\n // The watcher is immediate, so it also runs during SSR where there is no DOM.\n if (typeof HTMLElement === 'undefined') return\n const child = rootRef.value?.firstElementChild\n if (!(child instanceof HTMLElement)) {\n triggerEl.value = null\n triggerId.value = undefined\n return\n }\n if (props.asChild) {\n // The slotted element is owned by the consumer: decorate it in place so\n // it carries the morph choreography and the ARIA wiring of a trigger.\n child.classList.add('modo-morph-trigger')\n if (morphOrigin.value) {\n child.setAttribute('data-modo-morph-origin', morphOrigin.value)\n } else {\n child.removeAttribute('data-modo-morph-origin')\n }\n if (!child.id) child.id = ownTriggerId\n child.setAttribute('aria-haspopup', 'menu')\n child.setAttribute('aria-expanded', String(open.value))\n if (phase.value !== 'closed') child.setAttribute('aria-controls', menuId)\n else child.removeAttribute('aria-controls')\n }\n triggerEl.value = child\n triggerId.value = child.id || undefined\n}\n\nwatch([rootRef, morphOrigin, open, () => props.asChild], syncTriggerEl, {\n immediate: true,\n flush: 'post',\n})\n\nonBeforeUnmount(() => {\n if (landedTimer) clearTimeout(landedTimer)\n triggerEl.value = null\n triggerId.value = undefined\n})\n\nfunction handleClick(event: MouseEvent) {\n if (event.defaultPrevented) return\n syncTriggerEl()\n setOpen(!open.value)\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n if (props.asChild && isKeyboardActivation(event)) {\n event.preventDefault()\n syncTriggerEl()\n setOpen(!open.value)\n return\n }\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n syncTriggerEl()\n setOpen(true)\n }\n}\n</script>\n\n<template>\n <span\n ref=\"rootRef\"\n class=\"contents\"\n @click=\"asChild && handleClick($event)\"\n @keydown=\"asChild && handleKeyDown($event)\"\n >\n <slot v-if=\"asChild\" :open=\"open\" />\n <Button\n v-else\n :id=\"ownTriggerId\"\n :variant=\"variant\"\n :color=\"color\"\n :size=\"size\"\n :radius=\"radius\"\n :disabled=\"disabled\"\n :class=\"['modo-morph-trigger', neutralOutlineClass]\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"open\"\n :aria-controls=\"phase !== 'closed' ? menuId : undefined\"\n :data-modo-morph-origin=\"morphOrigin\"\n @click=\"handleClick\"\n @keydown=\"handleKeyDown\"\n >\n <span class=\"modo-morph-trigger__content\">\n <slot :open=\"open\" />\n </span>\n </Button>\n </span>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"MenuTrigger.mjs","names":[],"sources":["../../../../src/components/navigation/menu/MenuTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport Button from '../../forms/Button.vue'\nimport type { MenuTriggerProps } from '../../../interfaces/navigation/Menu.interface'\nimport { useMenuContext } from './MenuContext'\nimport { isKeyboardActivation } from '../../../utils/morph/morphHelpers'\n\ndefineOptions({\n name: 'MenuTrigger',\n})\n\nconst props = withDefaults(defineProps<MenuTriggerProps>(), {\n asChild: false,\n variant: 'outline',\n disabled: false,\n})\n\nconst { open, phase, setOpen, triggerEl, triggerId, menuId, color, radius, size } =\n useMenuContext()\nconst rootRef = ref<HTMLElement | null>(null)\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | null = null\n\nconst ownTriggerId = `${menuId}-trigger`\n\n// Same neutral outline look as the native DropdownMenu trigger: the provider\n// color only shows through on `danger` or the filled variants.\nconst neutralOutlineClass = computed(() =>\n props.variant === 'outline' && color.value !== 'danger'\n ? 'bg-card !border-border !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring'\n : '',\n)\n\nwatch(phase, (next, prev) => {\n if (prev === 'closing' && next === 'closed') {\n landed.value = true\n if (landedTimer) clearTimeout(landedTimer)\n landedTimer = setTimeout(() => {\n landed.value = false\n }, 500)\n }\n})\n\nconst morphOrigin = computed(() => {\n if (phase.value === 'closing') return 'closing'\n if (phase.value !== 'closed') return 'hidden'\n if (landed.value) return 'landed'\n return undefined\n})\n\nfunction syncTriggerEl() {\n // The watcher is immediate, so it also runs during SSR where there is no DOM.\n if (typeof HTMLElement === 'undefined') return\n const child = rootRef.value?.firstElementChild\n if (!(child instanceof HTMLElement)) {\n triggerEl.value = null\n triggerId.value = undefined\n return\n }\n if (props.asChild) {\n // The slotted element is owned by the consumer: decorate it in place so\n // it carries the morph choreography and the ARIA wiring of a trigger.\n child.classList.add('modo-morph-trigger')\n if (morphOrigin.value) {\n child.setAttribute('data-modo-morph-origin', morphOrigin.value)\n } else {\n child.removeAttribute('data-modo-morph-origin')\n }\n if (!child.id) child.id = ownTriggerId\n child.setAttribute('aria-haspopup', 'menu')\n child.setAttribute('aria-expanded', String(open.value))\n if (phase.value !== 'closed') child.setAttribute('aria-controls', menuId)\n else child.removeAttribute('aria-controls')\n }\n triggerEl.value = child\n triggerId.value = child.id || undefined\n}\n\nwatch([rootRef, morphOrigin, open, () => props.asChild], syncTriggerEl, {\n immediate: true,\n flush: 'post',\n})\n\nonBeforeUnmount(() => {\n if (landedTimer) clearTimeout(landedTimer)\n triggerEl.value = null\n triggerId.value = undefined\n})\n\nfunction handleClick(event: MouseEvent) {\n if (event.defaultPrevented) return\n syncTriggerEl()\n setOpen(!open.value)\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n if (props.asChild && isKeyboardActivation(event)) {\n event.preventDefault()\n syncTriggerEl()\n setOpen(!open.value)\n return\n }\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n syncTriggerEl()\n setOpen(true)\n }\n}\n</script>\n\n<template>\n <span\n ref=\"rootRef\"\n class=\"contents\"\n @click=\"asChild && handleClick($event)\"\n @keydown=\"asChild && handleKeyDown($event)\"\n >\n <slot v-if=\"asChild\" :open=\"open\" />\n <Button\n v-else\n :id=\"ownTriggerId\"\n :variant=\"variant\"\n :color=\"color\"\n :size=\"size\"\n :radius=\"radius\"\n :disabled=\"disabled\"\n :class=\"['modo-morph-trigger', neutralOutlineClass]\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"open\"\n :aria-controls=\"phase !== 'closed' ? menuId : undefined\"\n :data-modo-morph-origin=\"morphOrigin\"\n @click=\"handleClick\"\n @keydown=\"handleKeyDown\"\n >\n <span class=\"modo-morph-trigger__content\">\n <slot :open=\"open\" />\n </span>\n </Button>\n </span>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"MenuTrigger.mjs","names":[],"sources":["../../../../src/components/navigation/menu/MenuTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport Button from '../../forms/Button.vue'\nimport type { MenuTriggerProps } from '../../../interfaces/navigation/Menu.interface'\nimport { useMenuContext } from './MenuContext'\nimport { isKeyboardActivation } from '../../../utils/morph/morphHelpers'\n\ndefineOptions({\n name: 'MenuTrigger',\n})\n\nconst props = withDefaults(defineProps<MenuTriggerProps>(), {\n asChild: false,\n variant: 'outline',\n disabled: false,\n})\n\nconst { open, phase, setOpen, triggerEl, triggerId, menuId, color, radius, size } =\n useMenuContext()\nconst rootRef = ref<HTMLElement | null>(null)\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | null = null\n\nconst ownTriggerId = `${menuId}-trigger`\n\n// Same neutral outline look as the native DropdownMenu trigger: the provider\n// color only shows through on `danger` or the filled variants.\nconst neutralOutlineClass = computed(() =>\n props.variant === 'outline' && color.value !== 'danger'\n ? 'bg-card !border-input hover:!border-input-hover !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring'\n : '',\n)\n\nwatch(phase, (next, prev) => {\n if (prev === 'closing' && next === 'closed') {\n landed.value = true\n if (landedTimer) clearTimeout(landedTimer)\n landedTimer = setTimeout(() => {\n landed.value = false\n }, 500)\n }\n})\n\nconst morphOrigin = computed(() => {\n if (phase.value === 'closing') return 'closing'\n if (phase.value !== 'closed') return 'hidden'\n if (landed.value) return 'landed'\n return undefined\n})\n\nfunction syncTriggerEl() {\n // The watcher is immediate, so it also runs during SSR where there is no DOM.\n if (typeof HTMLElement === 'undefined') return\n const child = rootRef.value?.firstElementChild\n if (!(child instanceof HTMLElement)) {\n triggerEl.value = null\n triggerId.value = undefined\n return\n }\n if (props.asChild) {\n // The slotted element is owned by the consumer: decorate it in place so\n // it carries the morph choreography and the ARIA wiring of a trigger.\n child.classList.add('modo-morph-trigger')\n if (morphOrigin.value) {\n child.setAttribute('data-modo-morph-origin', morphOrigin.value)\n } else {\n child.removeAttribute('data-modo-morph-origin')\n }\n if (!child.id) child.id = ownTriggerId\n child.setAttribute('aria-haspopup', 'menu')\n child.setAttribute('aria-expanded', String(open.value))\n if (phase.value !== 'closed') child.setAttribute('aria-controls', menuId)\n else child.removeAttribute('aria-controls')\n }\n triggerEl.value = child\n triggerId.value = child.id || undefined\n}\n\nwatch([rootRef, morphOrigin, open, () => props.asChild], syncTriggerEl, {\n immediate: true,\n flush: 'post',\n})\n\nonBeforeUnmount(() => {\n if (landedTimer) clearTimeout(landedTimer)\n triggerEl.value = null\n triggerId.value = undefined\n})\n\nfunction handleClick(event: MouseEvent) {\n if (event.defaultPrevented) return\n syncTriggerEl()\n setOpen(!open.value)\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n if (props.asChild && isKeyboardActivation(event)) {\n event.preventDefault()\n syncTriggerEl()\n setOpen(!open.value)\n return\n }\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n syncTriggerEl()\n setOpen(true)\n }\n}\n</script>\n\n<template>\n <span\n ref=\"rootRef\"\n class=\"contents\"\n @click=\"asChild && handleClick($event)\"\n @keydown=\"asChild && handleKeyDown($event)\"\n >\n <slot v-if=\"asChild\" :open=\"open\" />\n <Button\n v-else\n :id=\"ownTriggerId\"\n :variant=\"variant\"\n :color=\"color\"\n :size=\"size\"\n :radius=\"radius\"\n :disabled=\"disabled\"\n :class=\"['modo-morph-trigger', neutralOutlineClass]\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"open\"\n :aria-controls=\"phase !== 'closed' ? menuId : undefined\"\n :data-modo-morph-origin=\"morphOrigin\"\n @click=\"handleClick\"\n @keydown=\"handleKeyDown\"\n >\n <span class=\"modo-morph-trigger__content\">\n <slot :open=\"open\" />\n </span>\n </Button>\n </span>\n</template>\n"],"mappings":""}
@@ -26,7 +26,7 @@ var MenuTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0
26
26
  const landed = (0, vue.ref)(false);
27
27
  let landedTimer = null;
28
28
  const ownTriggerId = `${menuId}-trigger`;
29
- const neutralOutlineClass = (0, vue.computed)(() => props.variant === "outline" && color.value !== "danger" ? "bg-card !border-border !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring" : "");
29
+ const neutralOutlineClass = (0, vue.computed)(() => props.variant === "outline" && color.value !== "danger" ? "bg-card !border-input hover:!border-input-hover !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring" : "");
30
30
  (0, vue.watch)(phase, (next, prev) => {
31
31
  if (prev === "closing" && next === "closed") {
32
32
  landed.value = true;
@@ -1 +1 @@
1
- {"version":3,"file":"MenuTrigger.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../../src/components/navigation/menu/MenuTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport Button from '../../forms/Button.vue'\nimport type { MenuTriggerProps } from '../../../interfaces/navigation/Menu.interface'\nimport { useMenuContext } from './MenuContext'\nimport { isKeyboardActivation } from '../../../utils/morph/morphHelpers'\n\ndefineOptions({\n name: 'MenuTrigger',\n})\n\nconst props = withDefaults(defineProps<MenuTriggerProps>(), {\n asChild: false,\n variant: 'outline',\n disabled: false,\n})\n\nconst { open, phase, setOpen, triggerEl, triggerId, menuId, color, radius, size } =\n useMenuContext()\nconst rootRef = ref<HTMLElement | null>(null)\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | null = null\n\nconst ownTriggerId = `${menuId}-trigger`\n\n// Same neutral outline look as the native DropdownMenu trigger: the provider\n// color only shows through on `danger` or the filled variants.\nconst neutralOutlineClass = computed(() =>\n props.variant === 'outline' && color.value !== 'danger'\n ? 'bg-card !border-border !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring'\n : '',\n)\n\nwatch(phase, (next, prev) => {\n if (prev === 'closing' && next === 'closed') {\n landed.value = true\n if (landedTimer) clearTimeout(landedTimer)\n landedTimer = setTimeout(() => {\n landed.value = false\n }, 500)\n }\n})\n\nconst morphOrigin = computed(() => {\n if (phase.value === 'closing') return 'closing'\n if (phase.value !== 'closed') return 'hidden'\n if (landed.value) return 'landed'\n return undefined\n})\n\nfunction syncTriggerEl() {\n // The watcher is immediate, so it also runs during SSR where there is no DOM.\n if (typeof HTMLElement === 'undefined') return\n const child = rootRef.value?.firstElementChild\n if (!(child instanceof HTMLElement)) {\n triggerEl.value = null\n triggerId.value = undefined\n return\n }\n if (props.asChild) {\n // The slotted element is owned by the consumer: decorate it in place so\n // it carries the morph choreography and the ARIA wiring of a trigger.\n child.classList.add('modo-morph-trigger')\n if (morphOrigin.value) {\n child.setAttribute('data-modo-morph-origin', morphOrigin.value)\n } else {\n child.removeAttribute('data-modo-morph-origin')\n }\n if (!child.id) child.id = ownTriggerId\n child.setAttribute('aria-haspopup', 'menu')\n child.setAttribute('aria-expanded', String(open.value))\n if (phase.value !== 'closed') child.setAttribute('aria-controls', menuId)\n else child.removeAttribute('aria-controls')\n }\n triggerEl.value = child\n triggerId.value = child.id || undefined\n}\n\nwatch([rootRef, morphOrigin, open, () => props.asChild], syncTriggerEl, {\n immediate: true,\n flush: 'post',\n})\n\nonBeforeUnmount(() => {\n if (landedTimer) clearTimeout(landedTimer)\n triggerEl.value = null\n triggerId.value = undefined\n})\n\nfunction handleClick(event: MouseEvent) {\n if (event.defaultPrevented) return\n syncTriggerEl()\n setOpen(!open.value)\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n if (props.asChild && isKeyboardActivation(event)) {\n event.preventDefault()\n syncTriggerEl()\n setOpen(!open.value)\n return\n }\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n syncTriggerEl()\n setOpen(true)\n }\n}\n</script>\n\n<template>\n <span\n ref=\"rootRef\"\n class=\"contents\"\n @click=\"asChild && handleClick($event)\"\n @keydown=\"asChild && handleKeyDown($event)\"\n >\n <slot v-if=\"asChild\" :open=\"open\" />\n <Button\n v-else\n :id=\"ownTriggerId\"\n :variant=\"variant\"\n :color=\"color\"\n :size=\"size\"\n :radius=\"radius\"\n :disabled=\"disabled\"\n :class=\"['modo-morph-trigger', neutralOutlineClass]\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"open\"\n :aria-controls=\"phase !== 'closed' ? menuId : undefined\"\n :data-modo-morph-origin=\"morphOrigin\"\n @click=\"handleClick\"\n @keydown=\"handleKeyDown\"\n >\n <span class=\"modo-morph-trigger__content\">\n <slot :open=\"open\" />\n </span>\n </Button>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EAMd,MAAM,EAAE,MAAM,OAAO,SAAS,WAAW,WAAW,QAAQ,OAAO,QAAQ,SACzE,oBAAA,gBAAe;EACjB,MAAM,WAAA,GAAA,IAAA,KAAkC,KAAI;EAC5C,MAAM,UAAA,GAAA,IAAA,KAAa,MAAK;EACxB,IAAI,cAAoD;EAExD,MAAM,eAAe,GAAG,OAAO;EAI/B,MAAM,uBAAA,GAAA,IAAA,gBACJ,MAAM,YAAY,aAAa,MAAM,UAAU,WAC3C,sGACA,GACN;EAEA,CAAA,GAAA,IAAA,OAAM,QAAQ,MAAM,SAAS;GAC3B,IAAI,SAAS,aAAa,SAAS,UAAU;IAC3C,OAAO,QAAQ;IACf,IAAI,aAAa,aAAa,YAAW;IACzC,cAAc,iBAAiB;KAC7B,OAAO,QAAQ;OACd,IAAG;;IAET;EAED,MAAM,eAAA,GAAA,IAAA,gBAA6B;GACjC,IAAI,MAAM,UAAU,WAAW,OAAO;GACtC,IAAI,MAAM,UAAU,UAAU,OAAO;GACrC,IAAI,OAAO,OAAO,OAAO;IAE1B;EAED,SAAS,gBAAgB;GAEvB,IAAI,OAAO,gBAAgB,aAAa;GACxC,MAAM,QAAQ,QAAQ,OAAO;GAC7B,IAAI,EAAE,iBAAiB,cAAc;IACnC,UAAU,QAAQ;IAClB,UAAU,QAAQ,KAAA;IAClB;;GAEF,IAAI,MAAM,SAAS;IAGjB,MAAM,UAAU,IAAI,qBAAoB;IACxC,IAAI,YAAY,OACd,MAAM,aAAa,0BAA0B,YAAY,MAAK;SAE9D,MAAM,gBAAgB,yBAAwB;IAEhD,IAAI,CAAC,MAAM,IAAI,MA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OAAQ,OAAM;IACd,UAAU,QAAA;IACV,QAAA,GAAA,IAAA,gBAAK,CAAA,sBAAyB,oBAAA,MAAmB,CAAA;IAClD,iBAAc;IACb,kBAAA,GAAA,IAAA,OAAe,KAAI;IACnB,kBAAA,GAAA,IAAA,OAAe,MAAK,KAAA,YAAA,GAAA,IAAA,OAAgB,OAAM,GAAG,KAAA;IAC7C,0BAAwB,YAAA;IACxB,SAAO;IACP,WAAS;;oCAIH,EAAA,GAAA,IAAA,oBAAA,QAFP,YAEO,EAAA,GAAA,IAAA,YADgB,KAAA,QAAA,WAAA,EAAd,OAAA,GAAA,IAAA,OAAM,KAAI,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"MenuTrigger.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../../../src/components/navigation/menu/MenuTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport Button from '../../forms/Button.vue'\nimport type { MenuTriggerProps } from '../../../interfaces/navigation/Menu.interface'\nimport { useMenuContext } from './MenuContext'\nimport { isKeyboardActivation } from '../../../utils/morph/morphHelpers'\n\ndefineOptions({\n name: 'MenuTrigger',\n})\n\nconst props = withDefaults(defineProps<MenuTriggerProps>(), {\n asChild: false,\n variant: 'outline',\n disabled: false,\n})\n\nconst { open, phase, setOpen, triggerEl, triggerId, menuId, color, radius, size } =\n useMenuContext()\nconst rootRef = ref<HTMLElement | null>(null)\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | null = null\n\nconst ownTriggerId = `${menuId}-trigger`\n\n// Same neutral outline look as the native DropdownMenu trigger: the provider\n// color only shows through on `danger` or the filled variants.\nconst neutralOutlineClass = computed(() =>\n props.variant === 'outline' && color.value !== 'danger'\n ? 'bg-card !border-input hover:!border-input-hover !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring'\n : '',\n)\n\nwatch(phase, (next, prev) => {\n if (prev === 'closing' && next === 'closed') {\n landed.value = true\n if (landedTimer) clearTimeout(landedTimer)\n landedTimer = setTimeout(() => {\n landed.value = false\n }, 500)\n }\n})\n\nconst morphOrigin = computed(() => {\n if (phase.value === 'closing') return 'closing'\n if (phase.value !== 'closed') return 'hidden'\n if (landed.value) return 'landed'\n return undefined\n})\n\nfunction syncTriggerEl() {\n // The watcher is immediate, so it also runs during SSR where there is no DOM.\n if (typeof HTMLElement === 'undefined') return\n const child = rootRef.value?.firstElementChild\n if (!(child instanceof HTMLElement)) {\n triggerEl.value = null\n triggerId.value = undefined\n return\n }\n if (props.asChild) {\n // The slotted element is owned by the consumer: decorate it in place so\n // it carries the morph choreography and the ARIA wiring of a trigger.\n child.classList.add('modo-morph-trigger')\n if (morphOrigin.value) {\n child.setAttribute('data-modo-morph-origin', morphOrigin.value)\n } else {\n child.removeAttribute('data-modo-morph-origin')\n }\n if (!child.id) child.id = ownTriggerId\n child.setAttribute('aria-haspopup', 'menu')\n child.setAttribute('aria-expanded', String(open.value))\n if (phase.value !== 'closed') child.setAttribute('aria-controls', menuId)\n else child.removeAttribute('aria-controls')\n }\n triggerEl.value = child\n triggerId.value = child.id || undefined\n}\n\nwatch([rootRef, morphOrigin, open, () => props.asChild], syncTriggerEl, {\n immediate: true,\n flush: 'post',\n})\n\nonBeforeUnmount(() => {\n if (landedTimer) clearTimeout(landedTimer)\n triggerEl.value = null\n triggerId.value = undefined\n})\n\nfunction handleClick(event: MouseEvent) {\n if (event.defaultPrevented) return\n syncTriggerEl()\n setOpen(!open.value)\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n if (props.asChild && isKeyboardActivation(event)) {\n event.preventDefault()\n syncTriggerEl()\n setOpen(!open.value)\n return\n }\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n syncTriggerEl()\n setOpen(true)\n }\n}\n</script>\n\n<template>\n <span\n ref=\"rootRef\"\n class=\"contents\"\n @click=\"asChild && handleClick($event)\"\n @keydown=\"asChild && handleKeyDown($event)\"\n >\n <slot v-if=\"asChild\" :open=\"open\" />\n <Button\n v-else\n :id=\"ownTriggerId\"\n :variant=\"variant\"\n :color=\"color\"\n :size=\"size\"\n :radius=\"radius\"\n :disabled=\"disabled\"\n :class=\"['modo-morph-trigger', neutralOutlineClass]\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"open\"\n :aria-controls=\"phase !== 'closed' ? menuId : undefined\"\n :data-modo-morph-origin=\"morphOrigin\"\n @click=\"handleClick\"\n @keydown=\"handleKeyDown\"\n >\n <span class=\"modo-morph-trigger__content\">\n <slot :open=\"open\" />\n </span>\n </Button>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EAMd,MAAM,EAAE,MAAM,OAAO,SAAS,WAAW,WAAW,QAAQ,OAAO,QAAQ,SACzE,oBAAA,gBAAe;EACjB,MAAM,WAAA,GAAA,IAAA,KAAkC,KAAI;EAC5C,MAAM,UAAA,GAAA,IAAA,KAAa,MAAK;EACxB,IAAI,cAAoD;EAExD,MAAM,eAAe,GAAG,OAAO;EAI/B,MAAM,uBAAA,GAAA,IAAA,gBACJ,MAAM,YAAY,aAAa,MAAM,UAAU,WAC3C,+HACA,GACN;EAEA,CAAA,GAAA,IAAA,OAAM,QAAQ,MAAM,SAAS;GAC3B,IAAI,SAAS,aAAa,SAAS,UAAU;IAC3C,OAAO,QAAQ;IACf,IAAI,aAAa,aAAa,YAAW;IACzC,cAAc,iBAAiB;KAC7B,OAAO,QAAQ;OACd,IAAG;;IAET;EAED,MAAM,eAAA,GAAA,IAAA,gBAA6B;GACjC,IAAI,MAAM,UAAU,WAAW,OAAO;GACtC,IAAI,MAAM,UAAU,UAAU,OAAO;GACrC,IAAI,OAAO,OAAO,OAAO;IAE1B;EAED,SAAS,gBAAgB;GAEvB,IAAI,OAAO,gBAAgB,aAAa;GACxC,MAAM,QAAQ,QAAQ,OAAO;GAC7B,IAAI,EAAE,iBAAiB,cAAc;IACnC,UA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AA,IAAA,YAAwB,KAAA,QAAA,WAAA;;IAAd,OAAA,GAAA,IAAA,OAAM,KAAI;oDAoBvB,eAAA,SAAA;;IAjBN,IAAI;IACJ,SAAS,QAAA;IACT,QAAA,GAAA,IAAA,OAAO,MAAK;IACZ,OAAA,GAAA,IAAA,OAAM,KAAI;IACV,SAAA,GAAA,IAAA,OAAQ,OAAM;IACd,UAAU,QAAA;IACV,QAAA,GAAA,IAAA,gBAAK,CAAA,sBAAyB,oBAAA,MAAmB,CAAA;IAClD,iBAAc;IACb,kBAAA,GAAA,IAAA,OAAe,KAAI;IACnB,kBAAA,GAAA,IAAA,OAAe,MAAK,KAAA,YAAA,GAAA,IAAA,OAAgB,OAAM,GAAG,KAAA;IAC7C,0BAAwB,YAAA;IACxB,SAAO;IACP,WAAS;;oCAIH,EAAA,GAAA,IAAA,oBAAA,QAFP,YAEO,EAAA,GAAA,IAAA,YADgB,KAAA,QAAA,WAAA,EAAd,OAAA,GAAA,IAAA,OAAM,KAAI,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
@@ -25,7 +25,7 @@ var MenuTrigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
25
25
  const landed = ref(false);
26
26
  let landedTimer = null;
27
27
  const ownTriggerId = `${menuId}-trigger`;
28
- const neutralOutlineClass = computed(() => props.variant === "outline" && color.value !== "danger" ? "bg-card !border-border !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring" : "");
28
+ const neutralOutlineClass = computed(() => props.variant === "outline" && color.value !== "danger" ? "bg-card !border-input hover:!border-input-hover !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring" : "");
29
29
  watch(phase, (next, prev) => {
30
30
  if (prev === "closing" && next === "closed") {
31
31
  landed.value = true;
@@ -1 +1 @@
1
- {"version":3,"file":"MenuTrigger.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/navigation/menu/MenuTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport Button from '../../forms/Button.vue'\nimport type { MenuTriggerProps } from '../../../interfaces/navigation/Menu.interface'\nimport { useMenuContext } from './MenuContext'\nimport { isKeyboardActivation } from '../../../utils/morph/morphHelpers'\n\ndefineOptions({\n name: 'MenuTrigger',\n})\n\nconst props = withDefaults(defineProps<MenuTriggerProps>(), {\n asChild: false,\n variant: 'outline',\n disabled: false,\n})\n\nconst { open, phase, setOpen, triggerEl, triggerId, menuId, color, radius, size } =\n useMenuContext()\nconst rootRef = ref<HTMLElement | null>(null)\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | null = null\n\nconst ownTriggerId = `${menuId}-trigger`\n\n// Same neutral outline look as the native DropdownMenu trigger: the provider\n// color only shows through on `danger` or the filled variants.\nconst neutralOutlineClass = computed(() =>\n props.variant === 'outline' && color.value !== 'danger'\n ? 'bg-card !border-border !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring'\n : '',\n)\n\nwatch(phase, (next, prev) => {\n if (prev === 'closing' && next === 'closed') {\n landed.value = true\n if (landedTimer) clearTimeout(landedTimer)\n landedTimer = setTimeout(() => {\n landed.value = false\n }, 500)\n }\n})\n\nconst morphOrigin = computed(() => {\n if (phase.value === 'closing') return 'closing'\n if (phase.value !== 'closed') return 'hidden'\n if (landed.value) return 'landed'\n return undefined\n})\n\nfunction syncTriggerEl() {\n // The watcher is immediate, so it also runs during SSR where there is no DOM.\n if (typeof HTMLElement === 'undefined') return\n const child = rootRef.value?.firstElementChild\n if (!(child instanceof HTMLElement)) {\n triggerEl.value = null\n triggerId.value = undefined\n return\n }\n if (props.asChild) {\n // The slotted element is owned by the consumer: decorate it in place so\n // it carries the morph choreography and the ARIA wiring of a trigger.\n child.classList.add('modo-morph-trigger')\n if (morphOrigin.value) {\n child.setAttribute('data-modo-morph-origin', morphOrigin.value)\n } else {\n child.removeAttribute('data-modo-morph-origin')\n }\n if (!child.id) child.id = ownTriggerId\n child.setAttribute('aria-haspopup', 'menu')\n child.setAttribute('aria-expanded', String(open.value))\n if (phase.value !== 'closed') child.setAttribute('aria-controls', menuId)\n else child.removeAttribute('aria-controls')\n }\n triggerEl.value = child\n triggerId.value = child.id || undefined\n}\n\nwatch([rootRef, morphOrigin, open, () => props.asChild], syncTriggerEl, {\n immediate: true,\n flush: 'post',\n})\n\nonBeforeUnmount(() => {\n if (landedTimer) clearTimeout(landedTimer)\n triggerEl.value = null\n triggerId.value = undefined\n})\n\nfunction handleClick(event: MouseEvent) {\n if (event.defaultPrevented) return\n syncTriggerEl()\n setOpen(!open.value)\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n if (props.asChild && isKeyboardActivation(event)) {\n event.preventDefault()\n syncTriggerEl()\n setOpen(!open.value)\n return\n }\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n syncTriggerEl()\n setOpen(true)\n }\n}\n</script>\n\n<template>\n <span\n ref=\"rootRef\"\n class=\"contents\"\n @click=\"asChild && handleClick($event)\"\n @keydown=\"asChild && handleKeyDown($event)\"\n >\n <slot v-if=\"asChild\" :open=\"open\" />\n <Button\n v-else\n :id=\"ownTriggerId\"\n :variant=\"variant\"\n :color=\"color\"\n :size=\"size\"\n :radius=\"radius\"\n :disabled=\"disabled\"\n :class=\"['modo-morph-trigger', neutralOutlineClass]\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"open\"\n :aria-controls=\"phase !== 'closed' ? menuId : undefined\"\n :data-modo-morph-origin=\"morphOrigin\"\n @click=\"handleClick\"\n @keydown=\"handleKeyDown\"\n >\n <span class=\"modo-morph-trigger__content\">\n <slot :open=\"open\" />\n </span>\n </Button>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EAMd,MAAM,EAAE,MAAM,OAAO,SAAS,WAAW,WAAW,QAAQ,OAAO,QAAQ,SACzE,gBAAe;EACjB,MAAM,UAAU,IAAwB,KAAI;EAC5C,MAAM,SAA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AAS,YAAY,OAAmB;GACtC,IAAI,MAAM,kBAAkB;GAC5B,eAAc;GACd,QAAQ,CAAC,KAAK,MAAK;;EAGrB,SAAS,cAAc,OAAsB;GAC3C,IAAI,MAAM,WAAW,qBAAqB,MAAM,EAAE;IAChD,MAAM,gBAAe;IACrB,eAAc;IACd,QAAQ,CAAC,KAAK,MAAK;IACnB;;GAEF,IAAI,MAAM,QAAQ,eAAe,MAAM,QAAQ,WAAW;IACxD,MAAM,gBAAe;IACrB,eAAc;IACd,QAAQ,KAAI;;;;uBAMd,mBA2BO,QAAA;aA1BD;IAAJ,KAAI;IACJ,OAAM;IACL,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,WAAW,YAAY,OAAM;IACpC,WAAO,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,WAAW,cAAc,OAAM;OAE7B,QAAA,UAAZ,WAAoC,KAAA,QAAA,WAAA;;IAAd,MAAM,MAAA,KAAI;sBAChC,YAmBS,gBAAA;;IAjBN,IAAI;IACJ,SAAS,QAAA;IACT,OAAO,MAAA,MAAK;IACZ,MAAM,MAAA,KAAI;IACV,QAAQ,MAAA,OAAM;IACd,UAAU,QAAA;IACV,OAAK,eAAA,CAAA,sBAAyB,oBAAA,MAAmB,CAAA;IAClD,iBAAc;IACb,iBAAe,MAAA,KAAI;IACnB,iBAAe,MAAA,MAAK,KAAA,WAAgB,MAAA,OAAM,GAAG,KAAA;IAC7C,0BAAwB,YAAA;IACxB,SAAO;IACP,WAAS;;2BAIH,CAFP,mBAEO,QAFP,YAEO,CADL,WAAqB,KAAA,QAAA,WAAA,EAAd,MAAM,MAAA,KAAI,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"MenuTrigger.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../../src/components/navigation/menu/MenuTrigger.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, ref, watch } from 'vue'\nimport Button from '../../forms/Button.vue'\nimport type { MenuTriggerProps } from '../../../interfaces/navigation/Menu.interface'\nimport { useMenuContext } from './MenuContext'\nimport { isKeyboardActivation } from '../../../utils/morph/morphHelpers'\n\ndefineOptions({\n name: 'MenuTrigger',\n})\n\nconst props = withDefaults(defineProps<MenuTriggerProps>(), {\n asChild: false,\n variant: 'outline',\n disabled: false,\n})\n\nconst { open, phase, setOpen, triggerEl, triggerId, menuId, color, radius, size } =\n useMenuContext()\nconst rootRef = ref<HTMLElement | null>(null)\nconst landed = ref(false)\nlet landedTimer: ReturnType<typeof setTimeout> | null = null\n\nconst ownTriggerId = `${menuId}-trigger`\n\n// Same neutral outline look as the native DropdownMenu trigger: the provider\n// color only shows through on `danger` or the filled variants.\nconst neutralOutlineClass = computed(() =>\n props.variant === 'outline' && color.value !== 'danger'\n ? 'bg-card !border-input hover:!border-input-hover !text-foreground hover:!bg-card active:!bg-accent focus-visible:!ring-ring'\n : '',\n)\n\nwatch(phase, (next, prev) => {\n if (prev === 'closing' && next === 'closed') {\n landed.value = true\n if (landedTimer) clearTimeout(landedTimer)\n landedTimer = setTimeout(() => {\n landed.value = false\n }, 500)\n }\n})\n\nconst morphOrigin = computed(() => {\n if (phase.value === 'closing') return 'closing'\n if (phase.value !== 'closed') return 'hidden'\n if (landed.value) return 'landed'\n return undefined\n})\n\nfunction syncTriggerEl() {\n // The watcher is immediate, so it also runs during SSR where there is no DOM.\n if (typeof HTMLElement === 'undefined') return\n const child = rootRef.value?.firstElementChild\n if (!(child instanceof HTMLElement)) {\n triggerEl.value = null\n triggerId.value = undefined\n return\n }\n if (props.asChild) {\n // The slotted element is owned by the consumer: decorate it in place so\n // it carries the morph choreography and the ARIA wiring of a trigger.\n child.classList.add('modo-morph-trigger')\n if (morphOrigin.value) {\n child.setAttribute('data-modo-morph-origin', morphOrigin.value)\n } else {\n child.removeAttribute('data-modo-morph-origin')\n }\n if (!child.id) child.id = ownTriggerId\n child.setAttribute('aria-haspopup', 'menu')\n child.setAttribute('aria-expanded', String(open.value))\n if (phase.value !== 'closed') child.setAttribute('aria-controls', menuId)\n else child.removeAttribute('aria-controls')\n }\n triggerEl.value = child\n triggerId.value = child.id || undefined\n}\n\nwatch([rootRef, morphOrigin, open, () => props.asChild], syncTriggerEl, {\n immediate: true,\n flush: 'post',\n})\n\nonBeforeUnmount(() => {\n if (landedTimer) clearTimeout(landedTimer)\n triggerEl.value = null\n triggerId.value = undefined\n})\n\nfunction handleClick(event: MouseEvent) {\n if (event.defaultPrevented) return\n syncTriggerEl()\n setOpen(!open.value)\n}\n\nfunction handleKeyDown(event: KeyboardEvent) {\n if (props.asChild && isKeyboardActivation(event)) {\n event.preventDefault()\n syncTriggerEl()\n setOpen(!open.value)\n return\n }\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n syncTriggerEl()\n setOpen(true)\n }\n}\n</script>\n\n<template>\n <span\n ref=\"rootRef\"\n class=\"contents\"\n @click=\"asChild && handleClick($event)\"\n @keydown=\"asChild && handleKeyDown($event)\"\n >\n <slot v-if=\"asChild\" :open=\"open\" />\n <Button\n v-else\n :id=\"ownTriggerId\"\n :variant=\"variant\"\n :color=\"color\"\n :size=\"size\"\n :radius=\"radius\"\n :disabled=\"disabled\"\n :class=\"['modo-morph-trigger', neutralOutlineClass]\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"open\"\n :aria-controls=\"phase !== 'closed' ? menuId : undefined\"\n :data-modo-morph-origin=\"morphOrigin\"\n @click=\"handleClick\"\n @keydown=\"handleKeyDown\"\n >\n <span class=\"modo-morph-trigger__content\">\n <slot :open=\"open\" />\n </span>\n </Button>\n </span>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAWA,MAAM,QAAQ;EAMd,MAAM,EAAE,MAAM,OAAO,SAAS,WAAW,WAAW,QAAQ,OAAO,QAAQ,SACzE,gBAAe;EACjB,MAAM,UAAU,IAAwB,KAAI;EAC5C,MAAM,SAAS,IAAI,MAAK;EACxB,IAAI,cAAoD;EA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kBAAkB;GAC5B,eAAc;GACd,QAAQ,CAAC,KAAK,MAAK;;EAGrB,SAAS,cAAc,OAAsB;GAC3C,IAAI,MAAM,WAAW,qBAAqB,MAAM,EAAE;IAChD,MAAM,gBAAe;IACrB,eAAc;IACd,QAAQ,CAAC,KAAK,MAAK;IACnB;;GAEF,IAAI,MAAM,QAAQ,eAAe,MAAM,QAAQ,WAAW;IACxD,MAAM,gBAAe;IACrB,eAAc;IACd,QAAQ,KAAI;;;;uBAMd,mBA2BO,QAAA;aA1BD;IAAJ,KAAI;IACJ,OAAM;IACL,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,WAAW,YAAY,OAAM;IACpC,WAAO,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,WAAW,cAAc,OAAM;OAE7B,QAAA,UAAZ,WAAoC,KAAA,QAAA,WAAA;;IAAd,MAAM,MAAA,KAAI;sBAChC,YAmBS,gBAAA;;IAjBN,IAAI;IACJ,SAAS,QAAA;IACT,OAAO,MAAA,MAAK;IACZ,MAAM,MAAA,KAAI;IACV,QAAQ,MAAA,OAAM;IACd,UAAU,QAAA;IACV,OAAK,eAAA,CAAA,sBAAyB,oBAAA,MAAmB,CAAA;IAClD,iBAAc;IACb,iBAAe,MAAA,KAAI;IACnB,iBAAe,MAAA,MAAK,KAAA,WAAgB,MAAA,OAAM,GAAG,KAAA;IAC7C,0BAAwB,YAAA;IACxB,SAAO;IACP,WAAS;;2BAIH,CAFP,mBAEO,QAFP,YAEO,CADL,WAAqB,KAAA,QAAA,WAAA,EAAd,MAAM,MAAA,KAAI,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA"}
@@ -62,6 +62,22 @@ function useFieldState(props, options) {
62
62
  })
63
63
  };
64
64
  }
65
+ /** What `radius="full"` becomes for each kind of field box. */
66
+ var FIELD_FULL_RADIUS_CLASS = {
67
+ control: "rounded-[999px]",
68
+ grow: "rounded-3xl",
69
+ surface: "rounded-2xl"
70
+ };
71
+ /** Radius utility of a field box for a `radius` prop value and a box kind. */
72
+ function fieldRadiusClass(radius, kind = "control", fullRadiusClass) {
73
+ switch (radius) {
74
+ case "none": return "rounded-none";
75
+ case "small": return "rounded-sm";
76
+ case "large": return "rounded-xl";
77
+ case "full": return fullRadiusClass ?? FIELD_FULL_RADIUS_CLASS[kind];
78
+ default: return "rounded-md";
79
+ }
80
+ }
65
81
  var FIELD_AFFORDANCE_ICON_BY_COLOR = {
66
82
  default: "modo-affordance-icon",
67
83
  primary: "modo-affordance-icon",
@@ -83,6 +99,13 @@ var FOCUS_BORDER_BY_COLOR = {
83
99
  success: "focus-within:border-success/60",
84
100
  warning: "focus-within:border-warning/60"
85
101
  };
102
+ /**
103
+ * Hover border of every field and field-like control (the `input-hover` colour
104
+ * token in style.css). It is ONLY applied at rest: not while focused (the focus
105
+ * border wins), not when invalid (the error border wins), not when disabled.
106
+ * `not-[.cursor-not-allowed]` is the disabled marker every field wrapper carries.
107
+ */
108
+ var FIELD_HOVER_BORDER = "not-[.cursor-not-allowed]:not-focus-within:hover:border-input-hover";
86
109
  var FORCED_BORDER_BY_COLOR = {
87
110
  default: "border-foreground/50",
88
111
  primary: "border-primary/60",
@@ -119,6 +142,7 @@ function useFieldClasses(source) {
119
142
  const focusBorder = FOCUS_BORDER_BY_COLOR[stateColor];
120
143
  const forcedBorder = forceFocus ? FORCED_BORDER_BY_COLOR[stateColor] : "";
121
144
  const forcedBg = forceFocus ? "bg-background" : "";
145
+ const hoverBorder = hasError || forceFocus ? "" : FIELD_HOVER_BORDER;
122
146
  const idleRing = halo === "off" ? "" : "ring-4 ring-border/25";
123
147
  const focusRingUtil = FIELD_FOCUS_RING;
124
148
  const forcedRingUtil = forceFocus ? MODO_FOCUS_RING : "";
@@ -133,7 +157,8 @@ function useFieldClasses(source) {
133
157
  errBorder
134
158
  ].join(" ");
135
159
  case "ghost": return [
136
- "bg-transparent border-b border-border rounded-none",
160
+ "bg-transparent border-b border-input rounded-none",
161
+ hoverBorder,
137
162
  focusBorder,
138
163
  forcedBorder,
139
164
  hasError ? "border-destructive" : ""
@@ -141,6 +166,7 @@ function useFieldClasses(source) {
141
166
  default: return [
142
167
  "bg-background border border-input",
143
168
  idleRing,
169
+ hoverBorder,
144
170
  focusBorder,
145
171
  focusRingUtil,
146
172
  forcedRingUtil,
@@ -151,13 +177,7 @@ function useFieldClasses(source) {
151
177
  }),
152
178
  radiusClasses: (0, vue.computed)(() => {
153
179
  if ((0, vue.toValue)(source.variant) === "ghost") return "";
154
- switch ((0, vue.toValue)(source.radius)) {
155
- case "none": return "rounded-none";
156
- case "small": return "rounded-sm";
157
- case "large": return "rounded-xl";
158
- case "full": return source.fullRadiusClass ?? "rounded-[999px]";
159
- default: return "rounded-md";
160
- }
180
+ return fieldRadiusClass((0, vue.toValue)(source.radius), source.radiusKind ? (0, vue.toValue)(source.radiusKind) : "control", source.fullRadiusClass);
161
181
  })
162
182
  };
163
183
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useField.cjs","names":[],"sources":["../../src/composables/useField.ts"],"sourcesContent":["import { computed, inject, useId, toValue, type ComputedRef, type InjectionKey, type MaybeRefOrGetter, type Ref } from 'vue';\nimport { useResolvedHalo } from './useModoConfig';\nimport type { ModoHalo } from '../config/ModoConfig';\nimport { useResolvedColor, useResolvedRadius } from './useModoConfig';\n\n/**\n * Injection key provided by FormField so child form controls can:\n * 1. Use the FormField's id as their own (connecting `<label for=\"...\">` automatically).\n * 2. Suppress the \"no label\" a11y warning — the FormField already renders a visible label.\n */\nexport const FORM_FIELD_ID_KEY: InjectionKey<Ref<string>> = Symbol('FormFieldId');\n \n/** \n * Props del campo de formulario que necesita `useFieldState`. \n * Se definen aquí para que cualquier componente (Input, Textarea, Password…) \n * pueda extenderlas y pasar su reactive `props` directamente. \n */ \nexport interface FieldStateSource { \n modelValue?: unknown; \n id?: string; \n label?: string; \n ariaLabel?: string; \n color?: 'default' | 'primary' | 'danger' | 'success' | 'warning'; \n radius?: 'none' | 'small' | 'medium' | 'large' | 'full'; \n errorText?: string; \n helperText?: string; \n /** Cuando es true, fuerza estado inválido sin renderizar errorText. Útil al envolver con FormField. */ \n invalid?: boolean; \n /** IDs adicionales para concatenar en aria-describedby (ej. provistos por un wrapper). */ \n ariaDescribedBy?: string; \n maxLength?: number; \n showCounter?: boolean; \n disabled?: boolean; \n loading?: boolean; \n} \n \nexport interface UseFieldStateOptions { \n /** Nombre del componente para el warning DEV. */ \n componentName: string; \n /** Prefijo para el id autogenerado (ej. 'modo-input'). */ \n idPrefix: string; \n} \n \n/** \n * Estado compartido entre campos de formulario (Input, Textarea, Password…). \n * \n * Resuelve: \n * - `fieldId` (prop.id o autogenerado). \n * - Color/radius resueltos desde el provider. \n * - `stateColor` (danger si hay error, si no el color resuelto). \n * - `describedBy` con los IDs de helper/error/counter. \n * - Contador y flags derivadas. \n * - Warning DEV cuando falta label/ariaLabel. \n */ \nexport function useFieldState(\n props: FieldStateSource,\n options: UseFieldStateOptions,\n) {\n const autoId = useId();\n // If a parent FormField provides its id, use it — this connects the FormField's\n // `<label for=\"...\">` to this input automatically without needing v-slot binding.\n const formFieldId = inject(FORM_FIELD_ID_KEY, null);\n const fieldId = computed(() => props.id ?? formFieldId?.value ?? `${options.idPrefix}-${autoId}`);\n \n const color = useResolvedColor(() => props.color); \n const radius = useResolvedRadius(() => props.radius); \n \n const hasError = computed(() => !!props.errorText || !!props.invalid); \n const isDisabled = computed(() => !!props.disabled || !!props.loading); \n \n const stateColor = computed(() => \n hasError.value ? 'danger' : color.value, \n ) as ComputedRef<'default' | 'primary' | 'danger' | 'success' | 'warning'>; \n \n const hasValue = computed(() => { \n const v = props.modelValue; \n return v !== null && v !== undefined && String(v).length > 0; \n }); \n \n const currentLength = computed(() => String(props.modelValue ?? '').length); \n const showCounterEffective = computed( \n () => !!props.showCounter && !!props.maxLength, \n ); \n const counterOverflow = computed( \n () => !!props.maxLength && currentLength.value >= props.maxLength, \n ); \n \n const errorId = computed(() => `${fieldId.value}-error`); \n const helperId = computed(() => `${fieldId.value}-helper`); \n const counterId = computed(() => `${fieldId.value}-counter`); \n \n const describedBy = computed(() => { \n const ids: string[] = []; \n if (hasError.value && props.errorText) ids.push(errorId.value); \n else if (props.helperText) ids.push(helperId.value); \n if (showCounterEffective.value) ids.push(counterId.value); \n if (props.ariaDescribedBy) ids.push(props.ariaDescribedBy); \n return ids.length ? ids.join(' ') : undefined; \n }); \n \n // Warn only when there is genuinely no accessible label: no label/ariaLabel prop\n // AND no parent FormField providing one (detected via injection key).\n if (import.meta.env.DEV && !props.label && !props.ariaLabel && !props.id && !formFieldId) {\n console.warn(\n `[mood-ui ${options.componentName}] Se requiere \\`label\\` o \\`ariaLabel\\` para accesibilidad.`,\n );\n }\n \n return { \n fieldId, \n color, \n radius, \n stateColor, \n hasError, \n hasValue, \n isDisabled, \n currentLength, \n showCounterEffective, \n counterOverflow, \n errorId, \n helperId, \n counterId, \n describedBy, \n }; \n} \n \nexport type FieldVariant = 'outline' | 'filled' | 'ghost'; \n \nexport interface UseFieldClassesSource { \n variant: MaybeRefOrGetter<FieldVariant>; \n stateColor: MaybeRefOrGetter<'default' | 'primary' | 'danger' | 'success' | 'warning'>; \n hasError: MaybeRefOrGetter<boolean>; \n radius: MaybeRefOrGetter<'none' | 'small' | 'medium' | 'large' | 'full'>; \n /** radius utility para 'full' (Input usa 'full', Textarea usa '2xl'). */ \n fullRadiusClass?: string; \n /** \n * Cuando es true, fuerza los estilos de focus (halo + borde) aunque \n * el foco esté fuera del wrapper. Útil para Select/Combobox cuando \n * el popover teleportado roba el foco pero el campo sigue \"activo\". \n */ \n forceFocus?: MaybeRefOrGetter<boolean>; \n /** \n * Estilo del halo del campo. Si no se pasa, se usa el valor resuelto \n * vía ModoProvider/useResolvedHalo. \n * - `'tinted'`: tintado al color (default) \n * - `'neutral'`: siempre gris \n * - `'off'`: sin halo persistente (solo focus-visible ring a11y) \n */ \n halo?: MaybeRefOrGetter<ModoHalo | undefined>; \n} \n\nexport const FIELD_AFFORDANCE_ICON_BY_COLOR: Record<string, string> = {\n default: 'modo-affordance-icon',\n primary: 'modo-affordance-icon',\n danger: 'text-destructive/85',\n success: 'modo-affordance-icon',\n warning: 'modo-affordance-icon',\n};\n\nexport const FIELD_AFFORDANCE_ACTION_BY_COLOR: Record<string, string> = {\n default: 'modo-affordance-action',\n primary: 'modo-affordance-action',\n danger: 'text-destructive/80 hover:text-destructive',\n success: 'modo-affordance-action',\n warning: 'modo-affordance-action',\n};\n \nconst FOCUS_BORDER_BY_COLOR: Record<string, string> = { \n default: 'focus-within:border-foreground/50', \n primary: 'focus-within:border-primary/60', \n danger: 'focus-within:border-destructive/60', \n success: 'focus-within:border-success/60', \n warning: 'focus-within:border-warning/60', \n}; \n \nconst FORCED_BORDER_BY_COLOR: Record<string, string> = { \n default: 'border-foreground/50', \n primary: 'border-primary/60', \n danger: 'border-destructive/60', \n success: 'border-success/60', \n warning: 'border-warning/60', \n}; \n \n/**\n * THE single focus indicator for the whole system. Every interactive component\n * uses this exact ring so tabbing through a form/toolbar shows one consistent\n * focus — a soft ring, no offset gap. `FIELD_FOCUS_RING` is the `focus-within`\n * variant for field wrappers; `CONTROL_FOCUS_RING` is the `focus-visible`\n * variant for buttons and other single-element controls.\n */\nexport const MODO_FOCUS_RING = 'ring-2 ring-ring/60';\nexport const FIELD_FOCUS_RING = 'focus-within:ring-2 focus-within:ring-ring/60';\nexport const CONTROL_FOCUS_RING =\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60';\n\n/**\n * Resuelve las clases de wrapper (variante + halo + error) y el radius\n * para cualquier campo de formulario que siga el patrón Input/Textarea.\n */\nexport function useFieldClasses(source: UseFieldClassesSource) {\n const resolvedHalo = useResolvedHalo(() => { \n const local = source.halo ? toValue(source.halo) : undefined; \n return local; \n }); \n \n const wrapperVariantClasses = computed(() => {\n const variant = toValue(source.variant);\n const stateColor = toValue(source.stateColor);\n const hasError = toValue(source.hasError);\n const forceFocus = source.forceFocus ? toValue(source.forceFocus) : false;\n const halo = resolvedHalo.value;\n const errBorder = hasError ? 'border-destructive' : '';\n const focusBorder = FOCUS_BORDER_BY_COLOR[stateColor];\n const forcedBorder = forceFocus ? FORCED_BORDER_BY_COLOR[stateColor] : '';\n const forcedBg = forceFocus ? 'bg-background' : '';\n\n // The persistent halo (idle ring) is opt-in via `neutral`/`tinted`.\n // The FOCUS ring is the SAME everywhere (see MODO_FOCUS_RING) so a field\n // and a button show an identical indicator when you tab to them.\n const idleRing = halo === 'off' ? '' : 'ring-4 ring-border/25';\n const focusRingUtil = FIELD_FOCUS_RING;\n const forcedRingUtil = forceFocus ? MODO_FOCUS_RING : '';\n\n switch (variant) {\n case 'filled':\n return [\n 'bg-muted border border-transparent',\n idleRing,\n 'focus-within:bg-background',\n focusBorder,\n focusRingUtil,\n forceFocus ? `${forcedRingUtil} ${forcedBorder} ${forcedBg}` : forcedBg,\n errBorder,\n ].join(' ');\n case 'ghost':\n return [\n 'bg-transparent border-b border-border rounded-none',\n focusBorder,\n forcedBorder,\n hasError ? 'border-destructive' : '',\n ].join(' ');\n case 'outline':\n default:\n return [\n 'bg-background border border-input',\n idleRing,\n focusBorder,\n focusRingUtil,\n forcedRingUtil,\n forcedBorder,\n errBorder,\n ].join(' ');\n }\n });\n \n const radiusClasses = computed(() => { \n const variant = toValue(source.variant); \n if (variant === 'ghost') return ''; \n const radius = toValue(source.radius); \n switch (radius) { \n case 'none': return 'rounded-none'; \n case 'small': return 'rounded-sm'; \n case 'large': return 'rounded-xl'; \n // `rounded-full` compiles to an effectively-infinite radius which\n // Chrome clamps differently for box-shadows than for the border,\n // making any ring render boxy corners. A large *finite* radius is a\n // visually-identical pill that shadows follow correctly.\n case 'full': return source.fullRadiusClass ?? 'rounded-[999px]';\n case 'medium': \n default: return 'rounded-md'; \n } \n }); \n \n return { wrapperVariantClasses, radiusClasses }; \n}\n"],"mappings":";;;;;;;;;AAUA,IAAa,oBAA+C,OAAO,cAAc;;;;;;;;;;;;AA4CjF,SAAgB,cACZ,OACA,SACF;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aAAa,kBAAkB;GAKhD,MAAM,WAAW,SAAS,QAAQ,KAAK;GACvC,MAAM,gBAAgB;GACtB,MAAM,iBAAiB,aAAa,kBAAkB;GAEtD,QAAQ,SAAR;IACI,KAAK,UACD,OAAO;KACH;KACA;KACA;KACA;KACA;KACA,aAAa,GAAG,eAAe,GAAG,aAAa,GAAG,aAAa;KAC/D;KACH,CAAC,KAAK,IAAI;IACf,KAAK,SACD,OAAO;KACH;KACA;KACA;KACA,WAAW,uBAAuB;KACrC,CAAC,KAAK,IAAI;IAEf,SACI,OAAO;KACH;KACA;KACA;KACA;KACA;KACA;KACA;KACH,CAAC,KAAK,IAAI;;IAsBd;EAAuB,gBAAA,GAAA,IAAA,gBAlBK;GAEjC,KAAA,GAAA,IAAA,SADwB,OAAO,QAC3B,KAAY,SAAS,OAAO;GAEhC,SAAA,GAAA,IAAA,SADuB,OAAO,OACtB,EAAR;IACI,KAAK,QAAQ,OAAO;IACpB,KAAK,SAAS,OAAO;IACrB,KAAK,SAAS,OAAO;IAKrB,KAAK,QAAQ,OAAO,OAAO,mBAAmB;IAE9C,SAAS,OAAO;;IAIQ;EAAe"}
1
+ {"version":3,"file":"useField.cjs","names":[],"sources":["../../src/composables/useField.ts"],"sourcesContent":["import { computed, inject, useId, toValue, type ComputedRef, type InjectionKey, type MaybeRefOrGetter, type Ref } from 'vue';\nimport { useResolvedHalo } from './useModoConfig';\nimport type { ModoHalo } from '../config/ModoConfig';\nimport { useResolvedColor, useResolvedRadius } from './useModoConfig';\n\n/**\n * Injection key provided by FormField so child form controls can:\n * 1. Use the FormField's id as their own (connecting `<label for=\"...\">` automatically).\n * 2. Suppress the \"no label\" a11y warning — the FormField already renders a visible label.\n */\nexport const FORM_FIELD_ID_KEY: InjectionKey<Ref<string>> = Symbol('FormFieldId');\n \n/** \n * Props del campo de formulario que necesita `useFieldState`. \n * Se definen aquí para que cualquier componente (Input, Textarea, Password…) \n * pueda extenderlas y pasar su reactive `props` directamente. \n */ \nexport interface FieldStateSource { \n modelValue?: unknown; \n id?: string; \n label?: string; \n ariaLabel?: string; \n color?: 'default' | 'primary' | 'danger' | 'success' | 'warning'; \n radius?: 'none' | 'small' | 'medium' | 'large' | 'full'; \n errorText?: string; \n helperText?: string; \n /** Cuando es true, fuerza estado inválido sin renderizar errorText. Útil al envolver con FormField. */ \n invalid?: boolean; \n /** IDs adicionales para concatenar en aria-describedby (ej. provistos por un wrapper). */ \n ariaDescribedBy?: string; \n maxLength?: number; \n showCounter?: boolean; \n disabled?: boolean; \n loading?: boolean; \n} \n \nexport interface UseFieldStateOptions { \n /** Nombre del componente para el warning DEV. */ \n componentName: string; \n /** Prefijo para el id autogenerado (ej. 'modo-input'). */ \n idPrefix: string; \n} \n \n/** \n * Estado compartido entre campos de formulario (Input, Textarea, Password…). \n * \n * Resuelve: \n * - `fieldId` (prop.id o autogenerado). \n * - Color/radius resueltos desde el provider. \n * - `stateColor` (danger si hay error, si no el color resuelto). \n * - `describedBy` con los IDs de helper/error/counter. \n * - Contador y flags derivadas. \n * - Warning DEV cuando falta label/ariaLabel. \n */ \nexport function useFieldState(\n props: FieldStateSource,\n options: UseFieldStateOptions,\n) {\n const autoId = useId();\n // If a parent FormField provides its id, use it — this connects the FormField's\n // `<label for=\"...\">` to this input automatically without needing v-slot binding.\n const formFieldId = inject(FORM_FIELD_ID_KEY, null);\n const fieldId = computed(() => props.id ?? formFieldId?.value ?? `${options.idPrefix}-${autoId}`);\n \n const color = useResolvedColor(() => props.color); \n const radius = useResolvedRadius(() => props.radius); \n \n const hasError = computed(() => !!props.errorText || !!props.invalid); \n const isDisabled = computed(() => !!props.disabled || !!props.loading); \n \n const stateColor = computed(() => \n hasError.value ? 'danger' : color.value, \n ) as ComputedRef<'default' | 'primary' | 'danger' | 'success' | 'warning'>; \n \n const hasValue = computed(() => { \n const v = props.modelValue; \n return v !== null && v !== undefined && String(v).length > 0; \n }); \n \n const currentLength = computed(() => String(props.modelValue ?? '').length); \n const showCounterEffective = computed( \n () => !!props.showCounter && !!props.maxLength, \n ); \n const counterOverflow = computed( \n () => !!props.maxLength && currentLength.value >= props.maxLength, \n ); \n \n const errorId = computed(() => `${fieldId.value}-error`); \n const helperId = computed(() => `${fieldId.value}-helper`); \n const counterId = computed(() => `${fieldId.value}-counter`); \n \n const describedBy = computed(() => { \n const ids: string[] = []; \n if (hasError.value && props.errorText) ids.push(errorId.value); \n else if (props.helperText) ids.push(helperId.value); \n if (showCounterEffective.value) ids.push(counterId.value); \n if (props.ariaDescribedBy) ids.push(props.ariaDescribedBy); \n return ids.length ? ids.join(' ') : undefined; \n }); \n \n // Warn only when there is genuinely no accessible label: no label/ariaLabel prop\n // AND no parent FormField providing one (detected via injection key).\n if (import.meta.env.DEV && !props.label && !props.ariaLabel && !props.id && !formFieldId) {\n console.warn(\n `[mood-ui ${options.componentName}] Se requiere \\`label\\` o \\`ariaLabel\\` para accesibilidad.`,\n );\n }\n \n return { \n fieldId, \n color, \n radius, \n stateColor, \n hasError, \n hasValue, \n isDisabled, \n currentLength, \n showCounterEffective, \n counterOverflow, \n errorId, \n helperId, \n counterId, \n describedBy, \n }; \n} \n \nexport type FieldVariant = 'outline' | 'filled' | 'ghost'; \n\nexport type FieldRadiusName = 'none' | 'small' | 'medium' | 'large' | 'full';\n\n/**\n * What a field's box is, for the radius scale:\n * - `control`: one row (Input, Select, Date…). `full` is a true pill.\n * - `grow`: a row that gets taller as it fills (chips in MultiSelect/TagInput).\n * `full` is a pill at one row and settles into a rounded rectangle after.\n * - `surface`: a large box (Textarea, drop zone). `full` is capped at a\n * card-like radius: a big pill is never a good shape.\n */\nexport type FieldRadiusKind = 'control' | 'grow' | 'surface';\n\n/** What `radius=\"full\"` becomes for each kind of field box. */\nexport const FIELD_FULL_RADIUS_CLASS: Record<FieldRadiusKind, string> = {\n // `rounded-full` compiles to an effectively-infinite radius which Chrome\n // clamps differently for box-shadows than for the border, making any ring\n // render boxy corners. A large *finite* radius is a visually-identical pill.\n control: 'rounded-[999px]',\n grow: 'rounded-3xl',\n surface: 'rounded-2xl',\n};\n\n/** Radius utility of a field box for a `radius` prop value and a box kind. */\nexport function fieldRadiusClass(\n radius: FieldRadiusName,\n kind: FieldRadiusKind = 'control',\n fullRadiusClass?: string,\n): string {\n switch (radius) {\n case 'none': return 'rounded-none';\n case 'small': return 'rounded-sm';\n case 'large': return 'rounded-xl';\n case 'full': return fullRadiusClass ?? FIELD_FULL_RADIUS_CLASS[kind];\n case 'medium':\n default: return 'rounded-md';\n }\n}\n \nexport interface UseFieldClassesSource { \n variant: MaybeRefOrGetter<FieldVariant>; \n stateColor: MaybeRefOrGetter<'default' | 'primary' | 'danger' | 'success' | 'warning'>; \n hasError: MaybeRefOrGetter<boolean>; \n radius: MaybeRefOrGetter<'none' | 'small' | 'medium' | 'large' | 'full'>; \n /** radius utility para 'full' (Input usa 'full', Textarea usa '2xl'). */ \n fullRadiusClass?: string; \n /** Kind of box, to cap `radius=\"full\"` on large surfaces. @default 'control' */\n radiusKind?: MaybeRefOrGetter<FieldRadiusKind>;\n /** \n * Cuando es true, fuerza los estilos de focus (halo + borde) aunque \n * el foco esté fuera del wrapper. Útil para Select/Combobox cuando \n * el popover teleportado roba el foco pero el campo sigue \"activo\". \n */ \n forceFocus?: MaybeRefOrGetter<boolean>; \n /** \n * Estilo del halo del campo. Si no se pasa, se usa el valor resuelto \n * vía ModoProvider/useResolvedHalo. \n * - `'tinted'`: tintado al color (default) \n * - `'neutral'`: siempre gris \n * - `'off'`: sin halo persistente (solo focus-visible ring a11y) \n */ \n halo?: MaybeRefOrGetter<ModoHalo | undefined>; \n} \n\nexport const FIELD_AFFORDANCE_ICON_BY_COLOR: Record<string, string> = {\n default: 'modo-affordance-icon',\n primary: 'modo-affordance-icon',\n danger: 'text-destructive/85',\n success: 'modo-affordance-icon',\n warning: 'modo-affordance-icon',\n};\n\nexport const FIELD_AFFORDANCE_ACTION_BY_COLOR: Record<string, string> = {\n default: 'modo-affordance-action',\n primary: 'modo-affordance-action',\n danger: 'text-destructive/80 hover:text-destructive',\n success: 'modo-affordance-action',\n warning: 'modo-affordance-action',\n};\n \nconst FOCUS_BORDER_BY_COLOR: Record<string, string> = { \n default: 'focus-within:border-foreground/50', \n primary: 'focus-within:border-primary/60', \n danger: 'focus-within:border-destructive/60', \n success: 'focus-within:border-success/60', \n warning: 'focus-within:border-warning/60', \n}; \n \n/**\n * Hover border of every field and field-like control (the `input-hover` colour\n * token in style.css). It is ONLY applied at rest: not while focused (the focus\n * border wins), not when invalid (the error border wins), not when disabled.\n * `not-[.cursor-not-allowed]` is the disabled marker every field wrapper carries.\n */\nexport const FIELD_HOVER_BORDER =\n 'not-[.cursor-not-allowed]:not-focus-within:hover:border-input-hover';\n\nconst FORCED_BORDER_BY_COLOR: Record<string, string> = { \n default: 'border-foreground/50', \n primary: 'border-primary/60', \n danger: 'border-destructive/60', \n success: 'border-success/60', \n warning: 'border-warning/60', \n}; \n \n/**\n * THE single focus indicator for the whole system. Every interactive component\n * uses this exact ring so tabbing through a form/toolbar shows one consistent\n * focus — a soft ring, no offset gap. `FIELD_FOCUS_RING` is the `focus-within`\n * variant for field wrappers; `CONTROL_FOCUS_RING` is the `focus-visible`\n * variant for buttons and other single-element controls.\n */\nexport const MODO_FOCUS_RING = 'ring-2 ring-ring/60';\nexport const FIELD_FOCUS_RING = 'focus-within:ring-2 focus-within:ring-ring/60';\nexport const CONTROL_FOCUS_RING =\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60';\n\n/**\n * Resuelve las clases de wrapper (variante + halo + error) y el radius\n * para cualquier campo de formulario que siga el patrón Input/Textarea.\n */\nexport function useFieldClasses(source: UseFieldClassesSource) {\n const resolvedHalo = useResolvedHalo(() => { \n const local = source.halo ? toValue(source.halo) : undefined; \n return local; \n }); \n \n const wrapperVariantClasses = computed(() => {\n const variant = toValue(source.variant);\n const stateColor = toValue(source.stateColor);\n const hasError = toValue(source.hasError);\n const forceFocus = source.forceFocus ? toValue(source.forceFocus) : false;\n const halo = resolvedHalo.value;\n const errBorder = hasError ? 'border-destructive' : '';\n const focusBorder = FOCUS_BORDER_BY_COLOR[stateColor];\n const forcedBorder = forceFocus ? FORCED_BORDER_BY_COLOR[stateColor] : '';\n const forcedBg = forceFocus ? 'bg-background' : '';\n const hoverBorder = hasError || forceFocus ? '' : FIELD_HOVER_BORDER;\n\n // The persistent halo (idle ring) is opt-in via `neutral`/`tinted`.\n // The FOCUS ring is the SAME everywhere (see MODO_FOCUS_RING) so a field\n // and a button show an identical indicator when you tab to them.\n const idleRing = halo === 'off' ? '' : 'ring-4 ring-border/25';\n const focusRingUtil = FIELD_FOCUS_RING;\n const forcedRingUtil = forceFocus ? MODO_FOCUS_RING : '';\n\n switch (variant) {\n case 'filled':\n return [\n 'bg-muted border border-transparent',\n idleRing,\n 'focus-within:bg-background',\n focusBorder,\n focusRingUtil,\n forceFocus ? `${forcedRingUtil} ${forcedBorder} ${forcedBg}` : forcedBg,\n errBorder,\n ].join(' ');\n case 'ghost':\n return [\n 'bg-transparent border-b border-input rounded-none',\n hoverBorder,\n focusBorder,\n forcedBorder,\n hasError ? 'border-destructive' : '',\n ].join(' ');\n case 'outline':\n default:\n return [\n 'bg-background border border-input',\n idleRing,\n hoverBorder,\n focusBorder,\n focusRingUtil,\n forcedRingUtil,\n forcedBorder,\n errBorder,\n ].join(' ');\n }\n });\n \n const radiusClasses = computed(() => { \n const variant = toValue(source.variant); \n if (variant === 'ghost') return ''; \n return fieldRadiusClass(\n toValue(source.radius),\n source.radiusKind ? toValue(source.radiusKind) : 'control',\n source.fullRadiusClass,\n );\n }); \n \n return { wrapperVariantClasses, radiusClasses }; \n}\n"],"mappings":";;;;;;;;;AAUA,IAAa,oBAA+C,OAAO,cAAc;;;;;;;;;;;;AA4CjF,SAAgB,cACZ,OACA,SACF;CACE,MAAM,UAAA,GAAA,IAAA,QAAgB;CAGtB,MAAM,eAAA,GAAA,IAAA,QAAqB,mBAAmB,KAAK;CACnD,MAAM,WAAA,GAAA,IAAA,gB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AAA,SAAqB,OAAO,WAAW,GAAG;GACpE,MAAM,OAAO,aAAa;GAC1B,MAAM,YAAY,WAAW,uBAAuB;GACpD,MAAM,cAAc,sBAAsB;GAC1C,MAAM,eAAe,aAAa,uBAAuB,cAAc;GACvE,MAAM,WAAW,aAAa,kBAAkB;GAChD,MAAM,cAAc,YAAY,aAAa,KAAK;GAKlD,MAAM,WAAW,SAAS,QAAQ,KAAK;GACvC,MAAM,gBAAgB;GACtB,MAAM,iBAAiB,aAAa,kBAAkB;GAEtD,QAAQ,SAAR;IACI,KAAK,UACD,OAAO;KACH;KACA;KACA;KACA;KACA;KACA,aAAa,GAAG,eAAe,GAAG,aAAa,GAAG,aAAa;KAC/D;KACH,CAAC,KAAK,IAAI;IACf,KAAK,SACD,OAAO;KACH;KACA;KACA;KACA;KACA,WAAW,uBAAuB;KACrC,CAAC,KAAK,IAAI;IAEf,SACI,OAAO;KACH;KACA;KACA;KACA;KACA;KACA;KACA;KACA;KACH,CAAC,KAAK,IAAI;;IAcd;EAAuB,gBAAA,GAAA,IAAA,gBAVK;GAEjC,KAAA,GAAA,IAAA,SADwB,OAAO,QAC3B,KAAY,SAAS,OAAO;GAChC,OAAO,kBAAA,GAAA,IAAA,SACK,OAAO,OAAO,EACtB,OAAO,cAAA,GAAA,IAAA,SAAqB,OAAO,WAAW,GAAG,WACjD,OAAO,gBACV;IAG2B;EAAe"}
@@ -61,6 +61,22 @@ function useFieldState(props, options) {
61
61
  })
62
62
  };
63
63
  }
64
+ /** What `radius="full"` becomes for each kind of field box. */
65
+ var FIELD_FULL_RADIUS_CLASS = {
66
+ control: "rounded-[999px]",
67
+ grow: "rounded-3xl",
68
+ surface: "rounded-2xl"
69
+ };
70
+ /** Radius utility of a field box for a `radius` prop value and a box kind. */
71
+ function fieldRadiusClass(radius, kind = "control", fullRadiusClass) {
72
+ switch (radius) {
73
+ case "none": return "rounded-none";
74
+ case "small": return "rounded-sm";
75
+ case "large": return "rounded-xl";
76
+ case "full": return fullRadiusClass ?? FIELD_FULL_RADIUS_CLASS[kind];
77
+ default: return "rounded-md";
78
+ }
79
+ }
64
80
  var FIELD_AFFORDANCE_ICON_BY_COLOR = {
65
81
  default: "modo-affordance-icon",
66
82
  primary: "modo-affordance-icon",
@@ -82,6 +98,13 @@ var FOCUS_BORDER_BY_COLOR = {
82
98
  success: "focus-within:border-success/60",
83
99
  warning: "focus-within:border-warning/60"
84
100
  };
101
+ /**
102
+ * Hover border of every field and field-like control (the `input-hover` colour
103
+ * token in style.css). It is ONLY applied at rest: not while focused (the focus
104
+ * border wins), not when invalid (the error border wins), not when disabled.
105
+ * `not-[.cursor-not-allowed]` is the disabled marker every field wrapper carries.
106
+ */
107
+ var FIELD_HOVER_BORDER = "not-[.cursor-not-allowed]:not-focus-within:hover:border-input-hover";
85
108
  var FORCED_BORDER_BY_COLOR = {
86
109
  default: "border-foreground/50",
87
110
  primary: "border-primary/60",
@@ -118,6 +141,7 @@ function useFieldClasses(source) {
118
141
  const focusBorder = FOCUS_BORDER_BY_COLOR[stateColor];
119
142
  const forcedBorder = forceFocus ? FORCED_BORDER_BY_COLOR[stateColor] : "";
120
143
  const forcedBg = forceFocus ? "bg-background" : "";
144
+ const hoverBorder = hasError || forceFocus ? "" : FIELD_HOVER_BORDER;
121
145
  const idleRing = halo === "off" ? "" : "ring-4 ring-border/25";
122
146
  const focusRingUtil = FIELD_FOCUS_RING;
123
147
  const forcedRingUtil = forceFocus ? MODO_FOCUS_RING : "";
@@ -132,7 +156,8 @@ function useFieldClasses(source) {
132
156
  errBorder
133
157
  ].join(" ");
134
158
  case "ghost": return [
135
- "bg-transparent border-b border-border rounded-none",
159
+ "bg-transparent border-b border-input rounded-none",
160
+ hoverBorder,
136
161
  focusBorder,
137
162
  forcedBorder,
138
163
  hasError ? "border-destructive" : ""
@@ -140,6 +165,7 @@ function useFieldClasses(source) {
140
165
  default: return [
141
166
  "bg-background border border-input",
142
167
  idleRing,
168
+ hoverBorder,
143
169
  focusBorder,
144
170
  focusRingUtil,
145
171
  forcedRingUtil,
@@ -150,13 +176,7 @@ function useFieldClasses(source) {
150
176
  }),
151
177
  radiusClasses: computed(() => {
152
178
  if (toValue(source.variant) === "ghost") return "";
153
- switch (toValue(source.radius)) {
154
- case "none": return "rounded-none";
155
- case "small": return "rounded-sm";
156
- case "large": return "rounded-xl";
157
- case "full": return source.fullRadiusClass ?? "rounded-[999px]";
158
- default: return "rounded-md";
159
- }
179
+ return fieldRadiusClass(toValue(source.radius), source.radiusKind ? toValue(source.radiusKind) : "control", source.fullRadiusClass);
160
180
  })
161
181
  };
162
182
  }