@farm-investimentos/front-mfe-components-vue3 0.0.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 (437) hide show
  1. package/README.md +35 -0
  2. package/dist/demo.html +10 -0
  3. package/dist/front-mfe-components.common.js +17771 -0
  4. package/dist/front-mfe-components.common.js.map +1 -0
  5. package/dist/front-mfe-components.css +1 -0
  6. package/dist/front-mfe-components.umd.js +17781 -0
  7. package/dist/front-mfe-components.umd.js.map +1 -0
  8. package/dist/front-mfe-components.umd.min.js +2 -0
  9. package/dist/front-mfe-components.umd.min.js.map +1 -0
  10. package/package.json +91 -0
  11. package/src/components/AlertBox/AlertBox.scss +52 -0
  12. package/src/components/AlertBox/AlertBox.stories.js +79 -0
  13. package/src/components/AlertBox/AlertBox.vue +127 -0
  14. package/src/components/AlertBox/__tests__/AlertBox.spec.js +32 -0
  15. package/src/components/AlertBox/__tests__/valueWatcher.spec.js +15 -0
  16. package/src/components/AlertBox/index.ts +4 -0
  17. package/src/components/AlertBox/valueWatcher.ts +10 -0
  18. package/src/components/AlertReload/AlertReload.scss +33 -0
  19. package/src/components/AlertReload/AlertReload.stories.js +34 -0
  20. package/src/components/AlertReload/AlertReload.vue +46 -0
  21. package/src/components/AlertReload/__tests__/AlertReload.spec.js +18 -0
  22. package/src/components/AlertReload/index.ts +4 -0
  23. package/src/components/ButtonToggle/ButtonToggle.scss +14 -0
  24. package/src/components/ButtonToggle/ButtonToggle.stories.js +50 -0
  25. package/src/components/ButtonToggle/ButtonToggle.vue +53 -0
  26. package/src/components/ButtonToggle/IButtonToggle.ts +5 -0
  27. package/src/components/ButtonToggle/__tests__/ButtonToggle.spec.js +35 -0
  28. package/src/components/ButtonToggle/index.ts +4 -0
  29. package/src/components/Buttons/ConfirmButton/ConfirmButton.stories.js +50 -0
  30. package/src/components/Buttons/ConfirmButton/ConfirmButton.vue +33 -0
  31. package/src/components/Buttons/ConfirmButton/__tests__/ConfirmButton.spec.js +14 -0
  32. package/src/components/Buttons/ConfirmButton/index.ts +4 -0
  33. package/src/components/Buttons/DangerButton/DangerButton.stories.js +49 -0
  34. package/src/components/Buttons/DangerButton/DangerButton.vue +32 -0
  35. package/src/components/Buttons/DangerButton/__tests__/DangerButton.spec.js +14 -0
  36. package/src/components/Buttons/DangerButton/index.ts +4 -0
  37. package/src/components/Buttons/DefaultButton/Buttons.stories.scss +10 -0
  38. package/src/components/Buttons/DefaultButton/DefaultButton.scss +328 -0
  39. package/src/components/Buttons/DefaultButton/DefaultButton.stories.js +317 -0
  40. package/src/components/Buttons/DefaultButton/DefaultButton.vue +128 -0
  41. package/src/components/Buttons/DefaultButton/__tests__/DefaultButton.spec.js +32 -0
  42. package/src/components/Buttons/DefaultButton/index.ts +4 -0
  43. package/src/components/Buttons/ExportButton/ExportButton.stories.js +40 -0
  44. package/src/components/Buttons/ExportButton/ExportButton.vue +82 -0
  45. package/src/components/Buttons/ExportButton/__tests__/ExportButton.spec.js +14 -0
  46. package/src/components/Buttons/ExportButton/index.ts +4 -0
  47. package/src/components/Buttons/ImportButton/ImportButton.scss +8 -0
  48. package/src/components/Buttons/ImportButton/ImportButton.stories.js +23 -0
  49. package/src/components/Buttons/ImportButton/ImportButton.vue +35 -0
  50. package/src/components/Buttons/ImportButton/__tests__/ImportButton.spec.js +23 -0
  51. package/src/components/Buttons/ImportButton/index.ts +4 -0
  52. package/src/components/Buttons/MultiImportButton/MultiImportButton.stories.js +35 -0
  53. package/src/components/Buttons/MultiImportButton/MultiImportButton.vue +54 -0
  54. package/src/components/Buttons/MultiImportButton/__tests__/MultiImportButton.spec.js +14 -0
  55. package/src/components/Buttons/MultiImportButton/index.ts +4 -0
  56. package/src/components/Buttons/RemoveButton/RemoveButton.scss +5 -0
  57. package/src/components/Buttons/RemoveButton/RemoveButton.stories.js +17 -0
  58. package/src/components/Buttons/RemoveButton/RemoveButton.vue +44 -0
  59. package/src/components/Buttons/RemoveButton/__tests__/RemoveButton.spec.js +23 -0
  60. package/src/components/Buttons/RemoveButton/index.ts +4 -0
  61. package/src/components/Buttons/ToggleButton/ToggleButton.stories.js +22 -0
  62. package/src/components/Buttons/ToggleButton/ToggleButton.vue +75 -0
  63. package/src/components/Buttons/ToggleButton/__tests__/ToggleButton.spec.js +21 -0
  64. package/src/components/Buttons/ToggleButton/index.ts +4 -0
  65. package/src/components/Card/Card.scss +18 -0
  66. package/src/components/Card/Card.stories.js +40 -0
  67. package/src/components/Card/Card.vue +24 -0
  68. package/src/components/Card/CardComposition.stories.ts +69 -0
  69. package/src/components/Card/CardContent/CardContent.scss +17 -0
  70. package/src/components/Card/CardContent/CardContent.stories.js +47 -0
  71. package/src/components/Card/CardContent/CardContent.vue +39 -0
  72. package/src/components/Card/CardContent/__tests__/CardContent.spec.js +20 -0
  73. package/src/components/Card/CardContent/index.ts +4 -0
  74. package/src/components/Card/__tests__/Card.spec.js +20 -0
  75. package/src/components/Card/index.ts +5 -0
  76. package/src/components/Checkbox/Checkbox.scss +108 -0
  77. package/src/components/Checkbox/Checkbox.stories.js +194 -0
  78. package/src/components/Checkbox/Checkbox.vue +193 -0
  79. package/src/components/Checkbox/__tests__/Checkbox.spec.js +34 -0
  80. package/src/components/Checkbox/__tests__/modelValueWatcher.spec.js +43 -0
  81. package/src/components/Checkbox/index.ts +4 -0
  82. package/src/components/Checkbox/modelValueWatcher.ts +12 -0
  83. package/src/components/Chip/Chip.scss +109 -0
  84. package/src/components/Chip/Chip.stories.js +96 -0
  85. package/src/components/Chip/Chip.stories.scss +13 -0
  86. package/src/components/Chip/Chip.vue +66 -0
  87. package/src/components/Chip/__tests__/Chip.spec.js +20 -0
  88. package/src/components/Chip/index.ts +4 -0
  89. package/src/components/ChipInviteStatus/ChipInviteStatus.stories.js +30 -0
  90. package/src/components/ChipInviteStatus/ChipInviteStatus.vue +38 -0
  91. package/src/components/ChipInviteStatus/__tests__/ChipInviteStatus.spec.js +22 -0
  92. package/src/components/ChipInviteStatus/index.ts +4 -0
  93. package/src/components/ChipInviteStatus/keys.ts +11 -0
  94. package/src/components/Collapsible/Collapsible.scss +48 -0
  95. package/src/components/Collapsible/Collapsible.stories.js +150 -0
  96. package/src/components/Collapsible/Collapsible.vue +189 -0
  97. package/src/components/Collapsible/__tests__/Collapsible.spec.js +38 -0
  98. package/src/components/Collapsible/index.ts +3 -0
  99. package/src/components/ContextMenu/ContextMenu.scss +33 -0
  100. package/src/components/ContextMenu/ContextMenu.stories.js +248 -0
  101. package/src/components/ContextMenu/ContextMenu.vue +250 -0
  102. package/src/components/ContextMenu/__tests__/ContextMenu.spec.js +29 -0
  103. package/src/components/ContextMenu/index.ts +5 -0
  104. package/src/components/CopyToClipboard/CopyToClipboard.stories.js +83 -0
  105. package/src/components/CopyToClipboard/CopyToClipboard.vue +133 -0
  106. package/src/components/CopyToClipboard/__tests__/CopyToClipboard.spec.js +24 -0
  107. package/src/components/CopyToClipboard/index.ts +4 -0
  108. package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.scss +17 -0
  109. package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.stories.js +30 -0
  110. package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.vue +50 -0
  111. package/src/components/DataTableEmptyWrapper/__tests__/DataTableEmptyWrapper.spec.js +20 -0
  112. package/src/components/DataTableEmptyWrapper/index.ts +4 -0
  113. package/src/components/DataTableHeader/DataTableHeader.scss +65 -0
  114. package/src/components/DataTableHeader/DataTableHeader.stories.js +109 -0
  115. package/src/components/DataTableHeader/DataTableHeader.vue +197 -0
  116. package/src/components/DataTableHeader/__tests__/DataTableHeader.spec.js +95 -0
  117. package/src/components/DataTableHeader/index.ts +3 -0
  118. package/src/components/DataTablePaginator/DataTablePaginator.scss +90 -0
  119. package/src/components/DataTablePaginator/DataTablePaginator.stories.js +49 -0
  120. package/src/components/DataTablePaginator/DataTablePaginator.vue +218 -0
  121. package/src/components/DataTablePaginator/__tests__/DataTablePaginator.spec.js +32 -0
  122. package/src/components/DataTablePaginator/index.ts +3 -0
  123. package/src/components/DatePicker/DatePicker.scss +18 -0
  124. package/src/components/DatePicker/DatePicker.stories.js +134 -0
  125. package/src/components/DatePicker/DatePicker.vue +292 -0
  126. package/src/components/DatePicker/__tests__/DatePicker.spec.js +108 -0
  127. package/src/components/DatePicker/customDatePicker.scss +79 -0
  128. package/src/components/DatePicker/index.ts +3 -0
  129. package/src/components/DatePicker/vDatePicker.scss +214 -0
  130. package/src/components/DialogFooter/DialogFooter.scss +34 -0
  131. package/src/components/DialogFooter/DialogFooter.stories.js +49 -0
  132. package/src/components/DialogFooter/DialogFooter.vue +102 -0
  133. package/src/components/DialogFooter/IExtraButton.ts +9 -0
  134. package/src/components/DialogFooter/__tests__/DialogFooter.spec.js +20 -0
  135. package/src/components/DialogFooter/index.ts +3 -0
  136. package/src/components/DialogHeader/DialogHeader.scss +32 -0
  137. package/src/components/DialogHeader/DialogHeader.stories.js +69 -0
  138. package/src/components/DialogHeader/DialogHeader.vue +61 -0
  139. package/src/components/DialogHeader/__tests__/DialogHeader.spec.js +24 -0
  140. package/src/components/DialogHeader/index.ts +3 -0
  141. package/src/components/Form/Form.stories.js +390 -0
  142. package/src/components/Form/Form.vue +100 -0
  143. package/src/components/Form/__tests__/Form.spec.js +14 -0
  144. package/src/components/Form/index.ts +4 -0
  145. package/src/components/Icon/Icon.scss +61 -0
  146. package/src/components/Icon/Icon.stories.js +156 -0
  147. package/src/components/Icon/Icon.vue +100 -0
  148. package/src/components/Icon/Icons.stories.scss +31 -0
  149. package/src/components/Icon/__tests__/Icon.spec.js +34 -0
  150. package/src/components/Icon/icons_list.ts +2557 -0
  151. package/src/components/Icon/index.ts +4 -0
  152. package/src/components/IconBox/IconBox.scss +42 -0
  153. package/src/components/IconBox/IconBox.stories.js +92 -0
  154. package/src/components/IconBox/IconBox.vue +78 -0
  155. package/src/components/IconBox/__tests__/IconBox.spec.js +37 -0
  156. package/src/components/IconBox/index.ts +3 -0
  157. package/src/components/IdCaption/IdCaption.scss +51 -0
  158. package/src/components/IdCaption/IdCaption.stories.js +224 -0
  159. package/src/components/IdCaption/IdCaption.vue +168 -0
  160. package/src/components/IdCaption/__tests__/IdCaption.spec.js +14 -0
  161. package/src/components/IdCaption/index.ts +3 -0
  162. package/src/components/Label/Label.scss +33 -0
  163. package/src/components/Label/Label.stories.js +60 -0
  164. package/src/components/Label/Label.vue +27 -0
  165. package/src/components/Label/__tests__/Label.spec.js +20 -0
  166. package/src/components/Label/index.ts +4 -0
  167. package/src/components/List/List.scss +0 -0
  168. package/src/components/List/List.stories.js +30 -0
  169. package/src/components/List/List.vue +75 -0
  170. package/src/components/List/__tests__/List.spec.js +33 -0
  171. package/src/components/List/composition/index.ts +3 -0
  172. package/src/components/List/composition/useFocus.ts +49 -0
  173. package/src/components/List/index.ts +4 -0
  174. package/src/components/ListItem/ListItem.scss +37 -0
  175. package/src/components/ListItem/ListItem.stories.js +81 -0
  176. package/src/components/ListItem/ListItem.vue +76 -0
  177. package/src/components/ListItem/ListItem.vue.bkpv2 +84 -0
  178. package/src/components/ListItem/__tests__/ListItem.spec.js +20 -0
  179. package/src/components/ListItem/index.ts +4 -0
  180. package/src/components/Loader/Loader.scss +116 -0
  181. package/src/components/Loader/Loader.stories.ts +48 -0
  182. package/src/components/Loader/Loader.vue +83 -0
  183. package/src/components/Loader/__tests__/Loader.spec.js +35 -0
  184. package/src/components/Loader/index.ts +3 -0
  185. package/src/components/Logger/Logger.scss +56 -0
  186. package/src/components/Logger/Logger.stories.js +228 -0
  187. package/src/components/Logger/Logger.vue +49 -0
  188. package/src/components/Logger/LoggerItem/ILoggerItem.ts +11 -0
  189. package/src/components/Logger/LoggerItem/LoggerItem.scss +99 -0
  190. package/src/components/Logger/LoggerItem/LoggerItem.stories.js +144 -0
  191. package/src/components/Logger/LoggerItem/LoggerItem.vue +98 -0
  192. package/src/components/Logger/LoggerItem/__tests__/LoggerItem.spec.js +93 -0
  193. package/src/components/Logger/LoggerItem/index.ts +4 -0
  194. package/src/components/Logger/LoggerItem/mappingIconKeys.ts +5 -0
  195. package/src/components/Logger/__tests__/Logger.spec.js +75 -0
  196. package/src/components/Logger/index.ts +4 -0
  197. package/src/components/MainFilter/MainFilter.scss +16 -0
  198. package/src/components/MainFilter/MainFilter.stories.js +84 -0
  199. package/src/components/MainFilter/MainFilter.vue +147 -0
  200. package/src/components/MainFilter/__tests__/MainFilter.spec.js +45 -0
  201. package/src/components/MainFilter/index.ts +3 -0
  202. package/src/components/ManagersList/ManagersList.stories.js +10 -0
  203. package/src/components/ManagersList/ManagersList.vue +29 -0
  204. package/src/components/ManagersList/__tests__/ManagersList.spec.js +27 -0
  205. package/src/components/ManagersList/index.ts +3 -0
  206. package/src/components/Modal/Modal.scss +110 -0
  207. package/src/components/Modal/Modal.stories.js +299 -0
  208. package/src/components/Modal/Modal.vue +135 -0
  209. package/src/components/Modal/__tests__/Modal.spec.js +19 -0
  210. package/src/components/Modal/index.ts +4 -0
  211. package/src/components/ModalPromptUser/ModalPromptUser.scss +3 -0
  212. package/src/components/ModalPromptUser/ModalPromptUser.stories.js +121 -0
  213. package/src/components/ModalPromptUser/ModalPromptUser.vue +135 -0
  214. package/src/components/ModalPromptUser/__tests__/ModalPromptUser.spec.js +27 -0
  215. package/src/components/ModalPromptUser/index.ts +3 -0
  216. package/src/components/MultipleFilePicker/MultipleFilePicker.scss +168 -0
  217. package/src/components/MultipleFilePicker/MultipleFilePicker.stories.js +74 -0
  218. package/src/components/MultipleFilePicker/MultipleFilePicker.vue +261 -0
  219. package/src/components/MultipleFilePicker/__tests__/MultipleFilePicker.spec.js +184 -0
  220. package/src/components/MultipleFilePicker/index.ts +3 -0
  221. package/src/components/MultipleSelectShortener/MultipleSelectShortener.stories.js +32 -0
  222. package/src/components/MultipleSelectShortener/MultipleSelectShortener.vue +48 -0
  223. package/src/components/MultipleSelectShortener/__tests__/MultipleSelectShortener.spec.js +21 -0
  224. package/src/components/MultipleSelectShortener/index.ts +4 -0
  225. package/src/components/ProgressBar/ProgressBar.scss +25 -0
  226. package/src/components/ProgressBar/ProgressBar.stories.js +49 -0
  227. package/src/components/ProgressBar/ProgressBar.vue +111 -0
  228. package/src/components/ProgressBar/__tests__/ProgressBar.spec.js +31 -0
  229. package/src/components/ProgressBar/index.ts +4 -0
  230. package/src/components/PromptUserToConfirm/PromptUserToConfirm.stories.js +51 -0
  231. package/src/components/PromptUserToConfirm/PromptUserToConfirm.vue +62 -0
  232. package/src/components/PromptUserToConfirm/__tests__/PromptUserToConfirm.spec.js +24 -0
  233. package/src/components/PromptUserToConfirm/index.ts +3 -0
  234. package/src/components/Radio/Radio.scss +109 -0
  235. package/src/components/Radio/Radio.stories.js +147 -0
  236. package/src/components/Radio/Radio.vue +110 -0
  237. package/src/components/Radio/__tests__/Radio.spec.js +27 -0
  238. package/src/components/Radio/index.ts +4 -0
  239. package/src/components/RadioGroup/RadioGroup.stories.js +85 -0
  240. package/src/components/RadioGroup/RadioGroup.vue +95 -0
  241. package/src/components/RadioGroup/__tests__/RadioGroup.spec.js +24 -0
  242. package/src/components/RadioGroup/index.ts +4 -0
  243. package/src/components/RangeDatePicker/RangeDatePicker.stories.js +76 -0
  244. package/src/components/RangeDatePicker/RangeDatePicker.vue +201 -0
  245. package/src/components/RangeDatePicker/__tests__/RangeDatePicker.spec.js +107 -0
  246. package/src/components/RangeDatePicker/index.ts +3 -0
  247. package/src/components/ResetTableRowSelection/ResetTableRowSelection.stories.js +15 -0
  248. package/src/components/ResetTableRowSelection/ResetTableRowSelection.vue +35 -0
  249. package/src/components/ResetTableRowSelection/__tests__/ResetTableRowSelection.spec.js +33 -0
  250. package/src/components/ResetTableRowSelection/index.ts +4 -0
  251. package/src/components/ResourceMetaInfo/ResourceMetaInfo.scss +14 -0
  252. package/src/components/ResourceMetaInfo/ResourceMetaInfo.stories.js +138 -0
  253. package/src/components/ResourceMetaInfo/ResourceMetaInfo.vue +140 -0
  254. package/src/components/ResourceMetaInfo/__tests__/ResourceMetaInfo.spec.js +182 -0
  255. package/src/components/ResourceMetaInfo/index.ts +4 -0
  256. package/src/components/Select/Select.scss +49 -0
  257. package/src/components/Select/Select.stories.js +346 -0
  258. package/src/components/Select/Select.vue +439 -0
  259. package/src/components/Select/__tests__/Select.spec.js +174 -0
  260. package/src/components/Select/__tests__/composition.spec.js +27 -0
  261. package/src/components/Select/composition/buildData.ts +34 -0
  262. package/src/components/Select/composition/index.ts +3 -0
  263. package/src/components/Select/index.ts +4 -0
  264. package/src/components/SelectAutoComplete/SelectAutoComplete.scss +49 -0
  265. package/src/components/SelectAutoComplete/SelectAutoComplete.stories.js +328 -0
  266. package/src/components/SelectAutoComplete/SelectAutoComplete.vue +535 -0
  267. package/src/components/SelectAutoComplete/__tests__/SelectAutoComplete.spec.js +130 -0
  268. package/src/components/SelectAutoComplete/__tests__/useSelectAutoComplete.spec.js +28 -0
  269. package/src/components/SelectAutoComplete/composables/index.ts +3 -0
  270. package/src/components/SelectAutoComplete/composables/useSelectAutoComplete.ts +37 -0
  271. package/src/components/SelectAutoComplete/index.ts +4 -0
  272. package/src/components/SelectModalOptions/SelectModalOptions.scss +15 -0
  273. package/src/components/SelectModalOptions/SelectModalOptions.stories.js +46 -0
  274. package/src/components/SelectModalOptions/SelectModalOptions.vue +298 -0
  275. package/src/components/SelectModalOptions/__tests__/SelectModalOptions.spec.js +132 -0
  276. package/src/components/SelectModalOptions/index.ts +4 -0
  277. package/src/components/Stepper/StepperHeader/IStep.ts +6 -0
  278. package/src/components/Stepper/StepperHeader/StepperHeader.scss +127 -0
  279. package/src/components/Stepper/StepperHeader/StepperHeader.stories.js +89 -0
  280. package/src/components/Stepper/StepperHeader/StepperHeader.vue +106 -0
  281. package/src/components/Stepper/StepperHeader/__tests__/StepperHeader.spec.js +63 -0
  282. package/src/components/Stepper/StepperHeader/_mixins.scss +46 -0
  283. package/src/components/Stepper/StepperHeader/index.ts +4 -0
  284. package/src/components/Stepper/index.ts +5 -0
  285. package/src/components/Switcher/Switcher.scss +71 -0
  286. package/src/components/Switcher/Switcher.stories.js +112 -0
  287. package/src/components/Switcher/Switcher.vue +94 -0
  288. package/src/components/Switcher/__tests__/Switcher.spec.js +26 -0
  289. package/src/components/Switcher/index.ts +4 -0
  290. package/src/components/TableContextMenu/TableContextMenu.scss +9 -0
  291. package/src/components/TableContextMenu/TableContextMenu.stories.js +92 -0
  292. package/src/components/TableContextMenu/TableContextMenu.vue +89 -0
  293. package/src/components/TableContextMenu/__tests__/TableContextMenu.spec.js +45 -0
  294. package/src/components/TableContextMenu/index.ts +3 -0
  295. package/src/components/Tabs/Tabs.scss +72 -0
  296. package/src/components/Tabs/Tabs.stories.js +68 -0
  297. package/src/components/Tabs/Tabs.vue +130 -0
  298. package/src/components/Tabs/__tests__/Tabs.spec.js +59 -0
  299. package/src/components/Tabs/index.ts +4 -0
  300. package/src/components/TextArea/TextArea.scss +75 -0
  301. package/src/components/TextArea/TextArea.stories.js +147 -0
  302. package/src/components/TextArea/TextArea.vue +224 -0
  303. package/src/components/TextArea/__tests__/TextArea.spec.js +48 -0
  304. package/src/components/TextArea/index.ts +4 -0
  305. package/src/components/TextFieldV2/TextFieldV2.scss +99 -0
  306. package/src/components/TextFieldV2/TextFieldV2.stories.js +260 -0
  307. package/src/components/TextFieldV2/TextFieldV2.vue +276 -0
  308. package/src/components/TextFieldV2/__tests__/TextFieldV2.spec.js +52 -0
  309. package/src/components/TextFieldV2/index.ts +4 -0
  310. package/src/components/Tooltip/Tooltip.scss +38 -0
  311. package/src/components/Tooltip/Tooltip.stories.js +100 -0
  312. package/src/components/Tooltip/Tooltip.vue +125 -0
  313. package/src/components/Tooltip/__tests__/Tooltip.spec.js +20 -0
  314. package/src/components/Tooltip/index.ts +5 -0
  315. package/src/components/Typography/BodyText/BodyText.scss +8 -0
  316. package/src/components/Typography/BodyText/BodyText.stories.js +58 -0
  317. package/src/components/Typography/BodyText/BodyText.vue +51 -0
  318. package/src/components/Typography/BodyText/__tests__/BodyText.spec.js +31 -0
  319. package/src/components/Typography/BodyText/configurations.ts +10 -0
  320. package/src/components/Typography/Caption/Caption.scss +8 -0
  321. package/src/components/Typography/Caption/Caption.stories.js +54 -0
  322. package/src/components/Typography/Caption/Caption.vue +51 -0
  323. package/src/components/Typography/Caption/__tests__/Caption.spec.js +31 -0
  324. package/src/components/Typography/Caption/configurations.ts +7 -0
  325. package/src/components/Typography/Heading/Heading.scss +20 -0
  326. package/src/components/Typography/Heading/Heading.stories.js +32 -0
  327. package/src/components/Typography/Heading/Heading.vue +50 -0
  328. package/src/components/Typography/Heading/__tests__/Heading.spec.js +38 -0
  329. package/src/components/Typography/Heading/configurations.ts +10 -0
  330. package/src/components/Typography/OverlayText/OverlayText.scss +3 -0
  331. package/src/components/Typography/OverlayText/OverlayText.stories.js +25 -0
  332. package/src/components/Typography/OverlayText/OverlayText.vue +22 -0
  333. package/src/components/Typography/OverlayText/__tests__/OverlayText.spec.js +20 -0
  334. package/src/components/Typography/Small/Small.scss +3 -0
  335. package/src/components/Typography/Small/Small.stories.js +34 -0
  336. package/src/components/Typography/Small/Small.vue +47 -0
  337. package/src/components/Typography/Small/__tests__/Small.spec.js +31 -0
  338. package/src/components/Typography/Small/configurations.ts +7 -0
  339. package/src/components/Typography/Subtitle/Subtitle.scss +8 -0
  340. package/src/components/Typography/Subtitle/Subtitle.stories.js +57 -0
  341. package/src/components/Typography/Subtitle/Subtitle.vue +52 -0
  342. package/src/components/Typography/Subtitle/__tests__/Subtitle.spec.js +31 -0
  343. package/src/components/Typography/Subtitle/configurations.ts +8 -0
  344. package/src/components/Typography/Typography.scss +87 -0
  345. package/src/components/Typography/Typography.stories.js +210 -0
  346. package/src/components/Typography/Typography.vue +132 -0
  347. package/src/components/Typography/__tests__/Typography.spec.js +60 -0
  348. package/src/components/Typography/index.ts +11 -0
  349. package/src/components/ValueCaption/ValueCaption.scss +19 -0
  350. package/src/components/ValueCaption/ValueCaption.stories.js +58 -0
  351. package/src/components/ValueCaption/ValueCaption.vue +63 -0
  352. package/src/components/ValueCaption/__tests__/ValueCaption.spec.js +14 -0
  353. package/src/components/ValueCaption/index.ts +4 -0
  354. package/src/components/layout/Basic.stories.js +113 -0
  355. package/src/components/layout/Box/Box.scss +15 -0
  356. package/src/components/layout/Box/Box.stories.js +41 -0
  357. package/src/components/layout/Box/Box.vue +37 -0
  358. package/src/components/layout/Box/__tests__/Box.spec.js +20 -0
  359. package/src/components/layout/Box/index.ts +4 -0
  360. package/src/components/layout/Col/Col.scss +110 -0
  361. package/src/components/layout/Col/Col.stories.js +174 -0
  362. package/src/components/layout/Col/Col.vue +141 -0
  363. package/src/components/layout/Col/__tests__/Col.spec.js +20 -0
  364. package/src/components/layout/Col/index.ts +4 -0
  365. package/src/components/layout/Container/Container.scss +35 -0
  366. package/src/components/layout/Container/Container.stories.js +23 -0
  367. package/src/components/layout/Container/Container.vue +18 -0
  368. package/src/components/layout/Container/index.ts +4 -0
  369. package/src/components/layout/ContainerFooter/Container.stories.js +29 -0
  370. package/src/components/layout/ContainerFooter/ContainerFooter.scss +13 -0
  371. package/src/components/layout/ContainerFooter/ContainerFooter.vue +27 -0
  372. package/src/components/layout/ContainerFooter/index.ts +4 -0
  373. package/src/components/layout/DisplayBreakpoints.stories.mdx +90 -0
  374. package/src/components/layout/GridSystem.stories.js +138 -0
  375. package/src/components/layout/Line/Line.scss +25 -0
  376. package/src/components/layout/Line/Line.stories.js +53 -0
  377. package/src/components/layout/Line/Line.vue +58 -0
  378. package/src/components/layout/Line/__tests__/Line.spec.js +22 -0
  379. package/src/components/layout/Line/index.ts +4 -0
  380. package/src/components/layout/PropsValues.stories.mdx +30 -0
  381. package/src/components/layout/Row/Row.scss +42 -0
  382. package/src/components/layout/Row/Row.stories.js +112 -0
  383. package/src/components/layout/Row/Row.vue +77 -0
  384. package/src/components/layout/Row/__tests__/Row.spec.js +20 -0
  385. package/src/components/layout/Row/index.ts +4 -0
  386. package/src/composition/__tests__/deepEqual.spec.js +13 -0
  387. package/src/composition/__tests__/validateFormFieldBuilder.spec.js +34 -0
  388. package/src/composition/__tests__/validateFormStateBuilder.spec.js +8 -0
  389. package/src/composition/deepEqual.ts +24 -0
  390. package/src/composition/validateFormFieldBuilder.ts +18 -0
  391. package/src/composition/validateFormMethodBuilder.ts +9 -0
  392. package/src/composition/validateFormStateBuilder.ts +13 -0
  393. package/src/configurations/_functions.scss +9 -0
  394. package/src/configurations/_mixins.scss +103 -0
  395. package/src/configurations/_theme-colors-background.scss +10 -0
  396. package/src/configurations/_theme-colors-base.module.scss +8 -0
  397. package/src/configurations/_theme-colors-bw.module.scss +10 -0
  398. package/src/configurations/_theme-colors-stroke.scss +10 -0
  399. package/src/configurations/_theme-colors-text.scss +10 -0
  400. package/src/configurations/_theme-colors-variations.scss +9 -0
  401. package/src/configurations/_theme-colors.scss +122 -0
  402. package/src/configurations/_variables.scss +36 -0
  403. package/src/configurations/colors.ts +12 -0
  404. package/src/configurations/flexVariables.ts +5 -0
  405. package/src/configurations/gutters.ts +1 -0
  406. package/src/configurations/sizes.ts +1 -0
  407. package/src/configurations/typographyHtmlTags.ts +16 -0
  408. package/src/examples/Colors.stories.js +122 -0
  409. package/src/examples/Colors.stories.scss +21 -0
  410. package/src/examples/Table.stories.js +200 -0
  411. package/src/examples/VuetifyDialog.stories.js +129 -0
  412. package/src/helpers/calculateMainZindex.js +12 -0
  413. package/src/helpers/date.ts +94 -0
  414. package/src/helpers/formatDatePickerHeader.ts +19 -0
  415. package/src/helpers/index.ts +4 -0
  416. package/src/helpers/isChildOfFixedElement.js +16 -0
  417. package/src/helpers/randomId.ts +9 -0
  418. package/src/main.ts +92 -0
  419. package/src/scss/Sticky-table.scss +112 -0
  420. package/src/scss/Table.scss +2 -0
  421. package/src/scss/VMenuOverrides.scss +17 -0
  422. package/src/scss/VuejsDialog.scss +93 -0
  423. package/src/scss/cssVariablesGenerator.scss +25 -0
  424. package/src/scss/utils.scss +51 -0
  425. package/src/shims-libs.d.ts +4 -0
  426. package/src/shims-tsx.d.ts +11 -0
  427. package/src/shims-vue.d.ts +4 -0
  428. package/src/stories/Introduction.stories.mdx +118 -0
  429. package/src/stories/assets/code-brackets.svg +1 -0
  430. package/src/stories/assets/colors.svg +1 -0
  431. package/src/stories/assets/comments.svg +1 -0
  432. package/src/stories/assets/direction.svg +1 -0
  433. package/src/stories/assets/flow.svg +1 -0
  434. package/src/stories/assets/logo_farmtech.svg +21 -0
  435. package/src/stories/assets/plugin.svg +1 -0
  436. package/src/stories/assets/repo.svg +1 -0
  437. package/src/vue-file-import.d.ts +4 -0
