@witchcraft/ui 0.3.26 → 0.4.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/README.md +54 -61
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1 -1
  4. package/dist/runtime/assets/animations.css +1 -1
  5. package/dist/runtime/assets/locales/en.json +2 -0
  6. package/dist/runtime/build/WitchcraftUiResolver.js +2 -2
  7. package/dist/runtime/components/TestControls/TestControls.vue +3 -3
  8. package/dist/runtime/components/WButton/WButton.d.vue.ts +34 -0
  9. package/dist/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +26 -38
  10. package/dist/runtime/components/WButton/WButton.vue.d.ts +34 -0
  11. package/dist/runtime/components/WCheckbox/WCheckbox.d.vue.ts +33 -0
  12. package/dist/runtime/components/WCheckbox/WCheckbox.vue +110 -0
  13. package/dist/runtime/components/WCheckbox/WCheckbox.vue.d.ts +33 -0
  14. package/dist/runtime/components/WColorInput/WColorInput.d.vue.ts +45 -0
  15. package/dist/runtime/components/WColorInput/WColorInput.vue +85 -0
  16. package/dist/runtime/components/WColorInput/WColorInput.vue.d.ts +45 -0
  17. package/dist/runtime/components/WColorInput/WColorSwatchButton.d.vue.ts +28 -0
  18. package/dist/runtime/components/WColorInput/WColorSwatchButton.vue +86 -0
  19. package/dist/runtime/components/WColorInput/WColorSwatchButton.vue.d.ts +28 -0
  20. package/dist/runtime/components/{LibColorPicker/LibColorPicker.d.vue.ts → WColorPicker/WColorPicker.d.vue.ts} +7 -6
  21. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +41 -29
  22. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue.d.ts → WColorPicker/WColorPicker.vue.d.ts} +7 -6
  23. package/dist/runtime/components/WCombobox/WCombobox.d.vue.ts +111 -0
  24. package/dist/runtime/components/WCombobox/WCombobox.vue +405 -0
  25. package/dist/runtime/components/WCombobox/WCombobox.vue.d.ts +111 -0
  26. package/dist/runtime/components/WCombobox/storyPlays.d.ts +18 -0
  27. package/dist/runtime/components/WCombobox/storyPlays.js +68 -0
  28. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts → WDarkModeSwitcher/WDarkModeSwitcher.d.vue.ts} +8 -13
  29. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +11 -14
  30. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts → WDarkModeSwitcher/WDarkModeSwitcher.vue.d.ts} +8 -13
  31. package/dist/runtime/components/WDatePicker/WDatePicker.d.vue.ts +40 -0
  32. package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
  33. package/dist/runtime/components/WDatePicker/WDatePicker.vue.d.ts +40 -0
  34. package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +21 -21
  35. package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +21 -21
  36. package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.d.vue.ts → WDatePicker/WTimeZonePicker.d.vue.ts} +1 -11
  37. package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
  38. package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue.d.ts → WDatePicker/WTimeZonePicker.vue.d.ts} +1 -11
  39. package/dist/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +10 -12
  40. package/dist/runtime/components/{LibDevOnly/LibDevOnly.d.vue.ts → WDevOnly/WDevOnly.d.vue.ts} +0 -3
  41. package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue.d.ts → WDevOnly/WDevOnly.vue.d.ts} +0 -3
  42. package/dist/runtime/components/WFileInput/WFileInput.d.vue.ts +58 -0
  43. package/dist/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +74 -57
  44. package/dist/runtime/components/WFileInput/WFileInput.vue.d.ts +58 -0
  45. package/dist/runtime/components/{Icon/Icon.vue.d.ts → WIcon/WIcon.d.vue.ts} +2 -6
  46. package/dist/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +1 -1
  47. package/dist/runtime/components/{Icon/Icon.d.vue.ts → WIcon/WIcon.vue.d.ts} +2 -6
  48. package/dist/runtime/components/{LibMultiValues/LibMultiValues.d.vue.ts → WMultiValues/WMultiValues.d.vue.ts} +8 -14
  49. package/dist/runtime/components/WMultiValues/WMultiValues.vue +150 -0
  50. package/dist/runtime/components/{LibMultiValues/LibMultiValues.vue.d.ts → WMultiValues/WMultiValues.vue.d.ts} +8 -14
  51. package/dist/runtime/components/WNotifications/WNotification.d.vue.ts +37 -0
  52. package/dist/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +34 -47
  53. package/dist/runtime/components/WNotifications/WNotification.vue.d.ts +37 -0
  54. package/dist/runtime/components/WNotifications/WNotifications.d.vue.ts +11 -0
  55. package/dist/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +35 -17
  56. package/dist/runtime/components/WNotifications/WNotifications.vue.d.ts +11 -0
  57. package/dist/runtime/components/WNumberInput/WNumberInput.d.vue.ts +27 -0
  58. package/dist/runtime/components/WNumberInput/WNumberInput.vue +96 -0
  59. package/dist/runtime/components/WNumberInput/WNumberInput.vue.d.ts +27 -0
  60. package/dist/runtime/components/WPagination/WPagination.d.vue.ts +59 -0
  61. package/dist/runtime/components/WPagination/WPagination.vue +182 -0
  62. package/dist/runtime/components/WPagination/WPagination.vue.d.ts +59 -0
  63. package/dist/runtime/components/WPalette/WPalette.d.vue.ts +11 -0
  64. package/dist/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
  65. package/dist/runtime/components/WPalette/WPalette.vue.d.ts +11 -0
  66. package/dist/runtime/components/WPopover/WPopover.d.vue.ts +45 -0
  67. package/dist/runtime/components/WPopover/WPopover.vue +144 -0
  68. package/dist/runtime/components/WPopover/WPopover.vue.d.ts +45 -0
  69. package/dist/runtime/components/WPopup/WPopup.d.vue.ts +51 -0
  70. package/dist/runtime/components/WPopup/WPopup.vue +106 -0
  71. package/dist/runtime/components/WPopup/WPopup.vue.d.ts +51 -0
  72. package/dist/runtime/components/{LibProgressBar/LibProgressBar.d.vue.ts → WProgressBar/WProgressBar.d.vue.ts} +14 -18
  73. package/dist/runtime/components/WProgressBar/WProgressBar.vue +150 -0
  74. package/dist/runtime/components/{LibProgressBar/LibProgressBar.vue.d.ts → WProgressBar/WProgressBar.vue.d.ts} +14 -18
  75. package/dist/runtime/components/{LibRecorder/LibRecorder.d.vue.ts → WRecorder/WRecorder.d.vue.ts} +14 -29
  76. package/dist/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +37 -36
  77. package/dist/runtime/components/{LibRecorder/LibRecorder.vue.d.ts → WRecorder/WRecorder.vue.d.ts} +14 -29
  78. package/dist/runtime/components/{LibRoot/LibRoot.d.vue.ts → WRoot/WRoot.d.vue.ts} +6 -5
  79. package/dist/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +17 -15
  80. package/dist/runtime/components/{LibRoot/LibRoot.vue.d.ts → WRoot/WRoot.vue.d.ts} +6 -5
  81. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.d.vue.ts → WSimpleInput/WSimpleInput.d.vue.ts} +10 -16
  82. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +14 -24
  83. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue.d.ts → WSimpleInput/WSimpleInput.vue.d.ts} +10 -16
  84. package/dist/runtime/components/WTable/WTable.d.vue.ts +102 -0
  85. package/dist/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +13 -14
  86. package/dist/runtime/components/WTable/WTable.vue.d.ts +102 -0
  87. package/dist/runtime/components/WTooltip/WTooltip.d.vue.ts +40 -0
  88. package/dist/runtime/components/WTooltip/WTooltip.vue +112 -0
  89. package/dist/runtime/components/WTooltip/WTooltip.vue.d.ts +40 -0
  90. package/dist/runtime/components/index.d.ts +20 -20
  91. package/dist/runtime/components/index.js +20 -20
  92. package/dist/runtime/composables/index.d.ts +4 -4
  93. package/dist/runtime/composables/index.js +4 -4
  94. package/dist/runtime/composables/useDelayedLoadingIndicator.d.ts +9 -0
  95. package/dist/runtime/composables/useDelayedLoadingIndicator.js +18 -0
  96. package/dist/runtime/composables/useDisplayForReka.d.ts +25 -0
  97. package/dist/runtime/composables/useDisplayForReka.js +16 -0
  98. package/dist/runtime/composables/useFallbackId.d.ts +3 -0
  99. package/dist/runtime/composables/useFallbackId.js +5 -0
  100. package/dist/runtime/composables/useInjectedDarkMode.d.ts +1 -1
  101. package/dist/runtime/composables/usePopupConstrainToStyle.d.ts +8 -0
  102. package/dist/runtime/composables/usePopupConstrainToStyle.js +8 -0
  103. package/dist/runtime/composables/useSetupDarkMode.d.ts +2 -3
  104. package/dist/runtime/composables/useSetupDarkMode.js +90 -4
  105. package/dist/runtime/helpers/NotificationHandler.d.ts +2 -2
  106. package/dist/runtime/injectionKeys.d.ts +1 -5
  107. package/dist/runtime/injectionKeys.js +0 -2
  108. package/dist/runtime/types/index.d.ts +85 -27
  109. package/dist/runtime/types/index.js +1 -0
  110. package/package.json +1 -1
  111. package/src/module.ts +1 -1
  112. package/src/runtime/assets/animations.css +3 -3
  113. package/src/runtime/assets/locales/en.json +2 -0
  114. package/src/runtime/build/WitchcraftUiResolver.ts +2 -2
  115. package/src/runtime/components/TestControls/TestControls.vue +3 -3
  116. package/src/runtime/components/WButton/WButton.stories.ts +112 -0
  117. package/src/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +34 -50
  118. package/src/runtime/components/{LibCheckbox/LibCheckbox.stories.ts → WCheckbox/WCheckbox.stories.ts} +5 -5
  119. package/src/runtime/components/WCheckbox/WCheckbox.vue +125 -0
  120. package/src/runtime/components/{LibColorInput/LibColorInput.stories.ts → WColorInput/WColorInput.stories.ts} +8 -8
  121. package/src/runtime/components/WColorInput/WColorInput.vue +112 -0
  122. package/src/runtime/components/WColorInput/WColorSwatchButton.vue +102 -0
  123. package/src/runtime/components/{LibColorPicker/LibColorPicker.stories.ts → WColorPicker/WColorPicker.stories.ts} +12 -12
  124. package/src/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +44 -31
  125. package/src/runtime/components/WCombobox/WCombobox.stories.ts +209 -0
  126. package/src/runtime/components/WCombobox/WCombobox.vue +450 -0
  127. package/src/runtime/components/WCombobox/storyPlays.ts +92 -0
  128. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts → WDarkModeSwitcher/WDarkModeSwitcher.stories.ts} +6 -6
  129. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +19 -30
  130. package/src/runtime/components/{LibDatePicker/LibDatePicker.stories.ts → WDatePicker/WDatePicker.stories.ts} +42 -34
  131. package/src/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
  132. package/src/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +21 -21
  133. package/src/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +21 -21
  134. package/src/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
  135. package/src/runtime/components/{LibDebug/LibDebug.stories.ts → WDebug/WDebug.stories.ts} +5 -5
  136. package/src/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +9 -10
  137. package/src/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -4
  138. package/src/runtime/components/{LibFileInput/LibFileInput.stories.ts → WFileInput/WFileInput.stories.ts} +7 -7
  139. package/src/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +98 -97
  140. package/src/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +5 -8
  141. package/src/runtime/components/{LibMultiValues/LibMultiValues.stories.ts → WMultiValues/WMultiValues.stories.ts} +9 -9
  142. package/src/runtime/components/WMultiValues/WMultiValues.vue +163 -0
  143. package/src/runtime/components/{LibNotifications/LibNotification.stories.ts → WNotifications/WNotification.stories.ts} +9 -9
  144. package/src/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +45 -65
  145. package/src/runtime/components/WNotifications/WNotifications.stories.ts +139 -0
  146. package/src/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +51 -29
  147. package/src/runtime/components/WNumberInput/WNumberInput.vue +109 -0
  148. package/src/runtime/components/WPagination/WPagination.stories.ts +51 -0
  149. package/src/runtime/components/WPagination/WPagination.vue +207 -0
  150. package/src/runtime/components/{LibPalette/LibPalette.stories.ts → WPalette/WPalette.stories.ts} +6 -6
  151. package/src/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
  152. package/src/runtime/components/WPopover/WPopover.stories.ts +218 -0
  153. package/src/runtime/components/WPopover/WPopover.vue +168 -0
  154. package/src/runtime/components/WPopup/WPopup.stories.ts +104 -0
  155. package/src/runtime/components/WPopup/WPopup.vue +125 -0
  156. package/src/runtime/components/WProgressBar/WProgressBar.stories.ts +119 -0
  157. package/src/runtime/components/WProgressBar/WProgressBar.vue +185 -0
  158. package/src/runtime/components/{LibRecorder/LibRecorder.stories.ts → WRecorder/WRecorder.stories.ts} +9 -6
  159. package/src/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +69 -68
  160. package/src/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +18 -15
  161. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.stories.ts → WSimpleInput/WSimpleInput.stories.ts} +11 -12
  162. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +28 -44
  163. package/src/runtime/components/{LibTable/LibTable.stories.ts → WTable/WTable.stories.ts} +60 -52
  164. package/src/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +85 -88
  165. package/src/runtime/components/WTooltip/WTooltip.stories.ts +82 -0
  166. package/src/runtime/components/WTooltip/WTooltip.vue +128 -0
  167. package/src/runtime/components/index.ts +20 -20
  168. package/src/runtime/composables/index.ts +4 -4
  169. package/src/runtime/composables/useDelayedLoadingIndicator.ts +30 -0
  170. package/src/runtime/composables/useDisplayForReka.ts +37 -0
  171. package/src/runtime/composables/useFallbackId.ts +6 -0
  172. package/src/runtime/composables/useInjectedDarkMode.ts +1 -2
  173. package/src/runtime/composables/usePopupConstrainToStyle.ts +29 -0
  174. package/src/runtime/composables/useSetupDarkMode.ts +122 -4
  175. package/src/runtime/helpers/NotificationHandler.ts +2 -2
  176. package/src/runtime/injectionKeys.ts +1 -7
  177. package/src/runtime/types/index.ts +105 -32
  178. package/types/components.d.ts +14 -15
  179. package/dist/runtime/components/Aria/Aria.d.vue.ts +0 -6
  180. package/dist/runtime/components/Aria/Aria.vue +0 -16
  181. package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -6
  182. package/dist/runtime/components/LibButton/LibButton.d.vue.ts +0 -37
  183. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -37
  184. package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +0 -41
  185. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +0 -103
  186. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -41
  187. package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +0 -64
  188. package/dist/runtime/components/LibColorInput/LibColorInput.vue +0 -162
  189. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +0 -64
  190. package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +0 -191
  191. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +0 -191
  192. package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +0 -46
  193. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -46
  194. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +0 -256
  195. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -387
  196. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -256
  197. package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +0 -27
  198. package/dist/runtime/components/LibLabel/LibLabel.vue +0 -45
  199. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -27
  200. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +0 -109
  201. package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +0 -45
  202. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -45
  203. package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +0 -15
  204. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -15
  205. package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +0 -105
  206. package/dist/runtime/components/LibPagination/LibPagination.vue +0 -229
  207. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -105
  208. package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +0 -15
  209. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -15
  210. package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +0 -52
  211. package/dist/runtime/components/LibPopup/LibPopup.vue +0 -365
  212. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -52
  213. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +0 -169
  214. package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +0 -99
  215. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +0 -178
  216. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -99
  217. package/dist/runtime/components/LibTable/LibTable.d.vue.ts +0 -125
  218. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -125
  219. package/dist/runtime/components/Template/NAME.d.vue.ts +0 -18
  220. package/dist/runtime/components/Template/NAME.vue +0 -27
  221. package/dist/runtime/components/Template/NAME.vue.d.ts +0 -18
  222. package/dist/runtime/components/Template/TemplateStory.d.ts +0 -7
  223. package/dist/runtime/components/Template/TemplateStory.js +0 -22
  224. package/dist/runtime/components/shared/props.d.ts +0 -171
  225. package/dist/runtime/components/shared/props.js +0 -2
  226. package/dist/runtime/composables/useAriaLabel.d.ts +0 -6
  227. package/dist/runtime/composables/useAriaLabel.js +0 -15
  228. package/dist/runtime/composables/useDarkMode.d.ts +0 -77
  229. package/dist/runtime/composables/useDarkMode.js +0 -89
  230. package/dist/runtime/composables/useDivideAttrs.d.ts +0 -27
  231. package/dist/runtime/composables/useDivideAttrs.js +0 -27
  232. package/dist/runtime/composables/useSuggestions.d.ts +0 -40
  233. package/dist/runtime/composables/useSuggestions.js +0 -263
  234. package/src/runtime/components/Aria/Aria.vue +0 -26
  235. package/src/runtime/components/LibButton/LibButton.stories.ts +0 -106
  236. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -131
  237. package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -203
  238. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +0 -405
  239. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -419
  240. package/src/runtime/components/LibLabel/LibLabel.stories.ts +0 -33
  241. package/src/runtime/components/LibLabel/LibLabel.vue +0 -65
  242. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -123
  243. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +0 -131
  244. package/src/runtime/components/LibPagination/LibPagination.stories.ts +0 -49
  245. package/src/runtime/components/LibPagination/LibPagination.vue +0 -274
  246. package/src/runtime/components/LibPopup/LibPopup.stories.ts +0 -153
  247. package/src/runtime/components/LibPopup/LibPopup.vue +0 -396
  248. package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +0 -90
  249. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -197
  250. package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +0 -134
  251. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -212
  252. package/src/runtime/components/Template/NAME.vue +0 -49
  253. package/src/runtime/components/Template/TemplateStory.ts +0 -37
  254. package/src/runtime/components/shared/props.ts +0 -199
  255. package/src/runtime/composables/useAriaLabel.ts +0 -23
  256. package/src/runtime/composables/useDarkMode.ts +0 -199
  257. package/src/runtime/composables/useDivideAttrs.ts +0 -53
  258. package/src/runtime/composables/useSuggestions.ts +0 -339
  259. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.d.ts +0 -0
  260. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.js +0 -0
  261. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.d.ts +0 -0
  262. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.js +0 -0
  263. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.d.ts +0 -0
  264. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.js +0 -0
  265. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.d.ts +0 -0
  266. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.js +0 -0
  267. /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.d.vue.ts → WDatePicker/WRangeDatePicker.d.vue.ts} +0 -0
  268. /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue.d.ts → WDatePicker/WRangeDatePicker.vue.d.ts} +0 -0
  269. /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.d.vue.ts → WDatePicker/WSingleDatePicker.d.vue.ts} +0 -0
  270. /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue.d.ts → WDatePicker/WSingleDatePicker.vue.d.ts} +0 -0
  271. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.d.ts +0 -0
  272. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.js +0 -0
  273. /package/dist/runtime/components/{LibDebug/LibDebug.d.vue.ts → WDebug/WDebug.d.vue.ts} +0 -0
  274. /package/dist/runtime/components/{LibDebug/LibDebug.vue.d.ts → WDebug/WDebug.vue.d.ts} +0 -0
  275. /package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -0
  276. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.d.vue.ts → WNotifications/WNotificationTestMessageComponent.d.vue.ts} +0 -0
  277. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
  278. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue.d.ts → WNotifications/WNotificationTestMessageComponent.vue.d.ts} +0 -0
  279. /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.d.ts +0 -0
  280. /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.js +0 -0
  281. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.ts +0 -0
  282. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.ts +0 -0
  283. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.ts +0 -0
  284. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.ts +0 -0
  285. /package/src/runtime/components/{LibDatePicker → WDatePicker}/helpers.ts +0 -0
  286. /package/src/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
  287. /package/src/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.ts +0 -0
