@witchcraft/ui 0.4.0 → 0.4.2

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 (316) hide show
  1. package/README.md +56 -61
  2. package/dist/module.d.mts +1 -1
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +13 -9
  5. package/dist/runtime/assets/animations.css +1 -1
  6. package/dist/runtime/assets/locales/en.json +2 -0
  7. package/dist/runtime/assets/utils.css +1 -1
  8. package/dist/runtime/build/WitchcraftUiResolver.js +1 -2
  9. package/dist/runtime/components/TestControls/TestControls.d.vue.ts +2 -1
  10. package/dist/runtime/components/TestControls/TestControls.vue +3 -3
  11. package/dist/runtime/components/TestControls/TestControls.vue.d.ts +2 -1
  12. package/dist/runtime/components/WButton/WButton.d.vue.ts +34 -0
  13. package/dist/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +26 -38
  14. package/dist/runtime/components/WButton/WButton.vue.d.ts +34 -0
  15. package/dist/runtime/components/WCheckbox/WCheckbox.d.vue.ts +33 -0
  16. package/dist/runtime/components/WCheckbox/WCheckbox.vue +110 -0
  17. package/dist/runtime/components/WCheckbox/WCheckbox.vue.d.ts +33 -0
  18. package/dist/runtime/components/{LibColorInput/LibColorInput.d.vue.ts → WColorInput/WColorInput.d.vue.ts} +18 -36
  19. package/dist/runtime/components/WColorInput/WColorInput.vue +85 -0
  20. package/dist/runtime/components/{LibColorInput/LibColorInput.vue.d.ts → WColorInput/WColorInput.vue.d.ts} +18 -36
  21. package/dist/runtime/components/WColorInput/WColorSwatchButton.d.vue.ts +28 -0
  22. package/dist/runtime/components/WColorInput/WColorSwatchButton.vue +86 -0
  23. package/dist/runtime/components/WColorInput/WColorSwatchButton.vue.d.ts +28 -0
  24. package/dist/runtime/components/{LibColorPicker/LibColorPicker.d.vue.ts → WColorPicker/WColorPicker.d.vue.ts} +12 -9
  25. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +41 -29
  26. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue.d.ts → WColorPicker/WColorPicker.vue.d.ts} +12 -9
  27. package/dist/runtime/components/WCombobox/WCombobox.d.vue.ts +111 -0
  28. package/dist/runtime/components/WCombobox/WCombobox.vue +405 -0
  29. package/dist/runtime/components/WCombobox/WCombobox.vue.d.ts +111 -0
  30. package/dist/runtime/components/WCombobox/storyPlays.d.ts +18 -0
  31. package/dist/runtime/components/WCombobox/storyPlays.js +68 -0
  32. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts → WDarkModeSwitcher/WDarkModeSwitcher.d.vue.ts} +9 -13
  33. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +11 -14
  34. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts → WDarkModeSwitcher/WDarkModeSwitcher.vue.d.ts} +9 -13
  35. package/dist/runtime/components/{LibDatePicker/LibDatePicker.d.vue.ts → WDatePicker/WDatePicker.d.vue.ts} +7 -7
  36. package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
  37. package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue.d.ts → WDatePicker/WDatePicker.vue.d.ts} +7 -7
  38. package/dist/runtime/components/WDatePicker/WRangeDatePicker.d.vue.ts +182 -0
  39. package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +29 -25
  40. package/dist/runtime/components/WDatePicker/WRangeDatePicker.vue.d.ts +182 -0
  41. package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.d.vue.ts → WDatePicker/WSingleDatePicker.d.vue.ts} +7 -5
  42. package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +21 -21
  43. package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue.d.ts → WDatePicker/WSingleDatePicker.vue.d.ts} +7 -5
  44. package/dist/runtime/components/WDatePicker/WTimeZonePicker.d.vue.ts +13 -0
  45. package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
  46. package/dist/runtime/components/WDatePicker/WTimeZonePicker.vue.d.ts +13 -0
  47. package/dist/runtime/components/{LibDebug/LibDebug.d.vue.ts → WDebug/WDebug.d.vue.ts} +3 -2
  48. package/dist/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +10 -12
  49. package/dist/runtime/components/{LibDebug/LibDebug.vue.d.ts → WDebug/WDebug.vue.d.ts} +3 -2
  50. package/dist/runtime/components/{LibDevOnly/LibDevOnly.d.vue.ts → WDevOnly/WDevOnly.d.vue.ts} +3 -5
  51. package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue.d.ts → WDevOnly/WDevOnly.vue.d.ts} +3 -5
  52. package/dist/runtime/components/WFileInput/WFileInput.d.vue.ts +58 -0
  53. package/dist/runtime/components/WFileInput/WFileInput.vue +348 -0
  54. package/dist/runtime/components/WFileInput/WFileInput.vue.d.ts +58 -0
  55. package/dist/runtime/components/WIcon/WIcon.d.vue.ts +18 -0
  56. package/dist/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +1 -1
  57. package/dist/runtime/components/WIcon/WIcon.vue.d.ts +18 -0
  58. package/dist/runtime/components/WMultiValues/WMultiValues.d.vue.ts +28 -0
  59. package/dist/runtime/components/WMultiValues/WMultiValues.vue +150 -0
  60. package/dist/runtime/components/WMultiValues/WMultiValues.vue.d.ts +28 -0
  61. package/dist/runtime/components/WNotifications/WNotification.d.vue.ts +37 -0
  62. package/dist/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +61 -35
  63. package/dist/runtime/components/WNotifications/WNotification.vue.d.ts +37 -0
  64. package/dist/runtime/components/WNotifications/WNotificationTestMessageComponent.d.vue.ts +7 -0
  65. package/dist/runtime/components/WNotifications/WNotificationTestMessageComponent.vue +29 -0
  66. package/dist/runtime/components/WNotifications/WNotificationTestMessageComponent.vue.d.ts +7 -0
  67. package/dist/runtime/components/WNotifications/WNotifications.d.vue.ts +11 -0
  68. package/dist/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +72 -36
  69. package/dist/runtime/components/WNotifications/WNotifications.vue.d.ts +11 -0
  70. package/dist/runtime/components/WNotifications/calculateNotificationProgress.d.ts +2 -0
  71. package/dist/runtime/components/WNotifications/calculateNotificationProgress.js +4 -0
  72. package/dist/runtime/components/WNumberInput/WNumberInput.d.vue.ts +27 -0
  73. package/dist/runtime/components/WNumberInput/WNumberInput.vue +96 -0
  74. package/dist/runtime/components/WNumberInput/WNumberInput.vue.d.ts +27 -0
  75. package/dist/runtime/components/WPagination/WPagination.d.vue.ts +59 -0
  76. package/dist/runtime/components/WPagination/WPagination.vue +182 -0
  77. package/dist/runtime/components/WPagination/WPagination.vue.d.ts +59 -0
  78. package/dist/runtime/components/WPalette/WPalette.d.vue.ts +11 -0
  79. package/dist/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
  80. package/dist/runtime/components/WPalette/WPalette.vue.d.ts +11 -0
  81. package/dist/runtime/components/WPopover/WPopover.d.vue.ts +45 -0
  82. package/dist/runtime/components/WPopover/WPopover.vue +144 -0
  83. package/dist/runtime/components/WPopover/WPopover.vue.d.ts +45 -0
  84. package/dist/runtime/components/WPopup/WPopup.d.vue.ts +51 -0
  85. package/dist/runtime/components/WPopup/WPopup.vue +115 -0
  86. package/dist/runtime/components/WPopup/WPopup.vue.d.ts +51 -0
  87. package/dist/runtime/components/{LibProgressBar/LibProgressBar.d.vue.ts → WProgressBar/WProgressBar.d.vue.ts} +13 -16
  88. package/dist/runtime/components/WProgressBar/WProgressBar.vue +150 -0
  89. package/dist/runtime/components/{LibProgressBar/LibProgressBar.vue.d.ts → WProgressBar/WProgressBar.vue.d.ts} +13 -16
  90. package/dist/runtime/components/{LibRecorder/LibRecorder.d.vue.ts → WRecorder/WRecorder.d.vue.ts} +13 -27
  91. package/dist/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +37 -36
  92. package/dist/runtime/components/{LibRecorder/LibRecorder.vue.d.ts → WRecorder/WRecorder.vue.d.ts} +13 -27
  93. package/dist/runtime/components/{LibRoot/LibRoot.d.vue.ts → WRoot/WRoot.d.vue.ts} +11 -9
  94. package/dist/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +17 -15
  95. package/dist/runtime/components/{LibRoot/LibRoot.vue.d.ts → WRoot/WRoot.vue.d.ts} +11 -9
  96. package/dist/runtime/components/WSimpleInput/WSimpleInput.d.vue.ts +34 -0
  97. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +14 -24
  98. package/dist/runtime/components/WSimpleInput/WSimpleInput.vue.d.ts +34 -0
  99. package/dist/runtime/components/WTable/WTable.d.vue.ts +102 -0
  100. package/dist/runtime/components/WTable/WTable.vue +370 -0
  101. package/dist/runtime/components/WTable/WTable.vue.d.ts +102 -0
  102. package/dist/runtime/components/WTooltip/WTooltip.d.vue.ts +40 -0
  103. package/dist/runtime/components/WTooltip/WTooltip.vue +112 -0
  104. package/dist/runtime/components/WTooltip/WTooltip.vue.d.ts +40 -0
  105. package/dist/runtime/components/index.d.ts +20 -20
  106. package/dist/runtime/components/index.js +20 -20
  107. package/dist/runtime/composables/index.d.ts +4 -4
  108. package/dist/runtime/composables/index.js +4 -4
  109. package/dist/runtime/composables/useDelayedLoadingIndicator.d.ts +9 -0
  110. package/dist/runtime/composables/useDelayedLoadingIndicator.js +18 -0
  111. package/dist/runtime/composables/useDisplayForReka.d.ts +25 -0
  112. package/dist/runtime/composables/useDisplayForReka.js +16 -0
  113. package/dist/runtime/composables/useFallbackId.d.ts +3 -0
  114. package/dist/runtime/composables/useFallbackId.js +5 -0
  115. package/dist/runtime/composables/useInjectedDarkMode.d.ts +1 -1
  116. package/dist/runtime/composables/usePopupConstrainToStyle.d.ts +8 -0
  117. package/dist/runtime/composables/usePopupConstrainToStyle.js +8 -0
  118. package/dist/runtime/composables/useSetupDarkMode.d.ts +2 -3
  119. package/dist/runtime/composables/useSetupDarkMode.js +90 -4
  120. package/dist/runtime/composables/useTimeConditionally.d.ts +16 -0
  121. package/dist/runtime/composables/useTimeConditionally.js +27 -0
  122. package/dist/runtime/directives/vResizableCols.js +101 -34
  123. package/dist/runtime/helpers/NotificationHandler.d.ts +28 -3
  124. package/dist/runtime/helpers/NotificationHandler.js +7 -10
  125. package/dist/runtime/injectionKeys.d.ts +1 -5
  126. package/dist/runtime/injectionKeys.js +0 -2
  127. package/dist/runtime/types/index.d.ts +97 -31
  128. package/dist/runtime/types/index.js +1 -0
  129. package/dist/runtime/utils/notifyIfError.d.ts +3 -1
  130. package/dist/runtime/utils/notifyIfError.js +4 -2
  131. package/dist/runtime/utils/twMerge.d.ts +1 -0
  132. package/dist/runtime/utils/twMerge.js +2 -1
  133. package/package.json +59 -56
  134. package/src/module.ts +16 -8
  135. package/src/runtime/assets/animations.css +53 -6
  136. package/src/runtime/assets/locales/en.json +2 -0
  137. package/src/runtime/assets/tailwind.css +1 -1
  138. package/src/runtime/assets/utils.css +52 -4
  139. package/src/runtime/build/WitchcraftUiResolver.ts +1 -2
  140. package/src/runtime/components/TestControls/TestControls.vue +3 -3
  141. package/src/runtime/components/WButton/WButton.stories.ts +112 -0
  142. package/src/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +34 -50
  143. package/src/runtime/components/{LibCheckbox/LibCheckbox.stories.ts → WCheckbox/WCheckbox.stories.ts} +5 -5
  144. package/src/runtime/components/WCheckbox/WCheckbox.vue +125 -0
  145. package/src/runtime/components/{LibColorInput/LibColorInput.stories.ts → WColorInput/WColorInput.stories.ts} +8 -8
  146. package/src/runtime/components/WColorInput/WColorInput.vue +112 -0
  147. package/src/runtime/components/WColorInput/WColorSwatchButton.vue +102 -0
  148. package/src/runtime/components/{LibColorPicker/LibColorPicker.stories.ts → WColorPicker/WColorPicker.stories.ts} +12 -12
  149. package/src/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +44 -31
  150. package/src/runtime/components/WCombobox/WCombobox.stories.ts +209 -0
  151. package/src/runtime/components/WCombobox/WCombobox.vue +450 -0
  152. package/src/runtime/components/WCombobox/storyPlays.ts +92 -0
  153. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts → WDarkModeSwitcher/WDarkModeSwitcher.stories.ts} +6 -6
  154. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +19 -30
  155. package/src/runtime/components/{LibDatePicker/LibDatePicker.stories.ts → WDatePicker/WDatePicker.stories.ts} +42 -34
  156. package/src/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
  157. package/src/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +29 -25
  158. package/src/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +21 -21
  159. package/src/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
  160. package/src/runtime/components/{LibDebug/LibDebug.stories.ts → WDebug/WDebug.stories.ts} +5 -5
  161. package/src/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +9 -10
  162. package/src/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -4
  163. package/src/runtime/components/{LibFileInput/LibFileInput.stories.ts → WFileInput/WFileInput.stories.ts} +20 -10
  164. package/src/runtime/components/WFileInput/WFileInput.vue +392 -0
  165. package/src/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +5 -8
  166. package/src/runtime/components/{LibMultiValues/LibMultiValues.stories.ts → WMultiValues/WMultiValues.stories.ts} +9 -9
  167. package/src/runtime/components/WMultiValues/WMultiValues.vue +163 -0
  168. package/src/runtime/components/{LibNotifications/LibNotification.stories.ts → WNotifications/WNotification.stories.ts} +42 -6
  169. package/src/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +72 -45
  170. package/src/runtime/components/WNotifications/WNotificationTestMessageComponent.vue +27 -0
  171. package/src/runtime/components/WNotifications/WNotifications.stories.ts +139 -0
  172. package/src/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +87 -47
  173. package/src/runtime/components/WNotifications/calculateNotificationProgress.ts +8 -0
  174. package/src/runtime/components/WNumberInput/WNumberInput.vue +109 -0
  175. package/src/runtime/components/WPagination/WPagination.stories.ts +51 -0
  176. package/src/runtime/components/WPagination/WPagination.vue +207 -0
  177. package/src/runtime/components/{LibPalette/LibPalette.stories.ts → WPalette/WPalette.stories.ts} +6 -6
  178. package/src/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
  179. package/src/runtime/components/WPopover/WPopover.stories.ts +218 -0
  180. package/src/runtime/components/WPopover/WPopover.vue +168 -0
  181. package/src/runtime/components/WPopup/WPopup.stories.ts +104 -0
  182. package/src/runtime/components/WPopup/WPopup.vue +134 -0
  183. package/src/runtime/components/WProgressBar/WProgressBar.stories.ts +119 -0
  184. package/src/runtime/components/WProgressBar/WProgressBar.vue +185 -0
  185. package/src/runtime/components/{LibRecorder/LibRecorder.stories.ts → WRecorder/WRecorder.stories.ts} +9 -6
  186. package/src/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +69 -68
  187. package/src/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +18 -15
  188. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.stories.ts → WSimpleInput/WSimpleInput.stories.ts} +11 -12
  189. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +28 -42
  190. package/src/runtime/components/WTable/WTable.stories.ts +334 -0
  191. package/src/runtime/components/WTable/WTable.vue +471 -0
  192. package/src/runtime/components/WTooltip/WTooltip.stories.ts +82 -0
  193. package/src/runtime/components/WTooltip/WTooltip.vue +128 -0
  194. package/src/runtime/components/index.ts +20 -20
  195. package/src/runtime/composables/index.ts +4 -4
  196. package/src/runtime/composables/useDelayedLoadingIndicator.ts +30 -0
  197. package/src/runtime/composables/useDisplayForReka.ts +37 -0
  198. package/src/runtime/composables/useFallbackId.ts +6 -0
  199. package/src/runtime/composables/useInjectedDarkMode.ts +1 -2
  200. package/src/runtime/composables/usePopupConstrainToStyle.ts +29 -0
  201. package/src/runtime/composables/useSetupDarkMode.ts +122 -4
  202. package/src/runtime/composables/useTimeConditionally.ts +51 -0
  203. package/src/runtime/directives/vResizableCols.ts +121 -38
  204. package/src/runtime/helpers/NotificationHandler.ts +30 -11
  205. package/src/runtime/injectionKeys.ts +1 -7
  206. package/src/runtime/types/index.ts +118 -36
  207. package/src/runtime/utils/notifyIfError.ts +6 -2
  208. package/src/runtime/utils/twMerge.ts +2 -1
  209. package/types/components.d.ts +14 -15
  210. package/dist/runtime/components/Aria/Aria.d.vue.ts +0 -5
  211. package/dist/runtime/components/Aria/Aria.vue +0 -16
  212. package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -5
  213. package/dist/runtime/components/Icon/Icon.d.vue.ts +0 -21
  214. package/dist/runtime/components/Icon/Icon.vue.d.ts +0 -21
  215. package/dist/runtime/components/LibButton/LibButton.d.vue.ts +0 -36
  216. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -36
  217. package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +0 -42
  218. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +0 -103
  219. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -42
  220. package/dist/runtime/components/LibColorInput/LibColorInput.vue +0 -162
  221. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.d.vue.ts +0 -34
  222. package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +0 -34
  223. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.d.vue.ts +0 -22
  224. package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +0 -22
  225. package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +0 -43
  226. package/dist/runtime/components/LibFileInput/LibFileInput.vue +0 -274
  227. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -43
  228. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +0 -165
  229. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -387
  230. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -165
  231. package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +0 -26
  232. package/dist/runtime/components/LibLabel/LibLabel.vue +0 -45
  233. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -26
  234. package/dist/runtime/components/LibMultiValues/LibMultiValues.d.vue.ts +0 -29
  235. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +0 -109
  236. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +0 -29
  237. package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +0 -30
  238. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -30
  239. package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +0 -13
  240. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -13
  241. package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +0 -104
  242. package/dist/runtime/components/LibPagination/LibPagination.vue +0 -229
  243. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -104
  244. package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +0 -14
  245. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -14
  246. package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +0 -46
  247. package/dist/runtime/components/LibPopup/LibPopup.vue +0 -365
  248. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -46
  249. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +0 -169
  250. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.d.vue.ts +0 -35
  251. package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +0 -35
  252. package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +0 -94
  253. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +0 -178
  254. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -94
  255. package/dist/runtime/components/LibTable/LibTable.d.vue.ts +0 -45
  256. package/dist/runtime/components/LibTable/LibTable.vue +0 -155
  257. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -45
  258. package/dist/runtime/components/Template/NAME.d.vue.ts +0 -17
  259. package/dist/runtime/components/Template/NAME.vue +0 -27
  260. package/dist/runtime/components/Template/NAME.vue.d.ts +0 -17
  261. package/dist/runtime/components/Template/TemplateStory.d.ts +0 -7
  262. package/dist/runtime/components/Template/TemplateStory.js +0 -22
  263. package/dist/runtime/components/shared/props.d.ts +0 -171
  264. package/dist/runtime/components/shared/props.js +0 -2
  265. package/dist/runtime/composables/useAriaLabel.d.ts +0 -6
  266. package/dist/runtime/composables/useAriaLabel.js +0 -15
  267. package/dist/runtime/composables/useDarkMode.d.ts +0 -77
  268. package/dist/runtime/composables/useDarkMode.js +0 -89
  269. package/dist/runtime/composables/useDivideAttrs.d.ts +0 -27
  270. package/dist/runtime/composables/useDivideAttrs.js +0 -27
  271. package/dist/runtime/composables/useSuggestions.d.ts +0 -40
  272. package/dist/runtime/composables/useSuggestions.js +0 -263
  273. package/src/runtime/components/Aria/Aria.vue +0 -26
  274. package/src/runtime/components/LibButton/LibButton.stories.ts +0 -106
  275. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -129
  276. package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -203
  277. package/src/runtime/components/LibFileInput/LibFileInput.vue +0 -320
  278. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +0 -405
  279. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -414
  280. package/src/runtime/components/LibLabel/LibLabel.stories.ts +0 -33
  281. package/src/runtime/components/LibLabel/LibLabel.vue +0 -65
  282. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -123
  283. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +0 -120
  284. package/src/runtime/components/LibPagination/LibPagination.stories.ts +0 -49
  285. package/src/runtime/components/LibPagination/LibPagination.vue +0 -274
  286. package/src/runtime/components/LibPopup/LibPopup.stories.ts +0 -153
  287. package/src/runtime/components/LibPopup/LibPopup.vue +0 -396
  288. package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +0 -90
  289. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -197
  290. package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +0 -134
  291. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -212
  292. package/src/runtime/components/LibTable/LibTable.stories.ts +0 -167
  293. package/src/runtime/components/LibTable/LibTable.vue +0 -190
  294. package/src/runtime/components/Template/NAME.vue +0 -49
  295. package/src/runtime/components/Template/TemplateStory.ts +0 -37
  296. package/src/runtime/components/shared/props.ts +0 -199
  297. package/src/runtime/composables/useAriaLabel.ts +0 -23
  298. package/src/runtime/composables/useDarkMode.ts +0 -199
  299. package/src/runtime/composables/useDivideAttrs.ts +0 -53
  300. package/src/runtime/composables/useSuggestions.ts +0 -339
  301. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.d.ts +0 -0
  302. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.js +0 -0
  303. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.d.ts +0 -0
  304. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.js +0 -0
  305. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.d.ts +0 -0
  306. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.js +0 -0
  307. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.d.ts +0 -0
  308. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.js +0 -0
  309. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.d.ts +0 -0
  310. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.js +0 -0
  311. /package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -0
  312. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.ts +0 -0
  313. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.ts +0 -0
  314. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.ts +0 -0
  315. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.ts +0 -0
  316. /package/src/runtime/components/{LibDatePicker → WDatePicker}/helpers.ts +0 -0
