@weni/unnnic-system 3.2.9-alpha.9 → 3.3.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 (209) hide show
  1. package/CHANGELOG.md +4 -10
  2. package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
  3. package/dist/components/Alert/Alert.vue.d.ts +119 -18
  4. package/dist/components/Alert/Alert.vue.d.ts.map +1 -1
  5. package/dist/components/Alert/Version1dot1.vue.d.ts +38 -2
  6. package/dist/components/Alert/Version1dot1.vue.d.ts.map +1 -1
  7. package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +2 -2
  8. package/dist/components/AudioRecorder/AudioPlayer.vue.d.ts +1 -1
  9. package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +5 -5
  10. package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +2 -2
  11. package/dist/components/Banner/Banner.vue.d.ts +1 -1
  12. package/dist/components/Banner/InfoBanner.vue.d.ts +1 -1
  13. package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +1 -1
  14. package/dist/components/Button/Button.vue.d.ts +2 -2
  15. package/dist/components/Button/Button.vue.d.ts.map +1 -1
  16. package/dist/components/Button/ButtonIcon.vue.d.ts +1 -1
  17. package/dist/components/Button/types.d.ts +1 -1
  18. package/dist/components/Button/types.d.ts.map +1 -1
  19. package/dist/components/Card/AccountCard.vue.d.ts +3 -3
  20. package/dist/components/Card/BlankCard.vue.d.ts +1 -1
  21. package/dist/components/Card/Card.vue.d.ts +21 -21
  22. package/dist/components/Card/CardCompany.vue.d.ts +8 -8
  23. package/dist/components/Card/CardData.vue.d.ts +1 -1
  24. package/dist/components/Card/CardStatusesContainer.vue.d.ts +4 -4
  25. package/dist/components/Card/ContentCard.vue.d.ts +2 -2
  26. package/dist/components/Card/DashCard.vue.d.ts +4 -4
  27. package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
  28. package/dist/components/Card/MarketplaceCard.vue.d.ts +2 -2
  29. package/dist/components/Card/SimpleCard.vue.d.ts +3 -3
  30. package/dist/components/Card/StatusCard.vue.d.ts +2 -2
  31. package/dist/components/Card/TitleCard.vue.d.ts +2 -2
  32. package/dist/components/CardImage/CardImage.vue.d.ts +8 -8
  33. package/dist/components/CardInformation/CardInformation.vue.d.ts +4 -4
  34. package/dist/components/CardProject/CardProject.vue.d.ts +3 -3
  35. package/dist/components/Carousel/Carousel.vue.d.ts +11 -11
  36. package/dist/components/Carousel/TagCarousel.vue.d.ts +9 -9
  37. package/dist/components/ChartBar/ChartBar.vue.d.ts +8 -8
  38. package/dist/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue.d.ts.map +1 -1
  39. package/dist/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue.d.ts +43 -0
  40. package/dist/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue.d.ts.map +1 -0
  41. package/dist/components/ChartLine/ChartLine.vue.d.ts +1 -1
  42. package/dist/components/ChatText/ChatText.vue.d.ts +2 -2
  43. package/dist/components/ChatsContact/ChatsContact.vue.d.ts +15 -15
  44. package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +1 -1
  45. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts +1 -1
  46. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
  47. package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +5 -5
  48. package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +2 -2
  49. package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +1 -1
  50. package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +2 -2
  51. package/dist/components/Checkbox/Checkbox.vue.d.ts +3 -3
  52. package/dist/components/Comment/Comment.vue.d.ts +1 -1
  53. package/dist/components/DataArea/DataArea.vue.d.ts +2 -2
  54. package/dist/components/DataTable/index.vue.d.ts +1 -8
  55. package/dist/components/DataTable/index.vue.d.ts.map +1 -1
  56. package/dist/components/DateFilter/DateFilter.vue.d.ts +27 -149
  57. package/dist/components/DatePicker/DatePicker.vue.d.ts +8 -8
  58. package/dist/components/Drawer/Drawer.vue.d.ts +7 -7
  59. package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
  60. package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
  61. package/dist/components/Flag.vue.d.ts +2 -2
  62. package/dist/components/FormElement/FormElement.vue.d.ts +32 -38
  63. package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
  64. package/dist/components/Icon.vue.d.ts +1 -1
  65. package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
  66. package/dist/components/ImportCard/ImportCard.vue.d.ts +7 -7
  67. package/dist/components/Input/BaseInput.vue.d.ts +1 -28
  68. package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
  69. package/dist/components/Input/Input.vue.d.ts +27 -149
  70. package/dist/components/Input/Input.vue.d.ts.map +1 -1
  71. package/dist/components/Input/TextInput.vue.d.ts +13 -67
  72. package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
  73. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +37 -159
  74. package/dist/components/InputNext/InputNext.vue.d.ts +4 -4
  75. package/dist/components/Label/Label.vue.d.ts +15 -9
  76. package/dist/components/Label/Label.vue.d.ts.map +1 -1
  77. package/dist/components/Modal/Modal.vue.d.ts +2 -2
  78. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +9 -9
  79. package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
  80. package/dist/components/ModalNext/ModalNext.vue.d.ts +35 -157
  81. package/dist/components/ModalUpload/ModalUpload.vue.d.ts +14 -14
  82. package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
  83. package/dist/components/MultiSelect/MultiSelect.vue.d.ts +7 -7
  84. package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
  85. package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
  86. package/dist/components/Radio/Radio.vue.d.ts +2 -2
  87. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +27 -81
  88. package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +8 -8
  89. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +4 -4
  90. package/dist/components/SelectTime/index.vue.d.ts +13 -67
  91. package/dist/components/SkeletonLoading/skeletonTheme.vue.d.ts +1 -1
  92. package/dist/components/Slider/Slider.vue.d.ts +2 -2
  93. package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
  94. package/dist/components/Switch/Switch.vue.d.ts +2 -2
  95. package/dist/components/Tab/Tab.vue.d.ts +2 -13
  96. package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
  97. package/dist/components/TableNext/TablePagination.vue.d.ts +6 -6
  98. package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
  99. package/dist/components/Tag/BrandTag.vue.d.ts +2 -2
  100. package/dist/components/Tag/DefaultTag.vue.d.ts +2 -2
  101. package/dist/components/Tag/IndicatorTag.vue.d.ts +2 -2
  102. package/dist/components/Tag/Tag.vue.d.ts +8 -8
  103. package/dist/components/TextArea/TextArea.vue.d.ts +32 -38
  104. package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
  105. package/dist/components/ToolTip/ToolTip.vue.d.ts +1 -1
  106. package/dist/components/Tour/Tour.vue.d.ts +6 -6
  107. package/dist/components/Tour/TourPopover.vue.d.ts +6 -6
  108. package/dist/components/UploadArea/UploadArea.vue.d.ts +7 -7
  109. package/dist/components/index.d.ts +1079 -1889
  110. package/dist/components/index.d.ts.map +1 -1
  111. package/dist/{es-d6005598.js → es-db7a2f44.mjs} +1 -1
  112. package/dist/{index-35640dc9.js → index-08caf833.mjs} +8434 -8712
  113. package/dist/locales/en.json.d.ts +1 -2
  114. package/dist/locales/es.json.d.ts +1 -2
  115. package/dist/locales/pt_br.json.d.ts +1 -2
  116. package/dist/{pt-br-89c2c09d.js → pt-br-88538a51.mjs} +1 -1
  117. package/dist/style.css +1 -1
  118. package/dist/unnnic.mjs +182 -0
  119. package/dist/unnnic.umd.js +109 -0
  120. package/dist/utils/call.d.ts +1 -2
  121. package/dist/utils/call.d.ts.map +1 -1
  122. package/package.json +4 -4
  123. package/src/assets/scss/scheme-colors.scss +4 -131
  124. package/src/assets/tokens/colors.json +2 -2
  125. package/src/components/Alert/Alert.vue +135 -26
  126. package/src/components/Alert/AlertBanner.vue +182 -0
  127. package/src/components/Alert/AlertCaller.vue +49 -0
  128. package/src/components/Alert/Version1dot1.vue +36 -0
  129. package/src/components/Alert/__tests__/AlertBanner.spec.js +89 -0
  130. package/src/components/Alert/__tests__/AlertCaller.spec.js +98 -0
  131. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +7 -11
  132. package/src/components/Alert/__tests__/__snapshots__/Version1dot1.spec.js.snap +2 -2
  133. package/src/components/Button/Button.vue +108 -60
  134. package/src/components/Button/types.ts +1 -0
  135. package/src/components/ChartFunnel/ChartFunnel.vue +4 -0
  136. package/src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +8 -2
  137. package/src/components/ChartFunnel/SvgFunnel/ChartFunnelBaseRow.vue +1 -1
  138. package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +64 -0
  139. package/src/components/DataTable/index.vue +10 -25
  140. package/src/components/FormElement/FormElement.vue +91 -51
  141. package/src/components/Input/BaseInput.vue +14 -22
  142. package/src/components/Input/Input.scss +21 -19
  143. package/src/components/Input/Input.vue +29 -85
  144. package/src/components/Input/TextInput.vue +42 -39
  145. package/src/components/Input/__test__/TextInput.spec.js +5 -5
  146. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +3 -12
  147. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
  148. package/src/components/Label/Label.vue +21 -52
  149. package/src/components/Label/__tests__/Label.spec.js +1 -1
  150. package/src/components/Label/__tests__/__snapshots__/Label.spec.js.snap +1 -1
  151. package/src/components/ModalDialog/ModalDialog.vue +0 -1
  152. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
  153. package/src/components/Tab/Tab.vue +23 -37
  154. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -1
  155. package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
  156. package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
  157. package/src/components/TextArea/TextArea.vue +9 -13
  158. package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +2 -7
  159. package/src/components/index.ts +4 -18
  160. package/src/locales/en.json +1 -2
  161. package/src/locales/es.json +1 -2
  162. package/src/locales/pt_br.json +1 -2
  163. package/src/stories/Alert.stories.js +67 -6
  164. package/src/stories/Button.stories.js +17 -2
  165. package/src/stories/ChartFunnel.stories.js +19 -0
  166. package/src/stories/DataTable.stories.js +0 -60
  167. package/src/stories/Input.stories.js +3 -16
  168. package/src/stories/Label.stories.js +0 -7
  169. package/src/stories/Tab.stories.js +4 -11
  170. package/src/types/scheme-colors.d.ts +14 -120
  171. package/src/utils/call.js +18 -46
  172. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +0 -9
  173. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +0 -1
  174. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +0 -15
  175. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +0 -1
  176. package/dist/components/Toast/Toast.vue.d.ts +0 -16
  177. package/dist/components/Toast/Toast.vue.d.ts.map +0 -1
  178. package/dist/components/Toast/ToastManager.d.ts +0 -14
  179. package/dist/components/Toast/ToastManager.d.ts.map +0 -1
  180. package/dist/components/Toast/types.d.ts +0 -35
  181. package/dist/components/Toast/types.d.ts.map +0 -1
  182. package/dist/unnnic.js +0 -188
  183. package/dist/unnnic.umd.cjs +0 -110
  184. package/src/assets/img/previews/doc-preview.png +0 -0
  185. package/src/assets/img/previews/image-preview.png +0 -0
  186. package/src/assets/img/previews/video-preview.png +0 -0
  187. package/src/components/Popover/__tests__/Popover.spec.js +0 -147
  188. package/src/components/Popover/__tests__/__snapshots__/Popover.spec.js.snap +0 -8
  189. package/src/components/Popover/index.vue +0 -146
  190. package/src/components/Select/SelectOption.vue +0 -65
  191. package/src/components/Select/__tests__/Select.spec.js +0 -412
  192. package/src/components/Select/__tests__/SelectItem.spec.js +0 -330
  193. package/src/components/Select/__tests__/SelectOption.spec.js +0 -174
  194. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +0 -93
  195. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +0 -15
  196. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +0 -25
  197. package/src/components/Select/index.vue +0 -243
  198. package/src/components/TemplatePreview/TemplatePreview.vue +0 -252
  199. package/src/components/TemplatePreview/TemplatePreviewModal.vue +0 -51
  200. package/src/components/TemplatePreview/types.d.ts +0 -16
  201. package/src/components/Toast/Toast.vue +0 -236
  202. package/src/components/Toast/ToastManager.ts +0 -110
  203. package/src/components/Toast/types.ts +0 -57
  204. package/src/stories/Popover.stories.js +0 -39
  205. package/src/stories/Select.stories.js +0 -91
  206. package/src/stories/TemplatePreview.stories.js +0 -94
  207. package/src/stories/TemplatePreviewModal.stories.js +0 -110
  208. package/src/stories/Toast.mdx +0 -123
  209. package/src/stories/Toast.stories.js +0 -126
