@witchcraft/ui 0.3.24 → 0.4.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/README.md +54 -61
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/assets/animations.css +1 -1
  4. package/dist/runtime/assets/locales/en.json +2 -0
  5. package/dist/runtime/assets/utils.css +1 -1
  6. package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
  7. package/dist/runtime/components/TestControls/TestControls.vue +3 -3
  8. package/dist/runtime/components/WButton/WButton.d.vue.ts +34 -0
  9. package/dist/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +26 -38
  10. package/dist/runtime/components/WButton/WButton.vue.d.ts +34 -0
  11. package/dist/runtime/components/WCheckbox/WCheckbox.d.vue.ts +33 -0
  12. package/dist/runtime/components/WCheckbox/WCheckbox.vue +109 -0
  13. package/dist/runtime/components/WCheckbox/WCheckbox.vue.d.ts +33 -0
  14. package/dist/runtime/components/WColorInput/WColorInput.d.vue.ts +45 -0
  15. package/dist/runtime/components/WColorInput/WColorInput.vue +85 -0
  16. package/dist/runtime/components/WColorInput/WColorInput.vue.d.ts +45 -0
  17. package/dist/runtime/components/WColorInput/WColorSwatchButton.d.vue.ts +28 -0
  18. package/dist/runtime/components/WColorInput/WColorSwatchButton.vue +86 -0
  19. package/dist/runtime/components/WColorInput/WColorSwatchButton.vue.d.ts +28 -0
  20. package/dist/runtime/components/{LibColorPicker/LibColorPicker.d.vue.ts → WColorPicker/WColorPicker.d.vue.ts} +5 -4
  21. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +40 -29
  22. package/dist/runtime/components/{LibColorPicker/LibColorPicker.vue.d.ts → WColorPicker/WColorPicker.vue.d.ts} +5 -4
  23. package/dist/runtime/components/WCombobox/WCombobox.d.vue.ts +109 -0
  24. package/dist/runtime/components/WCombobox/WCombobox.vue +402 -0
  25. package/dist/runtime/components/WCombobox/WCombobox.vue.d.ts +109 -0
  26. package/dist/runtime/components/WCombobox/storyPlays.d.ts +18 -0
  27. package/dist/runtime/components/WCombobox/storyPlays.js +68 -0
  28. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.d.vue.ts → WDarkModeSwitcher/WDarkModeSwitcher.d.vue.ts} +8 -13
  29. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +11 -14
  30. package/dist/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts → WDarkModeSwitcher/WDarkModeSwitcher.vue.d.ts} +8 -13
  31. package/dist/runtime/components/WDatePicker/WDatePicker.d.vue.ts +40 -0
  32. package/dist/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
  33. package/dist/runtime/components/WDatePicker/WDatePicker.vue.d.ts +40 -0
  34. package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +16 -21
  35. package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +16 -21
  36. package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.d.vue.ts → WDatePicker/WTimeZonePicker.d.vue.ts} +1 -11
  37. package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
  38. package/dist/runtime/components/{LibDatePicker/LibTimeZonePicker.vue.d.ts → WDatePicker/WTimeZonePicker.vue.d.ts} +1 -11
  39. package/dist/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +9 -12
  40. package/dist/runtime/components/{LibDevOnly/LibDevOnly.d.vue.ts → WDevOnly/WDevOnly.d.vue.ts} +0 -3
  41. package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue.d.ts → WDevOnly/WDevOnly.vue.d.ts} +0 -3
  42. package/dist/runtime/components/WFileInput/WFileInput.d.vue.ts +58 -0
  43. package/dist/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +71 -57
  44. package/dist/runtime/components/WFileInput/WFileInput.vue.d.ts +58 -0
  45. package/dist/runtime/components/{Icon/Icon.vue.d.ts → WIcon/WIcon.d.vue.ts} +2 -6
  46. package/dist/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +1 -1
  47. package/dist/runtime/components/{Icon/Icon.d.vue.ts → WIcon/WIcon.vue.d.ts} +2 -6
  48. package/dist/runtime/components/{LibMultiValues/LibMultiValues.d.vue.ts → WMultiValues/WMultiValues.d.vue.ts} +8 -14
  49. package/dist/runtime/components/WMultiValues/WMultiValues.vue +149 -0
  50. package/dist/runtime/components/{LibMultiValues/LibMultiValues.vue.d.ts → WMultiValues/WMultiValues.vue.d.ts} +8 -14
  51. package/dist/runtime/components/WNotifications/WNotification.d.vue.ts +37 -0
  52. package/dist/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +38 -50
  53. package/dist/runtime/components/WNotifications/WNotification.vue.d.ts +37 -0
  54. package/dist/runtime/components/WNotifications/WNotifications.d.vue.ts +11 -0
  55. package/dist/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +44 -28
  56. package/dist/runtime/components/WNotifications/WNotifications.vue.d.ts +11 -0
  57. package/dist/runtime/components/WNumberInput/WNumberInput.d.vue.ts +27 -0
  58. package/dist/runtime/components/WNumberInput/WNumberInput.vue +96 -0
  59. package/dist/runtime/components/WNumberInput/WNumberInput.vue.d.ts +27 -0
  60. package/dist/runtime/components/WPagination/WPagination.d.vue.ts +59 -0
  61. package/dist/runtime/components/WPagination/WPagination.vue +182 -0
  62. package/dist/runtime/components/WPagination/WPagination.vue.d.ts +59 -0
  63. package/dist/runtime/components/WPalette/WPalette.d.vue.ts +11 -0
  64. package/dist/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
  65. package/dist/runtime/components/WPalette/WPalette.vue.d.ts +11 -0
  66. package/dist/runtime/components/WPopover/WPopover.d.vue.ts +43 -0
  67. package/dist/runtime/components/WPopover/WPopover.vue +138 -0
  68. package/dist/runtime/components/WPopover/WPopover.vue.d.ts +43 -0
  69. package/dist/runtime/components/WPopup/WPopup.d.vue.ts +41 -0
  70. package/dist/runtime/components/WPopup/WPopup.vue +74 -0
  71. package/dist/runtime/components/WPopup/WPopup.vue.d.ts +41 -0
  72. package/dist/runtime/components/{LibProgressBar/LibProgressBar.d.vue.ts → WProgressBar/WProgressBar.d.vue.ts} +14 -18
  73. package/dist/runtime/components/WProgressBar/WProgressBar.vue +150 -0
  74. package/dist/runtime/components/{LibProgressBar/LibProgressBar.vue.d.ts → WProgressBar/WProgressBar.vue.d.ts} +14 -18
  75. package/dist/runtime/components/{LibRecorder/LibRecorder.d.vue.ts → WRecorder/WRecorder.d.vue.ts} +14 -29
  76. package/dist/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +37 -36
  77. package/dist/runtime/components/{LibRecorder/LibRecorder.vue.d.ts → WRecorder/WRecorder.vue.d.ts} +14 -29
  78. package/dist/runtime/components/{LibRoot/LibRoot.d.vue.ts → WRoot/WRoot.d.vue.ts} +6 -5
  79. package/dist/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +17 -15
  80. package/dist/runtime/components/{LibRoot/LibRoot.vue.d.ts → WRoot/WRoot.vue.d.ts} +6 -5
  81. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.d.vue.ts → WSimpleInput/WSimpleInput.d.vue.ts} +9 -16
  82. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +12 -23
  83. package/dist/runtime/components/{LibSimpleInput/LibSimpleInput.vue.d.ts → WSimpleInput/WSimpleInput.vue.d.ts} +9 -16
  84. package/dist/runtime/components/WTable/WTable.d.vue.ts +102 -0
  85. package/dist/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +13 -14
  86. package/dist/runtime/components/WTable/WTable.vue.d.ts +102 -0
  87. package/dist/runtime/components/WTooltip/WTooltip.d.vue.ts +40 -0
  88. package/dist/runtime/components/WTooltip/WTooltip.vue +111 -0
  89. package/dist/runtime/components/WTooltip/WTooltip.vue.d.ts +40 -0
  90. package/dist/runtime/components/index.d.ts +20 -20
  91. package/dist/runtime/components/index.js +20 -20
  92. package/dist/runtime/composables/index.d.ts +4 -4
  93. package/dist/runtime/composables/index.js +4 -4
  94. package/dist/runtime/composables/useDelayedLoadingIndicator.d.ts +9 -0
  95. package/dist/runtime/composables/useDelayedLoadingIndicator.js +18 -0
  96. package/dist/runtime/composables/useDisplayForReka.d.ts +25 -0
  97. package/dist/runtime/composables/useDisplayForReka.js +16 -0
  98. package/dist/runtime/composables/useFallbackId.d.ts +3 -0
  99. package/dist/runtime/composables/useFallbackId.js +5 -0
  100. package/dist/runtime/composables/useInjectedDarkMode.d.ts +1 -1
  101. package/dist/runtime/composables/usePopupConstrainToStyle.d.ts +8 -0
  102. package/dist/runtime/composables/usePopupConstrainToStyle.js +8 -0
  103. package/dist/runtime/composables/useSetupDarkMode.d.ts +2 -3
  104. package/dist/runtime/composables/useSetupDarkMode.js +90 -4
  105. package/dist/runtime/helpers/NotificationHandler.d.ts +25 -3
  106. package/dist/runtime/helpers/NotificationHandler.js +5 -9
  107. package/dist/runtime/injectionKeys.d.ts +1 -5
  108. package/dist/runtime/injectionKeys.js +0 -2
  109. package/dist/runtime/types/index.d.ts +85 -27
  110. package/dist/runtime/types/index.js +1 -0
  111. package/package.json +43 -43
  112. package/src/runtime/assets/animations.css +5 -5
  113. package/src/runtime/assets/locales/en.json +2 -0
  114. package/src/runtime/assets/utils.css +43 -0
  115. package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
  116. package/src/runtime/components/TestControls/TestControls.vue +3 -3
  117. package/src/runtime/components/WButton/WButton.stories.ts +112 -0
  118. package/src/runtime/components/{LibButton/LibButton.vue → WButton/WButton.vue} +34 -50
  119. package/src/runtime/components/{LibCheckbox/LibCheckbox.stories.ts → WCheckbox/WCheckbox.stories.ts} +5 -5
  120. package/src/runtime/components/WCheckbox/WCheckbox.vue +123 -0
  121. package/src/runtime/components/{LibColorInput/LibColorInput.stories.ts → WColorInput/WColorInput.stories.ts} +8 -8
  122. package/src/runtime/components/WColorInput/WColorInput.vue +112 -0
  123. package/src/runtime/components/WColorInput/WColorSwatchButton.vue +102 -0
  124. package/src/runtime/components/{LibColorPicker/LibColorPicker.stories.ts → WColorPicker/WColorPicker.stories.ts} +12 -12
  125. package/src/runtime/components/{LibColorPicker/LibColorPicker.vue → WColorPicker/WColorPicker.vue} +43 -32
  126. package/src/runtime/components/WCombobox/WCombobox.stories.ts +209 -0
  127. package/src/runtime/components/WCombobox/WCombobox.vue +446 -0
  128. package/src/runtime/components/WCombobox/storyPlays.ts +92 -0
  129. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts → WDarkModeSwitcher/WDarkModeSwitcher.stories.ts} +6 -6
  130. package/src/runtime/components/{LibDarkModeSwitcher/LibDarkModeSwitcher.vue → WDarkModeSwitcher/WDarkModeSwitcher.vue} +19 -30
  131. package/src/runtime/components/{LibDatePicker/LibDatePicker.stories.ts → WDatePicker/WDatePicker.stories.ts} +42 -34
  132. package/src/runtime/components/{LibDatePicker/LibDatePicker.vue → WDatePicker/WDatePicker.vue} +3 -7
  133. package/src/runtime/components/{LibDatePicker/LibRangeDatePicker.vue → WDatePicker/WRangeDatePicker.vue} +16 -22
  134. package/src/runtime/components/{LibDatePicker/LibSingleDatePicker.vue → WDatePicker/WSingleDatePicker.vue} +16 -22
  135. package/src/runtime/components/{LibDatePicker/LibTimeZonePicker.vue → WDatePicker/WTimeZonePicker.vue} +5 -12
  136. package/src/runtime/components/{LibDebug/LibDebug.stories.ts → WDebug/WDebug.stories.ts} +5 -5
  137. package/src/runtime/components/{LibDebug/LibDebug.vue → WDebug/WDebug.vue} +8 -11
  138. package/src/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -4
  139. package/src/runtime/components/{LibFileInput/LibFileInput.stories.ts → WFileInput/WFileInput.stories.ts} +7 -7
  140. package/src/runtime/components/{LibFileInput/LibFileInput.vue → WFileInput/WFileInput.vue} +95 -98
  141. package/src/runtime/components/{Icon/Icon.vue → WIcon/WIcon.vue} +5 -8
  142. package/src/runtime/components/{LibMultiValues/LibMultiValues.stories.ts → WMultiValues/WMultiValues.stories.ts} +9 -9
  143. package/src/runtime/components/WMultiValues/WMultiValues.vue +161 -0
  144. package/src/runtime/components/{LibNotifications/LibNotification.stories.ts → WNotifications/WNotification.stories.ts} +24 -9
  145. package/src/runtime/components/{LibNotifications/LibNotification.vue → WNotifications/WNotification.vue} +46 -66
  146. package/src/runtime/components/WNotifications/WNotifications.stories.ts +139 -0
  147. package/src/runtime/components/{LibNotifications/LibNotifications.vue → WNotifications/WNotifications.vue} +60 -40
  148. package/src/runtime/components/WNumberInput/WNumberInput.vue +109 -0
  149. package/src/runtime/components/WPagination/WPagination.stories.ts +51 -0
  150. package/src/runtime/components/WPagination/WPagination.vue +207 -0
  151. package/src/runtime/components/{LibPalette/LibPalette.stories.ts → WPalette/WPalette.stories.ts} +6 -6
  152. package/src/runtime/components/{LibPalette/LibPalette.vue → WPalette/WPalette.vue} +3 -8
  153. package/src/runtime/components/WPopover/WPopover.stories.ts +218 -0
  154. package/src/runtime/components/WPopover/WPopover.vue +161 -0
  155. package/src/runtime/components/WPopup/WPopup.stories.ts +60 -0
  156. package/src/runtime/components/WPopup/WPopup.vue +93 -0
  157. package/src/runtime/components/WProgressBar/WProgressBar.stories.ts +119 -0
  158. package/src/runtime/components/WProgressBar/WProgressBar.vue +185 -0
  159. package/src/runtime/components/{LibRecorder/LibRecorder.stories.ts → WRecorder/WRecorder.stories.ts} +9 -6
  160. package/src/runtime/components/{LibRecorder/LibRecorder.vue → WRecorder/WRecorder.vue} +69 -68
  161. package/src/runtime/components/{LibRoot/LibRoot.vue → WRoot/WRoot.vue} +18 -15
  162. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.stories.ts → WSimpleInput/WSimpleInput.stories.ts} +11 -12
  163. package/src/runtime/components/{LibSimpleInput/LibSimpleInput.vue → WSimpleInput/WSimpleInput.vue} +27 -44
  164. package/src/runtime/components/{LibTable/LibTable.stories.ts → WTable/WTable.stories.ts} +60 -52
  165. package/src/runtime/components/{LibTable/LibTable.vue → WTable/WTable.vue} +85 -87
  166. package/src/runtime/components/WTooltip/WTooltip.stories.ts +82 -0
  167. package/src/runtime/components/WTooltip/WTooltip.vue +126 -0
  168. package/src/runtime/components/index.ts +20 -20
  169. package/src/runtime/composables/index.ts +4 -4
  170. package/src/runtime/composables/useDelayedLoadingIndicator.ts +30 -0
  171. package/src/runtime/composables/useDisplayForReka.ts +37 -0
  172. package/src/runtime/composables/useFallbackId.ts +6 -0
  173. package/src/runtime/composables/useInjectedDarkMode.ts +1 -2
  174. package/src/runtime/composables/usePopupConstrainToStyle.ts +29 -0
  175. package/src/runtime/composables/useSetupDarkMode.ts +122 -4
  176. package/src/runtime/helpers/NotificationHandler.ts +26 -11
  177. package/src/runtime/injectionKeys.ts +1 -7
  178. package/src/runtime/types/index.ts +105 -32
  179. package/types/components.d.ts +13 -15
  180. package/dist/runtime/components/Aria/Aria.d.vue.ts +0 -6
  181. package/dist/runtime/components/Aria/Aria.vue +0 -16
  182. package/dist/runtime/components/Aria/Aria.vue.d.ts +0 -6
  183. package/dist/runtime/components/LibButton/LibButton.d.vue.ts +0 -37
  184. package/dist/runtime/components/LibButton/LibButton.vue.d.ts +0 -37
  185. package/dist/runtime/components/LibCheckbox/LibCheckbox.d.vue.ts +0 -41
  186. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +0 -103
  187. package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +0 -41
  188. package/dist/runtime/components/LibColorInput/LibColorInput.d.vue.ts +0 -64
  189. package/dist/runtime/components/LibColorInput/LibColorInput.vue +0 -162
  190. package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +0 -64
  191. package/dist/runtime/components/LibDatePicker/LibDatePicker.d.vue.ts +0 -191
  192. package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +0 -191
  193. package/dist/runtime/components/LibFileInput/LibFileInput.d.vue.ts +0 -46
  194. package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +0 -46
  195. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.d.vue.ts +0 -256
  196. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -387
  197. package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +0 -256
  198. package/dist/runtime/components/LibLabel/LibLabel.d.vue.ts +0 -27
  199. package/dist/runtime/components/LibLabel/LibLabel.vue +0 -45
  200. package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -27
  201. package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +0 -109
  202. package/dist/runtime/components/LibNotifications/LibNotification.d.vue.ts +0 -45
  203. package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +0 -45
  204. package/dist/runtime/components/LibNotifications/LibNotifications.d.vue.ts +0 -15
  205. package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +0 -15
  206. package/dist/runtime/components/LibPagination/LibPagination.d.vue.ts +0 -105
  207. package/dist/runtime/components/LibPagination/LibPagination.vue +0 -229
  208. package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +0 -105
  209. package/dist/runtime/components/LibPalette/LibPalette.d.vue.ts +0 -15
  210. package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +0 -15
  211. package/dist/runtime/components/LibPopup/LibPopup.d.vue.ts +0 -52
  212. package/dist/runtime/components/LibPopup/LibPopup.vue +0 -365
  213. package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +0 -52
  214. package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +0 -169
  215. package/dist/runtime/components/LibSuggestions/LibSuggestions.d.vue.ts +0 -99
  216. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +0 -178
  217. package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +0 -99
  218. package/dist/runtime/components/LibTable/LibTable.d.vue.ts +0 -125
  219. package/dist/runtime/components/LibTable/LibTable.vue.d.ts +0 -125
  220. package/dist/runtime/components/Template/NAME.d.vue.ts +0 -18
  221. package/dist/runtime/components/Template/NAME.vue +0 -27
  222. package/dist/runtime/components/Template/NAME.vue.d.ts +0 -18
  223. package/dist/runtime/components/Template/TemplateStory.d.ts +0 -7
  224. package/dist/runtime/components/Template/TemplateStory.js +0 -22
  225. package/dist/runtime/components/shared/props.d.ts +0 -171
  226. package/dist/runtime/components/shared/props.js +0 -2
  227. package/dist/runtime/composables/useAriaLabel.d.ts +0 -6
  228. package/dist/runtime/composables/useAriaLabel.js +0 -15
  229. package/dist/runtime/composables/useDarkMode.d.ts +0 -77
  230. package/dist/runtime/composables/useDarkMode.js +0 -89
  231. package/dist/runtime/composables/useDivideAttrs.d.ts +0 -27
  232. package/dist/runtime/composables/useDivideAttrs.js +0 -27
  233. package/dist/runtime/composables/useSuggestions.d.ts +0 -40
  234. package/dist/runtime/composables/useSuggestions.js +0 -263
  235. package/src/runtime/components/Aria/Aria.vue +0 -26
  236. package/src/runtime/components/LibButton/LibButton.stories.ts +0 -106
  237. package/src/runtime/components/LibCheckbox/LibCheckbox.vue +0 -131
  238. package/src/runtime/components/LibColorInput/LibColorInput.vue +0 -203
  239. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.stories.ts +0 -405
  240. package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +0 -419
  241. package/src/runtime/components/LibLabel/LibLabel.stories.ts +0 -33
  242. package/src/runtime/components/LibLabel/LibLabel.vue +0 -65
  243. package/src/runtime/components/LibMultiValues/LibMultiValues.vue +0 -123
  244. package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +0 -127
  245. package/src/runtime/components/LibPagination/LibPagination.stories.ts +0 -49
  246. package/src/runtime/components/LibPagination/LibPagination.vue +0 -274
  247. package/src/runtime/components/LibPopup/LibPopup.stories.ts +0 -153
  248. package/src/runtime/components/LibPopup/LibPopup.vue +0 -396
  249. package/src/runtime/components/LibProgressBar/LibProgressBar.stories.ts +0 -90
  250. package/src/runtime/components/LibProgressBar/LibProgressBar.vue +0 -197
  251. package/src/runtime/components/LibSuggestions/LibSuggestions.stories.ts +0 -134
  252. package/src/runtime/components/LibSuggestions/LibSuggestions.vue +0 -212
  253. package/src/runtime/components/Template/NAME.vue +0 -49
  254. package/src/runtime/components/Template/TemplateStory.ts +0 -37
  255. package/src/runtime/components/shared/props.ts +0 -199
  256. package/src/runtime/composables/useAriaLabel.ts +0 -23
  257. package/src/runtime/composables/useDarkMode.ts +0 -199
  258. package/src/runtime/composables/useDivideAttrs.ts +0 -53
  259. package/src/runtime/composables/useSuggestions.ts +0 -339
  260. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.d.ts +0 -0
  261. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.js +0 -0
  262. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.d.ts +0 -0
  263. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.js +0 -0
  264. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.d.ts +0 -0
  265. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.js +0 -0
  266. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.d.ts +0 -0
  267. /package/dist/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.js +0 -0
  268. /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.d.vue.ts → WDatePicker/WRangeDatePicker.d.vue.ts} +0 -0
  269. /package/dist/runtime/components/{LibDatePicker/LibRangeDatePicker.vue.d.ts → WDatePicker/WRangeDatePicker.vue.d.ts} +0 -0
  270. /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.d.vue.ts → WDatePicker/WSingleDatePicker.d.vue.ts} +0 -0
  271. /package/dist/runtime/components/{LibDatePicker/LibSingleDatePicker.vue.d.ts → WDatePicker/WSingleDatePicker.vue.d.ts} +0 -0
  272. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.d.ts +0 -0
  273. /package/dist/runtime/components/{LibDatePicker → WDatePicker}/helpers.js +0 -0
  274. /package/dist/runtime/components/{LibDebug/LibDebug.d.vue.ts → WDebug/WDebug.d.vue.ts} +0 -0
  275. /package/dist/runtime/components/{LibDebug/LibDebug.vue.d.ts → WDebug/WDebug.vue.d.ts} +0 -0
  276. /package/dist/runtime/components/{LibDevOnly/LibDevOnly.vue → WDevOnly/WDevOnly.vue} +0 -0
  277. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.d.vue.ts → WNotifications/WNotificationTestMessageComponent.d.vue.ts} +0 -0
  278. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
  279. /package/dist/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue.d.ts → WNotifications/WNotificationTestMessageComponent.vue.d.ts} +0 -0
  280. /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.d.ts +0 -0
  281. /package/dist/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.js +0 -0
  282. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToHsva.ts +0 -0
  283. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/safeConvertToRgba.ts +0 -0
  284. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/toLowPrecisionRgbaString.ts +0 -0
  285. /package/src/runtime/components/{LibColorPicker → WColorPicker}/utils/truncate.ts +0 -0
  286. /package/src/runtime/components/{LibDatePicker → WDatePicker}/helpers.ts +0 -0
  287. /package/src/runtime/components/{LibNotifications/LibNotificationTestMessageComponent.vue → WNotifications/WNotificationTestMessageComponent.vue} +0 -0
  288. /package/src/runtime/components/{LibNotifications → WNotifications}/calculateNotificationProgress.ts +0 -0
