vectis-ui 0.12.0 → 0.14.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 (519) hide show
  1. package/dist/components/VAccordion/VAccordion.css +1 -1
  2. package/dist/components/VAccordion/VAccordion.d.ts +6 -5
  3. package/dist/components/VAccordion/VAccordion.js.map +1 -1
  4. package/dist/components/VAccordion/VAccordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
  5. package/dist/components/VAccordion/VAccordionItem.css +1 -1
  6. package/dist/components/VAccordion/VAccordionItem.d.ts +1 -1
  7. package/dist/components/VAccordion/VAccordionItem.js.map +1 -1
  8. package/dist/components/VAccordion/VAccordionItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  9. package/dist/components/VAlert/VAlert.css +2 -0
  10. package/dist/components/VAlert/VAlert.d.ts +73 -0
  11. package/dist/components/VAlert/VAlert.js +9 -0
  12. package/dist/components/VAlert/VAlert.js.map +1 -0
  13. package/dist/components/VAlert/VAlert.vue_vue_type_script_setup_true_lang.js +96 -0
  14. package/dist/components/VAlert/VAlert.vue_vue_type_script_setup_true_lang.js.map +1 -0
  15. package/dist/components/VAvatar/VAvatar.d.ts +2 -2
  16. package/dist/components/VAvatar/VAvatarGroup.d.ts +1 -1
  17. package/dist/components/VAvatar/VAvatarGroup.vue_vue_type_script_setup_true_lang.js +8 -8
  18. package/dist/components/VBadge/VBadge.d.ts +3 -3
  19. package/dist/components/VBreadcrumb/VBreadcrumb.vue_vue_type_script_setup_true_lang.js +9 -9
  20. package/dist/components/VButton/VButton.d.ts +4 -4
  21. package/dist/components/VButton/VButtonGroup.css +1 -1
  22. package/dist/components/VButton/VButtonGroup.d.ts +2 -2
  23. package/dist/components/VButton/VButtonGroup.js.map +1 -1
  24. package/dist/components/VButton/VButtonGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  25. package/dist/components/VCalendar/VCalendar.css +1 -1
  26. package/dist/components/VCalendar/VCalendar.d.ts +7 -1
  27. package/dist/components/VCalendar/VCalendar.js.map +1 -1
  28. package/dist/components/VCalendar/VCalendar.vue_vue_type_script_setup_true_lang.js +20 -18
  29. package/dist/components/VCalendar/VCalendar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  30. package/dist/components/VCalendar/VCalendarEvent.js.map +1 -1
  31. package/dist/components/VCalendar/VCalendarEvent.vue_vue_type_script_setup_true_lang.js.map +1 -1
  32. package/dist/components/VCalendar/VCalendarMonth.css +1 -1
  33. package/dist/components/VCalendar/VCalendarMonth.d.ts +2 -2
  34. package/dist/components/VCalendar/VCalendarMonth.js.map +1 -1
  35. package/dist/components/VCalendar/VCalendarMonth.vue_vue_type_script_setup_true_lang.js.map +1 -1
  36. package/dist/components/VCalendar/VCalendarTimeGrid.css +1 -1
  37. package/dist/components/VCalendar/VCalendarTimeGrid.d.ts +3 -3
  38. package/dist/components/VCalendar/VCalendarTimeGrid.js.map +1 -1
  39. package/dist/components/VCalendar/VCalendarTimeGrid.vue_vue_type_script_setup_true_lang.js.map +1 -1
  40. package/dist/components/VCalendar/VCalendarYear.css +1 -1
  41. package/dist/components/VCalendar/VCalendarYear.js.map +1 -1
  42. package/dist/components/VCalendar/VCalendarYear.vue_vue_type_script_setup_true_lang.js.map +1 -1
  43. package/dist/components/VCalendar/gesture.d.ts +1 -16
  44. package/dist/components/VCalendar/gesture.js +1 -1
  45. package/dist/components/VCalendar/gesture.js.map +1 -1
  46. package/dist/components/VCalendar/types.d.ts +2 -0
  47. package/dist/components/VCard/VCard.css +2 -0
  48. package/dist/components/VCard/VCard.d.ts +87 -0
  49. package/dist/components/VCard/VCard.js +9 -0
  50. package/dist/components/VCard/VCard.js.map +1 -0
  51. package/dist/components/VCard/VCard.vue_vue_type_script_setup_true_lang.js +103 -0
  52. package/dist/components/VCard/VCard.vue_vue_type_script_setup_true_lang.js.map +1 -0
  53. package/dist/components/VCarousel/VCarousel.d.ts +1 -1
  54. package/dist/components/VCarousel/VCarousel.js.map +1 -1
  55. package/dist/components/VCarousel/VCarousel.vue_vue_type_script_setup_true_lang.js +18 -18
  56. package/dist/components/VCarousel/VCarousel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  57. package/dist/components/VCheckbox/VCheckMark.css +2 -0
  58. package/dist/components/VCheckbox/VCheckMark.js +9 -0
  59. package/dist/components/VCheckbox/VCheckMark.js.map +1 -0
  60. package/dist/components/VCheckbox/VCheckMark.vue_vue_type_script_setup_true_lang.js +33 -0
  61. package/dist/components/VCheckbox/VCheckMark.vue_vue_type_script_setup_true_lang.js.map +1 -0
  62. package/dist/components/VCheckbox/VCheckbox.css +1 -1
  63. package/dist/components/VCheckbox/VCheckbox.d.ts +8 -3
  64. package/dist/components/VCheckbox/VCheckbox.js.map +1 -1
  65. package/dist/components/VCheckbox/VCheckbox.vue_vue_type_script_setup_true_lang.js +54 -69
  66. package/dist/components/VCheckbox/VCheckbox.vue_vue_type_script_setup_true_lang.js.map +1 -1
  67. package/dist/components/VChip/VChip.d.ts +6 -6
  68. package/dist/components/VChip/VChip.js.map +1 -1
  69. package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js +26 -26
  70. package/dist/components/VChip/VChip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  71. package/dist/components/VColorInput/VColorInput.css +2 -0
  72. package/dist/components/VColorInput/VColorInput.d.ts +113 -0
  73. package/dist/components/VColorInput/VColorInput.js +9 -0
  74. package/dist/components/VColorInput/VColorInput.js.map +1 -0
  75. package/dist/components/VColorInput/VColorInput.vue_vue_type_script_setup_true_lang.js +230 -0
  76. package/dist/components/VColorInput/VColorInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
  77. package/dist/components/VColorPicker/VColorPicker.css +2 -0
  78. package/dist/components/VColorPicker/VColorPicker.d.ts +67 -0
  79. package/dist/components/VColorPicker/VColorPicker.js +9 -0
  80. package/dist/components/VColorPicker/VColorPicker.js.map +1 -0
  81. package/dist/components/VColorPicker/VColorPicker.vue_vue_type_script_setup_true_lang.js +390 -0
  82. package/dist/components/VColorPicker/VColorPicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
  83. package/dist/components/VColorPicker/color.d.ts +42 -0
  84. package/dist/components/VColorPicker/color.js +158 -0
  85. package/dist/components/VColorPicker/color.js.map +1 -0
  86. package/dist/components/VCombobox/VCombobox.css +1 -1
  87. package/dist/components/VCombobox/VCombobox.d.ts +46 -60
  88. package/dist/components/VCombobox/VCombobox.js.map +1 -1
  89. package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js +271 -372
  90. package/dist/components/VCombobox/VCombobox.vue_vue_type_script_setup_true_lang.js.map +1 -1
  91. package/dist/components/VCommandPalette/VCommandPalette.css +2 -0
  92. package/dist/components/VCommandPalette/VCommandPalette.d.ts +163 -0
  93. package/dist/components/VCommandPalette/VCommandPalette.js +9 -0
  94. package/dist/components/VCommandPalette/VCommandPalette.js.map +1 -0
  95. package/dist/components/VCommandPalette/VCommandPalette.vue_vue_type_script_setup_true_lang.js +321 -0
  96. package/dist/components/VCommandPalette/VCommandPalette.vue_vue_type_script_setup_true_lang.js.map +1 -0
  97. package/dist/components/VCommandPalette/VCommandPaletteItem.css +2 -0
  98. package/dist/components/VCommandPalette/VCommandPaletteItem.d.ts +38 -0
  99. package/dist/components/VCommandPalette/VCommandPaletteItem.js +9 -0
  100. package/dist/components/VCommandPalette/VCommandPaletteItem.js.map +1 -0
  101. package/dist/components/VCommandPalette/VCommandPaletteItem.vue_vue_type_script_setup_true_lang.js +69 -0
  102. package/dist/components/VCommandPalette/VCommandPaletteItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
  103. package/dist/components/VContextMenu/VContextMenu.css +2 -0
  104. package/dist/components/VContextMenu/VContextMenu.d.ts +66 -0
  105. package/dist/components/VContextMenu/VContextMenu.js +9 -0
  106. package/dist/components/VContextMenu/VContextMenu.js.map +1 -0
  107. package/dist/components/VContextMenu/VContextMenu.vue_vue_type_script_setup_true_lang.js +148 -0
  108. package/dist/components/VContextMenu/VContextMenu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  109. package/dist/components/VDataTable/VDataTable.css +1 -1
  110. package/dist/components/VDataTable/VDataTable.d.ts +41 -16
  111. package/dist/components/VDataTable/VDataTable.js.map +1 -1
  112. package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js +307 -194
  113. package/dist/components/VDataTable/VDataTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
  114. package/dist/components/VDateInput/VDateInput.d.ts +27 -7
  115. package/dist/components/VDateInput/VDateInput.js.map +1 -1
  116. package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js +170 -162
  117. package/dist/components/VDateInput/VDateInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  118. package/dist/components/VDatePicker/VDatePicker.d.ts +3 -3
  119. package/dist/components/VDatePicker/VDatePicker.js.map +1 -1
  120. package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js +228 -227
  121. package/dist/components/VDatePicker/VDatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  122. package/dist/components/VDatePicker/keyboard.d.ts +7 -7
  123. package/dist/components/VDatePicker/keyboard.js +8 -6
  124. package/dist/components/VDatePicker/keyboard.js.map +1 -1
  125. package/dist/components/VDatePicker/names.js +16 -20
  126. package/dist/components/VDatePicker/names.js.map +1 -1
  127. package/dist/components/VDialog/VDialog.d.ts +2 -4
  128. package/dist/components/VDialog/VDialog.js.map +1 -1
  129. package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js +46 -77
  130. package/dist/components/VDialog/VDialog.vue_vue_type_script_setup_true_lang.js.map +1 -1
  131. package/dist/components/VDrawer/VDrawer.css +2 -0
  132. package/dist/components/VDrawer/VDrawer.d.ts +102 -0
  133. package/dist/components/VDrawer/VDrawer.js +9 -0
  134. package/dist/components/VDrawer/VDrawer.js.map +1 -0
  135. package/dist/components/VDrawer/VDrawer.vue_vue_type_script_setup_true_lang.js +128 -0
  136. package/dist/components/VDrawer/VDrawer.vue_vue_type_script_setup_true_lang.js.map +1 -0
  137. package/dist/components/VEmptyState/VEmptyState.css +2 -0
  138. package/dist/components/VEmptyState/VEmptyState.d.ts +43 -0
  139. package/dist/components/VEmptyState/VEmptyState.js +9 -0
  140. package/dist/components/VEmptyState/VEmptyState.js.map +1 -0
  141. package/dist/components/VEmptyState/VEmptyState.vue_vue_type_script_setup_true_lang.js +48 -0
  142. package/dist/components/VEmptyState/VEmptyState.vue_vue_type_script_setup_true_lang.js.map +1 -0
  143. package/dist/components/VField/VField.css +2 -0
  144. package/dist/components/VField/VField.d.ts +84 -0
  145. package/dist/components/VField/VField.js +9 -0
  146. package/dist/components/VField/VField.js.map +1 -0
  147. package/dist/components/VField/VField.vue_vue_type_script_setup_true_lang.js +99 -0
  148. package/dist/components/VField/VField.vue_vue_type_script_setup_true_lang.js.map +1 -0
  149. package/dist/components/VField/VFieldAnnouncer.d.ts +7 -0
  150. package/dist/components/VField/VFieldAnnouncer.js +7 -0
  151. package/dist/components/VField/VFieldAnnouncer.js.map +1 -0
  152. package/dist/components/VField/VFieldAnnouncer.vue_vue_type_script_setup_true_lang.js +19 -0
  153. package/dist/components/VField/VFieldAnnouncer.vue_vue_type_script_setup_true_lang.js.map +1 -0
  154. package/dist/components/VField/VFieldMessage.d.ts +11 -0
  155. package/dist/components/VField/VFieldMessage.js +7 -0
  156. package/dist/components/VField/VFieldMessage.js.map +1 -0
  157. package/dist/components/VField/VFieldMessage.vue_vue_type_script_setup_true_lang.js +32 -0
  158. package/dist/components/VField/VFieldMessage.vue_vue_type_script_setup_true_lang.js.map +1 -0
  159. package/dist/components/VFieldset/VFieldset.css +2 -0
  160. package/dist/components/VFieldset/VFieldset.d.ts +52 -0
  161. package/dist/components/VFieldset/VFieldset.js +9 -0
  162. package/dist/components/VFieldset/VFieldset.js.map +1 -0
  163. package/dist/components/VFieldset/VFieldset.vue_vue_type_script_setup_true_lang.js +63 -0
  164. package/dist/components/VFieldset/VFieldset.vue_vue_type_script_setup_true_lang.js.map +1 -0
  165. package/dist/components/VFileInput/VFileInput.css +1 -1
  166. package/dist/components/VFileInput/VFileInput.d.ts +31 -7
  167. package/dist/components/VFileInput/VFileInput.js.map +1 -1
  168. package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js +168 -161
  169. package/dist/components/VFileInput/VFileInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  170. package/dist/components/VFilePicker/VFilePicker.d.ts +4 -4
  171. package/dist/components/VHotkeys/VHotkeys.css +1 -1
  172. package/dist/components/VHotkeys/VHotkeys.js.map +1 -1
  173. package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js +27 -30
  174. package/dist/components/VHotkeys/VHotkeys.vue_vue_type_script_setup_true_lang.js.map +1 -1
  175. package/dist/components/VHotkeys/platform.d.ts +2 -0
  176. package/dist/components/VHotkeys/platform.js +24 -5
  177. package/dist/components/VHotkeys/platform.js.map +1 -1
  178. package/dist/components/VHoverCard/VHoverCard.css +2 -0
  179. package/dist/components/VHoverCard/VHoverCard.d.ts +62 -0
  180. package/dist/components/VHoverCard/VHoverCard.js +9 -0
  181. package/dist/components/VHoverCard/VHoverCard.js.map +1 -0
  182. package/dist/components/VHoverCard/VHoverCard.vue_vue_type_script_setup_true_lang.js +97 -0
  183. package/dist/components/VHoverCard/VHoverCard.vue_vue_type_script_setup_true_lang.js.map +1 -0
  184. package/dist/components/VIcon/icons/add.d.ts +5 -0
  185. package/dist/components/VIcon/icons/add.js +9 -0
  186. package/dist/components/VIcon/icons/add.js.map +1 -0
  187. package/dist/components/VIcon/icons/colorize.d.ts +5 -0
  188. package/dist/components/VIcon/icons/colorize.js +9 -0
  189. package/dist/components/VIcon/icons/colorize.js.map +1 -0
  190. package/dist/components/VIcon/icons/inbox.d.ts +5 -0
  191. package/dist/components/VIcon/icons/inbox.js +9 -0
  192. package/dist/components/VIcon/icons/inbox.js.map +1 -0
  193. package/dist/components/VIcon/icons/index.d.ts +42 -2
  194. package/dist/components/VIcon/icons/index.js +88 -72
  195. package/dist/components/VIcon/icons/index.js.map +1 -1
  196. package/dist/components/VIcon/icons/names.d.ts +2 -2
  197. package/dist/components/VIcon/icons/names.js +1 -1
  198. package/dist/components/VIcon/icons/names.js.map +1 -1
  199. package/dist/components/VIcon/icons/open_in_new.d.ts +5 -0
  200. package/dist/components/VIcon/icons/open_in_new.js +9 -0
  201. package/dist/components/VIcon/icons/open_in_new.js.map +1 -0
  202. package/dist/components/VIcon/icons/priority_high.d.ts +5 -0
  203. package/dist/components/VIcon/icons/priority_high.js +9 -0
  204. package/dist/components/VIcon/icons/priority_high.js.map +1 -0
  205. package/dist/components/VIcon/icons/remove.d.ts +5 -0
  206. package/dist/components/VIcon/icons/remove.js +9 -0
  207. package/dist/components/VIcon/icons/remove.js.map +1 -0
  208. package/dist/components/VIcon/icons/search_off.d.ts +5 -0
  209. package/dist/components/VIcon/icons/search_off.js +9 -0
  210. package/dist/components/VIcon/icons/search_off.js.map +1 -0
  211. package/dist/components/VIcon/icons/star.d.ts +5 -0
  212. package/dist/components/VIcon/icons/star.js +9 -0
  213. package/dist/components/VIcon/icons/star.js.map +1 -0
  214. package/dist/components/VIconButton/VIconButton.d.ts +4 -4
  215. package/dist/components/VInput/VInput.css +1 -1
  216. package/dist/components/VInput/VInput.d.ts +51 -2
  217. package/dist/components/VInput/VInput.js.map +1 -1
  218. package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js +129 -106
  219. package/dist/components/VInput/VInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  220. package/dist/components/VInput/VInputGroup.css +1 -1
  221. package/dist/components/VInput/VInputGroup.d.ts +20 -0
  222. package/dist/components/VInput/VInputGroup.js.map +1 -1
  223. package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js +50 -51
  224. package/dist/components/VInput/VInputGroup.vue_vue_type_script_setup_true_lang.js.map +1 -1
  225. package/dist/components/VInputOTP/VInputOTP.css +1 -1
  226. package/dist/components/VInputOTP/VInputOTP.d.ts +27 -4
  227. package/dist/components/VInputOTP/VInputOTP.js.map +1 -1
  228. package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js +131 -113
  229. package/dist/components/VInputOTP/VInputOTP.vue_vue_type_script_setup_true_lang.js.map +1 -1
  230. package/dist/components/VLink/VLink.css +2 -0
  231. package/dist/components/VLink/VLink.d.ts +53 -0
  232. package/dist/components/VLink/VLink.js +9 -0
  233. package/dist/components/VLink/VLink.js.map +1 -0
  234. package/dist/components/VLink/VLink.vue_vue_type_script_setup_true_lang.js +58 -0
  235. package/dist/components/VLink/VLink.vue_vue_type_script_setup_true_lang.js.map +1 -0
  236. package/dist/components/VListbox/VListboxChevron.css +2 -0
  237. package/dist/components/VListbox/VListboxChevron.d.ts +12 -0
  238. package/dist/components/VListbox/VListboxChevron.js +9 -0
  239. package/dist/components/VListbox/VListboxChevron.js.map +1 -0
  240. package/dist/components/VListbox/VListboxChevron.vue_vue_type_script_setup_true_lang.js +25 -0
  241. package/dist/components/VListbox/VListboxChevron.vue_vue_type_script_setup_true_lang.js.map +1 -0
  242. package/dist/components/VListbox/VListboxGroup.css +2 -0
  243. package/dist/components/VListbox/VListboxGroup.d.ts +27 -0
  244. package/dist/components/VListbox/VListboxGroup.js +9 -0
  245. package/dist/components/VListbox/VListboxGroup.js.map +1 -0
  246. package/dist/components/VListbox/VListboxGroup.vue_vue_type_script_setup_true_lang.js +21 -0
  247. package/dist/components/VListbox/VListboxGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
  248. package/dist/components/VListbox/VListboxOption.css +2 -0
  249. package/dist/components/{VCombobox/VComboboxOption.d.ts → VListbox/VListboxOption.d.ts} +4 -4
  250. package/dist/components/VListbox/VListboxOption.js +9 -0
  251. package/dist/components/VListbox/VListboxOption.js.map +1 -0
  252. package/dist/components/{VCombobox/VComboboxOption.vue_vue_type_script_setup_true_lang.js → VListbox/VListboxOption.vue_vue_type_script_setup_true_lang.js} +6 -6
  253. package/dist/components/VListbox/VListboxOption.vue_vue_type_script_setup_true_lang.js.map +1 -0
  254. package/dist/components/VListbox/VListboxPanel.css +2 -0
  255. package/dist/components/VListbox/VListboxPanel.d.ts +59 -0
  256. package/dist/components/VListbox/VListboxPanel.js +9 -0
  257. package/dist/components/VListbox/VListboxPanel.js.map +1 -0
  258. package/dist/components/VListbox/VListboxPanel.vue_vue_type_script_setup_true_lang.js +123 -0
  259. package/dist/components/VListbox/VListboxPanel.vue_vue_type_script_setup_true_lang.js.map +1 -0
  260. package/dist/components/VListbox/VListboxSeparator.css +2 -0
  261. package/dist/components/VListbox/VListboxSeparator.d.ts +3 -0
  262. package/dist/components/VListbox/VListboxSeparator.js +9 -0
  263. package/dist/components/VListbox/VListboxSeparator.js.map +1 -0
  264. package/dist/components/{VCombobox/VComboboxSeparator.vue_vue_type_script_setup_true_lang.js → VListbox/VListboxSeparator.vue_vue_type_script_setup_true_lang.js} +4 -4
  265. package/dist/components/VListbox/VListboxSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -0
  266. package/dist/components/VListbox/VListboxValues.css +2 -0
  267. package/dist/components/VListbox/VListboxValues.d.ts +52 -0
  268. package/dist/components/VListbox/VListboxValues.js +9 -0
  269. package/dist/components/VListbox/VListboxValues.js.map +1 -0
  270. package/dist/components/VListbox/VListboxValues.vue_vue_type_script_setup_true_lang.js +103 -0
  271. package/dist/components/VListbox/VListboxValues.vue_vue_type_script_setup_true_lang.js.map +1 -0
  272. package/dist/components/VMenu/VMenu.d.ts +1 -1
  273. package/dist/components/VMenu/VMenu.vue_vue_type_script_setup_true_lang.js +9 -9
  274. package/dist/components/VMenu/VMenuItem.d.ts +1 -1
  275. package/dist/components/VMenu/VMenuItem.vue_vue_type_script_setup_true_lang.js +16 -16
  276. package/dist/components/VMenu/VMenuPanel.d.ts +2 -2
  277. package/dist/components/VMenu/VMenuPanel.js.map +1 -1
  278. package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js +7 -7
  279. package/dist/components/VMenu/VMenuPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
  280. package/dist/components/VMeter/VMeter.css +2 -0
  281. package/dist/components/VMeter/VMeter.d.ts +77 -0
  282. package/dist/components/VMeter/VMeter.js +9 -0
  283. package/dist/components/VMeter/VMeter.js.map +1 -0
  284. package/dist/components/VMeter/VMeter.vue_vue_type_script_setup_true_lang.js +113 -0
  285. package/dist/components/VMeter/VMeter.vue_vue_type_script_setup_true_lang.js.map +1 -0
  286. package/dist/components/VNumberInput/VNumberInput.css +2 -0
  287. package/dist/components/VNumberInput/VNumberInput.d.ts +114 -0
  288. package/dist/components/VNumberInput/VNumberInput.js +9 -0
  289. package/dist/components/VNumberInput/VNumberInput.js.map +1 -0
  290. package/dist/components/VNumberInput/VNumberInput.vue_vue_type_script_setup_true_lang.js +251 -0
  291. package/dist/components/VNumberInput/VNumberInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
  292. package/dist/components/VNumberInput/number.d.ts +30 -0
  293. package/dist/components/VNumberInput/number.js +38 -0
  294. package/dist/components/VNumberInput/number.js.map +1 -0
  295. package/dist/components/VPagination/VPagination.d.ts +1 -1
  296. package/dist/components/VPagination/VPagination.js.map +1 -1
  297. package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js +77 -77
  298. package/dist/components/VPagination/VPagination.vue_vue_type_script_setup_true_lang.js.map +1 -1
  299. package/dist/components/VProgressCircular/VProgressCircular.d.ts +2 -2
  300. package/dist/components/VProgressLinear/VProgressLinear.css +1 -1
  301. package/dist/components/VProgressLinear/VProgressLinear.d.ts +10 -7
  302. package/dist/components/VProgressLinear/VProgressLinear.js.map +1 -1
  303. package/dist/components/VProgressLinear/VProgressLinear.vue_vue_type_script_setup_true_lang.js +52 -34
  304. package/dist/components/VProgressLinear/VProgressLinear.vue_vue_type_script_setup_true_lang.js.map +1 -1
  305. package/dist/components/VRadio/VRadio.d.ts +8 -3
  306. package/dist/components/VRadio/VRadio.js.map +1 -1
  307. package/dist/components/VRadio/VRadio.vue_vue_type_script_setup_true_lang.js +52 -46
  308. package/dist/components/VRadio/VRadio.vue_vue_type_script_setup_true_lang.js.map +1 -1
  309. package/dist/components/VRating/VRating.css +2 -0
  310. package/dist/components/VRating/VRating.d.ts +92 -0
  311. package/dist/components/VRating/VRating.js +9 -0
  312. package/dist/components/VRating/VRating.js.map +1 -0
  313. package/dist/components/VRating/VRating.vue_vue_type_script_setup_true_lang.js +158 -0
  314. package/dist/components/VRating/VRating.vue_vue_type_script_setup_true_lang.js.map +1 -0
  315. package/dist/components/VResizable/VResizable.css +2 -0
  316. package/dist/components/VResizable/VResizable.d.ts +50 -0
  317. package/dist/components/VResizable/VResizable.js +9 -0
  318. package/dist/components/VResizable/VResizable.js.map +1 -0
  319. package/dist/components/VResizable/VResizable.vue_vue_type_script_setup_true_lang.js +225 -0
  320. package/dist/components/VResizable/VResizable.vue_vue_type_script_setup_true_lang.js.map +1 -0
  321. package/dist/components/VResizable/VResizablePanel.css +2 -0
  322. package/dist/components/VResizable/VResizablePanel.d.ts +60 -0
  323. package/dist/components/VResizable/VResizablePanel.js +9 -0
  324. package/dist/components/VResizable/VResizablePanel.js.map +1 -0
  325. package/dist/components/VResizable/VResizablePanel.vue_vue_type_script_setup_true_lang.js +83 -0
  326. package/dist/components/VResizable/VResizablePanel.vue_vue_type_script_setup_true_lang.js.map +1 -0
  327. package/dist/components/VResizable/context.d.ts +24 -0
  328. package/dist/components/VResizable/context.js +6 -0
  329. package/dist/components/VResizable/context.js.map +1 -0
  330. package/dist/components/VResizable/layout.d.ts +28 -0
  331. package/dist/components/VResizable/layout.js +41 -0
  332. package/dist/components/VResizable/layout.js.map +1 -0
  333. package/dist/components/VSelect/VSelect.css +2 -0
  334. package/dist/components/VSelect/VSelect.d.ts +193 -0
  335. package/dist/components/VSelect/VSelect.js +9 -0
  336. package/dist/components/VSelect/VSelect.js.map +1 -0
  337. package/dist/components/VSelect/VSelect.vue_vue_type_script_setup_true_lang.js +418 -0
  338. package/dist/components/VSelect/VSelect.vue_vue_type_script_setup_true_lang.js.map +1 -0
  339. package/dist/components/VSeparator/VSeparator.js.map +1 -1
  340. package/dist/components/VSeparator/VSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -1
  341. package/dist/components/VSideNavigation/VSideNavigation.vue_vue_type_script_setup_true_lang.js +8 -8
  342. package/dist/components/VSideNavigation/VSideNavigationItem.d.ts +2 -2
  343. package/dist/components/VSideNavigation/VSideNavigationItem.js.map +1 -1
  344. package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js +3 -3
  345. package/dist/components/VSideNavigation/VSideNavigationItem.vue_vue_type_script_setup_true_lang.js.map +1 -1
  346. package/dist/components/VSkeletonLoader/VSkeletonLoader.d.ts +3 -3
  347. package/dist/components/VSlider/VSlider.css +1 -1
  348. package/dist/components/VSlider/VSlider.d.ts +34 -8
  349. package/dist/components/VSlider/VSlider.js.map +1 -1
  350. package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js +236 -215
  351. package/dist/components/VSlider/VSlider.vue_vue_type_script_setup_true_lang.js.map +1 -1
  352. package/dist/components/VSnackbar/VSnackbar.vue_vue_type_script_setup_true_lang.js +4 -4
  353. package/dist/components/VSnackbar/state.js.map +1 -1
  354. package/dist/components/VSplitButton/VSplitButton.css +2 -0
  355. package/dist/components/VSplitButton/VSplitButton.d.ts +114 -0
  356. package/dist/components/VSplitButton/VSplitButton.js +9 -0
  357. package/dist/components/VSplitButton/VSplitButton.js.map +1 -0
  358. package/dist/components/VSplitButton/VSplitButton.vue_vue_type_script_setup_true_lang.js +148 -0
  359. package/dist/components/VSplitButton/VSplitButton.vue_vue_type_script_setup_true_lang.js.map +1 -0
  360. package/dist/components/VStepper/VStepper.css +2 -0
  361. package/dist/components/VStepper/VStepper.d.ts +73 -0
  362. package/dist/components/VStepper/VStepper.js +9 -0
  363. package/dist/components/VStepper/VStepper.js.map +1 -0
  364. package/dist/components/VStepper/VStepper.vue_vue_type_script_setup_true_lang.js +96 -0
  365. package/dist/components/VStepper/VStepper.vue_vue_type_script_setup_true_lang.js.map +1 -0
  366. package/dist/components/VSwitch/VSwitch.d.ts +8 -3
  367. package/dist/components/VSwitch/VSwitch.js.map +1 -1
  368. package/dist/components/VSwitch/VSwitch.vue_vue_type_script_setup_true_lang.js +53 -47
  369. package/dist/components/VSwitch/VSwitch.vue_vue_type_script_setup_true_lang.js.map +1 -1
  370. package/dist/components/VTabs/VTab.css +1 -1
  371. package/dist/components/VTabs/VTab.d.ts +1 -1
  372. package/dist/components/VTabs/VTab.js.map +1 -1
  373. package/dist/components/VTabs/VTab.vue_vue_type_script_setup_true_lang.js.map +1 -1
  374. package/dist/components/VTabs/VTabs.css +1 -1
  375. package/dist/components/VTabs/VTabs.d.ts +13 -5
  376. package/dist/components/VTabs/VTabs.js.map +1 -1
  377. package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js +20 -20
  378. package/dist/components/VTabs/VTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
  379. package/dist/components/VTextarea/VTextarea.css +1 -1
  380. package/dist/components/VTextarea/VTextarea.d.ts +22 -2
  381. package/dist/components/VTextarea/VTextarea.js.map +1 -1
  382. package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js +108 -100
  383. package/dist/components/VTextarea/VTextarea.vue_vue_type_script_setup_true_lang.js.map +1 -1
  384. package/dist/components/VTimeInput/VTimeInput.d.ts +27 -7
  385. package/dist/components/VTimeInput/VTimeInput.js.map +1 -1
  386. package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js +187 -171
  387. package/dist/components/VTimeInput/VTimeInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  388. package/dist/components/VTimePicker/VTimePicker.d.ts +2 -2
  389. package/dist/components/VTimePicker/VTimePicker.js.map +1 -1
  390. package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js +16 -16
  391. package/dist/components/VTimePicker/VTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
  392. package/dist/components/VTimeline/VTimeline.css +2 -0
  393. package/dist/components/VTimeline/VTimeline.d.ts +59 -0
  394. package/dist/components/VTimeline/VTimeline.js +9 -0
  395. package/dist/components/VTimeline/VTimeline.js.map +1 -0
  396. package/dist/components/VTimeline/VTimeline.vue_vue_type_script_setup_true_lang.js +53 -0
  397. package/dist/components/VTimeline/VTimeline.vue_vue_type_script_setup_true_lang.js.map +1 -0
  398. package/dist/components/VTimeline/VTimelineItem.css +2 -0
  399. package/dist/components/VTimeline/VTimelineItem.d.ts +48 -0
  400. package/dist/components/VTimeline/VTimelineItem.js +9 -0
  401. package/dist/components/VTimeline/VTimelineItem.js.map +1 -0
  402. package/dist/components/VTimeline/VTimelineItem.vue_vue_type_script_setup_true_lang.js +70 -0
  403. package/dist/components/VTimeline/VTimelineItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
  404. package/dist/components/VTimeline/context.d.ts +11 -0
  405. package/dist/components/VTimeline/context.js +6 -0
  406. package/dist/components/VTimeline/context.js.map +1 -0
  407. package/dist/components/VTimeline/datetime.d.ts +8 -0
  408. package/dist/components/VTimeline/datetime.js +36 -0
  409. package/dist/components/VTimeline/datetime.js.map +1 -0
  410. package/dist/components/VToast/VToast.vue_vue_type_script_setup_true_lang.js +8 -8
  411. package/dist/components/VToast/VToaster.vue_vue_type_script_setup_true_lang.js +12 -12
  412. package/dist/components/VToggle/VToggle.d.ts +4 -4
  413. package/dist/components/VToggle/VToggle.js.map +1 -1
  414. package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js +1 -1
  415. package/dist/components/VToggle/VToggle.vue_vue_type_script_setup_true_lang.js.map +1 -1
  416. package/dist/components/VToggle/VToggleItem.d.ts +1 -1
  417. package/dist/components/VTooltip/VTooltip.d.ts +8 -2
  418. package/dist/components/VTooltip/VTooltip.js.map +1 -1
  419. package/dist/components/VTooltip/VTooltip.vue_vue_type_script_setup_true_lang.js +45 -43
  420. package/dist/components/VTooltip/VTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
  421. package/dist/components/VTreeView/VTreeView.css +2 -0
  422. package/dist/components/VTreeView/VTreeView.d.ts +112 -0
  423. package/dist/components/VTreeView/VTreeView.js +9 -0
  424. package/dist/components/VTreeView/VTreeView.js.map +1 -0
  425. package/dist/components/VTreeView/VTreeView.vue_vue_type_script_setup_true_lang.js +317 -0
  426. package/dist/components/VTreeView/VTreeView.vue_vue_type_script_setup_true_lang.js.map +1 -0
  427. package/dist/components/VTypography/VTypography.d.ts +1 -1
  428. package/dist/components/VVirtualList/VVirtualList.css +2 -0
  429. package/dist/components/VVirtualList/VVirtualList.d.ts +78 -0
  430. package/dist/components/VVirtualList/VVirtualList.js +9 -0
  431. package/dist/components/VVirtualList/VVirtualList.js.map +1 -0
  432. package/dist/components/VVirtualList/VVirtualList.vue_vue_type_script_setup_true_lang.js +114 -0
  433. package/dist/components/VVirtualList/VVirtualList.vue_vue_type_script_setup_true_lang.js.map +1 -0
  434. package/dist/composables/useChoice.d.ts +28 -0
  435. package/dist/composables/useChoice.js +28 -0
  436. package/dist/composables/useChoice.js.map +1 -0
  437. package/dist/composables/useDebouncedSearch.d.ts +17 -0
  438. package/dist/composables/useDebouncedSearch.js +18 -0
  439. package/dist/composables/useDebouncedSearch.js.map +1 -0
  440. package/dist/composables/useEscapeDismiss.d.ts +8 -0
  441. package/dist/composables/useEscapeDismiss.js +16 -0
  442. package/dist/composables/useEscapeDismiss.js.map +1 -0
  443. package/dist/composables/useFieldIds.d.ts +2 -1
  444. package/dist/composables/useFieldIds.js +7 -6
  445. package/dist/composables/useFieldIds.js.map +1 -1
  446. package/dist/composables/useFieldPanel.d.ts +1 -0
  447. package/dist/composables/useFieldPanel.js +52 -42
  448. package/dist/composables/useFieldPanel.js.map +1 -1
  449. package/dist/composables/useFileField.d.ts +1 -3
  450. package/dist/composables/useFileField.js +48 -50
  451. package/dist/composables/useFileField.js.map +1 -1
  452. package/dist/composables/useHotkeyListener.d.ts +17 -0
  453. package/dist/composables/useHotkeyListener.js +29 -0
  454. package/dist/composables/useHotkeyListener.js.map +1 -0
  455. package/dist/composables/useIconClickHandlers.d.ts +2 -10
  456. package/dist/composables/useIconClickHandlers.js +1 -1
  457. package/dist/composables/useIconClickHandlers.js.map +1 -1
  458. package/dist/{components/VCombobox/infiniteScroll.d.ts → composables/useInfiniteScroll.d.ts} +6 -0
  459. package/dist/{components/VCombobox/infiniteScroll.js → composables/useInfiniteScroll.js} +9 -9
  460. package/dist/composables/useInfiniteScroll.js.map +1 -0
  461. package/dist/composables/useListbox.d.ts +132 -0
  462. package/dist/composables/useListbox.js +227 -0
  463. package/dist/composables/useListbox.js.map +1 -0
  464. package/dist/composables/useModalDialog.d.ts +28 -0
  465. package/dist/composables/useModalDialog.js +60 -0
  466. package/dist/composables/useModalDialog.js.map +1 -0
  467. package/dist/composables/useRootAttrs.d.ts +2 -3
  468. package/dist/composables/useRootAttrs.js.map +1 -1
  469. package/dist/composables/useTypeahead.d.ts +13 -0
  470. package/dist/composables/useTypeahead.js +23 -0
  471. package/dist/composables/useTypeahead.js.map +1 -0
  472. package/dist/composables/useVirtualList.d.ts +46 -0
  473. package/dist/composables/useVirtualList.js +145 -0
  474. package/dist/composables/useVirtualList.js.map +1 -0
  475. package/dist/i18n/en.js +50 -0
  476. package/dist/i18n/en.js.map +1 -1
  477. package/dist/i18n/fr.js +50 -0
  478. package/dist/i18n/fr.js.map +1 -1
  479. package/dist/i18n/state.d.ts +1 -1
  480. package/dist/i18n/state.js +17 -6
  481. package/dist/i18n/state.js.map +1 -1
  482. package/dist/i18n/types.d.ts +103 -2
  483. package/dist/icons.js +45 -37
  484. package/dist/index.d.ts +49 -3
  485. package/dist/index.js +80 -56
  486. package/dist/styles.css +1 -1
  487. package/dist/tokens/index.d.ts +43 -0
  488. package/dist/tokens/semantic.d.ts +42 -0
  489. package/dist/tokens/semantic.js +43 -1
  490. package/dist/tokens/semantic.js.map +1 -1
  491. package/dist/tokens/themes/dark.d.ts +1 -0
  492. package/dist/tokens/themes/dark.js +1 -0
  493. package/dist/tokens/themes/dark.js.map +1 -1
  494. package/dist/tokens.json +215 -1
  495. package/dist/types.d.ts +57 -4
  496. package/dist/utils/arrowNav.js.map +1 -1
  497. package/dist/utils/attrs.d.ts +9 -0
  498. package/dist/utils/attrs.js +14 -0
  499. package/dist/utils/attrs.js.map +1 -0
  500. package/dist/utils/date.d.ts +1 -0
  501. package/dist/utils/date.js +5 -4
  502. package/dist/utils/date.js.map +1 -1
  503. package/package.json +1 -1
  504. package/dist/components/VCombobox/VComboboxGroup.css +0 -2
  505. package/dist/components/VCombobox/VComboboxGroup.d.ts +0 -17
  506. package/dist/components/VCombobox/VComboboxGroup.js +0 -9
  507. package/dist/components/VCombobox/VComboboxGroup.js.map +0 -1
  508. package/dist/components/VCombobox/VComboboxGroup.vue_vue_type_script_setup_true_lang.js +0 -21
  509. package/dist/components/VCombobox/VComboboxGroup.vue_vue_type_script_setup_true_lang.js.map +0 -1
  510. package/dist/components/VCombobox/VComboboxOption.css +0 -2
  511. package/dist/components/VCombobox/VComboboxOption.js +0 -9
  512. package/dist/components/VCombobox/VComboboxOption.js.map +0 -1
  513. package/dist/components/VCombobox/VComboboxOption.vue_vue_type_script_setup_true_lang.js.map +0 -1
  514. package/dist/components/VCombobox/VComboboxSeparator.css +0 -2
  515. package/dist/components/VCombobox/VComboboxSeparator.js +0 -9
  516. package/dist/components/VCombobox/VComboboxSeparator.js.map +0 -1
  517. package/dist/components/VCombobox/VComboboxSeparator.vue_vue_type_script_setup_true_lang.js.map +0 -1
  518. package/dist/components/VCombobox/infiniteScroll.js.map +0 -1
  519. /package/dist/components/{VCombobox/VComboboxSeparator.d.ts → VCheckbox/VCheckMark.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.js","names":[],"sources":["../../../src/components/VColorPicker/color.ts"],"sourcesContent":["// @core\n/**\n * Colour parsing, conversion and formatting for VColorPicker and VColorInput, without a\n * dependency. Everything works in sRGB: an `oklch()` colour outside it is clipped to the nearest\n * displayable one, which is what the picker could show anyway.\n */\n\n/** How a colour is written: `#rrggbb`, `rgb()`, `hsl()` or `oklch()`. */\nexport type ColorFormat = 'hex' | 'rgb' | 'hsl' | 'oklch'\n\n/** The formats in the order the picker offers them. */\nexport const COLOR_FORMATS: readonly ColorFormat[] = ['hex', 'rgb', 'hsl', 'oklch']\n\n/** A colour in sRGB, each channel from 0 to 1, alpha included. */\nexport interface Rgba {\n r: number\n g: number\n b: number\n a: number\n}\n\n/**\n * A colour as the picker holds it: hue in degrees, saturation and value (brightness) from 0 to\n * 1. The hue survives where RGB would lose it, on greys, black and white.\n */\nexport interface Hsva {\n h: number\n s: number\n v: number\n a: number\n}\n\nconst clamp01 = (n: number) => Math.min(Math.max(n, 0), 1)\nconst wrapHue = (h: number) => ((h % 360) + 360) % 360\n\nexport function hsvToRgb({ h, s, v, a }: Hsva): Rgba {\n const f = (n: number) => {\n const k = (n + h / 60) % 6\n return v - v * s * Math.max(0, Math.min(k, 4 - k, 1))\n }\n return { r: f(5), g: f(3), b: f(1), a }\n}\n\n/** `hue` is kept when the colour has none of its own: a grey, black or white. */\nexport function rgbToHsv({ r, g, b, a }: Rgba, hue = 0): Hsva {\n const max = Math.max(r, g, b)\n const delta = max - Math.min(r, g, b)\n let h = hue\n if (delta > 0) {\n if (max === r) h = 60 * (((g - b) / delta + 6) % 6)\n else if (max === g) h = 60 * ((b - r) / delta + 2)\n else h = 60 * ((r - g) / delta + 4)\n }\n return { h: wrapHue(h), s: max === 0 ? 0 : delta / max, v: max, a }\n}\n\nfunction hslToRgb(h: number, s: number, l: number, a: number): Rgba {\n const v = l + s * Math.min(l, 1 - l)\n return hsvToRgb({ h, s: v === 0 ? 0 : 2 * (1 - l / v), v, a })\n}\n\nfunction rgbToHsl(rgba: Rgba): { h: number; s: number; l: number } {\n const { h, s, v } = rgbToHsv(rgba)\n const l = v * (1 - s / 2)\n return { h, s: l === 0 || l === 1 ? 0 : (v - l) / Math.min(l, 1 - l), l }\n}\n\nconst toLinear = (c: number) => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4)\nconst toGamma = (c: number) => (c <= 0.0031308 ? 12.92 * c : 1.055 * c ** (1 / 2.4) - 0.055)\n\n/** Björn Ottosson's OKLab matrices, from linear sRGB and back. */\nfunction rgbToOklch({ r, g, b }: Rgba): { l: number; c: number; h: number } {\n const [lr, lg, lb] = [toLinear(r), toLinear(g), toLinear(b)]\n const l = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb)\n const m = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb)\n const s = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb)\n const L = 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s\n const A = 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s\n const B = 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s\n return { l: L, c: Math.hypot(A, B), h: wrapHue((Math.atan2(B, A) * 180) / Math.PI) }\n}\n\nfunction oklchToRgb(L: number, C: number, H: number, a: number): Rgba {\n const A = C * Math.cos((H * Math.PI) / 180)\n const B = C * Math.sin((H * Math.PI) / 180)\n const l = (L + 0.3963377774 * A + 0.2158037573 * B) ** 3\n const m = (L - 0.1055613458 * A - 0.0638541728 * B) ** 3\n const s = (L - 0.0894841775 * A - 1.291485548 * B) ** 3\n const channel = (n: number) => clamp01(toGamma(n))\n return {\n r: channel(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),\n g: channel(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),\n b: channel(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s),\n a,\n }\n}\n\n/**\n * One argument of a colour function: a number, a percentage or an angle, `none` counting as 0.\n * `percent` is what 100% is worth for that channel.\n */\nfunction readNumber(token: string | undefined, percent: number): number | null {\n if (token === undefined) return null\n if (token === 'none') return 0\n const match = /^([+-]?(?:\\d+\\.?\\d*|\\.\\d+)(?:e[+-]?\\d+)?)(%|deg|grad|rad|turn)?$/.exec(token)\n if (!match) return null\n const n = Number(match[1])\n switch (match[2]) {\n case '%':\n return (n / 100) * percent\n case 'grad':\n return n * 0.9\n case 'rad':\n return (n * 180) / Math.PI\n case 'turn':\n return n * 360\n default:\n return n\n }\n}\n\nfunction parseHex(hex: string): Rgba | null {\n if (!/^[0-9a-f]+$/.test(hex) || ![3, 4, 6, 8].includes(hex.length)) return null\n const pairs = hex.length <= 4 ? [...hex].map((c) => c + c) : hex.match(/../g)!\n const [r = 0, g = 0, b = 0, a = 1] = pairs.map((pair) => parseInt(pair, 16) / 255)\n return { r, g, b, a }\n}\n\n/**\n * Reads a colour written in hex (`#` optional, 3, 4, 6 or 8 digits), `rgb()`, `hsl()` or\n * `oklch()`, in the comma or the space syntax, with an optional alpha. Returns `null` for\n * anything else, CSS colour names included.\n */\nexport function parseColor(input: string | null | undefined): Rgba | null {\n const text = (input ?? '').trim().toLowerCase()\n if (!text) return null\n const fn = /^(rgba?|hsla?|oklch)\\(\\s*([^)]*)\\)$/.exec(text)\n if (!fn) return parseHex(text.replace(/^#/, ''))\n\n const [main = '', alphaPart, extra] = fn[2]!.split('/')\n if (extra !== undefined) return null\n const args = main.trim().split(/\\s*,\\s*|\\s+/)\n const legacyAlpha = alphaPart === undefined && args.length === 4 ? args.pop() : undefined\n if (args.length !== 3) return null\n const alphaToken = (alphaPart ?? legacyAlpha)?.trim()\n const a = alphaToken === undefined ? 1 : readNumber(alphaToken, 1)\n if (a === null) return null\n\n const name = fn[1]!\n if (name.startsWith('rgb')) {\n const [r, g, b] = args.map((arg) => readNumber(arg, 255))\n if (r == null || g == null || b == null) return null\n return { r: clamp01(r / 255), g: clamp01(g / 255), b: clamp01(b / 255), a: clamp01(a) }\n }\n if (name.startsWith('hsl')) {\n // Bare numbers are percentages here, as the space syntax allows.\n const [h, s, l] = [readNumber(args[0], 360), readNumber(args[1], 100), readNumber(args[2], 100)]\n if (h == null || s == null || l == null) return null\n return hslToRgb(wrapHue(h), clamp01(s / 100), clamp01(l / 100), clamp01(a))\n }\n const [l, c, h] = [readNumber(args[0], 1), readNumber(args[1], 0.4), readNumber(args[2], 360)]\n if (l == null || c == null || h == null) return null\n return oklchToRgb(clamp01(l), Math.max(c, 0), wrapHue(h), clamp01(a))\n}\n\n/** Rounds to `digits` decimals and drops the trailing zeros. */\nconst round = (n: number, digits = 0) => String(Number(n.toFixed(digits)))\n\n/**\n * Writes a colour in `format`. The alpha appears only when `alpha` is true and the colour is not\n * opaque, so an opaque colour always reads the same whether alpha is offered or not.\n */\nexport function formatColor(rgba: Rgba, format: ColorFormat, alpha = false): string {\n const a = alpha ? clamp01(rgba.a) : 1\n const slash = a < 1 ? ` / ${round(a, 2)}` : ''\n switch (format) {\n case 'rgb':\n return `rgb(${round(rgba.r * 255)} ${round(rgba.g * 255)} ${round(rgba.b * 255)}${slash})`\n case 'hsl': {\n const { h, s, l } = rgbToHsl(rgba)\n return `hsl(${round(h)} ${round(s * 100)}% ${round(l * 100)}%${slash})`\n }\n case 'oklch': {\n const { l, c, h } = rgbToOklch(rgba)\n // Below this chroma the hue is noise from rounding: a grey is written with none.\n const hue = c < 0.0005 ? 0 : h\n return `oklch(${round(l * 100, 1)}% ${round(c, 3)} ${round(hue, 1)}${slash})`\n }\n default: {\n const hex = (n: number) =>\n Math.round(clamp01(n) * 255)\n .toString(16)\n .padStart(2, '0')\n return `#${hex(rgba.r)}${hex(rgba.g)}${hex(rgba.b)}${a < 1 ? hex(a) : ''}`\n }\n }\n}\n\n/** Whether two colours are the same once written in hex, which is how swatches are matched. */\nexport function sameColor(a: Rgba | null, b: Rgba | null, alpha: boolean): boolean {\n return !!a && !!b && formatColor(a, 'hex', alpha) === formatColor(b, 'hex', alpha)\n}\n"],"mappings":";AAWA,IAAa,IAAwC;CAAC;CAAO;CAAO;CAAO;AAAO,GAqB5E,KAAW,MAAc,KAAK,IAAI,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,GACnD,KAAW,OAAgB,IAAI,MAAO,OAAO;AAEnD,SAAgB,EAAS,EAAE,MAAG,MAAG,MAAG,QAAiB;CACnD,IAAM,KAAK,MAAc;EACvB,IAAM,KAAK,IAAI,IAAI,MAAM;EACzB,OAAO,IAAI,IAAI,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC;CACtD;CACA,OAAO;EAAE,GAAG,EAAE,CAAC;EAAG,GAAG,EAAE,CAAC;EAAG,GAAG,EAAE,CAAC;EAAG;CAAE;AACxC;AAGA,SAAgB,EAAS,EAAE,MAAG,MAAG,MAAG,QAAW,IAAM,GAAS;CAC5D,IAAM,IAAM,KAAK,IAAI,GAAG,GAAG,CAAC,GACtB,IAAQ,IAAM,KAAK,IAAI,GAAG,GAAG,CAAC,GAChC,IAAI;CAMR,OALI,IAAQ,MACV,AAEK,IAFD,MAAQ,IAAO,QAAQ,IAAI,KAAK,IAAQ,KAAK,KACxC,MAAQ,IAAO,OAAO,IAAI,KAAK,IAAQ,KACvC,OAAO,IAAI,KAAK,IAAQ,KAE5B;EAAE,GAAG,EAAQ,CAAC;EAAG,GAAG,MAAQ,IAAI,IAAI,IAAQ;EAAK,GAAG;EAAK;CAAE;AACpE;AAEA,SAAS,EAAS,GAAW,GAAW,GAAW,GAAiB;CAClE,IAAM,IAAI,IAAI,IAAI,KAAK,IAAI,GAAG,IAAI,CAAC;CACnC,OAAO,EAAS;EAAE;EAAG,GAAG,MAAM,IAAI,IAAI,KAAK,IAAI,IAAI;EAAI;EAAG;CAAE,CAAC;AAC/D;AAEA,SAAS,EAAS,GAAiD;CACjE,IAAM,EAAE,MAAG,MAAG,SAAM,EAAS,CAAI,GAC3B,IAAI,KAAK,IAAI,IAAI;CACvB,OAAO;EAAE;EAAG,GAAG,MAAM,KAAK,MAAM,IAAI,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;EAAG;CAAE;AAC1E;AAEA,IAAM,KAAY,MAAe,KAAK,SAAU,IAAI,UAAU,IAAI,QAAS,UAAU,KAC/E,KAAW,MAAe,KAAK,WAAY,QAAQ,IAAI,QAAQ,MAAM,IAAI,OAAO;AAGtF,SAAS,EAAW,EAAE,MAAG,MAAG,QAAgD;CAC1E,IAAM,CAAC,GAAI,GAAI,KAAM;EAAC,EAAS,CAAC;EAAG,EAAS,CAAC;EAAG,EAAS,CAAC;CAAC,GACrD,IAAI,KAAK,KAAK,cAAe,IAAK,cAAe,IAAK,cAAe,CAAE,GACvE,IAAI,KAAK,KAAK,cAAe,IAAK,cAAe,IAAK,cAAe,CAAE,GACvE,IAAI,KAAK,KAAK,cAAe,IAAK,cAAe,IAAK,cAAe,CAAE,GACvE,IAAI,cAAe,IAAI,aAAc,IAAI,cAAe,GACxD,IAAI,eAAe,IAAI,cAAc,IAAI,cAAe,GACxD,IAAI,cAAe,IAAI,cAAe,IAAI,aAAc;CAC9D,OAAO;EAAE,GAAG;EAAG,GAAG,KAAK,MAAM,GAAG,CAAC;EAAG,GAAG,EAAS,KAAK,MAAM,GAAG,CAAC,IAAI,MAAO,KAAK,EAAE;CAAE;AACrF;AAEA,SAAS,EAAW,GAAW,GAAW,GAAW,GAAiB;CACpE,IAAM,IAAI,IAAI,KAAK,IAAK,IAAI,KAAK,KAAM,GAAG,GACpC,IAAI,IAAI,KAAK,IAAK,IAAI,KAAK,KAAM,GAAG,GACpC,KAAK,IAAI,cAAe,IAAI,cAAe,MAAM,GACjD,KAAK,IAAI,cAAe,IAAI,cAAe,MAAM,GACjD,KAAK,IAAI,cAAe,IAAI,cAAc,MAAM,GAChD,KAAW,MAAc,EAAQ,EAAQ,CAAC,CAAC;CACjD,OAAO;EACL,GAAG,EAAQ,eAAe,IAAI,eAAe,IAAI,cAAe,CAAC;EACjE,GAAG,EAAQ,gBAAgB,IAAI,eAAe,IAAI,cAAe,CAAC;EAClE,GAAG,EAAQ,eAAgB,IAAI,cAAe,IAAI,cAAc,CAAC;EACjE;CACF;AACF;AAMA,SAAS,EAAW,GAA2B,GAAgC;CAC7E,IAAI,MAAU,KAAA,GAAW,OAAO;CAChC,IAAI,MAAU,QAAQ,OAAO;CAC7B,IAAM,IAAQ,mEAAmE,KAAK,CAAK;CAC3F,IAAI,CAAC,GAAO,OAAO;CACnB,IAAM,IAAI,OAAO,EAAM,EAAE;CACzB,QAAQ,EAAM,IAAd;EACE,KAAK,KACH,OAAQ,IAAI,MAAO;EACrB,KAAK,QACH,OAAO,IAAI;EACb,KAAK,OACH,OAAQ,IAAI,MAAO,KAAK;EAC1B,KAAK,QACH,OAAO,IAAI;EACb,SACE,OAAO;CACX;AACF;AAEA,SAAS,EAAS,GAA0B;CAC1C,IAAI,CAAC,cAAc,KAAK,CAAG,KAAK,CAAC;EAAC;EAAG;EAAG;EAAG;CAAC,CAAC,CAAC,SAAS,EAAI,MAAM,GAAG,OAAO;CAE3E,IAAM,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,MADlB,EAAI,UAAU,IAAI,CAAC,GAAG,CAAG,CAAC,CAAC,KAAK,MAAM,IAAI,CAAC,IAAI,EAAI,MAAM,KAAK,EAAA,CACjC,KAAK,MAAS,SAAS,GAAM,EAAE,IAAI,GAAG;CACjF,OAAO;EAAE;EAAG;EAAG;EAAG;CAAE;AACtB;AAOA,SAAgB,EAAW,GAA+C;CACxE,IAAM,KAAQ,KAAS,GAAA,CAAI,KAAK,CAAC,CAAC,YAAY;CAC9C,IAAI,CAAC,GAAM,OAAO;CAClB,IAAM,IAAK,sCAAsC,KAAK,CAAI;CAC1D,IAAI,CAAC,GAAI,OAAO,EAAS,EAAK,QAAQ,MAAM,EAAE,CAAC;CAE/C,IAAM,CAAC,IAAO,IAAI,GAAW,KAAS,EAAG,EAAE,CAAE,MAAM,GAAG;CACtD,IAAI,MAAU,KAAA,GAAW,OAAO;CAChC,IAAM,IAAO,EAAK,KAAK,CAAC,CAAC,MAAM,aAAa,GACtC,IAAc,MAAc,KAAA,KAAa,EAAK,WAAW,IAAI,EAAK,IAAI,IAAI,KAAA;CAChF,IAAI,EAAK,WAAW,GAAG,OAAO;CAC9B,IAAM,KAAc,KAAa,EAAA,EAAc,KAAK,GAC9C,IAAI,MAAe,KAAA,IAAY,IAAI,EAAW,GAAY,CAAC;CACjE,IAAI,MAAM,MAAM,OAAO;CAEvB,IAAM,IAAO,EAAG;CAChB,IAAI,EAAK,WAAW,KAAK,GAAG;EAC1B,IAAM,CAAC,GAAG,GAAG,KAAK,EAAK,KAAK,MAAQ,EAAW,GAAK,GAAG,CAAC;EAExD,OADI,KAAK,QAAQ,KAAK,QAAQ,KAAK,OAAa,OACzC;GAAE,GAAG,EAAQ,IAAI,GAAG;GAAG,GAAG,EAAQ,IAAI,GAAG;GAAG,GAAG,EAAQ,IAAI,GAAG;GAAG,GAAG,EAAQ,CAAC;EAAE;CACxF;CACA,IAAI,EAAK,WAAW,KAAK,GAAG;EAE1B,IAAM,CAAC,GAAG,GAAG,KAAK;GAAC,EAAW,EAAK,IAAI,GAAG;GAAG,EAAW,EAAK,IAAI,GAAG;GAAG,EAAW,EAAK,IAAI,GAAG;EAAC;EAE/F,OADI,KAAK,QAAQ,KAAK,QAAQ,KAAK,OAAa,OACzC,EAAS,EAAQ,CAAC,GAAG,EAAQ,IAAI,GAAG,GAAG,EAAQ,IAAI,GAAG,GAAG,EAAQ,CAAC,CAAC;CAC5E;CACA,IAAM,CAAC,GAAG,GAAG,KAAK;EAAC,EAAW,EAAK,IAAI,CAAC;EAAG,EAAW,EAAK,IAAI,EAAG;EAAG,EAAW,EAAK,IAAI,GAAG;CAAC;CAE7F,OADI,KAAK,QAAQ,KAAK,QAAQ,KAAK,OAAa,OACzC,EAAW,EAAQ,CAAC,GAAG,KAAK,IAAI,GAAG,CAAC,GAAG,EAAQ,CAAC,GAAG,EAAQ,CAAC,CAAC;AACtE;AAGA,IAAM,KAAS,GAAW,IAAS,MAAM,OAAO,OAAO,EAAE,QAAQ,CAAM,CAAC,CAAC;AAMzE,SAAgB,EAAY,GAAY,GAAqB,IAAQ,IAAe;CAClF,IAAM,IAAI,IAAQ,EAAQ,EAAK,CAAC,IAAI,GAC9B,IAAQ,IAAI,IAAI,MAAM,EAAM,GAAG,CAAC,MAAM;CAC5C,QAAQ,GAAR;EACE,KAAK,OACH,OAAO,OAAO,EAAM,EAAK,IAAI,GAAG,EAAE,GAAG,EAAM,EAAK,IAAI,GAAG,EAAE,GAAG,EAAM,EAAK,IAAI,GAAG,IAAI,EAAM;EAC1F,KAAK,OAAO;GACV,IAAM,EAAE,MAAG,MAAG,SAAM,EAAS,CAAI;GACjC,OAAO,OAAO,EAAM,CAAC,EAAE,GAAG,EAAM,IAAI,GAAG,EAAE,IAAI,EAAM,IAAI,GAAG,EAAE,GAAG,EAAM;EACvE;EACA,KAAK,SAAS;GACZ,IAAM,EAAE,MAAG,MAAG,SAAM,EAAW,CAAI,GAE7B,IAAM,IAAI,OAAS,IAAI;GAC7B,OAAO,SAAS,EAAM,IAAI,KAAK,CAAC,EAAE,IAAI,EAAM,GAAG,CAAC,EAAE,GAAG,EAAM,GAAK,CAAC,IAAI,EAAM;EAC7E;EACA,SAAS;GACP,IAAM,KAAO,MACX,KAAK,MAAM,EAAQ,CAAC,IAAI,GAAG,CAAC,CACzB,SAAS,EAAE,CAAC,CACZ,SAAS,GAAG,GAAG;GACpB,OAAO,IAAI,EAAI,EAAK,CAAC,IAAI,EAAI,EAAK,CAAC,IAAI,EAAI,EAAK,CAAC,IAAI,IAAI,IAAI,EAAI,CAAC,IAAI;EACxE;CACF;AACF;AAGA,SAAgB,EAAU,GAAgB,GAAgB,GAAyB;CACjF,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAY,GAAG,OAAO,CAAK,MAAM,EAAY,GAAG,OAAO,CAAK;AACnF"}
@@ -1,2 +1,2 @@
1
1
  @layer vectis.reset, vectis.tokens, vectis.components, vectis.utilities;
2
- @layer vectis.components{.v-combobox{anchor-scope:--combobox-anchor;width:100%;font-family:var(--vectis-text-family)}.v-combobox-control{display:block}.v-combobox-control .v-input-field{anchor-name:--combobox-anchor}.v-combobox-panel{max-block-size:var(--vectis-control-size-combobox-list-max-block);overflow:auto}.v-combobox-chevron,.v-combobox-spinner{color:var(--vectis-color-text-muted)}.v-combobox-chevron{transition:rotate var(--vectis-duration-fast) var(--vectis-ease-default)}.v-combobox[data-open] .v-combobox-chevron{rotate:180deg}.v-combobox[data-collapsed] .v-input-control{width:0;height:0;padding:0;position:absolute}.v-combobox-text{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;overflow:hidden}.v-combobox:not([data-collapsed]) .v-combobox-text{max-inline-size:50%}.v-combobox-overflow{white-space:nowrap;color:var(--vectis-color-text-muted);flex:none}.v-combobox:has(.v-combobox-text){min-inline-size:0}.v-combobox-state{align-items:center;gap:var(--control-gap);min-height:var(--control-height);padding:var(--vectis-space-1) var(--control-padding-inline);font-size:var(--control-font-size);color:var(--vectis-color-text-muted);flex:none;display:flex}.v-combobox-more{min-height:var(--vectis-control-height-xs);color:var(--vectis-color-text-muted);flex:none;justify-content:center;align-items:center;display:flex}@media (prefers-reduced-motion:reduce){.v-combobox-chevron{transition:none}}}
2
+ @layer vectis.components{.v-combobox{anchor-scope:--combobox-anchor;width:100%;font-family:var(--vectis-text-family)}.v-combobox-control{display:block}.v-combobox-control .v-input-field{anchor-name:--combobox-anchor}.v-combobox-panel{max-block-size:var(--vectis-control-size-combobox-list-max-block)}.v-combobox-spinner{color:var(--vectis-color-text-muted)}.v-combobox[data-collapsed] .v-input-control{width:0;height:0;padding:0;position:absolute}.v-combobox:not([data-collapsed]) .v-listbox-text{max-inline-size:50%}.v-combobox:has(.v-listbox-text){min-inline-size:0}.v-combobox-state{align-items:center;gap:var(--control-gap);min-height:var(--control-height);padding:var(--vectis-space-1) var(--control-padding-inline);font-size:var(--control-font-size);color:var(--vectis-color-text-muted);flex:none;display:flex}.v-combobox-state>.v-combobox-empty[data-size]{padding-block:var(--vectis-space-3);flex:1;padding-inline:0}.v-combobox-more{min-height:var(--vectis-control-height-xs);color:var(--vectis-color-text-muted);flex:none;justify-content:center;align-items:center;display:flex}@media (prefers-reduced-motion:reduce){.v-combobox-chevron{transition:none}}}
@@ -1,41 +1,22 @@
1
- import { ChipSize } from '../VChip/VChip.js';
2
1
  import { IconSource } from '../VIcon/types.js';
3
- import { ItemValue } from '../../types.js';
2
+ import { FieldLabelPosition } from '../VField/VField.js';
3
+ import { ItemValue, ListboxGroup, ListboxItem, ListboxChipSlotProps, ListboxOption, ListboxOptionSlotProps, ListboxOverflowSlotProps, ListboxSeparator } from '../../types.js';
4
4
  /** One thing that can be chosen. */
5
- export interface ComboboxOption {
6
- /**
7
- * What choosing it means: this is what the value holds. A number is admitted because a
8
- * list of options almost always comes from somewhere that keys its rows by one.
9
- */
10
- value: ItemValue;
11
- /** What it is called on screen, and what the search matches against. */
12
- label: string;
13
- /** An icon before the label: an icon name, or an explicit render. */
14
- icon?: IconSource;
15
- /** Shows the option without allowing it to be chosen. */
16
- disabled?: boolean;
17
- }
5
+ export type ComboboxOption = ListboxOption;
18
6
  /**
19
7
  * A named block of options, the equivalent of the grouping a native list offers. A
20
8
  * group none of whose options survive the search disappears entirely, its name
21
9
  * included.
22
10
  */
23
- export interface ComboboxGroup {
24
- /** The name of the block. */
25
- label: string;
26
- /** The options it holds. */
27
- options: ComboboxOption[];
28
- }
11
+ export type ComboboxGroup = ListboxGroup;
29
12
  /**
30
- * A rule drawn between two blocks of options. It is purely decorative, and a separator
31
- * the search leaves stranded (at the top, at the bottom, or against another one) is
32
- * simply not drawn.
13
+ * A rule drawn between two blocks of options. It is purely decorative, and a separator the
14
+ * search leaves stranded (at the top, at the bottom, or against another one) is simply not
15
+ * drawn.
33
16
  */
34
- export interface ComboboxSeparator {
35
- separator: true;
36
- }
17
+ export type ComboboxSeparator = ListboxSeparator;
37
18
  /** Anything the list may hold: an option, a named block, or a separator. */
38
- export type ComboboxItem = ComboboxOption | ComboboxGroup | ComboboxSeparator;
19
+ export type ComboboxItem = ListboxItem;
39
20
  /**
40
21
  * How the list is narrowed as one types: by the component itself, not at all (when the
41
22
  * options already arrive filtered by a server), or by a rule of your own.
@@ -51,27 +32,11 @@ export type ComboboxSize = 'sm' | 'md' | 'lg';
51
32
  */
52
33
  export type ComboboxDisplay = 'chip' | 'text';
53
34
  /** What the `#option` slot receives. */
54
- export interface ComboboxOptionSlotProps {
55
- option: ComboboxOption;
56
- index: number;
57
- active: boolean;
58
- selected: boolean;
59
- }
35
+ export type ComboboxOptionSlotProps = ListboxOptionSlotProps;
60
36
  /** What the `#chip` slot receives. */
61
- export interface ComboboxChipSlotProps {
62
- value: ItemValue;
63
- option: ComboboxOption | undefined;
64
- label: string;
65
- remove: () => void;
66
- size: ChipSize;
67
- compact: boolean;
68
- }
37
+ export type ComboboxChipSlotProps = ListboxChipSlotProps;
69
38
  /** What the `#overflow` slot receives. */
70
- export interface ComboboxOverflowSlotProps {
71
- count: number;
72
- size: ChipSize;
73
- compact: boolean;
74
- }
39
+ export type ComboboxOverflowSlotProps = ListboxOverflowSlotProps;
75
40
  /** What the `#empty` slot receives. */
76
41
  export interface ComboboxEmptySlotProps {
77
42
  query: string;
@@ -110,6 +75,21 @@ interface ComboboxProps {
110
75
  * so it is read out along with the label.
111
76
  */
112
77
  hint?: string;
78
+ /**
79
+ * A message saying what is wrong with the value, shown in place of the hint so that the field
80
+ * does not grow. It marks the field invalid, is read along with it, and is announced when it
81
+ * appears or changes.
82
+ */
83
+ error?: string;
84
+ /** Marks the field as required: an asterisk follows the label, and the field is `required`. */
85
+ required?: boolean;
86
+ /** Hides the label visually. It still names the field for assistive technology. */
87
+ hideLabel?: boolean;
88
+ /**
89
+ * Where the label sits: above the field (`top`, the default), or at its start, in a column of
90
+ * its own, moving back above when there is not room for both.
91
+ */
92
+ labelPosition?: FieldLabelPosition;
113
93
  /** The height of the field: 32, 40 or 48 pixels. */
114
94
  size?: ComboboxSize;
115
95
  /** Takes 4px off the height, as everywhere else in the design system. */
@@ -138,18 +118,14 @@ interface ComboboxProps {
138
118
  * explicit render.
139
119
  */
140
120
  expandIcon?: IconSource;
141
- /**
142
- * Leaves the chevron out, for a field that reads as a search box with suggestions rather than
143
- * as a list to pick from.
144
- */
145
- hideExpandIcon?: boolean;
146
121
  /** Offers a cross that empties both the selection and the search. */
147
122
  clearable?: boolean;
148
123
  /** What that cross does, in words. It falls back to the design system dictionary. */
149
124
  clearLabel?: string;
150
125
  /**
151
- * What the panel says when the search matches nothing. It is also what a screen reader
152
- * hears, even when the `#empty` slot draws something else: set both together.
126
+ * The title of the empty state the panel shows when the search matches nothing. It is also
127
+ * what a screen reader hears, even when the `#empty` slot draws something else: set both
128
+ * together.
153
129
  */
154
130
  emptyText?: string;
155
131
  /** How the list is narrowed as one types. */
@@ -175,6 +151,12 @@ interface ComboboxProps {
175
151
  * the end of the list comes into view.
176
152
  */
177
153
  hasMore?: boolean;
154
+ /**
155
+ * Renders only the rows near the visible part of the panel, for lists of thousands of options.
156
+ * Rows are measured as they render, so a custom `#option` may vary in height. Options are then
157
+ * announced with their position in the list.
158
+ */
159
+ virtual?: boolean;
178
160
  /** Where the list opens relative to the field. */
179
161
  placement?: ComboboxPlacement;
180
162
  }
@@ -229,25 +211,29 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {
229
211
  loading: boolean;
230
212
  label: string;
231
213
  placeholder: string;
214
+ error: string;
232
215
  size: ComboboxSize;
233
216
  filter: ComboboxFilter;
234
- display: ComboboxDisplay;
235
- placement: ComboboxPlacement;
236
217
  compact: boolean;
237
- disabled: boolean;
238
218
  iconStart: IconSource;
239
- invalid: boolean;
219
+ disabled: boolean;
220
+ required: boolean;
240
221
  multiple: boolean;
222
+ display: ComboboxDisplay;
223
+ placement: ComboboxPlacement;
224
+ invalid: boolean;
241
225
  hint: string;
226
+ hideLabel: boolean;
227
+ labelPosition: FieldLabelPosition;
242
228
  readonly: boolean;
243
229
  iconStartLabel: string;
244
230
  loadingText: string;
245
231
  clearable: boolean;
246
232
  clearLabel: string;
247
- expandIcon: IconSource;
248
233
  max: number;
234
+ expandIcon: IconSource;
235
+ virtual: boolean;
249
236
  overflowText: (count: number) => string;
250
- hideExpandIcon: boolean;
251
237
  emptyText: string;
252
238
  searchDebounce: number;
253
239
  hasMore: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"VCombobox.js","names":[],"sources":["../../../src/components/VCombobox/VCombobox.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @a11y @keyboard @core\n/**\n * Keep DOM focus on the field and move aria-activedescendant through options. JavaScript\n * supplies filtering, selection and keyboard navigation unavailable to native text inputs.\n */\n\nimport { computed, inject, reactive, ref, useId, watch, watchEffect } from 'vue'\n\nimport VChip from '../VChip/VChip.vue'\nimport type { ChipSize } from '../VChip/VChip.vue'\nimport VIcon from '../VIcon/VIcon.vue'\nimport { iconProps } from '../VIcon/iconProps'\nimport { expand_more as expandMoreIcon } from '../VIcon/icons/expand_more'\nimport type { IconSource } from '../VIcon/types'\nimport VInput from '../VInput/VInput.vue'\nimport VPopover from '../VPopover/VPopover.vue'\nimport VComboboxOption from './VComboboxOption.vue'\nimport VComboboxGroup from './VComboboxGroup.vue'\nimport VComboboxSeparator from './VComboboxSeparator.vue'\nimport { useInfiniteScroll } from './infiniteScroll'\nimport VSpinner from '../VSpinner/VSpinner.vue'\n\nimport { toggleValue } from '../../utils/array'\nimport type { ItemValue } from '../../types'\nimport { inputGroupKey } from '../VInput/context'\n\nimport { chipScaleFor } from '../../utils/chip'\nimport { createNormalizedCache, normalizeText } from '../../utils/text'\n\nimport { useControlShape } from '../../composables/useControlShape'\nimport { useRootAttrs } from '../../composables/useRootAttrs'\n\nimport { useFocusoutDismiss } from '../../composables/useFocusoutDismiss'\n\nimport { canClear } from '../../composables/useClearable'\nimport { iconStartListener } from '../../composables/useIconClickHandlers'\n\nimport { useTimer } from '../../composables/useTimer'\nimport { useMessages } from '../../i18n/state'\n\n/** One thing that can be chosen. */\nexport interface ComboboxOption {\n /**\n * What choosing it means: this is what the value holds. A number is admitted because a\n * list of options almost always comes from somewhere that keys its rows by one.\n */\n value: ItemValue\n /** What it is called on screen, and what the search matches against. */\n label: string\n /** An icon before the label: an icon name, or an explicit render. */\n icon?: IconSource\n /** Shows the option without allowing it to be chosen. */\n disabled?: boolean\n}\n\n/**\n * A named block of options, the equivalent of the grouping a native list offers. A\n * group none of whose options survive the search disappears entirely, its name\n * included.\n */\nexport interface ComboboxGroup {\n /** The name of the block. */\n label: string\n /** The options it holds. */\n options: ComboboxOption[]\n}\n\n/**\n * A rule drawn between two blocks of options. It is purely decorative, and a separator\n * the search leaves stranded (at the top, at the bottom, or against another one) is\n * simply not drawn.\n */\nexport interface ComboboxSeparator {\n separator: true\n}\n\n/** Anything the list may hold: an option, a named block, or a separator. */\nexport type ComboboxItem = ComboboxOption | ComboboxGroup | ComboboxSeparator\n\nconst isGroup = (item: ComboboxItem): item is ComboboxGroup => 'options' in item\nconst isSeparator = (item: ComboboxItem): item is ComboboxSeparator => 'separator' in item\n\n/**\n * How the list is narrowed as one types: by the component itself, not at all (when the\n * options already arrive filtered by a server), or by a rule of your own.\n */\nexport type ComboboxFilter = boolean | ((option: ComboboxOption, query: string) => boolean)\n\n/** Where the list opens relative to the field. */\nexport type ComboboxPlacement =\n 'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end'\n\n/** The height of the field: 32, 40 or 48 pixels. */\nexport type ComboboxSize = 'sm' | 'md' | 'lg'\n\n/**\n * How the chosen values are shown in a multiple field: one chip each, or their labels\n * joined by commas.\n */\nexport type ComboboxDisplay = 'chip' | 'text'\n\n/** What the `#option` slot receives. */\nexport interface ComboboxOptionSlotProps {\n option: ComboboxOption\n index: number\n active: boolean\n selected: boolean\n}\n\n/** What the `#chip` slot receives. */\nexport interface ComboboxChipSlotProps {\n value: ItemValue\n option: ComboboxOption | undefined\n label: string\n remove: () => void\n size: ChipSize\n compact: boolean\n}\n\n/** What the `#overflow` slot receives. */\nexport interface ComboboxOverflowSlotProps {\n count: number\n size: ChipSize\n compact: boolean\n}\n\n/** What the `#empty` slot receives. */\nexport interface ComboboxEmptySlotProps {\n query: string\n}\n\ninterface ComboboxProps {\n /**\n * What the list offers. An entry may be an option, a named block of options, or a\n * separator; a plain list of options remains perfectly valid.\n */\n options: ComboboxItem[]\n /**\n * Allows several values to be chosen, which makes the value a list and shows what has\n * been chosen inside the field, as chips or as text depending on `display`.\n */\n multiple?: boolean\n /**\n * How the chosen values are shown when several can be chosen: one dismissible chip each, or\n * their labels joined by commas on a single line, cut short with an ellipsis when they run\n * out of room.\n */\n display?: ComboboxDisplay\n /**\n * How many chosen values to show before the rest are summed up as \"+X\", as chips or as text\n * alike. Left out, or set to 0, every value is shown.\n */\n max?: number\n /**\n * Rephrases the \"+X\" standing for the values beyond `max`, \"+5 products\" for instance.\n * It receives the number of values being hidden.\n */\n overflowText?: (count: number) => string\n /** The label above the field, tied to it so that clicking it focuses the field. */\n label?: string\n /**\n * A line of help under the field. It is tied to the field for assistive technology,\n * so it is read out along with the label.\n */\n hint?: string\n /** The height of the field: 32, 40 or 48 pixels. */\n size?: ComboboxSize\n /** Takes 4px off the height, as everywhere else in the design system. */\n compact?: boolean\n /** What the field says while nothing is chosen and nothing has been typed. */\n placeholder?: string\n /** Makes the field unusable, greyed out through the colour tokens. */\n disabled?: boolean\n /**\n * Shows what has been chosen without letting it be changed: nothing can be typed, the list\n * never opens, the chips lose their crosses and no clear cross is offered.\n */\n readonly?: boolean\n /** Marks the field as invalid, for a rule of your own. */\n invalid?: boolean\n /**\n * An icon inside the field, at the start, before the chips when several values can\n * be chosen. It is decorative by default and becomes a real button as soon as a\n * `@click:icon-start` listener is attached, in which case it needs `iconStartLabel`.\n */\n iconStart?: IconSource\n /** What the start icon does, in words, once it is clickable. */\n iconStartLabel?: string\n /**\n * The chevron at the end of the field, which turns as the list opens: an icon name, or an\n * explicit render.\n */\n expandIcon?: IconSource\n /**\n * Leaves the chevron out, for a field that reads as a search box with suggestions rather than\n * as a list to pick from.\n */\n hideExpandIcon?: boolean\n /** Offers a cross that empties both the selection and the search. */\n clearable?: boolean\n /** What that cross does, in words. It falls back to the design system dictionary. */\n clearLabel?: string\n /**\n * What the panel says when the search matches nothing. It is also what a screen reader\n * hears, even when the `#empty` slot draws something else: set both together.\n */\n emptyText?: string\n /** How the list is narrowed as one types. */\n filter?: ComboboxFilter\n /**\n * How long to wait before telling the source what is being searched for, in\n * milliseconds. Zero tells it at once, which suits a source that is not a network\n * request.\n */\n searchDebounce?: number\n /**\n * Says that something is being loaded. Either way the field replaces its chevron with a\n * spinner.\n */\n loading?: boolean\n /**\n * What is said while loading, and what the spinner is announced as. A screen reader hears\n * it even when the `#loading` slot draws something else: set both together.\n */\n loadingText?: string\n /**\n * Says that there are more pages to come, which makes the component ask for the next one as\n * the end of the list comes into view.\n */\n hasMore?: boolean\n /** Where the list opens relative to the field. */\n placement?: ComboboxPlacement\n}\n\nconst props = withDefaults(defineProps<ComboboxProps>(), {\n multiple: false,\n display: 'chip',\n max: undefined,\n overflowText: undefined,\n label: undefined,\n hint: undefined,\n size: 'md',\n compact: false,\n placeholder: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n iconStart: undefined,\n iconStartLabel: undefined,\n expandIcon: () => expandMoreIcon,\n hideExpandIcon: false,\n clearable: false,\n clearLabel: undefined,\n emptyText: undefined,\n filter: true,\n searchDebounce: 250,\n loading: false,\n loadingText: undefined,\n hasMore: false,\n placement: 'bottom-start',\n})\n\nconst m = useMessages()\nconst resolvedEmptyText = computed(() => props.emptyText ?? m.value.combobox.empty)\nconst resolvedClearLabel = computed(() => props.clearLabel ?? m.value.combobox.clear)\nconst resolvedLoadingText = computed(() => props.loadingText ?? m.value.common.loading)\n\nconst emit = defineEmits<{\n /** What is being searched for, to be sent to the source. */\n search: [query: string]\n /** The end of the list has come into view: send the next page. */\n 'load-more': []\n /** The clear cross emptied the selection and the search. */\n clear: []\n /** The start icon was clicked. Attaching this listener is what makes it a button. */\n 'click:icon-start': [event: MouseEvent]\n}>()\n\ndefineSlots<{\n /**\n * Content at the start of the field, rendered after the chips standing for the chosen\n * values rather than in their place.\n */\n start?(): unknown\n /**\n * Controls of your own inside the field, placed before the ones the field owns: the clear\n * cross and the chevron.\n */\n 'value-end'?(): unknown\n /** What a row of the list shows, in place of the plain label: a subtitle, an avatar, a badge. */\n option?(props: ComboboxOptionSlotProps): unknown\n /** Replaces the chip standing for one chosen value. */\n chip?(props: ComboboxChipSlotProps): unknown\n /** Replaces the \"+X\" standing for the values beyond `max`. */\n overflow?(props: ComboboxOverflowSlotProps): unknown\n /** What the panel shows when nothing matches. It receives the term that was searched. */\n empty?(props: ComboboxEmptySlotProps): unknown\n /** What the panel shows while loading its first options. */\n loading?(): unknown\n}>()\n\n// Everything below reads the RESOLVED values and never the props: the chips, the panel and the\n// field would otherwise come out at three different scales inside the same row.\nconst group = inject(inputGroupKey, null)\nconst {\n size: resolvedSize,\n compact: resolvedCompact,\n disabled: resolvedDisabled,\n} = useControlShape(props, group)\n\n// The size, the density and the HEIGHT of the chips sitting inside the field, worked out\n// once in `utils/chip.ts` and shared with VFileInput. The height is set inline below\n// rather than restated as a table of CSS rules: it is the height the field forces on its\n// input, and deriving both from the same pair is what stops them drifting apart.\nconst chipScale = computed(() => chipScaleFor(resolvedSize.value, resolvedCompact.value))\n\n/** The chosen option's `value`, or the list of them when `multiple` is set. */\nconst model = defineModel<ItemValue | ItemValue[]>({ default: '' })\n\n// `class` and `style` stay on the wrapper, where a consumer expects to style the component;\n// everything else; a name above all; goes down to the text field, which is the element\n// assistive technology treats as the combobox.\ndefineOptions({ inheritAttrs: false })\nconst { rootClass, rootStyle, forwardedAttrs } = useRootAttrs()\n\n// Declared as this component's own event, `click:icon-start` is out of `$attrs`, so the\n// listener is relayed to the field by hand; and only when the consumer wrote one.\nconst iconStartClick = iconStartListener((event) => emit('click:icon-start', event))\n\n/** What reaches the field: the consumer's own attributes, plus that listener. */\nconst fieldAttrs = computed(() => ({ ...forwardedAttrs.value, ...iconStartClick }))\n\nconst rootEl = ref<HTMLElement | null>(null)\nconst inputRef = ref<InstanceType<typeof VInput> | null>(null)\n// One generated identifier serves twice: as the panel's own id, which the field points\n// at, and as the prefix of every option's id. The two strings can never collide, one\n// being a prefix of longer ones.\nconst optionsId = useId()\n\nconst open = ref(false)\nconst query = ref('')\nconst activeIndex = ref(-1)\nconst focused = ref(false)\n// The text in the field serves two purposes at once: it SHOWS the chosen label when a single\n// value is picked, and it is what one searches with. This flag tells the two apart; while it is\n// false the text is merely a label and narrows nothing, so reopening the panel offers the whole\n// list again.\nconst typed = ref(false)\n\nconst selectedValues = computed<ItemValue[]>(() => {\n if (props.multiple) return Array.isArray(model.value) ? model.value : []\n // An empty string is what an emptied combobox says, and it is not a value. A NUMBER, on the\n // other hand, is a value even at zero; hence the test on the empty string alone rather than\n // on falsiness, which would drop the option keyed `0`.\n return !Array.isArray(model.value) && model.value !== '' ? [model.value] : []\n})\n\n// Every option, flattened: the blocks unwrapped, the separators dropped, in the order they were\n// given. This is the ONE reading of the options the rest of the component does; the filtering,\n// the memory of what was chosen, the labels and the paging all ignore the hierarchy entirely.\nconst allOptions = computed<ComboboxOption[]>(() =>\n props.options.flatMap((item) => {\n if (isSeparator(item)) return []\n return isGroup(item) ? item.options : [item]\n }),\n)\n\n// With a source that answers over the network, the options only ever hold the latest results,\n// and something already chosen is usually absent from them; without this, a chip would show a\n// raw identifier instead of a name, and a custom chip would lose the option's icon. It is kept\n// up to date by an effect rather than by watching the options, because the effect tracks the\n// ITERATION and therefore also notices a page appended in place.\nconst optionCache = reactive(new Map<ItemValue, ComboboxOption>())\nwatchEffect(() => {\n const wanted = new Set(selectedValues.value)\n for (const option of allOptions.value) {\n if (wanted.has(option.value)) optionCache.set(option.value, option)\n }\n // Without this the memory would grow with every value chosen during the session rather than\n // with the current selection; a slow leak in a long-lived multiple field fed by a paginated\n // source.\n for (const value of optionCache.keys()) if (!wanted.has(value)) optionCache.delete(value)\n})\n\n/*\n * A lookup from value to option, built once per list of options rather than searched each time.\n * Finding an option is done several times per chip and per render; for the chip itself, its\n * label and the name of its remove button; so a linear search here would cost the number of\n * chips times the number of options, on every keystroke.\n */\nconst optionsByValue = computed(() => {\n const map = new Map<ItemValue, ComboboxOption>()\n for (const option of allOptions.value) if (!map.has(option.value)) map.set(option.value, option)\n return map\n})\n\n/**\n * The selection as a set, so that asking \"is this one chosen?\" costs nothing however many are;\n * the same device VDataTable uses for its selected rows.\n */\nconst selectedSet = computed(() => new Set(selectedValues.value))\n\n/**\n * An option coming from that memory is a reactive PROXY, since making the map reactive converts\n * the objects inside it. Compare options by their value and never by identity, or the two forms\n * of the same option will not match.\n */\nfunction optionOf(value: ItemValue) {\n return optionsByValue.value.get(value) ?? optionCache.get(value)\n}\n\nfunction labelOf(value: ItemValue) {\n return optionOf(value)?.label ?? String(value)\n}\n\n/*\n * Reading the label on every call is what keeps the filter reactive: flattening the options\n * only ever touches the containers, so a label changed in place would go unnoticed by anything\n * keyed on the list.\n */\nconst normalizedOf = createNormalizedCache<ComboboxOption>()\nconst normalizedLabelOf = (option: ComboboxOption) => normalizedOf(option, option.label)\n\n// ONE search term, read both by the local filter and by what is sent to the source: the\n// list on screen and the request in flight therefore cannot describe different searches.\n// With nothing typed the term is empty, so a label merely being displayed never narrows\n// the list.\nconst searchTerm = computed(() => (typed.value ? query.value.trim() : ''))\n\n// Closing empties `searchTerm` (the typing flag drops) in the same tick as it hides the panel,\n// but the panel fades out rather than vanishing. Filtered on the live term, the list would\n// spring back to every option during that fade, and the panel grow under the pointer that just\n// chose.\nconst closedTerm = ref<string | null>(null)\n\n// This is what the keyboard counts through: blocks and separators do not appear in it, which is\n// exactly why the arrows never stop on one.\nconst filtered = computed(() => {\n const matcher = props.filter\n const list = allOptions.value\n if (matcher === false) return list\n const q = closedTerm.value ?? searchTerm.value\n if (!q) return list\n if (typeof matcher === 'function') return list.filter((o) => matcher(o, q))\n const needle = normalizeText(q)\n return list.filter((o) => normalizedLabelOf(o).includes(needle))\n})\n\n// @a11y\n/**\n * What is announced about the state of the panel; that nothing matches, or that something is\n * loading.\n */\nconst stateAnnouncement = computed(() => {\n if (!open.value || filtered.value.length > 0) return ''\n return props.loading ? resolvedLoadingText.value : resolvedEmptyText.value\n})\n\n// Each option there carries its index in `filtered` (and not its position in the tree): ids,\n// highlight and the #option slot stay aligned on the keyboard navigation.\ntype RenderedOption = { kind: 'option'; key: string; option: ComboboxOption; index: number }\ntype RenderedNode =\n | RenderedOption\n | { kind: 'group'; key: string; label: string; options: RenderedOption[] }\n | { kind: 'separator'; key: string }\n\n// Nothing here is keyed by VALUE. Two options may share one (a consumer's duplicate, or `1`\n// beside `'1'`, which a template literal spells the same), and a value-keyed index hands both\n// the same position, so both light up as active and Vue patches two rows under one key.\nconst rendered = computed<RenderedNode[]>(() => {\n const kept = new Set(filtered.value)\n let next = 0\n\n const entryOf = (option: ComboboxOption, key: string): RenderedOption | null => {\n if (!kept.has(option)) return null\n return { kind: 'option', key: `option:${key}`, option, index: next++ }\n }\n\n const nodes: RenderedNode[] = []\n // A separator is held back and only drawn once something has come before it and something\n // comes after it. That single rule covers all three ways the filtering can strand one: at the\n // top of the list, at the bottom, and two in a row.\n let pendingSeparator: string | null = null\n\n for (const [i, item] of props.options.entries()) {\n if (isSeparator(item)) {\n if (nodes.length > 0) pendingSeparator = `sep:${i}`\n continue\n }\n\n let node: RenderedNode | null\n if (isGroup(item)) {\n const options = item.options\n .map((option, j) => entryOf(option, `${i}.${j}`))\n .filter((entry): entry is RenderedOption => entry !== null)\n // A block none of whose options survived is dropped entirely, its name included:\n // a heading over nothing is worse than no heading.\n node =\n options.length > 0 ? { kind: 'group', key: `group:${i}`, label: item.label, options } : null\n } else {\n node = entryOf(item, String(i))\n }\n if (!node) continue\n\n if (pendingSeparator !== null) {\n nodes.push({ kind: 'separator', key: pendingSeparator })\n pendingSeparator = null\n }\n nodes.push(node)\n }\n\n return nodes\n})\n\n// Nothing native waits before sending a request, or refrains from sending the same one twice,\n// so both have to be written. The waiting itself is delegated to `useTimer`; re-arming, a delay\n// of zero running at once, cancellation when the component goes away; and what stays here is\n// specific to this component: not repeating a term, and giving up when the panel closes.\nconst searchTimer = useTimer()\n// The last term actually sent, or nothing if none ever was. It is what stops reopening the\n// panel on an unchanged term from firing the request again; a consumer with a cache of their\n// own is of course free to answer instantly.\nlet lastEmitted: string | undefined\n\nconst cancelSearch = searchTimer.cancel\n\nfunction emitSearch(term: string, immediate = false) {\n cancelSearch()\n if (term === lastEmitted) return\n searchTimer.start(\n () => {\n // The panel may have closed while we were waiting: there is then nothing left to load,\n // and the check has to happen here rather than before arming the timer.\n if (!open.value) return\n lastEmitted = term\n emit('search', term)\n },\n immediate ? 0 : props.searchDebounce,\n )\n}\n\nwatch(searchTerm, (term) => {\n if (!open.value) return\n // A new search means a new list, so the highlight cannot survive it: with an outside source\n // the options are replaced wholesale, and the old position would name a completely unrelated\n // option. It is moved to the first available option rather than dropped altogether, and that\n // matters when the filtering is left to the source: the visible list keeps the very same\n // reference until the answer arrives, so the watcher below would never fire and Enter would\n // do nothing in the meantime.\n activeIndex.value = filtered.value.findIndex((o) => !o.disabled)\n // The page asked for under the previous term will never arrive, and the first page of the new\n // one may be exactly as long as the list it replaces; which the paging would not recognise as\n // an arrival.\n infiniteScroll.restart()\n emitSearch(term)\n})\n\nwatch(filtered, (list) => {\n // While the panel is open there must always be a valid option highlighted. It is moved back\n // to the first result whenever the highlighted one has fallen out of the list or there was\n // none at all; without that second case, a search that passed through \"no result\" would leave\n // nothing highlighted, and Enter would not choose the single result that came back.\n if (!open.value) return\n if (activeIndex.value < 0 || activeIndex.value >= list.length) {\n activeIndex.value = list.findIndex((o) => !o.disabled)\n }\n})\n\n// With a single value, the field shows its label as ordinary text whenever it is not being\n// edited. Read through `selectedValues`, which knows that a number is a value even at zero: a\n// test on the string type would leave a numeric value unlabelled.\nfunction singleLabel() {\n const value = props.multiple ? undefined : selectedValues.value[0]\n return value === undefined ? '' : labelOf(value)\n}\n\nquery.value = singleLabel()\n\n// Refresh copied selection labels when options arrive or the parent updates the value.\n// Post-flush timing reads the accepted model after rendering.\nwatch(\n [allOptions, selectedValues],\n () => {\n if (props.multiple || open.value || typed.value) return\n query.value = singleLabel()\n },\n { flush: 'post' },\n)\n\n/** The chosen values are spelled out as one line of text rather than drawn as chips. */\nconst textDisplay = computed(() => props.multiple && props.display === 'text')\n\n// A read-only TEXT display keeps it folded under the focus too: nothing can be typed, and the\n// input's share of the row would only cut the line of values short for nothing.\nconst collapsed = computed(\n () =>\n props.multiple &&\n selectedValues.value.length > 0 &&\n (!focused.value || (textDisplay.value && props.readonly)),\n)\n\n// Unfolded, the reader is working on the selection, and every value must be there to be seen\n// and taken back; Backspace included, which would otherwise remove a value hidden behind the\n// \"+X\". `max: 0` means no limit, as on VAvatarGroup: a truthiness test, never `!= null`, which\n// would hide every value.\nconst visibleValues = computed(() =>\n collapsed.value && props.max ? selectedValues.value.slice(0, props.max) : selectedValues.value,\n)\nconst overflowCount = computed(() => selectedValues.value.length - visibleValues.value.length)\n\n// Digits and a plus sign stay out of the dictionary, as VAvatarGroup's \"+N\" does: rephrasing\n// goes through `overflowText` or the `#overflow` slot.\nconst resolvedOverflowText = computed(() =>\n props.overflowText ? props.overflowText(overflowCount.value) : `+${overflowCount.value}`,\n)\n\n// The comma is universal punctuation rather than a word, so it stays out of the dictionary,\n// as in VFileInput's own text display.\nconst displayText = computed(() =>\n textDisplay.value ? visibleValues.value.map(labelOf).join(', ') : '',\n)\n\n// The field cannot work that out for itself, since the chips live outside its value, so the\n// answer is given to it explicitly, and the room for the cross is reserved accordingly.\nconst clearVisible = computed(() =>\n canClear(\n props,\n resolvedDisabled.value,\n selectedValues.value.length > 0 || query.value.length > 0,\n ),\n)\n\n// @a11y\n// An option's id follows the OPTION, from its place among all the options, and never its place\n// in the filtered list: a screen reader announces the current option when\n// `aria-activedescendant` changes, and a positional id would keep the same value while the\n// filter slides another option under the highlight, which then goes unannounced. Still indexed\n// by the filtered position, which the keyboard counts through.\nconst sourceIndex = computed(() => new Map(allOptions.value.map((option, i) => [option, i])))\nconst optionId = (index: number) => {\n const option = filtered.value[index]\n return `${optionsId}-option-${option ? sourceIndex.value.get(option) : index}`\n}\n\n/**\n * A rendered option with its state worked out, once per row: `row` is what the option element\n * takes, `slot` what the `#option` slot receives, and both read the same two answers.\n */\ntype OptionRow = RenderedOption & {\n row: { id: string; icon?: IconSource; active: boolean; selected: boolean; disabled?: boolean }\n slot: { option: ComboboxOption; index: number; active: boolean; selected: boolean }\n}\ntype RowNode =\n | OptionRow\n | { kind: 'group'; key: string; label: string; options: OptionRow[] }\n | { kind: 'separator'; key: string }\n\nfunction withState(entry: RenderedOption): OptionRow {\n const active = entry.index === activeIndex.value\n const selected = selectedSet.value.has(entry.option.value)\n return {\n ...entry,\n row: {\n id: optionId(entry.index),\n icon: entry.option.icon,\n active,\n selected,\n disabled: entry.option.disabled,\n },\n slot: { option: entry.option, index: entry.index, active, selected },\n }\n}\n\n// A row has to be written twice in the template, once inside a block and once at the top level\n// of the panel, a Vue template having no way to declare a reusable fragment. Kept apart from\n// `rendered` on purpose: the highlight moves on every arrow key, and only this cheap pass over\n// the tree follows it; the filtering and the grouping stay where they are.\nconst rows = computed<RowNode[]>(() =>\n rendered.value.map((node) => {\n if (node.kind === 'option') return withState(node)\n if (node.kind === 'group') return { ...node, options: node.options.map(withState) }\n return node\n }),\n)\n\nfunction hover(entry: RenderedOption) {\n if (!entry.option.disabled) activeIndex.value = entry.index\n}\n\n// @a11y\n// Since the focus never leaves the field, the browser has no reason to scroll the highlighted\n// option into view; nothing was focused. It is brought into view by hand instead, and asked for\n// the SMALLEST movement that reveals it, so an option already visible does not make the panel\n// jump.\nwatch(\n activeIndex,\n (index) => {\n if (index < 0) return\n // Called optionally: the unit-test environment implements no scrolling at all.\n document.getElementById(optionId(index))?.scrollIntoView?.({ block: 'nearest' })\n },\n { flush: 'post' },\n)\n\n// The single cut-off point of a frozen field: every route into the list; a click on the\n// control, the focus, a keystroke, typing; ends up here, so `readonly` is refused once rather\n// than guarded in each handler.\nfunction openPanel() {\n if (resolvedDisabled.value || props.readonly || open.value) return\n closedTerm.value = null\n open.value = true\n const list = filtered.value\n const selectedIdx = list.findIndex((o) => !o.disabled && selectedSet.value.has(o.value))\n activeIndex.value = selectedIdx >= 0 ? selectedIdx : list.findIndex((o) => !o.disabled)\n // Told to the source after the panel is marked open; the delayed emission checks that flag\n // before firing; which lets an outside source load its first page as the panel appears.\n emitSearch(searchTerm.value, true)\n}\n\n// Asking for the next page as the end of the list is reached. The observer itself, its\n// re-arming after each page and the lock that stops it firing twice all live in\n// `./infiniteScroll`; it is declared here so that closing the panel can reset it.\nconst sentinelEl = ref<HTMLElement | null>(null)\n\nconst infiniteScroll = useInfiniteScroll({\n sentinelEl,\n canLoad: () => open.value && props.hasMore && !props.loading,\n loaded: () => allOptions.value,\n onLoadMore: () => emit('load-more'),\n})\n\nfunction closePanel() {\n if (!open.value) return\n cancelSearch()\n // A page that never arrived; a request that failed; must not leave the paging frozen for\n // good, so the lock is released here.\n infiniteScroll.reset()\n closedTerm.value = searchTerm.value\n open.value = false\n activeIndex.value = -1\n typed.value = false\n query.value = singleLabel()\n}\n\nwatch(\n () => props.readonly || resolvedDisabled.value,\n (frozen) => {\n if (frozen) closePanel()\n },\n)\n\n/**\n * Closes as soon as the focus leaves the component; the panel included, which is a descendant\n * of it even while floating above the page.\n */\nconst onFocusout = useFocusoutDismiss(rootEl, closePanel)\n\n// @a11y\n/*\n * The focus must never leave the field, and this is what prevents it. Without cancelling the\n * press, clicking an option takes the focus off the field, the handler above closes the panel\n * before the click is turned into a selection, and choosing with the mouse stops working\n * entirely.\n */\nfunction onPanelMousedown(event: MouseEvent) {\n event.preventDefault()\n}\n\n/** The reader is typing: the text becomes a search, and the panel opens. */\nfunction onInput() {\n typed.value = true\n openPanel()\n}\n\n/**\n * With a single value chosen, the label shown in the field is selected on focus, so that typing\n * replaces it rather than appending to it; and until something IS typed, the whole list stays\n * on offer.\n */\nfunction selectQuery() {\n if (!props.multiple && query.value) inputRef.value?.select()\n}\n\nfunction onFocus() {\n focused.value = true\n selectQuery()\n}\n\n/** Whether a pointer event landed on the chevron, or on the spinner standing in its place. */\nconst onChevron = (event: Event) =>\n event.target instanceof Element &&\n event.target.closest('.v-combobox-chevron, .v-combobox-spinner') !== null\n\n// @core\n/*\n * The chevron is not focusable, so pressing it would hand the focus to the page: the root's\n * `focusout` then closes the panel, and the click that follows reopens it. A click meant to\n * close would flash the list instead.\n */\nfunction onControlMousedown(event: MouseEvent) {\n if (onChevron(event)) event.preventDefault()\n}\n\n/**\n * A click anywhere on the field focuses it and opens the panel; except on the chevron of an\n * open panel, which closes it.\n */\nfunction onControlClick(event: MouseEvent) {\n if (resolvedDisabled.value) return\n inputRef.value?.focus()\n if (open.value && onChevron(event)) {\n closePanel()\n return\n }\n openPanel()\n // Selected again after the click, which has just placed the caret somewhere in the middle of\n // the label.\n selectQuery()\n}\n\nfunction select(option: ComboboxOption) {\n if (option.disabled || props.readonly || resolvedDisabled.value) return\n // Remembered immediately: the option may vanish from the list; on the next search; before the\n // parent has even passed the new value back down.\n optionCache.set(option.value, option)\n if (!props.multiple) closedTerm.value = searchTerm.value\n typed.value = false\n if (props.multiple) {\n model.value = toggleValue(selectedValues.value, option.value)\n query.value = ''\n inputRef.value?.focus()\n } else {\n model.value = option.value\n // This path does not go through the closing function, so the pending search has to be\n // cancelled here as well; otherwise the last keystroke would fire its request after the\n // panel had closed. The paging lock goes for the same reason: a page still on its way when\n // the panel shut would otherwise freeze it on the next opening.\n cancelSearch()\n infiniteScroll.reset()\n // The label is taken from the option just chosen and not by reading the value back.\n query.value = option.label\n open.value = false\n activeIndex.value = -1\n }\n}\n\nfunction removeValue(value: ItemValue) {\n if (!props.multiple || props.readonly) return\n model.value = selectedValues.value.filter((v) => v !== value)\n inputRef.value?.focus()\n}\n\n/**\n * The clear cross was pressed. The field has already emptied the text it holds; what is left to\n * empty is the selection itself; the single value, or all the chips.\n */\nfunction onClear() {\n model.value = props.multiple ? [] : ''\n typed.value = false\n // The list may still be open (a pointer press on the cross does not close it): the\n // highlight is moved to the first option rather than dropped, or Enter would do nothing.\n activeIndex.value = open.value ? filtered.value.findIndex((o) => !o.disabled) : -1\n emit('clear')\n}\n\n// @keyboard\nfunction move(delta: number) {\n const list = filtered.value\n if (list.length === 0) return\n // From \"nothing highlighted\" the first step lands on an END of the list: starting at -1,\n // a step back would stop on the second-to-last option.\n let i = activeIndex.value < 0 && delta < 0 ? 0 : activeIndex.value\n for (let step = 0; step < list.length; step++) {\n i = (i + delta + list.length) % list.length\n if (!list[i]?.disabled) break\n }\n activeIndex.value = i\n}\n\n// @keyboard @a11y\n// Naming the current option and never the focus itself, which stays in the field throughout;\n// Backspace on an empty field takes back the last chip, the usual gesture in a field holding\n// several values.\nfunction onKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n if (open.value) move(1)\n else openPanel()\n break\n case 'ArrowUp':\n event.preventDefault()\n if (open.value) move(-1)\n else openPanel()\n break\n case 'Enter':\n if (open.value && activeIndex.value >= 0) {\n event.preventDefault()\n const option = filtered.value[activeIndex.value]\n if (option) select(option)\n }\n break\n case 'Escape':\n // Consumed only when it closes the list, so a surrounding VDialog stays open; on a\n // closed list it is left to go on and close the dialog.\n if (open.value) {\n event.preventDefault()\n closePanel()\n }\n break\n case 'Tab':\n closePanel()\n break\n case 'Backspace':\n if (props.multiple && !query.value) {\n const last = selectedValues.value.at(-1)\n if (last !== undefined) removeValue(last)\n }\n break\n }\n}\n\ndefineExpose({\n /** Moves the focus to the search field. */\n focus: (options?: FocusOptions) => inputRef.value?.focus(options),\n /** Selects what has been typed in the search field. */\n select: () => inputRef.value?.select(),\n /** The real `<input>` behind the field, for what neither of the two above covers. */\n el: computed(() => inputRef.value?.el ?? null),\n})\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n class=\"v-combobox\"\n :class=\"rootClass\"\n :style=\"[{ '--chip-height': chipScale.height }, rootStyle]\"\n :data-size=\"resolvedSize\"\n :data-compact=\"resolvedCompact ? '' : undefined\"\n :data-multiple=\"multiple ? '' : undefined\"\n :data-collapsed=\"collapsed ? '' : undefined\"\n :data-open=\"open ? '' : undefined\"\n @focusout=\"onFocusout\"\n >\n <div class=\"v-combobox-control\" @mousedown=\"onControlMousedown\" @click=\"onControlClick\">\n <!--\n The two arrangements VInput offers a field holding chips: its end controls lifted out of\n the flow, always; the chevron and the cross stay put whether or not the input has folded\n away; and the chips wrapping, when there are chips at all. A text display keeps the\n field on one line and needs only the first.\n -->\n <VInput\n ref=\"inputRef\"\n v-model=\"query\"\n class=\"v-input-end-pinned\"\n :class=\"{ 'v-input-chips': multiple && !textDisplay }\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n :aria-expanded=\"open\"\n :aria-controls=\"optionsId\"\n v-bind=\"fieldAttrs\"\n :label=\"label\"\n :hint=\"hint\"\n :size=\"resolvedSize\"\n :compact=\"resolvedCompact\"\n :invalid=\"invalid\"\n :disabled=\"resolvedDisabled\"\n :readonly=\"readonly\"\n :icon-start=\"iconStart\"\n :icon-start-label=\"iconStartLabel\"\n :clearable=\"clearable\"\n :clear-visible=\"clearVisible\"\n :clear-label=\"resolvedClearLabel\"\n :placeholder=\"selectedValues.length === 0 ? placeholder : undefined\"\n :aria-activedescendant=\"open && activeIndex >= 0 ? optionId(activeIndex) : undefined\"\n @input=\"onInput\"\n @keydown=\"onKeydown\"\n @focus=\"onFocus\"\n @blur=\"focused = false\"\n @clear=\"onClear\"\n >\n <template v-if=\"multiple || $slots.start\" #start>\n <span v-if=\"displayText\" class=\"v-combobox-text\">{{ displayText }}</span>\n <!-- A box of its own beside the line rather than the end of it: the labels are what\n the ellipsis cuts, and the count of what they do not show must survive it. -->\n <span v-if=\"textDisplay && overflowCount > 0\" class=\"v-combobox-overflow\">\n <slot\n name=\"overflow\"\n :count=\"overflowCount\"\n :size=\"chipScale.size\"\n :compact=\"chipScale.compact\"\n >{{ resolvedOverflowText }}</slot\n >\n </span>\n <template v-for=\"value in multiple && !textDisplay ? visibleValues : []\" :key=\"value\">\n <slot\n name=\"chip\"\n :value=\"value\"\n :option=\"optionOf(value)\"\n :label=\"labelOf(value)\"\n :remove=\"() => removeValue(value)\"\n :size=\"chipScale.size\"\n :compact=\"chipScale.compact\"\n >\n <VChip\n tone=\"accent\"\n :size=\"chipScale.size\"\n :compact=\"chipScale.compact\"\n :dismissible=\"!readonly && !resolvedDisabled\"\n :dismiss-label=\"m.common.remove(labelOf(value))\"\n :disabled=\"resolvedDisabled\"\n @dismiss=\"removeValue(value)\"\n >{{ labelOf(value) }}</VChip\n >\n </slot>\n </template>\n <!-- Not wrapped, unlike the text display's counter: a box around an inline-flex chip\n opens a line box, whose strut makes the field taller than its chips. Neutral\n and not dismissible, so it reads as a summary rather than one more value. -->\n <slot\n v-if=\"multiple && !textDisplay && overflowCount > 0\"\n name=\"overflow\"\n :count=\"overflowCount\"\n :size=\"chipScale.size\"\n :compact=\"chipScale.compact\"\n >\n <VChip\n class=\"v-combobox-overflow-chip\"\n tone=\"neutral\"\n :size=\"chipScale.size\"\n :compact=\"chipScale.compact\"\n :disabled=\"resolvedDisabled\"\n >{{ resolvedOverflowText }}</VChip\n >\n </slot>\n <slot name=\"start\" />\n </template>\n\n <template v-if=\"$slots['value-end']\" #value-end><slot name=\"value-end\" /></template>\n\n <!--\n The chevron sits at the end of the field and turns as the panel opens; the clear cross\n is rendered by the field itself, to its left. While loading, the spinner takes EXACTLY\n the chevron's place; the field gives a spinner among its direct children the size of\n an icon; so nothing shifts.\n -->\n <template v-if=\"loading || !hideExpandIcon\" #end>\n <VSpinner v-if=\"loading\" class=\"v-combobox-spinner v-input-icon-end\" aria-hidden=\"true\" />\n <VIcon\n v-else\n v-bind=\"iconProps(expandIcon)\"\n class=\"v-combobox-chevron v-input-icon-end\"\n aria-hidden=\"true\"\n />\n </template>\n </VInput>\n </div>\n\n <!--\n The panel itself carries both the listbox role and the scrolling. That single fact is what\n the observer watching for the end of the list and the scrolling of the highlighted option\n both rely on: inserting any wrapper between them breaks the two at once.\n -->\n <VPopover\n :id=\"optionsId\"\n v-model:open=\"open\"\n mode=\"manual\"\n anchor=\"--combobox-anchor\"\n match-trigger\n :placement=\"placement\"\n role=\"listbox\"\n class=\"v-combobox-panel v-control\"\n :data-size=\"resolvedSize\"\n :data-compact=\"resolvedCompact ? '' : undefined\"\n :aria-multiselectable=\"multiple ? 'true' : undefined\"\n @mousedown=\"onPanelMousedown\"\n >\n <!-- Blocks and separators exist for the eye alone: the keyboard counts through the\n flat list of surviving options and therefore never encounters one. -->\n <template v-for=\"node in rows\" :key=\"node.key\">\n <VComboboxSeparator v-if=\"node.kind === 'separator'\" />\n\n <VComboboxGroup v-else-if=\"node.kind === 'group'\" :label=\"node.label\">\n <VComboboxOption\n v-for=\"entry in node.options\"\n :key=\"entry.key\"\n v-bind=\"entry.row\"\n @select=\"select(entry.option)\"\n @pointermove=\"hover(entry)\"\n >\n <slot name=\"option\" v-bind=\"entry.slot\">{{ entry.option.label }}</slot>\n </VComboboxOption>\n </VComboboxGroup>\n\n <VComboboxOption\n v-else\n v-bind=\"node.row\"\n @select=\"select(node.option)\"\n @pointermove=\"hover(node)\"\n >\n <slot name=\"option\" v-bind=\"node.slot\">{{ node.option.label }}</slot>\n </VComboboxOption>\n </template>\n\n <!--\n The order matters: loading is checked before emptiness, so that a panel waiting for an\n answer never claims there is no result. Both are hidden from screen readers, and that is\n not an oversight.\n -->\n <div v-if=\"loading && filtered.length === 0\" class=\"v-combobox-state\" aria-hidden=\"true\">\n <slot name=\"loading\">\n <VSpinner :label=\"resolvedLoadingText\" />\n <span>{{ resolvedLoadingText }}</span>\n </slot>\n </div>\n <div v-else-if=\"filtered.length === 0\" class=\"v-combobox-state\" aria-hidden=\"true\">\n <slot name=\"empty\" :query=\"searchTerm\">{{ resolvedEmptyText }}</slot>\n </div>\n\n <!--\n It has to stay a SINGLE element: rendering the spinner conditionally in its place would\n destroy the marker and silently cancel the observation, and no further page would ever\n be asked for.\n -->\n <div v-if=\"hasMore\" ref=\"sentinelEl\" class=\"v-combobox-more\" aria-hidden=\"true\">\n <VSpinner v-if=\"loading\" :label=\"resolvedLoadingText\" />\n </div>\n </VPopover>\n\n <!-- The spoken counterpart of the two panel states above. It sits OUTSIDE the\n listbox, being exactly the kind of content a listbox may not contain. -->\n <span class=\"v-visually-hidden\" role=\"status\">{{ stateAnnouncement }}</span>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-combobox {\n /*\n * It is declared on the root because that is the common ancestor of the field and the\n * panel; a panel drawn above the page remains a descendant of it in the document.\n */\n anchor-scope: --combobox-anchor;\n width: 100%;\n font-family: var(--vectis-text-family);\n }\n\n .v-combobox-control {\n display: block;\n }\n\n /*\n * The anchor is the FIELD's box and not this wrapper's, which also holds the label and the\n * hint: anchored to the wrapper, the panel opens a hint's height below the field, and a\n * label's height above it once there is no room below and `flip-block` turns it over. Against\n * the field it covers whichever of the two it lands on, which a panel belonging to a control\n * is supposed to do.\n */\n .v-combobox-control .v-input-field {\n anchor-name: --combobox-anchor;\n }\n\n /*\n * The panel comes from VPopover, which brings the floating element, its open state, its\n * anchoring, its placement and its surface. It also carries the shared size class, so the\n * options and the state rows read their dimensions from it with no size table here.\n */\n .v-combobox-panel {\n max-block-size: var(--vectis-control-size-combobox-list-max-block);\n overflow: auto;\n }\n\n /*\n * The chevron and the clear cross are pinned to the end of the field by VInput's\n * `.v-input-end-pinned`, which also reserves their room. The chevron and the spinner take\n * turns in the same place and occupy the same box; the field gives a spinner among its direct\n * children the size of an icon; so swapping one for the other shifts nothing.\n */\n .v-combobox-chevron,\n .v-combobox-spinner {\n color: var(--vectis-color-text-muted);\n }\n\n .v-combobox-chevron {\n transition: rotate var(--vectis-duration-fast) var(--vectis-ease-default);\n }\n\n .v-combobox[data-open] .v-combobox-chevron {\n rotate: 180deg;\n }\n\n /*\n * It remains in the page and remains focusable; clicking the field or tabbing into it brings\n * it straight back, the folded state ending as soon as it has the focus.\n */\n .v-combobox[data-collapsed] .v-input-control {\n position: absolute;\n width: 0;\n height: 0;\n padding: 0;\n }\n\n /*\n * Under the focus the two share the row, and the line is capped at half of it so that a long\n * selection cannot squeeze what is being typed down to nothing. Folded, the input is out of\n * the flow and the line takes the whole field.\n */\n .v-combobox-text {\n flex: 0 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .v-combobox:not([data-collapsed]) .v-combobox-text {\n max-inline-size: 50%;\n }\n\n /* The \"+X\" after a line of text never shrinks: the line gives way instead. */\n .v-combobox-overflow {\n flex: none;\n white-space: nowrap;\n color: var(--vectis-color-text-muted);\n }\n\n /*\n * An unbroken line has the whole of its text as its min-content width, and that width travels\n * up through the field to the root. In a grid track or a flex row sized `auto`, the component\n * then widens its container to fit every label instead of cutting them short, and the\n * ellipsis never shows.\n */\n .v-combobox:has(.v-combobox-text) {\n min-inline-size: 0;\n }\n\n /* The rows saying \"nothing matches\" or \"loading\" are built like an option: they read\n the same inherited dimensions from the panel, and the spinner follows through the\n same block's icon context. They refuse to shrink, the panel being a bounded column\n that would otherwise squash them. */\n .v-combobox-state {\n display: flex;\n flex: none;\n align-items: center;\n gap: var(--control-gap);\n min-height: var(--control-height);\n padding: var(--vectis-space-1) var(--control-padding-inline);\n font-size: var(--control-font-size);\n color: var(--vectis-color-text-muted);\n }\n\n /*\n * The foot of the list: the marker watched for the end, and the place the next-page spinner\n * appears. It is given a real height on purpose; a box of no height at all makes the crossing\n * it is watched for unreliable.\n */\n .v-combobox-more {\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n min-height: var(--vectis-control-height-xs);\n color: var(--vectis-color-text-muted);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-combobox-chevron {\n transition: none;\n }\n }\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"VCombobox.js","names":[],"sources":["../../../src/components/VCombobox/VCombobox.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// @keyboard @a11y @core\n/**\n * Keep DOM focus on the field and move aria-activedescendant through options. JavaScript\n * supplies filtering, selection and keyboard navigation unavailable to native text inputs.\n */\n\nimport { computed, inject, ref, useId, watch } from 'vue'\n\nimport VEmptyState from '../VEmptyState/VEmptyState.vue'\nimport { expand_more as expandMoreIcon } from '../VIcon/icons/expand_more'\nimport { inbox as inboxIcon } from '../VIcon/icons/inbox'\nimport { search_off as searchOffIcon } from '../VIcon/icons/search_off'\nimport type { IconSource } from '../VIcon/types'\nimport type { FieldLabelPosition } from '../VField/VField.vue'\nimport VInput from '../VInput/VInput.vue'\nimport VListboxChevron from '../VListbox/VListboxChevron.vue'\nimport VListboxPanel from '../VListbox/VListboxPanel.vue'\nimport VListboxValues from '../VListbox/VListboxValues.vue'\nimport VSpinner from '../VSpinner/VSpinner.vue'\n\nimport { toggleValue } from '../../utils/array'\nimport type {\n ItemValue,\n ListboxGroup,\n ListboxItem,\n ListboxChipSlotProps,\n ListboxOption,\n ListboxOptionSlotProps,\n ListboxOverflowSlotProps,\n ListboxSeparator,\n} from '../../types'\nimport { inputGroupKey } from '../VInput/context'\n\nimport { chipScaleFor } from '../../utils/chip'\nimport { createNormalizedCache, normalizeText } from '../../utils/text'\n\nimport { useControlShape } from '../../composables/useControlShape'\nimport { useRootAttrs } from '../../composables/useRootAttrs'\n\nimport { useFocusoutDismiss } from '../../composables/useFocusoutDismiss'\nimport { useInfiniteScroll } from '../../composables/useInfiniteScroll'\nimport { selectionOf, useListbox } from '../../composables/useListbox'\n\nimport { canClear } from '../../composables/useClearable'\nimport { iconStartListener } from '../../composables/useIconClickHandlers'\n\nimport { useDebouncedSearch } from '../../composables/useDebouncedSearch'\nimport { useMessages } from '../../i18n/state'\n\n/** One thing that can be chosen. */\nexport type ComboboxOption = ListboxOption\n\n/**\n * A named block of options, the equivalent of the grouping a native list offers. A\n * group none of whose options survive the search disappears entirely, its name\n * included.\n */\nexport type ComboboxGroup = ListboxGroup\n\n/**\n * A rule drawn between two blocks of options. It is purely decorative, and a separator the\n * search leaves stranded (at the top, at the bottom, or against another one) is simply not\n * drawn.\n */\nexport type ComboboxSeparator = ListboxSeparator\n\n/** Anything the list may hold: an option, a named block, or a separator. */\nexport type ComboboxItem = ListboxItem\n\n/**\n * How the list is narrowed as one types: by the component itself, not at all (when the\n * options already arrive filtered by a server), or by a rule of your own.\n */\nexport type ComboboxFilter = boolean | ((option: ComboboxOption, query: string) => boolean)\n\n/** Where the list opens relative to the field. */\nexport type ComboboxPlacement =\n 'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end'\n\n/** The height of the field: 32, 40 or 48 pixels. */\nexport type ComboboxSize = 'sm' | 'md' | 'lg'\n\n/**\n * How the chosen values are shown in a multiple field: one chip each, or their labels\n * joined by commas.\n */\nexport type ComboboxDisplay = 'chip' | 'text'\n\n/** What the `#option` slot receives. */\nexport type ComboboxOptionSlotProps = ListboxOptionSlotProps\n\n/** What the `#chip` slot receives. */\nexport type ComboboxChipSlotProps = ListboxChipSlotProps\n\n/** What the `#overflow` slot receives. */\nexport type ComboboxOverflowSlotProps = ListboxOverflowSlotProps\n\n/** What the `#empty` slot receives. */\nexport interface ComboboxEmptySlotProps {\n query: string\n}\n\ninterface ComboboxProps {\n /**\n * What the list offers. An entry may be an option, a named block of options, or a\n * separator; a plain list of options remains perfectly valid.\n */\n options: ComboboxItem[]\n /**\n * Allows several values to be chosen, which makes the value a list and shows what has\n * been chosen inside the field, as chips or as text depending on `display`.\n */\n multiple?: boolean\n /**\n * How the chosen values are shown when several can be chosen: one dismissible chip each, or\n * their labels joined by commas on a single line, cut short with an ellipsis when they run\n * out of room.\n */\n display?: ComboboxDisplay\n /**\n * How many chosen values to show before the rest are summed up as \"+X\", as chips or as text\n * alike. Left out, or set to 0, every value is shown.\n */\n max?: number\n /**\n * Rephrases the \"+X\" standing for the values beyond `max`, \"+5 products\" for instance.\n * It receives the number of values being hidden.\n */\n overflowText?: (count: number) => string\n /** The label above the field, tied to it so that clicking it focuses the field. */\n label?: string\n /**\n * A line of help under the field. It is tied to the field for assistive technology,\n * so it is read out along with the label.\n */\n hint?: string\n /**\n * A message saying what is wrong with the value, shown in place of the hint so that the field\n * does not grow. It marks the field invalid, is read along with it, and is announced when it\n * appears or changes.\n */\n error?: string\n /** Marks the field as required: an asterisk follows the label, and the field is `required`. */\n required?: boolean\n /** Hides the label visually. It still names the field for assistive technology. */\n hideLabel?: boolean\n /**\n * Where the label sits: above the field (`top`, the default), or at its start, in a column of\n * its own, moving back above when there is not room for both.\n */\n labelPosition?: FieldLabelPosition\n /** The height of the field: 32, 40 or 48 pixels. */\n size?: ComboboxSize\n /** Takes 4px off the height, as everywhere else in the design system. */\n compact?: boolean\n /** What the field says while nothing is chosen and nothing has been typed. */\n placeholder?: string\n /** Makes the field unusable, greyed out through the colour tokens. */\n disabled?: boolean\n /**\n * Shows what has been chosen without letting it be changed: nothing can be typed, the list\n * never opens, the chips lose their crosses and no clear cross is offered.\n */\n readonly?: boolean\n /** Marks the field as invalid, for a rule of your own. */\n invalid?: boolean\n /**\n * An icon inside the field, at the start, before the chips when several values can\n * be chosen. It is decorative by default and becomes a real button as soon as a\n * `@click:icon-start` listener is attached, in which case it needs `iconStartLabel`.\n */\n iconStart?: IconSource\n /** What the start icon does, in words, once it is clickable. */\n iconStartLabel?: string\n /**\n * The chevron at the end of the field, which turns as the list opens: an icon name, or an\n * explicit render.\n */\n expandIcon?: IconSource\n /** Offers a cross that empties both the selection and the search. */\n clearable?: boolean\n /** What that cross does, in words. It falls back to the design system dictionary. */\n clearLabel?: string\n /**\n * The title of the empty state the panel shows when the search matches nothing. It is also\n * what a screen reader hears, even when the `#empty` slot draws something else: set both\n * together.\n */\n emptyText?: string\n /** How the list is narrowed as one types. */\n filter?: ComboboxFilter\n /**\n * How long to wait before telling the source what is being searched for, in\n * milliseconds. Zero tells it at once, which suits a source that is not a network\n * request.\n */\n searchDebounce?: number\n /**\n * Says that something is being loaded. Either way the field replaces its chevron with a\n * spinner.\n */\n loading?: boolean\n /**\n * What is said while loading, and what the spinner is announced as. A screen reader hears\n * it even when the `#loading` slot draws something else: set both together.\n */\n loadingText?: string\n /**\n * Says that there are more pages to come, which makes the component ask for the next one as\n * the end of the list comes into view.\n */\n hasMore?: boolean\n /**\n * Renders only the rows near the visible part of the panel, for lists of thousands of options.\n * Rows are measured as they render, so a custom `#option` may vary in height. Options are then\n * announced with their position in the list.\n */\n virtual?: boolean\n /** Where the list opens relative to the field. */\n placement?: ComboboxPlacement\n}\n\nconst props = withDefaults(defineProps<ComboboxProps>(), {\n multiple: false,\n display: 'chip',\n max: undefined,\n overflowText: undefined,\n label: undefined,\n hint: undefined,\n error: undefined,\n required: false,\n hideLabel: false,\n labelPosition: 'top',\n size: 'md',\n compact: false,\n placeholder: undefined,\n disabled: false,\n readonly: false,\n invalid: false,\n iconStart: undefined,\n iconStartLabel: undefined,\n expandIcon: () => expandMoreIcon,\n clearable: false,\n clearLabel: undefined,\n emptyText: undefined,\n filter: true,\n searchDebounce: 250,\n loading: false,\n loadingText: undefined,\n hasMore: false,\n virtual: false,\n placement: 'bottom-start',\n})\n\nconst m = useMessages()\nconst resolvedEmptyText = computed(() => props.emptyText ?? m.value.combobox.empty)\nconst resolvedClearLabel = computed(() => props.clearLabel ?? m.value.combobox.clear)\nconst resolvedLoadingText = computed(() => props.loadingText ?? m.value.common.loading)\n\nconst emit = defineEmits<{\n /** What is being searched for, to be sent to the source. */\n search: [query: string]\n /** The end of the list has come into view: send the next page. */\n 'load-more': []\n /** The clear cross emptied the selection and the search. */\n clear: []\n /** The start icon was clicked. Attaching this listener is what makes it a button. */\n 'click:icon-start': [event: MouseEvent]\n}>()\n\ndefineSlots<{\n /**\n * Content at the start of the field, rendered after the chips standing for the chosen\n * values rather than in their place.\n */\n start?(): unknown\n /**\n * Controls of your own inside the field, placed before the ones the field owns: the clear\n * cross and the chevron.\n */\n 'value-end'?(): unknown\n /** What a row of the list shows, in place of the plain label: a subtitle, an avatar, a badge. */\n option?(props: ComboboxOptionSlotProps): unknown\n /** Replaces the chip standing for one chosen value. */\n chip?(props: ComboboxChipSlotProps): unknown\n /** Replaces the \"+X\" standing for the values beyond `max`. */\n overflow?(props: ComboboxOverflowSlotProps): unknown\n /** What the panel shows when nothing matches. It receives the term that was searched. */\n empty?(props: ComboboxEmptySlotProps): unknown\n /** What the panel shows while loading its first options. */\n loading?(): unknown\n}>()\n\n// Everything below reads the RESOLVED values and never the props: the chips, the panel and the\n// field would otherwise come out at three different scales inside the same row.\nconst group = inject(inputGroupKey, null)\nconst {\n size: resolvedSize,\n compact: resolvedCompact,\n disabled: resolvedDisabled,\n} = useControlShape(props, group)\n\n// The size, the density and the HEIGHT of the chips sitting inside the field, worked out\n// once in `utils/chip.ts` and shared with VFileInput. The height is set inline below\n// rather than restated as a table of CSS rules: it is the height the field forces on its\n// input, and deriving both from the same pair is what stops them drifting apart.\nconst chipScale = computed(() => chipScaleFor(resolvedSize.value, resolvedCompact.value))\n\n/** The chosen option's `value`, or the list of them when `multiple` is set. */\nconst model = defineModel<ItemValue | ItemValue[]>({ default: '' })\n\n// `class` and `style` stay on the wrapper, where a consumer expects to style the component;\n// everything else; a name above all; goes down to the text field, which is the element\n// assistive technology treats as the combobox.\ndefineOptions({ inheritAttrs: false })\nconst { rootClass, rootStyle, forwardedAttrs } = useRootAttrs()\n\n// Declared as this component's own event, `click:icon-start` is out of `$attrs`, so the\n// listener is relayed to the field by hand; and only when the consumer wrote one.\nconst iconStartClick = iconStartListener((event) => emit('click:icon-start', event))\n\n/** What reaches the field: the consumer's own attributes, plus that listener. */\nconst fieldAttrs = computed(() => ({ ...forwardedAttrs.value, ...iconStartClick }))\n\nconst rootEl = ref<HTMLElement | null>(null)\nconst inputRef = ref<InstanceType<typeof VInput> | null>(null)\n// One generated identifier serves twice: as the panel's own id, which the field points\n// at, and as the prefix of every option's id. The two strings can never collide, one\n// being a prefix of longer ones.\nconst optionsId = useId()\n\nconst open = ref(false)\nconst query = ref('')\nconst focused = ref(false)\n// The text in the field serves two purposes at once: it SHOWS the chosen label when a single\n// value is picked, and it is what one searches with. This flag tells the two apart; while it is\n// false the text is merely a label and narrows nothing, so reopening the panel offers the whole\n// list again.\nconst typed = ref(false)\n\nconst selectedValues = computed(() => selectionOf(model.value, props.multiple))\n\n/*\n * Reading the label on every call is what keeps the filter reactive: flattening the options\n * only ever touches the containers, so a label changed in place would go unnoticed by anything\n * keyed on the list.\n */\nconst normalizedOf = createNormalizedCache<ComboboxOption>()\nconst normalizedLabelOf = (option: ComboboxOption) => normalizedOf(option, option.label)\n\n// ONE search term, read both by the local filter and by what is sent to the source: the\n// list on screen and the request in flight therefore cannot describe different searches.\n// With nothing typed the term is empty, so a label merely being displayed never narrows\n// the list.\nconst searchTerm = computed(() => (typed.value ? query.value.trim() : ''))\n\n// Closing empties `searchTerm` (the typing flag drops) in the same tick as it hides the panel,\n// but the panel fades out rather than vanishing. Filtered on the live term, the list would\n// spring back to every option during that fade, and the panel grow under the pointer that just\n// chose.\nconst closedTerm = ref<string | null>(null)\n\nconst panelRef = ref<InstanceType<typeof VListboxPanel> | null>(null)\n\nconst {\n allOptions,\n visible: filtered,\n optionOf,\n labelOf,\n remember,\n activeIndex,\n optionId,\n highlightFirst,\n highlightSelected,\n move,\n hover,\n blocks,\n measureRow,\n} = useListbox({\n items: () => props.options,\n filter: (list) => {\n const matcher = props.filter\n if (matcher === false) return list\n const q = closedTerm.value ?? searchTerm.value\n if (!q) return list\n if (typeof matcher === 'function') return list.filter((o) => matcher(o, q))\n const needle = normalizeText(q)\n return list.filter((o) => normalizedLabelOf(o).includes(needle))\n },\n selected: () => selectedValues.value,\n open: () => open.value,\n id: optionsId,\n panelEl: () => panelRef.value?.el ?? null,\n virtual: () => props.virtual,\n hasMore: () => props.hasMore,\n size: () => resolvedSize.value,\n compact: () => resolvedCompact.value,\n})\n\n// @a11y\n/**\n * What is announced about the state of the panel; that nothing matches, or that something is\n * loading.\n */\nconst stateAnnouncement = computed(() => {\n if (!open.value || filtered.value.length > 0) return ''\n return props.loading ? resolvedLoadingText.value : resolvedEmptyText.value\n})\n\nconst { request: emitSearch, cancel: cancelSearch } = useDebouncedSearch({\n delay: () => props.searchDebounce,\n active: () => open.value,\n report: (term) => emit('search', term),\n})\n\nwatch(searchTerm, (term) => {\n if (!open.value) return\n // A new search means a new list, so the highlight cannot survive it: with an outside source\n // the options are replaced wholesale, and the old position would name a completely unrelated\n // option. It is moved to the first available option rather than dropped altogether, and that\n // matters when the filtering is left to the source: the visible list keeps the very same\n // reference until the answer arrives, so the watcher below would never fire and Enter would\n // do nothing in the meantime.\n highlightFirst()\n // The page asked for under the previous term will never arrive, and the first page of the new\n // one may be exactly as long as the list it replaces; which the paging would not recognise as\n // an arrival.\n infiniteScroll.restart()\n emitSearch(term)\n})\n\n// With a single value, the field shows its label as ordinary text whenever it is not being\n// edited. Read through `selectedValues`, which knows that a number is a value even at zero: a\n// test on the string type would leave a numeric value unlabelled.\nfunction singleLabel() {\n const value = props.multiple ? undefined : selectedValues.value[0]\n return value === undefined ? '' : labelOf(value)\n}\n\nquery.value = singleLabel()\n\n// Refresh copied selection labels when options arrive or the parent updates the value.\n// Post-flush timing reads the accepted model after rendering.\nwatch(\n [allOptions, selectedValues],\n () => {\n if (props.multiple || open.value || typed.value) return\n query.value = singleLabel()\n },\n { flush: 'post' },\n)\n\n/** The chosen values are spelled out as one line of text rather than drawn as chips. */\nconst textDisplay = computed(() => props.multiple && props.display === 'text')\n\n// A read-only TEXT display keeps it folded under the focus too: nothing can be typed, and the\n// input's share of the row would only cut the line of values short for nothing.\nconst collapsed = computed(\n () =>\n props.multiple &&\n selectedValues.value.length > 0 &&\n (!focused.value || (textDisplay.value && props.readonly)),\n)\n\n// The field cannot work that out for itself, since the chips live outside its value, so the\n// answer is given to it explicitly, and the room for the cross is reserved accordingly.\nconst clearVisible = computed(() =>\n canClear(\n props,\n resolvedDisabled.value,\n selectedValues.value.length > 0 || query.value.length > 0,\n ),\n)\n\n// The single cut-off point of a frozen field: every route into the list; a click on the\n// control, the focus, a keystroke, typing; ends up here, so `readonly` is refused once rather\n// than guarded in each handler.\nfunction openPanel() {\n if (resolvedDisabled.value || props.readonly || open.value) return\n closedTerm.value = null\n open.value = true\n highlightSelected()\n // Told to the source after the panel is marked open; the delayed emission checks that flag\n // before firing; which lets an outside source load its first page as the panel appears.\n emitSearch(searchTerm.value, true)\n}\n\n// Asking for the next page as the end of the list is reached. The observer itself, its\n// re-arming after each page and the lock that stops it firing twice all live in\n// `useInfiniteScroll`; it is declared here so that closing the panel can reset it.\nconst sentinelEl = ref<HTMLElement | null>(null)\n\nconst infiniteScroll = useInfiniteScroll({\n sentinelEl,\n // Found by its ARIA role, which is public API, rather than by an internal class.\n root: (sentinel) => sentinel.closest('[role=\"listbox\"]'),\n canLoad: () => open.value && props.hasMore && !props.loading,\n loaded: () => allOptions.value,\n onLoadMore: () => emit('load-more'),\n})\n\n/**\n * Closes the list. The field then shows `label`: the chosen value's, unless the caller passes the\n * label of the option it has just chosen, which the value read back may not yet carry.\n */\nfunction closePanel(label = singleLabel()) {\n if (!open.value) return\n cancelSearch()\n // A page that never arrived; a request that failed; must not leave the paging frozen for\n // good, so the lock is released here.\n infiniteScroll.reset()\n closedTerm.value = searchTerm.value\n open.value = false\n activeIndex.value = -1\n typed.value = false\n query.value = label\n}\n\nwatch(\n () => props.readonly || resolvedDisabled.value,\n (frozen) => {\n if (frozen) closePanel()\n },\n)\n\n/**\n * Closes as soon as the focus leaves the component; the panel included, which is a descendant\n * of it even while floating above the page.\n */\nconst onFocusout = useFocusoutDismiss(rootEl, () => closePanel())\n\n/** The reader is typing: the text becomes a search, and the panel opens. */\nfunction onInput() {\n typed.value = true\n openPanel()\n}\n\n/**\n * With a single value chosen, the label shown in the field is selected on focus, so that typing\n * replaces it rather than appending to it; and until something IS typed, the whole list stays\n * on offer.\n */\nfunction selectQuery() {\n if (!props.multiple && query.value) inputRef.value?.select()\n}\n\nfunction onFocus() {\n focused.value = true\n selectQuery()\n}\n\n/** Whether a pointer event landed on the chevron, or on the spinner standing in its place. */\nconst onChevron = (event: Event) =>\n event.target instanceof Element &&\n event.target.closest('.v-combobox-chevron, .v-combobox-spinner') !== null\n\n// @core\n/*\n * The chevron is not focusable, so pressing it would hand the focus to the page: the root's\n * `focusout` then closes the panel, and the click that follows reopens it. A click meant to\n * close would flash the list instead.\n */\nfunction onControlMousedown(event: MouseEvent) {\n if (onChevron(event)) event.preventDefault()\n}\n\n/**\n * A click anywhere on the field focuses it and opens the panel; except on the chevron of an\n * open panel, which closes it.\n */\nfunction onControlClick(event: MouseEvent) {\n if (resolvedDisabled.value) return\n inputRef.value?.focus()\n if (open.value && onChevron(event)) {\n closePanel()\n return\n }\n openPanel()\n // Selected again after the click, which has just placed the caret somewhere in the middle of\n // the label.\n selectQuery()\n}\n\nfunction select(option: ComboboxOption) {\n if (option.disabled || props.readonly || resolvedDisabled.value) return\n // Remembered immediately: the option may vanish from the list; on the next search; before the\n // parent has even passed the new value back down.\n remember(option)\n if (props.multiple) {\n typed.value = false\n model.value = toggleValue(selectedValues.value, option.value)\n query.value = ''\n inputRef.value?.focus()\n } else {\n model.value = option.value\n closePanel(option.label)\n }\n}\n\nfunction removeValue(value: ItemValue) {\n if (!props.multiple || props.readonly || resolvedDisabled.value) return\n model.value = selectedValues.value.filter((v) => v !== value)\n inputRef.value?.focus()\n}\n\n/**\n * The clear cross was pressed. The field has already emptied the text it holds; what is left to\n * empty is the selection itself; the single value, or all the chips.\n */\nfunction onClear() {\n model.value = props.multiple ? [] : ''\n typed.value = false\n // The list may still be open (a pointer press on the cross does not close it): the\n // highlight is moved to the first option rather than dropped, or Enter would do nothing.\n if (open.value) highlightFirst()\n else activeIndex.value = -1\n emit('clear')\n}\n\n// @keyboard @a11y\n// Naming the current option and never the focus itself, which stays in the field throughout;\n// Backspace on an empty field takes back the last chip, the usual gesture in a field holding\n// several values.\nfunction onKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault()\n if (open.value) move(1)\n else openPanel()\n break\n case 'ArrowUp':\n event.preventDefault()\n if (open.value) move(-1)\n else openPanel()\n break\n case 'Enter':\n if (open.value && activeIndex.value >= 0) {\n event.preventDefault()\n const option = filtered.value[activeIndex.value]\n if (option) select(option)\n }\n break\n case 'Escape':\n // Consumed only when it closes the list, so a surrounding VDialog stays open; on a\n // closed list it is left to go on and close the dialog.\n if (open.value) {\n event.preventDefault()\n closePanel()\n }\n break\n case 'Tab':\n closePanel()\n break\n case 'Backspace':\n if (props.multiple && !query.value) {\n const last = selectedValues.value.at(-1)\n if (last !== undefined) removeValue(last)\n }\n break\n }\n}\n\ndefineExpose({\n /** Moves the focus to the search field. */\n focus: (options?: FocusOptions) => inputRef.value?.focus(options),\n /** Selects what has been typed in the search field. */\n select: () => inputRef.value?.select(),\n /** The real `<input>` behind the field, for what neither of the two above covers. */\n el: computed(() => inputRef.value?.el ?? null),\n})\n</script>\n\n<template>\n <div\n ref=\"rootEl\"\n class=\"v-combobox\"\n :class=\"rootClass\"\n :style=\"[{ '--chip-height': chipScale.height }, rootStyle]\"\n :data-size=\"resolvedSize\"\n :data-compact=\"resolvedCompact ? '' : undefined\"\n :data-multiple=\"multiple ? '' : undefined\"\n :data-collapsed=\"collapsed ? '' : undefined\"\n :data-open=\"open ? '' : undefined\"\n @focusout=\"onFocusout\"\n >\n <div class=\"v-combobox-control\" @mousedown=\"onControlMousedown\" @click=\"onControlClick\">\n <!--\n The two arrangements VInput offers a field holding chips: its end controls lifted out of\n the flow, always; the chevron and the cross stay put whether or not the input has folded\n away; and the chips wrapping, when there are chips at all. A text display keeps the\n field on one line and needs only the first.\n -->\n <VInput\n ref=\"inputRef\"\n v-model=\"query\"\n class=\"v-input-end-pinned\"\n :class=\"{ 'v-input-chips': multiple && !textDisplay }\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n :aria-expanded=\"open\"\n :aria-controls=\"optionsId\"\n v-bind=\"fieldAttrs\"\n :label=\"label\"\n :hint=\"hint\"\n :error=\"error\"\n :required=\"required\"\n :hide-label=\"hideLabel\"\n :label-position=\"labelPosition\"\n :size=\"resolvedSize\"\n :compact=\"resolvedCompact\"\n :invalid=\"invalid\"\n :disabled=\"resolvedDisabled\"\n :readonly=\"readonly\"\n :icon-start=\"iconStart\"\n :icon-start-label=\"iconStartLabel\"\n :clearable=\"clearable\"\n :clear-visible=\"clearVisible\"\n :clear-label=\"resolvedClearLabel\"\n :placeholder=\"selectedValues.length === 0 ? placeholder : undefined\"\n :aria-activedescendant=\"open && activeIndex >= 0 ? optionId(activeIndex) : undefined\"\n @input=\"onInput\"\n @keydown=\"onKeydown\"\n @focus=\"onFocus\"\n @blur=\"focused = false\"\n @clear=\"onClear\"\n >\n <template v-if=\"multiple || $slots.start\" #start>\n <VListboxValues\n v-if=\"multiple\"\n :values=\"selectedValues\"\n :display=\"display\"\n :max=\"max\"\n :collapsed=\"collapsed\"\n :overflow-text=\"overflowText\"\n :scale=\"chipScale\"\n :removable=\"!readonly\"\n :disabled=\"resolvedDisabled\"\n :label-of=\"labelOf\"\n :option-of=\"optionOf\"\n @remove=\"removeValue\"\n >\n <template v-if=\"$slots.chip\" #chip=\"chipProps\">\n <slot name=\"chip\" v-bind=\"chipProps\" />\n </template>\n <template v-if=\"$slots.overflow\" #overflow=\"overflowProps\">\n <slot name=\"overflow\" v-bind=\"overflowProps\" />\n </template>\n </VListboxValues>\n <slot name=\"start\" />\n </template>\n\n <template v-if=\"$slots['value-end']\" #value-end><slot name=\"value-end\" /></template>\n\n <!--\n The chevron sits at the end of the field and turns as the panel opens; the clear cross\n is rendered by the field itself, to its left. While loading, the spinner takes EXACTLY\n the chevron's place; the field gives a spinner among its direct children the size of\n an icon; so nothing shifts.\n -->\n <template #end>\n <VSpinner v-if=\"loading\" class=\"v-combobox-spinner v-input-icon-end\" aria-hidden=\"true\" />\n <VListboxChevron v-else class=\"v-combobox-chevron\" :icon=\"expandIcon\" :open=\"open\" />\n </template>\n </VInput>\n </div>\n\n <VListboxPanel\n :id=\"optionsId\"\n ref=\"panelRef\"\n v-model:open=\"open\"\n anchor=\"--combobox-anchor\"\n :placement=\"placement\"\n class=\"v-combobox-panel\"\n :size=\"resolvedSize\"\n :compact=\"resolvedCompact\"\n :multiple=\"multiple\"\n :virtual=\"virtual\"\n :blocks=\"blocks\"\n :measure=\"measureRow\"\n @select=\"select\"\n @highlight=\"hover\"\n >\n <template v-if=\"$slots.option\" #option=\"slotProps\">\n <slot name=\"option\" v-bind=\"slotProps\" />\n </template>\n\n <!--\n The order matters: loading is checked before emptiness, so that a panel waiting for an\n answer never claims there is no result. Both are hidden from screen readers, and that is\n not an oversight.\n -->\n <div v-if=\"loading && filtered.length === 0\" class=\"v-combobox-state\" aria-hidden=\"true\">\n <slot name=\"loading\">\n <VSpinner :label=\"resolvedLoadingText\" />\n <span>{{ resolvedLoadingText }}</span>\n </slot>\n </div>\n <div v-else-if=\"filtered.length === 0\" class=\"v-combobox-state\" aria-hidden=\"true\">\n <slot name=\"empty\" :query=\"searchTerm\">\n <VEmptyState\n size=\"sm\"\n class=\"v-combobox-empty\"\n :icon=\"searchTerm ? searchOffIcon : inboxIcon\"\n :title=\"resolvedEmptyText\"\n />\n </slot>\n </div>\n\n <!--\n It has to stay a SINGLE element: rendering the spinner conditionally in its place would\n destroy the marker and silently cancel the observation, and no further page would ever\n be asked for.\n -->\n <div v-if=\"hasMore\" ref=\"sentinelEl\" class=\"v-combobox-more\" aria-hidden=\"true\">\n <VSpinner v-if=\"loading\" :label=\"resolvedLoadingText\" />\n </div>\n </VListboxPanel>\n\n <!-- The spoken counterpart of the two panel states above. It sits OUTSIDE the\n listbox, being exactly the kind of content a listbox may not contain. -->\n <span class=\"v-visually-hidden\" role=\"status\">{{ stateAnnouncement }}</span>\n </div>\n</template>\n\n<style>\n@layer vectis.components {\n .v-combobox {\n /*\n * It is declared on the root because that is the common ancestor of the field and the\n * panel; a panel drawn above the page remains a descendant of it in the document.\n */\n anchor-scope: --combobox-anchor;\n width: 100%;\n font-family: var(--vectis-text-family);\n }\n\n .v-combobox-control {\n display: block;\n }\n\n /*\n * The anchor is the FIELD's box and not this wrapper's, which also holds the label and the\n * hint: anchored to the wrapper, the panel opens a hint's height below the field, and a\n * label's height above it once there is no room below and `flip-block` turns it over. Against\n * the field it covers whichever of the two it lands on, which a panel belonging to a control\n * is supposed to do.\n */\n .v-combobox-control .v-input-field {\n anchor-name: --combobox-anchor;\n }\n\n .v-combobox-panel {\n max-block-size: var(--vectis-control-size-combobox-list-max-block);\n }\n\n /*\n * The chevron and the clear cross are pinned to the end of the field by VInput's\n * `.v-input-end-pinned`, which also reserves their room. The chevron and the spinner take\n * turns in the same place and occupy the same box; the field gives a spinner among its direct\n * children the size of an icon; so swapping one for the other shifts nothing.\n */\n .v-combobox-spinner {\n color: var(--vectis-color-text-muted);\n }\n\n /*\n * It remains in the page and remains focusable; clicking the field or tabbing into it brings\n * it straight back, the folded state ending as soon as it has the focus.\n */\n .v-combobox[data-collapsed] .v-input-control {\n position: absolute;\n width: 0;\n height: 0;\n padding: 0;\n }\n\n /*\n * Under the focus the two share the row, and the line is capped at half of it so that a long\n * selection cannot squeeze what is being typed down to nothing. Folded, the input is out of\n * the flow and the line takes the whole field.\n */\n .v-combobox:not([data-collapsed]) .v-listbox-text {\n max-inline-size: 50%;\n }\n\n /*\n * An unbroken line has the whole of its text as its min-content width, and that width travels\n * up through the field to the root. In a grid track or a flex row sized `auto`, the component\n * then widens its container to fit every label instead of cutting them short, and the\n * ellipsis never shows.\n */\n .v-combobox:has(.v-listbox-text) {\n min-inline-size: 0;\n }\n\n /* The rows saying \"nothing matches\" or \"loading\" are built like an option: they read\n the same inherited dimensions from the panel, and the spinner follows through the\n same block's icon context. They refuse to shrink, the panel being a bounded column\n that would otherwise squash them. */\n .v-combobox-state {\n display: flex;\n flex: none;\n align-items: center;\n gap: var(--control-gap);\n min-height: var(--control-height);\n padding: var(--vectis-space-1) var(--control-padding-inline);\n font-size: var(--control-font-size);\n color: var(--vectis-color-text-muted);\n }\n\n /*\n * The default empty state spans the panel. `[data-size]` lifts the selector above VEmptyState's\n * own size rules, whose sheet may load after this one.\n */\n .v-combobox-state > .v-combobox-empty[data-size] {\n flex: 1;\n padding-block: var(--vectis-space-3);\n padding-inline: 0;\n }\n\n /*\n * The foot of the list: the marker watched for the end, and the place the next-page spinner\n * appears. It is given a real height on purpose; a box of no height at all makes the crossing\n * it is watched for unreliable.\n */\n .v-combobox-more {\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n min-height: var(--vectis-control-height-xs);\n color: var(--vectis-color-text-muted);\n }\n\n @media (prefers-reduced-motion: reduce) {\n .v-combobox-chevron {\n transition: none;\n }\n }\n}\n</style>\n"],"mappings":""}