mood-ui 0.10.0 → 0.11.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 (255) hide show
  1. package/dist/components/data-display/Chart.cjs +6 -0
  2. package/dist/components/data-display/Chart.cjs.map +1 -0
  3. package/dist/components/data-display/Chart.mjs +7 -0
  4. package/dist/components/data-display/Chart.mjs.map +1 -0
  5. package/dist/components/data-display/Chart.vue_vue_type_script_setup_true_lang.cjs +48 -0
  6. package/dist/components/data-display/Chart.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  7. package/dist/components/data-display/Chart.vue_vue_type_script_setup_true_lang.mjs +47 -0
  8. package/dist/components/data-display/Chart.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  9. package/dist/components/data-display/Stat.cjs.map +1 -1
  10. package/dist/components/data-display/Stat.mjs.map +1 -1
  11. package/dist/components/data-display/Stat.vue_vue_type_script_setup_true_lang.cjs +88 -75
  12. package/dist/components/data-display/Stat.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  13. package/dist/components/data-display/Stat.vue_vue_type_script_setup_true_lang.mjs +90 -77
  14. package/dist/components/data-display/Stat.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  15. package/dist/components/data-display/chart/Cartesian.cjs +6 -0
  16. package/dist/components/data-display/chart/Cartesian.cjs.map +1 -0
  17. package/dist/components/data-display/chart/Cartesian.mjs +7 -0
  18. package/dist/components/data-display/chart/Cartesian.mjs.map +1 -0
  19. package/dist/components/data-display/chart/Cartesian.vue_vue_type_script_setup_true_lang.cjs +573 -0
  20. package/dist/components/data-display/chart/Cartesian.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  21. package/dist/components/data-display/chart/Cartesian.vue_vue_type_script_setup_true_lang.mjs +572 -0
  22. package/dist/components/data-display/chart/Cartesian.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  23. package/dist/components/data-display/chart/Heatmap.cjs +6 -0
  24. package/dist/components/data-display/chart/Heatmap.cjs.map +1 -0
  25. package/dist/components/data-display/chart/Heatmap.mjs +7 -0
  26. package/dist/components/data-display/chart/Heatmap.mjs.map +1 -0
  27. package/dist/components/data-display/chart/Heatmap.vue_vue_type_script_setup_true_lang.cjs +332 -0
  28. package/dist/components/data-display/chart/Heatmap.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  29. package/dist/components/data-display/chart/Heatmap.vue_vue_type_script_setup_true_lang.mjs +331 -0
  30. package/dist/components/data-display/chart/Heatmap.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  31. package/dist/components/data-display/chart/Polar.cjs +6 -0
  32. package/dist/components/data-display/chart/Polar.cjs.map +1 -0
  33. package/dist/components/data-display/chart/Polar.mjs +7 -0
  34. package/dist/components/data-display/chart/Polar.mjs.map +1 -0
  35. package/dist/components/data-display/chart/Polar.vue_vue_type_script_setup_true_lang.cjs +361 -0
  36. package/dist/components/data-display/chart/Polar.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  37. package/dist/components/data-display/chart/Polar.vue_vue_type_script_setup_true_lang.mjs +360 -0
  38. package/dist/components/data-display/chart/Polar.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  39. package/dist/components/data-display/chart/Radar.cjs +6 -0
  40. package/dist/components/data-display/chart/Radar.cjs.map +1 -0
  41. package/dist/components/data-display/chart/Radar.mjs +7 -0
  42. package/dist/components/data-display/chart/Radar.mjs.map +1 -0
  43. package/dist/components/data-display/chart/Radar.vue_vue_type_script_setup_true_lang.cjs +347 -0
  44. package/dist/components/data-display/chart/Radar.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  45. package/dist/components/data-display/chart/Radar.vue_vue_type_script_setup_true_lang.mjs +346 -0
  46. package/dist/components/data-display/chart/Radar.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  47. package/dist/components/data-display/chart/Sparkline.cjs +6 -0
  48. package/dist/components/data-display/chart/Sparkline.cjs.map +1 -0
  49. package/dist/components/data-display/chart/Sparkline.mjs +7 -0
  50. package/dist/components/data-display/chart/Sparkline.mjs.map +1 -0
  51. package/dist/components/data-display/chart/Sparkline.vue_vue_type_script_setup_true_lang.cjs +293 -0
  52. package/dist/components/data-display/chart/Sparkline.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  53. package/dist/components/data-display/chart/Sparkline.vue_vue_type_script_setup_true_lang.mjs +292 -0
  54. package/dist/components/data-display/chart/Sparkline.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  55. package/dist/components/data-display/chart/useChart.cjs +189 -0
  56. package/dist/components/data-display/chart/useChart.cjs.map +1 -0
  57. package/dist/components/data-display/chart/useChart.mjs +182 -0
  58. package/dist/components/data-display/chart/useChart.mjs.map +1 -0
  59. package/dist/components/data-display/date-picker/DateRangePicker.cjs.map +1 -1
  60. package/dist/components/data-display/date-picker/DateRangePicker.mjs.map +1 -1
  61. package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.cjs +1 -7
  62. package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  63. package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs +1 -7
  64. package/dist/components/data-display/date-picker/DateRangePicker.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  65. package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.cjs +1 -1
  66. package/dist/components/data-display/table/Table.vue_vue_type_script_setup_true_lang.mjs +1 -1
  67. package/dist/components/feedback/Tooltip.cjs.map +1 -1
  68. package/dist/components/feedback/Tooltip.mjs.map +1 -1
  69. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.cjs +20 -3
  70. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  71. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.mjs +20 -3
  72. package/dist/components/feedback/Tooltip.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  73. package/dist/components/forms/Button.cjs +1 -1
  74. package/dist/components/forms/Button.cjs.map +1 -1
  75. package/dist/components/forms/Button.mjs +1 -1
  76. package/dist/components/forms/Button.mjs.map +1 -1
  77. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs +76 -63
  78. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  79. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs +77 -64
  80. package/dist/components/forms/Button.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  81. package/dist/components/forms/ButtonGroup.cjs +1 -1
  82. package/dist/components/forms/ButtonGroup.cjs.map +1 -1
  83. package/dist/components/forms/ButtonGroup.mjs +1 -1
  84. package/dist/components/forms/ButtonGroup.mjs.map +1 -1
  85. package/dist/components/forms/ButtonGroup.vue_vue_type_script_setup_true_lang.cjs +2 -2
  86. package/dist/components/forms/ButtonGroup.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  87. package/dist/components/forms/ButtonGroup.vue_vue_type_script_setup_true_lang.mjs +2 -2
  88. package/dist/components/forms/ButtonGroup.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  89. package/dist/components/forms/Checkbox.cjs +1 -1
  90. package/dist/components/forms/Checkbox.cjs.map +1 -1
  91. package/dist/components/forms/Checkbox.mjs +1 -1
  92. package/dist/components/forms/Checkbox.mjs.map +1 -1
  93. package/dist/components/forms/Checkbox.vue_vue_type_script_setup_true_lang.cjs +7 -7
  94. package/dist/components/forms/Checkbox.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  95. package/dist/components/forms/Checkbox.vue_vue_type_script_setup_true_lang.mjs +7 -7
  96. package/dist/components/forms/Checkbox.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  97. package/dist/components/forms/ColorPicker.vue_vue_type_script_setup_true_lang.cjs +1 -1
  98. package/dist/components/forms/ColorPicker.vue_vue_type_script_setup_true_lang.mjs +1 -1
  99. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.cjs +2 -2
  100. package/dist/components/forms/Combobox.vue_vue_type_script_setup_true_lang.mjs +2 -2
  101. package/dist/components/forms/DateField.vue_vue_type_script_setup_true_lang.cjs +2 -2
  102. package/dist/components/forms/DateField.vue_vue_type_script_setup_true_lang.mjs +2 -2
  103. package/dist/components/forms/DateRangeField.vue_vue_type_script_setup_true_lang.cjs +2 -2
  104. package/dist/components/forms/DateRangeField.vue_vue_type_script_setup_true_lang.mjs +2 -2
  105. package/dist/components/forms/DateTimeField.vue_vue_type_script_setup_true_lang.cjs +2 -2
  106. package/dist/components/forms/DateTimeField.vue_vue_type_script_setup_true_lang.mjs +2 -2
  107. package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.cjs +1 -1
  108. package/dist/components/forms/FileInput.vue_vue_type_script_setup_true_lang.mjs +1 -1
  109. package/dist/components/forms/FormField.vue_vue_type_script_setup_true_lang.cjs +1 -1
  110. package/dist/components/forms/FormField.vue_vue_type_script_setup_true_lang.mjs +1 -1
  111. package/dist/components/forms/Input.vue_vue_type_script_setup_true_lang.cjs +1 -1
  112. package/dist/components/forms/Input.vue_vue_type_script_setup_true_lang.mjs +1 -1
  113. package/dist/components/forms/MenuButton.cjs +6 -0
  114. package/dist/components/forms/MenuButton.cjs.map +1 -0
  115. package/dist/components/forms/MenuButton.mjs +7 -0
  116. package/dist/components/forms/MenuButton.mjs.map +1 -0
  117. package/dist/components/forms/MenuButton.vue_vue_type_script_setup_true_lang.cjs +270 -0
  118. package/dist/components/forms/MenuButton.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  119. package/dist/components/forms/MenuButton.vue_vue_type_script_setup_true_lang.mjs +269 -0
  120. package/dist/components/forms/MenuButton.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
  121. package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.cjs +2 -2
  122. package/dist/components/forms/MultiSelect.vue_vue_type_script_setup_true_lang.mjs +2 -2
  123. package/dist/components/forms/NumberInput.vue_vue_type_script_setup_true_lang.cjs +1 -1
  124. package/dist/components/forms/NumberInput.vue_vue_type_script_setup_true_lang.mjs +1 -1
  125. package/dist/components/forms/OTPInput.vue_vue_type_script_setup_true_lang.cjs +1 -1
  126. package/dist/components/forms/OTPInput.vue_vue_type_script_setup_true_lang.mjs +1 -1
  127. package/dist/components/forms/PasswordInput.vue_vue_type_script_setup_true_lang.cjs +1 -1
  128. package/dist/components/forms/PasswordInput.vue_vue_type_script_setup_true_lang.mjs +1 -1
  129. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.cjs +2 -2
  130. package/dist/components/forms/PhoneInput.vue_vue_type_script_setup_true_lang.mjs +2 -2
  131. package/dist/components/forms/Radio.cjs +1 -1
  132. package/dist/components/forms/Radio.cjs.map +1 -1
  133. package/dist/components/forms/Radio.mjs +1 -1
  134. package/dist/components/forms/Radio.mjs.map +1 -1
  135. package/dist/components/forms/Radio.vue_vue_type_script_setup_true_lang.cjs +6 -6
  136. package/dist/components/forms/Radio.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  137. package/dist/components/forms/Radio.vue_vue_type_script_setup_true_lang.mjs +6 -6
  138. package/dist/components/forms/Radio.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  139. package/dist/components/forms/RangeSlider.cjs.map +1 -1
  140. package/dist/components/forms/RangeSlider.mjs.map +1 -1
  141. package/dist/components/forms/RangeSlider.vue_vue_type_script_setup_true_lang.cjs +6 -6
  142. package/dist/components/forms/RangeSlider.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  143. package/dist/components/forms/RangeSlider.vue_vue_type_script_setup_true_lang.mjs +6 -6
  144. package/dist/components/forms/RangeSlider.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  145. package/dist/components/forms/SearchInput.cjs.map +1 -1
  146. package/dist/components/forms/SearchInput.mjs.map +1 -1
  147. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.cjs +225 -20
  148. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  149. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.mjs +227 -22
  150. package/dist/components/forms/SearchInput.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  151. package/dist/components/forms/Segmented.cjs +1 -1
  152. package/dist/components/forms/Segmented.cjs.map +1 -1
  153. package/dist/components/forms/Segmented.mjs +1 -1
  154. package/dist/components/forms/Segmented.mjs.map +1 -1
  155. package/dist/components/forms/Segmented.vue_vue_type_script_setup_true_lang.cjs +4 -12
  156. package/dist/components/forms/Segmented.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  157. package/dist/components/forms/Segmented.vue_vue_type_script_setup_true_lang.mjs +4 -12
  158. package/dist/components/forms/Segmented.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  159. package/dist/components/forms/Select.vue_vue_type_script_setup_true_lang.cjs +2 -2
  160. package/dist/components/forms/Select.vue_vue_type_script_setup_true_lang.mjs +2 -2
  161. package/dist/components/forms/Slider.cjs.map +1 -1
  162. package/dist/components/forms/Slider.mjs.map +1 -1
  163. package/dist/components/forms/Slider.vue_vue_type_script_setup_true_lang.cjs +6 -6
  164. package/dist/components/forms/Slider.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  165. package/dist/components/forms/Slider.vue_vue_type_script_setup_true_lang.mjs +6 -6
  166. package/dist/components/forms/Slider.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  167. package/dist/components/forms/Switch.cjs +1 -1
  168. package/dist/components/forms/Switch.cjs.map +1 -1
  169. package/dist/components/forms/Switch.mjs +1 -1
  170. package/dist/components/forms/Switch.mjs.map +1 -1
  171. package/dist/components/forms/Switch.vue_vue_type_script_setup_true_lang.cjs +7 -7
  172. package/dist/components/forms/Switch.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  173. package/dist/components/forms/Switch.vue_vue_type_script_setup_true_lang.mjs +7 -7
  174. package/dist/components/forms/Switch.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  175. package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.cjs +1 -1
  176. package/dist/components/forms/Textarea.vue_vue_type_script_setup_true_lang.mjs +1 -1
  177. package/dist/components/layout/AppShell.cjs.map +1 -1
  178. package/dist/components/layout/AppShell.mjs.map +1 -1
  179. package/dist/components/layout/AppShell.vue_vue_type_script_setup_true_lang.cjs +8 -8
  180. package/dist/components/layout/AppShell.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  181. package/dist/components/layout/AppShell.vue_vue_type_script_setup_true_lang.mjs +8 -8
  182. package/dist/components/layout/AppShell.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  183. package/dist/components/layout/Sidebar.cjs.map +1 -1
  184. package/dist/components/layout/Sidebar.mjs.map +1 -1
  185. package/dist/components/layout/Sidebar.vue_vue_type_script_setup_true_lang.cjs +36 -21
  186. package/dist/components/layout/Sidebar.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  187. package/dist/components/layout/Sidebar.vue_vue_type_script_setup_true_lang.mjs +36 -21
  188. package/dist/components/layout/Sidebar.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  189. package/dist/components/layout/Topbar.cjs.map +1 -1
  190. package/dist/components/layout/Topbar.mjs.map +1 -1
  191. package/dist/components/layout/Topbar.vue_vue_type_script_setup_true_lang.cjs +2 -2
  192. package/dist/components/layout/Topbar.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  193. package/dist/components/layout/Topbar.vue_vue_type_script_setup_true_lang.mjs +2 -2
  194. package/dist/components/layout/Topbar.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  195. package/dist/components/navigation/Switcher.cjs.map +1 -1
  196. package/dist/components/navigation/Switcher.mjs.map +1 -1
  197. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs +4 -4
  198. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  199. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs +4 -4
  200. package/dist/components/navigation/Switcher.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  201. package/dist/components/navigation/Tabs.cjs +1 -1
  202. package/dist/components/navigation/Tabs.cjs.map +1 -1
  203. package/dist/components/navigation/Tabs.mjs +1 -1
  204. package/dist/components/navigation/Tabs.mjs.map +1 -1
  205. package/dist/components/navigation/Tabs.vue_vue_type_script_setup_true_lang.cjs +1 -9
  206. package/dist/components/navigation/Tabs.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  207. package/dist/components/navigation/Tabs.vue_vue_type_script_setup_true_lang.mjs +1 -9
  208. package/dist/components/navigation/Tabs.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
  209. package/dist/composables/useField.cjs +21 -23
  210. package/dist/composables/useField.cjs.map +1 -1
  211. package/dist/composables/useField.mjs +21 -24
  212. package/dist/composables/useField.mjs.map +1 -1
  213. package/dist/composables/usePopover.cjs +5 -1
  214. package/dist/composables/usePopover.cjs.map +1 -1
  215. package/dist/composables/usePopover.mjs +5 -1
  216. package/dist/composables/usePopover.mjs.map +1 -1
  217. package/dist/index.cjs +5 -1
  218. package/dist/index.mjs +4 -2
  219. package/dist/mood-ui.css +107 -473
  220. package/dist/types/components/data-display/Chart.vue.d.ts +8 -0
  221. package/dist/types/components/data-display/Stat.vue.d.ts +12 -2
  222. package/dist/types/components/data-display/chart/Cartesian.vue.d.ts +17 -0
  223. package/dist/types/components/data-display/chart/Heatmap.vue.d.ts +10 -0
  224. package/dist/types/components/data-display/chart/Polar.vue.d.ts +9 -0
  225. package/dist/types/components/data-display/chart/Radar.vue.d.ts +10 -0
  226. package/dist/types/components/data-display/chart/Sparkline.vue.d.ts +13 -0
  227. package/dist/types/components/data-display/chart/useChart.d.ts +49 -0
  228. package/dist/types/components/feedback/Drawer.vue.d.ts +2 -2
  229. package/dist/types/components/feedback/Modal.vue.d.ts +2 -2
  230. package/dist/types/components/feedback/Tooltip.vue.d.ts +1 -1
  231. package/dist/types/components/forms/Button.vue.d.ts +3 -2
  232. package/dist/types/components/forms/Combobox.vue.d.ts +3 -3
  233. package/dist/types/components/forms/DateField.vue.d.ts +3 -3
  234. package/dist/types/components/forms/DateRangeField.vue.d.ts +3 -3
  235. package/dist/types/components/forms/DateTimeField.vue.d.ts +3 -3
  236. package/dist/types/components/forms/MenuButton.vue.d.ts +23 -0
  237. package/dist/types/components/forms/MultiSelect.vue.d.ts +3 -3
  238. package/dist/types/components/forms/SearchInput.vue.d.ts +33 -2
  239. package/dist/types/components/forms/Select.vue.d.ts +2 -2
  240. package/dist/types/components/layout/AppShell.vue.d.ts +1 -1
  241. package/dist/types/components/layout/PageHeader.vue.d.ts +1 -1
  242. package/dist/types/components/layout/Sidebar.vue.d.ts +4 -4
  243. package/dist/types/components/layout/Stack.vue.d.ts +1 -1
  244. package/dist/types/components/layout/Topbar.vue.d.ts +1 -1
  245. package/dist/types/components/navigation/Breadcrumbs.vue.d.ts +1 -1
  246. package/dist/types/components/navigation/Switcher.vue.d.ts +3 -3
  247. package/dist/types/composables/useField.d.ts +10 -0
  248. package/dist/types/composables/usePopover.d.ts +7 -0
  249. package/dist/types/index.d.ts +4 -0
  250. package/dist/types/interfaces/data-display/Chart.interface.d.ts +97 -0
  251. package/dist/types/interfaces/data-display/Stat.interface.d.ts +17 -6
  252. package/dist/types/interfaces/feedback/Tooltip.interface.d.ts +11 -0
  253. package/dist/types/interfaces/forms/MenuButton.interface.d.ts +38 -0
  254. package/dist/types/interfaces/forms/SearchInput.interface.d.ts +36 -0
  255. package/package.json +1 -1
