@autoafleveren/ui 1.3.2 → 1.4.0

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 (320) 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/components/AppActionBar/AppActionBarItem.vue.d.ts +4 -0
  5. package/dist/types/composables/index.d.ts +2 -1
  6. package/dist/types/composables/useActionBar/index.d.ts +3 -3
  7. package/dist/types/composables/useFocusTrap/index.d.ts +10 -0
  8. package/dist/ui-storybook.css +1 -1
  9. package/dist/ui.cjs +47 -40
  10. package/dist/ui.js +12385 -11552
  11. package/package.json +5 -2
  12. package/src/App.vue +15 -0
  13. package/src/Playground.vue.example +9 -0
  14. package/src/config/eslint.cjs +199 -0
  15. package/src/config/tailwind/config.cjs +229 -0
  16. package/src/config/tailwind/screens.json +9 -0
  17. package/src/css/build.css +52 -0
  18. package/src/css/main.css +4 -0
  19. package/src/css/theme.css +208 -0
  20. package/src/css/tinymce.css +58 -0
  21. package/src/main.ts +34 -0
  22. package/src/modules/components/AppActionBar/AppActionBar.vue +96 -0
  23. package/src/modules/components/AppActionBar/AppActionBarItem.vue +149 -0
  24. package/src/modules/components/AppActionBar/AppActionBarSubMenu.vue +89 -0
  25. package/src/modules/components/AppActionBar/Components/Error.vue +11 -0
  26. package/src/modules/components/AppActionBar/Components/Loading.vue +9 -0
  27. package/src/modules/components/AppActionBar/Components/MultiSelect.vue +102 -0
  28. package/src/modules/components/AppActionBar/Components/__tests__/multi-select.spec.ts +74 -0
  29. package/src/modules/components/AppActionBar/__mocks__/index.ts +36 -0
  30. package/src/modules/components/AppActionBar/__tests__/app-action-bar-item.spec.ts +134 -0
  31. package/src/modules/components/AppActionBar/__tests__/app-action-bar-sub-menu.spec.ts +45 -0
  32. package/src/modules/components/AppActionBar/__tests__/app-action-bar.spec.ts +92 -0
  33. package/src/modules/components/AppActionBar/index.d.ts +29 -0
  34. package/src/modules/components/AppActionBar/index.ts +18 -0
  35. package/src/modules/components/AppAlert/AppAlert.vue +69 -0
  36. package/src/modules/components/AppAlert/__tests__/app-alert.spec.ts +67 -0
  37. package/src/modules/components/AppAlert/index.d.ts +3 -0
  38. package/src/modules/components/AppAlert/index.ts +18 -0
  39. package/src/modules/components/AppAvatar/AppAvatar.vue +30 -0
  40. package/src/modules/components/AppAvatar/DefaultAvatar.vue +187 -0
  41. package/src/modules/components/AppAvatar/__tests__/app-avatar.spec.ts +70 -0
  42. package/src/modules/components/AppAvatar/index.d.ts +9 -0
  43. package/src/modules/components/AppAvatar/index.ts +9 -0
  44. package/src/modules/components/AppBackButton/AppBackButton.vue +51 -0
  45. package/src/modules/components/AppBackButton/__tests__/app-back-button.spec.ts +70 -0
  46. package/src/modules/components/AppBadge/AppBadge.vue +65 -0
  47. package/src/modules/components/AppBadge/__tests__/app-badge.spec.ts +64 -0
  48. package/src/modules/components/AppBadge/index.d.ts +13 -0
  49. package/src/modules/components/AppBadge/index.ts +29 -0
  50. package/src/modules/components/AppButton/AppButton.vue +53 -0
  51. package/src/modules/components/AppButton/ButtonIconSlot.vue +26 -0
  52. package/src/modules/components/AppButton/__tests__/app-button.spec.ts +145 -0
  53. package/src/modules/components/AppButton/__tests__/button-icon-slot.spec.ts +30 -0
  54. package/src/modules/components/AppButton/index.d.ts +16 -0
  55. package/src/modules/components/AppButton/index.ts +57 -0
  56. package/src/modules/components/AppCard/AppCard.vue +88 -0
  57. package/src/modules/components/AppCard/CardAction.vue +101 -0
  58. package/src/modules/components/AppCard/CardIconSlot.vue +65 -0
  59. package/src/modules/components/AppCard/__tests__/app-card.spec.ts +109 -0
  60. package/src/modules/components/AppCard/__tests__/card-action.spec.ts +55 -0
  61. package/src/modules/components/AppCard/__tests__/card-icon-slot.spec.ts +27 -0
  62. package/src/modules/components/AppCard/index.d.ts +12 -0
  63. package/src/modules/components/AppCard/index.ts +5 -0
  64. package/src/modules/components/AppColor/AppColor.vue +74 -0
  65. package/src/modules/components/AppColor/__tests__/app-color.spec.ts +53 -0
  66. package/src/modules/components/AppColor/index.d.ts +10 -0
  67. package/src/modules/components/AppColorCard/AppColorCard.vue +41 -0
  68. package/src/modules/components/AppColorCard/__tests__/app-color-card.spec.ts +55 -0
  69. package/src/modules/components/AppConfirm/AppConfirm.vue +237 -0
  70. package/src/modules/components/AppConfirm/__tests__/app-confirm.spec.ts +366 -0
  71. package/src/modules/components/AppConfirm/index.d.ts +31 -0
  72. package/src/modules/components/AppConfirm/index.ts +1 -0
  73. package/src/modules/components/AppContextMenu/AppContextMenu.vue +109 -0
  74. package/src/modules/components/AppContextMenu/ShortcutItem.vue +38 -0
  75. package/src/modules/components/AppContextMenu/__mocks__/index.ts +25 -0
  76. package/src/modules/components/AppContextMenu/__tests__/app-context-menu.spec.ts +71 -0
  77. package/src/modules/components/AppContextMenu/__tests__/shortcut-item.spec.ts +29 -0
  78. package/src/modules/components/AppContextMenu/index.d.ts +23 -0
  79. package/src/modules/components/AppDataTable/AppDataTable.vue +323 -0
  80. package/src/modules/components/AppDataTable/AppDataTableFooter.vue +91 -0
  81. package/src/modules/components/AppDataTable/__mocks__/index.ts +71 -0
  82. package/src/modules/components/AppDataTable/__tests__/app-data-table-footer.spec.ts +107 -0
  83. package/src/modules/components/AppDataTable/__tests__/app-data-table.spec.ts +153 -0
  84. package/src/modules/components/AppDataTable/index.d.ts +29 -0
  85. package/src/modules/components/AppDefinitionList/AppDefinitionItem.vue +57 -0
  86. package/src/modules/components/AppDefinitionList/AppDefinitionList.vue +32 -0
  87. package/src/modules/components/AppDefinitionList/__mocks__/index.ts +31 -0
  88. package/src/modules/components/AppDefinitionList/__tests__/app-definition-item.spec.ts +93 -0
  89. package/src/modules/components/AppDefinitionList/__tests__/app-definition-list.spec.ts +35 -0
  90. package/src/modules/components/AppDefinitionList/index.d.ts +8 -0
  91. package/src/modules/components/AppDisclosure/AppDisclosure.vue +19 -0
  92. package/src/modules/components/AppDisclosure/AppDisclosureButton.vue +43 -0
  93. package/src/modules/components/AppDisclosure/AppDisclosurePanel.vue +31 -0
  94. package/src/modules/components/AppDisclosure/__tests__/app-disclosure-button.spec.ts +70 -0
  95. package/src/modules/components/AppDisclosure/__tests__/app-disclosure-panel.spec.ts +64 -0
  96. package/src/modules/components/AppDisclosure/__tests__/app-disclosure.spec.ts +41 -0
  97. package/src/modules/components/AppDrawer/AppDrawer.vue +149 -0
  98. package/src/modules/components/AppDrawer/__tests__/app-drawer.spec.ts +120 -0
  99. package/src/modules/components/AppDrawer/index.d.ts +27 -0
  100. package/src/modules/components/AppDropdownButton/AppDropdownButton.vue +82 -0
  101. package/src/modules/components/AppDropdownButton/AppDropdownItem.vue +67 -0
  102. package/src/modules/components/AppDropdownButton/__mocks__/index.ts +25 -0
  103. package/src/modules/components/AppDropdownButton/__tests__/app-dropdown-button.spec.ts +81 -0
  104. package/src/modules/components/AppDropdownButton/__tests__/app-dropdown-item.spec.ts +108 -0
  105. package/src/modules/components/AppDropdownButton/index.d.ts +26 -0
  106. package/src/modules/components/AppDropdownButton/index.ts +8 -0
  107. package/src/modules/components/AppError/AppError.vue +233 -0
  108. package/src/modules/components/AppError/__tests__/app-error.spec.ts +366 -0
  109. package/src/modules/components/AppError/index.d.ts +30 -0
  110. package/src/modules/components/AppError/index.ts +1 -0
  111. package/src/modules/components/AppImageDropzone/AppImageDropzone.vue +130 -0
  112. package/src/modules/components/AppImageDropzone/__tests__/app-image-dropzone.spec.ts +92 -0
  113. package/src/modules/components/AppImageDropzone/index.d.ts +8 -0
  114. package/src/modules/components/AppInput/AppInput.vue +247 -0
  115. package/src/modules/components/AppInput/FileInput.vue +58 -0
  116. package/src/modules/components/AppInput/Input.vue +141 -0
  117. package/src/modules/components/AppInput/InputIconSlot.vue +27 -0
  118. package/src/modules/components/AppInput/LocationInput.vue +150 -0
  119. package/src/modules/components/AppInput/__mocks__/location.ts +13 -0
  120. package/src/modules/components/AppInput/__tests__/app-input.spec.ts +255 -0
  121. package/src/modules/components/AppInput/__tests__/file-input.spec.ts +48 -0
  122. package/src/modules/components/AppInput/__tests__/input-icon-slot.spec.ts +27 -0
  123. package/src/modules/components/AppInput/__tests__/input.spec.ts +260 -0
  124. package/src/modules/components/AppInput/__tests__/location-input.spec.ts +159 -0
  125. package/src/modules/components/AppInput/choice.ts +24 -0
  126. package/src/modules/components/AppInput/datepicker.ts +62 -0
  127. package/src/modules/components/AppInput/index.d.ts +68 -0
  128. package/src/modules/components/AppInput/index.ts +133 -0
  129. package/src/modules/components/AppInput/location.ts +8 -0
  130. package/src/modules/components/AppInput/richText.ts +45 -0
  131. package/src/modules/components/AppInputLabel/AppInputLabel.vue +15 -0
  132. package/src/modules/components/AppInputLabel/__tests__/app-input-label.spec.ts +38 -0
  133. package/src/modules/components/AppInputLabel/index.d.ts +6 -0
  134. package/src/modules/components/AppLicensePlate/AppLicensePlate.vue +34 -0
  135. package/src/modules/components/AppLicensePlate/__tests__/app-license-plate.spec.ts +46 -0
  136. package/src/modules/components/AppLicensePlate/index.d.ts +1 -0
  137. package/src/modules/components/AppLoader/AppLoader.vue +37 -0
  138. package/src/modules/components/AppLoader/index.d.ts +1 -0
  139. package/src/modules/components/AppLoader/index.ts +8 -0
  140. package/src/modules/components/AppMaps/AppMaps.vue +105 -0
  141. package/src/modules/components/AppMaps/index.ts +44 -0
  142. package/src/modules/components/AppMenu/AppMenu.vue +79 -0
  143. package/src/modules/components/AppMenu/AppMenuItem.vue +40 -0
  144. package/src/modules/components/AppMenu/__mocks__/index.ts +23 -0
  145. package/src/modules/components/AppMenu/__tests__/app-menu-item.spec.ts +47 -0
  146. package/src/modules/components/AppMenu/__tests__/app-menu.spec.ts +53 -0
  147. package/src/modules/components/AppMenu/index.d.ts +15 -0
  148. package/src/modules/components/AppModal/AppModal.vue +261 -0
  149. package/src/modules/components/AppModal/__tests__/app-modal.spec.ts +282 -0
  150. package/src/modules/components/AppModal/index.d.ts +36 -0
  151. package/src/modules/components/AppNavigationMenu/AppNavigationMenu.vue +95 -0
  152. package/src/modules/components/AppNavigationMenu/Mobile.vue +126 -0
  153. package/src/modules/components/AppNavigationMenu/NavigationItem.vue +82 -0
  154. package/src/modules/components/AppNavigationMenu/SupportItem.vue +29 -0
  155. package/src/modules/components/AppNavigationMenu/__tests__/app-navigation-menu.spec.ts +104 -0
  156. package/src/modules/components/AppNavigationMenu/__tests__/mobile.spec.ts +155 -0
  157. package/src/modules/components/AppNavigationMenu/__tests__/navigation-item.spec.ts +91 -0
  158. package/src/modules/components/AppNavigationMenu/__tests__/support-item.spec.ts +48 -0
  159. package/src/modules/components/AppPagination/AppPagination.vue +133 -0
  160. package/src/modules/components/AppPagination/AppPaginationItem.vue +28 -0
  161. package/src/modules/components/AppPagination/__mocks__/index.ts +20 -0
  162. package/src/modules/components/AppPagination/__tests__/app-pagination.spec.ts +143 -0
  163. package/src/modules/components/AppPagination/index.d.ts +24 -0
  164. package/src/modules/components/AppProgressBar/AppProgressBar.vue +93 -0
  165. package/src/modules/components/AppProgressBar/AppProgressBarStep.vue +5 -0
  166. package/src/modules/components/AppProgressBar/__mocks__/index.ts +17 -0
  167. package/src/modules/components/AppProgressBar/__tests__/app-progress-bar-step.spec.ts +18 -0
  168. package/src/modules/components/AppProgressBar/__tests__/app-progress-bar.spec.ts +77 -0
  169. package/src/modules/components/AppProgressBar/index.d.ts +21 -0
  170. package/src/modules/components/AppRating/AppRating.vue +42 -0
  171. package/src/modules/components/AppRating/VueStarRating/Star.vue +215 -0
  172. package/src/modules/components/AppRating/VueStarRating/StarRating.vue +231 -0
  173. package/src/modules/components/AppRating/VueStarRating/classes/AlphaColor.ts +68 -0
  174. package/src/modules/components/AppRating/VueStarRating/readme.md +279 -0
  175. package/src/modules/components/AppRating/__tests__/app-rating.spec.ts +36 -0
  176. package/src/modules/components/AppSection/AppSection.vue +35 -0
  177. package/src/modules/components/AppSection/__tests__/app-section.spec.ts +53 -0
  178. package/src/modules/components/AppSelect/AppSelect.vue +176 -0
  179. package/src/modules/components/AppSelect/__mocks__/index.ts +24 -0
  180. package/src/modules/components/AppSelect/__tests__/app-select.spec.ts +73 -0
  181. package/src/modules/components/AppSelect/index.d.ts +43 -0
  182. package/src/modules/components/AppSelect/index.ts +69 -0
  183. package/src/modules/components/AppStepper/AppStepper.vue +79 -0
  184. package/src/modules/components/AppStepper/__tests__/app-stepper.spec.ts +59 -0
  185. package/src/modules/components/AppTable/AppTable.vue +40 -0
  186. package/src/modules/components/AppTimeline/AppTimeline.vue +22 -0
  187. package/src/modules/components/AppTimeline/AppTimelineItem.vue +97 -0
  188. package/src/modules/components/AppTimeline/AppTimelineItemIcon.vue +55 -0
  189. package/src/modules/components/AppTimeline/__mocks__/timeline.ts +29 -0
  190. package/src/modules/components/AppTimeline/__tests__/app-timeline-item-Icon.spec.ts +35 -0
  191. package/src/modules/components/AppTimeline/__tests__/app-timeline-item.spec.ts +121 -0
  192. package/src/modules/components/AppTimeline/__tests__/app-timeline.spec.ts +55 -0
  193. package/src/modules/components/AppTimeline/index.d.ts +30 -0
  194. package/src/modules/components/AppTimeline/index.ts +13 -0
  195. package/src/modules/components/AppToggle/AppToggle.vue +36 -0
  196. package/src/modules/components/AppToggle/__tests__/app-toggle.spec.ts +54 -0
  197. package/src/modules/components/AppToggle/index.d.ts +3 -0
  198. package/src/modules/components/AppToggleCard/AppToggleCard.vue +45 -0
  199. package/src/modules/components/AppToggleCard/__tests__/app-toggle-card.spec.ts +55 -0
  200. package/src/modules/components/index.ts +43 -0
  201. package/src/modules/composables/index.ts +14 -0
  202. package/src/modules/composables/useActionBar/__mocks__/index.ts +17 -0
  203. package/src/modules/composables/useActionBar/__tests__/index.spec.ts +62 -0
  204. package/src/modules/composables/useActionBar/index.d.ts +1 -0
  205. package/src/modules/composables/useActionBar/index.ts +67 -0
  206. package/src/modules/composables/useComputedPosition/index.d.ts +16 -0
  207. package/src/modules/composables/useComputedPosition/index.ts +199 -0
  208. package/src/modules/composables/useConfirm/__tests__/index.spec.ts +29 -0
  209. package/src/modules/composables/useConfirm/index.ts +63 -0
  210. package/src/modules/composables/useContextMenu/index.ts +127 -0
  211. package/src/modules/composables/useDrawer/__tests__/index.spec.ts +34 -0
  212. package/src/modules/composables/useDrawer/index.ts +136 -0
  213. package/src/modules/composables/useEcho/index.ts +167 -0
  214. package/src/modules/composables/useError/__tests__/index.spec.ts +29 -0
  215. package/src/modules/composables/useError/index.ts +61 -0
  216. package/src/modules/composables/useFocusTrap/index.d.ts +3 -0
  217. package/src/modules/composables/useFocusTrap/index.ts +98 -0
  218. package/src/modules/composables/useGoogleApi/__tests__/index.spec.ts +39 -0
  219. package/src/modules/composables/useGoogleApi/index.ts +26 -0
  220. package/src/modules/composables/useLayout/__tests__/index.spec.ts +34 -0
  221. package/src/modules/composables/useLayout/index.d.ts +1 -0
  222. package/src/modules/composables/useLayout/index.ts +68 -0
  223. package/src/modules/composables/useModal/__tests__/index.spec.ts +34 -0
  224. package/src/modules/composables/useModal/index.ts +97 -0
  225. package/src/modules/composables/useNavigation/__mocks__/navigation.ts +22 -0
  226. package/src/modules/composables/useNavigation/__tests__/index.spec.ts +88 -0
  227. package/src/modules/composables/useNavigation/index.d.ts +17 -0
  228. package/src/modules/composables/useNavigation/index.ts +97 -0
  229. package/src/modules/icons/BuildingCircleCheck.vue +32 -0
  230. package/src/modules/icons/BuildingCircleXmark.vue +20 -0
  231. package/src/modules/icons/CarsIcon.vue +29 -0
  232. package/src/modules/icons/ChatPersonRoundedIcon.vue +184 -0
  233. package/src/modules/icons/CompanyIcon.vue +18 -0
  234. package/src/modules/icons/HeroGirlIcon.vue +246 -0
  235. package/src/modules/icons/HeroPersonIcon.vue +402 -0
  236. package/src/modules/icons/HeroPersonRoundedIcon.vue +412 -0
  237. package/src/modules/icons/HeroPersonWithBgIcon.vue +4503 -0
  238. package/src/modules/icons/LocationMarkerIcon.vue +33 -0
  239. package/src/modules/icons/PartyPopperIcon.vue +146 -0
  240. package/src/modules/icons/index.ts +32 -0
  241. package/src/modules/icons/status/ErrorIcon.vue +24 -0
  242. package/src/modules/icons/status/SuccessIcon.vue +24 -0
  243. package/src/modules/icons/status/WarningIcon.vue +27 -0
  244. package/src/modules/icons/status/index.ts +3 -0
  245. package/src/modules/index.ts +8 -0
  246. package/src/modules/layouts/Auth/Auth.vue +36 -0
  247. package/src/modules/layouts/Auth/__tests__/auth.spec.ts +63 -0
  248. package/src/modules/layouts/Base/Base.vue +69 -0
  249. package/src/modules/layouts/Base/__tests__/base.spec.ts +56 -0
  250. package/src/modules/layouts/Platform/Platform.vue +96 -0
  251. package/src/modules/layouts/Platform/__tests__/platform.spec.ts +56 -0
  252. package/src/modules/layouts/index.ts +9 -0
  253. package/src/modules/plugins/Sentry/index.d.ts +16 -0
  254. package/src/modules/plugins/Sentry/index.ts +65 -0
  255. package/src/modules/plugins/Sentry/language/nl.ts +13 -0
  256. package/src/modules/plugins/TinyMCE/lang/nl.js +430 -0
  257. package/src/modules/plugins/Toast/Toast.vue +58 -0
  258. package/src/modules/plugins/Toast/__tests__/toast.spec.ts +90 -0
  259. package/src/modules/plugins/Toast/index.ts +36 -0
  260. package/src/modules/plugins/Toast/types.d.ts +265 -0
  261. package/src/modules/plugins/index.ts +63 -0
  262. package/src/stories/Introduction.mdx +4 -0
  263. package/src/stories/assets/code-brackets.svg +1 -0
  264. package/src/stories/assets/colors.svg +1 -0
  265. package/src/stories/assets/comments.svg +1 -0
  266. package/src/stories/assets/direction.svg +1 -0
  267. package/src/stories/assets/flow.svg +1 -0
  268. package/src/stories/assets/images/logo.png +0 -0
  269. package/src/stories/assets/images/road.png +0 -0
  270. package/src/stories/assets/plugin.svg +1 -0
  271. package/src/stories/assets/repo.svg +1 -0
  272. package/src/stories/assets/stackalt.svg +1 -0
  273. package/src/stories/components/ActionBar/ActionBar.stories.ts +67 -0
  274. package/src/stories/components/Alert/Alert.stories.ts +53 -0
  275. package/src/stories/components/Avatar/Avatar.stories.ts +44 -0
  276. package/src/stories/components/BackButton/BackButton.stories.ts +39 -0
  277. package/src/stories/components/Badge/Badge.stories.ts +42 -0
  278. package/src/stories/components/Button/Button.stories.ts +132 -0
  279. package/src/stories/components/Card/Card.stories.ts +70 -0
  280. package/src/stories/components/Color/Color.stories.ts +41 -0
  281. package/src/stories/components/ColorCard/ColorCard.stories.ts +43 -0
  282. package/src/stories/components/Confirm/Confirm.stories.ts +110 -0
  283. package/src/stories/components/ContextMenu/ContextMenu.stories.ts +85 -0
  284. package/src/stories/components/DefinitionList/DefinitionList.stories.ts +32 -0
  285. package/src/stories/components/Disclosure/Disclosure.stories.ts +61 -0
  286. package/src/stories/components/DropdownButton/DropdownButton.stories.ts +121 -0
  287. package/src/stories/components/Error/Error.stories.ts +106 -0
  288. package/src/stories/components/ImageDropzone/ImageDropzone.stories.ts +41 -0
  289. package/src/stories/components/Input/Input.stories.ts +180 -0
  290. package/src/stories/components/Input/LocationInput.stories.ts +77 -0
  291. package/src/stories/components/LicensePlate/LicensePlate.stories.ts +39 -0
  292. package/src/stories/components/Maps/Maps.stories.ts +36 -0
  293. package/src/stories/components/Menu/Menu.stories.ts +41 -0
  294. package/src/stories/components/Modal/Modal.stories.ts +68 -0
  295. package/src/stories/components/Navigation/Navigation.stories.ts +62 -0
  296. package/src/stories/components/Pagination/Pagination.stories.ts +62 -0
  297. package/src/stories/components/ProgressBar/ProgressBar.stories.ts +48 -0
  298. package/src/stories/components/Rating/Rating.stories.ts +38 -0
  299. package/src/stories/components/Section/Section.stories.ts +44 -0
  300. package/src/stories/components/Select/Select.stories.ts +90 -0
  301. package/src/stories/components/Stepper/Stepper.stories.ts +38 -0
  302. package/src/stories/components/Table/DataTable.stories.ts +96 -0
  303. package/src/stories/components/Table/Table.stories.ts +45 -0
  304. package/src/stories/components/Timeline/Timeline.stories.ts +46 -0
  305. package/src/stories/components/Toast/Toast.stories.ts +47 -0
  306. package/src/stories/components/Toggle/Toggle.stories.ts +41 -0
  307. package/src/stories/components/ToggleCard/ToggleCard.stories.ts +43 -0
  308. package/src/stories/layouts/Auth.stories.ts +43 -0
  309. package/src/stories/layouts/Base.stories.ts +70 -0
  310. package/src/tests/mocks/resize-observer.ts +13 -0
  311. package/src/tests/stubs/AppSelect.ts +89 -0
  312. package/src/tests/stubs/HeadlessUiDialogStub.ts +24 -0
  313. package/src/tests/stubs/HeadlessUiTransitionChildStub.ts +20 -0
  314. package/src/tests/stubs/HeadlessUiTransitionRootStub.ts +25 -0
  315. package/src/tests/stubs/IconStub.ts +9 -0
  316. package/src/tests/stubs/Vue3EasyDataTableStub.ts +53 -0
  317. package/src/typings/plugin.d.ts +5 -0
  318. package/src/typings/shims-vue.d.ts +13 -0
  319. package/src/typings/utilities.d.ts +4 -0
  320. package/src/typings/vite-environment.d.ts +12 -0