@@ -0,0 +1,535 @@
1
+ <template>
2
+ <div ref="outsideClickHandler" @click="handleOutsideClick">
3
+ <div
4
+ :class="{
5
+ 'farm-textfield': true,
6
+ 'farm-textfield--validatable': rules.length > 0,
7
+ 'farm-textfield--touched': isTouched,
8
+ 'farm-textfield--blured': isBlured,
9
+ 'farm-textfield--error': hasError,
10
+ 'farm-textfield--disabled': disabled,
11
+ 'farm-textfield--focused': isFocus || isVisible,
12
+ 'farm-textfield--hiddendetails': hideDetails,
13
+ }"
14
+ v-if="!readonly && !disabled"
15
+ :id="customId"
16
+ >
17
+ <farm-contextmenu bottom v-model="isVisible" :stay-open="multiple" ref="contextmenu">
18
+ <farm-list v-if="!readonly" ref="listRef" @keyup="onKeyUp">
19
+ <farm-listitem
20
+ tabindex="0"
21
+ v-for="(item, index) in showFilteredItems ? filteredItems : items"
22
+ clickable
23
+ hoverColorVariation="lighten"
24
+ hover-color="primary"
25
+ :key="'contextmenu_item_' + index"
26
+ :class="{ 'farm-listitem--selected': item[itemValue] === innerValue }"
27
+ @click='selectItem(item)'
28
+ >
29
+ <farm-checkbox
30
+ class="farm-select__checkbox"
31
+ v-model="checked"
32
+ value="1"
33
+ size="sm"
34
+ v-if="isChecked(item)"
35
+ />
36
+ <farm-checkbox
37
+ class="farm-select__checkbox"
38
+ v-model="checked"
39
+ value="2"
40
+ size="sm"
41
+ v-else-if="multiple"
42
+ />
43
+ <farm-caption bold tag="span">{{ item[itemText] }}</farm-caption>
44
+ </farm-listitem>
45
+ <farm-listitem v-if=" (!items || items.length === 0) || (showFilteredItems && filteredItems.length === 0)">
46
+ {{ noDataText }}
47
+ </farm-listitem>
48
+ </farm-list>
49
+ <template v-slot:activator="{}">
50
+ <div class="farm-textfield--input farm-textfield--input--iconed">
51
+ <input
52
+ v-bind="$attrs"
53
+ v-model="selectedText"
54
+ ref="inputField"
55
+ :id="$props.id"
56
+ @focusin="onFocus(true)"
57
+ @focusout="onFocus(false)"
58
+ @input="onInput"
59
+ @blur="onBlur"
60
+ @keyup="onKeyUp"
61
+ autocomplete="off"
62
+ />
63
+ <farm-icon color="gray" :class="{ 'farm-icon--rotate': isVisible }" @click="addFocusToInput">
64
+ menu-down
65
+ </farm-icon>
66
+ </div>
67
+ </template>
68
+ </farm-contextmenu>
69
+ <farm-caption v-if="showErrorText" color="error" variation="regular">
70
+ {{ errorBucket[0] }}
71
+ </farm-caption>
72
+ <farm-caption
73
+ v-if="hint && !showErrorText"
74
+ class="farm-select__hint-text"
75
+ :class="{ 'farm-select__hint-text--show': persistentHint || isFocus }"
76
+ color="gray"
77
+ variation="regular"
78
+ >
79
+ {{ hint }}
80
+ </farm-caption>
81
+ </div>
82
+ <farm-textfield-v2 v-else v-model="selectedText" :disabled="disabled" :readonly="readonly" />
83
+ </div>
84
+ </template>
85
+
86
+ <script lang="ts">
87
+ /* tslint:disable */
88
+ import { computed, onBeforeMount, onMounted, PropType, ref, toRefs, watch, defineComponent } from 'vue';
89
+ import validateFormStateBuilder from '../../composition/validateFormStateBuilder';
90
+ import validateFormFieldBuilder from '../../composition/validateFormFieldBuilder';
91
+ import validateFormMethodBuilder from '../../composition/validateFormMethodBuilder';
92
+ import deepEqual from '../../composition/deepEqual';
93
+ import randomId from '../../helpers/randomId';
94
+ import { useSelectAutoComplete } from './composables';
95
+
96
+ export default defineComponent({
97
+ name: 'farm-select-auto-complete',
98
+ inheritAttrs: true,
99
+ props: {
100
+ /**
101
+ * v-model binding
102
+ */
103
+ value: { type: [String, Number, Array], default: '' },
104
+ hint: {
105
+ type: String,
106
+ default: null,
107
+ },
108
+ /**
109
+ * Always show hint text
110
+ */
111
+ persistentHint: {
112
+ type: Boolean,
113
+ default: true,
114
+ },
115
+ /**
116
+ * Disabled the input
117
+ */
118
+ disabled: {
119
+ type: Boolean,
120
+ default: false,
121
+ },
122
+ /**
123
+ * Puts input in readonly state
124
+ */
125
+ readonly: {
126
+ type: Boolean,
127
+ default: false,
128
+ },
129
+ /**
130
+ * Array of rules used for validation
131
+ */
132
+ rules: {
133
+ type: Array as PropType<Array<Function>>,
134
+ default: () => [],
135
+ },
136
+ /**
137
+ * An array of objects. Will look for a text, value and disabled keys.
138
+ * This can be changed using the item-text ad item-value
139
+ */
140
+ items: {
141
+ type: Array,
142
+ default: () => [],
143
+ },
144
+ /**
145
+ * Set property of items's text value
146
+ */
147
+ itemText: {
148
+ type: String,
149
+ default: 'text',
150
+ },
151
+ /**
152
+ * Set property of items's value
153
+ */
154
+ itemValue: {
155
+ type: String,
156
+ default: 'value',
157
+ },
158
+ /**
159
+ * No data text
160
+ */
161
+ noDataText: {
162
+ type: String,
163
+ default: 'Não há dados',
164
+ },
165
+ /**
166
+ * Set a multiple select
167
+ */
168
+ multiple: {
169
+ type: Boolean,
170
+ default: false,
171
+ },
172
+ /**
173
+ * Hides hint and validation errors
174
+ */
175
+ hideDetails: {
176
+ type: Boolean,
177
+ default: false,
178
+ },
179
+ /**
180
+ * Select id
181
+ */
182
+ id: {
183
+ type: String,
184
+ default: '',
185
+ },
186
+ /**
187
+ * The updated bound model<br />
188
+ * _event_
189
+ */
190
+ input: {
191
+ type: Function,
192
+ // eslint-disable-next-line
193
+ default: (value: [String, Number, Array<any>]) => {},
194
+ },
195
+ /**
196
+ * Emitted when the select is changed by user interaction<br />
197
+ * _event_
198
+ */
199
+ change: {
200
+ type: Function,
201
+ // eslint-disable-next-line
202
+ default: (value: [String, Number, Array<any>]) => {},
203
+ },
204
+ /**
205
+ * Emitted when any key is pressed<br />
206
+ * _event_
207
+ */
208
+ keyup: {
209
+ type: Function,
210
+ // eslint-disable-next-line
211
+ default: (event: Event) => {},
212
+ },
213
+ /**
214
+ * Emitted when the select is blurred<br />
215
+ * _event_
216
+ */
217
+ blur: {
218
+ type: Function,
219
+ // eslint-disable-next-line
220
+ default: (event: Event) => {},
221
+ },
222
+ },
223
+ setup(props, { emit }) {
224
+ const { rules, items, itemText, itemValue, disabled, multiple } = toRefs(props);
225
+
226
+ const {
227
+ multipleValues,
228
+ innerValue,
229
+ isTouched,
230
+ isFocus,
231
+ isBlured,
232
+ isVisible,
233
+ selectedText,
234
+ checked,
235
+ notChecked,
236
+ filteredItems,
237
+ inputField,
238
+ } = useSelectAutoComplete(props);
239
+
240
+ const listRef = ref();
241
+
242
+ const contextmenu = ref(null);
243
+
244
+ const { errorBucket, valid, validatable } = validateFormStateBuilder();
245
+
246
+ let fieldValidator = validateFormFieldBuilder(rules.value);
247
+ let validate = validateFormMethodBuilder(errorBucket, valid, fieldValidator);
248
+
249
+ const hasError = computed(() => {
250
+ return errorBucket.value.length > 0;
251
+ });
252
+
253
+ const customId = 'farm-select-' + (props.id || randomId(2));
254
+
255
+ const showErrorText = computed(() => hasError.value && isTouched.value);
256
+
257
+ const searchText = ref('');
258
+
259
+ const filterOptions = () => {
260
+ searchText.value = selectedText.value.toLowerCase();
261
+ if (!searchText || searchText.value.includes('+')) {
262
+ filteredItems.value = items.value;
263
+ return;
264
+ }
265
+
266
+ filteredItems.value = (items.value as any).filter(
267
+ (item) => item[(itemText.value as any)].toLowerCase().includes(searchText.value)
268
+ );
269
+
270
+ if (filteredItems.value.length === 0 && searchText.value.trim() !== '') {
271
+ filteredItems.value = [];
272
+ }
273
+ };
274
+
275
+ const showFilteredItems = computed(() => {
276
+ return isVisible.value && searchText.value.trim() !== '';
277
+ });
278
+
279
+ watch(
280
+ () => props.value,
281
+ newValue => {
282
+ innerValue.value = newValue;
283
+ errorBucket.value = [];
284
+
285
+ if (
286
+ (multiple.value && newValue === null) ||
287
+ (Array.isArray(newValue) && newValue.length === 0)
288
+ ) {
289
+ multipleValues.value = [];
290
+ }
291
+ if (Array.isArray(newValue) && newValue.length > 0) {
292
+ multipleValues.value = [...newValue];
293
+ }
294
+ validate(newValue);
295
+ updateSelectedTextValue();
296
+ emit('input', newValue);
297
+ }
298
+ );
299
+
300
+ watch(
301
+ () => props.items,
302
+ () => {
303
+ errorBucket.value = [];
304
+ validate(innerValue.value);
305
+ updateSelectedTextValue();
306
+ }
307
+ );
308
+
309
+ watch(
310
+ () => innerValue.value,
311
+ () => {
312
+ isTouched.value = true;
313
+ isBlured.value = true;
314
+ validate(innerValue.value);
315
+ emit('input', innerValue.value);
316
+ }
317
+ );
318
+
319
+ watch(
320
+ () => props.rules,
321
+ (newVal, oldVal) => {
322
+ if (deepEqual(newVal, oldVal)) return;
323
+ fieldValidator = validateFormFieldBuilder(rules.value);
324
+ validate(innerValue.value);
325
+ }
326
+ );
327
+
328
+
329
+ const handleOutsideClick = (event) => {
330
+ clearSearchAndReturnSelection(event);
331
+
332
+ };
333
+
334
+ onBeforeMount(() => {
335
+ validate(innerValue.value);
336
+ updateSelectedTextValue();
337
+ document.removeEventListener('click', handleOutsideClick);
338
+ });
339
+
340
+ onMounted(() => {
341
+ document.addEventListener('click', handleOutsideClick);
342
+ });
343
+
344
+ const reset = () => {
345
+ if (disabled.value) {
346
+ return;
347
+ }
348
+ innerValue.value = null;
349
+ multipleValues.value = [];
350
+ selectedText.value = '';
351
+ isTouched.value = true;
352
+ if (multiple.value) {
353
+ innerValue.value = [];
354
+ return;
355
+ }
356
+ emit('input', innerValue.value);
357
+ };
358
+
359
+ const onBlur = (event: Event) => {
360
+ isBlured.value = true;
361
+ validate(innerValue.value);
362
+ emit('blur', event);
363
+
364
+ setTimeout(() => {
365
+ if (multiple.value){
366
+ searchText.value = '';
367
+ addLabelToMultiple();
368
+ return;
369
+ }
370
+ }, 100);
371
+
372
+ };
373
+
374
+ const clearSearchAndReturnSelection = (event) => {
375
+ if (!event.srcElement.className.includes('farm-listitem')) {
376
+ if (innerValue.value !== null) {
377
+ if (!selectedText.value) {
378
+ innerValue.value = null;
379
+ }
380
+ }
381
+ searchText.value = '';
382
+ updateSelectedTextValue();
383
+ }
384
+ };
385
+
386
+ const onFocus = (focus: boolean) => {
387
+
388
+ isFocus.value = focus;
389
+ };
390
+
391
+ const selectItem = item => {
392
+
393
+ const value$ = itemValue.value.toString();
394
+
395
+ if (multiple.value) {
396
+ const alreadyAdded = multipleValues.value.findIndex(
397
+ val => val === item[value$]
398
+ );
399
+ checked.value = '1';
400
+ if (alreadyAdded !== -1) {
401
+ multipleValues.value.splice(alreadyAdded, 1);
402
+ } else {
403
+ multipleValues.value.push(item[value$]);
404
+ }
405
+ innerValue.value = [...multipleValues.value];
406
+
407
+ return;
408
+ }
409
+
410
+ innerValue.value = item[value$];
411
+ isVisible.value = false;
412
+
413
+ setTimeout(() => {
414
+ emit('change', innerValue.value);
415
+ searchText.value = '';
416
+ }, 100);
417
+ };
418
+
419
+ const clickInput = () => {
420
+
421
+ isTouched.value = true;
422
+ emit('click');
423
+ };
424
+
425
+ const makePristine = () => {
426
+ isTouched.value = false;
427
+ };
428
+
429
+ const updateSelectedTextValue = () => {
430
+ if (
431
+ !items.value ||
432
+ (items.value as any).length === 0 ||
433
+ innerValue.value === null ||
434
+ (multiple.value && multipleValues.value.length === 0)
435
+ ) {
436
+ selectedText.value = '';
437
+ return;
438
+ }
439
+ const selectedItem = (items.value as Array<any>).find(
440
+ item => item[itemValue.value as any] == innerValue.value
441
+ );
442
+
443
+ if (selectedItem) {
444
+ selectedText.value = selectedItem[(itemText.value as any)];
445
+ }
446
+
447
+ addLabelToMultiple();
448
+ };
449
+
450
+ const addLabelToMultiple = () => {
451
+ if (multiple.value && Array.isArray(innerValue.value) && innerValue.value.length > 0) {
452
+ const labelItem = (items.value as any).find(
453
+ item => item[itemValue.value.toString()] === innerValue.value[0]
454
+ );
455
+
456
+ if (innerValue.value.length === 0) {
457
+ selectedText.value = '';
458
+ return;
459
+ } else if (innerValue.value.length === 1) {
460
+ selectedText.value = labelItem[itemText.value as any];
461
+ return;
462
+ }
463
+
464
+ selectedText.value = `${labelItem[itemText.value as any]} (+${
465
+ innerValue.value.length - 1
466
+ } ${innerValue.value.length - 1 === 1 ? 'outro' : 'outros'})`;
467
+ }
468
+ };
469
+
470
+ const isChecked = item => {
471
+ return (
472
+ multiple.value &&
473
+ multipleValues.value.findIndex(val => val === item[itemValue.value as any]) !== -1
474
+ );
475
+ };
476
+
477
+ const onInput = () => {
478
+ isVisible.value = true;
479
+ };
480
+
481
+ function onKeyUp(event) {
482
+ if (props.readonly) return;
483
+ filterOptions();
484
+ event.preventDefault();
485
+ }
486
+
487
+ function addFocusToInput() {
488
+ inputField.value.focus();
489
+ }
490
+
491
+ return {
492
+ items,
493
+ innerValue,
494
+ selectedText,
495
+ errorBucket,
496
+ valid,
497
+ validatable,
498
+ hasError,
499
+ isTouched,
500
+ isBlured,
501
+ isFocus,
502
+ isVisible,
503
+ customId,
504
+ showErrorText,
505
+ contextmenu,
506
+ validate,
507
+ reset,
508
+ selectItem,
509
+ onBlur,
510
+ onFocus,
511
+ clickInput,
512
+ updateSelectedTextValue,
513
+ makePristine,
514
+ checked,
515
+ notChecked,
516
+ isChecked,
517
+ multipleValues,
518
+ addLabelToMultiple,
519
+ inputField,
520
+ onKeyUp,
521
+ addFocusToInput,
522
+ filterOptions,
523
+ onInput,
524
+ listRef,
525
+ filteredItems,
526
+ showFilteredItems,
527
+ searchText,
528
+ handleOutsideClick
529
+ };
530
+ },
531
+ });
532
+ </script>
533
+ <style lang="scss" scoped>
534
+ @import 'SelectAutoComplete';
535
+ </style>
@@ -0,0 +1,130 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import SelectAutoComplete from '../SelectAutoComplete.vue';
3
+
4
+ describe('SelectAutoComplet component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(SelectAutoComplete);
10
+ component = wrapper.vm;
11
+ });
12
+
13
+ test('Created hook', () => {
14
+ expect(wrapper).toBeDefined();
15
+ });
16
+
17
+
18
+ describe('mount component', () => {
19
+ it('renders correctly', () => {
20
+ expect(wrapper.element).toMatchSnapshot();
21
+ });
22
+ });
23
+
24
+ describe('methods', () => {
25
+ it('reset', () => {
26
+ component.reset();
27
+ expect(component.isTouched).toBeTruthy();
28
+ expect(component.innerValue).toEqual(null);
29
+ });
30
+
31
+ it('onBlur', () => {
32
+ component.onBlur();
33
+ expect(component.isBlured).toBeTruthy();
34
+ });
35
+
36
+ it('clickInput', () => {
37
+ component.clickInput();
38
+ expect(component.isTouched).toBeTruthy();
39
+ });
40
+
41
+ it('updateSelectedTextValue', () => {
42
+ component.updateSelectedTextValue();
43
+ expect(component.selectedText).toBeDefined();
44
+ });
45
+
46
+ it('makePristine', () => {
47
+ component.isTouched = true;
48
+ component.makePristine();
49
+ expect(component.isTouched).toBeFalsy();
50
+ });
51
+
52
+ describe('isChecked', () => {
53
+ it('should return false when multiple is false', async () => {
54
+ component.multipleValues = [0, 1, 2];
55
+ const result = component.isChecked({ value: 1 });
56
+ expect(result).toBe(false);
57
+ });
58
+ it('should return true when multiple is true and item is checked', async () => {
59
+ await wrapper.setProps({
60
+ multiple: true,
61
+ });
62
+ component.multipleValues = [0, 1, 2];
63
+ const result = component.isChecked({ value: 1 });
64
+ expect(result).toBe(true);
65
+ });
66
+ it('should return false when item is not checked', async () => {
67
+ await wrapper.setProps({
68
+ multiple: true,
69
+ });
70
+ component.multipleValues = [0, 1, 2];
71
+ const result = component.isChecked({ value: 3 });
72
+ expect(result).toBe(false);
73
+ });
74
+ });
75
+
76
+ describe('addLabelToMultiple', () => {
77
+ it('should not do anything when multiple is false', async () => {
78
+ component.addLabelToMultiple();
79
+
80
+ expect(component.selectedText).toBe('');
81
+ });
82
+ it('should return a selectedText to a selected item', async () => {
83
+ await wrapper.setProps({
84
+ multiple: true,
85
+ items: [
86
+ { value: 0, text: 'value 0' },
87
+ { value: 1, text: 'value 1' },
88
+ { value: 2, text: 'value 2' },
89
+ { value: 3, text: 'value 3' },
90
+ ],
91
+ value: [0],
92
+ });
93
+
94
+ component.addLabelToMultiple();
95
+ expect(component.selectedText).toBe('value 0');
96
+ });
97
+ it('should return a selectedText to two selected item', async () => {
98
+ await wrapper.setProps({
99
+ multiple: true,
100
+ items: [
101
+ { value: 0, text: 'value 0' },
102
+ { value: 1, text: 'value 1' },
103
+ { value: 2, text: 'value 2' },
104
+ { value: 3, text: 'value 3' },
105
+ ],
106
+ value: [0, 1],
107
+ });
108
+
109
+ component.addLabelToMultiple();
110
+ expect(component.selectedText).toBe('value 0 (+1 outro)');
111
+ });
112
+
113
+ it('should return a selectedText to three or more selected item', async () => {
114
+ await wrapper.setProps({
115
+ multiple: true,
116
+ items: [
117
+ { value: 0, text: 'value 0' },
118
+ { value: 1, text: 'value 1' },
119
+ { value: 2, text: 'value 2' },
120
+ { value: 3, text: 'value 3' },
121
+ ],
122
+ value: [0, 1, 2],
123
+ });
124
+
125
+ component.addLabelToMultiple();
126
+ expect(component.selectedText).toBe('value 0 (+2 outros)');
127
+ });
128
+ });
129
+ });
130
+ });
@@ -0,0 +1,28 @@
1
+ import useSelectAutoComplete from '../composables/useSelectAutoComplete';
2
+
3
+ describe('useSelectAutoComplete', () => {
4
+ it('should initialize with empty arrays and false values', () => {
5
+ const props = { value: [] };
6
+ const result = useSelectAutoComplete(props);
7
+
8
+ expect(result.multipleValues.value).toEqual([]);
9
+ expect(result.innerValue.value).toEqual([]);
10
+ expect(result.isTouched.value).toBe(false);
11
+ expect(result.isFocus.value).toBe(false);
12
+ expect(result.isBlured.value).toBe(false);
13
+ expect(result.isVisible.value).toBe(false);
14
+ expect(result.selectedText.value).toBe('');
15
+ expect(result.checked.value).toBe('1');
16
+ expect(result.notChecked.value).toBe(false);
17
+ expect(result.inputField.value).toBe(undefined);
18
+ expect(result.filteredItems.value).toBe(undefined);
19
+ });
20
+
21
+ it('should initialize with provided values', () => {
22
+ const props = { value: 'test' };
23
+ const result = useSelectAutoComplete(props);
24
+
25
+ expect(result.multipleValues.value).toEqual([]);
26
+ expect(result.innerValue.value).toBe('test');
27
+ });
28
+ });
@@ -0,0 +1,3 @@
1
+ import useSelectAutoComplete from './useSelectAutoComplete';
2
+
3
+ export { useSelectAutoComplete };