@autoafleveren/ui 1.3.2 → 1.3.3

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 (315) hide show
  1. package/dist/config/tailwind/config.cjs +1 -0
  2. package/dist/icons.cjs +17 -17
  3. package/dist/icons.js +1710 -1644
  4. package/dist/types/composables/index.d.ts +1 -1
  5. package/dist/types/composables/useActionBar/index.d.ts +3 -3
  6. package/dist/ui.cjs +36 -36
  7. package/dist/ui.js +6766 -6696
  8. package/package.json +3 -2
  9. package/src/App.vue +15 -0
  10. package/src/Playground.vue.example +9 -0
  11. package/src/config/eslint.cjs +199 -0
  12. package/src/config/tailwind/config.cjs +229 -0
  13. package/src/config/tailwind/screens.json +9 -0
  14. package/src/css/build.css +52 -0
  15. package/src/css/main.css +4 -0
  16. package/src/css/theme.css +208 -0
  17. package/src/css/tinymce.css +58 -0
  18. package/src/main.ts +34 -0
  19. package/src/modules/components/AppActionBar/AppActionBar.vue +96 -0
  20. package/src/modules/components/AppActionBar/AppActionBarItem.vue +123 -0
  21. package/src/modules/components/AppActionBar/AppActionBarSubMenu.vue +89 -0
  22. package/src/modules/components/AppActionBar/Components/Error.vue +11 -0
  23. package/src/modules/components/AppActionBar/Components/Loading.vue +9 -0
  24. package/src/modules/components/AppActionBar/Components/MultiSelect.vue +102 -0
  25. package/src/modules/components/AppActionBar/Components/__tests__/multi-select.spec.ts +74 -0
  26. package/src/modules/components/AppActionBar/__mocks__/index.ts +36 -0
  27. package/src/modules/components/AppActionBar/__tests__/app-action-bar-item.spec.ts +134 -0
  28. package/src/modules/components/AppActionBar/__tests__/app-action-bar-sub-menu.spec.ts +45 -0
  29. package/src/modules/components/AppActionBar/__tests__/app-action-bar.spec.ts +92 -0
  30. package/src/modules/components/AppActionBar/index.d.ts +29 -0
  31. package/src/modules/components/AppActionBar/index.ts +18 -0
  32. package/src/modules/components/AppAlert/AppAlert.vue +69 -0
  33. package/src/modules/components/AppAlert/__tests__/app-alert.spec.ts +67 -0
  34. package/src/modules/components/AppAlert/index.d.ts +3 -0
  35. package/src/modules/components/AppAlert/index.ts +18 -0
  36. package/src/modules/components/AppAvatar/AppAvatar.vue +30 -0
  37. package/src/modules/components/AppAvatar/DefaultAvatar.vue +187 -0
  38. package/src/modules/components/AppAvatar/__tests__/app-avatar.spec.ts +70 -0
  39. package/src/modules/components/AppAvatar/index.d.ts +9 -0
  40. package/src/modules/components/AppAvatar/index.ts +9 -0
  41. package/src/modules/components/AppBackButton/AppBackButton.vue +51 -0
  42. package/src/modules/components/AppBackButton/__tests__/app-back-button.spec.ts +70 -0
  43. package/src/modules/components/AppBadge/AppBadge.vue +65 -0
  44. package/src/modules/components/AppBadge/__tests__/app-badge.spec.ts +64 -0
  45. package/src/modules/components/AppBadge/index.d.ts +13 -0
  46. package/src/modules/components/AppBadge/index.ts +29 -0
  47. package/src/modules/components/AppButton/AppButton.vue +53 -0
  48. package/src/modules/components/AppButton/ButtonIconSlot.vue +26 -0
  49. package/src/modules/components/AppButton/__tests__/app-button.spec.ts +145 -0
  50. package/src/modules/components/AppButton/__tests__/button-icon-slot.spec.ts +30 -0
  51. package/src/modules/components/AppButton/index.d.ts +16 -0
  52. package/src/modules/components/AppButton/index.ts +57 -0
  53. package/src/modules/components/AppCard/AppCard.vue +88 -0
  54. package/src/modules/components/AppCard/CardAction.vue +101 -0
  55. package/src/modules/components/AppCard/CardIconSlot.vue +65 -0
  56. package/src/modules/components/AppCard/__tests__/app-card.spec.ts +109 -0
  57. package/src/modules/components/AppCard/__tests__/card-action.spec.ts +55 -0
  58. package/src/modules/components/AppCard/__tests__/card-icon-slot.spec.ts +27 -0
  59. package/src/modules/components/AppCard/index.d.ts +12 -0
  60. package/src/modules/components/AppCard/index.ts +5 -0
  61. package/src/modules/components/AppColor/AppColor.vue +74 -0
  62. package/src/modules/components/AppColor/__tests__/app-color.spec.ts +53 -0
  63. package/src/modules/components/AppColor/index.d.ts +10 -0
  64. package/src/modules/components/AppColorCard/AppColorCard.vue +41 -0
  65. package/src/modules/components/AppColorCard/__tests__/app-color-card.spec.ts +55 -0
  66. package/src/modules/components/AppConfirm/AppConfirm.vue +237 -0
  67. package/src/modules/components/AppConfirm/__tests__/app-confirm.spec.ts +366 -0
  68. package/src/modules/components/AppConfirm/index.d.ts +31 -0
  69. package/src/modules/components/AppConfirm/index.ts +1 -0
  70. package/src/modules/components/AppContextMenu/AppContextMenu.vue +100 -0
  71. package/src/modules/components/AppContextMenu/ShortcutItem.vue +37 -0
  72. package/src/modules/components/AppContextMenu/__mocks__/index.ts +25 -0
  73. package/src/modules/components/AppContextMenu/__tests__/app-context-menu.spec.ts +71 -0
  74. package/src/modules/components/AppContextMenu/__tests__/shortcut-item.spec.ts +29 -0
  75. package/src/modules/components/AppContextMenu/index.d.ts +23 -0
  76. package/src/modules/components/AppDataTable/AppDataTable.vue +323 -0
  77. package/src/modules/components/AppDataTable/AppDataTableFooter.vue +91 -0
  78. package/src/modules/components/AppDataTable/__mocks__/index.ts +71 -0
  79. package/src/modules/components/AppDataTable/__tests__/app-data-table-footer.spec.ts +107 -0
  80. package/src/modules/components/AppDataTable/__tests__/app-data-table.spec.ts +153 -0
  81. package/src/modules/components/AppDataTable/index.d.ts +29 -0
  82. package/src/modules/components/AppDefinitionList/AppDefinitionItem.vue +57 -0
  83. package/src/modules/components/AppDefinitionList/AppDefinitionList.vue +31 -0
  84. package/src/modules/components/AppDefinitionList/__mocks__/index.ts +31 -0
  85. package/src/modules/components/AppDefinitionList/__tests__/app-definition-item.spec.ts +93 -0
  86. package/src/modules/components/AppDefinitionList/__tests__/app-definition-list.spec.ts +35 -0
  87. package/src/modules/components/AppDefinitionList/index.d.ts +8 -0
  88. package/src/modules/components/AppDisclosure/AppDisclosure.vue +19 -0
  89. package/src/modules/components/AppDisclosure/AppDisclosureButton.vue +43 -0
  90. package/src/modules/components/AppDisclosure/AppDisclosurePanel.vue +31 -0
  91. package/src/modules/components/AppDisclosure/__tests__/app-disclosure-button.spec.ts +70 -0
  92. package/src/modules/components/AppDisclosure/__tests__/app-disclosure-panel.spec.ts +64 -0
  93. package/src/modules/components/AppDisclosure/__tests__/app-disclosure.spec.ts +41 -0
  94. package/src/modules/components/AppDrawer/AppDrawer.vue +149 -0
  95. package/src/modules/components/AppDrawer/__tests__/app-drawer.spec.ts +120 -0
  96. package/src/modules/components/AppDrawer/index.d.ts +27 -0
  97. package/src/modules/components/AppDropdownButton/AppDropdownButton.vue +82 -0
  98. package/src/modules/components/AppDropdownButton/AppDropdownItem.vue +67 -0
  99. package/src/modules/components/AppDropdownButton/__mocks__/index.ts +25 -0
  100. package/src/modules/components/AppDropdownButton/__tests__/app-dropdown-button.spec.ts +81 -0
  101. package/src/modules/components/AppDropdownButton/__tests__/app-dropdown-item.spec.ts +108 -0
  102. package/src/modules/components/AppDropdownButton/index.d.ts +26 -0
  103. package/src/modules/components/AppDropdownButton/index.ts +8 -0
  104. package/src/modules/components/AppError/AppError.vue +233 -0
  105. package/src/modules/components/AppError/__tests__/app-error.spec.ts +366 -0
  106. package/src/modules/components/AppError/index.d.ts +30 -0
  107. package/src/modules/components/AppError/index.ts +1 -0
  108. package/src/modules/components/AppImageDropzone/AppImageDropzone.vue +130 -0
  109. package/src/modules/components/AppImageDropzone/__tests__/app-image-dropzone.spec.ts +92 -0
  110. package/src/modules/components/AppImageDropzone/index.d.ts +8 -0
  111. package/src/modules/components/AppInput/AppInput.vue +247 -0
  112. package/src/modules/components/AppInput/FileInput.vue +58 -0
  113. package/src/modules/components/AppInput/Input.vue +141 -0
  114. package/src/modules/components/AppInput/InputIconSlot.vue +27 -0
  115. package/src/modules/components/AppInput/LocationInput.vue +150 -0
  116. package/src/modules/components/AppInput/__mocks__/location.ts +13 -0
  117. package/src/modules/components/AppInput/__tests__/app-input.spec.ts +255 -0
  118. package/src/modules/components/AppInput/__tests__/file-input.spec.ts +48 -0
  119. package/src/modules/components/AppInput/__tests__/input-icon-slot.spec.ts +27 -0
  120. package/src/modules/components/AppInput/__tests__/input.spec.ts +260 -0
  121. package/src/modules/components/AppInput/__tests__/location-input.spec.ts +159 -0
  122. package/src/modules/components/AppInput/choice.ts +24 -0
  123. package/src/modules/components/AppInput/datepicker.ts +62 -0
  124. package/src/modules/components/AppInput/index.d.ts +68 -0
  125. package/src/modules/components/AppInput/index.ts +133 -0
  126. package/src/modules/components/AppInput/location.ts +8 -0
  127. package/src/modules/components/AppInput/richText.ts +45 -0
  128. package/src/modules/components/AppInputLabel/AppInputLabel.vue +15 -0
  129. package/src/modules/components/AppInputLabel/__tests__/app-input-label.spec.ts +38 -0
  130. package/src/modules/components/AppInputLabel/index.d.ts +6 -0
  131. package/src/modules/components/AppLicensePlate/AppLicensePlate.vue +34 -0
  132. package/src/modules/components/AppLicensePlate/__tests__/app-license-plate.spec.ts +46 -0
  133. package/src/modules/components/AppLicensePlate/index.d.ts +1 -0
  134. package/src/modules/components/AppLoader/AppLoader.vue +37 -0
  135. package/src/modules/components/AppLoader/index.d.ts +1 -0
  136. package/src/modules/components/AppLoader/index.ts +8 -0
  137. package/src/modules/components/AppMaps/AppMaps.vue +105 -0
  138. package/src/modules/components/AppMaps/index.ts +44 -0
  139. package/src/modules/components/AppMenu/AppMenu.vue +79 -0
  140. package/src/modules/components/AppMenu/AppMenuItem.vue +40 -0
  141. package/src/modules/components/AppMenu/__mocks__/index.ts +23 -0
  142. package/src/modules/components/AppMenu/__tests__/app-menu-item.spec.ts +47 -0
  143. package/src/modules/components/AppMenu/__tests__/app-menu.spec.ts +53 -0
  144. package/src/modules/components/AppMenu/index.d.ts +15 -0
  145. package/src/modules/components/AppModal/AppModal.vue +261 -0
  146. package/src/modules/components/AppModal/__tests__/app-modal.spec.ts +282 -0
  147. package/src/modules/components/AppModal/index.d.ts +36 -0
  148. package/src/modules/components/AppNavigationMenu/AppNavigationMenu.vue +95 -0
  149. package/src/modules/components/AppNavigationMenu/Mobile.vue +126 -0
  150. package/src/modules/components/AppNavigationMenu/NavigationItem.vue +82 -0
  151. package/src/modules/components/AppNavigationMenu/SupportItem.vue +29 -0
  152. package/src/modules/components/AppNavigationMenu/__tests__/app-navigation-menu.spec.ts +104 -0
  153. package/src/modules/components/AppNavigationMenu/__tests__/mobile.spec.ts +155 -0
  154. package/src/modules/components/AppNavigationMenu/__tests__/navigation-item.spec.ts +91 -0
  155. package/src/modules/components/AppNavigationMenu/__tests__/support-item.spec.ts +48 -0
  156. package/src/modules/components/AppPagination/AppPagination.vue +133 -0
  157. package/src/modules/components/AppPagination/AppPaginationItem.vue +28 -0
  158. package/src/modules/components/AppPagination/__mocks__/index.ts +20 -0
  159. package/src/modules/components/AppPagination/__tests__/app-pagination.spec.ts +143 -0
  160. package/src/modules/components/AppPagination/index.d.ts +24 -0
  161. package/src/modules/components/AppProgressBar/AppProgressBar.vue +93 -0
  162. package/src/modules/components/AppProgressBar/AppProgressBarStep.vue +5 -0
  163. package/src/modules/components/AppProgressBar/__mocks__/index.ts +17 -0
  164. package/src/modules/components/AppProgressBar/__tests__/app-progress-bar-step.spec.ts +18 -0
  165. package/src/modules/components/AppProgressBar/__tests__/app-progress-bar.spec.ts +77 -0
  166. package/src/modules/components/AppProgressBar/index.d.ts +21 -0
  167. package/src/modules/components/AppRating/AppRating.vue +42 -0
  168. package/src/modules/components/AppRating/VueStarRating/Star.vue +215 -0
  169. package/src/modules/components/AppRating/VueStarRating/StarRating.vue +231 -0
  170. package/src/modules/components/AppRating/VueStarRating/classes/AlphaColor.ts +68 -0
  171. package/src/modules/components/AppRating/VueStarRating/readme.md +279 -0
  172. package/src/modules/components/AppRating/__tests__/app-rating.spec.ts +36 -0
  173. package/src/modules/components/AppSection/AppSection.vue +35 -0
  174. package/src/modules/components/AppSection/__tests__/app-section.spec.ts +53 -0
  175. package/src/modules/components/AppSelect/AppSelect.vue +176 -0
  176. package/src/modules/components/AppSelect/__mocks__/index.ts +24 -0
  177. package/src/modules/components/AppSelect/__tests__/app-select.spec.ts +73 -0
  178. package/src/modules/components/AppSelect/index.d.ts +43 -0
  179. package/src/modules/components/AppSelect/index.ts +69 -0
  180. package/src/modules/components/AppStepper/AppStepper.vue +79 -0
  181. package/src/modules/components/AppStepper/__tests__/app-stepper.spec.ts +59 -0
  182. package/src/modules/components/AppTable/AppTable.vue +40 -0
  183. package/src/modules/components/AppTimeline/AppTimeline.vue +22 -0
  184. package/src/modules/components/AppTimeline/AppTimelineItem.vue +97 -0
  185. package/src/modules/components/AppTimeline/AppTimelineItemIcon.vue +55 -0
  186. package/src/modules/components/AppTimeline/__mocks__/timeline.ts +29 -0
  187. package/src/modules/components/AppTimeline/__tests__/app-timeline-item-Icon.spec.ts +35 -0
  188. package/src/modules/components/AppTimeline/__tests__/app-timeline-item.spec.ts +121 -0
  189. package/src/modules/components/AppTimeline/__tests__/app-timeline.spec.ts +55 -0
  190. package/src/modules/components/AppTimeline/index.d.ts +30 -0
  191. package/src/modules/components/AppTimeline/index.ts +13 -0
  192. package/src/modules/components/AppToggle/AppToggle.vue +36 -0
  193. package/src/modules/components/AppToggle/__tests__/app-toggle.spec.ts +54 -0
  194. package/src/modules/components/AppToggle/index.d.ts +3 -0
  195. package/src/modules/components/AppToggleCard/AppToggleCard.vue +45 -0
  196. package/src/modules/components/AppToggleCard/__tests__/app-toggle-card.spec.ts +55 -0
  197. package/src/modules/components/index.ts +43 -0
  198. package/src/modules/composables/index.ts +13 -0
  199. package/src/modules/composables/useActionBar/__mocks__/index.ts +17 -0
  200. package/src/modules/composables/useActionBar/__tests__/index.spec.ts +62 -0
  201. package/src/modules/composables/useActionBar/index.d.ts +1 -0
  202. package/src/modules/composables/useActionBar/index.ts +67 -0
  203. package/src/modules/composables/useComputedPosition/index.d.ts +16 -0
  204. package/src/modules/composables/useComputedPosition/index.ts +199 -0
  205. package/src/modules/composables/useConfirm/__tests__/index.spec.ts +29 -0
  206. package/src/modules/composables/useConfirm/index.ts +63 -0
  207. package/src/modules/composables/useContextMenu/index.ts +127 -0
  208. package/src/modules/composables/useDrawer/__tests__/index.spec.ts +34 -0
  209. package/src/modules/composables/useDrawer/index.ts +136 -0
  210. package/src/modules/composables/useEcho/index.ts +167 -0
  211. package/src/modules/composables/useError/__tests__/index.spec.ts +29 -0
  212. package/src/modules/composables/useError/index.ts +61 -0
  213. package/src/modules/composables/useGoogleApi/__tests__/index.spec.ts +39 -0
  214. package/src/modules/composables/useGoogleApi/index.ts +26 -0
  215. package/src/modules/composables/useLayout/__tests__/index.spec.ts +34 -0
  216. package/src/modules/composables/useLayout/index.d.ts +1 -0
  217. package/src/modules/composables/useLayout/index.ts +68 -0
  218. package/src/modules/composables/useModal/__tests__/index.spec.ts +34 -0
  219. package/src/modules/composables/useModal/index.ts +97 -0
  220. package/src/modules/composables/useNavigation/__mocks__/navigation.ts +22 -0
  221. package/src/modules/composables/useNavigation/__tests__/index.spec.ts +88 -0
  222. package/src/modules/composables/useNavigation/index.d.ts +17 -0
  223. package/src/modules/composables/useNavigation/index.ts +97 -0
  224. package/src/modules/icons/BuildingCircleCheck.vue +32 -0
  225. package/src/modules/icons/BuildingCircleXmark.vue +20 -0
  226. package/src/modules/icons/CarsIcon.vue +29 -0
  227. package/src/modules/icons/ChatPersonRoundedIcon.vue +184 -0
  228. package/src/modules/icons/CompanyIcon.vue +18 -0
  229. package/src/modules/icons/HeroGirlIcon.vue +246 -0
  230. package/src/modules/icons/HeroPersonIcon.vue +402 -0
  231. package/src/modules/icons/HeroPersonRoundedIcon.vue +412 -0
  232. package/src/modules/icons/HeroPersonWithBgIcon.vue +4503 -0
  233. package/src/modules/icons/LocationMarkerIcon.vue +33 -0
  234. package/src/modules/icons/PartyPopperIcon.vue +146 -0
  235. package/src/modules/icons/index.ts +32 -0
  236. package/src/modules/icons/status/ErrorIcon.vue +24 -0
  237. package/src/modules/icons/status/SuccessIcon.vue +24 -0
  238. package/src/modules/icons/status/WarningIcon.vue +27 -0
  239. package/src/modules/icons/status/index.ts +3 -0
  240. package/src/modules/index.ts +8 -0
  241. package/src/modules/layouts/Auth/Auth.vue +36 -0
  242. package/src/modules/layouts/Auth/__tests__/auth.spec.ts +63 -0
  243. package/src/modules/layouts/Base/Base.vue +69 -0
  244. package/src/modules/layouts/Base/__tests__/base.spec.ts +56 -0
  245. package/src/modules/layouts/Platform/Platform.vue +96 -0
  246. package/src/modules/layouts/Platform/__tests__/platform.spec.ts +56 -0
  247. package/src/modules/layouts/index.ts +9 -0
  248. package/src/modules/plugins/Sentry/index.d.ts +16 -0
  249. package/src/modules/plugins/Sentry/index.ts +65 -0
  250. package/src/modules/plugins/Sentry/language/nl.ts +13 -0
  251. package/src/modules/plugins/TinyMCE/lang/nl.js +430 -0
  252. package/src/modules/plugins/Toast/Toast.vue +58 -0
  253. package/src/modules/plugins/Toast/__tests__/toast.spec.ts +90 -0
  254. package/src/modules/plugins/Toast/index.ts +36 -0
  255. package/src/modules/plugins/Toast/types.d.ts +265 -0
  256. package/src/modules/plugins/index.ts +63 -0
  257. package/src/stories/Introduction.mdx +4 -0
  258. package/src/stories/assets/code-brackets.svg +1 -0
  259. package/src/stories/assets/colors.svg +1 -0
  260. package/src/stories/assets/comments.svg +1 -0
  261. package/src/stories/assets/direction.svg +1 -0
  262. package/src/stories/assets/flow.svg +1 -0
  263. package/src/stories/assets/images/logo.png +0 -0
  264. package/src/stories/assets/images/road.png +0 -0
  265. package/src/stories/assets/plugin.svg +1 -0
  266. package/src/stories/assets/repo.svg +1 -0
  267. package/src/stories/assets/stackalt.svg +1 -0
  268. package/src/stories/components/ActionBar/ActionBar.stories.ts +67 -0
  269. package/src/stories/components/Alert/Alert.stories.ts +53 -0
  270. package/src/stories/components/Avatar/Avatar.stories.ts +44 -0
  271. package/src/stories/components/BackButton/BackButton.stories.ts +39 -0
  272. package/src/stories/components/Badge/Badge.stories.ts +42 -0
  273. package/src/stories/components/Button/Button.stories.ts +132 -0
  274. package/src/stories/components/Card/Card.stories.ts +70 -0
  275. package/src/stories/components/Color/Color.stories.ts +41 -0
  276. package/src/stories/components/ColorCard/ColorCard.stories.ts +43 -0
  277. package/src/stories/components/Confirm/Confirm.stories.ts +110 -0
  278. package/src/stories/components/ContextMenu/ContextMenu.stories.ts +85 -0
  279. package/src/stories/components/DefinitionList/DefinitionList.stories.ts +32 -0
  280. package/src/stories/components/Disclosure/Disclosure.stories.ts +61 -0
  281. package/src/stories/components/DropdownButton/DropdownButton.stories.ts +121 -0
  282. package/src/stories/components/Error/Error.stories.ts +106 -0
  283. package/src/stories/components/ImageDropzone/ImageDropzone.stories.ts +41 -0
  284. package/src/stories/components/Input/Input.stories.ts +180 -0
  285. package/src/stories/components/Input/LocationInput.stories.ts +77 -0
  286. package/src/stories/components/LicensePlate/LicensePlate.stories.ts +39 -0
  287. package/src/stories/components/Maps/Maps.stories.ts +36 -0
  288. package/src/stories/components/Menu/Menu.stories.ts +41 -0
  289. package/src/stories/components/Modal/Modal.stories.ts +68 -0
  290. package/src/stories/components/Navigation/Navigation.stories.ts +62 -0
  291. package/src/stories/components/Pagination/Pagination.stories.ts +62 -0
  292. package/src/stories/components/ProgressBar/ProgressBar.stories.ts +48 -0
  293. package/src/stories/components/Rating/Rating.stories.ts +38 -0
  294. package/src/stories/components/Section/Section.stories.ts +44 -0
  295. package/src/stories/components/Select/Select.stories.ts +90 -0
  296. package/src/stories/components/Stepper/Stepper.stories.ts +38 -0
  297. package/src/stories/components/Table/DataTable.stories.ts +96 -0
  298. package/src/stories/components/Table/Table.stories.ts +45 -0
  299. package/src/stories/components/Timeline/Timeline.stories.ts +46 -0
  300. package/src/stories/components/Toast/Toast.stories.ts +47 -0
  301. package/src/stories/components/Toggle/Toggle.stories.ts +41 -0
  302. package/src/stories/components/ToggleCard/ToggleCard.stories.ts +43 -0
  303. package/src/stories/layouts/Auth.stories.ts +43 -0
  304. package/src/stories/layouts/Base.stories.ts +70 -0
  305. package/src/tests/mocks/resize-observer.ts +13 -0
  306. package/src/tests/stubs/AppSelect.ts +89 -0
  307. package/src/tests/stubs/HeadlessUiDialogStub.ts +24 -0
  308. package/src/tests/stubs/HeadlessUiTransitionChildStub.ts +20 -0
  309. package/src/tests/stubs/HeadlessUiTransitionRootStub.ts +25 -0
  310. package/src/tests/stubs/IconStub.ts +9 -0
  311. package/src/tests/stubs/Vue3EasyDataTableStub.ts +53 -0
  312. package/src/typings/plugin.d.ts +5 -0
  313. package/src/typings/shims-vue.d.ts +13 -0
  314. package/src/typings/utilities.d.ts +4 -0
  315. package/src/typings/vite-environment.d.ts +12 -0