@@ -44,6 +44,8 @@
44
44
  </template>
45
45
 
46
46
  <script setup lang="ts">
47
+ import { computed } from 'vue';
48
+
47
49
  interface FunnelStep {
48
50
  percentage: number | string;
49
51
  value: number | string;
@@ -52,9 +54,13 @@ interface FunnelStep {
52
54
  color: string;
53
55
  }
54
56
 
55
- defineProps<{
57
+ const props = defineProps<{
56
58
  data: FunnelStep[];
57
59
  }>();
60
+
61
+ const calculatedTransform = computed(() => {
62
+ return `skew(${props.data.length === 2 ? '-8deg' : '-12deg'}, 0deg) translateX(-20px)`;
63
+ });
58
64
  </script>
59
65
 
60
66
  <style lang="scss" scoped>
@@ -76,7 +82,7 @@ defineProps<{
76
82
  &__card {
77
83
  height: 100%;
78
84
  transition: background-color 0.3s ease;
79
- transform: skew(-12deg, 0deg) translateX(-20px);
85
+ transform: v-bind(calculatedTransform);
80
86
  border-radius: 0 0 $unnnic-spacing-xs 0;
81
87
 
82
88
  &.first-item {
@@ -34,7 +34,7 @@
34
34
 
35
35
  <script>
36
36
  export default {
37
- name: 'UnnnicChartFunnelThreeRows',
37
+ name: 'UnnnicChartFunnelBaseRow',
38
38
 
39
39
  props: {
40
40
  rows: {
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <ChartFunnelBaseRow
3
+ class="unnnic-chart-funnel-two-rows"
4
+ :rows="rows"
5
+ viewBox="0 0 250 148"
6
+ />
7
+ </template>
8
+
9
+ <script>
10
+ import ChartFunnelBaseRow from './ChartFunnelBaseRow.vue';
11
+ export default {
12
+ name: 'UnnnicChartFunnelTwoRows',
13
+
14
+ components: {
15
+ ChartFunnelBaseRow,
16
+ },
17
+
18
+ props: {
19
+ data: {
20
+ type: Array,
21
+ required: true,
22
+ },
23
+ },
24
+
25
+ computed: {
26
+ rows() {
27
+ const { data } = this;
28
+ return [
29
+ {
30
+ pathD:
31
+ 'M362.938 0H12.025C6.30976 0 2.43799 5.81972 4.64626 11.0911L31 74H343.75L370.307 11.1122C372.535 5.83818 368.663 0 362.938 0Z',
32
+ titleX: '50%',
33
+ titleY: '32',
34
+ descriptionX: '50%',
35
+ descriptionY: '52',
36
+ title: data[0].title,
37
+ description: data[0].description,
38
+ },
39
+ {
40
+ pathD: 'M344 74H31L63.4654 148H311.535L344 74Z',
41
+ titleX: '50%',
42
+ titleY: '106',
43
+ descriptionX: '50%',
44
+ descriptionY: '126',
45
+ title: data[1].title,
46
+ description: data[1].description,
47
+ },
48
+ ];
49
+ },
50
+ },
51
+ };
52
+ </script>
53
+
54
+ <style lang="scss">
55
+ @use '@/assets/scss/unnnic' as *;
56
+ .unnnic-chart-funnel-two-rows {
57
+ [class$='row']:nth-child(1) {
58
+ fill: $unnnic-color-weni-950;
59
+ }
60
+ [class$='row']:nth-child(2) {
61
+ fill: $unnnic-color-weni-800;
62
+ }
63
+ }
64
+ </style>
@@ -16,7 +16,7 @@
16
16
  {
17
17
  'unnnic-data-table__header-cell--clickable': header.isSortable,
18
18
  'unnnic-data-table__header-cell--sorting':
19
- sortState.header === header.title && sortState.order !== '',
19
+ sort.header === header.title && sort.order !== '',
20
20
  },
21
21
  ]"
22
22
  @click.stop="handleClickHeader(header)"
@@ -31,12 +31,12 @@
31
31
  </template>
32
32
  <template v-if="header.isSortable">
33
33
  <IconArrowsDefault
34
- v-if="sortState.header !== header.title"
34
+ v-if="sort.header !== header.title"
35
35
  class="order-default-icon"
36
36
  data-testid="arrow-default-icon"
37
37
  />
38
38
  <Icon
39
- v-else-if="sortState.order === 'asc'"
39
+ v-else-if="sort.order === 'asc'"
40
40
  clickable
41
41
  size="ant"
42
42
  :icon="'switch_left'"
@@ -44,7 +44,7 @@
44
44
  data-testid="arrow-asc-icon"
45
45
  />
46
46
  <Icon
47
- v-else-if="sortState.order === 'desc'"
47
+ v-else-if="sort.order === 'desc'"
48
48
  clickable
49
49
  size="ant"
50
50
  :icon="'switch_left'"
@@ -183,12 +183,6 @@ type DataTableItem = {
183
183
  [key: string]: any;
184
184
  };
185
185
 
186
- type SortState = {
187
- header: string;
188
- itemKey: string;
189
- order: string;
190
- };
191
-
192
186
  interface Props {
193
187
  headers: DataTableHeader[];
194
188
  items: DataTableItem[];
@@ -204,7 +198,6 @@ interface Props {
204
198
  pageTotal?: number;
205
199
  pageInterval?: number;
206
200
  locale?: string;
207
- sort?: SortState;
208
201
  }
209
202
 
210
203
  defineOptions({
@@ -232,7 +225,6 @@ const props = withDefaults(defineProps<Props>(), {
232
225
  pageTotal: 0,
233
226
  pageInterval: 5,
234
227
  locale: 'en',
235
- sort: undefined,
236
228
  });
237
229
 
238
230
  const defaultTranslations = {
@@ -259,16 +251,12 @@ const headersItemsKeys: ComputedRef<string[]> = computed(() => {
259
251
  return props.headers.map((header) => header.itemKey);
260
252
  });
261
253
 
262
- const internalSort = ref({
254
+ const sort = ref({
263
255
  header: '',
264
256
  itemKey: '',
265
257
  order: '',
266
258
  });
267
259
 
268
- const sortState = computed(() => {
269
- return props.sort !== undefined ? props.sort : internalSort.value;
270
- });
271
-
272
260
  const getHeaderColumnSize = (header: DataTableHeader): string => {
273
261
  return typeof header.size === 'number'
274
262
  ? `${header.size || 1}fr`
@@ -283,12 +271,9 @@ const gridTemplateColumns: ComputedRef<string> = computed(() => {
283
271
  return columnSizes.join(' ');
284
272
  });
285
273
 
286
- const handleSort = (header: SortState, order: string) => {
287
- if (props.sort === undefined) {
288
- internalSort.value = { ...header, order };
289
- }
290
-
291
- emit('update:sort', { ...header, order });
274
+ const handleSort = (header: typeof sort.value, order: string) => {
275
+ sort.value = { ...header, order };
276
+ emit('update:sort', sort.value);
292
277
  };
293
278
 
294
279
  const handleClickHeader = (header: DataTableHeader) => {
@@ -301,9 +286,9 @@ const handleClickHeader = (header: DataTableHeader) => {
301
286
  };
302
287
 
303
288
  const nextSort =
304
- header.title !== sortState.value.header
289
+ header.title !== sort.value.header
305
290
  ? 'asc'
306
- : nextSortOrderMapper[sortState.value.order];
291
+ : nextSortOrderMapper[sort.value.order];
307
292
 
308
293
  handleSort(
309
294
  nextSort === ''
@@ -17,31 +17,52 @@
17
17
 
18
18
  <slot></slot>
19
19
 
20
- <section class="unnnic-form-element__hints-container">
21
- <section class="unnnic-form-element__message-container">
22
- <p
23
- v-if="message"
24
- class="unnnic-form-element__message"
25
- >
26
- {{ fullySanitize(message) }}
27
- </p>
28
- <p
29
- v-if="!!error.length"
30
- class="unnnic-form-element__message error"
31
- >
32
- {{ Array.isArray(error) ? error.join(', ') : error }}
33
- </p>
34
- </section>
35
- <p v-if="!!$slots.rightMessage">
20
+ <p
21
+ v-if="shouldShowErrorSection"
22
+ class="unnnic-form-element__error"
23
+ >
24
+ <template v-if="error !== true">
25
+ <UnnnicIcon
26
+ size="sm"
27
+ icon="warning"
28
+ scheme="aux-red-500"
29
+ />
30
+
31
+ {{ fullySanitize(error) }}
32
+ </template>
33
+
34
+ <span
35
+ v-if="!!$slots.rightMessage"
36
+ class="unnnic-form-element__right-message"
37
+ >
38
+ <slot name="rightMessage"></slot>
39
+ </span>
40
+ </p>
41
+
42
+ <p
43
+ v-if="message || !!$slots.rightMessage"
44
+ class="unnnic-form-element__message"
45
+ >
46
+ {{ fullySanitize(message) }}
47
+
48
+ <span
49
+ v-if="!shouldShowErrorSection && !!$slots.rightMessage"
50
+ class="unnnic-form-element__right-message"
51
+ >
36
52
  <slot name="rightMessage"></slot>
37
- </p>
38
- </section>
53
+ </span>
54
+ </p>
39
55
  </section>
40
56
  </template>
41
57
 
42
58
  <script>
59
+ import UnnnicIcon from '../../components/Icon.vue';
43
60
  import { fullySanitize } from '../../utils/sanitize';
44
61
  export default {
62
+ components: {
63
+ UnnnicIcon,
64
+ },
65
+
45
66
  props: {
46
67
  size: {
47
68
  type: String,
@@ -49,18 +70,28 @@ export default {
49
70
  validator: (size) => ['md', 'sm'].includes(size),
50
71
  },
51
72
 
52
- label: { type: String, default: '' },
73
+ label: String,
53
74
 
54
- fixedLabel: { type: Boolean, default: false },
75
+ fixedLabel: Boolean,
55
76
 
56
77
  error: {
57
78
  type: [Boolean, String],
58
79
  default: false,
59
80
  },
60
81
 
61
- message: { type: String, default: '' },
82
+ message: String,
83
+
84
+ disabled: Boolean,
85
+ },
86
+
87
+ data() {
88
+ return {};
89
+ },
62
90
 
63
- disabled: { type: Boolean, default: false },
91
+ computed: {
92
+ shouldShowErrorSection() {
93
+ return this.error && (this.error !== true || !!this.$slots.rightMessage);
94
+ },
64
95
  },
65
96
  methods: {
66
97
  fullySanitize,
@@ -71,66 +102,75 @@ export default {
71
102
  <style lang="scss" scoped>
72
103
  @use '@/assets/scss/unnnic' as *;
73
104
 
74
- * {
75
- margin: $unnnic-space-0;
76
- padding: $unnnic-space-0;
77
- box-sizing: border-box;
78
- }
79
-
80
105
  .unnnic-form-element {
81
106
  &__label {
82
- font: $unnnic-font-body;
107
+ margin: 0;
108
+ margin-bottom: $unnnic-spacing-nano;
109
+
83
110
  color: $unnnic-color-neutral-cloudy;
84
- margin-bottom: $unnnic-space-1;
85
- display: flex;
86
- align-items: center;
87
- gap: $unnnic-space-2;
111
+ font-family: $unnnic-font-family-secondary;
112
+ font-weight: $unnnic-font-weight-regular;
113
+ font-size: $unnnic-font-size-body-gt;
114
+ line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
115
+
116
+ $label-bottom-spacing: 3px;
88
117
 
89
118
  &--fixed {
90
- margin-top: -$unnnic-font-size-body-gt - $unnnic-space-2 + $unnnic-space-1;
119
+ margin-top: -$unnnic-font-size-body-gt - $unnnic-line-height-md +
120
+ $label-bottom-spacing;
91
121
  }
92
122
 
93
123
  &--fixed {
94
- margin-bottom: $unnnic-space-0;
124
+ margin-bottom: 0;
95
125
  position: absolute;
96
- padding: $unnnic-space-0 $unnnic-space-1;
97
- margin-left: $unnnic-space-2;
126
+ padding: 0 $unnnic-spacing-nano;
127
+ margin-left: $unnnic-spacing-xs;
98
128
 
99
129
  &:after {
100
130
  content: ' ';
101
131
  position: absolute;
102
- left: $unnnic-space-0;
103
- bottom: $unnnic-space-1 - $unnnic-border-width-thinner;
132
+ left: 0;
133
+ bottom: $label-bottom-spacing - $unnnic-border-width-thinner;
104
134
  width: 100%;
105
135
  height: $unnnic-border-width-thinner;
106
- background-color: $unnnic-color-white;
136
+ background-color: $unnnic-color-neutral-white;
107
137
  }
108
138
  }
109
139
  }
110
140
 
141
+ &__error,
111
142
  &__message {
112
- &.error {
113
- color: $unnnic-color-fg-critical;
114
- }
143
+ margin: 0;
144
+ margin-top: $unnnic-spacing-stack-nano;
145
+
146
+ color: $unnnic-color-neutral-cloudy;
147
+ font-family: $unnnic-font-family-secondary;
148
+ font-weight: $unnnic-font-weight-regular;
149
+ font-size: $unnnic-font-size-body-md;
150
+ line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
115
151
  }
116
152
 
117
- &__hints-container {
153
+ &__message {
118
154
  display: flex;
119
- justify-content: space-between;
120
- margin-top: $unnnic-space-1;
121
- font: $unnnic-font-caption-2;
122
- color: $unnnic-color-fg-base;
155
+ column-gap: $unnnic-spacing-nano;
123
156
  }
124
157
 
125
- &__message-container {
158
+ &__right-message {
159
+ margin-left: auto;
160
+ }
161
+
162
+ &__error {
126
163
  display: flex;
127
- flex-direction: column;
128
- gap: $unnnic-space-1;
164
+ column-gap: $unnnic-spacing-nano;
165
+ align-items: center;
166
+
167
+ color: $unnnic-color-aux-red-500;
129
168
  }
130
169
 
131
170
  &--disabled .unnnic-form-element__label,
132
171
  &--disabled .unnnic-form-element__message {
133
172
  user-select: none;
173
+ color: $unnnic-color-neutral-cleanest;
134
174
  }
135
175
  }
136
176
  </style>
@@ -4,18 +4,16 @@
4
4
  v-mask="mask"
5
5
  v-bind="attributes"
6
6
  :value="fullySanitize(modelValue)"
7
- :class="[classes, { focus: forceActiveStatus }]"
7
+ :class="classes"
8
8
  :type="nativeType"
9
- :readonly="readonly"
10
9
  />
10
+
11
11
  <input
12
12
  v-else
13
13
  v-bind="attributes"
14
14
  :value="fullySanitize(modelValue)"
15
- :class="[classes, { focus: forceActiveStatus }]"
15
+ :class="classes"
16
16
  :type="nativeType"
17
- :maxlength="maxlength"
18
- :readonly="readonly"
19
17
  />
20
18
  </template>
21
19
 
@@ -51,18 +49,6 @@ export default {
51
49
  },
52
50
  hasIconLeft: Boolean,
53
51
  hasIconRight: Boolean,
54
- maxlength: {
55
- type: Number,
56
- default: null,
57
- },
58
- readonly: {
59
- type: Boolean,
60
- default: false,
61
- },
62
- forceActiveStatus: {
63
- type: Boolean,
64
- default: false,
65
- },
66
52
  },
67
53
  emits: ['update:modelValue'],
68
54
  data() {
@@ -110,21 +96,27 @@ export default {
110
96
  &.size {
111
97
  &-md {
112
98
  @include input-md-font;
113
- padding: $unnnic-space-3 $unnnic-space-4;
99
+
100
+ padding: ($unnnic-spacing-ant - $unnnic-border-width-thinner)
101
+ ($unnnic-spacing-sm - $unnnic-border-width-thinner);
114
102
  }
115
103
 
116
104
  &-sm {
117
105
  @include input-sm-font;
118
- padding: $unnnic-space-2 $unnnic-space-4;
106
+
107
+ padding: $unnnic-spacing-xs
108
+ ($unnnic-spacing-sm - $unnnic-border-width-thinner);
119
109
  }
120
110
  }
121
111
 
122
112
  &.input--has-icon-left {
123
- padding-left: $unnnic-space-10;
113
+ padding-left: $unnnic-spacing-sm + $unnnic-icon-size-sm +
114
+ $unnnic-spacing-xs - $unnnic-border-width-thinner;
124
115
  }
125
116
 
126
117
  &.input--has-icon-right {
127
- padding-right: $unnnic-space-10;
118
+ padding-right: $unnnic-spacing-sm + $unnnic-icon-size-sm +
119
+ $unnnic-spacing-xs - $unnnic-border-width-thinner;
128
120
  }
129
121
 
130
122
  &.error {
@@ -134,7 +126,7 @@ export default {
134
126
  &:-ms-input-placeholder,
135
127
  &::-ms-input-placeholder {
136
128
  /* Internet Explorer 10-11 */
137
- color: $unnnic-color-fg-muted;
129
+ color: $unnnic-color-brand-sec;
138
130
  }
139
131
  }
140
132
  </style>
@@ -1,41 +1,43 @@
1
1
  @use '@/assets/scss/unnnic' as *;
2
2
 
3
3
  @mixin input-base {
4
- background: $unnnic-color-white;
5
- border: $unnnic-border-width-thinner solid $unnnic-color-border-base;
4
+ background: $unnnic-color-neutral-white;
5
+ border: $unnnic-border-width-thinner solid $unnnic-color-neutral-clean;
6
6
  outline: none;
7
- border-radius: $unnnic-radius-2;
8
- color: $unnnic-color-fg-emphasized;
9
- caret-color: $unnnic-color-fg-muted;
10
- font: $unnnic-font-body;
7
+ border-radius: $unnnic-border-radius-sm;
8
+ color: $unnnic-color-neutral-darkest;
9
+ caret-color: $unnnic-color-neutral-clean;
10
+ font-weight: $unnnic-font-weight-regular;
11
+ font-family: $unnnic-font-family-secondary;
11
12
 
12
- &:focus,
13
- &.focus {
14
- border-color: $unnnic-color-border-active;
13
+ &:focus {
14
+ border-color: $unnnic-color-weni-600;
15
15
  }
16
16
 
17
17
  &::placeholder {
18
- color: $unnnic-color-fg-muted;
19
- opacity: 1;
20
- /* Firefox */
18
+ color: $unnnic-color-neutral-cleanest;
19
+ opacity: 1; /* Firefox */
21
20
  }
22
21
 
23
22
  &:disabled {
24
- border-color: $unnnic-color-border-muted;
25
- background-color: $unnnic-color-bg-muted;
23
+ border-color: $unnnic-color-neutral-cleanest;
24
+ background-color: $unnnic-color-neutral-lightest;
26
25
  cursor: not-allowed;
27
- color: $unnnic-color-fg-muted;
26
+ color: $unnnic-color-neutral-cleanest;
28
27
  }
29
28
  }
30
29
 
31
30
  @mixin input-sm-font {
32
- font: $unnnic-font-body;
31
+ font-size: $unnnic-font-size-body-md;
32
+ line-height: $unnnic-font-size-body-md + $unnnic-line-height-medium;
33
33
  }
34
34
 
35
35
  @mixin input-md-font {
36
- font: $unnnic-font-body;
36
+ font-size: $unnnic-font-size-body-gt;
37
+ line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
37
38
  }
38
39
 
39
40
  @mixin input-error {
40
- border-color: $unnnic-color-border-critical;
41
- }
41
+ border-color: $unnnic-color-aux-red-500;
42
+ color: $unnnic-color-aux-red-500;
43
+ }