@witchcraft/ui 0.3.24 → 0.4.0-beta.1

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 (288) hide show
  1. package/README.md +54 -61
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/assets/animations.css +1 -1
  4. package/dist/runtime/assets/locales/en.json +2 -0
  5. package/dist/runtime/assets/utils.css +1 -1
  6. package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
  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 +109 -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} +5 -4
  21. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +40 -29
  22. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue.d.ts → WColorPicker/WColorPicker.vue.d.ts} +5 -4
  23. package/dist/runtime/components/WCombobox/WCombobox.d.vue.ts +109 -0
  24. package/dist/runtime/components/WCombobox/WCombobox.vue +402 -0
  25. package/dist/runtime/components/WCombobox/WCombobox.vue.d.ts +109 -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} +16 -21
  35. package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +16 -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} +9 -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} +71 -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 +149 -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} +38 -50
  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} +44 -28
  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 +43 -0
  67. package/dist/runtime/components/WPopover/WPopover.vue +138 -0
  68. package/dist/runtime/components/WPopover/WPopover.vue.d.ts +43 -0
  69. package/dist/runtime/components/WPopup/WPopup.d.vue.ts +41 -0
  70. package/dist/runtime/components/WPopup/WPopup.vue +74 -0
  71. package/dist/runtime/components/WPopup/WPopup.vue.d.ts +41 -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} +9 -16
  82. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +12 -23
  83. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue.d.ts → WSimpleInput/WSimpleInput.vue.d.ts} +9 -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 +111 -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 +25 -3
  106. package/dist/runtime/helpers/NotificationHandler.js +5 -9
  107. package/dist/runtime/injectionKeys.d.ts +1 -5
  108. package/dist/runtime/injectionKeys.js +0 -2
  109. package/dist/runtime/types/index.d.ts +85 -27
  110. package/dist/runtime/types/index.js +1 -0
  111. package/package.json +43 -43
  112. package/src/runtime/assets/animations.css +5 -5
  113. package/src/runtime/assets/locales/en.json +2 -0
  114. package/src/runtime/assets/utils.css +43 -0
  115. package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
  116. package/src/runtime/components/TestControls/TestControls.vue +3 -3
  117. package/src/runtime/components/WButton/WButton.stories.ts +112 -0
  118. package/src/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +34 -50
  119. package/src/runtime/components/{LibCheckbox/LibCheckbox.stories.ts → WCheckbox/WCheckbox.stories.ts} +5 -5
  120. package/src/runtime/components/WCheckbox/WCheckbox.vue +123 -0
  121. package/src/runtime/components/{LibColorInput/LibColorInput.stories.ts → WColorInput/WColorInput.stories.ts} +8 -8
  122. package/src/runtime/components/WColorInput/WColorInput.vue +112 -0
  123. package/src/runtime/components/WColorInput/WColorSwatchButton.vue +102 -0
  124. package/src/runtime/components/{LibColorPicker/LibColorPicker.stories.ts → WColorPicker/WColorPicker.stories.ts} +12 -12
  125. package/src/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +43 -32
  126. package/src/runtime/components/WCombobox/WCombobox.stories.ts +209 -0
  127. package/src/runtime/components/WCombobox/WCombobox.vue +446 -0
  128. package/src/runtime/components/WCombobox/storyPlays.ts +92 -0
  129. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts → WDarkModeSwitcher/WDarkModeSwitcher.stories.ts} +6 -6
  130. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +19 -30
  131. package/src/runtime/components/{LibDatePicker/LibDatePicker.stories.ts → WDatePicker/WDatePicker.stories.ts} +42 -34
  132. package/src/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
  133. package/src/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +16 -22
  134. package/src/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +16 -22
  135. package/src/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
  136. package/src/runtime/components/{LibDebug/LibDebug.stories.ts → WDebug/WDebug.stories.ts} +5 -5
  137. package/src/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +8 -11
  138. package/src/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -4
  139. package/src/runtime/components/{LibFileInput/LibFileInput.stories.ts → WFileInput/WFileInput.stories.ts} +7 -7
  140. package/src/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +95 -98
  141. package/src/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +5 -8
  142. package/src/runtime/components/{LibMultiValues/LibMultiValues.stories.ts → WMultiValues/WMultiValues.stories.ts} +9 -9
  143. package/src/runtime/components/WMultiValues/WMultiValues.vue +161 -0
  144. package/src/runtime/components/{LibNotifications/LibNotification.stories.ts → WNotifications/WNotification.stories.ts} +24 -9
  145. package/src/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +46 -66
  146. package/src/runtime/components/WNotifications/WNotifications.stories.ts +139 -0
  147. package/src/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +60 -40
  148. package/src/runtime/components/WNumberInput/WNumberInput.vue +109 -0
  149. package/src/runtime/components/WPagination/WPagination.stories.ts +51 -0
  150. package/src/runtime/components/WPagination/WPagination.vue +207 -0
  151. package/src/runtime/components/{LibPalette/LibPalette.stories.ts → WPalette/WPalette.stories.ts} +6 -6
  152. package/src/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
  153. package/src/runtime/components/WPopover/WPopover.stories.ts +218 -0
  154. package/src/runtime/components/WPopover/WPopover.vue +161 -0
  155. package/src/runtime/components/WPopup/WPopup.stories.ts +60 -0
  156. package/src/runtime/components/WPopup/WPopup.vue +93 -0
  157. package/src/runtime/components/WProgressBar/WProgressBar.stories.ts +119 -0
  158. package/src/runtime/components/WProgressBar/WProgressBar.vue +185 -0
  159. package/src/runtime/components/{LibRecorder/LibRecorder.stories.ts → WRecorder/WRecorder.stories.ts} +9 -6
  160. package/src/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +69 -68
  161. package/src/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +18 -15
  162. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.stories.ts → WSimpleInput/WSimpleInput.stories.ts} +11 -12
  163. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +27 -44
  164. package/src/runtime/components/{LibTable/LibTable.stories.ts → WTable/WTable.stories.ts} +60 -52
  165. package/src/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +85 -87
  166. package/src/runtime/components/WTooltip/WTooltip.stories.ts +82 -0
  167. package/src/runtime/components/WTooltip/WTooltip.vue +126 -0
  168. package/src/runtime/components/index.ts +20 -20
  169. package/src/runtime/composables/index.ts +4 -4
  170. package/src/runtime/composables/useDelayedLoadingIndicator.ts +30 -0
  171. package/src/runtime/composables/useDisplayForReka.ts +37 -0
  172. package/src/runtime/composables/useFallbackId.ts +6 -0
  173. package/src/runtime/composables/useInjectedDarkMode.ts +1 -2
  174. package/src/runtime/composables/usePopupConstrainToStyle.ts +29 -0
  175. package/src/runtime/composables/useSetupDarkMode.ts +122 -4
  176. package/src/runtime/helpers/NotificationHandler.ts +26 -11
  177. package/src/runtime/injectionKeys.ts +1 -7
  178. package/src/runtime/types/index.ts +105 -32
  179. package/types/components.d.ts +13 -15
  180. package/dist/runtime/components/Aria/Aria.d.vue.ts +0 -6
  181. package/dist/runtime/components/Aria/Aria.vue +0 -16
  182. package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -6
  183. package/dist/runtime/components/LibButton/LibButton.d.vue.ts +0 -37
  184. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -37
  185. package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +0 -41
  186. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +0 -103
  187. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -41
  188. package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +0 -64
  189. package/dist/runtime/components/LibColorInput/LibColorInput.vue +0 -162
  190. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +0 -64
  191. package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +0 -191
  192. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +0 -191
  193. package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +0 -46
  194. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -46
  195. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +0 -256
  196. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -387
  197. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -256
  198. package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +0 -27
  199. package/dist/runtime/components/LibLabel/LibLabel.vue +0 -45
  200. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -27
  201. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +0 -109
  202. package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +0 -45
  203. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -45
  204. package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +0 -15
  205. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -15
  206. package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +0 -105
  207. package/dist/runtime/components/LibPagination/LibPagination.vue +0 -229
  208. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -105
  209. package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +0 -15
  210. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -15
  211. package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +0 -52
  212. package/dist/runtime/components/LibPopup/LibPopup.vue +0 -365
  213. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -52
  214. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +0 -169
  215. package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +0 -99
  216. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +0 -178
  217. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -99
  218. package/dist/runtime/components/LibTable/LibTable.d.vue.ts +0 -125
  219. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -125
  220. package/dist/runtime/components/Template/NAME.d.vue.ts +0 -18
  221. package/dist/runtime/components/Template/NAME.vue +0 -27
  222. package/dist/runtime/components/Template/NAME.vue.d.ts +0 -18
  223. package/dist/runtime/components/Template/TemplateStory.d.ts +0 -7
  224. package/dist/runtime/components/Template/TemplateStory.js +0 -22
  225. package/dist/runtime/components/shared/props.d.ts +0 -171
  226. package/dist/runtime/components/shared/props.js +0 -2
  227. package/dist/runtime/composables/useAriaLabel.d.ts +0 -6
  228. package/dist/runtime/composables/useAriaLabel.js +0 -15
  229. package/dist/runtime/composables/useDarkMode.d.ts +0 -77
  230. package/dist/runtime/composables/useDarkMode.js +0 -89
  231. package/dist/runtime/composables/useDivideAttrs.d.ts +0 -27
  232. package/dist/runtime/composables/useDivideAttrs.js +0 -27
  233. package/dist/runtime/composables/useSuggestions.d.ts +0 -40
  234. package/dist/runtime/composables/useSuggestions.js +0 -263
  235. package/src/runtime/components/Aria/Aria.vue +0 -26
  236. package/src/runtime/components/LibButton/LibButton.stories.ts +0 -106
  237. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -131
  238. package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -203
  239. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +0 -405
  240. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -419
  241. package/src/runtime/components/LibLabel/LibLabel.stories.ts +0 -33
  242. package/src/runtime/components/LibLabel/LibLabel.vue +0 -65
  243. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -123
  244. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +0 -127
  245. package/src/runtime/components/LibPagination/LibPagination.stories.ts +0 -49
  246. package/src/runtime/components/LibPagination/LibPagination.vue +0 -274
  247. package/src/runtime/components/LibPopup/LibPopup.stories.ts +0 -153
  248. package/src/runtime/components/LibPopup/LibPopup.vue +0 -396
  249. package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +0 -90
  250. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -197
  251. package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +0 -134
  252. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -212
  253. package/src/runtime/components/Template/NAME.vue +0 -49
  254. package/src/runtime/components/Template/TemplateStory.ts +0 -37
  255. package/src/runtime/components/shared/props.ts +0 -199
  256. package/src/runtime/composables/useAriaLabel.ts +0 -23
  257. package/src/runtime/composables/useDarkMode.ts +0 -199
  258. package/src/runtime/composables/useDivideAttrs.ts +0 -53
  259. package/src/runtime/composables/useSuggestions.ts +0 -339
  260. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.d.ts +0 -0
  261. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.js +0 -0
  262. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.d.ts +0 -0
  263. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.js +0 -0
  264. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.d.ts +0 -0
  265. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.js +0 -0
  266. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.d.ts +0 -0
  267. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.js +0 -0
  268. /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.d.vue.ts → WDatePicker/WRangeDatePicker.d.vue.ts} +0 -0
  269. /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue.d.ts → WDatePicker/WRangeDatePicker.vue.d.ts} +0 -0
  270. /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.d.vue.ts → WDatePicker/WSingleDatePicker.d.vue.ts} +0 -0
  271. /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue.d.ts → WDatePicker/WSingleDatePicker.vue.d.ts} +0 -0
  272. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.d.ts +0 -0
  273. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.js +0 -0
  274. /package/dist/runtime/components/{LibDebug/LibDebug.d.vue.ts → WDebug/WDebug.d.vue.ts} +0 -0
  275. /package/dist/runtime/components/{LibDebug/LibDebug.vue.d.ts → WDebug/WDebug.vue.d.ts} +0 -0
  276. /package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -0
  277. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.d.vue.ts → WNotifications/WNotificationTestMessageComponent.d.vue.ts} +0 -0
  278. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
  279. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue.d.ts → WNotifications/WNotificationTestMessageComponent.vue.d.ts} +0 -0
  280. /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.d.ts +0 -0
  281. /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.js +0 -0
  282. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.ts +0 -0
  283. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.ts +0 -0
  284. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.ts +0 -0
  285. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.ts +0 -0
  286. /package/src/runtime/components/{LibDatePicker → WDatePicker}/helpers.ts +0 -0
  287. /package/src/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
  288. /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,446 @@
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-neutral-100
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
+ open && popupSide === 'top' && `rounded-tl-none rounded-tr-none`,
50
+ 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
+ <ComboboxTrigger
96
+ :as-child="true"
97
+ >
98
+ <slot
99
+ name="trigger"
100
+ v-bind="{ open }"
101
+ >
102
+ <WButton
103
+ :border="false"
104
+ class="combobox--toggle p-0"
105
+ :aria-label="open ? 'Close' : 'Open'"
106
+ >
107
+ <slot
108
+ name="toggle"
109
+ :is-open="open"
110
+ >
111
+ <WIcon
112
+ :class="twMerge(`combobox--toggle scale-150`, open && `rotate-180`)"
113
+ >
114
+ <i-chevron-caret-down/>
115
+ </WIcon>
116
+ </slot>
117
+ </WButton>
118
+ </slot>
119
+ </ComboboxTrigger>
120
+ </div>
121
+ </ComboboxAnchor>
122
+ <ComboboxPortal :to="to">
123
+ <ComboboxContent
124
+ v-if="showEmptyLabel || filtered.length > 0 || errorMessage !== false"
125
+ :style="contentStyle"
126
+ :class="twMerge(`
127
+ combobox--content
128
+ z-100
129
+ w-[var(--reka-combobox-trigger-width)]
130
+ align-end
131
+ bg-white
132
+ dark:bg-neutral-900
133
+ will-change-[opacity,transform]
134
+ data-[side=top]:animate-slideDownAndFade
135
+ data-[side=right]:animate-slideLeftAndFade
136
+ data-[side=bottom]:animate-slideUpAndFade
137
+ data-[side=left]:animate-slideRightAndFade
138
+ border-neutral-300
139
+ dark:border-neutral-700
140
+ border
141
+ rounded-sm
142
+ shadow-lg
143
+ shadow-black/50
144
+ data-[side=bottom]:border-t-0
145
+ data-[side=top]:border-b-0
146
+ dark:data-[side=bottom]:border-t-0
147
+ dark:data-[side=top]:border-b-0
148
+ data-[side=bottom]:rounded-tl-none
149
+ data-[side=bottom]:rounded-tr-none
150
+ data-[side=top]:rounded-bl-none
151
+ data-[side=top]:rounded-br-none
152
+ max-h-[500px]
153
+ overflow-y-auto
154
+ `, contentProps?.class)"
155
+ ref="contentComponent"
156
+ v-bind="{
157
+ side: 'bottom',
158
+ position: 'popper',
159
+ avoidCollisions: true,
160
+ prioritizePosition: true,
161
+ ...contentProps,
162
+ class: undefined
163
+ }"
164
+ >
165
+ <ComboboxViewport
166
+
167
+ class="combobox--viewport flex flex-col"
168
+ >
169
+ <Transition>
170
+ <div
171
+ v-if="useSlots()['header']"
172
+ :id="`${id}-instruction`"
173
+ class="
174
+ combobox--popup-header
175
+ px-2
176
+ flex
177
+ items-center
178
+ justify-center
179
+ "
180
+ >
181
+ <slot
182
+ :filtered="filtered"
183
+ :is-showing-empty-label="showEmptyLabel"
184
+ name="header"
185
+ class="
186
+ text-neutral-800
187
+ dark:text-neutral-200
188
+ combobox--popup-label
189
+ text-ellipsis
190
+ overflow-hidden
191
+ whitespace-nowrap
192
+ "
193
+ />
194
+ </div>
195
+ </Transition>
196
+ <slot
197
+ v-if="errorMessage !== false"
198
+ name="invalid"
199
+ v-bind="{ searchTerm, errorMessage, id: `${id}-error`, role: 'alert' }"
200
+ >
201
+ <div
202
+ :id="`${id}-error`"
203
+ role="alert"
204
+ class="
205
+ combobox--error-message
206
+ text-danger-500
207
+ dark:text-danger-500
208
+ text-sm
209
+ px-2
210
+ py-1
211
+ bg-danger-100
212
+ dark:bg-danger-800
213
+ flex
214
+ items-center
215
+ justify-center
216
+ "
217
+ >
218
+ {{ errorMessage }}
219
+ </div>
220
+ </slot>
221
+ <ComboboxEmpty
222
+ v-if="showEmptyLabel"
223
+ class="
224
+ combobox--empty
225
+ px-2
226
+ text-center
227
+ text-neutral-800
228
+ dark:text-neutral-200
229
+ bg-neutral-100
230
+ dark:bg-neutral-800
231
+ "
232
+ >
233
+ {{ emptyLabel }}
234
+ </ComboboxEmpty>
235
+ <slot
236
+ name="suggestions"
237
+ v-bind="{ filtered, display, searchTerm }"
238
+ >
239
+ <div
240
+ class="
241
+ combobox--suggestions
242
+ flex-col
243
+ flex
244
+ max-h-[500px]
245
+ overflow-y-auto
246
+ "
247
+ >
248
+ <ComboboxItem
249
+ class="
250
+ combobox--suggestion
251
+ flex
252
+ justify-between
253
+ gap-2
254
+ px-2
255
+ cursor-pointer
256
+ data-[highlighted]:outline-hidden
257
+ data-[highlighted]:bg-accent-200
258
+ data-[highlighted]:text-accent-800
259
+ dark:data-[highlighted]:bg-accent-800
260
+ dark:data-[highlighted]:text-accent-200
261
+ "
262
+ :value="suggestion"
263
+ v-for="(suggestion, index) in filtered"
264
+ :key="index"
265
+ >
266
+ <slot
267
+ name="suggestion-icon"
268
+ v-bind="{ suggestion: suggestion as Exclude<TSuggestion, any[]> }"
269
+ />
270
+ <slot
271
+ name="suggestion"
272
+ v-bind="{
273
+ suggestion: suggestion as Exclude<TSuggestion, any[]>,
274
+ suggestionText: display(suggestion)
275
+ }"
276
+ >
277
+ <div
278
+ class="
279
+ combobox--suggestion-label
280
+ "
281
+ >
282
+ {{ display(suggestion) }}
283
+ </div>
284
+ </slot>
285
+ </ComboboxItem>
286
+ </div>
287
+ </slot>
288
+ </ComboboxViewport>
289
+ </ComboboxContent>
290
+ </ComboboxPortal>
291
+ </ComboboxRoot>
292
+ </template>
293
+
294
+ <script setup lang="ts" generic="TSuggestion extends NonNullable<AcceptableValue>">
295
+ import type { AcceptableValue, ComboboxContentEmits, ComboboxContentProps, ComboboxInputEmits, ComboboxInputProps } from "reka-ui"
296
+ import {
297
+ ComboboxAnchor,
298
+ ComboboxContent,
299
+ ComboboxEmpty,
300
+ ComboboxInput,
301
+ ComboboxItem,
302
+ ComboboxPortal,
303
+ ComboboxRoot,
304
+ ComboboxTrigger,
305
+ ComboboxViewport, useFilter } from "reka-ui"
306
+ import type { EmitsToProps, HTMLAttributes, InputHTMLAttributes } from "vue"
307
+ import { computed, nextTick, ref, useAttrs, useSlots, useTemplateRef, watch } from "vue"
308
+
309
+ import { useDelayedLoadingIndicator } from "../../composables/useDelayedLoadingIndicator.js"
310
+ import { type SuggestionsDisplayProps, useDisplayForReka } from "../../composables/useDisplayForReka.js"
311
+ import { useFallbackId } from "../../composables/useFallbackId.js"
312
+ import { usePopupConstrainToStyle } from "../../composables/usePopupConstrainToStyle.js"
313
+ import { usePreHydrationValue } from "../../composables/usePreHydrationValue.js"
314
+ import type { PopupConstrainToProps } from "../../types/index.js"
315
+ import { twMerge } from "../../utils/twMerge.js"
316
+ import WButton from "../WButton/WButton.vue"
317
+ import WIcon from "../WIcon/WIcon.vue"
318
+
319
+ const $attrs = useAttrs()
320
+
321
+ const emit = defineEmits<{
322
+ (e: "save", value: string): void
323
+ (e: "new", value: string): void
324
+ }>()
325
+
326
+ const props = withDefaults(defineProps<
327
+ & SuggestionsDisplayProps<TSuggestion>
328
+ & PopupConstrainToProps
329
+ & {
330
+ id?: string
331
+ border?: boolean
332
+ to?: string
333
+ /**
334
+ * Validates the input, return true if valid, otherwise return an error message.
335
+ *
336
+ * 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.
337
+ *
338
+ * If restrictToSuggestions is true, the input will be invalid if there is no exact match.
339
+ *
340
+ * `save` will not be emitted when the input is invalid.
341
+ *
342
+ * To show an error message, return a string from the function.
343
+ */
344
+ isValid?: (searchTerm: string) => true | string
345
+ suggestions: TSuggestion[]
346
+ /** 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. */
347
+ emptyLabel?: string
348
+ /** The popup can't be styled via the regular class attr because it's teleported. You can also pass any reka ComboboxContent options. */
349
+ contentProps?: { class?: string, to?: string } & HTMLAttributes & ComboboxContentProps & EmitsToProps<ComboboxContentEmits>
350
+ /** Disables the filter. */
351
+ ignoreFilter?: boolean
352
+ /** If false, modelValue is set to the search term (so long as it's valid). */
353
+ restrictToSuggestions?: boolean
354
+ /** Input attributes or reka-ui ComboboxInput props. */
355
+ inputProps?: Omit<InputHTMLAttributes, "class"> & { class?: string } & HTMLAttributes & ComboboxInputProps & EmitsToProps<ComboboxInputEmits>
356
+ }>(), {
357
+ border: true,
358
+ ignoreFilter: false,
359
+ emptyLabel: undefined,
360
+ isValid: (_: string) => true as const,
361
+ restrictToSuggestions: false,
362
+ to: "#root"
363
+ })
364
+ const finalId = useFallbackId(props)
365
+
366
+ const contentStyle = usePopupConstrainToStyle("combobox-content", props, [props?.contentProps?.style])
367
+
368
+ const modelValue = defineModel<TSuggestion>({ required: false, default: "" })
369
+ usePreHydrationValue(finalId, modelValue)
370
+ const open = defineModel<boolean>("open", { required: false, default: false })
371
+ const searchTerm = defineModel<string>("searchTerm", { default: "" })
372
+ const display = useDisplayForReka(props)
373
+
374
+ const { contains } = useFilter()
375
+ const filtered = computed(() => {
376
+ const f = props.ignoreFilter
377
+ ? props.suggestions
378
+ : props.suggestions.filter(v => {
379
+ return contains(display(v), searchTerm.value)
380
+ })
381
+ if ((f?.length ?? 0) === 0 && props.restrictToSuggestions) {
382
+ return props.suggestions
383
+ } else {
384
+ return f
385
+ }
386
+ })
387
+
388
+ const errorMessage = computed(() => {
389
+ if (searchTerm.value === "") return false
390
+ const isExactMatch = filtered.value.find(v => display(v) === searchTerm.value)
391
+ if (!props.restrictToSuggestions && isExactMatch) return false
392
+ const validation = props.isValid(searchTerm.value)
393
+ if (validation === true) return false
394
+ return validation
395
+ })
396
+
397
+
398
+ watch(searchTerm, () => {
399
+ const isExactMatch = filtered.value.find(v => display(v) === searchTerm.value)
400
+ if (isExactMatch) {
401
+ modelValue.value = isExactMatch
402
+ }
403
+ })
404
+
405
+
406
+ function save(e: Event) {
407
+ if (errorMessage.value !== false || searchTerm.value === "") {
408
+ open.value = false
409
+ return
410
+ }
411
+ e.preventDefault()
412
+ emit("save", searchTerm.value)
413
+ open.value = false
414
+ }
415
+
416
+ const loading = defineModel<boolean>("loading", { default: false })
417
+ const showLoadingIndicator = useDelayedLoadingIndicator(loading)
418
+
419
+ const showEmptyLabel = computed(() => {
420
+ return errorMessage.value === false
421
+ && !props.restrictToSuggestions
422
+ && searchTerm.value !== ""
423
+ && props.emptyLabel !== ""
424
+ && !props.suggestions.some(s => display(s) === searchTerm.value)
425
+ })
426
+
427
+ const ariaDescribedBy = computed(() => {
428
+ const ids = []
429
+ if (open.value) ids.push(`${props.id}-instruction`)
430
+ if (errorMessage.value !== false) ids.push(`${props.id}-error`)
431
+ if ("ariaDescribedby" in $attrs) ids.push($attrs.ariaDescribedby as any)
432
+ return ids.join(" ") || undefined
433
+ })
434
+
435
+ const contentComp = useTemplateRef("contentComponent")
436
+ const popupSide = ref<"top" | "right" | "bottom" | "left" | undefined>(undefined)
437
+ watch(open, () => {
438
+ nextTick(() => {
439
+ if (open.value && contentComp.value?.$el) {
440
+ popupSide.value = contentComp.value.$el.getAttribute("data-side")
441
+ } else {
442
+ popupSide.value = undefined
443
+ }
444
+ })
445
+ })
446
+ </script>