@witchcraft/ui 0.3.26 → 0.4.0-beta.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 (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 +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} +7 -6
  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} +7 -6
  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} +32 -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 +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 +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 +1 -1
  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 +123 -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} +43 -32
  125. package/src/runtime/components/WCombobox/WCombobox.stories.ts +209 -0
  126. package/src/runtime/components/WCombobox/WCombobox.vue +446 -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} +16 -22
  133. package/src/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +16 -22
  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} +8 -11
  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} +95 -98
  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 +161 -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} +43 -66
  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 +161 -0
  154. package/src/runtime/components/WPopup/WPopup.stories.ts +60 -0
  155. package/src/runtime/components/WPopup/WPopup.vue +93 -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} +27 -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 -87
  165. package/src/runtime/components/WTooltip/WTooltip.stories.ts +82 -0
  166. package/src/runtime/components/WTooltip/WTooltip.vue +126 -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 +13 -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
@@ -3,7 +3,7 @@ import { faker } from "@faker-js/faker"
3
3
  import type { Meta, StoryObj } from "@storybook/vue3"
4
4
  import { reactive, ref } from "vue"
5
5
 
6
- import LibTable from "./LibTable.vue"
6
+ import WTable from "./WTable.vue"
7
7
 
8
8
  // todo
9
9
  import * as components from "../index.js"
@@ -11,58 +11,62 @@ import * as components from "../index.js"
11
11
  // faker is slow, we can just choose from a few hundred pre-generated sentences
12
12
  const fakerSentences = Array.from({ length: 100 }).fill(0).map(_ => faker.lorem.sentence(faker.number.int({ min: 1, max: 50 })))
13
13
 