@@ -3,18 +3,19 @@ import SidebarRow_default from "./SidebarRow.mjs";
3
3
  import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, renderSlot, resolveDynamicComponent, toDisplayString, unref, useSlots, withCtx } from "vue";
4
4
  import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/vue/24/outline";
5
5
  //#region src/components/layout/Sidebar.vue?vue&type=script&setup=true&lang.ts
6
- var _hoisted_1 = ["aria-labelledby"];
7
- var _hoisted_2 = ["id"];
8
- var _hoisted_3 = {
6
+ var _hoisted_1 = ["aria-label"];
7
+ var _hoisted_2 = ["aria-labelledby"];
8
+ var _hoisted_3 = ["id"];
9
+ var _hoisted_4 = {
9
10
  key: 1,
10
11
  "aria-hidden": "true",
11
12
  class: "mx-2 my-1 h-px bg-border"
12
13
  };
13
- var _hoisted_4 = {
14
+ var _hoisted_5 = {
14
15
  class: "flex flex-col gap-1",
15
16
  role: "list"
16
17
  };
17
- var _hoisted_5 = ["aria-label"];
18
+ var _hoisted_6 = ["aria-label"];
18
19
  var Sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
19
20
  __name: "Sidebar",
20
21
  props: {
@@ -74,6 +75,14 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
74
75
  }
75
76
  });
76
77
  const togglePositionClass = computed(() => props.toggleSide === "start" ? "-left-3" : "-right-3");
78
+ const toggleButtonClass = computed(() => [
79
+ "z-20 size-6 rounded-full",
80
+ "border border-border bg-card shadow-sm",
81
+ "flex items-center justify-center cursor-pointer",
82
+ "text-muted-foreground hover:text-foreground",
83
+ "transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
84
+ togglePositionClass.value
85
+ ]);
77
86
  function onSelect(item) {
78
87
  if (item.disabled) return;
79
88
  if (!item.href && !item.to && !item.children) emit("update:activeId", item.id);
@@ -88,8 +97,21 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
88
97
  default: withCtx(() => [
89
98
  _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
90
99
  key: 0,
91
- class: normalizeClass(["shrink-0", __props.dividers ? "border-b border-border" : ""])
92
- }, [renderSlot(_ctx.$slots, "header", { collapsed: __props.collapsed })], 2)) : createCommentVNode("", true),
100
+ class: normalizeClass(["relative shrink-0", __props.dividers ? "border-b border-border" : ""])
101
+ }, [renderSlot(_ctx.$slots, "header", { collapsed: __props.collapsed }), __props.showToggle ? (openBlock(), createElementBlock("button", {
102
+ key: 0,
103
+ type: "button",
104
+ "data-modo-sidebar-toggle": "",
105
+ "aria-label": __props.collapsed ? "Expand sidebar" : "Collapse sidebar",
106
+ class: normalizeClass(["absolute top-1/2 -translate-y-1/2", toggleButtonClass.value]),
107
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:collapsed", !__props.collapsed))
108
+ }, [!__props.collapsed ? (openBlock(), createBlock(unref(ChevronLeftIcon), {
109
+ key: 0,
110
+ class: "size-3.5"
111
+ })) : (openBlock(), createBlock(unref(ChevronRightIcon), {
112
+ key: 1,
113
+ class: "size-3.5"
114
+ }))], 10, _hoisted_1)) : createCommentVNode("", true)], 2)) : createCommentVNode("", true),
93
115
  createElementVNode("div", { class: normalizeClass(["flex-1 min-h-0 overflow-y-auto flex flex-col gap-4", paddingClass.value]) }, [renderSlot(_ctx.$slots, "default", {
94
116
  collapsed: __props.collapsed,
95
117
  activeId: __props.activeId ?? null
@@ -109,9 +131,9 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
109
131
  key: 0,
110
132
  id: `sidebar-section-${section.id}`,
111
133
  class: "px-3 pt-1 pb-1 text-caption uppercase tracking-wide text-muted-foreground select-none"
112
- }, toDisplayString(section.title), 9, _hoisted_2)) : section.title && __props.collapsed && sectionIdx > 0 ? (openBlock(), createElementBlock("p", _hoisted_3)) : createCommentVNode("", true)]),
134
+ }, toDisplayString(section.title), 9, _hoisted_3)) : section.title && __props.collapsed && sectionIdx > 0 ? (openBlock(), createElementBlock("p", _hoisted_4)) : createCommentVNode("", true)]),
113
135
  _: 2
