@weni/unnnic-system 3.2.5 → 3.2.7-alpha.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 (145) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
  3. package/dist/components/Alert/Alert.vue.d.ts +5 -5
  4. package/dist/components/Alert/Version1dot1.vue.d.ts +2 -2
  5. package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +1 -1
  6. package/dist/components/AudioRecorder/AudioPlayer.vue.d.ts +1 -1
  7. package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +3 -3
  8. package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +2 -2
  9. package/dist/components/Banner/Banner.vue.d.ts +1 -1
  10. package/dist/components/Banner/InfoBanner.vue.d.ts +1 -1
  11. package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +1 -1
  12. package/dist/components/Button/Button.vue.d.ts +2 -2
  13. package/dist/components/Button/Button.vue.d.ts.map +1 -1
  14. package/dist/components/Button/ButtonIcon.vue.d.ts +1 -1
  15. package/dist/components/Button/types.d.ts +1 -1
  16. package/dist/components/Button/types.d.ts.map +1 -1
  17. package/dist/components/Card/AccountCard.vue.d.ts +3 -3
  18. package/dist/components/Card/BlankCard.vue.d.ts +1 -1
  19. package/dist/components/Card/Card.vue.d.ts +20 -20
  20. package/dist/components/Card/CardCompany.vue.d.ts +7 -7
  21. package/dist/components/Card/CardData.vue.d.ts +1 -1
  22. package/dist/components/Card/CardStatusesContainer.vue.d.ts +3 -3
  23. package/dist/components/Card/ContentCard.vue.d.ts +2 -2
  24. package/dist/components/Card/DashCard.vue.d.ts +4 -4
  25. package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
  26. package/dist/components/Card/MarketplaceCard.vue.d.ts +2 -2
  27. package/dist/components/Card/SimpleCard.vue.d.ts +2 -2
  28. package/dist/components/Card/StatusCard.vue.d.ts +2 -2
  29. package/dist/components/Card/TitleCard.vue.d.ts +1 -1
  30. package/dist/components/CardImage/CardImage.vue.d.ts +16 -7
  31. package/dist/components/CardInformation/CardInformation.vue.d.ts +3 -3
  32. package/dist/components/CardProject/CardProject.vue.d.ts +11 -2
  33. package/dist/components/Carousel/Carousel.vue.d.ts +10 -10
  34. package/dist/components/Carousel/TagCarousel.vue.d.ts +8 -8
  35. package/dist/components/ChartBar/ChartBar.vue.d.ts +7 -7
  36. package/dist/components/ChatText/ChatText.vue.d.ts +1 -1
  37. package/dist/components/ChatsContact/ChatsContact.vue.d.ts +14 -14
  38. package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +1 -1
  39. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts +1 -1
  40. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
  41. package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +4 -4
  42. package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +2 -2
  43. package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +1 -1
  44. package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +2 -2
  45. package/dist/components/Checkbox/Checkbox.vue.d.ts +3 -3
  46. package/dist/components/Comment/Comment.vue.d.ts +1 -1
  47. package/dist/components/DataArea/DataArea.vue.d.ts +1 -1
  48. package/dist/components/DataTable/index.vue.d.ts +3 -1
  49. package/dist/components/DataTable/index.vue.d.ts.map +1 -1
  50. package/dist/components/DateFilter/DateFilter.vue.d.ts +182 -27
  51. package/dist/components/DatePicker/DatePicker.vue.d.ts +8 -8
  52. package/dist/components/Drawer/Drawer.vue.d.ts +7 -7
  53. package/dist/components/DropArea/DropArea.vue.d.ts +2 -0
  54. package/dist/components/DropArea/DropArea.vue.d.ts.map +1 -1
  55. package/dist/components/Dropdown/Dropdown.vue.d.ts +9 -0
  56. package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
  57. package/dist/components/Flag.vue.d.ts +2 -2
  58. package/dist/components/FormElement/FormElement.vue.d.ts +38 -32
  59. package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
  60. package/dist/components/Icon.vue.d.ts +1 -1
  61. package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
  62. package/dist/components/ImportCard/ImportCard.vue.d.ts +7 -7
  63. package/dist/components/Input/BaseInput.vue.d.ts +10 -1
  64. package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
  65. package/dist/components/Input/Input.vue.d.ts +182 -27
  66. package/dist/components/Input/Input.vue.d.ts.map +1 -1
  67. package/dist/components/Input/TextInput.vue.d.ts +31 -13
  68. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +192 -37
  69. package/dist/components/InputNext/InputNext.vue.d.ts +3 -3
  70. package/dist/components/Modal/Modal.vue.d.ts +2 -2
  71. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +10 -10
  72. package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
  73. package/dist/components/ModalNext/ModalNext.vue.d.ts +189 -34
  74. package/dist/components/ModalUpload/ModalUpload.vue.d.ts +20 -14
  75. package/dist/components/MultiSelect/MultiSelect.vue.d.ts +7 -7
  76. package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
  77. package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
  78. package/dist/components/Radio/Radio.vue.d.ts +2 -2
  79. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +45 -26
  80. package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +7 -7
  81. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +4 -4
  82. package/dist/components/SelectTime/index.vue.d.ts +31 -13
  83. package/dist/components/Slider/Slider.vue.d.ts +1 -1
  84. package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
  85. package/dist/components/Switch/Switch.vue.d.ts +2 -2
  86. package/dist/components/Tab/Tab.vue.d.ts +1 -1
  87. package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
  88. package/dist/components/TableNext/TablePagination.vue.d.ts +6 -6
  89. package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
  90. package/dist/components/Tag/BrandTag.vue.d.ts +2 -2
  91. package/dist/components/Tag/DefaultTag.vue.d.ts +2 -2
  92. package/dist/components/Tag/IndicatorTag.vue.d.ts +1 -1
  93. package/dist/components/Tag/Tag.vue.d.ts +7 -7
  94. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +9 -0
  95. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +1 -0
  96. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +15 -0
  97. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +1 -0
  98. package/dist/components/TextArea/TextArea.vue.d.ts +38 -32
  99. package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
  100. package/dist/components/Tour/Tour.vue.d.ts +6 -6
  101. package/dist/components/Tour/TourPopover.vue.d.ts +6 -6
  102. package/dist/components/UploadArea/UploadArea.vue.d.ts +13 -7
  103. package/dist/components/index.d.ts +2071 -767
  104. package/dist/components/index.d.ts.map +1 -1
  105. package/dist/{es-a07e7553.mjs → es-a147ef18.mjs} +1 -1
  106. package/dist/{index-93aafec9.mjs → index-802ab669.mjs} +8035 -7832
  107. package/dist/{pt-br-a81c613f.mjs → pt-br-cdc64aa4.mjs} +1 -1
  108. package/dist/style.css +1 -1
  109. package/dist/unnnic.mjs +123 -119
  110. package/dist/unnnic.umd.js +42 -41
  111. package/package.json +2 -2
  112. package/src/assets/img/previews/doc-preview.png +0 -0
  113. package/src/assets/img/previews/image-preview.png +0 -0
  114. package/src/assets/img/previews/video-preview.png +0 -0
  115. package/src/components/Button/Button.vue +57 -108
  116. package/src/components/Button/types.ts +0 -1
  117. package/src/components/DataTable/index.vue +26 -14
  118. package/src/components/DropArea/DropArea.vue +26 -2
  119. package/src/components/Dropdown/Dropdown.vue +6 -0
  120. package/src/components/Dropdown/__tests__/Dropdown.spec.js +57 -0
  121. package/src/components/FormElement/FormElement.vue +50 -90
  122. package/src/components/Input/BaseInput.vue +10 -12
  123. package/src/components/Input/Input.scss +17 -20
  124. package/src/components/Input/Input.vue +86 -28
  125. package/src/components/Input/TextInput.vue +27 -35
  126. package/src/components/Input/__test__/TextInput.spec.js +5 -5
  127. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +12 -3
  128. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
  129. package/src/components/ModalDialog/ModalDialog.vue +27 -29
  130. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
  131. package/src/components/SelectSmart/SelectSmart.vue +3 -1
  132. package/src/components/SelectSmart/__tests__/SelectSmart.spec.js +45 -0
  133. package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
  134. package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
  135. package/src/components/TemplatePreview/TemplatePreview.vue +249 -0
  136. package/src/components/TemplatePreview/TemplatePreviewModal.vue +51 -0
  137. package/src/components/TemplatePreview/types.d.ts +16 -0
  138. package/src/components/TextArea/TextArea.vue +14 -9
  139. package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +7 -2
  140. package/src/components/index.ts +11 -3
  141. package/src/stories/Button.stories.js +1 -10
  142. package/src/stories/DataTable.stories.js +2 -2
  143. package/src/stories/Input.stories.js +17 -3
  144. package/src/stories/TemplatePreview.stories.js +94 -0
  145. package/src/stories/TemplatePreviewModal.stories.js +110 -0
