@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,439 @@
1
+ <template>
2
+ <div :class="{
3
+ 'farm-textfield': true,
4
+ 'farm-textfield--validatable': rules.length > 0,
5
+ 'farm-textfield--touched': isTouched,
6
+ 'farm-textfield--blured': isBlured,
7
+ 'farm-textfield--error': hasError,
8
+ 'farm-textfield--disabled': disabled,
9
+ 'farm-textfield--focused': isFocus || isVisible,
10
+ 'farm-textfield--hiddendetails': hideDetails,
11
+ }" v-if="!readonly && !disabled" :id="customId">
12
+ <farm-contextmenu bottom v-model="isVisible" :stay-open="multiple" ref="contextmenu">
13
+ <farm-list v-if="!readonly" ref="listRef" @keydown="onKeyDown">
14
+ <farm-listitem tabindex="0" v-for="(item, index) in items" clickable hoverColorVariation="lighten"
15
+ hover-color="primary" :key="'contextmenu_item_' + index"
16
+ :class="{ 'farm-listitem--selected': item[itemValue] === innerValue }" @click:item="selectItem(item)">
17
+ <farm-checkbox class="farm-select__checkbox" v-model="checked" value="1" size="sm"
18
+ v-if="isChecked(item)" />
19
+ <farm-checkbox class="farm-select__checkbox" v-model="checked" value="2" size="sm"
20
+ v-else-if="multiple" />
21
+ <farm-caption bold tag="span">{{ item[itemText] }}</farm-caption>
22
+ </farm-listitem>
23
+ <farm-listitem v-if="!items || items.length === 0">
24
+ {{ noDataText }}
25
+ </farm-listitem>
26
+ </farm-list>
27
+ <template v-slot:activator="{ }">
28
+ <div class="farm-textfield--input farm-textfield--input--iconed" @keydown="onKeyDown">
29
+ <input v-bind="$attrs" v-model="selectedText" ref="inputField" readonly :id="$props.id"
30
+ @click="clickInput" @blur="onBlur" @focusin="onFocus(true)" @focusout="onFocus(false)" />
31
+ <farm-icon color="gray" :class="{ 'farm-icon--rotate': isVisible }" @click="addFocusToInput">
32
+ menu-down
33
+ </farm-icon>
34
+ </div>
35
+ </template>
36
+ </farm-contextmenu>
37
+ <farm-caption v-if="showErrorText" color="error" variation="regular">
38
+ {{ errorBucket[0] }}
39
+ </farm-caption>
40
+ <farm-caption v-if="hint && !showErrorText" class="farm-select__hint-text" :class="{
41
+ 'farm-select__hint-text--show': persistentHint || isFocus,
42
+ }" color="gray" variation="regular">
43
+ {{ hint }}
44
+ </farm-caption>
45
+ </div>
46
+ <farm-textfield-v2 v-else v-model="selectedText" :disabled="disabled" :readonly="readonly" />
47
+ </template>
48
+
49
+ <script lang="ts">
50
+ import { computed, onBeforeMount, PropType, ref, toRefs, watch } from 'vue';
51
+ import validateFormStateBuilder from '../../composition/validateFormStateBuilder';
52
+ import validateFormFieldBuilder from '../../composition/validateFormFieldBuilder';
53
+ import validateFormMethodBuilder from '../../composition/validateFormMethodBuilder';
54
+ import deepEqual from '../../composition/deepEqual';
55
+ import randomId from '../../helpers/randomId';
56
+ import { buildData } from './composition';
57
+
58
+ export default {
59
+ name: 'farm-select',
60
+ inheritAttrs: true,
61
+ props: {
62
+ /**
63
+ * v-model binding
64
+ */
65
+ modelValue: { type: [String, Number, Array], default: '' },
66
+ hint: {
67
+ type: String,
68
+ default: null,
69
+ },
70
+ /**
71
+ * Always show hint text
72
+ */
73
+ persistentHint: {
74
+ type: Boolean,
75
+ default: true,
76
+ },
77
+ /**
78
+ * Disabled the input
79
+ */
80
+ disabled: {
81
+ type: Boolean,
82
+ default: false,
83
+ },
84
+ /**
85
+ * Puts input in readonly state
86
+ */
87
+ readonly: {
88
+ type: Boolean,
89
+ default: false,
90
+ },
91
+ /**
92
+ * Array of rules used for validation
93
+ */
94
+ rules: {
95
+ type: Array as PropType<Array<Function>>,
96
+ default: () => [],
97
+ },
98
+ /**
99
+ * An array of objects. Will look for a text, value and disabled keys.
100
+ * This can be changed using the item-text ad item-value
101
+ */
102
+ items: {
103
+ type: Array,
104
+ default: () => [],
105
+ },
106
+ /**
107
+ * Set property of items's text value
108
+ */
109
+ itemText: {
110
+ type: String,
111
+ default: 'text',
112
+ },
113
+ /**
114
+ * Set property of items's value
115
+ */
116
+ itemValue: {
117
+ type: String,
118
+ default: 'value',
119
+ },
120
+ /**
121
+ * No data text
122
+ */
123
+ noDataText: {
124
+ type: String,
125
+ default: 'Não há dados',
126
+ },
127
+ /**
128
+ * Set a multiple select
129
+ */
130
+ multiple: {
131
+ type: Boolean,
132
+ default: false,
133
+ },
134
+ /**
135
+ * Hides hint and validation errors
136
+ */
137
+ hideDetails: {
138
+ type: Boolean,
139
+ default: false,
140
+ },
141
+ /**
142
+ * Select id
143
+ */
144
+ id: {
145
+ type: String,
146
+ default: '',
147
+ },
148
+ /**
149
+ * The updated bound model<br />
150
+ * _event_
151
+ */
152
+ input: {
153
+ type: Function,
154
+ // eslint-disable-next-line
155
+ default: (value: [String, Number, Array<any>]) => { },
156
+ },
157
+ /**
158
+ * Emitted when the select is changed by user interaction<br />
159
+ * _event_
160
+ */
161
+ change: {
162
+ type: Function,
163
+ // eslint-disable-next-line
164
+ default: (value: [String, Number, Array<any>]) => { },
165
+ },
166
+ /**
167
+ * Emitted when any key is pressed<br />
168
+ * _event_
169
+ */
170
+ keyup: {
171
+ type: Function,
172
+ // eslint-disable-next-line
173
+ default: (event: Event) => { },
174
+ },
175
+ /**
176
+ * Emitted when the select is blurred<br />
177
+ * _event_
178
+ */
179
+ blur: {
180
+ type: Function,
181
+ // eslint-disable-next-line
182
+ default: (event: Event) => { },
183
+ },
184
+ },
185
+ setup(props, { emit }) {
186
+ const { rules, items, itemText, itemValue, disabled, multiple } = toRefs(props);
187
+
188
+ const {
189
+ multipleValues,
190
+ innerValue,
191
+ isTouched,
192
+ isFocus,
193
+ isBlured,
194
+ isVisible,
195
+ selectedText,
196
+ checked,
197
+ notChecked,
198
+ inputField,
199
+ keys,
200
+ } = buildData(props);
201
+
202
+ const listRef = ref();
203
+
204
+ const contextmenu = ref(null);
205
+
206
+ const { errorBucket, valid, validatable } = validateFormStateBuilder();
207
+
208
+ let fieldValidator = validateFormFieldBuilder(rules.value);
209
+ let validate = validateFormMethodBuilder(errorBucket, valid, fieldValidator);
210
+
211
+ const hasError = computed(() => {
212
+ return errorBucket.value.length > 0;
213
+ });
214
+
215
+ const customId = 'farm-select-' + (props.id || randomId(2));
216
+
217
+ const showErrorText = computed(() => hasError.value && isTouched.value);
218
+
219
+ watch(
220
+ () => props.modelValue,
221
+ newValue => {
222
+ innerValue.value = newValue;
223
+ errorBucket.value = [];
224
+
225
+ if (
226
+ (multiple.value && newValue === null) ||
227
+ (Array.isArray(newValue) && newValue.length === 0)
228
+ ) {
229
+ multipleValues.value = [];
230
+ }
231
+ if (Array.isArray(newValue) && newValue.length > 0) {
232
+ multipleValues.value = [...newValue];
233
+ }
234
+ validate(newValue);
235
+ updateSelectedTextValue();
236
+ emit('update:modelValue', newValue);
237
+ }
238
+ );
239
+
240
+ watch(
241
+ () => props.items,
242
+ () => {
243
+ errorBucket.value = [];
244
+ validate(innerValue.value);
245
+ updateSelectedTextValue();
246
+ }
247
+ );
248
+
249
+ watch(
250
+ () => innerValue.value,
251
+ () => {
252
+ isTouched.value = true;
253
+ isBlured.value = true;
254
+ validate(innerValue.value);
255
+ emit('update:modelValue', innerValue.value);
256
+ }
257
+ );
258
+
259
+ watch(
260
+ () => props.rules,
261
+ (newVal, oldVal) => {
262
+ if (deepEqual(newVal, oldVal)) return;
263
+ fieldValidator = validateFormFieldBuilder(rules.value);
264
+ validate(innerValue.value);
265
+ }
266
+ );
267
+
268
+ onBeforeMount(() => {
269
+ validate(innerValue.value);
270
+ updateSelectedTextValue();
271
+ });
272
+
273
+ const reset = () => {
274
+ if (disabled.value) {
275
+ return;
276
+ }
277
+ innerValue.value = null;
278
+ multipleValues.value = [];
279
+ selectedText.value = '';
280
+ isTouched.value = true;
281
+ if (multiple.value) {
282
+ innerValue.value = [];
283
+ return;
284
+ }
285
+ emit('update:modelValue', innerValue.value);
286
+ };
287
+
288
+ const onBlur = (event: Event) => {
289
+ isBlured.value = true;
290
+ validate(innerValue.value);
291
+ emit('blur', event);
292
+ };
293
+
294
+ const onFocus = (focus: boolean) => {
295
+ isFocus.value = focus;
296
+ };
297
+
298
+ const selectItem = item => {
299
+ inputField.value.focus();
300
+ if (multiple.value) {
301
+ const alreadyAdded = multipleValues.value.findIndex(
302
+ val => val === item[itemValue.value]
303
+ );
304
+ checked.value = '1';
305
+ if (alreadyAdded !== -1) {
306
+ multipleValues.value.splice(alreadyAdded, 1);
307
+ } else {
308
+ multipleValues.value.push(item[itemValue.value]);
309
+ }
310
+ innerValue.value = [...multipleValues.value];
311
+ return;
312
+ }
313
+
314
+ innerValue.value = item[itemValue.value];
315
+ isVisible.value = false;
316
+
317
+ setTimeout(() => {
318
+ emit('change', innerValue.value);
319
+ }, 100);
320
+
321
+ };
322
+
323
+ const clickInput = () => {
324
+ isTouched.value = true;
325
+ emit('click');
326
+ };
327
+
328
+ const makePristine = () => {
329
+ isTouched.value = false;
330
+ };
331
+
332
+ const updateSelectedTextValue = () => {
333
+ if (
334
+ !items.value ||
335
+ items.value.length === 0 ||
336
+ innerValue.value === null ||
337
+ (multiple.value && multipleValues.value.length === 0)
338
+ ) {
339
+ selectedText.value = '';
340
+ return;
341
+ }
342
+ const selectedItem = items.value.find(
343
+ item => item[itemValue.value] == innerValue.value
344
+ );
345
+
346
+ if (selectedItem) {
347
+ selectedText.value = selectedItem[itemText.value];
348
+ }
349
+
350
+ addLabelToMultiple();
351
+ };
352
+
353
+ const addLabelToMultiple = () => {
354
+ if (multiple.value && Array.isArray(innerValue.value) && innerValue.value.length > 0) {
355
+ const labelItem = items.value.find(
356
+ item => item[itemValue.value] === innerValue.value[0]
357
+ );
358
+
359
+ if (innerValue.value.length === 0) {
360
+ selectedText.value = '';
361
+ return;
362
+ } else if (innerValue.value.length === 1) {
363
+ selectedText.value = labelItem[itemText.value];
364
+ return;
365
+ }
366
+
367
+ selectedText.value = `${labelItem[itemText.value]} (+${innerValue.value.length - 1
368
+ } ${innerValue.value.length - 1 === 1 ? 'outro' : 'outros'})`;
369
+ }
370
+ };
371
+
372
+ const isChecked = item => {
373
+ return (
374
+ multiple.value &&
375
+ multipleValues.value.findIndex(val => val === item[itemValue.value]) !== -1
376
+ );
377
+ };
378
+
379
+ function onKeyDown(e) {
380
+ if (props.readonly) return;
381
+
382
+ if (['Space'].includes(e.code)) {
383
+ isVisible.value = true;
384
+ e.currentTarget.click();
385
+ }
386
+ if (['Escape'].includes(e.code)) {
387
+ isVisible.value = false;
388
+ }
389
+
390
+ if (keys[e.code]) {
391
+ listRef.value.focus(keys[e.code]);
392
+ }
393
+
394
+ e.preventDefault();
395
+ }
396
+
397
+ function addFocusToInput() {
398
+ inputField.value.focus();
399
+ }
400
+
401
+ return {
402
+ items,
403
+ innerValue,
404
+ selectedText,
405
+ errorBucket,
406
+ valid,
407
+ validatable,
408
+ hasError,
409
+ isTouched,
410
+ isBlured,
411
+ isFocus,
412
+ isVisible,
413
+ customId,
414
+ showErrorText,
415
+ contextmenu,
416
+ validate,
417
+ reset,
418
+ selectItem,
419
+ onBlur,
420
+ onFocus,
421
+ clickInput,
422
+ updateSelectedTextValue,
423
+ makePristine,
424
+ checked,
425
+ notChecked,
426
+ isChecked,
427
+ multipleValues,
428
+ addLabelToMultiple,
429
+ inputField,
430
+ onKeyDown,
431
+ addFocusToInput,
432
+ listRef,
433
+ };
434
+ },
435
+ };
436
+ </script>
437
+ <style lang="scss" scoped>
438
+ @import 'Select';
439
+ </style>
@@ -0,0 +1,174 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import Select from '../Select';
3
+
4
+ describe('Select component', () => {
5
+ let wrapper;
6
+ let component;
7
+
8
+ beforeEach(() => {
9
+ wrapper = shallowMount(Select);
10
+ component = wrapper.vm;
11
+ });
12
+
13
+ test('Created hook', () => {
14
+ expect(wrapper).toBeDefined();
15
+ });
16
+
17
+ describe('mount component', () => {
18
+ it('renders correctly', () => {
19
+ expect(wrapper.element).toMatchSnapshot();
20
+ });
21
+ });
22
+
23
+ describe('methods', () => {
24
+ it('reset', () => {
25
+ component.reset();
26
+ expect(component.isTouched).toBeTruthy();
27
+ expect(component.innerValue).toEqual(null);
28
+ });
29
+
30
+ it('onBlur', () => {
31
+ component.onBlur();
32
+ expect(component.isBlured).toBeTruthy();
33
+ });
34
+
35
+ it('clickInput', () => {
36
+ component.clickInput();
37
+ expect(component.isTouched).toBeTruthy();
38
+ });
39
+
40
+ it('updateSelectedTextValue', () => {
41
+ component.updateSelectedTextValue();
42
+ expect(component.selectedText).toBeDefined();
43
+ });
44
+
45
+ it('makePristine', () => {
46
+ component.isTouched = true;
47
+ component.makePristine();
48
+ expect(component.isTouched).toBeFalsy();
49
+ });
50
+
51
+ describe('isChecked', () => {
52
+ it('should return false when multiple is false', async () => {
53
+ component.multipleValues = [0, 1, 2];
54
+ const result = component.isChecked({ value: 1 });
55
+ expect(result).toBe(false);
56
+ });
57
+ it('should return true when multiple is true and item is checked', async () => {
58
+ await wrapper.setProps({
59
+ multiple: true,
60
+ });
61
+ component.multipleValues = [0, 1, 2];
62
+ const result = component.isChecked({ value: 1 });
63
+ expect(result).toBe(true);
64
+ });
65
+ it('should return false when item is not checked', async () => {
66
+ await wrapper.setProps({
67
+ multiple: true,
68
+ });
69
+ component.multipleValues = [0, 1, 2];
70
+ const result = component.isChecked({ value: 3 });
71
+ expect(result).toBe(false);
72
+ });
73
+ });
74
+ describe('addLabelToMultiple', () => {
75
+ it('should not do anything when multiple is false', async () => {
76
+ component.addLabelToMultiple();
77
+
78
+ expect(component.selectedText).toBe('');
79
+ });
80
+ it('should return a selectedText to a selected item', async () => {
81
+ await wrapper.setProps({
82
+ multiple: true,
83
+ items: [
84
+ { value: 0, text: 'value 0' },
85
+ { value: 1, text: 'value 1' },
86
+ { value: 2, text: 'value 2' },
87
+ { value: 3, text: 'value 3' },
88
+ ],
89
+ modelValue: [0],
90
+ });
91
+
92
+ component.addLabelToMultiple();
93
+ expect(component.selectedText).toBe('value 0');
94
+ });
95
+ it('should return a selectedText to two selected item', async () => {
96
+ await wrapper.setProps({
97
+ multiple: true,
98
+ items: [
99
+ { value: 0, text: 'value 0' },
100
+ { value: 1, text: 'value 1' },
101
+ { value: 2, text: 'value 2' },
102
+ { value: 3, text: 'value 3' },
103
+ ],
104
+ modelValue: [0, 1],
105
+ });
106
+
107
+ component.addLabelToMultiple();
108
+ expect(component.selectedText).toBe('value 0 (+1 outro)');
109
+ });
110
+
111
+ it('should return a selectedText to three or more selected item', async () => {
112
+ await wrapper.setProps({
113
+ multiple: true,
114
+ items: [
115
+ { value: 0, text: 'value 0' },
116
+ { value: 1, text: 'value 1' },
117
+ { value: 2, text: 'value 2' },
118
+ { value: 3, text: 'value 3' },
119
+ ],
120
+ modelValue: [0, 1, 2],
121
+ });
122
+
123
+ component.addLabelToMultiple();
124
+ expect(component.selectedText).toBe('value 0 (+2 outros)');
125
+ });
126
+ });
127
+
128
+ describe('onKeyDown', () => {
129
+ it('should open the ContextMenu and click on current element', () => {
130
+ const event = {
131
+ code: 'Space',
132
+ preventDefault: jest.fn(),
133
+ currentTarget: {
134
+ click: jest.fn(),
135
+ },
136
+ };
137
+ component.onKeyDown(event);
138
+
139
+ expect(component.isVisible).toBeTruthy();
140
+ expect(event.currentTarget.click).toHaveBeenCalled();
141
+ expect(event.preventDefault).toHaveBeenCalled();
142
+ });
143
+ it('should open the ContextMenu and click on current element when prop readonly is true', async () => {
144
+ await wrapper.setProps({
145
+ readonly: true,
146
+ });
147
+ const event = {
148
+ code: 'Space',
149
+ preventDefault: jest.fn(),
150
+ currentTarget: {
151
+ click: jest.fn(),
152
+ },
153
+ };
154
+ component.onKeyDown(event);
155
+
156
+ expect(component.isVisible).toBeFalsy();
157
+ expect(event.currentTarget.click).not.toHaveBeenCalled();
158
+ expect(event.preventDefault).not.toHaveBeenCalled();
159
+ });
160
+
161
+ it('should close the ContextMenu', () => {
162
+ const event = {
163
+ code: 'Escape',
164
+ preventDefault: jest.fn(),
165
+ };
166
+ component.onKeyDown(event);
167
+
168
+ expect(component.isVisible).toBeFalsy();
169
+
170
+ expect(event.preventDefault).toHaveBeenCalled();
171
+ });
172
+ });
173
+ });
174
+ });
@@ -0,0 +1,27 @@
1
+ import buildData from '../composition/buildData';
2
+
3
+ describe('buildData', () => {
4
+ it('should initialize with empty arrays and false values', () => {
5
+ const props = { modelValue: [] };
6
+ const result = buildData(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
+ });
19
+
20
+ it('should initialize with provided values', () => {
21
+ const props = { modelValue: 'test' };
22
+ const result = buildData(props);
23
+
24
+ expect(result.multipleValues.value).toEqual([]);
25
+ expect(result.innerValue.value).toBe('test');
26
+ });
27
+ });
@@ -0,0 +1,34 @@
1
+ import { ref } from 'vue';
2
+
3
+ export default function (props) {
4
+ const multipleValues = ref(Array.isArray(props.modelValue) ? [...props.modelValue] : []);
5
+ const innerValue = ref(props.modelValue);
6
+ const isTouched = ref(false);
7
+ const isFocus = ref(false);
8
+ const isBlured = ref(false);
9
+ const isVisible = ref(false);
10
+ const selectedText = ref('');
11
+ const checked = ref('1');
12
+ const notChecked = ref(false);
13
+ const inputField = ref();
14
+ const keys = {
15
+ ArrowDown: 'next',
16
+ ArrowUp: 'prev',
17
+ Home: 'first',
18
+ End: 'last',
19
+ };
20
+
21
+ return {
22
+ multipleValues,
23
+ innerValue,
24
+ isTouched,
25
+ isFocus,
26
+ isBlured,
27
+ isVisible,
28
+ selectedText,
29
+ checked,
30
+ notChecked,
31
+ inputField,
32
+ keys,
33
+ };
34
+ }
@@ -0,0 +1,3 @@
1
+ import buildData from './buildData';
2
+
3
+ export { buildData };
@@ -0,0 +1,4 @@
1
+ import Select from './Select.vue';
2
+
3
+ export { Select };
4
+ export default Select;