@@ -0,0 +1,366 @@
1
+ import {
2
+ describe,
3
+ it,
4
+ expect,
5
+ vi,
6
+ } from 'vitest';
7
+ import { flushPromises, shallowMount } from '@vue/test-utils';
8
+ import {
9
+ Dialog,
10
+ DialogTitle,
11
+ TransitionChild,
12
+ TransitionRoot,
13
+ } from '@headlessui/vue';
14
+ import Error from '../AppError.vue';
15
+ import { AppButton } from '~components';
16
+ import HeadlessUiTransitionRootStub from '~/tests/stubs/HeadlessUiTransitionRootStub';
17
+ import HeadlessUiDialogStub from '~/tests/stubs/HeadlessUiDialogStub';
18
+ import HeadlessUiTransitionChildStub from '~/tests/stubs/HeadlessUiTransitionChildStub';
19
+
20
+ import type { ErrorProps } from '../index.d';
21
+
22
+ function createWrapper(props: ErrorProps) {
23
+ return shallowMount(Error, {
24
+ props,
25
+ global: {
26
+ stubs: {
27
+ Dialog: HeadlessUiDialogStub,
28
+ TransitionRoot: HeadlessUiTransitionRootStub,
29
+ TransitionChild: HeadlessUiTransitionChildStub,
30
+ },
31
+ },
32
+ });
33
+ }
34
+
35
+ describe('generic AppError component', () => {
36
+ it('should display a confirm when title is set', () => {
37
+ const wrapper = createWrapper({ title: 'title' });
38
+
39
+ const transitionWrapper = wrapper.findComponent(TransitionRoot)
40
+ .findComponent(Dialog)
41
+ .findAllComponents(TransitionChild)[1];
42
+
43
+ expect(transitionWrapper.exists()).toBe(true);
44
+ expect(transitionWrapper.isVisible()).toBe(true);
45
+ });
46
+
47
+ it('should set the right title', () => {
48
+ const title = 'This is a test';
49
+
50
+ const wrapper = createWrapper({
51
+ title,
52
+ content: 'Bla',
53
+ });
54
+
55
+ const dialogTitleWrapper = wrapper.findComponent(TransitionRoot)
56
+ .findComponent(Dialog)
57
+ .findAllComponents(TransitionChild)[1]
58
+ .findComponent(DialogTitle);
59
+
60
+ expect(dialogTitleWrapper.text()).toStrictEqual(title);
61
+ });
62
+
63
+ it('should set the right content', () => {
64
+ const content = 'This is test content';
65
+
66
+ const wrapper = createWrapper({
67
+ title: 'This is a test',
68
+ content,
69
+ });
70
+
71
+ const dialogContent = wrapper.findComponent(TransitionRoot)
72
+ .findComponent(Dialog)
73
+ .findAllComponents(TransitionChild)[1]
74
+ .find('[data-test-error-content]');
75
+
76
+ expect(dialogContent.text()).toStrictEqual(content);
77
+ });
78
+
79
+ it('should render the content as text by default', () => {
80
+ const content = '<p>This is test content</p>';
81
+ const wrapper = createWrapper({
82
+ title: 'This is a test',
83
+ content,
84
+ });
85
+
86
+ const dialogContent = wrapper.findComponent(TransitionRoot)
87
+ .findComponent(Dialog)
88
+ .findAllComponents(TransitionChild)[1]
89
+ .find('[data-test-error-content]');
90
+
91
+ expect(dialogContent.text()).toBe(content);
92
+ });
93
+
94
+ it('should render the content as html when html is enabled', () => {
95
+ const content = '<p>This is test content</p>';
96
+
97
+ const wrapper = createWrapper({
98
+ title: 'This is a test',
99
+ content,
100
+ html: true,
101
+ });
102
+
103
+ const dialogContent = wrapper.findComponent(TransitionRoot)
104
+ .findComponent(Dialog)
105
+ .findAllComponents(TransitionChild)[1]
106
+ .find('[data-test-error-content]');
107
+
108
+ expect(dialogContent.text()).toBe('This is test content');
109
+ expect(dialogContent.find('.app-error-html-content').find('p').exists()).toBe(true);
110
+ expect(dialogContent.find('.app-error-html-content').find('p').text()).toBe('This is test content');
111
+ });
112
+
113
+ it('should be able to set a custom text in confirm button', () => {
114
+ const confirmButtonText = 'huts';
115
+
116
+ const wrapper = createWrapper({
117
+ title: 'This is a test',
118
+ content: 'Bla',
119
+ confirmButtonText,
120
+ cancelButtonText: 'cancel button',
121
+ });
122
+
123
+ const confirmButton = wrapper.findComponent(TransitionRoot)
124
+ .findComponent(Dialog)
125
+ .findAllComponents(TransitionChild)[1]
126
+ .findAllComponents(AppButton)[0];
127
+
128
+ expect(confirmButton.exists()).toBe(true);
129
+ expect(confirmButton.text()).toStrictEqual(confirmButtonText);
130
+ });
131
+
132
+ it('should be able to set a custom text in cancel button', () => {
133
+ const cancelButtonText = 'huts';
134
+
135
+ const wrapper = createWrapper({
136
+ title: 'This is a test',
137
+ content: 'Bla',
138
+ confirmButtonText: 'confirm button',
139
+ cancelButtonText,
140
+ });
141
+
142
+ const cancelButton = wrapper.findComponent(TransitionRoot)
143
+ .findComponent(Dialog)
144
+ .findAllComponents(TransitionChild)[1]
145
+ .findAllComponents(AppButton)[1];
146
+
147
+ expect(cancelButton.exists()).toBe(true);
148
+ expect(cancelButton.text()).toStrictEqual(cancelButtonText);
149
+ });
150
+
151
+ it('should not have a default icon', () => {
152
+ const wrapper = createWrapper({
153
+ title: 'This is a test',
154
+ content: 'Bla',
155
+ });
156
+
157
+ const appIconWrapper = wrapper.findComponent(TransitionRoot)
158
+ .findComponent(Dialog)
159
+ .findAllComponents(TransitionChild)[1]
160
+ .find('[data-test-error-icon]');
161
+
162
+ expect(appIconWrapper.exists()).toBe(false);
163
+ });
164
+
165
+ it('should have a default icon for type "success"', () => {
166
+ const wrapper = createWrapper({
167
+ type: 'success',
168
+ title: 'This is a test',
169
+ content: 'Bla',
170
+ });
171
+
172
+ const appIconWrapper = wrapper.findComponent(TransitionRoot)
173
+ .findComponent(Dialog)
174
+ .findAllComponents(TransitionChild)[1]
175
+ .find('[data-test-error-icon]');
176
+
177
+ expect(appIconWrapper.isVisible()).toBe(true);
178
+ });
179
+
180
+ it('should emit a close when confirm button is pressed', async () => {
181
+ expect.assertions(2);
182
+
183
+ const wrapper = createWrapper({
184
+ title: 'This is a test',
185
+ content: 'Bla',
186
+ confirmButtonText: 'confirm',
187
+ });
188
+
189
+ const confirmButton = wrapper.findComponent(TransitionRoot)
190
+ .findComponent(Dialog)
191
+ .findAllComponents(TransitionChild)[1]
192
+ .findAllComponents(AppButton)[0];
193
+
194
+ await confirmButton.trigger('click');
195
+
196
+ const emitted = wrapper.emitted<Event[]>();
197
+
198
+ expect(emitted).toHaveProperty('close');
199
+ expect(emitted.close[0][0]).toBe(true);
200
+ });
201
+
202
+ it('should emit a close when cancel button is pressed', async () => {
203
+ expect.assertions(2);
204
+
205
+ const wrapper = createWrapper({
206
+ title: 'This is a test',
207
+ content: 'Bla',
208
+ cancelButtonText: 'confirm',
209
+ });
210
+
211
+ const confirmButton = wrapper.findComponent(TransitionRoot)
212
+ .findComponent(Dialog)
213
+ .findAllComponents(TransitionChild)[1]
214
+ .findAllComponents(AppButton)[0];
215
+
216
+ await confirmButton.trigger('click');
217
+
218
+ const emitted = wrapper.emitted<Event[]>();
219
+
220
+ expect(emitted).toHaveProperty('close');
221
+ expect(emitted.close[0][0]).toBe(false);
222
+ });
223
+
224
+ it('should process promise when onConfirm is function', async () => {
225
+ expect.assertions(3);
226
+
227
+ const onConfirm = vi.fn();
228
+
229
+ const wrapper = createWrapper({
230
+ title: 'This is a test',
231
+ content: 'Bla',
232
+ confirmButtonText: 'confirm',
233
+ onConfirm,
234
+ });
235
+
236
+ const confirmButton = wrapper.findComponent(TransitionRoot)
237
+ .findComponent(Dialog)
238
+ .findAllComponents(TransitionChild)[1]
239
+ .findAllComponents(AppButton)[0];
240
+
241
+ await confirmButton.trigger('click');
242
+
243
+ const emitted = wrapper.emitted<Event[]>();
244
+
245
+ expect(emitted).toHaveProperty('close');
246
+ expect(emitted.close[0][0]).toBe(true);
247
+
248
+ expect(onConfirm).toHaveBeenCalledTimes(1);
249
+ });
250
+
251
+ it('should process promise when onCancel is function', async () => {
252
+ expect.assertions(3);
253
+
254
+ const onCancel = vi.fn();
255
+
256
+ const wrapper = createWrapper({
257
+ title: 'This is a test',
258
+ content: 'Bla',
259
+ cancelButtonText: 'confirm',
260
+ onCancel,
261
+ });
262
+
263
+ const cancelButton = wrapper.findComponent(TransitionRoot)
264
+ .findComponent(Dialog)
265
+ .findAllComponents(TransitionChild)[1]
266
+ .findAllComponents(AppButton)[0];
267
+
268
+ await cancelButton.trigger('click');
269
+
270
+ const emitted = wrapper.emitted<Event[]>();
271
+
272
+ expect(emitted).toHaveProperty('close');
273
+ expect(emitted.close[0][0]).toBe(false);
274
+
275
+ expect(onCancel).toHaveBeenCalledTimes(1);
276
+ });
277
+
278
+ it('should show spinner when confirming', async () => {
279
+ expect.assertions(2);
280
+
281
+ const wrapper = createWrapper({
282
+ title: 'This is a test',
283
+ content: 'Bla',
284
+ confirmButtonText: 'confirm',
285
+ cancelButtonText: 'confirm',
286
+ });
287
+
288
+ // @ts-expect-error setting data on wrapper works in this case but not according to Typescript
289
+ wrapper.vm.confirmLoading = true;
290
+ // @ts-expect-error setting data on wrapper works in this case but not according to Typescript
291
+ wrapper.vm.cancelLoading = true;
292
+
293
+ await flushPromises();
294
+
295
+ const buttons = wrapper.findComponent(TransitionRoot)
296
+ .findComponent(Dialog)
297
+ .findAllComponents(TransitionChild)[1]
298
+ .findAllComponents(AppButton);
299
+
300
+ expect(buttons[0].props('loading')).toBe(true);
301
+ expect(buttons[1].props('loading')).toBe(true);
302
+ });
303
+
304
+ it('should close confirm when backdrop is clicked and preventBackdropClose is "false"', async () => {
305
+ expect.assertions(3);
306
+
307
+ const wrapper = createWrapper({
308
+ title: 'This is a test',
309
+ content: 'BlaBlaBla',
310
+ preventBackdropClose: false,
311
+ });
312
+
313
+ const dialog = wrapper.findComponent(Dialog);
314
+ expect(dialog.exists()).toBe(true);
315
+
316
+ dialog.vm.$emit('close');
317
+
318
+ await flushPromises();
319
+
320
+ const closeConfirmEmit = wrapper.emitted<Event[]>('close');
321
+
322
+ expect(closeConfirmEmit).toBeDefined();
323
+ expect(closeConfirmEmit).toHaveLength(1);
324
+ });
325
+
326
+ it('should not close confirm when backdrop is clicked', async () => {
327
+ expect.assertions(2);
328
+
329
+ const wrapper = createWrapper({
330
+ title: 'This is a test',
331
+ content: 'BlaBlaBla',
332
+ });
333
+
334
+ const dialog = wrapper.findComponent(Dialog);
335
+ expect(dialog.exists()).toBe(true);
336
+
337
+ dialog.vm.$emit('close');
338
+
339
+ await flushPromises();
340
+
341
+ const closeConfirmEmit = wrapper.emitted<Event[]>('close');
342
+
343
+ expect(closeConfirmEmit).toBeUndefined();
344
+ });
345
+
346
+ it('shouldn\'t close confirm when backdrop is clicked with prevent prop', async () => {
347
+ expect.assertions(2);
348
+
349
+ const wrapper = createWrapper({
350
+ title: 'This is a test',
351
+ content: 'BlaBlaBla',
352
+ });
353
+
354
+ await wrapper.setProps({ preventBackdropClose: true });
355
+
356
+ const dialog = wrapper.findComponent(Dialog);
357
+ expect(dialog.exists()).toBe(true);
358
+
359
+ dialog.vm.$emit('close');
360
+ await flushPromises();
361
+
362
+ const closeConfirmEmit = wrapper.emitted<Event[]>('close');
363
+
364
+ expect(closeConfirmEmit).toBeUndefined();
365
+ });
366
+ });
@@ -0,0 +1,30 @@
1
+ import type { Component } from 'vue';
2
+
3
+ export type Error = (options: ErrorProps) => Promise<void>;
4
+ export type ErrorType = 'default' | 'success' | 'error';
5
+ export type OnConfirm = () => unknown;
6
+ export type OnCancel = () => unknown;
7
+
8
+ export interface ErrorProps {
9
+ title: string;
10
+ type?: ErrorType;
11
+ content?: string;
12
+ confirmButtonText?: string;
13
+ confirmButtonTrailingIcon?: Component;
14
+ confirmButtonLeadingIcon?: Component;
15
+ cancelButtonText?: string;
16
+ cancelButtonTrailingIcon?: Component;
17
+ cancelButtonLeadingIcon?: Component;
18
+ withBackdrop?: boolean;
19
+ preventBackdropClose?: boolean;
20
+ icon?: string | Component;
21
+ html?: boolean;
22
+ extendedIconDomClasses?: string;
23
+ onConfirm?: OnConfirm;
24
+ onCancel?: OnCancel;
25
+ }
26
+
27
+ export interface ErrorInstance {
28
+ instance: App;
29
+ element: HTMLDivElement;
30
+ }
@@ -0,0 +1 @@
1
+ export const types = ['default', 'success', 'error'] as const;
@@ -0,0 +1,130 @@
1
+ <script lang="ts" setup>
2
+ import { ref, onMounted, watch } from 'vue';
3
+ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
4
+ import { useDropZone } from '@vueuse/core';
5
+ import { byPrefixAndName } from '~icons';
6
+
7
+ import type { ImageDropzoneProps } from '.';
8
+
9
+ const props = withDefaults(defineProps<ImageDropzoneProps>(), {
10
+ title: 'Drag & drop',
11
+ description: 'of selecteer een afbeelding van je computer (jpg, jpeg of png).',
12
+ name: '',
13
+ disabled: false,
14
+ multiple: false,
15
+ dataTypes: () => ['image/png', 'image/gif', 'image/jpeg'],
16
+ });
17
+
18
+ const emit = defineEmits<{ (event: 'update:modelValue', value: File | null): void }>();
19
+
20
+ const file = ref<File | null>(null);
21
+ const preview = ref<string | null>(null);
22
+ const fileInput = ref<HTMLElement>();
23
+ const dropZoneRef = ref<HTMLDivElement>();
24
+ const { isOverDropZone } = useDropZone(dropZoneRef, { onDrop, dataTypes: props.dataTypes });
25
+
26
+ watch(file, newFile => {
27
+ emit('update:modelValue', newFile);
28
+ });
29
+
30
+ onMounted(() => {
31
+ if (props.existingFileUrl) {
32
+ preview.value = props.existingFileUrl;
33
+
34
+ file.value = new File([], props.existingFileUrl.split('/').pop() ?? '');
35
+ }
36
+ });
37
+
38
+ function onDrop(files: File[] | null): void {
39
+ if (files && !props.disabled) {
40
+ const droppedFile = files[0];
41
+
42
+ file.value = droppedFile;
43
+ preview.value = URL.createObjectURL(droppedFile);
44
+ }
45
+ }
46
+
47
+ function handleFileChange(event: Event): void {
48
+ const input = event.target as HTMLInputElement;
49
+ const selectedFile = input.files?.[0];
50
+
51
+ if (selectedFile && props.dataTypes.includes(selectedFile.type)) {
52
+ file.value = selectedFile;
53
+ preview.value = URL.createObjectURL(selectedFile);
54
+ }
55
+ }
56
+
57
+ function removeImage(): void {
58
+ file.value = null;
59
+ preview.value = null;
60
+ (fileInput.value as HTMLInputElement).value = '';
61
+ }
62
+
63
+ function handleClick(): void {
64
+ fileInput.value?.click();
65
+ }
66
+ </script>
67
+
68
+ <template>
69
+ <div
70
+ ref="dropZoneRef"
71
+ :class="{ 'cursor-pointer': !disabled, 'cursor-not-allowed': disabled, 'bg-zinc-700': isOverDropZone }"
72
+ class="group relative flex size-60 items-center justify-center rounded-2xl bg-secondary text-center drop-shadow-card"
73
+ @click="handleClick"
74
+ >
75
+ <input
76
+ ref="fileInput"
77
+ :disabled="disabled"
78
+ :accept="dataTypes.join(', ')"
79
+ :name="name"
80
+ type="file"
81
+ class="hidden"
82
+ @change="handleFileChange"
83
+ >
84
+
85
+ <div
86
+ v-if="!file"
87
+ class="flex flex-col items-center px-6 py-10 text-white"
88
+ >
89
+ <FontAwesomeIcon
90
+ :icon="byPrefixAndName.far?.['arrow-up-to-line']"
91
+ class="size-10"
92
+ />
93
+
94
+ <h3 class="mb-2 mt-4 text-xl font-bold">
95
+ {{ title }}
96
+ </h3>
97
+
98
+ <p class="text-sm">
99
+ {{ description }}
100
+ </p>
101
+ </div>
102
+
103
+ <img
104
+ v-if="preview"
105
+ :src="preview"
106
+ alt="Preview"
107
+ class="size-full rounded-2xl object-cover"
108
+ >
109
+
110
+ <span
111
+ v-if="file && !disabled"
112
+ class="absolute inset-0 hidden size-full flex-col items-center justify-center rounded-2xl bg-secondary p-1 text-white
113
+ group-hover:flex"
114
+ @click.stop="removeImage"
115
+ >
116
+ <FontAwesomeIcon
117
+ :icon="byPrefixAndName.far?.trash"
118
+ class="size-10"
119
+ />
120
+
121
+ <h3 class="mb-2 mt-4 text-xl font-bold">
122
+ Verwijderen
123
+ </h3>
124
+
125
+ <p class="text-sm">
126
+ Klik hier om de afbeelding te verwijderen
127
+ </p>
128
+ </span>
129
+ </div>
130
+ </template>
@@ -0,0 +1,92 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';
3
+ import { AppImageDropzone } from '~components';
4
+
5
+ describe('the AppImageDropzone component', () => {
6
+ let originalCreateObjectUrl: typeof URL.createObjectURL;
7
+
8
+ beforeAll(() => {
9
+ // eslint-disable-next-line @typescript-eslint/unbound-method
10
+ originalCreateObjectUrl = URL.createObjectURL;
11
+ URL.createObjectURL = vi.fn(() => 'blob:http://localhost:8080/12345').bind(URL);
12
+ });
13
+
14
+ afterAll(() => {
15
+ URL.createObjectURL = originalCreateObjectUrl;
16
+ });
17
+
18
+ it('renders the component', () => {
19
+ const wrapper = shallowMount(AppImageDropzone);
20
+ expect(wrapper.exists()).toBe(true);
21
+ });
22
+
23
+ it('emits update:modelValue when file changes', async () => {
24
+ expect.assertions(3);
25
+
26
+ const wrapper = shallowMount(AppImageDropzone);
27
+ const file = new File([''], 'test.png', { type: 'image/png' });
28
+ const inputElement = wrapper.find('input[type="file"]').element as HTMLInputElement;
29
+
30
+ Object.defineProperty(inputElement, 'files', {
31
+ value: [file],
32
+ writable: false,
33
+ });
34
+
35
+ expect(wrapper.emitted('update:modelValue')).toBeUndefined();
36
+
37
+ await wrapper.find('input').trigger('change');
38
+
39
+ expect(wrapper.emitted('update:modelValue')).toHaveLength(1);
40
+ expect(wrapper.emitted('update:modelValue')?.[0]).toStrictEqual([file]);
41
+ });
42
+
43
+ it('displays the preview image when file is set', async () => {
44
+ expect.assertions(3);
45
+
46
+ const wrapper = shallowMount(AppImageDropzone);
47
+
48
+ const file = new File([''], 'test.png', { type: 'image/png' });
49
+ const inputElement = wrapper.find('input').element as HTMLInputElement;
50
+
51
+ Object.defineProperty(inputElement, 'files', {
52
+ value: [file],
53
+ writable: false,
54
+ });
55
+
56
+ expect(wrapper.find('img').exists()).toBe(false);
57
+
58
+ await wrapper.find('input').trigger('change');
59
+ await wrapper.vm.$nextTick();
60
+
61
+ const img = wrapper.find('img');
62
+
63
+ expect(img.exists()).toBe(true);
64
+ expect(img.attributes('src')).toContain('blob:');
65
+ });
66
+
67
+ it('removes the image when remove button is clicked', async () => {
68
+ expect.assertions(3);
69
+
70
+ const wrapper = shallowMount(AppImageDropzone);
71
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
72
+ const wrapperVm = wrapper.vm as unknown as typeof AppImageDropzone;
73
+ const file = new File([''], 'test.png', { type: 'image/png' });
74
+ const inputElement = wrapper.find('input[type="file"]').element as HTMLInputElement;
75
+
76
+ Object.defineProperty(inputElement, 'files', {
77
+ value: [file],
78
+ writable: false,
79
+ });
80
+
81
+ await wrapper.find('input').trigger('change');
82
+ await wrapper.vm.$nextTick();
83
+
84
+ expect(wrapper.find('img').exists()).toBe(true);
85
+
86
+ const removeButton = wrapper.find('span');
87
+ await removeButton.trigger('click');
88
+
89
+ expect(wrapperVm.file).toBeNull();
90
+ expect(wrapper.find('img').exists()).toBe(false);
91
+ });
92
+ });
@@ -0,0 +1,8 @@
1
+ export interface ImageDropzoneProps {
2
+ title?: string;
3
+ description?: string;
4
+ disabled?: boolean;
5
+ existingFileUrl?: string;
6
+ dataTypes?: string[];
7
+ name?: string;
8
+ }