@@ -1,419 +0,0 @@
1
- <template>
2
- <div
3
- :class="twMerge(`input--outer-wrapper
4
- grow
5
- flex
6
- flex-wrap
7
- `,
8
- disabled && `
9
- text-neutral-400
10
- dark:text-neutral-600
11
- `,
12
- ($.wrapperAttrs as any)?.class
13
- )"
14
- tabindex="-1"
15
- v-bind="{ ...$.wrapperAttrs, class: undefined }"
16
- ref="inputWrapperEl"
17
- >
18
- <slot
19
- name="label"
20
- v-bind="{ ...slotProps, label }"
21
- >
22
- <lib-label
23
- v-if="label || $slots.default"
24
- :id="id ?? fallbackId"
25
- :disabled="disabled"
26
- :readonly="readonly"
27
- :valid="valid"
28
- class="input--label"
29
- >
30
- <slot v-bind="slotProps">
31
- {{ label }}
32
- </slot>
33
- </lib-label>
34
- <!-- Allow blurring when clicking the blank part of a label. -->
35
- <div class="input--label-spacer flex-1"/>
36
- </slot>
37
- <!-- These are mostly copies of the classes on LibSimpleInput except made to work with disabled/readonly/etc manually since a div cannot have these states. -->
38
- <div
39
- :data-border="border"
40
- :data-invalid="!valid"
41
- :data-disabled="disabled"
42
- :data-read-only="readonly"
43
- :data-is-open="isOpen"
44
- v-bind="{ ...$['inner-wrapperAttrs'], class: undefined }"
45
- :class="twMerge(`input--inner-wrapper
46
- relative
47
- flex
48
- flex-1
49
- basis-[100%]
50
- flex-wrap
51
- rounded-sm
52
- gap-2
53
- px-2
54
- `,
55
- border && `
56
- bg-inherit
57
- border
58
- border-neutral-500
59
- outlined-within:border-accent-500
60
- has-[input:invalid]:border-danger-700
61
- has-[input:invalid]:dark:border-danger-600
62
- `,
63
- border && !valid && `
64
- border-danger-700
65
- dark:border-danger-600
66
- `,
67
- isOpen && `rounded-b-none`,
68
- !valid && `
69
- outlined:!outline-danger-700
70
- text-danger-800
71
- dark:text-danger-400
72
- `,
73
- `
74
- has-[input:invalid]:outline-danger-700
75
- has-[input:invalid]:text-danger-800
76
- has-[input:invalid]:dark:text-danger-400
77
- `,
78
- readonly && `
79
- bg-neutral-50
80
- text-neutral-800
81
- dark:bg-neutral-950
82
- dark:text-neutral-200
83
- `,
84
- disabled && `
85
- bg-neutral-50
86
- text-neutral-400
87
- dark:border-neutral-600
88
- border-neutral-400
89
- `,
90
- ($['inner-wrapperAttrs'] as any)?.class
91
- )"
92
- >
93
- <slot
94
- name="left"
95
- v-bind="slotProps"
96
- />
97
- <slot
98
- name="input"
99
- v-bind="{ ...inputProps, ...slotProps, suggestionsIndicatorClickHandler }"
100
- >
101
- <lib-simple-input
102
- :class="twMerge(
103
- `input--input p-0`,
104
- !$slots.left && `-ml-2 pl-2`,
105
- !$slots.right && (!$values || $values.length === 0) && !suggestions && `-mr-2 -pr-2`,
106
- ($.attrs as any)?.class
107
- )"
108
- v-bind="inputProps"
109
- />
110
- </slot>
111
- <slot
112
- name="indicator"
113
- v-bind="{ isOpen, suggestionsIndicatorClickHandler }"
114
- >
115
- <!-- todo, convert to button for accessibility ? -->
116
- <div
117
- v-if="suggestions"
118
- :data-is-open="isOpen"
119
- :class="twMerge(`input--indicator flex flex-col justify-center`)"
120
- @click="suggestionsIndicatorClickHandler"
121
- >
122
- <icon :class="isOpen && `rotate-180`">
123
- <i-fa6-solid-chevron-up/>
124
- </icon>
125
- </div>
126
- </slot>
127
- <slot
128
- name="values"
129
- v-bind="{ ...multivaluesProps, ...slotProps }"
130
- >
131
- <template v-if="$values && $values.length > 0">
132
- <lib-multi-values
133
- :class="twMerge(`
134
- input--multivalues
135
- grow-[9000]
136
- justify-space-between
137
- py-1
138
- `,
139
- !$slots.right && `-mr-1`,
140
- ($.multivaluesAttrs as any)?.class
141
- )"
142
- v-bind="multivaluesProps"
143
- />
144
- </template>
145
- </slot>
146
- <slot
147
- name="right"
148
- v-bind="slotProps"
149
- />
150
-
151
- <slot
152
- v-if="suggestions"
153
- name="suggestions"
154
- v-bind="{ ...suggestionProps, ...slotProps }"
155
- >
156
- <!-- todo 1px needs to be abstracted to var -->
157
- <lib-suggestions
158
- :class="twMerge(`
159
- input--suggestions
160
- absolute
161
- -inset-x-px
162
- z-10
163
- rounded-b-sm
164
- border-accent-500
165
- border
166
- top-full
167
- `,
168
- !border && `
169
- rounded-sm
170
- `,
171
- ($.suggestionsAttrs as any)?.class
172
- )"
173
- ref="suggestionsComponent"
174
- v-bind="suggestionProps"
175
- >
176
- <template #item="itemSlotProps">
177
- <slot
178
- name="suggestion-item"
179
- v-bind="itemSlotProps"
180
- />
181
- </template>
182
- </lib-suggestions>
183
- </slot>
184
- </div>
185
- </div>
186
- </template>
187
-
188
- <script setup lang="ts">
189
- import { isBlank } from "@alanscodelog/utils/isBlank"
190
- import { pushIfNotIn } from "@alanscodelog/utils/pushIfNotIn"
191
- import { computed, type HTMLAttributes, type InputHTMLAttributes, nextTick, ref, toRef, useSlots, watch } from "vue"
192
- import type { ComponentExposed } from "vue-component-type-helpers"
193
-
194
- import IFa6SolidChevronUp from "~icons/fa6-solid/chevron-up"
195
-
196
- import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
197
- import { useSuggestionsInputAria } from "../../composables/useSuggestions.js"
198
- import { twMerge } from "../../utils/twMerge.js"
199
- import Icon from "../Icon/Icon.vue"
200
- import LibLabel from "../LibLabel/LibLabel.vue"
201
- import LibMultiValues from "../LibMultiValues/LibMultiValues.vue"
202
- import LibSimpleInput from "../LibSimpleInput/LibSimpleInput.vue"
203
- import LibSuggestions from "../LibSuggestions/LibSuggestions.vue"
204
- import { type BaseInteractiveProps, getFallbackId, type LabelProps, type LinkableByIdProps, type SuggestionsProps, type TailwindClassProp, type WrapperProps } from "../shared/props.js"
205
-
206
- /* #region base */
207
- defineOptions({
208
- name: "LibSimpleInputDeprecated",
209
- inheritAttrs: false
210
- })
211
- const $slots = useSlots()
212
- const emit = defineEmits<{
213
- (e: "input", val: InputEvent): void
214
- (e: "submit", val: string, suggestion?: any): void
215
- (e: "keydown", val: KeyboardEvent): void
216
- (e: "blur", val: FocusEvent): void
217
- (e: "focus", val: FocusEvent): void
218
- (e: "indicatorClick", val: MouseEvent): void
219
- }>()
220
-
221
- const fallbackId = getFallbackId()
222
-
223
- const props = withDefaults(defineProps<Props>(), {
224
- valid: true,
225
- suggestions: undefined,
226
- updateOnlyOnSubmit: false,
227
- unstyle: false, disabled: false, readonly: false, border: true
228
- })
229
-
230
- const $ = useDivideAttrs(["wrapper", "inner-wrapper", "suggestions", "multivalues"] as const)
231
-
232
- const $values = defineModel<string[] | undefined>("values", { default: undefined })
233
- const $modelValue = defineModel<string>({ required: true })
234
-
235
- const fullId = computed(() => props.id ?? fallbackId)
236
-
237
- const $inputValue = defineModel<string>("inputValue", { default: "" })
238
- $inputValue.value = $modelValue.value ?? ""
239
-
240
- const canEdit = computed(() => !props.disabled && !props.readonly)
241
- const suggestionsComponent = ref<ComponentExposed<typeof LibSuggestions> | null>(null)
242
- const activeSuggestion = ref(0)
243
- watch($modelValue, () => {
244
- $inputValue.value = $modelValue.value
245
- })
246
- const inputWrapperEl = ref<HTMLElement | null>(null)
247
- const isOpen = ref(false)
248
-
249
- const suggestionsIndicatorClickHandler = (e: MouseEvent) => {
250
- nextTick(() => {
251
- if (props.suggestions) {
252
- (suggestionsComponent.value as any)?.suggestions.toggle()
253
- }
254
- })
255
- emit("indicatorClick", e)
256
- }
257
-
258
- const handleKeydown = (e: KeyboardEvent) => {
259
- if (props.suggestions) {
260
- if (e.key === "Enter" && activeSuggestion.value === -1 && $values.value) {
261
- pushIfNotIn($values.value, [$inputValue.value])
262
- $inputValue.value = ""
263
- $modelValue.value = ""
264
- } else {
265
- (suggestionsComponent.value as any)?.inputKeydownHandler?.(e)
266
- if ($values.value) {
267
- $modelValue.value = ""
268
- }
269
- }
270
- }
271
- emit("keydown", e)
272
- }
273
- const handleBlur = (e: FocusEvent) => {
274
- if (props.suggestions) {
275
- (suggestionsComponent.value as any)?.inputBlurHandler?.(e)
276
- }
277
- emit("blur", e)
278
- }
279
- const handleFocus = (e: FocusEvent) => {
280
- if (props.suggestions) {
281
- (suggestionsComponent.value as any)?.inputFocusHandler?.(e)
282
- }
283
- emit("focus", e)
284
- }
285
-
286
- function addValue(val: string) {
287
- if ($values.value === undefined) return
288
- if (isBlank(val)) return
289
- pushIfNotIn($values.value, [val])
290
- $inputValue.value = ""
291
- $modelValue.value = ""
292
- }
293
- const suggestions = toRef(props, "suggestions")
294
- const inputAriaProps = useSuggestionsInputAria(
295
- fullId,
296
- isOpen,
297
- activeSuggestion,
298
- suggestions
299
- )
300
- const inputProps = computed(() => ({
301
- id: fullId.value,
302
- border: false,
303
- disabled: props.disabled,
304
- readonly: props.readonly,
305
- isValid: props.valid,
306
- onKeydown: handleKeydown,
307
- onBlur: handleBlur,
308
- onFocus: handleFocus,
309
- modelValue: $inputValue.value,
310
- // eslint-disable-next-line @typescript-eslint/naming-convention
311
- "onUpdate:modelValue": (e: string) => {
312
- $inputValue.value = e
313
- if (!props.suggestions && !props.updateOnlyOnSubmit && !props.restrictToSuggestions) {
314
- $modelValue.value = e
315
- }
316
- },
317
- onSubmit: (e: string) => {
318
- if (!props.suggestions) {
319
- $modelValue.value = $values.value ? "" : e
320
- emit("submit", e)
321
- if ($values.value) {
322
- addValue(e)
323
- }
324
- }
325
- },
326
- ...inputAriaProps.value,
327
- canEdit: canEdit.value,
328
- ...$.value.attrs,
329
- class: undefined
330
- }))
331
-
332
- function slotSubmit(val: any, _wasRemoved: boolean): void {
333
- emit("submit", val)
334
- }
335
- const slotProps = computed(() => ({
336
- id: fullId.value,
337
- isOpen: isOpen.value,
338
- valid: props.valid,
339
- disabled: props.disabled,
340
- readonly: props.readonly,
341
- emitSubmit: slotSubmit
342
- }))
343
-
344
- const suggestionProps = computed(() => ({
345
- id: fullId.value,
346
- suggestions: props.suggestions,
347
- allowOpenEmpty: props.allowOpenEmpty,
348
- restrictToSuggestions: props.restrictToSuggestions,
349
- suggestionLabel: props.suggestionLabel,
350
- suggestionsFilter: props.suggestionsFilter,
351
- modelValue: $values.value ?? $modelValue.value.toString(),
352
- inputValue: $inputValue.value,
353
- isValid: props.isValid,
354
- // eslint-disable-next-line @typescript-eslint/naming-convention
355
- "onUpdate:inputValue": (e: string) => $inputValue.value = e,
356
- onSubmit: (e: string, suggestion?: any, wasRemoved?: boolean) => {
357
- $modelValue.value = wasRemoved ? "" : e
358
- emit("submit", e, suggestion)
359
- },
360
- // eslint-disable-next-line @typescript-eslint/naming-convention
361
- "onUpdate:modelValue": (e: string | string[]) => {
362
- $values.value &&= e as string[]
363
- },
364
- // eslint-disable-next-line @typescript-eslint/naming-convention
365
- "onUpdate:isOpen": (e: boolean) => { isOpen.value = e },
366
- // eslint-disable-next-line @typescript-eslint/naming-convention
367
- "onUpdate:activeSuggestion": (e: number) => activeSuggestion.value = e,
368
- ...$.value.suggestionsAttrs,
369
- class: undefined
370
- }))
371
-
372
- const multivaluesProps = computed(() => ({
373
- hasSlotRight: !$slots.right,
374
- label: props.label,
375
- border: props.border,
376
- disabled: props.disabled,
377
- readonly: props.readonly,
378
- modelValue: $values.value,
379
- // eslint-disable-next-line @typescript-eslint/naming-convention
380
- "onUpdate:modelValue": (e: string[]) => $values.value = e,
381
- ...$.value.multivaluesAttrs,
382
- class: undefined
383
- }))
384
-
385
- defineExpose({
386
- suggestionsComponent,
387
- el: inputWrapperEl
388
- })
389
- </script>
390
-
391
- <script lang="ts">
392
- type WrapperTypes
393
- = & WrapperProps<"suggestions", HTMLAttributes>
394
- & WrapperProps<"wrapper", HTMLAttributes>
395
- & WrapperProps<"inner-wrapper", HTMLAttributes>
396
-
397
- type RealProps
398
- = SuggestionsProps
399
- & LinkableByIdProps
400
- & LabelProps
401
- & BaseInteractiveProps
402
- & {
403
- suggestions?: SuggestionsProps["suggestions"]
404
- valid?: boolean
405
- }
406
-
407
- interface Props
408
- extends
409
- /** @vue-ignore */
410
- Partial<Omit<
411
- InputHTMLAttributes,
412
- "class" | "readonly" | "disabled" | "onSubmit"
413
- // https://github.com/vuejs/core/pull/14237
414
- | "autocomplete"
415
- > & TailwindClassProp>,
416
- /** @vue-ignore */
417
- Partial<WrapperTypes>,
418
- RealProps { }
419
- </script>
@@ -1,33 +0,0 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
- import type { Meta, StoryObj } from "@storybook/vue3"
3
-
4
- import Label from "./LibLabel.vue"
5
-
6
- import * as components from "../index.js"
7
-
8
- const meta: Meta<typeof Label> = {
9
- component: Label,
10
- title: "Components/Label",
11
- args: {
12
- slot: "label"
13
- }
14
- }
15
-
16
- export default meta
17
- type Story = StoryObj<typeof Label>
18
-
19
- export const Primary: Story = {
20
- render: args => ({
21
- components,
22
- setup: () => ({ args }),
23
- template: `
24
- <lib-label v-bind="args">{{args.slot}}</lib-label>
25
- <br/>
26
- In flex col with input:
27
- <div class="flex flex-col">
28
- <lib-label v-bind="args">{{args.slot}}</lib-label>
29
- <lib-simple-input modelValue="some input"></lib-simple-input>
30
- </div>
31
- `
32
- })
33
- }
@@ -1,65 +0,0 @@
1
- <template>
2
- <!-- we use data-disabled because labels have no disabled property technically -->
3
- <label
4
- :id="`label-${id ?? fallbackId}`"
5
- :class="!($attrs as any).unstyle && twMerge(`
6
- pr-0
7
- text-sm
8
- `,
9
- !valid && `text-danger-700`,
10
- ($attrs as any)?.class
11
- )"
12
- :data-disabled="disabled"
13
- :data-invalid="!valid"
14
- :for="id"
15
- v-bind="{ ...$attrs, class: undefined }"
16
- >
17
- <slot/>
18
- </label>
19
- </template>
20
-
21
- <script setup lang="ts">
22
- import { useAttrs } from "vue"
23
-
24
- import { twMerge } from "../../utils/twMerge.js"
25
- import { getFallbackId } from "../shared/props.js"
26
-
27
- defineOptions({
28
- name: "LibLabel"
29
- })
30
-
31
- const fallbackId = getFallbackId()
32
-
33
- withDefaults(defineProps<Props>(), {
34
- id: "",
35
- valid: true,
36
- unstyle: false, disabled: false, readonly: false, border: true
37
- })
38
-
39
- const $attrs = useAttrs()
40
- </script>
41
-
42
- <script lang="ts">
43
- import type { LabelHTMLAttributes } from "vue"
44
- import type { BaseInteractiveProps, LabelProps, LinkableByIdProps, TailwindClassProp } from "../shared/props.js"
45
-
46
- type RealProps =
47
- & LinkableByIdProps
48
- & LabelProps
49
- & BaseInteractiveProps
50
- & {
51
- unstyled?: boolean
52
- valid?: boolean
53
- }
54
-
55
- interface Props
56
- extends
57
- /** @vue-ignore */
58
- Partial<Omit<LabelHTMLAttributes,"class"> & TailwindClassProp>,
59
- RealProps
60
- { }
61
- </script>
62
-
63
- <script lang="ts">
64
-
65
- </script>
@@ -1,123 +0,0 @@
1
- <template>
2
- <div
3
- v-if="$modelValue && $modelValue?.length > 0"
4
- :class="twMerge(`
5
- multivalues
6
- group
7
- flex
8
- flex-initial
9
- items-center
10
- justify-center
11
- gap-1
12
- overflow-x-scroll
13
- scrollbar-hidden
14
- `,
15
- ($.attrs as any)?.class)
16
- "
17
- :data-disabled="disabled"
18
- :data-read-only="readonly"
19
- :aria-label="`Values for ${label}`"
20
- :tabindex="disabled ? -1 : 0"
21
- v-bind="{ ...$.attrs, class: undefined }"
22
- >
23
- <div
24
- :data-border="border"
25
- :class="twMerge(`
26
- multivalues--item
27
- flex-basis-0
28
- min-w-2
29
- flex
30
- max-w-fit
31
- flex-1
32
- items-center
33
- gap-0.5
34
- overflow-hidden
35
- px-1
36
- text-xs
37
- leading-none`,
38
- !(disabled || readonly) && `
39
- group-focus:text-accent-500
40
- focus:text-accent-500`,
41
- border && `
42
- rounded-sm
43
- border-neutral-400
44
- border
45
- focus:border-accent-400
46
- `,
47
- border && (disabled || readonly) && `
48
- border-neutral-200
49
- focus:border-neutral-200
50
- dark:border-neutral-800
51
- dark:focus:border-neutral-800
52
- `,
53
- ($.itemAttrs as any)?.class
54
- )"
55
- :tabindex="canEdit ? 0 : undefined"
56
- v-for="(value) of $modelValue"
57
- :key="value"
58
- @keydown.ctrl.c.prevent="copy(value.toString())"
59
- >
60
- <span class="multivalues--label truncate">{{ value }}</span>
61
- <lib-button
62
- class="multivalues--remove-button !p-0 text-sm !leading-none"
63
- :aria-label="`Remove ${value}`"
64
- :border="false"
65
- :disabled="disabled || readonly"
66
- @click="removeVal(value)"
67
- >
68
- <icon><i-fa6-solid-xmark/></icon>
69
- </lib-button>
70
- </div>
71
- </div>
72
- </template>
73
-
74
- <script setup lang="ts" generic="T extends string | number">
75
- import { removeIfIn } from "@alanscodelog/utils/removeIfIn"
76
- import { computed, type HTMLAttributes } from "vue"
77
-
78
- import IFa6SolidXmark from "~icons/fa6-solid/xmark"
79
-
80
- import { useDivideAttrs } from "../../composables/useDivideAttrs.js"
81
- import { copy } from "../../helpers/copy.js"
82
- import { twMerge } from "../../utils/twMerge.js"
83
- import Icon from "../Icon/Icon.vue"
84
- import LibButton from "../LibButton/LibButton.vue"
85
- import type { BaseInteractiveProps, LabelProps, TailwindClassProp, WrapperProps } from "../shared/props.js"
86
-
87
- defineOptions({
88
- name: "LibMultiValues",
89
- inheritAttrs: false
90
- })
91
-
92
- const $ = useDivideAttrs(["item"] as const)
93
- const props = withDefaults(defineProps<Props>(), {
94
- unstyle: false, disabled: false, readonly: false, border: true
95
- })
96
-
97
- const canEdit = computed(() => !props.disabled && !props.readonly)
98
- const $modelValue = defineModel<T[]>({ default: () => [] })
99
-
100
- const removeVal = (value: T) => {
101
- if (!canEdit.value) return
102
- removeIfIn($modelValue.value, value)
103
- }
104
- </script>
105
-
106
- <script lang="ts">
107
- type WrapperTypes = Partial<WrapperProps<"item", HTMLAttributes>>
108
-
109
- type RealProps
110
- = & LabelProps
111
- & BaseInteractiveProps
112
- & {
113
- border?: boolean
114
- }
115
- interface Props
116
- extends
117
- /** @vue-ignore */
118
- Partial<Omit<HTMLAttributes, "class"> & TailwindClassProp>,
119
- /** @vue-ignore */
120
- WrapperTypes,
121
- RealProps
122
- {}
123
- </script>