@@ -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>
@@ -0,0 +1,92 @@
1
+ import { expect, userEvent, waitFor, within } from "@storybook/test"
2
+
3
+ export const playBasic = async ({ canvasElement }: { canvasElement: HTMLElement, args: any }) => {
4
+ const canvas = within(canvasElement)
5
+ const input = canvas.getByRole("combobox") // More robust than LabelText
6
+ await userEvent.clear(input)
7
+
8
+ await userEvent.type(input, "A")
9
+ await expect(canvas.getByTestId("model-value")).toHaveTextContent("A")
10
+
11
+ await userEvent.clear(input)
12
+ await userEvent.type(input, "[Esc]")
13
+ await expect(canvas.getByTestId("search-term")).toHaveTextContent("")
14
+
15
+ await expect(canvas.getByTestId("model-value")).toHaveTextContent("A")
16
+ }
17
+ export const playBasicKeyboardSelect = async ({ canvasElement }: { canvasElement: HTMLElement, args: any }) => {
18
+ const canvas = within(canvasElement)
19
+ const input = canvas.getByRole("combobox")
20
+
21
+ await userEvent.clear(input)
22
+ await userEvent.type(input, "A")
23
+
24
+ await expect(canvas.getByRole("listbox")).toBeInTheDocument()
25
+
26
+ await userEvent.keyboard("{ArrowDown}")
27
+ const options = canvas.getAllByRole("option")
28
+
29
+ await expect(options[1]).toHaveAttribute("data-highlighted")
30
+
31
+ await userEvent.keyboard("{Enter}")
32
+ // it's the 0th element because of the filter
33
+ await expect(canvas.getByTestId("model-value")).toHaveTextContent(options[0]!.textContent?.trim() ?? "")
34
+ }
35
+ export const playBasicClickSelect = async ({ canvasElement }: { canvasElement: HTMLElement, args: any }) => {
36
+ const canvas = within(canvasElement)
37
+ const input = canvas.getByRole("combobox")
38
+ await userEvent.clear(input)
39
+
40
+ await userEvent.click(input)
41
+
42
+ const option = canvas.getByRole("option", { name: "AB" })
43
+ await userEvent.click(option)
44
+
45
+ await expect(canvas.getByTestId("model-value")).toHaveTextContent("AB")
46
+
47
+ await waitFor(() => {
48
+ expect(canvas.queryByRole("listbox")).not.toBeInTheDocument()
49
+ })
50
+ }
51
+ export const playValidation = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
52
+ const canvas = within(canvasElement)
53
+ const input = canvas.getByRole("combobox")
54
+
55
+ await userEvent.clear(input)
56
+ await userEvent.type(input, "Invalid")
57
+
58
+ await userEvent.click(input)
59
+
60
+ const body = within(document.body)
61
+ await waitFor(() => {
62
+ expect(body.getByRole("alert")).toBeInTheDocument()
63
+ })
64
+ }
65
+
66
+ export const playAllowNewValues = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
67
+ const canvas = within(canvasElement)
68
+ const input = canvas.getByRole("combobox")
69
+ await userEvent.clear(input)
70
+ const newValue = "New Custom Value"
71
+
72
+ await userEvent.type(input, newValue)
73
+
74
+ const body = within(document.body)
75
+ await waitFor(() => {
76
+ expect(body.getByText(/Press Enter to Add Value/i)).toBeInTheDocument()
77
+ })
78
+
79
+ await userEvent.keyboard("{Enter}")
80
+
81
+ await expect(canvas.getByTestId("model-value")).toHaveTextContent(newValue)
82
+
83
+ await userEvent.clear(input)
84
+ await userEvent.type(input, newValue)
85
+ expect(body.queryByText(/Press Enter to Add Value/i)).not.toBeInTheDocument()
86
+
87
+ await userEvent.clear(input)
88
+ await userEvent.type(input, "New")
89
+ await waitFor(() => {
90
+ expect(body.getByRole("option", { name: newValue })).toBeInTheDocument()
91
+ })
92
+ }
@@ -3,13 +3,13 @@
3
3
  import type { Meta, StoryObj } from "@storybook/vue3"
