@weni/unnnic-system 1.16.17 → 1.16.19-develop.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/.eslintrc.js +20 -20
  2. package/README.md +2 -2
  3. package/babel.config.js +16 -16
  4. package/dist/scss/colors.scss +121 -121
  5. package/dist/scss/fonts.scss +123 -123
  6. package/dist/scss/grid.scss +51 -51
  7. package/dist/scss/spacing.scss +92 -92
  8. package/dist/scss/unnnic.scss +10 -10
  9. package/dist/unnnic.common.js +13 -13
  10. package/dist/unnnic.common.js.map +1 -1
  11. package/dist/unnnic.umd.js +13 -13
  12. package/dist/unnnic.umd.js.map +1 -1
  13. package/dist/unnnic.umd.min.js.map +1 -1
  14. package/jest.config.js +3 -3
  15. package/package-lock.json +60419 -0
  16. package/package.json +4 -4
  17. package/public/index.html +17 -17
  18. package/src/assets/fonts/fonts/icomoon.svg +163 -163
  19. package/src/assets/fonts/icons.css +582 -582
  20. package/src/assets/icons/Brazil.svg +21 -21
  21. package/src/assets/icons/Spain.svg +498 -498
  22. package/src/assets/icons/USA.svg +28 -28
  23. package/src/assets/icons/add-1.svg +3 -3
  24. package/src/assets/icons/add-circle-1.svg +4 -4
  25. package/src/assets/icons/alarm-bell-ring.svg +8 -8
  26. package/src/assets/icons/alert-circle-1-1.svg +3 -3
  27. package/src/assets/icons/alert-circle-1.svg +5 -5
  28. package/src/assets/icons/american-express.svg +4 -4
  29. package/src/assets/icons/app-window-edit-1.svg +4 -4
  30. package/src/assets/icons/app-window-edit-2.svg +9 -9
  31. package/src/assets/icons/arrow-button-down-1.svg +3 -3
  32. package/src/assets/icons/arrow-button-up-1.svg +3 -3
  33. package/src/assets/icons/arrow-down-1-1.svg +3 -3
  34. package/src/assets/icons/arrow-left-1-1.svg +3 -3
  35. package/src/assets/icons/arrow-redo.svg +3 -3
  36. package/src/assets/icons/arrow-right-1-1.svg +3 -3
  37. package/src/assets/icons/arrow-undo.svg +3 -3
  38. package/src/assets/icons/attachment.svg +3 -3
  39. package/src/assets/icons/bin-1-1.svg +5 -5
  40. package/src/assets/icons/book-address-1-2.svg +4 -4
  41. package/src/assets/icons/book-address-2.svg +3 -3
  42. package/src/assets/icons/book-library-1.svg +9 -9
  43. package/src/assets/icons/book-library-2.svg +3 -3
  44. package/src/assets/icons/bookmark-tag-1.svg +3 -3
  45. package/src/assets/icons/building-2-1.svg +13 -13
  46. package/src/assets/icons/button-play-1.svg +4 -4
  47. package/src/assets/icons/button-refresh-arrow-1.svg +3 -3
  48. package/src/assets/icons/button-refresh-arrows-1.svg +4 -4
  49. package/src/assets/icons/charger-1.svg +4 -4
  50. package/src/assets/icons/chat-translate-1.svg +6 -6
  51. package/src/assets/icons/check-2.svg +3 -3
  52. package/src/assets/icons/check-circle-1-1-1.svg +3 -3
  53. package/src/assets/icons/check-circle-1-1.svg +4 -4
  54. package/src/assets/icons/check-double.svg +3 -3
  55. package/src/assets/icons/check-square-1.svg +4 -4
  56. package/src/assets/icons/check-square-2.svg +4 -4
  57. package/src/assets/icons/checkbox-default.svg +3 -3
  58. package/src/assets/icons/checkbox-disable.svg +3 -3
  59. package/src/assets/icons/checkbox-less.svg +4 -4
  60. package/src/assets/icons/checkbox-select.svg +4 -4
  61. package/src/assets/icons/close-1.svg +3 -3
  62. package/src/assets/icons/cog-1.svg +4 -4
  63. package/src/assets/icons/cog-2.svg +3 -3
  64. package/src/assets/icons/common-file-empty-1.svg +3 -3
  65. package/src/assets/icons/common-file-horizontal-image-1.svg +5 -5
  66. package/src/assets/icons/controls-pause-1.svg +4 -4
  67. package/src/assets/icons/controls-play-1.svg +3 -3
  68. package/src/assets/icons/copy-paste-1.svg +7 -7
  69. package/src/assets/icons/currency-dollar-circle-1.svg +4 -4
  70. package/src/assets/icons/default-avatar.svg +5 -5
  71. package/src/assets/icons/delete-1-1.svg +4 -4
  72. package/src/assets/icons/delete-1.svg +3 -3
  73. package/src/assets/icons/delete-2-1.svg +3 -3
  74. package/src/assets/icons/developer-community-github-1-1.svg +3 -3
  75. package/src/assets/icons/diners-club.svg +6 -6
  76. package/src/assets/icons/discover.svg +11 -11
  77. package/src/assets/icons/download-bottom-1.svg +4 -4
  78. package/src/assets/icons/download-thick-bottom-1.svg +4 -4
  79. package/src/assets/icons/drag-1.svg +10 -10
  80. package/src/assets/icons/email-action-unread-1-1.svg +4 -4
  81. package/src/assets/icons/email-action-unread-1.svg +10 -10
  82. package/src/assets/icons/emoji.svg +6 -6
  83. package/src/assets/icons/expand-8-1.svg +6 -6
  84. package/src/assets/icons/expand-full-1.svg +7 -7
  85. package/src/assets/icons/export-1.svg +5 -5
  86. package/src/assets/icons/filter.svg +3 -3
  87. package/src/assets/icons/fitness-biceps-1.svg +3 -3
  88. package/src/assets/icons/flash-1-3.svg +3 -3
  89. package/src/assets/icons/flash-1-4.svg +3 -3
  90. package/src/assets/icons/floppy-disk-1.svg +6 -6
  91. package/src/assets/icons/folder-1.svg +3 -3
  92. package/src/assets/icons/folder-2.svg +3 -3
  93. package/src/assets/icons/gauge-dashboard-1.svg +4 -4
  94. package/src/assets/icons/gauge-dashboard-2.svg +8 -8
  95. package/src/assets/icons/generic-card.svg +4 -4
  96. package/src/assets/icons/graph-stats-1.svg +3 -3
  97. package/src/assets/icons/graph-stats-ascend-2.svg +3 -3
  98. package/src/assets/icons/graph-stats-circle-1-1.svg +4 -4
  99. package/src/assets/icons/graph-stats-circle-1.svg +4 -4
  100. package/src/assets/icons/graph-stats-descend-2.svg +4 -4
  101. package/src/assets/icons/headphones-customer-support-1.svg +3 -3
  102. package/src/assets/icons/headphones-customer-support-2.svg +3 -3
  103. package/src/assets/icons/headphones-customer-support-human-1-1.svg +4 -4
  104. package/src/assets/icons/hierarchy-3-2.svg +3 -3
  105. package/src/assets/icons/hierarchy-3-3.svg +3 -3
  106. package/src/assets/icons/house-1-1.svg +4 -4
  107. package/src/assets/icons/house-2-2.svg +3 -3
  108. package/src/assets/icons/icon-script.py +27 -27
  109. package/src/assets/icons/indicator.svg +3 -3
  110. package/src/assets/icons/information-circle-4.svg +3 -3
  111. package/src/assets/icons/interaction-time.svg +5 -5
  112. package/src/assets/icons/jcb.svg +21 -21
  113. package/src/assets/icons/keyboard-arrow-down-1.svg +3 -3
  114. package/src/assets/icons/keyboard-arrow-left-1.svg +3 -3
  115. package/src/assets/icons/keyboard-arrow-right-1.svg +3 -3
  116. package/src/assets/icons/keyboard-return-1-1.svg +3 -3
  117. package/src/assets/icons/keyboard-return-1.svg +4 -4
  118. package/src/assets/icons/layout-dashboard-1.svg +6 -6
  119. package/src/assets/icons/layout-dashboard-2.svg +6 -6
  120. package/src/assets/icons/layout-module-1-2.svg +6 -6
  121. package/src/assets/icons/loading-circle-1.svg +19 -19
  122. package/src/assets/icons/lock-2-1.svg +4 -4
  123. package/src/assets/icons/lock-2-2.svg +3 -3
  124. package/src/assets/icons/lock-unlock-1-1.svg +4 -4
  125. package/src/assets/icons/logout-1-1.svg +4 -4
  126. package/src/assets/icons/mastercard.svg +6 -6
  127. package/src/assets/icons/messages-bubble-1.svg +3 -3
  128. package/src/assets/icons/messages-bubble-3.svg +3 -3
  129. package/src/assets/icons/messages-bubble-4.svg +3 -3
  130. package/src/assets/icons/messages.svg +3 -3
  131. package/src/assets/icons/messaging-we-chat-2.svg +4 -4
  132. package/src/assets/icons/messaging-we-chat-3.svg +8 -8
  133. package/src/assets/icons/messaging-whatsapp-1.svg +4 -4
  134. package/src/assets/icons/microphone.svg +4 -4
  135. package/src/assets/icons/move-expand-vertical-1.svg +3 -3
  136. package/src/assets/icons/navigation-menu-vertical-1.svg +5 -5
  137. package/src/assets/icons/notes-1.svg +7 -7
  138. package/src/assets/icons/office-file-pdf-1-1.svg +6 -6
  139. package/src/assets/icons/paginate-filter-text-1.svg +7 -7
  140. package/src/assets/icons/pencil-write-1.svg +4 -4
  141. package/src/assets/icons/phone-3.svg +3 -3
  142. package/src/assets/icons/phone-4.svg +3 -3
  143. package/src/assets/icons/phone-charger-1.svg +3 -3
  144. package/src/assets/icons/photography-equipment-bag-1.svg +5 -5
  145. package/src/assets/icons/pie-line-graph-1.svg +7 -7
  146. package/src/assets/icons/preferences.svg +11 -11
  147. package/src/assets/icons/question-circle-1.svg +5 -5
  148. package/src/assets/icons/question-circle-2.svg +3 -3
  149. package/src/assets/icons/radio-default.svg +3 -3
  150. package/src/assets/icons/radio-disable.svg +3 -3
  151. package/src/assets/icons/radio-selected.svg +4 -4
  152. package/src/assets/icons/rating-star-1-1.svg +3 -3
  153. package/src/assets/icons/rating-star-1.svg +3 -3
  154. package/src/assets/icons/read-email-at-1.svg +10 -10
  155. package/src/assets/icons/response-time.svg +12 -12
  156. package/src/assets/icons/science-fiction-robot-1.svg +8 -8
  157. package/src/assets/icons/science-fiction-robot-2.svg +5 -5
  158. package/src/assets/icons/search-1.svg +3 -3
  159. package/src/assets/icons/send-email-3-1.svg +3 -3
  160. package/src/assets/icons/single-neutral-2.svg +4 -4
  161. package/src/assets/icons/single-neutral-actions-1.svg +4 -4
  162. package/src/assets/icons/social-instagram-1.svg +3 -3
  163. package/src/assets/icons/social-media-facebook-1.svg +3 -3
  164. package/src/assets/icons/social-media-google-1.svg +6 -6
  165. package/src/assets/icons/sort-asc.svg +4 -4
  166. package/src/assets/icons/sort-default.svg +4 -4
  167. package/src/assets/icons/sort-desc.svg +4 -4
  168. package/src/assets/icons/study-light-idea-1.svg +10 -10
  169. package/src/assets/icons/subtract-1.svg +3 -3
  170. package/src/assets/icons/subtract-circle-1.svg +4 -4
  171. package/src/assets/icons/switch-default-disabled.svg +4 -4
  172. package/src/assets/icons/switch-default.svg +11 -11
  173. package/src/assets/icons/switch-selected-disabled.svg +4 -4
  174. package/src/assets/icons/switch-selected.svg +11 -11
  175. package/src/assets/icons/synchronize-arrow-clock-4.svg +4 -4
  176. package/src/assets/icons/synchronize-arrow-clock-5.svg +4 -4
  177. package/src/assets/icons/task-checklist-1.svg +4 -4
  178. package/src/assets/icons/task-list-clock-1.svg +9 -9
  179. package/src/assets/icons/text-bold.svg +3 -3
  180. package/src/assets/icons/text-center.svg +7 -7
  181. package/src/assets/icons/text-italic.svg +3 -3
  182. package/src/assets/icons/text-justified.svg +7 -7
  183. package/src/assets/icons/text-left.svg +7 -7
  184. package/src/assets/icons/text-right.svg +7 -7
  185. package/src/assets/icons/text-underline.svg +4 -4
  186. package/src/assets/icons/ticket-1.svg +9 -9
  187. package/src/assets/icons/ticket-2.svg +4 -4
  188. package/src/assets/icons/time-clock-circle-1.svg +4 -4
  189. package/src/assets/icons/transfer-message.svg +4 -4
  190. package/src/assets/icons/translate-1.svg +8 -8
  191. package/src/assets/icons/translate-2.svg +8 -8
  192. package/src/assets/icons/typing-1.svg +4 -4
  193. package/src/assets/icons/unionpay.svg +7 -7
  194. package/src/assets/icons/unordered-list.svg +8 -8
  195. package/src/assets/icons/upload-bottom-1.svg +4 -4
  196. package/src/assets/icons/video-file-mp4-1.svg +6 -6
  197. package/src/assets/icons/view-1-1.svg +4 -4
  198. package/src/assets/icons/view-off-1.svg +7 -7
  199. package/src/assets/icons/vip-crown-queen-2.svg +4 -4
  200. package/src/assets/icons/visa.svg +8 -8
  201. package/src/assets/img/flag/en.svg +28 -28
  202. package/src/assets/img/flag/pt-br.svg +21 -21
  203. package/src/assets/scss/colors.scss +121 -121
  204. package/src/assets/scss/fonts.scss +123 -123
  205. package/src/assets/scss/grid.scss +51 -51
  206. package/src/assets/scss/spacing.scss +92 -92
  207. package/src/assets/scss/unnnic.scss +10 -10
  208. package/src/components/Accordion/Accordion.vue +142 -142
  209. package/src/components/Alert/Alert.vue +145 -145
  210. package/src/components/Alert/AlertCaller.vue +49 -49
  211. package/src/components/Alert/Version1dot1.vue +146 -146
  212. package/src/components/AudioRecorder/AudioHandler.vue +96 -96
  213. package/src/components/AudioRecorder/AudioPlayer.vue +197 -197
  214. package/src/components/AudioRecorder/AudioRecorder.vue +357 -357
  215. package/src/components/AutocompleteSelect/AutocompleteSelect.vue +318 -318
  216. package/src/components/AvatarIcon/AvatarIcon.vue +90 -90
  217. package/src/components/Banner/Banner.vue +80 -80
  218. package/src/components/Banner/InfoBanner.vue +158 -158
  219. package/src/components/Breadcrumb/Breadcrumb.vue +80 -80
  220. package/src/components/Button/Button.vue +314 -314
  221. package/src/components/Button/ButtonIcon.vue +103 -103
  222. package/src/components/Card/AccountCard.vue +94 -94
  223. package/src/components/Card/BlankCard.vue +83 -83
  224. package/src/components/Card/Card.vue +197 -197
  225. package/src/components/Card/CardCompany.vue +289 -289
  226. package/src/components/Card/CardData.vue +117 -117
  227. package/src/components/Card/CardStatusesContainer.vue +222 -222
  228. package/src/components/Card/ContentCard.vue +135 -135
  229. package/src/components/Card/DashCard.vue +141 -141
  230. package/src/components/Card/DefaultCard.vue +81 -81
  231. package/src/components/Card/MarketplaceCard.vue +173 -173
  232. package/src/components/Card/StatusCard.vue +104 -104
  233. package/src/components/Card/TitleCard.vue +96 -96
  234. package/src/components/CardFlow/CardFlow.vue +175 -175
  235. package/src/components/CardImage/CardImage.vue +150 -150
  236. package/src/components/CardInformation/CardInformation.vue +65 -65
  237. package/src/components/CardNumber/CardNumber.vue +61 -61
  238. package/src/components/CardProject/CardProject.vue +73 -73
  239. package/src/components/Carousel/Carousel.vue +62 -62
  240. package/src/components/Carousel/TagCarousel.vue +190 -190
  241. package/src/components/ChartBar/ChartBar.vue +395 -395
  242. package/src/components/ChartLine/ChartLine.vue +300 -300
  243. package/src/components/ChartRainbow/ChartRainbow.vue +160 -160
  244. package/src/components/ChatText/ChatText.vue +156 -156
  245. package/src/components/Checkbox/Checkbox.vue +139 -139
  246. package/src/components/CircleProgressBar/CircleProgressBar.vue +146 -146
  247. package/src/components/Comment/Comment.vue +99 -99
  248. package/src/components/DataArea/DataArea.vue +96 -96
  249. package/src/components/DateFilter/DateFilter.vue +78 -78
  250. package/src/components/DatePicker/DatePicker.vue +806 -806
  251. package/src/components/Dropdown/Dropdown.vue +109 -109
  252. package/src/components/Dropdown/DropdownItem.vue +31 -31
  253. package/src/components/Dropdown/DropdownSkeleton.vue +164 -164
  254. package/src/components/Dropdown/LanguageSelect.vue +261 -261
  255. package/src/components/Flag.vue +41 -41
  256. package/src/components/FormElement/FormElement.vue +60 -60
  257. package/src/components/Icon.vue +157 -157
  258. package/src/components/ImportCard/ImportCard.vue +199 -199
  259. package/src/components/Indicator/Indicator.vue +108 -108
  260. package/src/components/Input/Autocomplete.vue +325 -325
  261. package/src/components/Input/BaseInput.vue +176 -176
  262. package/src/components/Input/Input.vue +154 -154
  263. package/src/components/Input/TextInput.vue +186 -186
  264. package/src/components/InputDatePicker/InputDatePicker.vue +193 -193
  265. package/src/components/InputNext/InputNext.vue +260 -260
  266. package/src/components/Label/Label.vue +30 -30
  267. package/src/components/Modal/CallModal.vue +23 -23
  268. package/src/components/Modal/Modal.vue +208 -208
  269. package/src/components/ModalNext/ModalNext.vue +396 -396
  270. package/src/components/ModalUpload/ModalUpload.vue +177 -177
  271. package/src/components/MoodRating/MoodRating.vue +115 -115
  272. package/src/components/MultiSelect/MultiSelect.vue +274 -274
  273. package/src/components/Pagination/Pagination.vue +164 -164
  274. package/src/components/ProgressBar/ProgressBar.vue +232 -232
  275. package/src/components/Radio/Radio.vue +133 -133
  276. package/src/components/Select/Select.vue +409 -409
  277. package/src/components/Select/SelectItem.vue +79 -79
  278. package/src/components/SelectListItem/SelectListItem.vue +125 -125
  279. package/src/components/Sidebar/Sidebar.vue +91 -91
  280. package/src/components/Sidebar/SidebarItem.vue +90 -90
  281. package/src/components/Sidebar/SidebarMenu.vue +34 -34
  282. package/src/components/Sidebar/SidebarPrimary.vue +384 -384
  283. package/src/components/SkeletonLoading/SkeletonLoading.vue +115 -115
  284. package/src/components/SkeletonLoading/skeletonTheme.vue +74 -74
  285. package/src/components/Slider/Slider.vue +317 -317
  286. package/src/components/StarRating/StarRating.vue +71 -71
  287. package/src/components/Switch/Switch.vue +170 -170
  288. package/src/components/Tab/Tab.vue +129 -129
  289. package/src/components/Table/Table.vue +115 -115
  290. package/src/components/Table/TableRow.vue +75 -75
  291. package/src/components/TabsExpanded/TabsExpanded.vue +131 -131
  292. package/src/components/Tag/BrandTag.vue +97 -97
  293. package/src/components/Tag/DefaultTag.vue +124 -124
  294. package/src/components/Tag/IndicatorTag.vue +104 -104
  295. package/src/components/Tag/Tag.vue +87 -87
  296. package/src/components/TextArea/TextArea.vue +200 -200
  297. package/src/components/TextEditor/TextEditor.vue +530 -530
  298. package/src/components/ToolTip/ToolTip.vue +192 -192
  299. package/src/components/UploadArea/UploadArea.vue +386 -386
  300. package/src/components/config.js +2 -2
  301. package/src/components/grid/Grid.vue +45 -45
  302. package/src/components/index.js +220 -220
  303. package/src/locales/en.json +15 -15
  304. package/src/locales/es.json +15 -15
  305. package/src/locales/pt_br.json +15 -15
  306. package/src/main.js +13 -13
  307. package/src/stories/Accordion.stories.js +46 -46
  308. package/src/stories/Alert.stories.js +58 -58
  309. package/src/stories/AudioRecorder.stories.js +48 -48
  310. package/src/stories/Autocomplete.stories.js +55 -55
  311. package/src/stories/AutocompleteSelect.stories.js +45 -45
  312. package/src/stories/AvatarIcon.stories.js +24 -24
  313. package/src/stories/Banner.stories.js +46 -46
  314. package/src/stories/Breadcrumb.stories.js +31 -31
  315. package/src/stories/Button.stories.js +49 -49
  316. package/src/stories/ButtonIcon.stories.js +40 -40
  317. package/src/stories/Card.stories.js +118 -118
  318. package/src/stories/CardCompany.stories.js +52 -52
  319. package/src/stories/CardData.stories.js +41 -41
  320. package/src/stories/CardFlow.stories.js +44 -44
  321. package/src/stories/CardImage.stories.js +56 -56
  322. package/src/stories/CardInformation.stories.js +64 -64
  323. package/src/stories/CardNumber.stories.js +35 -35
  324. package/src/stories/CardProject.stories.js +70 -70
  325. package/src/stories/Carousel.stories.js +38 -38
  326. package/src/stories/ChartBar.stories.js +119 -119
  327. package/src/stories/ChartLine.stories.js +55 -55
  328. package/src/stories/ChartRainbow.stories.js +34 -34
  329. package/src/stories/ChatText.stories.js +62 -62
  330. package/src/stories/Checkbox.stories.js +28 -28
  331. package/src/stories/CircleProgressBar.stories.js +36 -36
  332. package/src/stories/Colors.stories.mdx +91 -91
  333. package/src/stories/Comment.stories.js +59 -59
  334. package/src/stories/DataArea.stories.js +75 -75
  335. package/src/stories/DateFilter.stories.js +23 -23
  336. package/src/stories/DatePicker.stories.js +87 -87
  337. package/src/stories/Dropdown.stories.js +19 -19
  338. package/src/stories/DropdownSkeleton.stories.js +15 -15
  339. package/src/stories/Font.stories.mdx +80 -80
  340. package/src/stories/FormElement.stories.js +40 -40
  341. package/src/stories/Grid.stories.js +20 -20
  342. package/src/stories/Icon.stories.js +64 -64
  343. package/src/stories/ImportCard.stories.js +35 -35
  344. package/src/stories/Indicator.stories.js +23 -23
  345. package/src/stories/Input.stories.js +63 -63
  346. package/src/stories/InputDatePicker.stories.js +53 -53
  347. package/src/stories/InputNext.stories.js +109 -109
  348. package/src/stories/Introduction.stories.mdx +207 -207
  349. package/src/stories/Label.stories.js +20 -20
  350. package/src/stories/LanguageSelect.stories.js +28 -28
  351. package/src/stories/Modal.stories.js +58 -58
  352. package/src/stories/ModalNext.stories.js +171 -171
  353. package/src/stories/ModalUpload.stories.js +29 -29
  354. package/src/stories/MoodRating.stories.js +37 -37
  355. package/src/stories/MultiSelect.stories.js +55 -55
  356. package/src/stories/Pagination.stories.js +31 -31
  357. package/src/stories/ProgressBar.stories.js +73 -73
  358. package/src/stories/Radio.stories.js +46 -46
  359. package/src/stories/Select.stories.js +62 -62
  360. package/src/stories/SelectListItem.stories.js +63 -63
  361. package/src/stories/Sidebar.stories.js +37 -37
  362. package/src/stories/SidebarPrimary.stories.js +83 -83
  363. package/src/stories/SkeletonLoading.stories.js +34 -34
  364. package/src/stories/Slider.stories.js +29 -29
  365. package/src/stories/StarRating.stories.js +38 -38
  366. package/src/stories/Switch.stories.js +31 -31
  367. package/src/stories/Tab.stories.js +42 -42
  368. package/src/stories/Table.stories.js +145 -145
  369. package/src/stories/TabsExpanded.stories.js +68 -68
  370. package/src/stories/Tag.stories.js +46 -46
  371. package/src/stories/TextArea.stories.js +43 -43
  372. package/src/stories/TextEditor.stories.js +80 -80
  373. package/src/stories/ToolTip.stories.js +27 -27
  374. package/src/stories/UploadArea.stories.js +51 -51
  375. package/src/utils/call.js +25 -25
  376. package/src/utils/colorsList.js +38 -38
  377. package/src/utils/emojiList.js +47 -47
  378. package/src/utils/iconList.js +108 -108
  379. package/src/utils/icons.js +359 -359
  380. package/src/utils/plugins/i18n.js +26 -26
  381. package/vue.config.js +26 -26