14
- const meta: Meta<typeof LibTable> = {
15
- component: LibTable as any,
14
+
15
+ type ExtraTestArgs = {
16
+ _slots?: string
17
+ }
18
+ const meta: Meta<typeof WTable> = {
19
+ component: WTable as any,
16
20
  title: "Components/Table"
17
21
  }
18
22
 
19
23
  export default meta
20
- type Story = StoryObj<typeof LibTable> & { args: {
21
- slots?: string
22
- ["wrapper-class"]?: string
23
- } }
24
+ type Story = StoryObj<typeof WTable> & { args: ExtraTestArgs }
24
25
 
25
26
  export const Primary: Story = {
26
- render: args => ({
27
- components,
28
- setup: () => {
29
- const show = ref(true)
30
- const debugGrips = ref(false)
31
- // careful, storybook passes refs as is causing issues
32
- const argsReactive = reactive({
33
- ...args,
34
- resizable: {
35
- enabled: true,
36
- ...args.resizable
37
- }
38
- })
27
+ render: args => {
28
+ const extraArgs = args as ExtraTestArgs
29
+ return {
30
+ components,
31
+ setup: () => {
32
+ const show = ref(true)
33
+ const debugGrips = ref(false)
34
+ // careful, storybook passes refs as is causing issues
35
+ const argsReactive = reactive({
36
+ ...args,
37
+ resizable: {
38
+ enabled: true,
39
+ ...args.resizable
40
+ }
41
+ })
39
42
 
40
- return {
41
- args: argsReactive,
42
- debugGrips,
43
- show
44
- }
45
- },
46
- template: `
43
+ return {
44
+ args: argsReactive,
45
+ debugGrips,
46
+ show
47
+ }
48
+ },
49
+ template: `
47
50
  <div class="p-2 flex flex-col gap-2 border rounded-md mb-10">
48
51
  Controls:
49
- <LibButton class="flex-1" @click="args.resizable.enabled = !args.resizable.enabled">Toggle Resizable (currently {{args.resizable.enabled}})</LibButton>
50
- <LibButton @click="args.stickyHeader = !args.stickyHeader">Toggle Sticky Header (currently {{args.stickyHeader}})</LibButton>
51
- <LibButton @click="show = !show">Toggle Table</LibButton>
52
- <LibButton @click="debugGrips = !debugGrips">Toggle Debug Grips (currently {{debugGrips}})</LibButton>
52
+ <WButton class="flex-1" @click="args.resizable.enabled = !args.resizable.enabled">Toggle Resizable (currently {{args.resizable.enabled}})</WButton>
53
+ <WButton @click="args.stickyHeader = !args.stickyHeader">Toggle Sticky Header (currently {{args.stickyHeader}})</WButton>
54
+ <WButton @click="show = !show">Toggle Table</WButton>
55
+ <WButton @click="debugGrips = !debugGrips">Toggle Debug Grips (currently {{debugGrips}})</WButton>
53
56
  </div>
54
57
  <div :class="debugGrips ? ' [&_.grip]:bg-red-500': ''">
55
- <lib-table
58
+ <WTable
56
59
  v-if="show"
57
60
  v-bind="args"
58
61
  >
59
- ${(args as any).slots}
60
- </lib-table>
62
+ ${extraArgs._slots}
63
+ </WTable>
61
64
  </div>
62
65
  `
63
- }),
66
+ }
67
+ },
64
68
  args: {
65
- cols: ["prop1", "prop2", "prop3"],
69
+ cols: ["prop1", "prop2", "prop3"] as any,
66
70
  values: [
67
71
  { prop1: "Item1 Prop 1", prop2: "Item1 Prop 2", prop3: "Item1 Prop 3" },
68
72
  { prop1: "Item2 Prop 1", prop2: "Item2 Prop 2", prop3: "Item2 Prop 3" },
@@ -148,7 +152,7 @@ export const InitialSize: Story = {
148
152
  [&:not(.resizable-cols-setup)_thead_tr]:flex-nowrap
149
153
  [&:not(.resizable-cols-setup)_thead_th:not(.override-initial)]:flex-1
150
154
  `,
151
- slots: `
155
+ _slots: `
152
156
  <template #header-prop3="colProps">
153
157
  <th
154
158
  :class="\`\${colProps.class} [table:not(.resizable-cols-setup)_&]:w-[min-content] whitespace-nowrap override-initial\`"
@@ -183,9 +187,11 @@ export const StickyHeader: Story = {
183
187
  // moving the border to the wrapper is to hide the little bits of border sticking out
184
188
  // added back the right straight border otherwise the scrollbar looks ass
185
189
  // this is ever so slightly visible if there is no scrollbar
186
- ["wrapper-class"]: `
187
- max-h-[50dvh]
188
- `,
190
+ wrapperAttrs: {
191
+ class: `
192
+ max-h-[50dvh]
193
+ `
194
+ },
189
195
  values: Array.from({ length: 200 }).fill(0).map((_, i) => ({
190
196
  prop1: `Item${i + 1} Prop 1`,
191
197
  prop2: `Item${i + 1} Prop 2`,
@@ -206,9 +212,11 @@ export const VirtualizedFixedHeight: Story = {
206
212
  enabled: true
207
213
  },
208
214
  stickyHeader: true,
209
- ["wrapper-class"]: `
210
- max-h-[50dvh]
211
- `,
215
+ wrapperAttrs: {
216
+ class: `
217
+ max-h-[50dvh]
218
+ `
219
+ },
212
220
  values: Array.from({ length: 10000 }).fill(0).map((_, i) => ({
213
221
  prop1: `Item${i + 1} Prop 1`,
214
222
  prop2: `Item${i + 1} Prop 2`,
@@ -259,9 +267,9 @@ export const VirtualizedFitWidthFalse: Story = {
259
267
  [&:not(.resizable-cols-setup)]:w-max
260
268
  [&:not(.resizable-cols-setup)_th]:w-max
261
269
  `,
262
- ["wrapper-class"]: `
263
- max-h-[50dvh]
264
- `,
270
+ wrapperAttrs: {
271
+ class: `max-h-[50dvh]`
272
+ },
265
273
  values: Array.from({ length: 10000 }).fill(0).map((_, i) => ({
266
274
  prop1: `Item${i + 1} Prop 1`,
267
275
  prop2: `Item${i + 1} Prop 2`,
@@ -284,18 +292,18 @@ export const ThreeColSomeColsNotResizable: Story = {
284
292
  </div>
285
293
  <div :class="debugGrips ? ' [&_.grip]:bg-red-500': ''">
286
294
  <div class="flex flex-col gap-2 w-full">
287
- <lib-table
295
+ <WTable
288
296
  v-bind="args"
289
297
  >
290
- </lib-table>
291
- <lib-table
298
+ </WTable>
299
+ <WTable
292
300
  v-bind="{...args, colConfig:args.colConfig2}"
293
301
  >
294
- </lib-table>
295
- <lib-table
302
+ </WTable>
303
+ <WTable
296
304
  v-bind="{...args, colConfig:args.colConfig3}"
297
305
  >
298
- </lib-table>
306
+ </WTable>
299
307
  </div>
300
308
  </div>
301
309
  `
@@ -50,7 +50,9 @@
50
50
  mergedVirtualizerOpts.enabled && mergedVirtualizerOpts.method === 'dynamic' && `
51
51
  relative
52
52
  `,
53
- ($attrs as any)['wrapper-class'])"
53
+ wrapperAttrs?.class
54
+ )"
55
+ v-bind="{ ...wrapperAttrs, class: undefined }"
54
56
  ref="parentRef"
55
57
  >
56
58
  <div
@@ -63,12 +65,12 @@
63
65
  >
64
66
  <!-- https://github.com/TanStack/virtual/issues/640#issuecomment-2795731690 -->
65
67
  <table
66
- :style="{
68
+ :style="[{
67
69
  ...(stickyHeader && mergedVirtualizerOpts.enabled
68
70
  ? { '--table-sticky-fix': `${totalSize-tableHeight}px` }
69
- : {}),
70
- ...($attrs as any).style ?? {}
71
- }"
71
+ : {})
72
+
73
+ }, $attrs?.style]"
72
74
  :class="twMerge(`
73
75
  table
74
76
  table-fixed
@@ -107,6 +109,7 @@
107
109
  dark:[&_.grip]:hover:bg-neutral-700
108
110
  `,
109
111
  ($attrs as any).class)"
112
+ v-bind="{ ...$attrs, class: undefined, style: undefined }"
110
113
  v-resizable-cols="resizableOptions"
111
114
  >
112
115
  <thead
@@ -163,7 +166,7 @@
163
166
  >
164
167
  <template
165
168
  v-for="(virtual, index) in virtualList"
166
- :key="virtual.key"
169
+ :key="virtual.key as any"
167
170
  >
168
171
  <tr
169
172
  :class="twMerge(`
@@ -182,7 +185,7 @@
182
185
  transform: mergedVirtualizerOpts.method === 'fixed'
183
186
  ? `translateY(${virtual.start - index * virtual.size!}px)`
184
187
  : `translateY(${virtual.start}px)`,
185
- height: `${virtual.size}px`
188
+ height: mergedVirtualizerOpts.method === 'fixed' ? `${virtual.size}px` : undefined
186
189
  }
187
190
  : {})
188
191
  }"
@@ -196,7 +199,7 @@
196
199
  <slot
197
200
  :name="col"
198
201
  :item="values[virtual.index]"
199
- :value="values[virtual.index][col]"
202
+ :value="values[virtual.index]![col]"
200
203
  :style="{ width: widths[j] }"
201
204
  :class="classes[`${virtual.index}-${j}`]"
202
205
  >
@@ -204,7 +207,7 @@
204
207
  :style="{ width: widths[j] }"
205
208
  :class="classes[`${virtual.index}-${j}`]"
206
209
  >
207
- {{ values[virtual.index][col] }}
210
+ {{ values[virtual.index]![col] }}
208
211
  </td>
209
212
  </slot>
210
213
  </template>
@@ -222,33 +225,97 @@ import type { MakeRequired } from "@alanscodelog/utils"
222
225
  import { keys } from "@alanscodelog/utils/keys"
223
226
  import { throttle } from "@alanscodelog/utils/throttle"
224
227
  import { useVirtualizer, type VirtualizerOptions } from "@tanstack/vue-virtual"
225
- import { computed, onMounted, ref, type TableHTMLAttributes } from "vue"
228
+ import { computed, type HTMLAttributes, onMounted, ref, type TableHTMLAttributes, useAttrs } from "vue"
226
229
 
227
230
  import { useGlobalResizeObserver } from "../../composables/useGlobalResizeObserver.js"
228
231
  import { vResizableCols } from "../../directives/vResizableCols.js"
229
- import type { ResizableOptions, TableColConfig } from "../../types/index.js"
232
+ import type { ResizableOptions, TableColConfig, TailwindClassProp } from "../../types/index.js"
230
233
  import { twMerge } from "../../utils/twMerge.js"
231
- import type { TailwindClassProp } from "../shared/props.js"
232
234
 
233
235
  defineOptions({
234
- name: "LibTable",
236
+ name: "WTable",
235
237
  inheritAttrs: false
236
238
  })
237
239
 
238
- const props = withDefaults(defineProps<Props>(), {
240
+ const $attrs = useAttrs()
241
+ const props = withDefaults(defineProps<
242
+ & {
243
+ resizable?: Partial<ResizableOptions>
244
+ values: T[]
245
+ /** Let's the table know the shape of the data since values might be empty. */
246
+ cols?: (keyof T)[]
247
+ rounded?: boolean
248
+ border?: boolean
249
+ cellBorder?: boolean
250
+ /** Disables the header. This also sets the selector to `tr:first-child > td` instead to avoid issues with the vResizableCols directive. */
251
+ header?: boolean
252
+ colConfig?: TableColConfig<T>
253
+ /**
254
+ * See tanstack/vue-virtual {@link https://tanstack.com/virtual/latest/docs/api/virtualizer}
255
+ *
256
+ * The defaults are:
257
+ *
258
+ * - enabled: false
259
+ * - method: "fixed"
260
+ * - overscan: (50 if fixed, 10 if dynamic)
261
+ * - estimateSize: () => { return 33 }
262
+ *
263
+ * This also has an additional option, `method`, which can be set to `fixed` or `dynamic` (experimental).
264
+ *
265
+ * Notes:
266
+ *
267
+ * - Because of how virtualization works, initial layout (before .resizable-cols-setup class is applied) will only have access to the headers and not the rows. This can cause cols to look very small, especially if using resizable.fitWidth false.
268
+ *
269
+ * ### Fixed
270
+ *
271
+ * `fixed` is the default and will set the height of ALL items to the height of the first item onMounted (tanstack does not do this and if your estimateSize if off, the scrolling is weird).
272
+ *
273
+ * Since the table now truncates rows by default, they will always be the same height unless you change the inner styling. In fixed mode, `forceRecalculateFixedVirtualizer` is exposed if you need to force re-calculation.
274
+ *
275
+ * If using slots, be sure to at least pass the `class` slot prop to the td element. `style` with width is also supplied but is not required if you're displaying the table as a table.
276
+ *
277
+ * ### Dynamic (experimental)
278
+ *
279
+ * In `dynamic` mode we use tanstack's measureElement method. This is more expensive, but it will work with any heights.
280
+ *
281
+ * Dynamic mode also requires the table displays itself using grid and flex post setup as otherwise dynamic mode doesn't work.
282
+ *
283
+ * You don't need to do anything unless using slots. If using slots, pass the given `ref` slot prop to ref (internally this is tanstack's measureElement) and the class and style slot props at the very least:
284
+ * ```vue
285
+ * <template #[`${colName}`]="slotProps">
286
+ * <td
287
+ * :ref="slotProps.ref"
288
+ * :class="slotProps.class"
289
+ * :style="slotProps.style"
290
+ * >
291
+ * {{ slotProps.value }}
292
+ * </td>
293
+ * </template>
294
+ * ```
295
+ */
296
+ virtualizerOptions?: Partial<VirtualizerOptions<any, any>> & { method?: "fixed" | "dynamic" }
297
+ /** Whether to enable sticky header styles. This requires `border:false`. This moves the border to the wrapper and styles a straight border between the scroll bar and the rounded border. */
298
+ stickyHeader?: boolean
299
+ /** Which key to use for the rows (only if not using virtualization). */
300
+ itemKey?: keyof T | ((item: T) => string)
301
+ /** Pass attributes to the wrapper div. To pass to the table you can use regular top level attributes. */
302
+ wrapperAttrs?: Omit<HTMLAttributes, "class"> & TailwindClassProp
303
+ }
304
+ & /** @vue-ignore */ Omit<TableHTMLAttributes, "class" | "readonly" | "disabled">
305
+ & /** @vue-ignore */ TailwindClassProp
306
+ >(), {
239
307
  resizable: () => ({}),
240
- values: () => [] as T[],
241
308
  cols: () => [] as (keyof T)[],
242
309
  rounded: true,
243
310
  border: true,
244
311
  cellBorder: true,
245
312
  header: true,
246
- colConfig: () => ({}),
313
+ colConfig: () => ({} as any),
247
314
  virtualizerOptions: () => ({ }),
248
- enableStickyHeader: false,
249
- itemKey: ""
315
+ enableStickyHeader: false
250
316
  })
251
317
 
318
+
252
319
  const widths = ref([])
253
320
 
254
321
 
@@ -402,73 +469,4 @@ defineExpose({
402
469
  })
403
470
  </script>
404
471
 
405
- <script lang="ts">
406
- // generic isn't working here :/
407
- type T = any
408
472
 
409
- type RealProps = {
410
- resizable?: Partial<ResizableOptions>
411
- values?: T[]
412
- /** Let's the table know the shape of the data since values might be empty. */
413
- cols?: (keyof T)[]
414
- rounded?: boolean
415
- border?: boolean
416
- cellBorder?: boolean
417
- /** Disables the header. This also sets the selector to `tr:first-child > td` instead to avoid issues with the vResizableCols directive. */
418
- header?: boolean
419
- colConfig?: TableColConfig<T>
420
- /**
421
- * See tanstack/vue-virtual {@link https://tanstack.com/virtual/latest/docs/api/virtualizer}
422
- *
423
- * The defaults are:
424
- *
425
- * - enabled: false
426
- * - method: "fixed"
427
- * - overscan: (50 if fixed, 10 if dynamic)
428
- * - estimateSize: () => { return 33 }
429
- *
430
- * This also has an additional option, `method`, which can be set to `fixed` or `dynamic` (experimental).
431
- *
432
- * Notes:
433
- *
434
- * - Because of how virtualization works, initial layout (before .resizable-cols-setup class is applied) will only have access to the headers and not the rows. This can cause cols to look very small, especially if using resizable.fitWidth false.
435
- *
436
- * ### Fixed
437
- *
438
- * `fixed` is the default and will set the height of ALL items to the height of the first item onMounted (tanstack does not do this and if your estimateSize if off, the scrolling is weird).
439
- *
440
- * Since the table now truncates rows by default, they will always be the same height unless you change the inner styling. In fixed mode, `forceRecalculateFixedVirtualizer` is exposed if you need to force re-calculation.
441
- *
442
- * If using slots, be sure to at least pass the `class` slot prop to the td element. `style` with width is also supplied but is not required if you're displaying the table as a table.
443
- *
444
- * ### Dynamic (experimental)
445
- *
446
- * In `dynamic` mode we use tanstack's measureElement method. This is more expensive, but it will work with any heights.
447
- *
448
- * Dynamic mode also requires the table displays itself using grid and flex post setup as otherwise dynamic mode doesn't work.
449
- *
450
- * You don't need to do anything unless using slots. If using slots, pass the given `ref` slot prop to ref (internally this is tanstack's measureElement) and the class and style slot props at the very least:
451
- * ```vue
452
- * <template #[`${colName}`]="slotProps">
453
- * <td
454
- * :ref="slotProps.ref"
455
- * :class="slotProps.class"
456
- * :style="slotProps.style"
457
- * >
458
- * {{ slotProps.value }}
459
- * </td>
460
- * </template>
461
- * ```
462
- */
463
- virtualizerOptions?: Partial<VirtualizerOptions<any, any>> & { method?: "fixed" | "dynamic" }
464
- /** Whether to enable sticky header styles. This requires `border:false`. This moves the border to the wrapper and styles a straight border between the scroll bar and the rounded border. */
465
- stickyHeader?: boolean
466
- /** Which key to use for the rows (only if not using virtualization). */
467
- itemKey?: keyof T | ((item: T) => string)
468
- }
469
- interface Props
470
- extends
471
- /** @vue-ignore */
472
- Partial<Omit<TableHTMLAttributes, "class" | "readonly" | "disabled"> & TailwindClassProp>,
473
- RealProps { }
474
- </script>
@@ -0,0 +1,82 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ import type { Meta, StoryObj } from "@storybook/vue3"
3
+ import { ref } from "vue"
4
+
5
+ import WTooltip from "./WTooltip.vue"
6
+
7
+ import * as components from "../index.js"
8
+
9
+ const meta: Meta<typeof WTooltip> = {
10
+ component: WTooltip as any,
11
+ title: "Components/Tooltip",
12
+ args: {
13
+ content: "This is a tooltip"
14
+ }
15
+ }
16
+
17
+ export default meta
18
+
19
+ type ExtraTestArgs = {
20
+ _testContent?: string
21
+ _testTrigger?: string
22
+ }
23
+
24
+ type Story = StoryObj<typeof WTooltip> & {
25
+ args?: ExtraTestArgs
26
+ }
27
+
28
+ export const Primary: Story = {
29
+ render: args => {
30
+ const extraArgs = args as ExtraTestArgs
31
+ return {
32
+ components,
33
+ setup() {
34
+ const showTooltip = ref(false)
35
+ return {
36
+ showTooltip,
37
+ extraArgs,
38
+ args
39
+ }
40
+ },
41
+ template: `
42
+ <div class="flex flex-col gap-3 items-center pt-10">
43
+ <WTooltip v-bind="args">
44
+ ${extraArgs._testTrigger ?? ""}
45
+ <template #content>
46
+ ${extraArgs._testContent ?? "This is a tooltip"}
47
+ </template>
48
+ </WTooltip>
49
+ </div>
50
+ `
51
+ }
52
+ }
53
+ }
54
+
55
+
56
+ export const CustomTrigger: Story = {
57
+ ...Primary,
58
+ args: {
59
+
60
+ _testTrigger: "Custom Trigger"
61
+ }
62
+ }
63
+
64
+ export const VeryLongContentConstrainedToTriggerWidth: Story = {
65
+ ...Primary,
66
+ args: {
67
+ constrainWidthTo: "trigger",
68
+ constrainHeightTo: "available",
69
+ _testTrigger: "<button>Tiny Trigger</button>",
70
+ // should scroll
71
+ _testContent: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.".repeat(10)
72
+ }
73
+ }
74
+
75
+ export const VeryLongContentConstrainedToCustomPxHeight: Story = {
76
+ ...Primary,
77
+ args: {
78
+ constrainHeightTo: 50,
79
+ // should scroll
80
+ _testContent: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.".repeat(10)
81
+ }
82
+ }
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <TooltipProvider :disabled="disabled">
3
+ <TooltipRoot
4
+ :delay-duration="rootProps?.delayDuration ?? 200"
5
+ :disable-closing-trigger="rootProps?.disableClosingTrigger ?? false"
6
+ v-bind="rootProps"
7
+ >
8
+ <TooltipTrigger
9
+ v-if="triggerWhileDisabled"
10
+ as-child
11
+ >
12
+ <!-- https://reka-ui.com/docs/components/tooltip#displaying-a-tooltip-from-a-disabled-button -->
13
+ <span>
14
+ <slot>
15
+ <WIcon class="text-neutral-500"><i-lucide-info/></WIcon>
16
+ </slot>
17
+ </span>
18
+ </TooltipTrigger>
19
+ <TooltipTrigger v-else>
20
+ <slot>
21
+ <WIcon class="text-neutral-500">
22
+ <i-lucide-info/>
23
+ </WIcon>
24
+ </slot>
25
+ </TooltipTrigger>
26
+ <TooltipPortal
27
+ :to="to"
28
+ >
29
+ <TooltipContent
30
+ :style="contentStyle"
31
+ :class="twMerge(`
32
+ z-100
33
+ tooltip--content-wrapper
34
+ origin-[var(--reka-tooltip-content-transform-origin)]
35
+ data-[side=top]:animate-slideDownAndFade
36
+ data-[side=right]:animate-slideLeftAndFade
37
+ data-[side=bottom]:animate-slideUpAndFade
38
+ data-[side=left]:animate-slideRightAndFade
39
+ bg-neutral-50
40
+ dark:bg-neutral-800
41
+ rounded-sm
42
+ shadow-sm
43
+ shadow-black/30
44
+ border
45
+ border-black/30
46
+ p-2
47
+ overflow-auto
48
+ `,
49
+ contentProps?.class
50
+ ) "
51
+ v-bind="{
52
+ collisionPadding: 20,
53
+ side: 'top',
54
+ ...contentProps,
55
+ class: undefined,
56
+ style: undefined
57
+ }"
58
+ >
59
+ <div
60
+ class="
61
+ tooltip--content-container
62
+ text-sm
63
+ whitespace-pre-wrap
64
+ flex
65
+ flex-col
66
+ justify-center
67
+ "
68
+ >
69
+ <slot
70
+ name="content"
71
+ v-bind="{ content }"
72
+ >
73
+ {{ content }}
74
+ </slot>
75
+ </div>
76
+ <TooltipArrow
77
+ class="
78
+ tooltip--arrow
79
+ -mt-px
80
+ fill-neutral-50
81
+ dark:fill-neutral-800
82
+ drop-shadow-[0_2px_1px_rgba(0,0,0,0.3)]
83
+ relative
84
+ "
85
+ />
86
+ </TooltipContent>
87
+ </TooltipPortal>
88
+ </TooltipRoot>
89
+ </TooltipProvider>
90
+ </template>
91
+
92
+ <script setup lang="ts">
93
+ import { TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger } from "reka-ui"
94
+
95
+ import { usePopupConstrainToStyle } from "../../composables/usePopupConstrainToStyle.js"
96
+ import type { PopupConstrainToProps } from "../../types/index.js"
97
+ import { twMerge } from "../../utils/twMerge.js"
98
+ import WIcon from "../WIcon/WIcon.vue"
99
+
100
+ const props = withDefaults(defineProps<
101
+ & PopupConstrainToProps
102
+ & {
103
+ delayDuration?: number
104
+ disabled?: boolean
105
+ triggerWhileDisabled?: boolean
106
+ content?: string
107
+ collisionBoundary?: Element | null
108
+ to?: string
109
+ /** Reka's TooltipRoot props */
110
+ rootProps?: any
111
+ /** Reka's TooltipContent props */
112
+ contentProps?: any
113
+ }>(),
114
+ {
115
+ delayDuration: 200,
116
+ disabled: false,
117
+ triggerWhileDisabled: false,
118
+ constrainWidthTo: "available",
119
+ constrainHeightTo: "available",
120
+ content: "",
121
+ to: "#root"
122
+ })
123
+
124
+ const contentStyle = usePopupConstrainToStyle("tooltip", props, [props?.contentProps?.style])
125
+ </script>
126
+