@@ -1,396 +0,0 @@
1
- <!-- Popover API WHEN :sob:
2
- #awaiting https://developer.mozilla.org/en-US/docs/Web/API/Popover_API#browser_compatibility -->
3
- <template>
4
- <slot
5
- name="button"
6
- :extract-el="(_:any) => buttonEl = _"
7
- />
8
- <!-- <Transition> -->
9
- <component
10
- v-if="modelValue || useDialogForBackdrop"
11
- :id="id ?? fallbackId"
12
- :class="twMerge(
13
- useBackdrop && useDialogForBackdrop && `
14
- popup--backdrop
15
- bg-transparent
16
- p-0
17
- backdrop:bg-transparent
18
- `,
19
- modelValue && useBackdrop && !useDialogForBackdrop && `
20
- popup--backdrop
21
- z-100
22
- fixed
23
- inset-0
24
- `,
25
- $attrs.class as any
26
- )"
27
- v-bind="{ ...$attrs, class: undefined }"
28
- :is="useDialogForBackdrop ? 'dialog' : 'div'"
29
- ref="dialogEl"
30
- @mousedown.self="handleMouseup"
31
- >
32
- <div
33
- v-if="modelValue"
34
- :class="`popup z-100 fixed ${props.avoidRepositioning ? 'transition-[top,left]' : ''}`"
35
- :style="`
36
- top:${pos.y}px;
37
- left:${pos.x}px;
38
- ${pos.maxWidth ? `max-width:${pos.maxWidth}px` : ''}
39
- ${pos.maxHeight ? `max-height:${pos.maxHeight}px` : ''}
40
- `"
41
- >
42
- <slot
43
- name="popup"
44
- :position="pos"
45
- :extract-el="(_:any) => popupEl = _"
46
- />
47
- </div>
48
- </component>
49
- <!-- </Transition> -->
50
- </template>
51
-
52
- <script setup lang="ts">
53
- // eslint-disable-next-line simple-import-sort/imports
54
- import { onMounted, ref, useAttrs, watch, type HTMLAttributes } from "vue"
55
- import { getFallbackId, type LinkableByIdProps, type TailwindClassProp, type PopupProps } from "../shared/props.js"
56
-
57
- import { twMerge } from "../../utils/twMerge.js"
58
- import { castType } from "@alanscodelog/utils/castType"
59
- import { isArray } from "@alanscodelog/utils/isArray"
60
- import type { IPopupReference, PopupPosition, SimpleDOMRect } from "../../types/index.js"
61
-
62
- const fallbackId = getFallbackId()
63
- const props = withDefaults(defineProps<Props>(), {
64
- useBackdrop: true,
65
- useDialogForBackdrop: false,
66
- // vue is getting confused when the prop type can also be a function
67
- preferredHorizontal: () => ["center-most", "either"] satisfies Props["preferredHorizontal"],
68
- preferredVertical: () => ["top", "bottom", "either"] satisfies Props["preferredVertical"],
69
- avoidRepositioning: false,
70
- canClose: true
71
- })
72
- const $attrs = useAttrs()
73
- defineOptions({
74
- name: "LibPopup",
75
- inheritAttrs: false
76
- })
77
-
78
- const emit = defineEmits<{
79
- (e: "close"): void
80
- }>()
81
-
82
- const dialogEl = ref<HTMLDialogElement | null>(null)
83
- const popupEl = ref<IPopupReference | null>(null)
84
- const buttonEl = ref<IPopupReference | null>(null)
85
- const backgroundEl = ref<IPopupReference | null>(null)
86
-
87
- const pos = ref<PopupPosition>({} as any)
88
- const modelValue = defineModel<boolean>({ default: false })
89
- let isOpen = modelValue.value
90
-
91
- /**
92
- * We don't have access to the dialog backdrop and without extra styling, it's of 0 width/height, positioned in the center of the screen, with margins taking up all the space.
93
- *
94
- * This returns a modified rect that makes more logical sense.
95
- */
96
- const getDialogBoundingRect = (): SimpleDOMRect => ({
97
- x: 0,
98
- y: 0,
99
- width: window.innerWidth,
100
- height: window.innerHeight,
101
- top: 0,
102
- bottom: 0,
103
- left: 0,
104
- right: 0
105
- })
106
- let lastButtonElPos: SimpleDOMRect | undefined
107
- const recompute = (force: boolean = false): void => {
108
- requestAnimationFrame(() => {
109
- const horzHasCenterScreen = isArray(props.preferredHorizontal)
110
- && props.preferredHorizontal[0] === "center-screen"
111
- const vertHasCenterScreen = isArray(props.preferredVertical)
112
- && props.preferredVertical[0] === "center-screen"
113
-
114
- const canBePositionedWithoutButton
115
- = (horzHasCenterScreen || typeof props.preferredHorizontal === "function")
116
- && (vertHasCenterScreen || typeof props.preferredVertical === "function")
117
- if (!popupEl.value || !dialogEl.value || (!buttonEl.value && !canBePositionedWithoutButton)) {
118
- pos.value = {} as any
119
- return
120
- }
121
- const el = buttonEl.value?.getBoundingClientRect()
122
- const bg = backgroundEl.value?.getBoundingClientRect() ?? (
123
- props.useBackdrop
124
- ? getDialogBoundingRect()
125
- : document.body.getBoundingClientRect()
126
- )
127
- const popup = popupEl.value.getBoundingClientRect()
128
-
129
- let finalPos: { x: number, y: number, maxWidth?: number, maxHeight?: number } = {} as any
130
-
131
- if (!force && modelValue.value && props.avoidRepositioning && buttonEl.value && lastButtonElPos) {
132
- const shiftX = buttonEl.value.getBoundingClientRect().x - lastButtonElPos.x
133
- const shiftY = buttonEl.value.getBoundingClientRect().y - lastButtonElPos.y
134
-
135
- pos.value.x += shiftX
136
- pos.value.y += shiftY
137
- lastButtonElPos = el
138
- return
139
- }
140
-
141
- const space = {
142
- left: 0,
143
- right: 0,
144
- leftLeft: 0,
145
- rightRight: 0,
146
- leftFromCenter: 0,
147
- rightFromCenter: 0,
148
- topFromCenter: 0,
149
- bottomFromCenter: 0,
150
- top: 0,
151
- bottom: 0
152
- }
153
- if (el) {
154
- space.left = (el.x + el.width) - bg.x
155
- space.leftLeft = el.x - bg.x
156
- space.right = (bg.x + bg.width) - (el.x + el.width)
157
- space.rightRight = bg.x + bg.width - el.x
158
- space.leftFromCenter = (el.x + (el.width / 2)) - bg.x
159
- space.rightFromCenter = (bg.x + bg.width) - (el.x + (el.width / 2))
160
- space.topFromCenter = (el.y + (el.height / 2)) - bg.y
161
- space.bottomFromCenter = (bg.y + bg.height) - (el.y + (el.height / 2))
162
- space.top = el.y - bg.y
163
- space.bottom = (bg.y + bg.height) - (el.y + el.height)
164
- }
165
- const { preferredHorizontal, preferredVertical } = props
166
- let maxWidth: number | undefined
167
- let maxHeight: number | undefined
168
- if (typeof preferredHorizontal === "function") {
169
- finalPos.x = preferredHorizontal(el, popup, bg, space)
170
- } else {
171
- outerloop:
172
- for (const type of preferredHorizontal) {
173
- switch (type) {
174
- case "center-screen":
175
- if (popup.width < bg.width) {
176
- finalPos.x = (bg.width / 2) - (popup.width / 2)
177
- } else {
178
- finalPos.x = 0
179
- maxWidth = finalPos.x
180
- }
181
- break
182
- case "center-most":
183
- case "center":
184
- castType<DOMRect>(el)
185
- if (space.leftFromCenter >= (popup.width / 2)
186
- && space.rightFromCenter >= (popup.width / 2)) {
187
- finalPos.x = el.x + (el.width / 2) - (popup.width / 2)
188
- break outerloop
189
- }
190
- // todo temp fix when it's too wide, will prefer left
191
- if (((space.rightFromCenter + space.leftFromCenter) <= popup.width)) {
192
- finalPos.x = 0
193
- break outerloop
194
- }
195
- if (type === "center-most") {
196
- if (space.leftFromCenter < space.rightFromCenter) {
197
- finalPos.x = el.x + (el.width / 2) - space.leftFromCenter; break outerloop
198
- } else {
199
- finalPos.x = el.x + (el.width / 2) + space.rightFromCenter - popup.width; break outerloop
200
- }
201
- }
202
- break
203
- case "left-most":
204
- castType<DOMRect>(el)
205
- if (space.left >= popup.width) {
206
- finalPos.x = el.x - popup.width; break outerloop
207
- } else {
208
- finalPos.x = 0; break outerloop
209
- }
210
- case "right-most":
211
- castType<DOMRect>(el)
212
- if (space.right >= popup.width) {
213
- finalPos.x = el.x + el.width; break outerloop
214
- } else {
215
- finalPos.x = bg.x + bg.width - popup.width; break outerloop
216
- }
217
-
218
- case "right":
219
- castType<DOMRect>(el)
220
- if (space.right >= popup.width) {
221
- finalPos.x = el.x; break outerloop
222
- }
223
- break
224
- case "left":
225
- castType<DOMRect>(el)
226
- if (space.left >= popup.width) {
227
- finalPos.x = (el.x + el.width) - popup.width; break outerloop
228
- }
229
- break
230
- case "either": {
231
- castType<DOMRect>(el)
232
- if (space.right >= space.left) {
233
- finalPos.x = el.x; break outerloop
234
- } else {
235
- finalPos.x = (el.x + el.width) - popup.width
236
- break outerloop
237
- }
238
- }
239
- }
240
- }
241
- }
242
- if (typeof preferredVertical === "function") {
243
- finalPos.y = preferredVertical(el, popup, bg, space)
244
- } else {
245
- outerloop:
246
- for (const type of preferredVertical) {
247
- switch (type) {
248
- case "center-screen":
249
- if (popup.height < bg.height) {
250
- finalPos.y = (bg.height / 2) - (popup.height / 2)
251
- } else {
252
- finalPos.y = 0
253
- maxHeight = finalPos.y
254
- }
255
- break
256
- case "top":
257
- castType<DOMRect>(el)
258
- if (space.top >= popup.height) {
259
- finalPos.y = el.y - popup.height; break outerloop
260
- }
261
- break
262
- case "bottom":
263
- castType<DOMRect>(el)
264
- if (space.bottom >= popup.height) {
265
- finalPos.y = el.y + el.height; break outerloop
266
- }
267
- break
268
- case "top-most":
269
- castType<DOMRect>(el)
270
- if (space.top >= popup.height) {
271
- finalPos.y = el.y - popup.height; break outerloop
272
- } else {
273
- finalPos.y = 0; break outerloop
274
- }
275
- case "bottom-most":
276
- castType<DOMRect>(el)
277
- if (space.bottom >= popup.height) {
278
- finalPos.y = el.y + el.height; break outerloop
279
- } else {
280
- finalPos.y = bg.y + bg.height - popup.height; break outerloop
281
- }
282
- case "center-most":
283
- case "center":
284
- castType<DOMRect>(el)
285
- if (space.topFromCenter >= (popup.height / 2)
286
- && space.bottomFromCenter >= (popup.height / 2)) {
287
- finalPos.y = el.y + (el.height / 2) - (popup.height / 2)
288
- break outerloop
289
- }
290
- // todo temp fix when it's too wide, will prefer the top
291
- if (((space.bottomFromCenter + space.topFromCenter) <= popup.height)) {
292
- finalPos.y = 0
293
- break outerloop
294
- }
295
- if (type === "center-most") {
296
- if (space.topFromCenter < space.bottomFromCenter) {
297
- finalPos.y = el.y + (el.height / 2) - space.topFromCenter; break outerloop
298
- } else {
299
- finalPos.y = el.y + (el.height / 2) + space.bottomFromCenter - popup.height; break outerloop
300
- }
301
- }
302
- break
303
- case "either": {
304
- castType<DOMRect>(el)
305
- if (space.top >= space.bottom) {
306
- finalPos.y = el.y - popup.height; break outerloop
307
- } else { finalPos.y = el.y + el.height; break outerloop }
308
- }
309
- }
310
- }
311
- }
312
- finalPos.maxWidth = maxWidth ?? undefined
313
- finalPos.maxHeight = maxHeight ?? undefined
314
-
315
- if (props.modifyPosition) {
316
- finalPos = props.modifyPosition(finalPos, el, popup, bg, space)
317
- }
318
- pos.value = finalPos
319
- lastButtonElPos = el
320
- })
321
- }
322
-
323
- const show = () => {
324
- if (!isOpen) {
325
- isOpen = true
326
- modelValue.value = isOpen
327
- if (props.useBackdrop && props.useDialogForBackdrop) dialogEl.value?.showModal()
328
- recompute(true)
329
- }
330
- }
331
-
332
- const close = () => {
333
- if (isOpen) {
334
- const res = props.canClose ?? false
335
- emit("close")
336
- if (res === false) return
337
- isOpen = false
338
- modelValue.value = isOpen
339
- pos.value.maxWidth = undefined
340
- if (props.useBackdrop && props.useDialogForBackdrop) dialogEl.value?.close()
341
- }
342
- }
343
-
344
-
345
- const recomputeListener = () => recompute()
346
-
347
- const bindListeners = () => {
348
- window.addEventListener("resize", recomputeListener)
349
- window.addEventListener("scroll", recomputeListener, true)
350
- }
351
- const unbindListeners = () => {
352
- window.removeEventListener("resize", recomputeListener)
353
- window.removeEventListener("scroll", recomputeListener, true)
354
- }
355
-
356
- watch([modelValue, popupEl], () => {
357
- if (modelValue.value) {
358
- show()
359
- bindListeners()
360
- } else {
361
- close()
362
- unbindListeners()
363
- }
364
- })
365
-
366
- const handleMouseup = ($event: MouseEvent) => {
367
- $event.preventDefault()
368
- close()
369
- }
370
- onMounted(() => {
371
- recompute()
372
- })
373
-
374
- defineExpose({
375
- recompute,
376
- setReference: (el: IPopupReference | null) => {
377
- buttonEl.value = el
378
- },
379
- setBackground: (el: IPopupReference | null) => {
380
- backgroundEl.value = el
381
- }
382
-
383
- })
384
- </script>
385
-
386
- <script lang="ts">
387
- type RealProps
388
- = & LinkableByIdProps
389
- & PopupProps
390
-
391
- interface Props
392
- extends
393
- /** @vue-ignore */
394
- Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
395
- RealProps { }
396
- </script>
@@ -1,90 +0,0 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
- import type { Meta, StoryObj } from "@storybook/vue3"
3
- import { onUnmounted, ref } from "vue"
4
-
5
- import LibProgressBar from "./LibProgressBar.vue"
6
-
7
- import * as components from "../index.js"
8
-
9
- const meta: Meta<typeof LibProgressBar> = {
10
- component: LibProgressBar,
11
- title: "Components/ProgressBar",
12
- args: {
13
- label: "Label",
14
- // @ts-expect-error .
15
- _timeout: 1000,
16
- _add: 10,
17
- _start: 50
18
- }
19
- }
20
-
21
- export default meta
22
- type Story = StoryObj<typeof LibProgressBar>
23
-
24
- export const Primary: Story = {
25
- render: args => ({
26
- components,
27
- setup: () => {
28
- const progress = ref((args as any)._start as number)
29
- if (args.progress) {
30
- progress.value = args.progress
31
- } else {
32
- const interval = setInterval(() => {
33
- if (progress.value >= 100) {
34
- progress.value = 0
35
- } else {
36
- progress.value += (args as any)._add as number
37
- }
38
- }, (args as any)._timeout as number)
39
- onUnmounted(() => {
40
- clearInterval(interval)
41
- })
42
- }
43
- return {
44
- args: { ...args },
45
- progress
46
- }
47
- },
48
- template: `
49
- <lib-progress-bar class="flex-1" v-bind="args" :progress="progress"></lib-progress-bar>
50
- <br/>
51
- Stretched in flexbox:
52
- <div class="flex w-full">
53
- <lib-progress-bar class="flex-1" v-bind="args" :progress="progress"></lib-progress-bar>
54
- </div>
55
- `
56
- })
57
- }
58
- export const Secondary: Story = {
59
- ...Primary,
60
- args: {
61
- ...Primary.args
62
- }
63
- }
64
- export const ReallyLongLabel: Story = {
65
- ...Primary,
66
- args: {
67
- ...Primary.args,
68
- label: "Really Long Label Label to See Effect Really Long Label Label to See Effect Really Long Label Label to See Effect Really Long Label Label to See Effect"
69
- }
70
- }
71
- export const Static: Story = {
72
- ...Primary,
73
- args: {
74
- ...Primary.args,
75
- progress: 50
76
- }
77
- }
78
-
79
- export const AutoHiding: Story = {
80
- ...Primary,
81
- args: {
82
- ...Primary.args,
83
- autohideOnComplete: 500,
84
- clamp: [10, 100],
85
- _start: 0,
86
- // keepSpaceWhenHidden: true,
87
- _timeout: 1000,
88
- _add: 10
89
- }
90
- }
@@ -1,197 +0,0 @@
1
- <template>
2
- <Transition>
3
- <div
4
- v-if="!hide"
5
- :id="id ?? fallbackId"
6
- :class="twMerge(`
7
- progress-bar
8
- w-[200px]
9
- whitespace-nowrap
10
- overflow-x-scroll
11
- scrollbar-hidden
12
- rounded-sm
13
- flex
14
- text-fg
15
- relative
16
- before:content-['']
17
- text-sm
18
- min-w-[50px]
19
- after:shadow-inner
20
- after:shadow-black/50
21
- after:content-['']
22
- after:absolute
23
- after:inset-0
24
- after:pointer-events-none
25
- after:z-2
26
- after:transition-all
27
- before:shadow-inner
28
- before:shadow-black/50
29
- before:rounded-sm
30
- before:bg-bars-gradient
31
- before:animate-slideBgInf
32
- before:[background-size:15px_15px]
33
- before:absolute
34
- before:w-[var(--progress)]
35
- before:top-0 before:bottom-0 before:left-0
36
- before:transition-all
37
- before:z-1
38
- before:duration-500
39
- `, psuedoHide && `
40
- after:opacity-0
41
- before:opacity-0
42
- `, ($attrs as any).class)"
43
- :data-value="progress"
44
- :title="label"
45
- role="progressbar"
46
- :aria-valuenow="clampVal(progress, clamp[0] ?? 0, clamp[1] ?? 100)"
47
- :aria-valuemin="clamp[0] ?? 0"
48
- :aria-valuemax="clamp[1] ?? 100"
49
- v-bind="{ ...$attrs, class: undefined }"
50
- :style="`--progress: ${clampVal(progress, clamp[0] ?? 0, clamp[1] ?? 100)}%;`"
51
- >
52
- <div class="procgress-bar--label-wrapper relative flex-1">
53
- <span class="before:content-vertical-holder"/>
54
- <Transition>
55
- <slot>
56
- <label
57
- v-if="!psuedoHide"
58
- :for="id"
59
- class="
60
- text-bg
61
- absolute inset-0 flex
62
- justify-center
63
- "
64
- >
65
- <div class="truncate">
66
- {{ label ?? "" }}
67
- </div>
68
- </label>
69
- </slot>
70
- </Transition>
71
-
72
- <Transition>
73
- <slot>
74
- <label
75
- v-if="!psuedoHide"
76
- class="
77
- progress-bar--label
78
- contrast-label
79
- pointer-events-none
80
- absolute
81
- inset-0
82
- flex justify-center transition-all
83
- duration-500
84
- [clip-path:inset(0_0_0_var(--progress))]
85
- dark:hidden
86
- "
87
- >
88
- <div class="truncate">
89
- {{ label ?? "" }}
90
- </div>
91
- </label>
92
- </slot>
93
- </Transition>
94
- </div>
95
- </div>
96
- </Transition>
97
- </template>
98
-
99
- <script setup lang="ts">
100
- import { ref, watch } from "vue"
101
-
102
- import { twMerge } from "../../utils/twMerge.js"
103
- import { type BaseInteractiveProps, getFallbackId, type LabelProps, type LinkableByIdProps, type TailwindClassProp } from "../shared/props.js"
104
-
105
- // TODO move to utils
106
- const clampVal = (n: number, min: number, max: number) => Math.min(Math.max(n, min), max)
107
-
108
- defineOptions({
109
- name: "LibProgressBar",
110
- inheritAttrs: false
111
- })
112
- const fallbackId = getFallbackId()
113
- const props = withDefaults(defineProps<Props>(), {
114
- autohideOnComplete: -1,
115
- keepSpaceWhenHidden: false,
116
- clamp: () => [0, 100],
117
- unstyle: false, disabled: false, readonly: false, border: true
118
- })
119
- const hide = ref<boolean>(false)
120
- const psuedoHide = ref<boolean>(false)
121
- let timeout: number
122
- let type: number
123
- if (props.autohideOnComplete > -1 && (props.progress >= 100 || props.progress < 0)) {
124
- if (props.keepSpaceWhenHidden) {
125
- hide.value = false
126
- psuedoHide.value = true
127
- } else {
128
- hide.value = true
129
- psuedoHide.value = false
130
- }
131
- }
132
-
133
- watch([
134
- () => props.progress,
135
- () => props.keepSpaceWhenHidden,
136
- () => props.autohideOnComplete
137
- ], () => {
138
- if (props.autohideOnComplete > -1 && (props.progress >= 100 || props.progress < 0)) {
139
- if (props.keepSpaceWhenHidden) {
140
- if (type === 1) return
141
- clearTimeout(timeout)
142
- type = 1
143
- timeout = setTimeout(() => {
144
- type = 0
145
- hide.value = false
146
- psuedoHide.value = true
147
- }, props.autohideOnComplete) as any
148
- } else {
149
- if (type === 2) return
150
- clearTimeout(timeout)
151
- type = 2
152
- timeout = setTimeout(() => {
153
- type = 0
154
- hide.value = true
155
- psuedoHide.value = false
156
- }, props.autohideOnComplete) as any
157
- }
158
- } else {
159
- clearTimeout(timeout)
160
- hide.value = false
161
- psuedoHide.value = false
162
- }
163
- }, { immediate: false })
164
- </script>
165
-
166
- <script lang="ts">
167
- import type { HTMLAttributes } from "vue"
168
-
169
- type RealProps
170
- = & LinkableByIdProps
171
- & BaseInteractiveProps
172
- & LabelProps
173
- & {
174
- /** A number from 0-100. It is auto-clamped. */
175
- progress: number
176
- /** Will auto hide after this given time if progress is 100% or more or less than 0% until progress is set to something else. Disabled (-1) by default. */
177
- autohideOnComplete?: number
178
- /**
179
- * Do not actually hide the element, just leave an unstyled div,
180
- * so the whole layout doesn't change on completion when autohideOnComplete is set.
181
- */
182
- keepSpaceWhenHidden?: boolean
183
- /**
184
- * By default the progress bar is visually clamped to 0-100, even if the value might be something else.
185
- * You can change what it's clamped to here, to for example,
186
- * show at least a small sliver of the progress bar when it's still 0.
187
- */
188
- clamp?: [start: number, end: number]
189
- }
190
-
191
- interface Props
192
- extends
193
- /** @vue-ignore */
194
- Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
195
- RealProps
196
- { }
197
- </script>