@@ -0,0 +1,279 @@
1
+ # Star Rating Component for Vue 2.x / 3.x
2
+
3
+ [![Build Status](https://travis-ci.org/craigh411/vue-star-rating.svg?branch=master)](https://travis-ci.org/craigh411/vue-star-rating)
4
+ [![npm](https://img.shields.io/npm/dt/vue-star-rating.svg)]()
5
+
6
+ A simple, highly customisable star rating component for Vue 2.x. / 3.x
7
+
8
+ > Need more than stars? Check out [vue-rate-it](https://github.com/craigh411/vue-rate-it) with hundreds of different raters built in!
9
+
10
+ ### Screenshot
11
+
12
+ ![star-rating.png](https://user-images.githubusercontent.com/13747552/76623388-4ee74580-652b-11ea-9efb-5fb0ca548980.png)
13
+
14
+ #### See it in action:
15
+ - [Vue 2 Examples](https://jsfiddle.net/craig_h_411/992o7cq5/)
16
+ - [Vue 3 Examples](https://codepen.io/craigh411/pen/abNXVQN)
17
+
18
+ ## Features:
19
+
20
+ - SVG stars - scale without loss of quality.
21
+ - Customisable rating increments.
22
+ - Customisable colors.
23
+ - Customisable number of stars.
24
+ - Create read-only stars.
25
+
26
+ ## Usage
27
+
28
+ ### Install Via NPM
29
+
30
+
31
+ Install via npm:
32
+
33
+ #### Vue 2.x Install
34
+
35
+ `npm install vue-star-rating`
36
+
37
+ #### Vue 3.x Install
38
+
39
+ If you're using Vue 3 you will currently need to install the `next` version of `vue-star-rating`
40
+
41
+ `npm install vue-star-rating@next`
42
+
43
+ ---
44
+
45
+ Once installed import in to your component:
46
+
47
+ `import StarRating from 'vue-star-rating'`
48
+
49
+ Then register `vue-star-rating` using the components option:
50
+
51
+ ```javascript
52
+ components: {
53
+ StarRating
54
+ }
55
+ ```
56
+
57
+ You can then use the following markup in your project:
58
+
59
+ `<star-rating />`
60
+
61
+ ---
62
+
63
+ ### Via CDN
64
+
65
+ You may also include `vue-star-rating` directly in to your webpage via Unpkg. Simply add the following script tag:
66
+
67
+ #### Vue 2.x
68
+
69
+ ```javascript
70
+ <script src="https://unpkg.com/vue-star-rating/dist/VueStarRating.umd.min.js"></script>`
71
+ ```
72
+
73
+ You will need to register the component by doing:
74
+
75
+ ```javascript
76
+ Vue.component('star-rating', VueStarRating.default);
77
+ ```
78
+
79
+ #### Vue 3.x
80
+
81
+ ```javascript
82
+ <script src="https://unpkg.com/vue-star-rating@next/dist/VueStarRating.umd.min.js"></script>
83
+ ````
84
+
85
+ ```javascript
86
+ const app = Vue.createApp({
87
+ // Your component code
88
+ })
89
+ app.component('star-rating', VueStarRating.default)
90
+ app.mount('#app')
91
+ ```
92
+
93
+
94
+ ## Getting Started
95
+
96
+ To get started with `vue-star-rating` you will want to sync the rating values between the component and parent, you can then take a look at the props and custom events section of the docs to customise your `star-rating` component.
97
+
98
+ ### Syncing Rating Values with V-Model
99
+
100
+ `vue-star-rating` supports `v-model`, which is the simplest way to keep your ratings in sync:
101
+
102
+ #### Vue 2.2+
103
+
104
+ ```HTML
105
+ <star-rating v-model="rating"></star-rating>
106
+ ```
107
+
108
+ #### Vue 3.x
109
+
110
+ v-model works on the `rating` prop, so if you're using **Vue 3** you will need to do:
111
+
112
+ ```HTML
113
+ <star-rating v-model:rating="rating"></star-rating>
114
+ ```
115
+
116
+ ## Docs
117
+
118
+ ### Props
119
+
120
+ The following props can be passed to the component:
121
+
122
+ #### General Props
123
+
124
+ These props provide general functionailty to the star rating component
125
+
126
+ | Prop | Description | Type | Default |
127
+ | ------------- | ------------- |-------------|-------------|
128
+ | increment | The rating increment, for example pass 0.5 for half stars or 0.01 for fluid stars. Expects a number between 0.01 - 1. | Number | 1
129
+ | rating | The initial rating, this will automatically round to the closest increment, so for the most accurate rating pass 0.01 as increment or set the `round-start-rating` prop to false | Number | 0 |
130
+ | max-rating | The maximum rating, this lets `vue-star-rating` know how many stars to display | Number | 5 |
131
+ | star-points | The points defining a custom star shape.<br><small>_If no points are passed the default star shape is used._</small> | Array| [] |
132
+ | read-only | When set to true, the rating cannot be edited. Use in conjuction with `increment` to define rounding precision. | Boolean | false |
133
+ | show-rating | Whether or not to show the rating next to the stars | Boolean | true |
134
+ | fixed-points | Specify a fixed number of digits after the decimal point. | Number | null |
135
+ | rtl | Pass true to display star rating using rtl (right-to-left) | Boolean | false |
136
+ | round-start-rating | Pass false if you don't want the start rating value to round to the closest increment. The user will still only be able to select based on the given increment. | Boolean | true |
137
+ | clearable | When set to true a second click on the same rating clears the rating | Boolean | false |
138
+ | active-on-click | When set to true only apply active colors when the user clicks the star, rather than on mouseover. | Boolean | false |
139
+
140
+
141
+ #### Style Props
142
+
143
+ These props are used to style the star rating component
144
+
145
+
146
+ | Prop | Description | Type | Default |
147
+ | ------------- | ------------- |-------------|-------------|
148
+ | star-size | The size of each star, this gets passed to the `SVG` width attribute, so larger numbers are larger stars | Number | 50 |
149
+ | inactive-color | The color of the non-highlighted portion of a star. | String | #d8d8d8 |
150
+ | active-color | The color of the highlighted portion of a star. Pass an array of colors to color each star individually | String &#124; Array | #ffd055 |
151
+ | border-color | Sets the colour of the border for each star | String | #999 |
152
+ | active-border-color | The border color of a highlighted star. Pass an array of colors to color each star's border individually | String &#124; Array | null |
153
+ | border-width | Sets the width of the border for each star | Number | 0 |
154
+ | animate | Set to true for an animation to be applied on mouseover | Boolean | false |
155
+ | padding | Pads the right of each star so distance between stars can be altered | Number | 0 |
156
+ | rounded-corners | Whether or not to round the star's corners | Boolean | false |
157
+ | inline | Sets the star rating to display inline | Boolean | false |
158
+ | glow | Adds a subtle glow around each active star, this should be a number to spread the glow | Number | 0 |
159
+ | glow-color | Sets the color for the glow | String | #fff |
160
+ | text-class | A css class name to style the rating text for a specific star rating component | String | '' |
161
+
162
+ **Important:** Vue requires you to pass numbers and boolean values using `v-bind`, any props that require a number or bool should use `v-bind:` or the colon (`:`) shorthand.
163
+
164
+
165
+ #### Props Example
166
+
167
+ ```HTML
168
+ <star-rating v-bind:increment="0.5"
169
+ v-bind:max-rating="3"
170
+ inactive-color="#000"
171
+ active-color="#f00"
172
+ v-bind:star-size="90">
173
+ </star-rating>
174
+ ```
175
+
176
+ #### Passing an Array of Colors
177
+
178
+ The `active-color` and `active-border-color` props also accept an array of colors. The colors in the array will be applied to the stars in order, so index 0 will be the color of the first star, index 1 will be the second and so on.
179
+ Any array you pass will be padded if the number of elements in the array is less than the number of stars. This means that the following code will color the first star red and *ALL* remaining stars black.
180
+
181
+
182
+ ```HTML
183
+ <star-rating :active-color="['red','black']">
184
+ </star-rating>
185
+ ```
186
+
187
+
188
+ ### Custom Events
189
+
190
+ `vue-star-rating` fires the following custom events, simply use `v-on:` or the `@` shortand to capture the event.
191
+
192
+ ### Vue 2.x Events
193
+
194
+ | Event | Description | Return Value
195
+ | ------------- | ------------- |-----------|
196
+ | rating-selected | Returns the rating the user selects via the click event | rating
197
+ | current-rating | Returns the rating that the users mouse is currently over | rating
198
+
199
+ #### Vue 2.x Example
200
+
201
+ ```HTML
202
+ <star-rating @rating-selected ="setRating"></star-rating>
203
+ ```
204
+
205
+ Then in your view model:
206
+
207
+ ```javascript
208
+ new Vue({
209
+ el: '#app',
210
+ methods: {
211
+ setRating: function(rating){
212
+ this.rating= rating;
213
+ }
214
+ },
215
+ data: {
216
+ rating: 0
217
+ }
218
+ });
219
+ ```
220
+
221
+ ### Vue 3.x Events
222
+
223
+ Some changes have been made to event names in Vue 3
224
+
225
+ | Event | Description | Return Value
226
+ | ------------- | ------------- |-----------|
227
+ | update:rating | Returns the rating the user selects via the click event | rating
228
+ | hover:rating | Returns the rating that the users mouse is currently over | rating
229
+
230
+
231
+ #### Vue 3.x Example
232
+
233
+ ```HTML
234
+ <star-rating @update:rating ="setRating"></star-rating>
235
+ ```
236
+
237
+ Then in your view model:
238
+
239
+ ```javascript
240
+ const app = Vue.createApp({
241
+ methods: {
242
+ setRating(rating){
243
+ this.rating= rating;
244
+ }
245
+ },
246
+ data: {
247
+ rating: 0
248
+ }
249
+ })
250
+ app.component('star-rating', VueStarRating.default)
251
+ app.mount('#app')
252
+
253
+ ```
254
+
255
+ ### Screen Reader Support
256
+
257
+ `vue-star-rating` has built in support for screen readers. By default this message will read "Rated {{rating}} out of {{maxRating}} stars", you can change this by using the `screen-reader` scoped slot:
258
+
259
+
260
+ ````javascript
261
+ <star-rating>
262
+ <template v-slot:screen-reader="slotProps">
263
+ This product has been rated {{slotProps.rating}} out of {{slotProps.stars}} stars
264
+ </template>
265
+ </star-rating>
266
+ ````
267
+
268
+ ### IE9 Support
269
+
270
+ `vue-star-rating` supports IE 9+; make sure you place the following in the `head` of your webpage to ensure that IE is in standards mode:
271
+
272
+ `<meta http-equiv="X-UA-Compatible" content="IE=Edge">`
273
+
274
+
275
+ ------------------------------------------------
276
+
277
+ Open-source should always be 100% FREE! but, if you're feeling generous, feel free to:
278
+
279
+ <a href="https://www.buymeacoffee.com/fkocI2e6H" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
@@ -0,0 +1,36 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { shallowMount } from '@vue/test-utils';
3
+ import StarRating from '../VueStarRating/StarRating.vue';
4
+ import AppRating from '../AppRating.vue';
5
+
6
+ import type { VueWrapper } from '@vue/test-utils';
7
+
8
+ function createWrapper(): VueWrapper<InstanceType<typeof AppRating>> {
9
+ return shallowMount(AppRating, {
10
+ props: { modelValue: 5 },
11
+ slots: { default: '<div data-test-default-slot></div>' },
12
+ });
13
+ }
14
+
15
+ describe('the AppRating component', () => {
16
+ it('renders the default slot', () => {
17
+ const wrapper = createWrapper();
18
+
19
+ const slot = wrapper.find('[data-test-default-slot]');
20
+ expect(slot.exists()).toBe(true);
21
+ });
22
+
23
+ it('should emit when StarRating component modelValue changes', async () => {
24
+ expect.assertions(3);
25
+
26
+ const wrapper = createWrapper();
27
+
28
+ const starRating = wrapper.findComponent(StarRating);
29
+ expect(starRating.exists()).toBe(true);
30
+ expect(starRating.props('rating')).toBe(5);
31
+
32
+ await starRating.vm.$emit('update:rating', 4.5);
33
+
34
+ expect(wrapper.emitted('update:modelValue')).toStrictEqual([[4.5]]);
35
+ });
36
+ });
@@ -0,0 +1,35 @@
1
+ <script lang="ts" setup>
2
+ defineProps<{ title?: string; description?: string }>();
3
+ </script>
4
+
5
+ <template>
6
+ <section class="flex flex-col space-y-4 border-b border-zinc-200 py-8 lg:flex-row lg:space-x-10 lg:space-y-0">
7
+ <div class="flex shrink-0 flex-col lg:w-80 lg:space-y-1">
8
+ <slot name="titleDescription">
9
+ <slot name="title">
10
+ <h3
11
+ v-if="title"
12
+ class="text-xl font-bold text-zinc-900"
13
+ data-test-title
14
+ >
15
+ {{ title }}
16
+ </h3>
17
+ </slot>
18
+
19
+ <slot name="description">
20
+ <p
21
+ v-if="description"
22
+ class="text-zinc-700"
23
+ data-test-description
24
+ >
25
+ {{ description }}
26
+ </p>
27
+ </slot>
28
+ </slot>
29
+ </div>
30
+
31
+ <div class="w-full min-w-0">
32
+ <slot></slot>
33
+ </div>
34
+ </section>
35
+ </template>
@@ -0,0 +1,53 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { shallowMount } from '@vue/test-utils';
3
+ import AppSection from '../AppSection.vue';
4
+
5
+ import type { ComponentMountingOptions } from '@vue/test-utils';
6
+
7
+ function createWrapper(
8
+ slots: ComponentMountingOptions<typeof AppSection>['slots'] = {},
9
+ props: ComponentMountingOptions<typeof AppSection>['props'] = { title: 'title text', description: 'description' },
10
+ ) {
11
+ return shallowMount(AppSection, {
12
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
13
+ props,
14
+ slots,
15
+ });
16
+ }
17
+
18
+ describe('the AppSection component', () => {
19
+ it('should hide the optional elements by default', () => {
20
+ const wrapper = createWrapper({}, { title: undefined, description: undefined });
21
+
22
+ expect(wrapper.find('[data-test-title]').exists()).toBe(false);
23
+ expect(wrapper.find('[data-test-description]').exists()).toBe(false);
24
+ });
25
+
26
+ it('should show title by prop', () => {
27
+ const wrapper = createWrapper();
28
+
29
+ expect(wrapper.find('[data-test-title]').exists()).toBe(true);
30
+ expect(wrapper.find('[data-test-title]').text()).toBe('title text');
31
+ });
32
+
33
+ it('should show description by prop', () => {
34
+ const wrapper = createWrapper();
35
+
36
+ expect(wrapper.find('[data-test-description]').exists()).toBe(true);
37
+ expect(wrapper.find('[data-test-description]').text()).toBe('description');
38
+ });
39
+
40
+ it('should show default slot content', () => {
41
+ const wrapper = createWrapper({ default: '<p data-test-slot>slot text</p>' });
42
+
43
+ expect(wrapper.find('[data-test-slot]').exists()).toBe(true);
44
+ });
45
+
46
+ it('should hide title and description when slot override', () => {
47
+ const wrapper = createWrapper({ titleDescription: '<p data-test-slot>slot text</p>' });
48
+
49
+ expect(wrapper.find('[data-test-title]').exists()).toBe(false);
50
+ expect(wrapper.find('[data-test-description]').exists()).toBe(false);
51
+ expect(wrapper.find('[data-test-slot]').exists()).toBe(true);
52
+ });
53
+ });
@@ -0,0 +1,176 @@
1
+ <script lang="ts" setup>
2
+ import { computed, isRef, onMounted, unref, useSlots, useTemplateRef } from 'vue';
3
+ import Multiselect from '@vueform/multiselect';
4
+ import { useStorage } from '@vueuse/core';
5
+ import { AppInputLabel } from '~components';
6
+ import { classes, getSlotClasses } from '.';
7
+
8
+ import type { MultiSelectSlots, TagSlotProps, Props } from './index.d';
9
+
10
+ const props = withDefaults(defineProps<Props>(), {
11
+ wrapperClasses: undefined,
12
+ errorMessage: undefined,
13
+ label: undefined,
14
+ optionLabel: 'name',
15
+ fetchOnOpen: false,
16
+ openDirection: 'down',
17
+ dropdownClasses: undefined,
18
+ additionalClasses: undefined,
19
+ labelClasses: undefined,
20
+ searchable: false,
21
+ cacheable: false,
22
+ });
23
+
24
+ const slots = useSlots();
25
+ const multiSelect = useTemplateRef<Multiselect>('select');
26
+ const storage = useStorage('app-select', [], sessionStorage);
27
+
28
+ const filteredSlots = computed((): MultiSelectSlots[] => {
29
+ return (Object.keys(slots) as unknown as MultiSelectSlots[]).filter(slot => slot !== 'tag');
30
+ });
31
+ const selectClasses = computed(() => {
32
+ const classesCloned = { ...classes };
33
+
34
+ if (props.openDirection === 'up') {
35
+ classesCloned.dropdown = `${classes.dropdown} ${classes.dropdownTop}`;
36
+ classesCloned.containerOpen = `${classes.containerOpenTop}`;
37
+ }
38
+
39
+ if (props.dropdownClasses) {
40
+ classesCloned.dropdown = `${classesCloned.dropdown} ${props.dropdownClasses}`;
41
+ }
42
+
43
+ if (props.hasError) {
44
+ classesCloned.container = `${classesCloned.container} border-error! focus:ring-error focus:border-error`;
45
+ }
46
+
47
+ Object.entries(props.additionalClasses ?? {}).forEach(([key, value]) => {
48
+ if (key in classesCloned) {
49
+ classesCloned[key] = `${classesCloned[key]} ${value}`;
50
+ }
51
+ });
52
+
53
+ return classesCloned;
54
+ });
55
+
56
+ onMounted(() => {
57
+ if (props.cacheable) {
58
+ const values = Object.values(multiSelect.value?.modelValue ?? {});
59
+ const valueProp = multiSelect.value?.valueProp ?? 'value';
60
+
61
+ storage.value.filter(value => {
62
+ return values.includes(value[valueProp]) || values.includes(`${value[valueProp]}`);
63
+ })?.forEach(value => {
64
+ multiSelect.value?.select(value);
65
+ });
66
+ }
67
+ });
68
+
69
+ function wrap(value): unknown[] {
70
+ if (!value) {
71
+ return [];
72
+ }
73
+
74
+ if (isRef(value)) {
75
+ return Array.isArray(value.value) ? value.value : [value.value];
76
+ }
77
+
78
+ return Array.isArray(value) ? value : [value];
79
+ }
80
+
81
+ function onChangeSelect(value, select): void {
82
+ props.onChange?.(value);
83
+
84
+ // @ts-expect-error type not defined
85
+ storage.value = wrap(unref(select.iv));
86
+ }
87
+
88
+ defineOptions({ inheritAttrs: false });
89
+ </script>
90
+
91
+ <template>
92
+ <div :class="wrapperClasses">
93
+ <AppInputLabel
94
+ v-if="label || $slots.label"
95
+ :has-error="hasError"
96
+ :class="labelClasses"
97
+ >
98
+ <slot name="label">
99
+ {{ label }}
100
+ </slot>
101
+ </AppInputLabel>
102
+
103
+ <Multiselect
104
+ :native="false"
105
+ :classes="selectClasses"
106
+ :searchable="props.searchable"
107
+ v-bind="{ ...$attrs, ...{ ref: 'select', label: props.optionLabel, onChange: props.onChange } }"
108
+ @open="(select: unknown) => {
109
+ // @ts-expect-error type not defined
110
+ if (fetchOnOpen && select?.noOptions) {
111
+ // @ts-expect-error type not defined
112
+ select?.resolveOptions?.()
113
+ }
114
+ }"
115
+ @change="onChangeSelect"
116
+ >
117
+ <template
118
+ v-for="(slot, index) of filteredSlots"
119
+ :key="index"
120
+ #[slot]="slotProps"
121
+ >
122
+ <slot
123
+ :name="slot"
124
+ v-bind="{ ...(slotProps as Object | undefined ? slotProps : {}), classes: getSlotClasses(slot) }"
125
+ ></slot>
126
+ </template>
127
+
128
+ <template #tag="slotProps: TagSlotProps">
129
+ <div :class="classes.tag">
130
+ <slot
131
+ name="tag"
132
+ v-bind="slotProps"
133
+ >
134
+ <span :class="classes.tagText">{{ slotProps.option?.[optionLabel] }}</span>
135
+ </slot>
136
+
137
+ <span
138
+ v-if="!slotProps.disabled"
139
+ :class="classes.tagRemove"
140
+ @click="(event: Event) => slotProps.handleTagRemove(slotProps.option, event)"
141
+ >
142
+ <span :class="classes.tagRemoveIcon"></span>
143
+ </span>
144
+ </div>
145
+ </template>
146
+ </Multiselect>
147
+
148
+ <p
149
+ v-if="hasError && errorMessage"
150
+ class="order-2 mt-1.5 flex items-center gap-x-1 text-xs italic text-error"
151
+ data-test-error-message
152
+ >
153
+ {{ errorMessage }}
154
+ </p>
155
+ </div>
156
+ </template>
157
+
158
+ <style>
159
+ @reference "./../../../css/main.css";
160
+
161
+ .multiselect-wrapper {
162
+ @apply relative mx-auto w-full flex items-center justify-end box-border cursor-pointer outline-hidden min-h-[42px];
163
+ }
164
+
165
+ .multiselect-assistive-text {
166
+ @apply hidden;
167
+ }
168
+
169
+ .app-select::-webkit-scrollbar {
170
+ @apply rounded-br-lg;
171
+ }
172
+
173
+ .app-select::-webkit-scrollbar-track {
174
+ @apply rounded-br-lg;
175
+ }
176
+ </style>
@@ -0,0 +1,24 @@
1
+ export const simpleOptions = {
2
+ batman: 'Batman',
3
+ robin: 'Robin',
4
+ joker: 'Joker',
5
+ spiderman: 'Spiderman',
6
+ captainAmerica: 'Captain America',
7
+ };
8
+
9
+ export const groupOptions = [
10
+ {
11
+ label: 'DC',
12
+ options: ['Batman', 'Robin', 'Joker'],
13
+ },
14
+ {
15
+ label: 'Marvel',
16
+ options: ['Spiderman', 'Iron Man', 'Captain America'],
17
+ },
18
+ ];
19
+
20
+ export const asyncOptions = async () => {
21
+ await new Promise(resolve => { setTimeout(resolve, 500); });
22
+
23
+ return simpleOptions;
24
+ };
@@ -0,0 +1,73 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { shallowMount } from '@vue/test-utils';
3
+ import Multiselect from '@vueform/multiselect';
4
+ import { AppInputLabel } from '~components';
5
+ import AppSelect from '../AppSelect.vue';
6
+
7
+ import type { ComponentMountingOptions, VueWrapper } from '@vue/test-utils';
8
+ import type { Props } from '~components/AppSelect/index.d';
9
+
10
+ function createWrapper(
11
+ props?: Partial<Props> & Record<string, unknown>,
12
+ slots?: ComponentMountingOptions<typeof AppSelect>['slots'],
13
+ ): VueWrapper<InstanceType<typeof AppSelect>> {
14
+ return shallowMount(AppSelect, { props, slots });
15
+ }
16
+
17
+ describe('the AppSelect component', () => {
18
+ it('should not render a AppInputLabel when label not provided', () => {
19
+ const wrapper = createWrapper();
20
+
21
+ const inputLabel = wrapper.findComponent(AppInputLabel);
22
+ expect(inputLabel.exists()).toBe(false);
23
+ });
24
+
25
+ it('should render a AppInputLabel when label provided by prop', () => {
26
+ const wrapper = createWrapper({
27
+ label: 'label by prop',
28
+ });
29
+
30
+ const inputLabel = wrapper.findComponent(AppInputLabel);
31
+ expect(inputLabel.exists()).toBe(true);
32
+ expect(inputLabel.text()).toBe('label by prop');
33
+ });
34
+
35
+ it('should render a AppInputLabel when label provided by slot', () => {
36
+ const wrapper = createWrapper({}, {
37
+ label: 'label by slot',
38
+ });
39
+
40
+ const inputLabel = wrapper.findComponent(AppInputLabel);
41
+ expect(inputLabel.exists()).toBe(true);
42
+ expect(inputLabel.text()).toBe('label by slot');
43
+ });
44
+
45
+ it('can render the multiselect with props', () => {
46
+ const options = ['item 1', 'item 2'];
47
+ const mode = 'tags';
48
+ const wrapper = createWrapper({
49
+ options,
50
+ mode,
51
+ });
52
+
53
+ const multiSelect = wrapper.findComponent(Multiselect);
54
+ expect(multiSelect.exists()).toBe(true);
55
+ expect(multiSelect.props('options')).toStrictEqual(options);
56
+ expect(multiSelect.props('mode')).toBe('tags');
57
+ });
58
+
59
+ it('should not render the errors when error not provided', () => {
60
+ const wrapper = createWrapper();
61
+
62
+ const errorMessage = wrapper.find('[data-test-error-message]');
63
+ expect(errorMessage.exists()).toBe(false);
64
+ });
65
+
66
+ it('should render the errors when errors provided', () => {
67
+ const wrapper = createWrapper({ hasError: true, errorMessage: 'error' });
68
+
69
+ const errorMessage = wrapper.find('[data-test-error-message]');
70
+ expect(errorMessage.exists()).toBe(true);
71
+ expect(errorMessage.text()).toBe('error');
72
+ });
73
+ });