114
- }, 1024), createElementVNode("ul", _hoisted_4, [(openBlock(true), createElementBlock(Fragment, null, renderList(section.items, (item) => {
136
+ }, 1024), createElementVNode("ul", _hoisted_5, [(openBlock(true), createElementBlock(Fragment, null, renderList(section.items, (item) => {
115
137
  return openBlock(), createBlock(SidebarRow_default, {
116
138
  key: item.id,
117
139
  item,
@@ -136,33 +158,26 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
136
158
  "bar-side",
137
159
  "expand-aria-label"
138
160
  ]);
139
- }), 128))])], 8, _hoisted_1);
161
+ }), 128))])], 8, _hoisted_2);
140
162
  }), 128))], 2),
141
163
  _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
142
164
  key: 1,
143
165
  class: normalizeClass(["shrink-0", __props.dividers ? "border-t border-border" : ""])
144
166
  }, [renderSlot(_ctx.$slots, "footer", { collapsed: __props.collapsed })], 2)) : createCommentVNode("", true),
145
- __props.showToggle ? (openBlock(), createElementBlock("button", {
167
+ __props.showToggle && !_ctx.$slots.header ? (openBlock(), createElementBlock("button", {
146
168
  key: 2,
147
169
  type: "button",
148
170
  "data-modo-sidebar-toggle": "",
149
171
  "aria-label": __props.collapsed ? "Expand sidebar" : "Collapse sidebar",
150
- class: normalizeClass([
151
- "absolute top-[16px] z-10 size-6 rounded-full",
152
- "border border-border bg-card shadow-sm",
153
- "flex items-center justify-center",
154
- "text-muted-foreground hover:text-foreground",
155
- "transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
156
- togglePositionClass.value
157
- ]),
158
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:collapsed", !__props.collapsed))
172
+ class: normalizeClass(["absolute top-[16px]", toggleButtonClass.value]),
173
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:collapsed", !__props.collapsed))
159
174
  }, [!__props.collapsed ? (openBlock(), createBlock(unref(ChevronLeftIcon), {
160
175
  key: 0,
161
176
  class: "size-3.5"
162
177
  })) : (openBlock(), createBlock(unref(ChevronRightIcon), {
163
178
  key: 1,
164
179
  class: "size-3.5"
165
- }))], 10, _hoisted_5)) : createCommentVNode("", true)
180
+ }))], 10, _hoisted_6)) : createCommentVNode("", true)
166
181
  ]),
167
182
  _: 3