@@ -1,530 +1,530 @@
1
- <template>
2
- <div :class="['unnnic-text-editor', loadingValue !== undefined && 'status-loading']">
3
- <div v-if="loadingValue !== undefined" class="loading">
4
- <div class="indicator" :style="{ width: `${loadingValue * 100}%` }"></div>
5
- </div>
6
-
7
- <div class="text-editor" @click="$refs.oDoc.focus()">
8
- <textarea
9
- class="inside"
10
- ref="oDoc"
11
- :value="value"
12
- @input="$emit('input', $event.srcElement.value)"
13
- @keydown="$emit('keydown', $event)"
14
- @focus="isFocused = true"
15
- @blur="isFocused = false"
16
- ></textarea>
17
-
18
- <!-- <div
19
- class="inside"
20
- contenteditable="true"
21
- v-html="initialContent"
22
- @input="onInput"
23
- @keydown="$emit('keydown', $event)"
24
- @focus="isFocused = true"
25
- @blur="isFocused = false"
26
- ></div> -->
27
-
28
- <div v-if="$slots['footer-input']" class="footer-input" @click.stop>
29
- <slot name="footer-input" />
30
- </div>
31
- </div>
32
-
33
- <div class="actions">
34
- <unnnic-tool-tip
35
- side="left"
36
- :text="text('action')"
37
- enabled
38
- >
39
- <unnnic-button-icon
40
- @click="$emit('action')"
41
- type="secondary"
42
- size="small"
43
- icon="flash-1-4"
44
- />
45
- </unnnic-tool-tip>
46
-
47
- <unnnic-button-icon
48
- @click="$emit('send')"
49
- type="secondary"
50
- size="small"
51
- icon="send-email-3-1"
52
- />
53
- </div>
54
-
55
- <div class="format">
56
- <unnnic-tool-tip
57
- side="top"
58
- :text="text('Undo')"
59
- enabled
60
- >
61
- <unnnic-icon
62
- icon="arrow-undo"
63
- size="ant"
64
- clickable
65
- scheme="neutral-cloudy"
66
- @click="formatDoc('undo')"
67
- />
68
- </unnnic-tool-tip>
69
-
70
- <unnnic-tool-tip
71
- side="top"
72
- :text="text('Redo')"
73
- enabled
74
- >
75
- <unnnic-icon
76
- icon="arrow-redo"
77
- size="ant"
78
- clickable
79
- scheme="neutral-cloudy"
80
- @click="formatDoc('redo')"
81
- />
82
- </unnnic-tool-tip>
83
-
84
- <unnnic-tool-tip
85
- side="top"
86
- :text="text('RecordAudio')"
87
- enabled
88
- >
89
- <unnnic-icon
90
- icon="microphone"
91
- size="ant"
92
- clickable
93
- scheme="neutral-cloudy"
94
- @mousedown="$emit('record-audio-down')"
95
- @mouseup="$emit('record-audio-up')"
96
- @click="$emit('record-audio')"
97
- />
98
- </unnnic-tool-tip>
99
-
100
- <unnnic-tool-tip
101
- side="top"
102
- :text="text('Attach')"
103
- :enabled="!attachmentOptionsOpen"
104
- >
105
- <unnnic-dropdown
106
- :open.sync="attachmentOptionsOpen"
107
- position="none"
108
- class="attachment-options-dropdown"
109
- >
110
- <unnnic-icon
111
- slot="trigger"
112
- icon="attachment"
113
- size="ant"
114
- clickable
115
- scheme="neutral-cloudy"
116
- />
117
-
118
- <div class="attachment-options-container">
119
- <slot name="attachment-options" />
120
- </div>
121
- </unnnic-dropdown>
122
- </unnnic-tool-tip>
123
-
124
- <!-- <unnnic-icon
125
- icon="email-action-unread-1"
126
- size="ant"
127
- clickable
128
- scheme="neutral-cloudy"
129
- /> -->
130
-
131
- <!--
132
-
133
- <unnnic-tool-tip
134
- side="top"
135
- :text="text('Bold')"
136
- enabled
137
- :style="{ marginLeft: '1rem', }"
138
- >
139
- <unnnic-icon
140
- icon="text-bold"
141
- size="ant"
142
- clickable
143
- scheme="neutral-cloudy"
144
- @click="formatDoc('bold')"
145
- />
146
- </unnnic-tool-tip>
147
-
148
- <unnnic-tool-tip
149
- side="top"
150
- :text="text('Italic')"
151
- enabled
152
- >
153
- <unnnic-icon
154
- icon="text-italic"
155
- size="ant"
156
- clickable
157
- scheme="neutral-cloudy"
158
- @click="formatDoc('italic')"
159
- />
160
- </unnnic-tool-tip>
161
-
162
- <unnnic-tool-tip
163
- side="top"
164
- :text="text('Underline')"
165
- enabled
166
- >
167
- <unnnic-icon
168
- icon="text-underline"
169
- size="ant"
170
- clickable
171
- scheme="neutral-cloudy"
172
- @click="formatDoc('underline')"
173
- />
174
- </unnnic-tool-tip>
175
-
176
- <unnnic-tool-tip
177
- side="top"
178
- :text="text('List')"
179
- enabled
180
- >
181
- <unnnic-icon
182
- icon="unordered-list"
183
- size="ant"
184
- clickable
185
- scheme="neutral-cloudy"
186
- @click="formatDoc('insertunorderedlist')"
187
- />
188
- </unnnic-tool-tip>
189
-
190
- <unnnic-tool-tip
191
- side="top"
192
- :text="text('Left')"
193
- enabled
194
- >
195
- <unnnic-icon
196
- icon="text-left"
197
- size="ant"
198
- clickable
199
- scheme="neutral-cloudy"
200
- @click="formatDoc('justifyleft')"
201
- />
202
- </unnnic-tool-tip>
203
-
204
- <unnnic-tool-tip
205
- side="top"
206
- :text="text('Center')"
207
- enabled
208
- >
209
- <unnnic-icon
210
- icon="text-center"
211
- size="ant"
212
- clickable
213
- scheme="neutral-cloudy"
214
- @click="formatDoc('justifycenter')"
215
- />
216
- </unnnic-tool-tip>
217
-
218
- <unnnic-tool-tip
219
- side="top"
220
- :text="text('Right')"
221
- enabled
222
- >
223
- <unnnic-icon
224
- icon="text-right"
225
- size="ant"
226
- clickable
227
- scheme="neutral-cloudy"
228
- @click="formatDoc('justifyright')"
229
- />
230
- </unnnic-tool-tip>
231
-
232
- <unnnic-tool-tip
233
- side="top"
234
- :text="text('Justify')"
235
- enabled
236
- >
237
- <unnnic-icon
238
- icon="text-justified"
239
- size="ant"
240
- clickable
241
- scheme="neutral-cloudy"
242
- @click="formatDoc('justifyFull')"
243
- />
244
- </unnnic-tool-tip>
245
-
246
- -->
247
- </div>
248
- </div>
249
- </template>
250
-
251
- <script>
252
- import UnnnicButtonIcon from '../Button/ButtonIcon.vue';
253
- import UnnnicToolTip from '../ToolTip/ToolTip.vue';
254
- import UnnnicIcon from '../Icon.vue';
255
- import UnnnicDropdown from '../Dropdown/Dropdown.vue';
256
-
257
- export default {
258
- components: {
259
- UnnnicButtonIcon,
260
- UnnnicToolTip,
261
- UnnnicIcon,
262
- UnnnicDropdown,
263
- },
264
-
265
- props: {
266
- loadingValue: {
267
- type: Number,
268
- },
269
-
270
- value: {
271
- type: String,
272
- default: '',
273
- },
274
-
275
- texts: {
276
- type: Object,
277
- default() {
278
- return {
279
- Undo: 'Undo',
280
- Redo: 'Redo',
281
- RecordAudio: 'Record Audio',
282
- Bold: 'Bold',
283
- Italic: 'Italic',
284
- Underline: 'Underline',
285
- List: 'List',
286
- Left: 'Left',
287
- Center: 'Center',
288
- Right: 'Right',
289
- Justify: 'Justify',
290
- Attach: 'Attach',
291
- action: 'Mensagens rápidas',
292
- };
293
- },
294
- },
295
-
296
- tags: {
297
- type: Array,
298
- default() {
299
- return ['b', 'i', 'u', 'ul', 'li', 'br', 'div'];
300
- },
301
- },
302
-
303
- attributes: {
304
- type: Array,
305
- default() {
306
- return ['style'];
307
- },
308
- },
309
-
310
- styleProperties: {
311
- type: Array,
312
- default() {
313
- return ['text-align'];
314
- },
315
- },
316
- },
317
-
318
- data() {
319
- return {
320
- initialContent: '',
321
-
322
- attachmentOptionsOpen: false,
323
-
324
- isFocused: false,
325
-
326
- lastValueFromInside: '',
327
- };
328
- },
329
-
330
- computed: {},
331
-
332
- created() {
333
- this.initialContent = this.value;
334
- document.execCommand('defaultParagraphSeparator', false, 'div');
335
- },
336
-
337
- watch: {
338
- value: {
339
- immediate: true,
340
-
341
- handler() {
342
- // if (this.value !== this.lastValueFromInside) {
343
- // this.$refs.oDoc.innerHTML = this.value;
344
- // }
345
-
346
- this.$nextTick(() => {
347
- this.$refs.oDoc.style.minHeight = 0;
348
- this.$refs.oDoc.style.minHeight = `${this.$refs.oDoc.scrollHeight}px`;
349
- });
350
- },
351
- },
352
- },
353
-
354
- methods: {
355
- formatDoc(sCmd, sValue) {
356
- this.$refs.oDoc.focus();
357
- document.execCommand(sCmd, false, sValue);
358
- this.$refs.oDoc.focus();
359
- },
360
-
361
- validateMode() {
362
- return this.$refs.oDoc.focus();
363
- },
364
-
365
- emitInput() {
366
- this.lastValueFromInside = this.$refs.oDoc.innerHTML;
367
-
368
- this.lastValueFromInside = this.lastValueFromInside.replace(/<(\/)?([^> ]+)( [^>]+)?>/gi, ($1, $2 = '', $3, $4 = '') => {
369
- if (this.tags.includes($3)) {
370
- const complements = [];
371
-
372
- // eslint-disable-next-line no-restricted-syntax
373
- for (const i of $4.matchAll(/((?<name1>[^ =]+)="(?<value1>[^"]*)"|(?<name2>[^ =]+)='(?<value2>[^"]*)')/g)) {
374
- const name = i.groups.name1 || i.groups.name2;
375
- const value = i.groups.value1 || i.groups.value2;
376
-
377
- if (this.attributes.includes('style') && name === 'style') {
378
- const styles = [];
379
-
380
- // eslint-disable-next-line no-restricted-syntax
381
- for (const j of value.matchAll(/(?<propertyName>[^:]+):(?<propertyValue>[^;]+);?/g)) {
382
- if (this.styleProperties.includes(j.groups.propertyName.toLowerCase().trim())) {
383
- styles.push(`${j.groups.propertyName.toLowerCase().trim()}: ${j.groups.propertyValue.trim()}`);
384
- }
385
- }
386
-
387
- complements.push(`style="${styles.join('; ')};"`);
388
- }
389
- }
390
-
391
- return `<${$2}${$3}${complements.length ? ` ${complements.join(' ')}` : ''}>`;
392
- }
393
-
394
- return '';
395
- });
396
-
397
- this.$emit('input', this.lastValueFromInside);
398
- },
399
-
400
- onInput() {
401
- this.emitInput();
402
- },
403
-
404
- setValue(value) {
405
- this.$refs.oDoc.innerHTML = value;
406
- this.emitInput();
407
- },
408
-
409
- clear() {
410
- this.$refs.oDoc.innerHTML = '';
411
- this.emitInput();
412
- },
413
-
414
- text(key) {
415
- return this.texts[key];
416
- },
417
- },
418
- };
419
- </script>
420
-
421
- <style lang="scss" scoped>
422
- @import "../../assets/scss/unnnic.scss";
423
-
424
- .unnnic-text-editor {
425
- display: grid;
426
- grid-template-areas:
427
- "loading loading-side"
428
- "text-editor actions"
429
- "format empty";
430
- grid-template-columns: 1fr auto;
431
- grid-column-gap: $unnnic-spacing-inline-xs;
432
-
433
- .loading {
434
- grid-area: loading;
435
- width: 100%;
436
- height: $unnnic-border-width-thin;
437
- border-radius: $unnnic-border-radius-sm $unnnic-border-radius-sm 0 0;
438
- position: relative;
439
- overflow: hidden;
440
- background-color: rgba($unnnic-color-neutral-cleanest, $unnnic-opacity-level-light);
441
-
442
- .indicator {
443
- height: $unnnic-border-width-thin;
444
- background-color: $unnnic-color-neutral-cleanest;
445
- transition: width 0.2s;
446
- }
447
- }
448
-
449
- &:not(.status-loading) .text-editor {
450
- border-radius: $unnnic-border-radius-sm;
451
- }
452
-
453
- .text-editor {
454
- grid-area: text-editor;
455
- height: 7.25 * $unnnic-font-size;
456
- box-sizing: border-box;
457
- overflow: auto;
458
- background-color: $unnnic-color-neutral-snow;
459
- border-radius: 0 0 $unnnic-border-radius-sm $unnnic-border-radius-sm;
460
- padding: $unnnic-spacing-inset-sm;
461
- border: $unnnic-border-width-thinner solid $unnnic-color-neutral-clean;
462
- outline: none;
463
- color: $unnnic-color-neutral-cloudy;
464
- font-family: $unnnic-font-family-secondary;
465
- font-size: $unnnic-font-size-body-gt;
466
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
467
- font-weight: $unnnic-font-weight-regular;
468
- cursor: text;
469
- display: flex;
470
- flex-direction: column;
471
-
472
- .inside {
473
- color: $unnnic-color-neutral-cloudy;
474
- font-family: $unnnic-font-family-secondary;
475
- font-size: $unnnic-font-size-body-gt;
476
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
477
- font-weight: $unnnic-font-weight-regular;
478
- border: none;
479
- padding: 0;
480
- resize: none;
481
- overflow-y: hidden;
482
-
483
- flex: 1;
484
- outline: none;
485
-
486
- ::v-deep p {
487
- margin: 0;
488
- }
489
- }
490
-
491
- .footer-input {
492
- margin-top: $unnnic-spacing-stack-xs;
493
- align-self: flex-start;
494
- cursor: initial;
495
- }
496
-
497
- p {
498
- margin: 0;
499
- }
500
- }
501
-
502
- .actions {
503
- grid-area: actions;
504
- display: flex;
505
- flex-direction: column;
506
- gap: $unnnic-spacing-stack-xs;
507
- place-self: center;
508
- }
509
-
510
- .format {
511
- grid-area: format;
512
- place-self: center;
513
- padding: $unnnic-spacing-inset-nano;
514
- user-select: none;
515
- display: flex;
516
- gap: $unnnic-spacing-inline-xs;
517
-
518
- .attachment-options-dropdown ::v-deep .unnnic-dropdown__content {
519
- padding: 0;
520
- bottom: 100%;
521
- margin-bottom: 0.5 * $unnnic-font-size;
522
- right: (-10.375 * $unnnic-font-size / 2) + 0.625 * $unnnic-font-size;
523
- }
524
-
525
- .attachment-options-container {
526
- width: 10.375 * $unnnic-font-size;
527
- }
528
- }
529
- }
530
- </style>
1
+ <template>
2
+ <div :class="['unnnic-text-editor', loadingValue !== undefined && 'status-loading']">
3
+ <div v-if="loadingValue !== undefined" class="loading">
4
+ <div class="indicator" :style="{ width: `${loadingValue * 100}%` }"></div>
5
+ </div>
6
+
7
+ <div class="text-editor" @click="$refs.oDoc.focus()">
8
+ <textarea
9
+ class="inside"
10
+ ref="oDoc"
11
+ :value="value"
12
+ @input="$emit('input', $event.srcElement.value)"
13
+ @keydown="$emit('keydown', $event)"
14
+ @focus="isFocused = true"
15
+ @blur="isFocused = false"
16
+ ></textarea>
17
+
18
+ <!-- <div
19
+ class="inside"
20
+ contenteditable="true"
21
+ v-html="initialContent"
22
+ @input="onInput"
23
+ @keydown="$emit('keydown', $event)"
24
+ @focus="isFocused = true"
25
+ @blur="isFocused = false"
26
+ ></div> -->
27
+
28
+ <div v-if="$slots['footer-input']" class="footer-input" @click.stop>
29
+ <slot name="footer-input" />
30
+ </div>
31
+ </div>
32
+
33
+ <div class="actions">
34
+ <unnnic-tool-tip
35
+ side="left"
36
+ :text="text('action')"
37
+ enabled
38
+ >
39
+ <unnnic-button-icon
40
+ @click="$emit('action')"
41
+ type="secondary"
42
+ size="small"
43
+ icon="flash-1-4"
44
+ />
45
+ </unnnic-tool-tip>
46
+
47
+ <unnnic-button-icon
48
+ @click="$emit('send')"
49
+ type="secondary"
50
+ size="small"
51
+ icon="send-email-3-1"
52
+ />
53
+ </div>
54
+
55
+ <div class="format">
56
+ <unnnic-tool-tip
57
+ side="top"
58
+ :text="text('Undo')"
59
+ enabled
60
+ >
61
+ <unnnic-icon
62
+ icon="arrow-undo"
63
+ size="ant"
64
+ clickable
65
+ scheme="neutral-cloudy"
66
+ @click="formatDoc('undo')"
67
+ />
68
+ </unnnic-tool-tip>
69
+
70
+ <unnnic-tool-tip
71
+ side="top"
72
+ :text="text('Redo')"
73
+ enabled
74
+ >
75
+ <unnnic-icon
76
+ icon="arrow-redo"
77
+ size="ant"
78
+ clickable
79
+ scheme="neutral-cloudy"
80
+ @click="formatDoc('redo')"
81
+ />
82
+ </unnnic-tool-tip>
83
+
84
+ <unnnic-tool-tip
85
+ side="top"
86
+ :text="text('RecordAudio')"
87
+ enabled
88
+ >
89
+ <unnnic-icon
90
+ icon="microphone"
91
+ size="ant"
92
+ clickable
93
+ scheme="neutral-cloudy"
94
+ @mousedown="$emit('record-audio-down')"
95
+ @mouseup="$emit('record-audio-up')"
96
+ @click="$emit('record-audio')"
97
+ />
98
+ </unnnic-tool-tip>
99
+
100
+ <unnnic-tool-tip
101
+ side="top"
102
+ :text="text('Attach')"
103
+ :enabled="!attachmentOptionsOpen"
104
+ >
105
+ <unnnic-dropdown
106
+ :open.sync="attachmentOptionsOpen"
107
+ position="none"
108
+ class="attachment-options-dropdown"
109
+ >
110
+ <unnnic-icon
111
+ slot="trigger"
112
+ icon="attachment"
113
+ size="ant"
114
+ clickable
115
+ scheme="neutral-cloudy"
116
+ />
117
+
118
+ <div class="attachment-options-container">
119
+ <slot name="attachment-options" />
120
+ </div>
121
+ </unnnic-dropdown>
122
+ </unnnic-tool-tip>
123
+
124
+ <!-- <unnnic-icon
125
+ icon="email-action-unread-1"
126
+ size="ant"
127
+ clickable
128
+ scheme="neutral-cloudy"
129
+ /> -->
130
+
131
+ <!--
132
+
133
+ <unnnic-tool-tip
134
+ side="top"
135
+ :text="text('Bold')"
136
+ enabled
137
+ :style="{ marginLeft: '1rem', }"
138
+ >
139
+ <unnnic-icon
140
+ icon="text-bold"
141
+ size="ant"
142
+ clickable
143
+ scheme="neutral-cloudy"
144
+ @click="formatDoc('bold')"
145
+ />
146
+ </unnnic-tool-tip>
147
+
148
+ <unnnic-tool-tip
149
+ side="top"
150
+ :text="text('Italic')"
151
+ enabled
152
+ >
153
+ <unnnic-icon
154
+ icon="text-italic"
155
+ size="ant"
156
+ clickable
157
+ scheme="neutral-cloudy"
158
+ @click="formatDoc('italic')"
159
+ />
160
+ </unnnic-tool-tip>
161
+
162
+ <unnnic-tool-tip
163
+ side="top"
164
+ :text="text('Underline')"
165
+ enabled
166
+ >
167
+ <unnnic-icon
168
+ icon="text-underline"
169
+ size="ant"
170
+ clickable
171
+ scheme="neutral-cloudy"
172
+ @click="formatDoc('underline')"
173
+ />
174
+ </unnnic-tool-tip>
175
+
176
+ <unnnic-tool-tip
177
+ side="top"
178
+ :text="text('List')"
179
+ enabled
180
+ >
181
+ <unnnic-icon
182
+ icon="unordered-list"
183
+ size="ant"
184
+ clickable
185
+ scheme="neutral-cloudy"
186
+ @click="formatDoc('insertunorderedlist')"
187
+ />
188
+ </unnnic-tool-tip>
189
+
190
+ <unnnic-tool-tip
191
+ side="top"
192
+ :text="text('Left')"
193
+ enabled
194
+ >
195
+ <unnnic-icon
196
+ icon="text-left"
197
+ size="ant"
198
+ clickable
199
+ scheme="neutral-cloudy"
200
+ @click="formatDoc('justifyleft')"
201
+ />
202
+ </unnnic-tool-tip>
203
+
204
+ <unnnic-tool-tip
205
+ side="top"
206
+ :text="text('Center')"
207
+ enabled
208
+ >
209
+ <unnnic-icon
210
+ icon="text-center"
211
+ size="ant"
212
+ clickable
213
+ scheme="neutral-cloudy"
214
+ @click="formatDoc('justifycenter')"
215
+ />
216
+ </unnnic-tool-tip>
217
+
218
+ <unnnic-tool-tip
219
+ side="top"
220
+ :text="text('Right')"
221
+ enabled
222
+ >
223
+ <unnnic-icon
224
+ icon="text-right"
225
+ size="ant"
226
+ clickable
227
+ scheme="neutral-cloudy"
228
+ @click="formatDoc('justifyright')"
229
+ />
230
+ </unnnic-tool-tip>
231
+
232
+ <unnnic-tool-tip
233
+ side="top"
234
+ :text="text('Justify')"
235
+ enabled
236
+ >
237
+ <unnnic-icon
238
+ icon="text-justified"
239
+ size="ant"
240
+ clickable
241
+ scheme="neutral-cloudy"
242
+ @click="formatDoc('justifyFull')"
243
+ />
244
+ </unnnic-tool-tip>
245
+
246
+ -->
247
+ </div>
248
+ </div>
249
+ </template>
250
+
251
+ <script>
252
+ import UnnnicButtonIcon from '../Button/ButtonIcon.vue';
253
+ import UnnnicToolTip from '../ToolTip/ToolTip.vue';
254
+ import UnnnicIcon from '../Icon.vue';
255
+ import UnnnicDropdown from '../Dropdown/Dropdown.vue';
256
+
257
+ export default {
258
+ components: {
259
+ UnnnicButtonIcon,
260
+ UnnnicToolTip,
261
+ UnnnicIcon,
262
+ UnnnicDropdown,
263
+ },
264
+
265
+ props: {
266
+ loadingValue: {
267
+ type: Number,
268
+ },
269
+
270
+ value: {
271
+ type: String,
272
+ default: '',
273
+ },
274
+
275
+ texts: {
276
+ type: Object,
277
+ default() {
278
+ return {
279
+ Undo: 'Undo',
280
+ Redo: 'Redo',
281
+ RecordAudio: 'Record Audio',
282
+ Bold: 'Bold',
283
+ Italic: 'Italic',
284
+ Underline: 'Underline',
285
+ List: 'List',
286
+ Left: 'Left',
287
+ Center: 'Center',
288
+ Right: 'Right',
289
+ Justify: 'Justify',
290
+ Attach: 'Attach',
291
+ action: 'Mensagens rápidas',
292
+ };
293
+ },
294
+ },
295
+
296
+ tags: {
297
+ type: Array,
298
+ default() {
299
+ return ['b', 'i', 'u', 'ul', 'li', 'br', 'div'];
300
+ },
301
+ },
302
+
303
+ attributes: {
304
+ type: Array,
305
+ default() {
306
+ return ['style'];
307
+ },
308
+ },
309
+
310
+ styleProperties: {
311
+ type: Array,
312
+ default() {
313
+ return ['text-align'];
314
+ },
315
+ },
316
+ },
317
+
318
+ data() {
319
+ return {
320
+ initialContent: '',
321
+
322
+ attachmentOptionsOpen: false,
323
+
324
+ isFocused: false,
325
+
326
+ lastValueFromInside: '',
327
+ };
328
+ },
329
+
330
+ computed: {},
331
+
332
+ created() {
333
+ this.initialContent = this.value;
334
+ document.execCommand('defaultParagraphSeparator', false, 'div');
335
+ },
336
+
337
+ watch: {
338
+ value: {
339
+ immediate: true,
340
+
341
+ handler() {
342
+ // if (this.value !== this.lastValueFromInside) {
343
+ // this.$refs.oDoc.innerHTML = this.value;
344
+ // }
345
+
346
+ this.$nextTick(() => {
347
+ this.$refs.oDoc.style.minHeight = 0;
348
+ this.$refs.oDoc.style.minHeight = `${this.$refs.oDoc.scrollHeight}px`;
349
+ });
350
+ },
351
+ },
352
+ },
353
+
354
+ methods: {
355
+ formatDoc(sCmd, sValue) {
356
+ this.$refs.oDoc.focus();
357
+ document.execCommand(sCmd, false, sValue);
358
+ this.$refs.oDoc.focus();
359
+ },
360
+
361
+ validateMode() {
362
+ return this.$refs.oDoc.focus();
363
+ },
364
+
365
+ emitInput() {
366
+ this.lastValueFromInside = this.$refs.oDoc.innerHTML;
367
+
368
+ this.lastValueFromInside = this.lastValueFromInside.replace(/<(\/)?([^> ]+)( [^>]+)?>/gi, ($1, $2 = '', $3, $4 = '') => {
369
+ if (this.tags.includes($3)) {
370
+ const complements = [];
371
+
372
+ // eslint-disable-next-line no-restricted-syntax
373
+ for (const i of $4.matchAll(/((?<name1>[^ =]+)="(?<value1>[^"]*)"|(?<name2>[^ =]+)='(?<value2>[^"]*)')/g)) {
374
+ const name = i.groups.name1 || i.groups.name2;
375
+ const value = i.groups.value1 || i.groups.value2;
376
+
377
+ if (this.attributes.includes('style') && name === 'style') {
378
+ const styles = [];
379
+
380
+ // eslint-disable-next-line no-restricted-syntax
381
+ for (const j of value.matchAll(/(?<propertyName>[^:]+):(?<propertyValue>[^;]+);?/g)) {
382
+ if (this.styleProperties.includes(j.groups.propertyName.toLowerCase().trim())) {
383
+ styles.push(`${j.groups.propertyName.toLowerCase().trim()}: ${j.groups.propertyValue.trim()}`);
384
+ }
385
+ }
386
+
387
+ complements.push(`style="${styles.join('; ')};"`);
388
+ }
389
+ }
390
+
391
+ return `<${$2}${$3}${complements.length ? ` ${complements.join(' ')}` : ''}>`;
392
+ }
393
+
394
+ return '';
395
+ });
396
+
397
+ this.$emit('input', this.lastValueFromInside);
398
+ },
399
+
400
+ onInput() {
401
+ this.emitInput();
402
+ },
403
+
404
+ setValue(value) {
405
+ this.$refs.oDoc.innerHTML = value;
406
+ this.emitInput();
407
+ },
408
+
409
+ clear() {
410
+ this.$refs.oDoc.innerHTML = '';
411
+ this.emitInput();
412
+ },
413
+
414
+ text(key) {
415
+ return this.texts[key];
416
+ },
417
+ },
418
+ };
419
+ </script>
420
+
421
+ <style lang="scss" scoped>
422
+ @import "../../assets/scss/unnnic.scss";
423
+
424
+ .unnnic-text-editor {
425
+ display: grid;
426
+ grid-template-areas:
427
+ "loading loading-side"
428
+ "text-editor actions"
429
+ "format empty";
430
+ grid-template-columns: 1fr auto;
431
+ grid-column-gap: $unnnic-spacing-inline-xs;
432
+
433
+ .loading {
434
+ grid-area: loading;
435
+ width: 100%;
436
+ height: $unnnic-border-width-thin;
437
+ border-radius: $unnnic-border-radius-sm $unnnic-border-radius-sm 0 0;
438
+ position: relative;
439
+ overflow: hidden;
440
+ background-color: rgba($unnnic-color-neutral-cleanest, $unnnic-opacity-level-light);
441
+
442
+ .indicator {
443
+ height: $unnnic-border-width-thin;
444
+ background-color: $unnnic-color-neutral-cleanest;
445
+ transition: width 0.2s;
446
+ }
447
+ }
448
+
449
+ &:not(.status-loading) .text-editor {
450
+ border-radius: $unnnic-border-radius-sm;
451
+ }
452
+
453
+ .text-editor {
454
+ grid-area: text-editor;
455
+ height: 7.25 * $unnnic-font-size;
456
+ box-sizing: border-box;
457
+ overflow: auto;
458
+ background-color: $unnnic-color-neutral-snow;
459
+ border-radius: 0 0 $unnnic-border-radius-sm $unnnic-border-radius-sm;
460
+ padding: $unnnic-spacing-inset-sm;
461
+ border: $unnnic-border-width-thinner solid $unnnic-color-neutral-clean;
462
+ outline: none;
463
+ color: $unnnic-color-neutral-cloudy;
464
+ font-family: $unnnic-font-family-secondary;
465
+ font-size: $unnnic-font-size-body-gt;
466
+ line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
467
+ font-weight: $unnnic-font-weight-regular;
468
+ cursor: text;
469
+ display: flex;
470
+ flex-direction: column;
471
+
472
+ .inside {
473
+ color: $unnnic-color-neutral-cloudy;
474
+ font-family: $unnnic-font-family-secondary;
475
+ font-size: $unnnic-font-size-body-gt;
476
+ line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
477
+ font-weight: $unnnic-font-weight-regular;
478
+ border: none;
479
+ padding: 0;
480
+ resize: none;
481
+ overflow-y: hidden;
482
+
483
+ flex: 1;
484
+ outline: none;
485
+
486
+ ::v-deep p {
487
+ margin: 0;
488
+ }
489
+ }
490
+
491
+ .footer-input {
492
+ margin-top: $unnnic-spacing-stack-xs;
493
+ align-self: flex-start;
494
+ cursor: initial;
495
+ }
496
+
497
+ p {
498
+ margin: 0;
499
+ }
500
+ }
501
+
502
+ .actions {
503
+ grid-area: actions;
504
+ display: flex;
505
+ flex-direction: column;
506
+ gap: $unnnic-spacing-stack-xs;
507
+ place-self: center;
508
+ }
509
+
510
+ .format {
511
+ grid-area: format;
512
+ place-self: center;
513
+ padding: $unnnic-spacing-inset-nano;
514
+ user-select: none;
515
+ display: flex;
516
+ gap: $unnnic-spacing-inline-xs;
517
+
518
+ .attachment-options-dropdown ::v-deep .unnnic-dropdown__content {
519
+ padding: 0;
520
+ bottom: 100%;
521
+ margin-bottom: 0.5 * $unnnic-font-size;
522
+ right: (-10.375 * $unnnic-font-size / 2) + 0.625 * $unnnic-font-size;
523
+ }
524
+
525
+ .attachment-options-container {
526
+ width: 10.375 * $unnnic-font-size;
527
+ }
528
+ }
529
+ }
530
+ </style>