4
4
  import { ref } from "vue"
5
5
 
6
- import LibDarkModeSwitcher from "./LibDarkModeSwitcher.vue"
6
+ import WDarkModeSwitcher from "./WDarkModeSwitcher.vue"
7
7
 
8
8
  // todo, maybe don't do this for perf reasons
9
9
  import * as components from "../index.js"
10
10
 
11
- const meta: Meta<typeof LibDarkModeSwitcher> = {
12
- component: LibDarkModeSwitcher,
11
+ const meta: Meta<typeof WDarkModeSwitcher> = {
12
+ component: WDarkModeSwitcher,
13
13
  title: "Components/DarkModeSwitcher",
14
14
  args: {
15
15
 
@@ -17,7 +17,7 @@ const meta: Meta<typeof LibDarkModeSwitcher> = {
17
17
  }
18
18
 
19
19
  export default meta
20
- type Story = StoryObj<typeof LibDarkModeSwitcher>
20
+ type Story = StoryObj<typeof WDarkModeSwitcher>
21
21
 
22
22
 
23
23
  export const Primary: Story = {
@@ -32,10 +32,10 @@ export const Primary: Story = {
32
32
  },
33
33
  template: `
34
34
  Value: {{darkMode}}
35
- <LibDarkModeSwitcher
35
+ <WDarkModeSwitcher
36
36
  @update:darkMode="darkMode = $event"
37
37
  v-bind="{...args}"
38
- ></LibDarkModeSwitcher>
38
+ ></WDarkModeSwitcher>
39
39
  <!-- workaround for style tag not being allowed -->
40
40
  <component is="style">
41
41
  {{args.css}}
@@ -1,23 +1,23 @@
1
1
  <template>
2
- <lib-button
2
+ <WButton
3
3
  v-bind="{ ...$attrs, class: undefined }"
4
- :class="!($attrs as any).unstyle && twMerge(`
4
+ :class="!unstyle && twMerge(`
5
5
  dark-mode-switcher
6
6
  rounded-full
7
7
  after:rounded-full
8
8
  `,
9
9
  ($attrs as any)?.class
10
10
  )"
11
- :title="`${t('dark-mode-switcher.title')}${t(`dark-mode-switcher.${darkModeState}`)}`"
11
+ :aria-label="`${t('dark-mode-switcher.title')}${t(`dark-mode-switcher.${darkModeState}`)}`"
12
12
  @click="cycleDarkMode"
13
13
  >
14
14
  <!-- content-vertical-holder will keep the icon the height of a text line regardless of the svg used -->
15
15
  <template #icon>
16
- <icon
16
+ <WIcon
17
17
  class="w-[1em] items-center content-vertical-holder"
18
18
  >
19
19
  <component :is="darkModeState==='dark' ? IFaSolidMoon : darkModeState==='light' ? IPhSunBold : IFa6SolidCircleHalfStroke"/>
20
- </icon>
20
+ </WIcon>
21
21
  </template>
22
22
  <template
23
23
  #default
@@ -27,7 +27,7 @@
27
27
  {{ t(`dark-mode-switcher.${darkModeState}`) }}
28
28
  </div>
29
29
  </template>
30
- </lib-button>
30
+ </Wbutton>
31
31
  </template>
32
32
 
33
33
  <script lang="ts" setup>
@@ -39,10 +39,10 @@ import IPhSunBold from "~icons/ph/sun-bold"
39
39
 
40
40
  import { useInjectedDarkMode } from "../../composables/useInjectedDarkMode.js"
41
41
  import { useInjectedI18n } from "../../composables/useInjectedI18n.js"
42
+ import type { BaseInteractiveProps, TailwindClassProp } from "../../types/index.js"
42
43
  import { twMerge } from "../../utils/twMerge.js"
43
- import Icon from "../Icon/Icon.vue"
44
- import LibButton from "../LibButton/LibButton.vue"
45
- import type { TailwindClassProp } from "../shared/props.js"
44
+ import WButton from "../WButton/WButton.vue"
45
+ import WIcon from "../WIcon/WIcon.vue"
46
46
 
47
47
  const t = useInjectedI18n()
48
48
 
@@ -54,7 +54,16 @@ const emit = defineEmits<{
54
54
  }>()
55
55
  const $attrs = useAttrs()
56
56
 
57
- withDefaults(defineProps<Props>(), { showLabel: true })
57
+ withDefaults(defineProps<
58
+ & Pick<BaseInteractiveProps, "border">
59
+ & {
60
+ disabled?: boolean
61
+ unstyle?: boolean
62
+ showLabel?: boolean
63
+ }
64
+ & /** @vue-ignore */ Omit<ButtonHTMLAttributes, "class">
65
+ & /** @vue-ignore */ TailwindClassProp
66
+ >(), { showLabel: true })
58
67
 
59
68
  const {
60
69
  darkMode,
@@ -70,23 +79,3 @@ onMounted(() => {
70
79
  })
71
80
  </script>
72
81
 
73
- <script lang="ts">
74
- export default {
75
- name: "LibDarkModeSwitcher"
76
- }
77
- type RealProps = {
78
- showLabel?: boolean
79
- }
80
-
81
- interface Props
82
- extends
83
- /** @vue-ignore */
84
- Partial<Omit<ButtonHTMLAttributes, "class" | "color" | "disabled">
85
- & TailwindClassProp
86
- & {
87
- disabled?: boolean
88
- unstyle?: boolean
89
- }>,
90
- RealProps
91
- { }
92
- </script>