168
183
  }, 8, ["aria-label"]);
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.vue_vue_type_script_setup_true_lang.mjs","names":["$slots","$emit"],"sources":["../../../src/components/layout/Sidebar.vue"],"sourcesContent":["<template> \n <component\n :is=\"as\"\n class=\"relative flex flex-col h-full min-h-0 bg-card text-foreground\"\n :aria-label=\"ariaLabel ?? 'Sidebar'\"\n role=\"navigation\"\n >\n <!-- HEADER --> \n <div \n v-if=\"$slots.header\" \n :class=\"[ \n 'shrink-0', \n dividers ? 'border-b border-border' : '', \n ]\" \n > \n <slot name=\"header\" :collapsed=\"collapsed\" /> \n </div> \n \n <!-- BODY --> \n <div \n :class=\"[ \n 'flex-1 min-h-0 overflow-y-auto flex flex-col gap-4', \n paddingClass, \n ]\" \n > \n <!-- Free-form body via default slot --> \n <slot :collapsed=\"collapsed\" :active-id=\"activeId ?? null\" /> \n \n <!-- Or auto-generated sections/items --> \n <div \n v-for=\"(section, sectionIdx) in resolvedSections\" \n :key=\"section.id\" \n class=\"flex flex-col gap-1\" \n :aria-labelledby=\"section.title ? `sidebar-section-${section.id}` : undefined\" \n role=\"group\" \n > \n <Transition \n enter-active-class=\"transition-opacity duration-base ease-standard motion-reduce:transition-none\" \n leave-active-class=\"transition-opacity duration-fast ease-standard motion-reduce:transition-none\" \n enter-from-class=\"opacity-0\" \n leave-to-class=\"opacity-0\" \n > \n <p \n v-if=\"section.title && !collapsed\" \n :id=\"`sidebar-section-${section.id}`\" \n class=\"px-3 pt-1 pb-1 text-caption uppercase tracking-wide text-muted-foreground select-none\" \n > \n {{ section.title }} \n </p> \n <p \n v-else-if=\"section.title && collapsed && sectionIdx > 0\" \n aria-hidden=\"true\" \n class=\"mx-2 my-1 h-px bg-border\" \n /> \n </Transition> \n \n <ul class=\"flex flex-col gap-1\" role=\"list\"> \n <SidebarRow \n v-for=\"item in section.items\" \n :key=\"item.id\" \n :item=\"item\" \n :depth=\"0\" \n :collapsed=\"collapsed\" \n :active-id=\"activeId ?? null\" \n :size=\"resolvedSize\" \n :radius=\"resolvedRadius\" \n :color=\"resolvedColor\" \n :active-variant=\"activeVariant\" \n :bar-side=\"barSide\" \n :expand-aria-label=\"expandAriaLabel ?? 'Toggle sub-items'\" \n @select=\"onSelect\" \n /> \n </ul> \n </div> \n </div> \n \n <!-- FOOTER --> \n <div \n v-if=\"$slots.footer\" \n :class=\"[ \n 'shrink-0', \n dividers ? 'border-t border-border' : '', \n ]\" \n > \n <slot name=\"footer\" :collapsed=\"collapsed\" /> \n </div>\n\n <!-- COLLAPSE TOGGLE -->\n <button\n v-if=\"showToggle\"\n type=\"button\"\n data-modo-sidebar-toggle\n :aria-label=\"collapsed ? 'Expand sidebar' : 'Collapse sidebar'\"\n :class=\"[\n 'absolute top-[16px] z-10 size-6 rounded-full',\n 'border border-border bg-card shadow-sm',\n 'flex items-center justify-center',\n 'text-muted-foreground hover:text-foreground',\n 'transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n togglePositionClass,\n ]\"\n @click=\"$emit('update:collapsed', !collapsed)\"\n >\n <ChevronLeftIcon v-if=\"!collapsed\" class=\"size-3.5\" />\n <ChevronRightIcon v-else class=\"size-3.5\" />\n </button>\n </component>\n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, useSlots } from 'vue'; \nimport type { Sidebar, SidebarItem, SidebarSection } from '../../interfaces/layout/Sidebar.interface'; \nimport { useResolvedColor, useResolvedRadius, useResolvedSize } from '../../composables/useModoConfig'; \nimport SidebarRow from './SidebarRow.vue';\nimport { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/vue/24/outline';\n \nconst props = withDefaults(defineProps<Sidebar>(), { \n as: 'nav', \n activeId: null, \n collapsed: false, \n activeVariant: 'tonal', \n barSide: 'start', \n padding: 'small',\n dividers: true,\n showToggle: false,\n toggleSide: 'end',\n}); \n \nconst emit = defineEmits<{\n 'update:activeId': [value: string | number | null];\n 'update:collapsed': [value: boolean];\n select: [item: SidebarItem];\n}>();\n \nuseSlots(); \n \nconst resolvedColor = useResolvedColor(() => props.color); \nconst resolvedRadius = useResolvedRadius(() => props.radius); \nconst resolvedSize = useResolvedSize(() => props.size); \n \n/** Normalize either `sections` or `items` into a section array. */ \nconst resolvedSections = computed<SidebarSection[]>(() => { \n if (props.sections?.length) return props.sections; \n if (props.items?.length) { \n return [{ id: '_default', items: props.items }]; \n } \n return []; \n}); \n \nconst paddingClass = computed(() => { \n switch (props.padding) { \n case 'none': return ''; \n case 'medium': return 'p-3'; \n case 'large': return 'p-4'; \n default: return 'p-2';\n }\n});\n\nconst togglePositionClass = computed(() =>\n props.toggleSide === 'start' ? '-left-3' : '-right-3',\n);\n\nfunction onSelect(item: SidebarItem) { \n if (item.disabled) return; \n // Items with their own navigation target keep behaving as links. \n // For pure \"button\" items we update the active id internally so the \n // host can rely on the v-model without writing extra plumbing. \n if (!item.href && !item.to && !item.children) { \n emit('update:activeId', item.id); \n } \n emit('select', item); \n} \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoHA,MAAM,QAAQ;EAYd,MAAM,OAAO;EAMb,UAAU;EAEV,MAAM,gBAAgB,uBAAuB,MAAM,MAAM;EACzD,MAAM,iBAAiB,wBAAwB,MAAM,OAAO;EAC5D,MAAM,eAAe,sBAAsB,MAAM,KAAK;;EAGtD,MAAM,mBAAmB,eAAiC;GACtD,IAAI,MAAM,UAAU,QAAQ,OAAO,MAAM;GACzC,IAAI,MAAM,OAAO,QACb,OAAO,CAAC;IAAE,IAAI;IAAY,OAAO,MAAM;IAAO,CAAC;GAEnD,OAAO,EAAE;IACX;EAEF,MAAM,eAAe,eAAe;GAChC,QAAQ,MAAM,SAAd;IACI,KAAK,QAAQ,OAAO;IACpB,KAAK,UAAU,OAAO;IACtB,KAAK,SAAS,OAAO;IACrB,SAAS,OAAO;;IAEtB;EAEF,MAAM,sBAAsB,eACxB,MAAM,eAAe,UAAU,YAAY,WAC9C;EAED,SAAS,SAAS,MAAmB;GACjC,IAAI,KAAK,UAAU;GAInB,IAAI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BAAA;QAZG,KAAK,KAAK;QACJ;QACN,OAAO;QACP,WAAW,QAAA;QACX,aAAW,QAAA,YAAQ;QACnB,MAAM,MAAA,aAAY;QAClB,QAAQ,MAAA,eAAc;QACtB,OAAO,MAAA,cAAa;QACpB,kBAAgB,QAAA;QAChB,YAAU,QAAA;QACV,qBAAmB,QAAA,mBAAe;QAC1B;;;;;;;;;;;;;;KAQfA,KAAAA,OAAO,UAAA,WAAA,EADjB,mBAQM,OAAA;;MAND,OAAK,eAAA,CAAA,YAAkD,QAAA,WAAQ,2BAAA,GAAA,CAAA;SAKhE,WAA6C,KAAA,QAAA,UAAA,EAAxB,WAAW,QAAA,WAAS,CAAA,CAAA,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;KAKnC,QAAA,cAAA,WAAA,EADV,mBAiBS,UAAA;;MAfL,MAAK;MACL,4BAAA;MACC,cAAY,QAAA,YAAS,mBAAA;MACrB,OAAK,eAAA;;;;;;OAA8W,oBAAA;;MAQnX,SAAK,OAAA,OAAA,OAAA,MAAA,WAAEC,KAAAA,MAAK,oBAAA,CAAsB,QAAA,UAAS;UAEpB,QAAA,aAAA,WAAA,EAAxB,YAAsD,MAAA,gBAAA,EAAA;;MAAnB,OAAM;yBACzC,YAA4C,MAAA,iBAAA,EAAA;;MAAnB,OAAM"}
1
+ {"version":3,"file":"Sidebar.vue_vue_type_script_setup_true_lang.mjs","names":["$slots","$emit"],"sources":["../../../src/components/layout/Sidebar.vue"],"sourcesContent":["<template> \n <component\n :is=\"as\"\n class=\"relative flex flex-col h-full min-h-0 bg-card text-foreground\"\n :aria-label=\"ariaLabel ?? 'Sidebar'\"\n role=\"navigation\"\n >\n <!-- HEADER -->\n <div\n v-if=\"$slots.header\"\n :class=\"[\n 'relative shrink-0',\n dividers ? 'border-b border-border' : '',\n ]\"\n >\n <slot name=\"header\" :collapsed=\"collapsed\" />\n\n <!-- Collapse toggle: vertically centered on the header so it lines\n up with a Switcher / brand placed in the header slot. -->\n <button\n v-if=\"showToggle\"\n type=\"button\"\n data-modo-sidebar-toggle\n :aria-label=\"collapsed ? 'Expand sidebar' : 'Collapse sidebar'\"\n :class=\"['absolute top-1/2 -translate-y-1/2', toggleButtonClass]\"\n @click=\"$emit('update:collapsed', !collapsed)\"\n >\n <ChevronLeftIcon v-if=\"!collapsed\" class=\"size-3.5\" />\n <ChevronRightIcon v-else class=\"size-3.5\" />\n </button>\n </div>\n \n <!-- BODY --> \n <div \n :class=\"[ \n 'flex-1 min-h-0 overflow-y-auto flex flex-col gap-4', \n paddingClass, \n ]\" \n > \n <!-- Free-form body via default slot --> \n <slot :collapsed=\"collapsed\" :active-id=\"activeId ?? null\" /> \n \n <!-- Or auto-generated sections/items --> \n <div \n v-for=\"(section, sectionIdx) in resolvedSections\" \n :key=\"section.id\" \n class=\"flex flex-col gap-1\" \n :aria-labelledby=\"section.title ? `sidebar-section-${section.id}` : undefined\" \n role=\"group\" \n > \n <Transition \n enter-active-class=\"transition-opacity duration-base ease-standard motion-reduce:transition-none\" \n leave-active-class=\"transition-opacity duration-fast ease-standard motion-reduce:transition-none\" \n enter-from-class=\"opacity-0\" \n leave-to-class=\"opacity-0\" \n > \n <p \n v-if=\"section.title && !collapsed\" \n :id=\"`sidebar-section-${section.id}`\" \n class=\"px-3 pt-1 pb-1 text-caption uppercase tracking-wide text-muted-foreground select-none\" \n > \n {{ section.title }} \n </p> \n <p \n v-else-if=\"section.title && collapsed && sectionIdx > 0\" \n aria-hidden=\"true\" \n class=\"mx-2 my-1 h-px bg-border\" \n /> \n </Transition> \n \n <ul class=\"flex flex-col gap-1\" role=\"list\"> \n <SidebarRow \n v-for=\"item in section.items\" \n :key=\"item.id\" \n :item=\"item\" \n :depth=\"0\" \n :collapsed=\"collapsed\" \n :active-id=\"activeId ?? null\" \n :size=\"resolvedSize\" \n :radius=\"resolvedRadius\" \n :color=\"resolvedColor\" \n :active-variant=\"activeVariant\" \n :bar-side=\"barSide\" \n :expand-aria-label=\"expandAriaLabel ?? 'Toggle sub-items'\" \n @select=\"onSelect\" \n /> \n </ul> \n </div> \n </div> \n \n <!-- FOOTER --> \n <div \n v-if=\"$slots.footer\" \n :class=\"[ \n 'shrink-0', \n dividers ? 'border-t border-border' : '', \n ]\" \n > \n <slot name=\"footer\" :collapsed=\"collapsed\" /> \n </div>\n\n <!-- COLLAPSE TOGGLE (no header: anchored near the top edge) -->\n <button\n v-if=\"showToggle && !$slots.header\"\n type=\"button\"\n data-modo-sidebar-toggle\n :aria-label=\"collapsed ? 'Expand sidebar' : 'Collapse sidebar'\"\n :class=\"['absolute top-[16px]', toggleButtonClass]\"\n @click=\"$emit('update:collapsed', !collapsed)\"\n >\n <ChevronLeftIcon v-if=\"!collapsed\" class=\"size-3.5\" />\n <ChevronRightIcon v-else class=\"size-3.5\" />\n </button>\n </component>\n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, useSlots } from 'vue'; \nimport type { Sidebar, SidebarItem, SidebarSection } from '../../interfaces/layout/Sidebar.interface'; \nimport { useResolvedColor, useResolvedRadius, useResolvedSize } from '../../composables/useModoConfig'; \nimport SidebarRow from './SidebarRow.vue';\nimport { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/vue/24/outline';\n \nconst props = withDefaults(defineProps<Sidebar>(), { \n as: 'nav', \n activeId: null, \n collapsed: false, \n activeVariant: 'tonal', \n barSide: 'start', \n padding: 'small',\n dividers: true,\n showToggle: false,\n toggleSide: 'end',\n}); \n \nconst emit = defineEmits<{\n 'update:activeId': [value: string | number | null];\n 'update:collapsed': [value: boolean];\n select: [item: SidebarItem];\n}>();\n \nuseSlots(); \n \nconst resolvedColor = useResolvedColor(() => props.color); \nconst resolvedRadius = useResolvedRadius(() => props.radius); \nconst resolvedSize = useResolvedSize(() => props.size); \n \n/** Normalize either `sections` or `items` into a section array. */ \nconst resolvedSections = computed<SidebarSection[]>(() => { \n if (props.sections?.length) return props.sections; \n if (props.items?.length) { \n return [{ id: '_default', items: props.items }]; \n } \n return []; \n}); \n \nconst paddingClass = computed(() => { \n switch (props.padding) { \n case 'none': return ''; \n case 'medium': return 'p-3'; \n case 'large': return 'p-4'; \n default: return 'p-2';\n }\n});\n\nconst togglePositionClass = computed(() =>\n props.toggleSide === 'start' ? '-left-3' : '-right-3',\n);\n\n// Shared look for the collapse toggle. Vertical anchoring differs by placement\n// (centered on the header slot, or near the top edge when there is no header),\n// so those classes are applied at the call site instead.\nconst toggleButtonClass = computed(() => [\n 'z-20 size-6 rounded-full',\n 'border border-border bg-card shadow-sm',\n 'flex items-center justify-center cursor-pointer',\n 'text-muted-foreground hover:text-foreground',\n 'transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n togglePositionClass.value,\n]);\n\nfunction onSelect(item: SidebarItem) { \n if (item.disabled) return; \n // Items with their own navigation target keep behaving as links. \n // For pure \"button\" items we update the active id internally so the \n // host can rely on the v-model without writing extra plumbing. \n if (!item.href && !item.to && !item.children) { \n emit('update:activeId', item.id); \n } \n emit('select', item); \n} \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2HA,MAAM,QAAQ;EAYd,MAAM,OAAO;EAMb,UAAU;EAEV,MAAM,gBAAgB,uBAAuB,MAAM,MAAM;EACzD,MAAM,iBAAiB,wBAAwB,MAAM,OAAO;EAC5D,MAAM,eAAe,sBAAsB,MAAM,KAAK;;EAGtD,MAAM,mBAAmB,eAAiC;GACtD,IAAI,MAAM,UAAU,QAAQ,OAAO,MAAM;GACzC,IAAI,MAAM,OAAO,QACb,OAAO,CAAC;IAAE,IAAI;IAAY,OAAO,MAAM;IAAO,CAAC;GAEnD,OAAO,EAAE;IACX;EAEF,MAAM,eAAe,eAAe;GAChC,QAAQ,MAAM,SAAd;IACI,KAAK,QAAQ,OAAO;IACpB,KAAK,UAAU,OAAO;IACtB,KAAK,SAAS,OAAO;IACrB,SAAS,OAAO;;IAEtB;EAEF,MAAM,sBAAsB,eACxB,MAAM,eAAe,UAAU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AsD,MAAA,gBAAA,EAAA;;MAAnB,OAAM;yBACzC,YAA4C,MAAA,iBAAA,EAAA;;MAAnB,OAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"Topbar.cjs","names":[],"sources":["../../../src/components/layout/Topbar.vue"],"sourcesContent":["<template> \n <component \n :is=\"as\" \n :class=\"[ \n 'w-full bg-background text-foreground', \n stickyClasses, \n divider ? 'border-b border-border' : '', \n ]\" \n > \n <div \n :class=\"[ \n 'relative flex items-center gap-3 w-full', \n heightClass, \n paddingClasses, \n ]\" \n > \n <!-- Menu toggle (hamburger) --> \n <Button \n v-if=\"menuToggle\" \n variant=\"ghost\" \n color=\"default\" \n :size=\"buttonSize\" \n :icon=\"menuIcon ?? HamburgerIcon\" \n :ariaLabel=\"menuAriaLabel ?? 'Toggle navigation menu'\" \n class=\"shrink-0 -ml-1\" \n @click=\"emit('menu-toggle')\" \n /> \n \n <!-- Logo / brand --> \n <div \n v-if=\"hasLogo || hasTitle\" \n class=\"flex items-center gap-2 shrink-0 min-w-0\" \n > \n <slot name=\"logo\" /> \n <div v-if=\"hasTitle\" class=\"flex flex-col min-w-0 leading-tight\"> \n <span \n v-if=\"title || $slots.title\" \n class=\"text-body font-semibold text-foreground truncate\" \n > \n <slot name=\"title\">{{ title }}</slot> \n </span> \n <span \n v-if=\"subtitle || $slots.subtitle\" \n class=\"text-caption text-muted-foreground truncate\" \n > \n <slot name=\"subtitle\">{{ subtitle }}</slot> \n </span> \n </div> \n </div> \n \n <!-- Inline navigation --> \n <nav \n v-if=\"$slots.nav\" \n class=\"hidden md:flex items-center gap-1 shrink-0\" \n aria-label=\"Primary\" \n > \n <slot name=\"nav\" /> \n </nav> \n \n<!-- Search (truly centered over the full topbar width) --> \n <div \n v-if=\"$slots.search\" \n class=\"absolute inset-0 flex items-center justify-center pointer-events-none\" \n :class=\"paddingClasses\"\n > \n <div class=\"w-full max-w-md pointer-events-auto\"> \n <slot name=\"search\" /> \n </div> \n </div> \n\n <!-- Spacer: always present to push actions/user to the right --> \n <div class=\"flex-1 min-w-0\" aria-hidden=\"true\" />\n \n <!-- Actions (notifications, etc.) --> \n <div \n v-if=\"$slots.actions\" \n class=\"flex items-center gap-1 shrink-0\" \n > \n <slot name=\"actions\" /> \n </div> \n \n <!-- User menu / avatar --> \n <div \n v-if=\"$slots.user\" \n class=\"flex items-center shrink-0\" \n > \n <slot name=\"user\" /> \n </div> \n </div> \n </component> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, defineComponent, h, useSlots } from 'vue'; \nimport type { Topbar } from '../../interfaces/layout/Topbar.interface'; \nimport Button from '../forms/Button.vue'; \nimport { useResolvedSize } from '../../composables/useModoConfig'; \n \nconst props = withDefaults(defineProps<Topbar>(), { \n divider: true, \n sticky: false, \n padding: 'medium', \n as: 'header', \n menuToggle: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst emit = defineEmits<{ 'menu-toggle': [] }>(); \nconst slots = useSlots(); \n \n// Default hamburger icon. Inline SVG avoids any external icon dependency; \n// `aria-hidden` because Button supplies the accessible name via `ariaLabel`. \nconst HamburgerIcon = defineComponent({ \n name: 'TopbarMenuIcon', \n setup() { \n return () => \n h( \n 'svg', \n { \n xmlns: 'http://www.w3.org/2000/svg', \n viewBox: '0 0 24 24', \n fill: 'none', \n stroke: 'currentColor', \n 'stroke-width': 2, \n 'stroke-linecap': 'round', \n 'stroke-linejoin': 'round', \n 'aria-hidden': 'true', \n class: 'h-5 w-5', \n }, \n [ \n h('line', { x1: 3, y1: 6, x2: 21, y2: 6 }), \n h('line', { x1: 3, y1: 12, x2: 21, y2: 12 }), \n h('line', { x1: 3, y1: 18, x2: 21, y2: 18 }), \n ], \n ); \n }, \n}); \n \nconst hasLogo = computed(() => !!slots.logo); \nconst hasTitle = computed( \n () => !!props.title || !!slots.title || !!props.subtitle || !!slots.subtitle, \n); \n \nconst heightClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': \n return 'h-12'; \n case 'large': \n return 'h-16'; \n default: \n return 'h-14'; \n } \n}); \n \nconst paddingClasses = computed(() => { \n switch (props.padding) { \n case 'none': \n return 'px-0'; \n case 'small': \n return 'px-3'; \n case 'large': \n return 'px-6'; \n default: \n return 'px-4'; \n } \n}); \n \n// Match the bar size for the menu toggle so it lines up vertically. \nconst buttonSize = computed<'small' | 'medium'>(() =>\n resolvedSize.value === 'large' ? 'medium' : 'small',\n);\n \nconst stickyClasses = computed(() => \n props.sticky \n ? 'sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-background/85' \n : '', \n); \n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"Topbar.cjs","names":[],"sources":["../../../src/components/layout/Topbar.vue"],"sourcesContent":["<template> \n <component \n :is=\"as\" \n :class=\"[ \n 'w-full bg-card text-foreground',\n stickyClasses, \n divider ? 'border-b border-border' : '', \n ]\" \n > \n <div \n :class=\"[ \n 'relative flex items-center gap-3 w-full', \n heightClass, \n paddingClasses, \n ]\" \n > \n <!-- Menu toggle (hamburger) --> \n <Button \n v-if=\"menuToggle\" \n variant=\"ghost\" \n color=\"default\" \n :size=\"buttonSize\" \n :icon=\"menuIcon ?? HamburgerIcon\" \n :ariaLabel=\"menuAriaLabel ?? 'Toggle navigation menu'\" \n class=\"shrink-0 -ml-1\" \n @click=\"emit('menu-toggle')\" \n /> \n \n <!-- Logo / brand --> \n <div \n v-if=\"hasLogo || hasTitle\" \n class=\"flex items-center gap-2 shrink-0 min-w-0\" \n > \n <slot name=\"logo\" /> \n <div v-if=\"hasTitle\" class=\"flex flex-col min-w-0 leading-tight\"> \n <span \n v-if=\"title || $slots.title\" \n class=\"text-body font-semibold text-foreground truncate\" \n > \n <slot name=\"title\">{{ title }}</slot> \n </span> \n <span \n v-if=\"subtitle || $slots.subtitle\" \n class=\"text-caption text-muted-foreground truncate\" \n > \n <slot name=\"subtitle\">{{ subtitle }}</slot> \n </span> \n </div> \n </div> \n \n <!-- Inline navigation --> \n <nav \n v-if=\"$slots.nav\" \n class=\"hidden md:flex items-center gap-1 shrink-0\" \n aria-label=\"Primary\" \n > \n <slot name=\"nav\" /> \n </nav> \n \n<!-- Search (truly centered over the full topbar width) --> \n <div \n v-if=\"$slots.search\" \n class=\"absolute inset-0 flex items-center justify-center pointer-events-none\" \n :class=\"paddingClasses\"\n > \n <div class=\"w-full max-w-md pointer-events-auto\"> \n <slot name=\"search\" /> \n </div> \n </div> \n\n <!-- Spacer: always present to push actions/user to the right --> \n <div class=\"flex-1 min-w-0\" aria-hidden=\"true\" />\n \n <!-- Actions (notifications, etc.) --> \n <div \n v-if=\"$slots.actions\" \n class=\"flex items-center gap-1 shrink-0\" \n > \n <slot name=\"actions\" /> \n </div> \n \n <!-- User menu / avatar --> \n <div \n v-if=\"$slots.user\" \n class=\"flex items-center shrink-0\" \n > \n <slot name=\"user\" /> \n </div> \n </div> \n </component> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, defineComponent, h, useSlots } from 'vue'; \nimport type { Topbar } from '../../interfaces/layout/Topbar.interface'; \nimport Button from '../forms/Button.vue'; \nimport { useResolvedSize } from '../../composables/useModoConfig'; \n \nconst props = withDefaults(defineProps<Topbar>(), { \n divider: true, \n sticky: false, \n padding: 'medium', \n as: 'header', \n menuToggle: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst emit = defineEmits<{ 'menu-toggle': [] }>(); \nconst slots = useSlots(); \n \n// Default hamburger icon. Inline SVG avoids any external icon dependency; \n// `aria-hidden` because Button supplies the accessible name via `ariaLabel`. \nconst HamburgerIcon = defineComponent({ \n name: 'TopbarMenuIcon', \n setup() { \n return () => \n h( \n 'svg', \n { \n xmlns: 'http://www.w3.org/2000/svg', \n viewBox: '0 0 24 24', \n fill: 'none', \n stroke: 'currentColor', \n 'stroke-width': 2, \n 'stroke-linecap': 'round', \n 'stroke-linejoin': 'round', \n 'aria-hidden': 'true', \n class: 'h-5 w-5', \n }, \n [ \n h('line', { x1: 3, y1: 6, x2: 21, y2: 6 }), \n h('line', { x1: 3, y1: 12, x2: 21, y2: 12 }), \n h('line', { x1: 3, y1: 18, x2: 21, y2: 18 }), \n ], \n ); \n }, \n}); \n \nconst hasLogo = computed(() => !!slots.logo); \nconst hasTitle = computed( \n () => !!props.title || !!slots.title || !!props.subtitle || !!slots.subtitle, \n); \n \nconst heightClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': \n return 'h-12'; \n case 'large': \n return 'h-16'; \n default: \n return 'h-14'; \n } \n}); \n \nconst paddingClasses = computed(() => { \n switch (props.padding) { \n case 'none': \n return 'px-0'; \n case 'small': \n return 'px-3'; \n case 'large': \n return 'px-6'; \n default: \n return 'px-4'; \n } \n}); \n \n// Match the bar size for the menu toggle so it lines up vertically. \nconst buttonSize = computed<'small' | 'medium'>(() =>\n resolvedSize.value === 'large' ? 'medium' : 'small',\n);\n \nconst stickyClasses = computed(() => \n props.sticky \n ? 'sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-card/85'\n : '', \n); \n</script>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Topbar.mjs","names":[],"sources":["../../../src/components/layout/Topbar.vue"],"sourcesContent":["<template> \n <component \n :is=\"as\" \n :class=\"[ \n 'w-full bg-background text-foreground', \n stickyClasses, \n divider ? 'border-b border-border' : '', \n ]\" \n > \n <div \n :class=\"[ \n 'relative flex items-center gap-3 w-full', \n heightClass, \n paddingClasses, \n ]\" \n > \n <!-- Menu toggle (hamburger) --> \n <Button \n v-if=\"menuToggle\" \n variant=\"ghost\" \n color=\"default\" \n :size=\"buttonSize\" \n :icon=\"menuIcon ?? HamburgerIcon\" \n :ariaLabel=\"menuAriaLabel ?? 'Toggle navigation menu'\" \n class=\"shrink-0 -ml-1\" \n @click=\"emit('menu-toggle')\" \n /> \n \n <!-- Logo / brand --> \n <div \n v-if=\"hasLogo || hasTitle\" \n class=\"flex items-center gap-2 shrink-0 min-w-0\" \n > \n <slot name=\"logo\" /> \n <div v-if=\"hasTitle\" class=\"flex flex-col min-w-0 leading-tight\"> \n <span \n v-if=\"title || $slots.title\" \n class=\"text-body font-semibold text-foreground truncate\" \n > \n <slot name=\"title\">{{ title }}</slot> \n </span> \n <span \n v-if=\"subtitle || $slots.subtitle\" \n class=\"text-caption text-muted-foreground truncate\" \n > \n <slot name=\"subtitle\">{{ subtitle }}</slot> \n </span> \n </div> \n </div> \n \n <!-- Inline navigation --> \n <nav \n v-if=\"$slots.nav\" \n class=\"hidden md:flex items-center gap-1 shrink-0\" \n aria-label=\"Primary\" \n > \n <slot name=\"nav\" /> \n </nav> \n \n<!-- Search (truly centered over the full topbar width) --> \n <div \n v-if=\"$slots.search\" \n class=\"absolute inset-0 flex items-center justify-center pointer-events-none\" \n :class=\"paddingClasses\"\n > \n <div class=\"w-full max-w-md pointer-events-auto\"> \n <slot name=\"search\" /> \n </div> \n </div> \n\n <!-- Spacer: always present to push actions/user to the right --> \n <div class=\"flex-1 min-w-0\" aria-hidden=\"true\" />\n \n <!-- Actions (notifications, etc.) --> \n <div \n v-if=\"$slots.actions\" \n class=\"flex items-center gap-1 shrink-0\" \n > \n <slot name=\"actions\" /> \n </div> \n \n <!-- User menu / avatar --> \n <div \n v-if=\"$slots.user\" \n class=\"flex items-center shrink-0\" \n > \n <slot name=\"user\" /> \n </div> \n </div> \n </component> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, defineComponent, h, useSlots } from 'vue'; \nimport type { Topbar } from '../../interfaces/layout/Topbar.interface'; \nimport Button from '../forms/Button.vue'; \nimport { useResolvedSize } from '../../composables/useModoConfig'; \n \nconst props = withDefaults(defineProps<Topbar>(), { \n divider: true, \n sticky: false, \n padding: 'medium', \n as: 'header', \n menuToggle: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst emit = defineEmits<{ 'menu-toggle': [] }>(); \nconst slots = useSlots(); \n \n// Default hamburger icon. Inline SVG avoids any external icon dependency; \n// `aria-hidden` because Button supplies the accessible name via `ariaLabel`. \nconst HamburgerIcon = defineComponent({ \n name: 'TopbarMenuIcon', \n setup() { \n return () => \n h( \n 'svg', \n { \n xmlns: 'http://www.w3.org/2000/svg', \n viewBox: '0 0 24 24', \n fill: 'none', \n stroke: 'currentColor', \n 'stroke-width': 2, \n 'stroke-linecap': 'round', \n 'stroke-linejoin': 'round', \n 'aria-hidden': 'true', \n class: 'h-5 w-5', \n }, \n [ \n h('line', { x1: 3, y1: 6, x2: 21, y2: 6 }), \n h('line', { x1: 3, y1: 12, x2: 21, y2: 12 }), \n h('line', { x1: 3, y1: 18, x2: 21, y2: 18 }), \n ], \n ); \n }, \n}); \n \nconst hasLogo = computed(() => !!slots.logo); \nconst hasTitle = computed( \n () => !!props.title || !!slots.title || !!props.subtitle || !!slots.subtitle, \n); \n \nconst heightClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': \n return 'h-12'; \n case 'large': \n return 'h-16'; \n default: \n return 'h-14'; \n } \n}); \n \nconst paddingClasses = computed(() => { \n switch (props.padding) { \n case 'none': \n return 'px-0'; \n case 'small': \n return 'px-3'; \n case 'large': \n return 'px-6'; \n default: \n return 'px-4'; \n } \n}); \n \n// Match the bar size for the menu toggle so it lines up vertically. \nconst buttonSize = computed<'small' | 'medium'>(() =>\n resolvedSize.value === 'large' ? 'medium' : 'small',\n);\n \nconst stickyClasses = computed(() => \n props.sticky \n ? 'sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-background/85' \n : '', \n); \n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"Topbar.mjs","names":[],"sources":["../../../src/components/layout/Topbar.vue"],"sourcesContent":["<template> \n <component \n :is=\"as\" \n :class=\"[ \n 'w-full bg-card text-foreground',\n stickyClasses, \n divider ? 'border-b border-border' : '', \n ]\" \n > \n <div \n :class=\"[ \n 'relative flex items-center gap-3 w-full', \n heightClass, \n paddingClasses, \n ]\" \n > \n <!-- Menu toggle (hamburger) --> \n <Button \n v-if=\"menuToggle\" \n variant=\"ghost\" \n color=\"default\" \n :size=\"buttonSize\" \n :icon=\"menuIcon ?? HamburgerIcon\" \n :ariaLabel=\"menuAriaLabel ?? 'Toggle navigation menu'\" \n class=\"shrink-0 -ml-1\" \n @click=\"emit('menu-toggle')\" \n /> \n \n <!-- Logo / brand --> \n <div \n v-if=\"hasLogo || hasTitle\" \n class=\"flex items-center gap-2 shrink-0 min-w-0\" \n > \n <slot name=\"logo\" /> \n <div v-if=\"hasTitle\" class=\"flex flex-col min-w-0 leading-tight\"> \n <span \n v-if=\"title || $slots.title\" \n class=\"text-body font-semibold text-foreground truncate\" \n > \n <slot name=\"title\">{{ title }}</slot> \n </span> \n <span \n v-if=\"subtitle || $slots.subtitle\" \n class=\"text-caption text-muted-foreground truncate\" \n > \n <slot name=\"subtitle\">{{ subtitle }}</slot> \n </span> \n </div> \n </div> \n \n <!-- Inline navigation --> \n <nav \n v-if=\"$slots.nav\" \n class=\"hidden md:flex items-center gap-1 shrink-0\" \n aria-label=\"Primary\" \n > \n <slot name=\"nav\" /> \n </nav> \n \n<!-- Search (truly centered over the full topbar width) --> \n <div \n v-if=\"$slots.search\" \n class=\"absolute inset-0 flex items-center justify-center pointer-events-none\" \n :class=\"paddingClasses\"\n > \n <div class=\"w-full max-w-md pointer-events-auto\"> \n <slot name=\"search\" /> \n </div> \n </div> \n\n <!-- Spacer: always present to push actions/user to the right --> \n <div class=\"flex-1 min-w-0\" aria-hidden=\"true\" />\n \n <!-- Actions (notifications, etc.) --> \n <div \n v-if=\"$slots.actions\" \n class=\"flex items-center gap-1 shrink-0\" \n > \n <slot name=\"actions\" /> \n </div> \n \n <!-- User menu / avatar --> \n <div \n v-if=\"$slots.user\" \n class=\"flex items-center shrink-0\" \n > \n <slot name=\"user\" /> \n </div> \n </div> \n </component> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, defineComponent, h, useSlots } from 'vue'; \nimport type { Topbar } from '../../interfaces/layout/Topbar.interface'; \nimport Button from '../forms/Button.vue'; \nimport { useResolvedSize } from '../../composables/useModoConfig'; \n \nconst props = withDefaults(defineProps<Topbar>(), { \n divider: true, \n sticky: false, \n padding: 'medium', \n as: 'header', \n menuToggle: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst emit = defineEmits<{ 'menu-toggle': [] }>(); \nconst slots = useSlots(); \n \n// Default hamburger icon. Inline SVG avoids any external icon dependency; \n// `aria-hidden` because Button supplies the accessible name via `ariaLabel`. \nconst HamburgerIcon = defineComponent({ \n name: 'TopbarMenuIcon', \n setup() { \n return () => \n h( \n 'svg', \n { \n xmlns: 'http://www.w3.org/2000/svg', \n viewBox: '0 0 24 24', \n fill: 'none', \n stroke: 'currentColor', \n 'stroke-width': 2, \n 'stroke-linecap': 'round', \n 'stroke-linejoin': 'round', \n 'aria-hidden': 'true', \n class: 'h-5 w-5', \n }, \n [ \n h('line', { x1: 3, y1: 6, x2: 21, y2: 6 }), \n h('line', { x1: 3, y1: 12, x2: 21, y2: 12 }), \n h('line', { x1: 3, y1: 18, x2: 21, y2: 18 }), \n ], \n ); \n }, \n}); \n \nconst hasLogo = computed(() => !!slots.logo); \nconst hasTitle = computed( \n () => !!props.title || !!slots.title || !!props.subtitle || !!slots.subtitle, \n); \n \nconst heightClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': \n return 'h-12'; \n case 'large': \n return 'h-16'; \n default: \n return 'h-14'; \n } \n}); \n \nconst paddingClasses = computed(() => { \n switch (props.padding) { \n case 'none': \n return 'px-0'; \n case 'small': \n return 'px-3'; \n case 'large': \n return 'px-6'; \n default: \n return 'px-4'; \n } \n}); \n \n// Match the bar size for the menu toggle so it lines up vertically. \nconst buttonSize = computed<'small' | 'medium'>(() =>\n resolvedSize.value === 'large' ? 'medium' : 'small',\n);\n \nconst stickyClasses = computed(() => \n props.sticky \n ? 'sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-card/85'\n : '', \n); \n</script>\n"],"mappings":""}
@@ -115,10 +115,10 @@ var Topbar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue
115
115
  }