@@ -17,51 +17,28 @@
17
17
 
18
18
  <slot></slot>
19
19
 
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
- >
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 v-if="!!error.length" class="unnnic-form-element__message error">
29
+ {{ Array.isArray(error) ? error.join(', ') : error }}
30
+ </p>
31
+ </section>
32
+ <p v-if="!!$slots.rightMessage">
52
33
  <slot name="rightMessage"></slot>
53
- </span>
54
- </p>
34
+ </p>
35
+ </section>
55
36
  </section>
56
37
  </template>
57
38
 
58
39
  <script>
59
- import UnnnicIcon from '../../components/Icon.vue';
60
40
  import { fullySanitize } from '../../utils/sanitize';
61
41
  export default {
62
- components: {
63
- UnnnicIcon,
64
- },
65
42
 
66
43
  props: {
67
44
  size: {
@@ -70,28 +47,18 @@ export default {
70
47
  validator: (size) => ['md', 'sm'].includes(size),
71
48
  },
72
49
 
73
- label: String,
50
+ label: { type: String, default: '' },
74
51
 
75
- fixedLabel: Boolean,
52
+ fixedLabel: { type: Boolean, default: false },
76
53
 
77
54
  error: {
78
55
  type: [Boolean, String],
79
56
  default: false,
80
57
  },
81
58
 
82
- message: String,
83
-
84
- disabled: Boolean,
85
- },
59
+ message: { type: String, default: '' },
86
60
 
87
- data() {
88
- return {};
89
- },
90
-
91
- computed: {
92
- shouldShowErrorSection() {
93
- return this.error && (this.error !== true || !!this.$slots.rightMessage);
94
- },
61
+ disabled: { type: Boolean, default: false },
95
62
  },
96
63
  methods: {
97
64
  fullySanitize,
@@ -102,75 +69,68 @@ export default {
102
69
  <style lang="scss" scoped>
103
70
  @use '@/assets/scss/unnnic' as *;
104
71
 
72
+ * {
73
+ margin: $unnnic-space-0;
74
+ padding: $unnnic-space-0;
75
+ box-sizing: border-box;
76
+ }
77
+
105
78
  .unnnic-form-element {
106
79
  &__label {
107
- margin: 0;
108
- margin-bottom: $unnnic-spacing-nano;
109
-
80
+ font: $unnnic-font-body;
110
81
  color: $unnnic-color-neutral-cloudy;
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;
82
+ margin-bottom: $unnnic-space-1;
83
+ display: flex;
84
+ align-items: center;
85
+ gap: $unnnic-space-2;
117
86
 
118
87
  &--fixed {
119
- margin-top: -$unnnic-font-size-body-gt - $unnnic-line-height-md +
120
- $label-bottom-spacing;
88
+ margin-top: -$unnnic-font-size-body-gt - $unnnic-space-2 +
89
+ $unnnic-space-1;
121
90
  }
122
91
 
123
92
  &--fixed {
124
- margin-bottom: 0;
93
+ margin-bottom: $unnnic-space-0;
125
94
  position: absolute;
126
- padding: 0 $unnnic-spacing-nano;
127
- margin-left: $unnnic-spacing-xs;
95
+ padding: $unnnic-space-0 $unnnic-space-1;
96
+ margin-left: $unnnic-space-2;
128
97
 
129
98
  &:after {
130
99
  content: ' ';
131
100
  position: absolute;
132
- left: 0;
133
- bottom: $label-bottom-spacing - $unnnic-border-width-thinner;
101
+ left: $unnnic-space-0;
102
+ bottom: $unnnic-space-1 - $unnnic-border-width-thinner;
134
103
  width: 100%;
135
104
  height: $unnnic-border-width-thinner;
136
- background-color: $unnnic-color-neutral-white;
105
+ background-color: $unnnic-color-white;
137
106
  }
138
107
  }
139
108
  }
140
109
 
141
- &__error,
142
110
  &__message {
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;
111
+ &.error {
112
+ color: $unnnic-color-fg-critical;
113
+ }
151
114
  }
152
115
 
153
- &__message {
116
+ &__hints-container {
154
117
  display: flex;
155
- column-gap: $unnnic-spacing-nano;
156
- }
157
-
158
- &__right-message {
159
- margin-left: auto;
118
+ justify-content: space-between;
119
+ margin-top: $unnnic-space-1;
120
+ font: $unnnic-font-caption-2;
121
+ color: $unnnic-color-fg-base;
160
122
  }
161
123
 
162
- &__error {
124
+ &__message-container {
163
125
  display: flex;
164
- column-gap: $unnnic-spacing-nano;
165
- align-items: center;
166
-
167
- color: $unnnic-color-aux-red-500;
126
+ flex-direction: column;
127
+ gap: $unnnic-space-1;
168
128
  }
169
129
 
130
+
170
131
  &--disabled .unnnic-form-element__label,
171
132
  &--disabled .unnnic-form-element__message {
172
133
  user-select: none;
173
- color: $unnnic-color-neutral-cleanest;
174
134
  }
175
135
  }
176
136
  </style>
@@ -7,13 +7,13 @@
7
7
  :class="classes"
8
8
  :type="nativeType"
9
9
  />
10
-
11
10
  <input
12
11
  v-else
13
12
  v-bind="attributes"
14
13
  :value="fullySanitize(modelValue)"
15
14
  :class="classes"
16
15
  :type="nativeType"
16
+ :maxlength="maxlength"
17
17
  />
18
18
  </template>
19
19
 
@@ -49,6 +49,10 @@ export default {
49
49
  },
50
50
  hasIconLeft: Boolean,
51
51
  hasIconRight: Boolean,
52
+ maxlength: {
53
+ type: Number,
54
+ default: null,
55
+ },
52
56
  },
53
57
  emits: ['update:modelValue'],
54
58
  data() {
@@ -96,27 +100,21 @@ export default {
96
100
  &.size {
97
101
  &-md {
98
102
  @include input-md-font;
99
-
100
- padding: ($unnnic-spacing-ant - $unnnic-border-width-thinner)
101
- ($unnnic-spacing-sm - $unnnic-border-width-thinner);
103
+ padding: $unnnic-space-3 $unnnic-space-4;
102
104
  }
103
105
 
104
106
  &-sm {
105
107
  @include input-sm-font;
106
-
107
- padding: $unnnic-spacing-xs
108
- ($unnnic-spacing-sm - $unnnic-border-width-thinner);
108
+ padding: $unnnic-space-2 $unnnic-space-4;
109
109
  }
110
110
  }
111
111
 
112
112
  &.input--has-icon-left {
113
- padding-left: $unnnic-spacing-sm + $unnnic-icon-size-sm + $unnnic-spacing-xs -
114
- $unnnic-border-width-thinner;
113
+ padding-left: $unnnic-space-10;
115
114
  }
116
115
 
117
116
  &.input--has-icon-right {
118
- padding-right: $unnnic-spacing-sm + $unnnic-icon-size-sm +
119
- $unnnic-spacing-xs - $unnnic-border-width-thinner;
117
+ padding-right: $unnnic-space-10;
120
118
  }
121
119
 
122
120
  &.error {
@@ -126,7 +124,7 @@ export default {
126
124
  &:-ms-input-placeholder,
127
125
  &::-ms-input-placeholder {
128
126
  /* Internet Explorer 10-11 */
129
- color: $unnnic-color-brand-sec;
127
+ color: $unnnic-color-fg-muted;
130
128
  }
131
129
  }
132
130
  </style>
@@ -1,43 +1,40 @@
1
1
  @use '@/assets/scss/unnnic' as *;
2
2
 
3
3
  @mixin input-base {
4
- background: $unnnic-color-neutral-white;
5
- border: $unnnic-border-width-thinner solid $unnnic-color-neutral-clean;
4
+ background: $unnnic-color-white;
5
+ border: $unnnic-border-width-thinner solid $unnnic-color-border-base;
6
6
  outline: none;
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;
7
+ border-radius: $unnnic-radius-2;
8
+ color: $unnnic-color-fg-emphasized;
9
+ caret-color: $unnnic-color-fg-muted;
10
+ font: $unnnic-font-body;
12
11
 
13
12
  &:focus {
14
- border-color: $unnnic-color-weni-600;
13
+ border-color: $unnnic-color-border-active;
15
14
  }
16
15
 
17
16
  &::placeholder {
18
- color: $unnnic-color-neutral-cleanest;
19
- opacity: 1; /* Firefox */
17
+ color: $unnnic-color-fg-muted;
18
+ opacity: 1;
19
+ /* Firefox */
20
20
  }
21
21
 
22
22
  &:disabled {
23
- border-color: $unnnic-color-neutral-cleanest;
24
- background-color: $unnnic-color-neutral-lightest;
23
+ border-color: $unnnic-color-border-muted;
24
+ background-color: $unnnic-color-bg-muted;
25
25
  cursor: not-allowed;
26
- color: $unnnic-color-neutral-cleanest;
26
+ color: $unnnic-color-fg-muted;
27
27
  }
28
28
  }
29
29
 
30
30
  @mixin input-sm-font {
31
- font-size: $unnnic-font-size-body-md;
32
- line-height: $unnnic-font-size-body-md + $unnnic-line-height-medium;
31
+ font: $unnnic-font-body;
33
32
  }
34
33
 
35
34
  @mixin input-md-font {
36
- font-size: $unnnic-font-size-body-gt;
37
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
35
+ font: $unnnic-font-body;
38
36
  }
39
37
 
40
38
  @mixin input-error {
41
- border-color: $unnnic-color-aux-red-500;
42
- color: $unnnic-color-aux-red-500;
43
- }
39
+ border-color: $unnnic-color-border-critical;
40
+ }
@@ -6,13 +6,18 @@
6
6
  >
7
7
  <slot name="label" />
8
8
  </p>
9
-
10
- <p
9
+ <section
11
10
  v-else-if="label"
12
11
  class="unnnic-form__label"
13
12
  >
14
- {{ fullySanitize(label) }}
15
- </p>
13
+ <p>
14
+ {{ fullySanitize(label) }}
15
+ </p>
16
+ <UnnnicToolTip v-if="tooltip" enabled :text="tooltip">
17
+ <UnnnicIcon icon="help" size="sm" scheme="fg-base" />
18
+ </UnnnicToolTip>
19
+ </section>
20
+
16
21
 
17
22
  <TextInput
18
23
  v-bind="$attrs"
@@ -28,24 +33,38 @@
28
33
  :size="size"
29
34
  :mask="mask"
30
35
  :nativeType="nativeType"
36
+ :maxlength="maxlength"
37
+ :disabled="disabled"
31
38
  />
32
39
 
33
- <p
34
- v-if="message"
35
- class="unnnic-form__message"
36
- >
37
- {{ fullySanitize(message) }}
38
- </p>
40
+ <section class="unnnic-form__hints-container">
41
+ <section class="unnnic-form__message-container">
42
+ <p
43
+ v-if="message"
44
+ class="unnnic-form__message"
45
+ >
46
+ {{ fullySanitize(message) }}
47
+ </p>
48
+ <p v-if="!!errors.length" class="unnnic-form__message error">
49
+ {{ Array.isArray(errors) ? errors.join(', ') : errors }}
50
+ </p>
51
+ </section>
52
+ <p v-if="maxlength && showMaxlengthCounter">
53
+ {{ (val || '').length }} / {{ maxlength }}
54
+ </p>
55
+ </section>
39
56
  </div>
40
57
  </template>
41
58
 
42
59
  <script>
43
60
  import { fullySanitize } from '../../utils/sanitize';
44
61
  import TextInput from './TextInput.vue';
62
+ import UnnnicToolTip from '../ToolTip/ToolTip.vue';
63
+ import UnnnicIcon from '../Icon.vue';
45
64
 
46
65
  export default {
47
66
  name: 'UnnnicInput',
48
- components: { TextInput },
67
+ components: { TextInput, UnnnicToolTip, UnnnicIcon },
49
68
  props: {
50
69
  placeholder: {
51
70
  type: String,
@@ -68,19 +87,23 @@ export default {
68
87
  },
69
88
  message: {
70
89
  type: String,
71
- default: null,
90
+ default: '',
91
+ },
92
+ errors: {
93
+ type: [String, Array],
94
+ default: '',
72
95
  },
73
96
  label: {
74
97
  type: String,
75
- default: null,
98
+ default: '',
76
99
  },
77
100
  iconLeft: {
78
101
  type: String,
79
- default: null,
102
+ default: '',
80
103
  },
81
104
  iconRight: {
82
105
  type: String,
83
- default: null,
106
+ default: '',
84
107
  },
85
108
  allowTogglePassword: {
86
109
  type: Boolean,
@@ -88,11 +111,11 @@ export default {
88
111
  },
89
112
  iconLeftClickable: {
90
113
  type: Boolean,
91
- default: null,
114
+ default: false,
92
115
  },
93
116
  iconRightClickable: {
94
117
  type: Boolean,
95
- default: null,
118
+ default: false,
96
119
  },
97
120
  hasCloudyColor: {
98
121
  type: Boolean,
@@ -106,6 +129,22 @@ export default {
106
129
  type: [String, Array],
107
130
  default: '',
108
131
  },
132
+ tooltip: {
133
+ type: String,
134
+ default: '',
135
+ },
136
+ maxlength: {
137
+ type: [Number, null],
138
+ default: null,
139
+ },
140
+ showMaxlengthCounter: {
141
+ type: Boolean,
142
+ default: false,
143
+ },
144
+ disabled: {
145
+ type: Boolean,
146
+ default: false,
147
+ },
109
148
  },
110
149
  emits: ['update:modelValue'],
111
150
  data() {
@@ -138,27 +177,46 @@ export default {
138
177
  <style lang="scss" scoped>
139
178
  @use '@/assets/scss/unnnic' as *;
140
179
 
180
+ * {
181
+ margin: 0;
182
+ padding: 0;
183
+ box-sizing: border-box;
184
+ }
185
+
141
186
  .unnnic-form {
142
- font-family: $unnnic-font-family-secondary;
143
187
  position: relative;
144
188
 
145
189
  &__message {
146
- font-size: $unnnic-font-size-body-md;
147
- margin: $unnnic-spacing-stack-nano 0;
148
- color: $unnnic-color-feedback-red;
190
+ &.error {
191
+ color: $unnnic-color-fg-critical;
192
+ }
149
193
  }
150
194
 
151
195
  &__label {
152
- font-weight: $unnnic-font-weight-regular;
153
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
154
- font-size: $unnnic-font-size-body-gt;
196
+ font: $unnnic-font-body;
155
197
  color: $unnnic-color-neutral-cloudy;
156
- margin: $unnnic-spacing-stack-xs 0;
198
+ margin-bottom: $unnnic-space-1;
199
+ display: flex;
200
+ align-items: center;
201
+ gap: $unnnic-space-2;
202
+
203
+ :deep(.unnnic-tooltip) {
204
+ display: flex;
205
+ }
206
+ }
207
+
208
+ &__hints-container {
209
+ display: flex;
210
+ justify-content: space-between;
211
+ margin-top: $unnnic-space-1;
212
+ font: $unnnic-font-caption-2;
213
+ color: $unnnic-color-fg-base;
157
214
  }
158
215
 
159
- &.sm &__label {
160
- font-size: $unnnic-font-size-body-md;
161
- line-height: $unnnic-font-size-body-md + $unnnic-line-height-medium;
216
+ &__message-container {
217
+ display: flex;
218
+ flex-direction: column;
219
+ gap: $unnnic-space-1;
162
220
  }
163
221
  }
164
222
  </style>
@@ -3,7 +3,6 @@
3
3
  :class="[
4
4
  'text-input',
5
5
  `size--${size}`,
6
- `text-input--icon-right-size-${iconRightSize}`,
7
6
  ]"
8
7
  >
9
8
  <BaseInput
@@ -18,6 +17,7 @@
18
17
  class="input-itself"
19
18
  :hasIconLeft="!!iconLeft"
20
19
  :hasIconRight="!!iconRight || allowTogglePassword"
20
+ :maxlength="maxlength"
21
21
  @focus="onFocus"
22
22
  @blur="onBlur"
23
23
  />
@@ -26,7 +26,7 @@
26
26
  v-if="iconLeft"
27
27
  :scheme="iconScheme"
28
28
  :icon="iconLeft"
29
- size="sm"
29
+ size="ant"
30
30
  :clickable="iconLeftClickable"
31
31
  :class="['icon-left', { clickable: iconLeftClickable }]"
32
32
  @click="onIconLeftClick"
@@ -36,7 +36,7 @@
36
36
  v-if="iconRightSvg"
37
37
  :scheme="iconScheme"
38
38
  :icon="iconRightSvg"
39
- :size="iconRightSize"
39
+ size="ant"
40
40
  :clickable="iconRightClickable || allowTogglePassword"
41
41
  :class="[
42
42
  'icon-right',
@@ -92,10 +92,6 @@ export default {
92
92
  type: Boolean,
93
93
  default: null,
94
94
  },
95
- iconRightSize: {
96
- type: String,
97
- default: 'sm',
98
- },
99
95
  allowTogglePassword: {
100
96
  type: Boolean,
101
97
  default: null,
@@ -108,6 +104,14 @@ export default {
108
104
  type: String,
109
105
  default: 'md',
110
106
  },
107
+ maxlength: {
108
+ type: Number,
109
+ default: null,
110
+ },
111
+ disabled: {
112
+ type: Boolean,
113
+ default: false,
114
+ },
111
115
  },
112
116
  emits: ['icon-left-click', 'icon-right-click'],
113
117
  data() {
@@ -118,7 +122,7 @@ export default {
118
122
  },
119
123
  computed: {
120
124
  isDisabled() {
121
- return this.$attrs.disabled;
125
+ return this.$attrs.disabled || this.disabled;
122
126
  },
123
127
 
124
128
  iconRightSvg() {
@@ -131,22 +135,22 @@ export default {
131
135
 
132
136
  iconScheme() {
133
137
  if (this.type === 'error') {
134
- return 'aux-red-500';
138
+ return 'fg-critical';
135
139
  }
136
140
 
137
141
  if (this.isDisabled) {
138
- return 'neutral-cleanest';
142
+ return 'fg-muted';
139
143
  }
140
144
 
141
145
  if (this.modelValue || this.isFocused) {
142
- return 'neutral-dark';
146
+ return 'color-gray-700';
143
147
  }
144
148
 
145
149
  if (this.hasCloudyColor) {
146
- return 'neutral-cloudy';
150
+ return 'fg-base';
147
151
  }
148
152
 
149
- return 'neutral-cloudy';
153
+ return 'fg-base';
150
154
  },
151
155
 
152
156
  attributes() {
@@ -183,6 +187,10 @@ export default {
183
187
  <style lang="scss" scoped>
184
188
  @use '@/assets/scss/unnnic' as *;
185
189
 
190
+ .text-input {
191
+ position: relative;
192
+ }
193
+
186
194
  .icon {
187
195
  &-left,
188
196
  &-right {
@@ -193,32 +201,16 @@ export default {
193
201
 
194
202
  &-left {
195
203
  position: absolute;
196
- top: $unnnic-spacing-ant + 0.1875 * $unnnic-font-size;
197
- left: $unnnic-inline-sm - $unnnic-border-width-thinner;
204
+ top: 50%;
205
+ transform: translateY(-50%);
206
+ left: $unnnic-space-4;
198
207
  }
199
208
 
200
209
  &-right {
201
210
  position: absolute;
202
- top: $unnnic-spacing-ant + 0.1875 * $unnnic-font-size;
203
- right: $unnnic-inline-sm - $unnnic-border-width-thinner;
204
- }
205
- }
206
- .text-input {
207
- position: relative;
208
-
209
- &.size--sm {
210
- .icon-left,
211
- .icon-right {
212
- top: $unnnic-spacing-xs + 0.125 * $unnnic-font-size;
213
- }
214
- }
215
-
216
- &.size--sm.text-input--icon-right-size-ant .icon-right {
217
- top: 0.5625 * $unnnic-font-size;
218
- }
219
-
220
- &.size--md.text-input--icon-right-size-ant .icon-right {
221
- top: 0.8125 * $unnnic-font-size;
211
+ top: 50%;
212
+ transform: translateY(-50%);
213
+ right: $unnnic-space-4;
222
214
  }
223
215
  }
224
216
  </style>
@@ -74,22 +74,22 @@ describe('TextInput.vue', () => {
74
74
 
75
75
  test('computes the correct iconScheme based on various states', async () => {
76
76
  await wrapper.setProps({ type: 'error' });
77
- expect(wrapper.vm.iconScheme).toBe('aux-red-500');
77
+ expect(wrapper.vm.iconScheme).toBe('fg-critical');
78
78
 
79
79
  await wrapper.setProps({ type: 'normal' });
80
80
  await wrapper.setData({ isDisabled: true });
81
- expect(wrapper.vm.iconScheme).toBe('neutral-cloudy');
81
+ expect(wrapper.vm.iconScheme).toBe('fg-base');
82
82
 
83
83
  await wrapper.setData({ isDisabled: false });
84
84
  await wrapper.setProps({ modelValue: 'text' });
85
- expect(wrapper.vm.iconScheme).toBe('neutral-dark');
85
+ expect(wrapper.vm.iconScheme).toBe('color-gray-700');
86
86
 
87
87
  await wrapper.setData({ isFocused: true });
88
- expect(wrapper.vm.iconScheme).toBe('neutral-dark');
88
+ expect(wrapper.vm.iconScheme).toBe('color-gray-700');
89
89
 
90
90
  await wrapper.setProps({ hasCloudyColor: true, modelValue: '' });
91
91
  await wrapper.setData({ isFocused: false });
92
- expect(wrapper.vm.iconScheme).toBe('neutral-cloudy');
92
+ expect(wrapper.vm.iconScheme).toBe('fg-base');
93
93
  });
94
94
 
95
95
  test('attributes computed property returns combined attributes and props', () => {