@witchcraft/ui 0.3.26 → 0.4.0-beta.10

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 (287) hide show
  1. package/README.md +54 -61
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1 -1
  4. package/dist/runtime/assets/animations.css +1 -1
  5. package/dist/runtime/assets/locales/en.json +2 -0
  6. package/dist/runtime/build/WitchcraftUiResolver.js +2 -2
  7. package/dist/runtime/components/TestControls/TestControls.vue +3 -3
  8. package/dist/runtime/components/WButton/WButton.d.vue.ts +34 -0
  9. package/dist/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +26 -38
  10. package/dist/runtime/components/WButton/WButton.vue.d.ts +34 -0
  11. package/dist/runtime/components/WCheckbox/WCheckbox.d.vue.ts +33 -0
  12. package/dist/runtime/components/WCheckbox/WCheckbox.vue +110 -0
  13. package/dist/runtime/components/WCheckbox/WCheckbox.vue.d.ts +33 -0
  14. package/dist/runtime/components/WColorInput/WColorInput.d.vue.ts +45 -0
  15. package/dist/runtime/components/WColorInput/WColorInput.vue +85 -0
  16. package/dist/runtime/components/WColorInput/WColorInput.vue.d.ts +45 -0
  17. package/dist/runtime/components/WColorInput/WColorSwatchButton.d.vue.ts +28 -0
  18. package/dist/runtime/components/WColorInput/WColorSwatchButton.vue +86 -0
  19. package/dist/runtime/components/WColorInput/WColorSwatchButton.vue.d.ts +28 -0
  20. package/dist/runtime/components/{LibColorPicker/LibColorPicker.d.vue.ts → WColorPicker/WColorPicker.d.vue.ts} +7 -6
  21. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +41 -29
  22. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue.d.ts → WColorPicker/WColorPicker.vue.d.ts} +7 -6
  23. package/dist/runtime/components/WCombobox/WCombobox.d.vue.ts +111 -0
  24. package/dist/runtime/components/WCombobox/WCombobox.vue +405 -0
  25. package/dist/runtime/components/WCombobox/WCombobox.vue.d.ts +111 -0
  26. package/dist/runtime/components/WCombobox/storyPlays.d.ts +18 -0
  27. package/dist/runtime/components/WCombobox/storyPlays.js +68 -0
  28. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts → WDarkModeSwitcher/WDarkModeSwitcher.d.vue.ts} +8 -13
  29. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +11 -14
  30. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts → WDarkModeSwitcher/WDarkModeSwitcher.vue.d.ts} +8 -13
  31. package/dist/runtime/components/WDatePicker/WDatePicker.d.vue.ts +40 -0
  32. package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
  33. package/dist/runtime/components/WDatePicker/WDatePicker.vue.d.ts +40 -0
  34. package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +21 -21
  35. package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +21 -21
  36. package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.d.vue.ts → WDatePicker/WTimeZonePicker.d.vue.ts} +1 -11
  37. package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
  38. package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue.d.ts → WDatePicker/WTimeZonePicker.vue.d.ts} +1 -11
  39. package/dist/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +10 -12
  40. package/dist/runtime/components/{LibDevOnly/LibDevOnly.d.vue.ts → WDevOnly/WDevOnly.d.vue.ts} +0 -3
  41. package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue.d.ts → WDevOnly/WDevOnly.vue.d.ts} +0 -3
  42. package/dist/runtime/components/WFileInput/WFileInput.d.vue.ts +58 -0
  43. package/dist/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +74 -57
  44. package/dist/runtime/components/WFileInput/WFileInput.vue.d.ts +58 -0
  45. package/dist/runtime/components/{Icon/Icon.vue.d.ts → WIcon/WIcon.d.vue.ts} +2 -6
  46. package/dist/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +1 -1
  47. package/dist/runtime/components/{Icon/Icon.d.vue.ts → WIcon/WIcon.vue.d.ts} +2 -6
  48. package/dist/runtime/components/{LibMultiValues/LibMultiValues.d.vue.ts → WMultiValues/WMultiValues.d.vue.ts} +8 -14
  49. package/dist/runtime/components/WMultiValues/WMultiValues.vue +150 -0
  50. package/dist/runtime/components/{LibMultiValues/LibMultiValues.vue.d.ts → WMultiValues/WMultiValues.vue.d.ts} +8 -14
  51. package/dist/runtime/components/WNotifications/WNotification.d.vue.ts +37 -0
  52. package/dist/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +34 -47
  53. package/dist/runtime/components/WNotifications/WNotification.vue.d.ts +37 -0
  54. package/dist/runtime/components/WNotifications/WNotifications.d.vue.ts +11 -0
  55. package/dist/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +35 -17
  56. package/dist/runtime/components/WNotifications/WNotifications.vue.d.ts +11 -0
  57. package/dist/runtime/components/WNumberInput/WNumberInput.d.vue.ts +27 -0
  58. package/dist/runtime/components/WNumberInput/WNumberInput.vue +96 -0
  59. package/dist/runtime/components/WNumberInput/WNumberInput.vue.d.ts +27 -0
  60. package/dist/runtime/components/WPagination/WPagination.d.vue.ts +59 -0
  61. package/dist/runtime/components/WPagination/WPagination.vue +182 -0
  62. package/dist/runtime/components/WPagination/WPagination.vue.d.ts +59 -0
  63. package/dist/runtime/components/WPalette/WPalette.d.vue.ts +11 -0
  64. package/dist/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
  65. package/dist/runtime/components/WPalette/WPalette.vue.d.ts +11 -0
  66. package/dist/runtime/components/WPopover/WPopover.d.vue.ts +45 -0
  67. package/dist/runtime/components/WPopover/WPopover.vue +144 -0
  68. package/dist/runtime/components/WPopover/WPopover.vue.d.ts +45 -0
  69. package/dist/runtime/components/WPopup/WPopup.d.vue.ts +51 -0
  70. package/dist/runtime/components/WPopup/WPopup.vue +106 -0
  71. package/dist/runtime/components/WPopup/WPopup.vue.d.ts +51 -0
  72. package/dist/runtime/components/{LibProgressBar/LibProgressBar.d.vue.ts → WProgressBar/WProgressBar.d.vue.ts} +14 -18
  73. package/dist/runtime/components/WProgressBar/WProgressBar.vue +150 -0
  74. package/dist/runtime/components/{LibProgressBar/LibProgressBar.vue.d.ts → WProgressBar/WProgressBar.vue.d.ts} +14 -18
  75. package/dist/runtime/components/{LibRecorder/LibRecorder.d.vue.ts → WRecorder/WRecorder.d.vue.ts} +14 -29
  76. package/dist/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +37 -36
  77. package/dist/runtime/components/{LibRecorder/LibRecorder.vue.d.ts → WRecorder/WRecorder.vue.d.ts} +14 -29
  78. package/dist/runtime/components/{LibRoot/LibRoot.d.vue.ts → WRoot/WRoot.d.vue.ts} +6 -5
  79. package/dist/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +17 -15
  80. package/dist/runtime/components/{LibRoot/LibRoot.vue.d.ts → WRoot/WRoot.vue.d.ts} +6 -5
  81. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.d.vue.ts → WSimpleInput/WSimpleInput.d.vue.ts} +10 -16
  82. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +14 -24
  83. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue.d.ts → WSimpleInput/WSimpleInput.vue.d.ts} +10 -16
  84. package/dist/runtime/components/WTable/WTable.d.vue.ts +102 -0
  85. package/dist/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +13 -14
  86. package/dist/runtime/components/WTable/WTable.vue.d.ts +102 -0
  87. package/dist/runtime/components/WTooltip/WTooltip.d.vue.ts +40 -0
  88. package/dist/runtime/components/WTooltip/WTooltip.vue +112 -0
  89. package/dist/runtime/components/WTooltip/WTooltip.vue.d.ts +40 -0
  90. package/dist/runtime/components/index.d.ts +20 -20
  91. package/dist/runtime/components/index.js +20 -20
  92. package/dist/runtime/composables/index.d.ts +4 -4
  93. package/dist/runtime/composables/index.js +4 -4
  94. package/dist/runtime/composables/useDelayedLoadingIndicator.d.ts +9 -0
  95. package/dist/runtime/composables/useDelayedLoadingIndicator.js +18 -0
  96. package/dist/runtime/composables/useDisplayForReka.d.ts +25 -0
  97. package/dist/runtime/composables/useDisplayForReka.js +16 -0
  98. package/dist/runtime/composables/useFallbackId.d.ts +3 -0
  99. package/dist/runtime/composables/useFallbackId.js +5 -0
  100. package/dist/runtime/composables/useInjectedDarkMode.d.ts +1 -1
  101. package/dist/runtime/composables/usePopupConstrainToStyle.d.ts +8 -0
  102. package/dist/runtime/composables/usePopupConstrainToStyle.js +8 -0
  103. package/dist/runtime/composables/useSetupDarkMode.d.ts +2 -3
  104. package/dist/runtime/composables/useSetupDarkMode.js +90 -4
  105. package/dist/runtime/helpers/NotificationHandler.d.ts +2 -2
  106. package/dist/runtime/injectionKeys.d.ts +1 -5
  107. package/dist/runtime/injectionKeys.js +0 -2
  108. package/dist/runtime/types/index.d.ts +85 -27
  109. package/dist/runtime/types/index.js +1 -0
  110. package/package.json +1 -1
  111. package/src/module.ts +1 -1
  112. package/src/runtime/assets/animations.css +3 -3
  113. package/src/runtime/assets/locales/en.json +2 -0
  114. package/src/runtime/build/WitchcraftUiResolver.ts +2 -2
  115. package/src/runtime/components/TestControls/TestControls.vue +3 -3
  116. package/src/runtime/components/WButton/WButton.stories.ts +112 -0
  117. package/src/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +34 -50
  118. package/src/runtime/components/{LibCheckbox/LibCheckbox.stories.ts → WCheckbox/WCheckbox.stories.ts} +5 -5
  119. package/src/runtime/components/WCheckbox/WCheckbox.vue +125 -0
  120. package/src/runtime/components/{LibColorInput/LibColorInput.stories.ts → WColorInput/WColorInput.stories.ts} +8 -8
  121. package/src/runtime/components/WColorInput/WColorInput.vue +112 -0
  122. package/src/runtime/components/WColorInput/WColorSwatchButton.vue +102 -0
  123. package/src/runtime/components/{LibColorPicker/LibColorPicker.stories.ts → WColorPicker/WColorPicker.stories.ts} +12 -12
  124. package/src/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +44 -31
  125. package/src/runtime/components/WCombobox/WCombobox.stories.ts +209 -0
  126. package/src/runtime/components/WCombobox/WCombobox.vue +450 -0
  127. package/src/runtime/components/WCombobox/storyPlays.ts +92 -0
  128. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts → WDarkModeSwitcher/WDarkModeSwitcher.stories.ts} +6 -6
  129. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +19 -30
  130. package/src/runtime/components/{LibDatePicker/LibDatePicker.stories.ts → WDatePicker/WDatePicker.stories.ts} +42 -34
  131. package/src/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
  132. package/src/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +21 -21
  133. package/src/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +21 -21
  134. package/src/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
  135. package/src/runtime/components/{LibDebug/LibDebug.stories.ts → WDebug/WDebug.stories.ts} +5 -5
  136. package/src/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +9 -10
  137. package/src/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -4
  138. package/src/runtime/components/{LibFileInput/LibFileInput.stories.ts → WFileInput/WFileInput.stories.ts} +7 -7
  139. package/src/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +98 -97
  140. package/src/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +5 -8
  141. package/src/runtime/components/{LibMultiValues/LibMultiValues.stories.ts → WMultiValues/WMultiValues.stories.ts} +9 -9
  142. package/src/runtime/components/WMultiValues/WMultiValues.vue +163 -0
  143. package/src/runtime/components/{LibNotifications/LibNotification.stories.ts → WNotifications/WNotification.stories.ts} +9 -9
  144. package/src/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +45 -65
  145. package/src/runtime/components/WNotifications/WNotifications.stories.ts +139 -0
  146. package/src/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +51 -29
  147. package/src/runtime/components/WNumberInput/WNumberInput.vue +109 -0
  148. package/src/runtime/components/WPagination/WPagination.stories.ts +51 -0
  149. package/src/runtime/components/WPagination/WPagination.vue +207 -0
  150. package/src/runtime/components/{LibPalette/LibPalette.stories.ts → WPalette/WPalette.stories.ts} +6 -6
  151. package/src/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
  152. package/src/runtime/components/WPopover/WPopover.stories.ts +218 -0
  153. package/src/runtime/components/WPopover/WPopover.vue +168 -0
  154. package/src/runtime/components/WPopup/WPopup.stories.ts +104 -0
  155. package/src/runtime/components/WPopup/WPopup.vue +125 -0
  156. package/src/runtime/components/WProgressBar/WProgressBar.stories.ts +119 -0
  157. package/src/runtime/components/WProgressBar/WProgressBar.vue +185 -0
  158. package/src/runtime/components/{LibRecorder/LibRecorder.stories.ts → WRecorder/WRecorder.stories.ts} +9 -6
  159. package/src/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +69 -68
  160. package/src/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +18 -15
  161. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.stories.ts → WSimpleInput/WSimpleInput.stories.ts} +11 -12
  162. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +28 -44
  163. package/src/runtime/components/{LibTable/LibTable.stories.ts → WTable/WTable.stories.ts} +60 -52
  164. package/src/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +85 -88
  165. package/src/runtime/components/WTooltip/WTooltip.stories.ts +82 -0
  166. package/src/runtime/components/WTooltip/WTooltip.vue +128 -0
  167. package/src/runtime/components/index.ts +20 -20
  168. package/src/runtime/composables/index.ts +4 -4
  169. package/src/runtime/composables/useDelayedLoadingIndicator.ts +30 -0
  170. package/src/runtime/composables/useDisplayForReka.ts +37 -0
  171. package/src/runtime/composables/useFallbackId.ts +6 -0
  172. package/src/runtime/composables/useInjectedDarkMode.ts +1 -2
  173. package/src/runtime/composables/usePopupConstrainToStyle.ts +29 -0
  174. package/src/runtime/composables/useSetupDarkMode.ts +122 -4
  175. package/src/runtime/helpers/NotificationHandler.ts +2 -2
  176. package/src/runtime/injectionKeys.ts +1 -7
  177. package/src/runtime/types/index.ts +105 -32
  178. package/types/components.d.ts +14 -15
  179. package/dist/runtime/components/Aria/Aria.d.vue.ts +0 -6
  180. package/dist/runtime/components/Aria/Aria.vue +0 -16
  181. package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -6
  182. package/dist/runtime/components/LibButton/LibButton.d.vue.ts +0 -37
  183. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -37
  184. package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +0 -41
  185. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +0 -103
  186. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -41
  187. package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +0 -64
  188. package/dist/runtime/components/LibColorInput/LibColorInput.vue +0 -162
  189. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +0 -64
  190. package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +0 -191
  191. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +0 -191
  192. package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +0 -46
  193. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -46
  194. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +0 -256
  195. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -387
  196. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -256
  197. package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +0 -27
  198. package/dist/runtime/components/LibLabel/LibLabel.vue +0 -45
  199. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -27
  200. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +0 -109
  201. package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +0 -45
  202. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -45
  203. package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +0 -15
  204. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -15
  205. package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +0 -105
  206. package/dist/runtime/components/LibPagination/LibPagination.vue +0 -229
  207. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -105
  208. package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +0 -15
  209. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -15
  210. package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +0 -52
  211. package/dist/runtime/components/LibPopup/LibPopup.vue +0 -365
  212. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -52
  213. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +0 -169
  214. package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +0 -99
  215. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +0 -178
  216. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -99
  217. package/dist/runtime/components/LibTable/LibTable.d.vue.ts +0 -125
  218. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -125
  219. package/dist/runtime/components/Template/NAME.d.vue.ts +0 -18
  220. package/dist/runtime/components/Template/NAME.vue +0 -27
  221. package/dist/runtime/components/Template/NAME.vue.d.ts +0 -18
  222. package/dist/runtime/components/Template/TemplateStory.d.ts +0 -7
  223. package/dist/runtime/components/Template/TemplateStory.js +0 -22
  224. package/dist/runtime/components/shared/props.d.ts +0 -171
  225. package/dist/runtime/components/shared/props.js +0 -2
  226. package/dist/runtime/composables/useAriaLabel.d.ts +0 -6
  227. package/dist/runtime/composables/useAriaLabel.js +0 -15
  228. package/dist/runtime/composables/useDarkMode.d.ts +0 -77
  229. package/dist/runtime/composables/useDarkMode.js +0 -89
  230. package/dist/runtime/composables/useDivideAttrs.d.ts +0 -27
  231. package/dist/runtime/composables/useDivideAttrs.js +0 -27
  232. package/dist/runtime/composables/useSuggestions.d.ts +0 -40
  233. package/dist/runtime/composables/useSuggestions.js +0 -263
  234. package/src/runtime/components/Aria/Aria.vue +0 -26
  235. package/src/runtime/components/LibButton/LibButton.stories.ts +0 -106
  236. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -131
  237. package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -203
  238. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +0 -405
  239. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -419
  240. package/src/runtime/components/LibLabel/LibLabel.stories.ts +0 -33
  241. package/src/runtime/components/LibLabel/LibLabel.vue +0 -65
  242. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -123
  243. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +0 -131
  244. package/src/runtime/components/LibPagination/LibPagination.stories.ts +0 -49
  245. package/src/runtime/components/LibPagination/LibPagination.vue +0 -274
  246. package/src/runtime/components/LibPopup/LibPopup.stories.ts +0 -153
  247. package/src/runtime/components/LibPopup/LibPopup.vue +0 -396
  248. package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +0 -90
  249. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -197
  250. package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +0 -134
  251. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -212
  252. package/src/runtime/components/Template/NAME.vue +0 -49
  253. package/src/runtime/components/Template/TemplateStory.ts +0 -37
  254. package/src/runtime/components/shared/props.ts +0 -199
  255. package/src/runtime/composables/useAriaLabel.ts +0 -23
  256. package/src/runtime/composables/useDarkMode.ts +0 -199
  257. package/src/runtime/composables/useDivideAttrs.ts +0 -53
  258. package/src/runtime/composables/useSuggestions.ts +0 -339
  259. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.d.ts +0 -0
  260. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.js +0 -0
  261. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.d.ts +0 -0
  262. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.js +0 -0
  263. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.d.ts +0 -0
  264. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.js +0 -0
  265. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.d.ts +0 -0
  266. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.js +0 -0
  267. /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.d.vue.ts → WDatePicker/WRangeDatePicker.d.vue.ts} +0 -0
  268. /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue.d.ts → WDatePicker/WRangeDatePicker.vue.d.ts} +0 -0
  269. /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.d.vue.ts → WDatePicker/WSingleDatePicker.d.vue.ts} +0 -0
  270. /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue.d.ts → WDatePicker/WSingleDatePicker.vue.d.ts} +0 -0
  271. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.d.ts +0 -0
  272. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.js +0 -0
  273. /package/dist/runtime/components/{LibDebug/LibDebug.d.vue.ts → WDebug/WDebug.d.vue.ts} +0 -0
  274. /package/dist/runtime/components/{LibDebug/LibDebug.vue.d.ts → WDebug/WDebug.vue.d.ts} +0 -0
  275. /package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -0
  276. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.d.vue.ts → WNotifications/WNotificationTestMessageComponent.d.vue.ts} +0 -0
  277. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
  278. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue.d.ts → WNotifications/WNotificationTestMessageComponent.vue.d.ts} +0 -0
  279. /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.d.ts +0 -0
  280. /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.js +0 -0
  281. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.ts +0 -0
  282. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.ts +0 -0
  283. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.ts +0 -0
  284. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.ts +0 -0
  285. /package/src/runtime/components/{LibDatePicker → WDatePicker}/helpers.ts +0 -0
  286. /package/src/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
  287. /package/src/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.ts +0 -0