116
116
  });
117
117
  const buttonSize = (0, vue.computed)(() => resolvedSize.value === "large" ? "medium" : "small");
118
- const stickyClasses = (0, vue.computed)(() => props.sticky ? "sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-background/85" : "");
118
+ const stickyClasses = (0, vue.computed)(() => props.sticky ? "sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-card/85" : "");
119
119
  return (_ctx, _cache) => {
120
120
  return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(__props.as), { class: (0, vue.normalizeClass)([
121
- "w-full bg-background text-foreground",
121
+ "w-full bg-card text-foreground",
122
122
  stickyClasses.value,
123
123
  __props.divider ? "border-b border-border" : ""
124
124
  ]) }, {
@@ -1 +1 @@
1
- {"version":3,"file":"Topbar.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../../src/components/layout/Topbar.vue"],"sourcesContent":["<template> \n <component \n :is=\"as\" \n :class=\"[ \n 'w-full bg-background text-foreground', \n stickyClasses, \n divider ? 'border-b border-border' : '', \n ]\" \n > \n <div \n :class=\"[ \n 'relative flex items-center gap-3 w-full', \n heightClass, \n paddingClasses, \n ]\" \n > \n <!-- Menu toggle (hamburger) --> \n <Button \n v-if=\"menuToggle\" \n variant=\"ghost\" \n color=\"default\" \n :size=\"buttonSize\" \n :icon=\"menuIcon ?? HamburgerIcon\" \n :ariaLabel=\"menuAriaLabel ?? 'Toggle navigation menu'\" \n class=\"shrink-0 -ml-1\" \n @click=\"emit('menu-toggle')\" \n /> \n \n <!-- Logo / brand --> \n <div \n v-if=\"hasLogo || hasTitle\" \n class=\"flex items-center gap-2 shrink-0 min-w-0\" \n > \n <slot name=\"logo\" /> \n <div v-if=\"hasTitle\" class=\"flex flex-col min-w-0 leading-tight\"> \n <span \n v-if=\"title || $slots.title\" \n class=\"text-body font-semibold text-foreground truncate\" \n > \n <slot name=\"title\">{{ title }}</slot> \n </span> \n <span \n v-if=\"subtitle || $slots.subtitle\" \n class=\"text-caption text-muted-foreground truncate\" \n > \n <slot name=\"subtitle\">{{ subtitle }}</slot> \n </span> \n </div> \n </div> \n \n <!-- Inline navigation --> \n <nav \n v-if=\"$slots.nav\" \n class=\"hidden md:flex items-center gap-1 shrink-0\" \n aria-label=\"Primary\" \n > \n <slot name=\"nav\" /> \n </nav> \n \n<!-- Search (truly centered over the full topbar width) --> \n <div \n v-if=\"$slots.search\" \n class=\"absolute inset-0 flex items-center justify-center pointer-events-none\" \n :class=\"paddingClasses\"\n > \n <div class=\"w-full max-w-md pointer-events-auto\"> \n <slot name=\"search\" /> \n </div> \n </div> \n\n <!-- Spacer: always present to push actions/user to the right --> \n <div class=\"flex-1 min-w-0\" aria-hidden=\"true\" />\n \n <!-- Actions (notifications, etc.) --> \n <div \n v-if=\"$slots.actions\" \n class=\"flex items-center gap-1 shrink-0\" \n > \n <slot name=\"actions\" /> \n </div> \n \n <!-- User menu / avatar --> \n <div \n v-if=\"$slots.user\" \n class=\"flex items-center shrink-0\" \n > \n <slot name=\"user\" /> \n </div> \n </div> \n </component> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, defineComponent, h, useSlots } from 'vue'; \nimport type { Topbar } from '../../interfaces/layout/Topbar.interface'; \nimport Button from '../forms/Button.vue'; \nimport { useResolvedSize } from '../../composables/useModoConfig'; \n \nconst props = withDefaults(defineProps<Topbar>(), { \n divider: true, \n sticky: false, \n padding: 'medium', \n as: 'header', \n menuToggle: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst emit = defineEmits<{ 'menu-toggle': [] }>(); \nconst slots = useSlots(); \n \n// Default hamburger icon. Inline SVG avoids any external icon dependency; \n// `aria-hidden` because Button supplies the accessible name via `ariaLabel`. \nconst HamburgerIcon = defineComponent({ \n name: 'TopbarMenuIcon', \n setup() { \n return () => \n h( \n 'svg', \n { \n xmlns: 'http://www.w3.org/2000/svg', \n viewBox: '0 0 24 24', \n fill: 'none', \n stroke: 'currentColor', \n 'stroke-width': 2, \n 'stroke-linecap': 'round', \n 'stroke-linejoin': 'round', \n 'aria-hidden': 'true', \n class: 'h-5 w-5', \n }, \n [ \n h('line', { x1: 3, y1: 6, x2: 21, y2: 6 }), \n h('line', { x1: 3, y1: 12, x2: 21, y2: 12 }), \n h('line', { x1: 3, y1: 18, x2: 21, y2: 18 }), \n ], \n ); \n }, \n}); \n \nconst hasLogo = computed(() => !!slots.logo); \nconst hasTitle = computed( \n () => !!props.title || !!slots.title || !!props.subtitle || !!slots.subtitle, \n); \n \nconst heightClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': \n return 'h-12'; \n case 'large': \n return 'h-16'; \n default: \n return 'h-14'; \n } \n}); \n \nconst paddingClasses = computed(() => { \n switch (props.padding) { \n case 'none': \n return 'px-0'; \n case 'small': \n return 'px-3'; \n case 'large': \n return 'px-6'; \n default: \n return 'px-4'; \n } \n}); \n \n// Match the bar size for the menu toggle so it lines up vertically. \nconst buttonSize = computed<'small' | 'medium'>(() =>\n resolvedSize.value === 'large' ? 'medium' : 'small',\n);\n \nconst stickyClasses = computed(() => \n props.sticky \n ? 'sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-background/85' \n : '', \n); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkGA,MAAM,QAAQ;EAQd,MAAM,eAAe,sBAAA,sBAAsB,MAAM,KAAK;EAEtD,MAAM,OAAO;EACb,MAAM,SAAA,GAAA,IAAA,WAAkB;EAIxB,MAAM,iBAAA,GAAA,IAAA,iBAAgC;GAClC,MAAM;GACN,QAAQ;IACJ,cAAA,GAAA,IAAA,GAEQ,OACA;KACI,OAAO;KACP,SAAS;KACT,MAAM;KACN,QAAQ;KACR,gBAAgB;KAChB,kBAAkB;KAClB,mBAAmB;KACnB,eAAe;KACf,OAAO;KACV,EACD;gBACM,QAAQ;MAAE,IAAI;MAAG,IAAI;MAAG,IAAI;MAAI,IAAI;MAAG,CA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B,KAAA,QAAA,SAAA,CAAA,CAAA,CAAA,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA;2DAKmB,OAAA;MAA5C,OAAM;MAAiB,eAAY;;KAI9BA,KAAAA,OAAO,YAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAIX,OALN,YAKM,EAAA,GAAA,IAAA,YADqB,KAAA,QAAA,UAAA,CAAA,CAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA;KAKjBA,KAAAA,OAAO,SAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAIX,OALN,YAKM,EAAA,GAAA,IAAA,YADkB,KAAA,QAAA,OAAA,CAAA,CAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"Topbar.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../../src/components/layout/Topbar.vue"],"sourcesContent":["<template> \n <component \n :is=\"as\" \n :class=\"[ \n 'w-full bg-card text-foreground',\n stickyClasses, \n divider ? 'border-b border-border' : '', \n ]\" \n > \n <div \n :class=\"[ \n 'relative flex items-center gap-3 w-full', \n heightClass, \n paddingClasses, \n ]\" \n > \n <!-- Menu toggle (hamburger) --> \n <Button \n v-if=\"menuToggle\" \n variant=\"ghost\" \n color=\"default\" \n :size=\"buttonSize\" \n :icon=\"menuIcon ?? HamburgerIcon\" \n :ariaLabel=\"menuAriaLabel ?? 'Toggle navigation menu'\" \n class=\"shrink-0 -ml-1\" \n @click=\"emit('menu-toggle')\" \n /> \n \n <!-- Logo / brand --> \n <div \n v-if=\"hasLogo || hasTitle\" \n class=\"flex items-center gap-2 shrink-0 min-w-0\" \n > \n <slot name=\"logo\" /> \n <div v-if=\"hasTitle\" class=\"flex flex-col min-w-0 leading-tight\"> \n <span \n v-if=\"title || $slots.title\" \n class=\"text-body font-semibold text-foreground truncate\" \n > \n <slot name=\"title\">{{ title }}</slot> \n </span> \n <span \n v-if=\"subtitle || $slots.subtitle\" \n class=\"text-caption text-muted-foreground truncate\" \n > \n <slot name=\"subtitle\">{{ subtitle }}</slot> \n </span> \n </div> \n </div> \n \n <!-- Inline navigation --> \n <nav \n v-if=\"$slots.nav\" \n class=\"hidden md:flex items-center gap-1 shrink-0\" \n aria-label=\"Primary\" \n > \n <slot name=\"nav\" /> \n </nav> \n \n<!-- Search (truly centered over the full topbar width) --> \n <div \n v-if=\"$slots.search\" \n class=\"absolute inset-0 flex items-center justify-center pointer-events-none\" \n :class=\"paddingClasses\"\n > \n <div class=\"w-full max-w-md pointer-events-auto\"> \n <slot name=\"search\" /> \n </div> \n </div> \n\n <!-- Spacer: always present to push actions/user to the right --> \n <div class=\"flex-1 min-w-0\" aria-hidden=\"true\" />\n \n <!-- Actions (notifications, etc.) --> \n <div \n v-if=\"$slots.actions\" \n class=\"flex items-center gap-1 shrink-0\" \n > \n <slot name=\"actions\" /> \n </div> \n \n <!-- User menu / avatar --> \n <div \n v-if=\"$slots.user\" \n class=\"flex items-center shrink-0\" \n > \n <slot name=\"user\" /> \n </div> \n </div> \n </component> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, defineComponent, h, useSlots } from 'vue'; \nimport type { Topbar } from '../../interfaces/layout/Topbar.interface'; \nimport Button from '../forms/Button.vue'; \nimport { useResolvedSize } from '../../composables/useModoConfig'; \n \nconst props = withDefaults(defineProps<Topbar>(), { \n divider: true, \n sticky: false, \n padding: 'medium', \n as: 'header', \n menuToggle: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst emit = defineEmits<{ 'menu-toggle': [] }>(); \nconst slots = useSlots(); \n \n// Default hamburger icon. Inline SVG avoids any external icon dependency; \n// `aria-hidden` because Button supplies the accessible name via `ariaLabel`. \nconst HamburgerIcon = defineComponent({ \n name: 'TopbarMenuIcon', \n setup() { \n return () => \n h( \n 'svg', \n { \n xmlns: 'http://www.w3.org/2000/svg', \n viewBox: '0 0 24 24', \n fill: 'none', \n stroke: 'currentColor', \n 'stroke-width': 2, \n 'stroke-linecap': 'round', \n 'stroke-linejoin': 'round', \n 'aria-hidden': 'true', \n class: 'h-5 w-5', \n }, \n [ \n h('line', { x1: 3, y1: 6, x2: 21, y2: 6 }), \n h('line', { x1: 3, y1: 12, x2: 21, y2: 12 }), \n h('line', { x1: 3, y1: 18, x2: 21, y2: 18 }), \n ], \n ); \n }, \n}); \n \nconst hasLogo = computed(() => !!slots.logo); \nconst hasTitle = computed( \n () => !!props.title || !!slots.title || !!props.subtitle || !!slots.subtitle, \n); \n \nconst heightClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': \n return 'h-12'; \n case 'large': \n return 'h-16'; \n default: \n return 'h-14'; \n } \n}); \n \nconst paddingClasses = computed(() => { \n switch (props.padding) { \n case 'none': \n return 'px-0'; \n case 'small': \n return 'px-3'; \n case 'large': \n return 'px-6'; \n default: \n return 'px-4'; \n } \n}); \n \n// Match the bar size for the menu toggle so it lines up vertically. \nconst buttonSize = computed<'small' | 'medium'>(() =>\n resolvedSize.value === 'large' ? 'medium' : 'small',\n);\n \nconst stickyClasses = computed(() => \n props.sticky \n ? 'sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-card/85'\n : '', \n); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkGA,MAAM,QAAQ;EAQd,MAAM,eAAe,sBAAA,sBAAsB,MAAM,KAAK;EAEtD,MAAM,OAAO;EACb,MAAM,SAAA,GAAA,IAAA,WAAkB;EAIxB,MAAM,iBAAA,GAAA,IAAA,iBAAgC;GAClC,MAAM;GACN,QAAQ;IACJ,cAAA,GAAA,IAAA,GAEQ,OACA;KACI,OAAO;KACP,SAAS;KACT,MAAM;KACN,QAAQ;KACR,gBAAgB;KAChB,kBAAkB;KAClB,mBAAmB;KACnB,eAAe;KACf,OAAO;KACV,EACD;gBACM,QAAQ;MAAE,IAAI;MAAG,IAAI;MAAG,IAAI;MAAI,IA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A,IAAA,YADoB,KAAA,QAAA,SAAA,CAAA,CAAA,CAAA,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA;2DAKmB,OAAA;MAA5C,OAAM;MAAiB,eAAY;;KAI9BA,KAAAA,OAAO,YAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAIX,OALN,YAKM,EAAA,GAAA,IAAA,YADqB,KAAA,QAAA,UAAA,CAAA,CAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA;KAKjBA,KAAAA,OAAO,SAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAIX,OALN,YAKM,EAAA,GAAA,IAAA,YADkB,KAAA,QAAA,OAAA,CAAA,CAAA,KAAA,GAAA,IAAA,oBAAA,IAAA,KAAA"}
@@ -114,10 +114,10 @@ var Topbar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
114
114
  }
115
115
  });
116
116
  const buttonSize = computed(() => resolvedSize.value === "large" ? "medium" : "small");
117
- const stickyClasses = computed(() => props.sticky ? "sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-background/85" : "");
117
+ const stickyClasses = computed(() => props.sticky ? "sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-card/85" : "");
118
118
  return (_ctx, _cache) => {
119
119
  return openBlock(), createBlock(resolveDynamicComponent(__props.as), { class: normalizeClass([
120
- "w-full bg-background text-foreground",
120
+ "w-full bg-card text-foreground",
121
121
  stickyClasses.value,
122
122
  __props.divider ? "border-b border-border" : ""
123
123
  ]) }, {
@@ -1 +1 @@
1
- {"version":3,"file":"Topbar.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/layout/Topbar.vue"],"sourcesContent":["<template> \n <component \n :is=\"as\" \n :class=\"[ \n 'w-full bg-background text-foreground', \n stickyClasses, \n divider ? 'border-b border-border' : '', \n ]\" \n > \n <div \n :class=\"[ \n 'relative flex items-center gap-3 w-full', \n heightClass, \n paddingClasses, \n ]\" \n > \n <!-- Menu toggle (hamburger) --> \n <Button \n v-if=\"menuToggle\" \n variant=\"ghost\" \n color=\"default\" \n :size=\"buttonSize\" \n :icon=\"menuIcon ?? HamburgerIcon\" \n :ariaLabel=\"menuAriaLabel ?? 'Toggle navigation menu'\" \n class=\"shrink-0 -ml-1\" \n @click=\"emit('menu-toggle')\" \n /> \n \n <!-- Logo / brand --> \n <div \n v-if=\"hasLogo || hasTitle\" \n class=\"flex items-center gap-2 shrink-0 min-w-0\" \n > \n <slot name=\"logo\" /> \n <div v-if=\"hasTitle\" class=\"flex flex-col min-w-0 leading-tight\"> \n <span \n v-if=\"title || $slots.title\" \n class=\"text-body font-semibold text-foreground truncate\" \n > \n <slot name=\"title\">{{ title }}</slot> \n </span> \n <span \n v-if=\"subtitle || $slots.subtitle\" \n class=\"text-caption text-muted-foreground truncate\" \n > \n <slot name=\"subtitle\">{{ subtitle }}</slot> \n </span> \n </div> \n </div> \n \n <!-- Inline navigation --> \n <nav \n v-if=\"$slots.nav\" \n class=\"hidden md:flex items-center gap-1 shrink-0\" \n aria-label=\"Primary\" \n > \n <slot name=\"nav\" /> \n </nav> \n \n<!-- Search (truly centered over the full topbar width) --> \n <div \n v-if=\"$slots.search\" \n class=\"absolute inset-0 flex items-center justify-center pointer-events-none\" \n :class=\"paddingClasses\"\n > \n <div class=\"w-full max-w-md pointer-events-auto\"> \n <slot name=\"search\" /> \n </div> \n </div> \n\n <!-- Spacer: always present to push actions/user to the right --> \n <div class=\"flex-1 min-w-0\" aria-hidden=\"true\" />\n \n <!-- Actions (notifications, etc.) --> \n <div \n v-if=\"$slots.actions\" \n class=\"flex items-center gap-1 shrink-0\" \n > \n <slot name=\"actions\" /> \n </div> \n \n <!-- User menu / avatar --> \n <div \n v-if=\"$slots.user\" \n class=\"flex items-center shrink-0\" \n > \n <slot name=\"user\" /> \n </div> \n </div> \n </component> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, defineComponent, h, useSlots } from 'vue'; \nimport type { Topbar } from '../../interfaces/layout/Topbar.interface'; \nimport Button from '../forms/Button.vue'; \nimport { useResolvedSize } from '../../composables/useModoConfig'; \n \nconst props = withDefaults(defineProps<Topbar>(), { \n divider: true, \n sticky: false, \n padding: 'medium', \n as: 'header', \n menuToggle: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst emit = defineEmits<{ 'menu-toggle': [] }>(); \nconst slots = useSlots(); \n \n// Default hamburger icon. Inline SVG avoids any external icon dependency; \n// `aria-hidden` because Button supplies the accessible name via `ariaLabel`. \nconst HamburgerIcon = defineComponent({ \n name: 'TopbarMenuIcon', \n setup() { \n return () => \n h( \n 'svg', \n { \n xmlns: 'http://www.w3.org/2000/svg', \n viewBox: '0 0 24 24', \n fill: 'none', \n stroke: 'currentColor', \n 'stroke-width': 2, \n 'stroke-linecap': 'round', \n 'stroke-linejoin': 'round', \n 'aria-hidden': 'true', \n class: 'h-5 w-5', \n }, \n [ \n h('line', { x1: 3, y1: 6, x2: 21, y2: 6 }), \n h('line', { x1: 3, y1: 12, x2: 21, y2: 12 }), \n h('line', { x1: 3, y1: 18, x2: 21, y2: 18 }), \n ], \n ); \n }, \n}); \n \nconst hasLogo = computed(() => !!slots.logo); \nconst hasTitle = computed( \n () => !!props.title || !!slots.title || !!props.subtitle || !!slots.subtitle, \n); \n \nconst heightClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': \n return 'h-12'; \n case 'large': \n return 'h-16'; \n default: \n return 'h-14'; \n } \n}); \n \nconst paddingClasses = computed(() => { \n switch (props.padding) { \n case 'none': \n return 'px-0'; \n case 'small': \n return 'px-3'; \n case 'large': \n return 'px-6'; \n default: \n return 'px-4'; \n } \n}); \n \n// Match the bar size for the menu toggle so it lines up vertically. \nconst buttonSize = computed<'small' | 'medium'>(() =>\n resolvedSize.value === 'large' ? 'medium' : 'small',\n);\n \nconst stickyClasses = computed(() => \n props.sticky \n ? 'sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-background/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AFN,YAEM,CADF,WAAsB,KAAA,QAAA,SAAA,CAAA,CAAA,CAAA,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;+BAK9B,mBAAiD,OAAA;MAA5C,OAAM;MAAiB,eAAY;;KAI9BA,KAAAA,OAAO,WAAA,WAAA,EADjB,mBAKM,OALN,YAKM,CADF,WAAuB,KAAA,QAAA,UAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;KAKjBA,KAAAA,OAAO,QAAA,WAAA,EADjB,mBAKM,OALN,YAKM,CADF,WAAoB,KAAA,QAAA,OAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"Topbar.vue_vue_type_script_setup_true_lang.mjs","names":["$slots"],"sources":["../../../src/components/layout/Topbar.vue"],"sourcesContent":["<template> \n <component \n :is=\"as\" \n :class=\"[ \n 'w-full bg-card text-foreground',\n stickyClasses, \n divider ? 'border-b border-border' : '', \n ]\" \n > \n <div \n :class=\"[ \n 'relative flex items-center gap-3 w-full', \n heightClass, \n paddingClasses, \n ]\" \n > \n <!-- Menu toggle (hamburger) --> \n <Button \n v-if=\"menuToggle\" \n variant=\"ghost\" \n color=\"default\" \n :size=\"buttonSize\" \n :icon=\"menuIcon ?? HamburgerIcon\" \n :ariaLabel=\"menuAriaLabel ?? 'Toggle navigation menu'\" \n class=\"shrink-0 -ml-1\" \n @click=\"emit('menu-toggle')\" \n /> \n \n <!-- Logo / brand --> \n <div \n v-if=\"hasLogo || hasTitle\" \n class=\"flex items-center gap-2 shrink-0 min-w-0\" \n > \n <slot name=\"logo\" /> \n <div v-if=\"hasTitle\" class=\"flex flex-col min-w-0 leading-tight\"> \n <span \n v-if=\"title || $slots.title\" \n class=\"text-body font-semibold text-foreground truncate\" \n > \n <slot name=\"title\">{{ title }}</slot> \n </span> \n <span \n v-if=\"subtitle || $slots.subtitle\" \n class=\"text-caption text-muted-foreground truncate\" \n > \n <slot name=\"subtitle\">{{ subtitle }}</slot> \n </span> \n </div> \n </div> \n \n <!-- Inline navigation --> \n <nav \n v-if=\"$slots.nav\" \n class=\"hidden md:flex items-center gap-1 shrink-0\" \n aria-label=\"Primary\" \n > \n <slot name=\"nav\" /> \n </nav> \n \n<!-- Search (truly centered over the full topbar width) --> \n <div \n v-if=\"$slots.search\" \n class=\"absolute inset-0 flex items-center justify-center pointer-events-none\" \n :class=\"paddingClasses\"\n > \n <div class=\"w-full max-w-md pointer-events-auto\"> \n <slot name=\"search\" /> \n </div> \n </div> \n\n <!-- Spacer: always present to push actions/user to the right --> \n <div class=\"flex-1 min-w-0\" aria-hidden=\"true\" />\n \n <!-- Actions (notifications, etc.) --> \n <div \n v-if=\"$slots.actions\" \n class=\"flex items-center gap-1 shrink-0\" \n > \n <slot name=\"actions\" /> \n </div> \n \n <!-- User menu / avatar --> \n <div \n v-if=\"$slots.user\" \n class=\"flex items-center shrink-0\" \n > \n <slot name=\"user\" /> \n </div> \n </div> \n </component> \n</template> \n \n<script setup lang=\"ts\"> \nimport { computed, defineComponent, h, useSlots } from 'vue'; \nimport type { Topbar } from '../../interfaces/layout/Topbar.interface'; \nimport Button from '../forms/Button.vue'; \nimport { useResolvedSize } from '../../composables/useModoConfig'; \n \nconst props = withDefaults(defineProps<Topbar>(), { \n divider: true, \n sticky: false, \n padding: 'medium', \n as: 'header', \n menuToggle: false, \n}); \n \nconst resolvedSize = useResolvedSize(() => props.size); \n \nconst emit = defineEmits<{ 'menu-toggle': [] }>(); \nconst slots = useSlots(); \n \n// Default hamburger icon. Inline SVG avoids any external icon dependency; \n// `aria-hidden` because Button supplies the accessible name via `ariaLabel`. \nconst HamburgerIcon = defineComponent({ \n name: 'TopbarMenuIcon', \n setup() { \n return () => \n h( \n 'svg', \n { \n xmlns: 'http://www.w3.org/2000/svg', \n viewBox: '0 0 24 24', \n fill: 'none', \n stroke: 'currentColor', \n 'stroke-width': 2, \n 'stroke-linecap': 'round', \n 'stroke-linejoin': 'round', \n 'aria-hidden': 'true', \n class: 'h-5 w-5', \n }, \n [ \n h('line', { x1: 3, y1: 6, x2: 21, y2: 6 }), \n h('line', { x1: 3, y1: 12, x2: 21, y2: 12 }), \n h('line', { x1: 3, y1: 18, x2: 21, y2: 18 }), \n ], \n ); \n }, \n}); \n \nconst hasLogo = computed(() => !!slots.logo); \nconst hasTitle = computed( \n () => !!props.title || !!slots.title || !!props.subtitle || !!slots.subtitle, \n); \n \nconst heightClass = computed(() => { \n switch (resolvedSize.value) { \n case 'small': \n return 'h-12'; \n case 'large': \n return 'h-16'; \n default: \n return 'h-14'; \n } \n}); \n \nconst paddingClasses = computed(() => { \n switch (props.padding) { \n case 'none': \n return 'px-0'; \n case 'small': \n return 'px-3'; \n case 'large': \n return 'px-6'; \n default: \n return 'px-4'; \n } \n}); \n \n// Match the bar size for the menu toggle so it lines up vertically. \nconst buttonSize = computed<'small' | 'medium'>(() =>\n resolvedSize.value === 'large' ? 'medium' : 'small',\n);\n \nconst stickyClasses = computed(() => \n props.sticky \n ? 'sticky top-0 z-30 backdrop-blur supports-[backdrop-filter]:bg-card/85'\n : '', \n); \n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkGA,MAAM,QAAQ;EAQd,MAAM,eAAe,sBAAsB,MAAM,KAAK;EAEtD,MAAM,OAAO;EACb,MAAM,QAAQ,UAAU;EAIxB,MAAM,gBAAgB,gBAAgB;GAClC,MAAM;GACN,QAAQ;IACJ,aACI,EACI,OACA;KACI,OAAO;KACP,SAAS;KACT,MAAM;KACN,QAAQ;KACR,gBAAgB;KAChB,kBAAkB;KAClB,mBAAmB;KACnB,eAAe;KACf,OAAO;KACV,EACD;KACI,EAAE,QAAQ;MAAE,IAAI;MAAG,IAAI;MAAG,IAAI;MAAI,IAAI;MAAG,CAAC;KAC1C,EAAE,QAAQ;MAAE,IAAI;MAAG,IAAI;MAAI,IAAI;MAAI,IAAI;MAAI,CAAC;KAC5C,EAAE,QAAQ;MAAE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qC,KAAA,QAAA,SAAA,EAAA,QAAA,CAAA,gBAAA,gBAAf,QAAA,MAAK,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA,EAGrB,QAAA,YAAYA,KAAAA,OAAO,YAAA,WAAA,EAD7B,mBAKO,QALP,YAKO,CADH,WAA2C,KAAA,QAAA,YAAA,EAAA,QAAA,CAAA,gBAAA,gBAAlB,QAAA,SAAQ,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;KAOnCA,KAAAA,OAAO,OAAA,WAAA,EADjB,mBAMM,OANN,YAMM,CADF,WAAmB,KAAA,QAAA,MAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;KAKbA,KAAAA,OAAO,UAAA,WAAA,EADjB,mBAQM,OAAA;;MANF,OAAK,eAAA,CAAC,yEACE,eAAA,MAAc,CAAA;SAEtB,mBAEM,OAFN,YAEM,CADF,WAAsB,KAAA,QAAA,SAAA,CAAA,CAAA,CAAA,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;+BAK9B,mBAAiD,OAAA;MAA5C,OAAM;MAAiB,eAAY;;KAI9BA,KAAAA,OAAO,WAAA,WAAA,EADjB,mBAKM,OALN,YAKM,CADF,WAAuB,KAAA,QAAA,UAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;KAKjBA,KAAAA,OAAO,QAAA,WAAA,EADjB,mBAKM,OALN,YAKM,CADF,WAAoB,KAAA,QAAA,OAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Switcher.cjs","names":[],"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',\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=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\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\"\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 py-1\"\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=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\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-full\";\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":""}
1
+ {"version":3,"file":"Switcher.cjs","names":[],"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=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\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=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\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":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Switcher.mjs","names":[],"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',\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=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\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\"\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 py-1\"\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=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\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-full\";\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":""}
1
+ {"version":3,"file":"Switcher.mjs","names":[],"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=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\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=\"shrink-0 inline-flex items-center justify-center w-9 h-9 rounded-md bg-accent/60 text-foreground\"\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":""}