@@ -0,0 +1,209 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ import type { Meta, StoryObj } from "@storybook/vue3"
3
+ import { ref, watch } from "vue"
4
+
5
+ import { playAllowNewValues, playBasic, playBasicClickSelect, playBasicKeyboardSelect, playValidation } from "./storyPlays.js"
6
+ import WCombobox from "./WCombobox.vue"
7
+
8
+ import * as components from "../index.js"
9
+
10
+
11
+ const meta: Meta<typeof WCombobox> = {
12
+ component: WCombobox as any,
13
+ title: "Components/Combobox",
14
+ args: {
15
+ modelValue: "",
16
+ searchTerm: "",
17
+ emptyLabel: "No matches found",
18
+ suggestions: ["A", "AB", "ABC", "B", "BC", "C", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
19
+ }
20
+ }
21
+
22
+ export default meta
23
+
24
+ type ExtraTestArgs = {
25
+ _simulateLoading?: boolean
26
+ _allowSave?: boolean
27
+ _headerTemplate?: string
28
+ }
29
+
30
+ type Story = StoryObj<typeof WCombobox> & { args?: ExtraTestArgs }
31
+
32
+ /**
33
+ * Primary story setup to match the DOM structure expected by the
34
+ * migrated play functions (specifically looking for data-testid="model-value").
35
+ */
36
+ export const Primary: Story = {
37
+ render: args => {
38
+ const extraArgs = args as ExtraTestArgs
39
+ return {
40
+ components,
41
+ setup() {
42
+ const modelValue = ref(args.modelValue)
43
+ const searchTerm = ref(args.searchTerm)
44
+ const suggestions = ref([...args.suggestions!])
45
+ const loading = ref(false)
46
+ const simulateLoading = ref((extraArgs)._simulateLoading)
47
+ // the component takes care of extending this so we can actually see the icon on quick loads like this
48
+ watch(searchTerm, () => {
49
+ if (simulateLoading.value) {
50
+ loading.value = true
51
+ setTimeout(() => {
52
+ loading.value = false
53
+ }, 1)
54
+ }
55
+ })
56
+ function save(value: string) {
57
+ if (!(extraArgs)._allowSave) return
58
+ const newValue: any
59
+ = typeof value === "string" && typeof suggestions.value[0] === "object"
60
+ ? { name: value, id: "new-id" }
61
+ : value
62
+ suggestions.value = [...suggestions.value, newValue]
63
+ modelValue.value = newValue
64
+ }
65
+ return {
66
+ args,
67
+ modelValue,
68
+ searchTerm,
69
+ suggestions,
70
+ loading,
71
+ simulateLoading,
72
+ save,
73
+ extraArgs
74
+ }
75
+ },
76
+ template: `
77
+ <div class="flex flex-col gap-3">
78
+ <div class="flex flex-col gap-1">
79
+ <WCheckbox v-model="simulateLoading">Simulate Loading</WCheckbox>
80
+ <WCheckbox v-model="loading">Loading (Force State)</WCheckbox>
81
+ </div>
82
+ <div class="text-xs text-neutral-500">
83
+ <div>
84
+ Current Model Value:
85
+ <span class="font-mono" data-testid="model-value">{{ modelValue }}</span>
86
+ </div>
87
+ <div>
88
+ Current Search Term:
89
+ <span class="font-mono" data-testid="search-term">{{ searchTerm }}</span>
90
+ </div>
91
+ </div>
92
+
93
+ <div class="flex flex-col gap-1">
94
+ <WCombobox
95
+ @save="save"
96
+ v-bind="args"
97
+ v-model="modelValue"
98
+ v-model:searchTerm="searchTerm"
99
+ :suggestions="suggestions"
100
+ :loading="loading"
101
+ >
102
+ ${(extraArgs)._headerTemplate ?? ""}
103
+ </WCombobox>
104
+ </div>
105
+ </div>
106
+ `
107
+ }
108
+ },
109
+ play: async (...args) => {
110
+ await playBasicClickSelect(...args)
111
+ await playBasicKeyboardSelect(...args)
112
+ await playBasic(...args)
113
+ }
114
+ }
115
+
116
+ export const RestrictToSuggestions: Story = {
117
+ ...Primary,
118
+ args: {
119
+ ...Primary.args,
120
+ restrictToSuggestions: true
121
+ },
122
+ play: async (...args) => {
123
+ await playBasicClickSelect(...args)
124
+ await playBasicKeyboardSelect(...args)
125
+ await playBasic(...args)
126
+ }
127
+ }
128
+
129
+
130
+ export const ObjectSuggestions: Story = {
131
+ ...Primary,
132
+ play: undefined,
133
+ args: {
134
+ ...Primary.args,
135
+ suggestions: [
136
+ { id: 1, name: "Apple" },
137
+ { id: 2, name: "Banana" },
138
+ { id: 3, name: "Cherry" }
139
+ ] as any[],
140
+ displayKey: "name"
141
+ }
142
+ }
143
+
144
+
145
+ export const AllowNewValues: Story = {
146
+ ...Primary,
147
+ args: {
148
+ ...Primary.args,
149
+ _allowSave: true,
150
+ _headerTemplate: `
151
+ <template #header="slotProps">
152
+ <div v-if="slotProps.isShowingEmptyLabel" :class="slotProps.class">
153
+ Press Enter to Add Value
154
+ </div>
155
+ </template>
156
+ `
157
+ },
158
+ play: playAllowNewValues
159
+ }
160
+
161
+ /** Note that when allowing new values to be added, if the input is v-modeling objects, you have to transform the object before adding it to the suggestions array. */
162
+ export const ObjectSuggestionsCustomDisplay: Story = {
163
+ ...Primary,
164
+ play: undefined,
165
+ args: {
166
+ ...Primary.args,
167
+ _allowSave: true,
168
+ suggestions: [
169
+ { id: 1, name: "Apple" },
170
+ { id: 2, name: "Banana" },
171
+ { id: 3, name: "Cherry" }
172
+ ] as any[],
173
+ displayEntry: (value: any) => {
174
+ return value.name?.toLowerCase()
175
+ }
176
+ }
177
+ }
178
+
179
+
180
+ export const CustomHeader: Story = {
181
+ ...Primary,
182
+ play: undefined,
183
+ args: {
184
+ ...Primary.args,
185
+ loading: true,
186
+ _headerTemplate: `<template #header> Custom Header </template>`
187
+ }
188
+ }
189
+
190
+ export const WithValidation: Story = {
191
+ ...Primary,
192
+ args: {
193
+ ...Primary.args,
194
+ loading: true,
195
+ isValid: (searchTerm: string) => searchTerm === "Invalid" ? "Error Message" : true,
196
+ modelValue: "Invalid"
197
+ },
198
+ play: playValidation
199
+ }
200
+
201
+ export const LoadingIndicator: Story = {
202
+ ...Primary,
203
+ play: undefined,
204
+ args: {
205
+ ...Primary.args,
206
+ _simulateLoading: true
207
+ }
208
+ }
209
+
@@ -0,0 +1,450 @@
1
+ <template>
2
+ <!-- reka's filter does not work well, specially with lowercase/uppercase, e.g. A !== A but a === A ??? -->
3
+ <ComboboxRoot
4
+ :ignore-filter="true"
5
+ :class="twMerge(`combobox-root relative`, $attrs?.class as any)"
6
+ v-bind="{ ...$attrs, class: undefined }"
7
+ :reset-search-term-on-select="true"
8
+ :reset-search-term-on-blur="true"
9
+ :open-on-click="true"
10
+ ref="comboboxRootComponent"
11
+ v-model:open="open"
12
+ v-model="modelValue"
13
+ >
14
+ <ComboboxAnchor
15
+ class="combobox-anchor justify-between flex"
16
+ >
17
+ <div
18
+ :class="twMerge(`
19
+ combobox--input-wrapper
20
+ flex
21
+ items-center
22
+ justify-between
23
+ rounded-sm
24
+ px-1
25
+ leading-none
26
+ fg-inherit
27
+ bg-inherit
28
+ outlined-within:border-accent-500
29
+ gap-2
30
+ focus-outline-none
31
+ focus-outline-hidden
32
+ w-full
33
+ min-w-0
34
+ `, errorMessage !== false && `!border-danger-500`,
35
+ border &&`
36
+ border
37
+ border-neutral-300
38
+ dark:border-neutral-700
39
+ bg-white
40
+ dark:bg-neutral-800/50
41
+ focus:bg-bg
42
+ dark:focus:bg-neutral-800
43
+ dark:focus:border-accent-500
44
+ focus-within:border-accent-500
45
+ dark:focus-within:border-accent-500
46
+ has-[input:invalid]:border-danger-500
47
+ invalid:border-danger-500
48
+ `,
49
+ filtered.length > 0 && open && popupSide === 'top' && `rounded-tl-none rounded-tr-none`,
50
+ filtered.length > 0 && open && popupSide === 'bottom' && `rounded-bl-none rounded-br-none`
51
+ )"
52
+ >
53
+ <!-- @vue-expect-error aria/keydown can be defined -->
54
+ <ComboboxInput
55
+ :id="id"
56
+ :display-value="display"
57
+ spellcheck="false"
58
+ :aria-invalid="errorMessage !== false"
59
+ :aria-busy="loading"
60
+ :aria-errormessage="ariaDescribedBy"
61
+ :class="twMerge(`
62
+ combobox--input
63
+ bg-transparent
64
+ min-w-[70px]
65
+ w-full
66
+ outline-hidden
67
+ px-1
68
+ `,
69
+ inputProps?.class
70
+ )"
71
+ v-bind="{ ...inputProps, class: undefined }"
72
+ :aria-describedby="ariaDescribedBy"
73
+ v-model="searchTerm"
74
+ @keydown.enter="save"
75
+ />
76
+ <Transition>
77
+ <slot
78
+ v-if="showLoadingIndicator"
79
+ name="loading-indicator"
80
+ >
81
+ <WIcon
82
+ v-if="showLoadingIndicator"
83
+ aria-label="Loading suggestions"
84
+ class="
85
+ combobox--loading-indicator
86
+ animate-spin
87
+ text-neutral-500
88
+ -mr-1
89
+ "
90
+ >
91
+ <i-lucide-loader-circle/>
92
+ </WIcon>
93
+ </slot>
94
+ </Transition>
95
+ <slot name="right"/>
96
+ <ComboboxTrigger
97
+ :as-child="true"
98
+ >
99
+ <slot
100
+ name="trigger"
101
+ v-bind="{ open }"
102
+ >
103
+ <WButton
104
+ :border="false"
105
+ class="combobox--toggle p-0 text-neutral-800 dark:text-neutral-200"
106
+ :aria-label="open ? 'Close' : 'Open'"
107
+ >
108
+ <slot
109
+ name="toggle"
110
+ :is-open="open"
111
+ >
112
+ <WIcon
113
+ :class="twMerge(`combobox--toggle scale-150`, open && `rotate-180`)"
114
+ >
115
+ <i-lucide-chevron-down/>
116
+ </WIcon>
117
+ </slot>
118
+ </WButton>
119
+ </slot>
120
+ </ComboboxTrigger>
121
+ </div>
122
+ </ComboboxAnchor>
123
+ <ComboboxPortal :to="to">
124
+ <ComboboxContent
125
+ v-if="showEmptyLabel || filtered.length > 0 || errorMessage !== false"
126
+ :style="contentStyle"
127
+ :class="twMerge(`
128
+ combobox--content
129
+ z-100
130
+ w-[var(--reka-combobox-trigger-width)]
131
+ align-end
132
+ bg-white
133
+ dark:bg-neutral-900
134
+ will-change-[opacity,transform]
135
+ data-[side=top]:animate-slideDownAndFade
136
+ data-[side=right]:animate-slideLeftAndFade
137
+ data-[side=bottom]:animate-slideUpAndFade
138
+ data-[side=left]:animate-slideRightAndFade
139
+ border-neutral-300
140
+ dark:border-neutral-700
141
+ border
142
+ rounded-sm
143
+ shadow-lg
144
+ shadow-black/50
145
+ data-[side=bottom]:border-t-0
146
+ data-[side=top]:border-b-0
147
+ dark:data-[side=bottom]:border-t-0
148
+ dark:data-[side=top]:border-b-0
149
+ data-[side=bottom]:rounded-tl-none
150
+ data-[side=bottom]:rounded-tr-none
151
+ data-[side=top]:rounded-bl-none
152
+ data-[side=top]:rounded-br-none
153
+ max-h-[500px]
154
+ overflow-y-auto
155
+ `, contentProps?.class)"
156
+ ref="contentComponent"
157
+ v-bind="{
158
+ side: 'bottom',
159
+ position: 'popper',
160
+ avoidCollisions: true,
161
+ prioritizePosition: true,
162
+ ...contentProps,
163
+ class: undefined
164
+ }"
165
+ >
166
+ <ComboboxViewport
167
+
168
+ class="combobox--viewport flex flex-col"
169
+ >
170
+ <Transition>
171
+ <div
172
+ v-if="useSlots()['header']"
173
+ :id="`${id}-instruction`"
174
+ class="
175
+ combobox--popup-header
176
+ px-2
177
+ flex
178
+ items-center
179
+ justify-center
180
+ "
181
+ >
182
+ <slot
183
+ :filtered="filtered"
184
+ :is-showing-empty-label="showEmptyLabel"
185
+ name="header"
186
+ class="
187
+ text-neutral-800
188
+ dark:text-neutral-200
189
+ combobox--popup-label
190
+ text-ellipsis
191
+ overflow-hidden
192
+ whitespace-nowrap
193
+ "
194
+ />
195
+ </div>
196
+ </Transition>
197
+ <slot
198
+ v-if="errorMessage !== false"
199
+ name="invalid"
200
+ v-bind="{ searchTerm, errorMessage, id: `${id}-error`, role: 'alert' }"
201
+ >
202
+ <div
203
+ :id="`${id}-error`"
204
+ role="alert"
205
+ class="
206
+ combobox--error-message
207
+ text-danger-500
208
+ dark:text-danger-500
209
+ text-sm
210
+ px-2
211
+ py-1
212
+ bg-danger-100
213
+ dark:bg-danger-800
214
+ flex
215
+ items-center
216
+ justify-center
217
+ "
218
+ >
219
+ {{ errorMessage }}
220
+ </div>
221
+ </slot>
222
+ <ComboboxEmpty
223
+ v-if="showEmptyLabel"
224
+ class="
225
+ combobox--empty
226
+ px-2
227
+ text-center
228
+ text-neutral-800
229
+ dark:text-neutral-200
230
+ bg-neutral-100
231
+ dark:bg-neutral-800
232
+ "
233
+ >
234
+ {{ emptyLabel }}
235
+ </ComboboxEmpty>
236
+ <slot
237
+ name="suggestions"
238
+ v-bind="{ filtered, display, searchTerm }"
239
+ >
240
+ <div
241
+ class="
242
+ combobox--suggestions
243
+ flex-col
244
+ flex
245
+ max-h-[500px]
246
+ overflow-y-auto
247
+ "
248
+ >
249
+ <ComboboxItem
250
+ class="
251
+ combobox--suggestion
252
+ flex
253
+ justify-between
254
+ gap-2
255
+ px-2
256
+ cursor-pointer
257
+ data-[highlighted]:outline-hidden
258
+ data-[highlighted]:bg-accent-200
259
+ data-[highlighted]:text-accent-800
260
+ dark:data-[highlighted]:bg-accent-800
261
+ dark:data-[highlighted]:text-accent-200
262
+ "
263
+ :value="suggestion"
264
+ v-for="(suggestion, index) in filtered"
265
+ :key="index"
266
+ >
267
+ <slot
268
+ name="suggestion-icon"
269
+ v-bind="{ suggestion: suggestion as Exclude<TSuggestion, any[]> }"
270
+ />
271
+ <slot
272
+ name="suggestion"
273
+ v-bind="{
274
+ suggestion: suggestion as Exclude<TSuggestion, any[]>,
275
+ suggestionText: display(suggestion)
276
+ }"
277
+ >
278
+ <div
279
+ class="
280
+ combobox--suggestion-label
281
+ "
282
+ >
283
+ {{ display(suggestion) }}
284
+ </div>
285
+ </slot>
286
+ </ComboboxItem>
287
+ </div>
288
+ </slot>
289
+ </ComboboxViewport>
290
+ </ComboboxContent>
291
+ </ComboboxPortal>
292
+ </ComboboxRoot>
293
+ </template>
294
+
295
+ <script setup lang="ts" generic="TSuggestion extends NonNullable<AcceptableValue>">
296
+ import type { AcceptableValue, ComboboxContentEmits, ComboboxContentProps, ComboboxInputEmits, ComboboxInputProps } from "reka-ui"
297
+ import {
298
+ ComboboxAnchor,
299
+ ComboboxContent,
300
+ ComboboxEmpty,
301
+ ComboboxInput,
302
+ ComboboxItem,
303
+ ComboboxPortal,
304
+ ComboboxRoot,
305
+ ComboboxTrigger,
306
+ ComboboxViewport, useFilter } from "reka-ui"
307
+ import type { EmitsToProps, HTMLAttributes, InputHTMLAttributes } from "vue"
308
+ import { computed, nextTick, ref, useAttrs, useSlots, useTemplateRef, watch } from "vue"
309
+
310
+ import ILucideChevronDown from "~icons/lucide/chevron-down"
311
+ import ILucideLoaderCircle from "~icons/lucide/loader-circle"
312
+
313
+ import { useDelayedLoadingIndicator } from "../../composables/useDelayedLoadingIndicator.js"
314
+ import { type SuggestionsDisplayProps, useDisplayForReka } from "../../composables/useDisplayForReka.js"
315
+ import { useFallbackId } from "../../composables/useFallbackId.js"
316
+ import { usePopupConstrainToStyle } from "../../composables/usePopupConstrainToStyle.js"
317
+ import { usePreHydrationValue } from "../../composables/usePreHydrationValue.js"
318
+ import type { PopupConstrainToProps } from "../../types/index.js"
319
+ import { twMerge } from "../../utils/twMerge.js"
320
+ import WButton from "../WButton/WButton.vue"
321
+ import WIcon from "../WIcon/WIcon.vue"
322
+
323
+ const $attrs = useAttrs()
324
+
325
+ const emit = defineEmits<{
326
+ (e: "save", value: string): void
327
+ (e: "new", value: string): void
328
+ }>()
329
+
330
+ const props = withDefaults(defineProps<
331
+ & SuggestionsDisplayProps<TSuggestion>
332
+ & PopupConstrainToProps
333
+ & {
334
+ id?: string
335
+ border?: boolean
336
+ to?: string
337
+ /**
338
+ * Validates the input, return true if valid, otherwise return an error message.
339
+ *
340
+ * If the input is invalid, modelValue is not updated. Empty inputs are visually valid, but they cannot trigger saves or or any setting of modelValue.
341
+ *
342
+ * If restrictToSuggestions is true, the input will be invalid if there is no exact match.
343
+ *
344
+ * `save` will not be emitted when the input is invalid.
345
+ *
346
+ * To show an error message, return a string from the function.
347
+ */
348
+ isValid?: (searchTerm: string) => true | string
349
+ suggestions: TSuggestion[]
350
+ /** Shown in the popup when the search term is valid, not empty, not already selected, there are no suggestions, and restrictToSuggestions is false. Defaults to undefined. */
351
+ emptyLabel?: string
352
+ /** The popup can't be styled via the regular class attr because it's teleported. You can also pass any reka ComboboxContent options. */
353
+ contentProps?: { class?: string, to?: string } & HTMLAttributes & ComboboxContentProps & EmitsToProps<ComboboxContentEmits>
354
+ /** Disables the filter. */
355
+ ignoreFilter?: boolean
356
+ /** If false, modelValue is set to the search term (so long as it's valid). */
357
+ restrictToSuggestions?: boolean
358
+ /** Input attributes or reka-ui ComboboxInput props. */
359
+ inputProps?: Omit<InputHTMLAttributes, "class"> & { class?: string } & HTMLAttributes & ComboboxInputProps & EmitsToProps<ComboboxInputEmits>
360
+ }>(), {
361
+ border: true,
362
+ ignoreFilter: false,
363
+ emptyLabel: undefined,
364
+ isValid: (_: string) => true as const,
365
+ restrictToSuggestions: false,
366
+ to: "#root"
367
+ })
368
+ const finalId = useFallbackId(props)
369
+
370
+ const contentStyle = usePopupConstrainToStyle("combobox-content", props, [props?.contentProps?.style])
371
+
372
+ const modelValue = defineModel<TSuggestion>({ required: false, default: "" })
373
+ usePreHydrationValue(finalId, modelValue)
374
+ const open = defineModel<boolean>("open", { required: false, default: false })
375
+ const searchTerm = defineModel<string>("searchTerm", { default: "" })
376
+ const display = useDisplayForReka(props)
377
+
378
+ const { contains } = useFilter()
379
+ const filtered = computed(() => {
380
+ const f = props.ignoreFilter
381
+ ? props.suggestions
382
+ : props.suggestions.filter(v => {
383
+ return contains(display(v), searchTerm.value)
384
+ })
385
+ if ((f?.length ?? 0) === 0 && props.restrictToSuggestions) {
386
+ return props.suggestions
387
+ } else {
388
+ return f
389
+ }
390
+ })
391
+
392
+ const errorMessage = computed(() => {
393
+ if (searchTerm.value === "") return false
394
+ const isExactMatch = filtered.value.find(v => display(v) === searchTerm.value)
395
+ if (!props.restrictToSuggestions && isExactMatch) return false
396
+ const validation = props.isValid(searchTerm.value)
397
+ if (validation === true) return false
398
+ return validation
399
+ })
400
+
401
+
402
+ watch(searchTerm, () => {
403
+ const isExactMatch = filtered.value.find(v => display(v) === searchTerm.value)
404
+ if (isExactMatch) {
405
+ modelValue.value = isExactMatch
406
+ }
407
+ })
408
+
409
+
410
+ function save(e: Event) {
411
+ if (errorMessage.value !== false || searchTerm.value === "") {
412
+ open.value = false
413
+ return
414
+ }
415
+ e.preventDefault()
416
+ emit("save", searchTerm.value)
417
+ open.value = false
418
+ }
419
+
420
+ const loading = defineModel<boolean>("loading", { default: false })
421
+ const showLoadingIndicator = useDelayedLoadingIndicator(loading)
422
+
423
+ const showEmptyLabel = computed(() => {
424
+ return errorMessage.value === false
425
+ && !props.restrictToSuggestions
426
+ && searchTerm.value !== ""
427
+ && props.emptyLabel !== ""
428
+ && !props.suggestions.some(s => display(s) === searchTerm.value)
429
+ })
430
+
431
+ const ariaDescribedBy = computed(() => {
432
+ const ids = []
433
+ if (open.value) ids.push(`${props.id}-instruction`)
434
+ if (errorMessage.value !== false) ids.push(`${props.id}-error`)
435
+ if ("ariaDescribedby" in $attrs) ids.push($attrs.ariaDescribedby as any)
436
+ return ids.join(" ") || undefined
437
+ })
438
+
439
+ const contentComp = useTemplateRef("contentComponent")
440
+ const popupSide = ref<"top" | "right" | "bottom" | "left" | undefined>(undefined)
441
+ watch(open, () => {
442
+ nextTick(() => {
443
+ if (open.value && contentComp.value?.$el) {
444
+ popupSide.value = contentComp.value.$el.getAttribute("data-side")
445
+ } else {
446
+ popupSide.value = undefined
447
+ }
448
+ })
449
+ })
450
+ </script>