@weni/unnnic-system 3.4.1-alpha.2 → 3.5.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 (220) hide show
  1. package/CHANGELOG.md +6 -1
  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 +33 -24
  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/ChartLine/ChartLine.vue.d.ts +1 -1
  39. package/dist/components/ChatText/ChatText.vue.d.ts +2 -2
  40. package/dist/components/ChatsContact/ChatsContact.vue.d.ts +40 -31
  41. package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +1 -1
  42. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts +1 -1
  43. package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
  44. package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +5 -5
  45. package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +2 -2
  46. package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +1 -1
  47. package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +2 -2
  48. package/dist/components/Checkbox/Checkbox.vue.d.ts +28 -19
  49. package/dist/components/Checkbox/Checkbox.vue.d.ts.map +1 -1
  50. package/dist/components/Comment/Comment.vue.d.ts +1 -1
  51. package/dist/components/DataArea/DataArea.vue.d.ts +2 -2
  52. package/dist/components/DataTable/index.vue.d.ts +1 -1
  53. package/dist/components/DataTable/index.vue.d.ts.map +1 -1
  54. package/dist/components/DateFilter/DateFilter.vue.d.ts +29 -176
  55. package/dist/components/DatePicker/DatePicker.vue.d.ts +6 -6
  56. package/dist/components/Drawer/Drawer.vue.d.ts +7 -7
  57. package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
  58. package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
  59. package/dist/components/Flag.vue.d.ts +2 -2
  60. package/dist/components/FormElement/FormElement.vue.d.ts +32 -38
  61. package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
  62. package/dist/components/Icon.vue.d.ts +1 -1
  63. package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
  64. package/dist/components/ImportCard/ImportCard.vue.d.ts +7 -7
  65. package/dist/components/Input/BaseInput.vue.d.ts +1 -32
  66. package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
  67. package/dist/components/Input/Input.vue.d.ts +29 -176
  68. package/dist/components/Input/Input.vue.d.ts.map +1 -1
  69. package/dist/components/Input/TextInput.vue.d.ts +14 -83
  70. package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
  71. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +36 -183
  72. package/dist/components/InputNext/InputNext.vue.d.ts +4 -4
  73. package/dist/components/Label/Label.vue.d.ts +15 -9
  74. package/dist/components/Label/Label.vue.d.ts.map +1 -1
  75. package/dist/components/Modal/Modal.vue.d.ts +2 -2
  76. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +9 -9
  77. package/dist/components/ModalNext/ModalNext.vue.d.ts +37 -184
  78. package/dist/components/ModalUpload/ModalUpload.vue.d.ts +14 -14
  79. package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
  80. package/dist/components/MultiSelect/MultiSelect.vue.d.ts +14 -20
  81. package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
  82. package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
  83. package/dist/components/Radio/Radio.vue.d.ts +6 -8
  84. package/dist/components/Radio/Radio.vue.d.ts.map +1 -1
  85. package/dist/components/SelectSmart/SelectSmart.vue.d.ts +53 -113
  86. package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +8 -8
  87. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +29 -20
  88. package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts.map +1 -1
  89. package/dist/components/SelectTime/index.vue.d.ts +14 -83
  90. package/dist/components/SkeletonLoading/skeletonTheme.vue.d.ts +1 -1
  91. package/dist/components/Slider/Slider.vue.d.ts +2 -2
  92. package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
  93. package/dist/components/Switch/Switch.vue.d.ts +25 -24
  94. package/dist/components/Switch/Switch.vue.d.ts.map +1 -1
  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 +1242 -2570
  110. package/dist/components/index.d.ts.map +1 -1
  111. package/dist/{es-eca523be.mjs → es-df2d978e.mjs} +1 -1
  112. package/dist/{index-c84d6c3d.mjs → index-0a11875e.mjs} +11921 -18138
  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-dd7ba97f.mjs → pt-br-01d866ab.mjs} +1 -1
  117. package/dist/style.css +1 -1
  118. package/dist/unnnic.mjs +162 -172
  119. package/dist/unnnic.umd.js +51 -53
  120. package/dist/utils/call.d.ts +1 -2
  121. package/dist/utils/call.d.ts.map +1 -1
  122. package/package.json +1 -2
  123. package/src/assets/scss/scheme-colors.scss +238 -115
  124. package/src/components/Alert/Alert.vue +135 -26
  125. package/src/components/Alert/AlertBanner.vue +182 -0
  126. package/src/components/Alert/AlertCaller.vue +49 -0
  127. package/src/components/Alert/Version1dot1.vue +36 -0
  128. package/src/components/Alert/__tests__/AlertBanner.spec.js +89 -0
  129. package/src/components/Alert/__tests__/AlertCaller.spec.js +98 -0
  130. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +7 -11
  131. package/src/components/Alert/__tests__/__snapshots__/Version1dot1.spec.js.snap +2 -2
  132. package/src/components/Button/Button.vue +108 -60
  133. package/src/components/Button/types.ts +1 -0
  134. package/src/components/Checkbox/Checkbox.vue +65 -88
  135. package/src/components/Checkbox/__tests__/Checkbox.spec.js +21 -6
  136. package/src/components/FormElement/FormElement.vue +91 -51
  137. package/src/components/Input/BaseInput.vue +14 -31
  138. package/src/components/Input/Input.scss +21 -19
  139. package/src/components/Input/Input.vue +30 -94
  140. package/src/components/Input/TextInput.vue +58 -82
  141. package/src/components/Input/__test__/TextInput.spec.js +5 -5
  142. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +3 -16
  143. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -7
  144. package/src/components/Label/Label.vue +21 -52
  145. package/src/components/Label/__tests__/Label.spec.js +1 -1
  146. package/src/components/Label/__tests__/__snapshots__/Label.spec.js.snap +1 -1
  147. package/src/components/Radio/Radio.vue +67 -80
  148. package/src/components/Radio/__test__/Radio.spec.js +20 -14
  149. package/src/components/Radio/__test__/__snapshots__/Radio.spec.js.snap +3 -3
  150. package/src/components/Switch/Switch.vue +99 -91
  151. package/src/components/Switch/__tests__/Switch.spec.js +74 -8
  152. package/src/components/Switch/__tests__/__snapshots__/Switch.spec.js.snap +5 -3
  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/TemplatePreview/TemplatePreview.vue +2 -2
  158. package/src/components/TemplatePreview/TemplatePreviewModal.vue +1 -1
  159. package/src/components/TextArea/TextArea.vue +9 -13
  160. package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +2 -7
  161. package/src/components/index.ts +8 -30
  162. package/src/locales/en.json +1 -2
  163. package/src/locales/es.json +1 -2
  164. package/src/locales/pt_br.json +1 -2
  165. package/src/stories/Alert.stories.js +67 -6
  166. package/src/stories/Button.stories.js +17 -2
  167. package/src/stories/Checkbox.stories.js +10 -9
  168. package/src/stories/Input.stories.js +3 -16
  169. package/src/stories/Label.stories.js +0 -7
  170. package/src/stories/Switch.stories.js +5 -4
  171. package/src/stories/Tab.stories.js +4 -11
  172. package/src/types/scheme-colors.d.ts +0 -1
  173. package/src/utils/call.js +18 -46
  174. package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts +0 -28
  175. package/dist/components/CheckboxGroup/CheckboxGroup.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/components/ui/popover/Popover.vue.d.ts +0 -23
  183. package/dist/components/ui/popover/Popover.vue.d.ts.map +0 -1
  184. package/dist/components/ui/popover/PopoverContent.vue.d.ts +0 -43
  185. package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +0 -1
  186. package/dist/components/ui/popover/PopoverTrigger.vue.d.ts +0 -19
  187. package/dist/components/ui/popover/PopoverTrigger.vue.d.ts.map +0 -1
  188. package/dist/components/ui/popover/index.d.ts +0 -5
  189. package/dist/components/ui/popover/index.d.ts.map +0 -1
  190. package/src/assets/icons/checkbox-checked-disabled.svg +0 -3
  191. package/src/assets/icons/checkbox-checked.svg +0 -3
  192. package/src/assets/icons/radio-checked.svg +0 -3
  193. package/src/assets/icons/switch-checked-disabled.svg +0 -3
  194. package/src/assets/icons/switch-checked.svg +0 -3
  195. package/src/components/CheckboxGroup/CheckboxGroup.vue +0 -96
  196. package/src/components/Popover/__tests__/Popover.spec.js +0 -147
  197. package/src/components/Popover/__tests__/__snapshots__/Popover.spec.js.snap +0 -8
  198. package/src/components/Popover/index.vue +0 -146
  199. package/src/components/RadioGroup/RadioGroup.vue +0 -110
  200. package/src/components/Select/SelectOption.vue +0 -65
  201. package/src/components/Select/__tests__/Select.spec.js +0 -412
  202. package/src/components/Select/__tests__/SelectItem.spec.js +0 -330
  203. package/src/components/Select/__tests__/SelectOption.spec.js +0 -174
  204. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +0 -97
  205. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +0 -15
  206. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +0 -25
  207. package/src/components/Select/index.vue +0 -245
  208. package/src/components/Toast/Toast.vue +0 -236
  209. package/src/components/Toast/ToastManager.ts +0 -110
  210. package/src/components/Toast/types.ts +0 -57
  211. package/src/components/ui/popover/Popover.vue +0 -15
  212. package/src/components/ui/popover/PopoverContent.vue +0 -98
  213. package/src/components/ui/popover/PopoverTrigger.vue +0 -12
  214. package/src/components/ui/popover/index.ts +0 -4
  215. package/src/stories/CheckboxGroup.stories.js +0 -104
  216. package/src/stories/Popover.stories.js +0 -306
  217. package/src/stories/RadioGroup.stories.js +0 -139
  218. package/src/stories/Select.stories.js +0 -158
  219. package/src/stories/Toast.mdx +0 -123
  220. package/src/stories/Toast.stories.js +0 -126
@@ -6,16 +6,20 @@
6
6
  :class="[
7
7
  'unnnic-button',
8
8
  `unnnic-button--size-${size}`,
9
- `unnnic-button--${buttonType}`,
9
+ `unnnic-button--${type}`,
10
10
  iconCenter ? `unnnic-button--icon-on-center` : null,
11
11
  float ? `unnnic-button--float` : null,
12
12
  ]"
13
13
  >
14
- <UnnnicIconLoading
14
+ <UnnnicIcon
15
15
  v-if="loading"
16
+ icon="loading-circle-1"
16
17
  :scheme="iconScheme"
17
18
  :size="iconSize"
19
+ :filled="iconsFilled"
18
20
  :style="{ position: 'absolute' }"
21
+ class="rotation"
22
+ :next="next"
19
23
  data-testid="icon-loading"
20
24
  />
21
25
 
@@ -68,7 +72,6 @@
68
72
  <script setup lang="ts">
69
73
  import { computed, watch, useSlots } from 'vue';
70
74
  import UnnnicIcon from '../Icon.vue';
71
- import UnnnicIconLoading from '../IconLoading/IconLoading.vue';
72
75
  import type { ButtonProps, ButtonSize, ButtonType } from './types';
73
76
  import type { SchemeColor } from '@/types/scheme-colors';
74
77
 
@@ -99,8 +102,8 @@ const buttonDisabled = computed(() => {
99
102
  });
100
103
 
101
104
  const iconSize = computed(() => {
102
- if (props.size === 'extra-large') return 'lg';
103
- return 'ant';
105
+ if (props.size === 'small') return 'sm';
106
+ return 'md';
104
107
  });
105
108
 
106
109
  const hasText = computed(() => {
@@ -117,11 +120,12 @@ const iconScheme = computed((): SchemeColor => {
117
120
  primary: 'neutral-white',
118
121
  secondary: 'neutral-dark',
119
122
  tertiary: 'neutral-dark',
123
+ alternative: 'neutral-white',
120
124
  warning: 'neutral-white',
121
125
  attention: 'neutral-white',
122
126
  };
123
127
 
124
- return typeToSchemeMap[buttonType.value] || 'neutral-white';
128
+ return typeToSchemeMap[props.type] || 'neutral-white';
125
129
  });
126
130
 
127
131
  const isSizePropValid = computed(() => {
@@ -132,23 +136,16 @@ const isSizePropValid = computed(() => {
132
136
  );
133
137
  });
134
138
 
135
- const buttonType = computed(() => {
136
- return (
137
- {
138
- alternative: 'tertiary',
139
- }[props.type] || props.type
140
- );
141
- });
142
-
143
139
  const isTypePropValid = computed(() => {
144
140
  const validTypes: ButtonType[] = [
145
141
  'primary',
146
142
  'secondary',
147
143
  'tertiary',
144
+ 'alternative',
148
145
  'warning',
149
146
  'attention',
150
147
  ];
151
- return validTypes.includes(buttonType.value);
148
+ return validTypes.includes(props.type);
152
149
  });
153
150
 
154
151
  const validateProps = () => {
@@ -162,8 +159,6 @@ const validateProps = () => {
162
159
 
163
160
  if (!isTypePropValid.value) {
164
161
  errorMessage += ' Invalid type prop.';
165
- errorMessage +=
166
- ' Please provide one of the following types: primary, secondary, tertiary, warning, attention. Alternative is discontinued and it was forced renamed to tertiary.';
167
162
  }
168
163
 
169
164
  throw new Error(errorMessage);
@@ -201,12 +196,13 @@ watch(
201
196
  display: inline-flex;
202
197
  align-items: center;
203
198
  justify-content: center;
204
- border-radius: $unnnic-radius-2;
199
+ border-radius: $unnnic-border-radius-sm;
205
200
  border: 0;
206
201
  outline: none;
207
202
  overflow: hidden;
208
203
  white-space: nowrap;
209
- font: $unnnic-font-action;
204
+ font-weight: $unnnic-font-weight-regular;
205
+ font-family: $unnnic-font-family-secondary;
210
206
  cursor: pointer;
211
207
  position: relative;
212
208
 
@@ -220,91 +216,129 @@ watch(
220
216
  }
221
217
  }
222
218
 
223
- &--primary,
224
- &--warning,
225
- &--attention {
226
- color: $unnnic-color-fg-inverted;
227
- }
228
-
229
- &--secondary,
230
- &--tertiary {
231
- color: $unnnic-color-fg-emphasized;
232
- }
233
-
234
219
  &--primary {
235
- background-color: $unnnic-color-bg-active;
220
+ background-color: $unnnic-color-weni-600;
221
+ color: $unnnic-color-neutral-white;
236
222
 
237
223
  &:hover:enabled {
238
- background-color: $unnnic-color-teal-700;
224
+ background-color: $unnnic-color-weni-700;
239
225
  }
240
226
 
241
227
  &:active:enabled {
242
- background-color: $unnnic-color-teal-800;
228
+ background-color: $unnnic-color-weni-800;
243
229
  }
244
230
  }
245
231
 
246
232
  &--secondary {
247
- background-color: $unnnic-color-bg-base;
233
+ background-color: $unnnic-color-neutral-white;
234
+ color: $unnnic-color-neutral-dark;
248
235
  box-shadow: inset 0 0 0 $unnnic-border-width-thinner
249
- $unnnic-color-border-base;
236
+ $unnnic-color-neutral-cleanest;
250
237
 
251
238
  &:hover:enabled {
252
- background-color: $unnnic-color-gray-50;
253
- }
254
-
255
- &:active:enabled {
256
- background-color: $unnnic-color-gray-100;
239
+ background-color: $unnnic-color-neutral-light;
257
240
  }
258
241
 
259
242
  &:disabled {
260
243
  box-shadow: none;
261
244
  }
245
+
246
+ &:active:enabled {
247
+ background-color: $unnnic-color-neutral-soft;
248
+ }
262
249
  }
263
250
 
264
251
  &--tertiary {
265
252
  background-color: transparent;
253
+ color: $unnnic-color-neutral-dark;
266
254
 
267
255
  &:hover:enabled {
268
- background-color: rgba($unnnic-color-gray-400, 0.1);
256
+ background-color: $unnnic-color-neutral-light;
257
+ }
258
+
259
+ &:disabled {
260
+ color: $unnnic-color-neutral-clean;
261
+ cursor: not-allowed;
269
262
  }
270
263
 
271
264
  &:active:enabled {
272
- background-color: rgba($unnnic-color-gray-400, 0.2);
265
+ background-color: $unnnic-color-neutral-soft;
266
+ }
267
+ }
268
+
269
+ &--alternative {
270
+ background-color: $unnnic-color-weni-50;
271
+ color: $unnnic-color-weni-800;
272
+
273
+ :deep(svg .primary) {
274
+ fill: $unnnic-color-weni-800;
275
+ }
276
+
277
+ :deep(svg .primary-stroke) {
278
+ stroke: $unnnic-color-weni-800;
279
+ }
280
+
281
+ &:hover:enabled {
282
+ background-color: $unnnic-color-weni-100;
283
+ }
284
+
285
+ &:disabled {
286
+ :deep(svg .primary) {
287
+ fill: $unnnic-color-neutral-clean;
288
+ }
289
+
290
+ :deep(svg .primary-stroke) {
291
+ stroke: $unnnic-color-neutral-clean;
292
+ }
293
+ }
294
+
295
+ &:active:enabled {
296
+ background-color: $unnnic-color-weni-200;
297
+ color: $unnnic-color-weni-900;
298
+
299
+ :deep(svg .primary) {
300
+ fill: $unnnic-color-weni-900;
301
+ }
302
+
303
+ :deep(svg .primary-stroke) {
304
+ stroke: $unnnic-color-weni-900;
305
+ }
273
306
  }
274
307
  }
275
308
 
276
309
  &--warning {
277
- background-color: $unnnic-color-red-500;
310
+ background-color: $unnnic-color-aux-red-500;
278
311
  color: $unnnic-color-neutral-white;
279
312
 
280
313
  &:hover:enabled {
281
- background-color: $unnnic-color-red-600;
314
+ background-color: $unnnic-color-aux-red-700;
282
315
  }
283
316
 
284
317
  &:active:enabled {
285
- background-color: $unnnic-color-red-700;
318
+ background-color: $unnnic-color-aux-red-900;
286
319
  }
287
320
  }
288
321
 
289
322
  &--attention {
290
- background-color: $unnnic-color-yellow-500;
323
+ background-color: $unnnic-color-aux-yellow-500;
324
+ color: $unnnic-color-neutral-white;
291
325
 
292
326
  &:hover:enabled {
293
- background-color: $unnnic-color-yellow-600;
327
+ background-color: $unnnic-color-aux-yellow-700;
294
328
  }
295
329
 
296
330
  &:active:enabled {
297
- background-color: $unnnic-color-yellow-700;
331
+ background-color: $unnnic-color-aux-yellow-900;
298
332
  }
299
333
  }
300
334
 
301
335
  &--primary:disabled,
302
336
  &--secondary:disabled,
303
- &--tertiary:disabled,
337
+ &--alternative:disabled,
304
338
  &--warning:disabled,
305
339
  &--attention:disabled {
306
- background-color: $unnnic-color-bg-muted;
307
- color: $unnnic-color-fg-muted;
340
+ background-color: $unnnic-color-neutral-soft;
341
+ color: $unnnic-color-neutral-clean;
308
342
  cursor: not-allowed;
309
343
  }
310
344
 
@@ -317,12 +351,26 @@ watch(
317
351
  box-shadow: $unnnic-shadow-level-near;
318
352
  }
319
353
 
320
- &--size-large {
321
- padding: $unnnic-space-3 $unnnic-space-4;
322
- }
354
+ &--size {
355
+ &-extra-large,
356
+ &-large,
357
+ &-small {
358
+ padding: $unnnic-squish-xs;
359
+ font-size: $unnnic-font-size-body-gt;
360
+ line-height: ($unnnic-font-size-body-gt + $unnnic-line-height-medium);
361
+ }
362
+
363
+ &-extra-large {
364
+ height: 58px;
365
+ }
323
366
 
324
- &--size-small {
325
- padding: $unnnic-space-2 $unnnic-space-4;
367
+ &-large {
368
+ height: 46px;
369
+ }
370
+
371
+ &-small {
372
+ height: 38px;
373
+ }
326
374
  }
327
375
  }
328
376
  </style>
@@ -340,8 +388,8 @@ watch(
340
388
  }
341
389
 
342
390
  &-large {
343
- height: 45px;
344
- width: 45px;
391
+ height: 46px;
392
+ width: 46px;
345
393
  }
346
394
 
347
395
  &-large,
@@ -356,8 +404,8 @@ watch(
356
404
 
357
405
  &-small {
358
406
  padding: $unnnic-inset-nano;
359
- height: 37px;
360
- width: 37px;
407
+ height: 38px;
408
+ width: 38px;
361
409
 
362
410
  .unnnic-icon {
363
411
  width: $unnnic-icon-size-ant;
@@ -4,6 +4,7 @@ export type ButtonType =
4
4
  | 'primary'
5
5
  | 'secondary'
6
6
  | 'tertiary'
7
+ | 'alternative'
7
8
  | 'warning'
8
9
  | 'attention';
9
10
 
@@ -1,41 +1,37 @@
1
1
  <!-- eslint-disable vue/multi-word-component-names -->
2
2
  <template>
3
- <section class="unnnic-checkbox-wrapper">
4
- <label>
5
- <input
6
- class="unnnic-checkbox"
7
- type="checkbox"
8
- :disabled="disabled"
9
- :checked="modelValue"
10
- @change="click"
11
- v-bind="pick($attrs, ['id', 'name'])"
12
- />
13
-
14
- <p
15
- v-if="label || textRight"
16
- :class="[
17
- 'unnnic-checkbox__label',
18
- { 'unnnic-checkbox__label--disabled': disabled },
19
- ]"
20
- data-testid="checkbox-text-right"
21
- >
22
- {{ label || textRight }}
23
- </p>
24
- </label>
25
-
26
- <p
27
- v-if="helper"
28
- class="unnnic-checkbox__helper"
3
+ <div class="unnnic-checkbox-wrapper">
4
+ <UnnnicIcon
5
+ class="unnnic-checkbox"
6
+ :class="{ disabled }"
7
+ :icon="icon"
8
+ :scheme="color"
9
+ :clickable="!disabled"
10
+ :size="size"
11
+ @click="click"
12
+ />
13
+
14
+ <div
15
+ v-if="textRight"
16
+ :class="[
17
+ 'unnnic-checkbox__label',
18
+ 'unnnic-checkbox__label__right',
19
+ `unnnic-checkbox__label__${size}`,
20
+ ]"
21
+ data-testid="checkbox-text-right"
29
22
  >
30
- {{ helper }}
31
- </p>
32
- </section>
23
+ {{ textRight }}
24
+ </div>
25
+ </div>
33
26
  </template>
34
27
 
35
28
  <script>
36
- import { pick } from 'lodash';
29
+ import UnnnicIcon from '../Icon.vue';
37
30
 
38
31
  export default {
32
+ components: {
33
+ UnnnicIcon,
34
+ },
39
35
  model: {
40
36
  event: 'change',
41
37
  },
@@ -54,16 +50,13 @@ export default {
54
50
  default: false,
55
51
  },
56
52
 
57
- label: {
53
+ size: {
58
54
  type: String,
59
- default: '',
60
- },
61
-
62
- helper: {
63
- type: String,
64
- default: '',
55
+ default: 'md',
56
+ validator(value) {
57
+ return ['md', 'sm'].includes(value);
58
+ },
65
59
  },
66
-
67
60
  textRight: {
68
61
  type: String,
69
62
  default: '',
@@ -82,11 +75,25 @@ export default {
82
75
 
83
76
  return 'less';
84
77
  },
78
+
79
+ icon() {
80
+ return {
81
+ checked: 'checkbox-select',
82
+ default: this.disabled ? 'checkbox-disable' : 'checkbox-default',
83
+ less: 'checkbox-less',
84
+ }[this.valueName];
85
+ },
86
+
87
+ color() {
88
+ if (this.valueName === 'default') {
89
+ return 'neutral-clean';
90
+ }
91
+
92
+ return 'brand-weni';
93
+ },
85
94
  },
86
95
 
87
96
  methods: {
88
- pick,
89
-
90
97
  click() {
91
98
  const isChecked = ['checked', 'less'].includes(this.valueName);
92
99
  this.$emit('change', !isChecked);
@@ -99,65 +106,35 @@ export default {
99
106
  <style lang="scss" scoped>
100
107
  @use '@/assets/scss/unnnic' as *;
101
108
 
102
- $checkbox-size: 21px;
103
-
104
109
  .unnnic-checkbox-wrapper {
105
110
  display: flex;
106
- flex-direction: column;
107
111
  align-items: flex-start;
108
- }
109
-
110
- label {
111
- display: flex;
112
- align-items: center;
113
- column-gap: $unnnic-space-2;
112
+ cursor: pointer;
114
113
  }
115
114
 
116
115
  .unnnic-checkbox {
117
- appearance: none;
118
- width: $checkbox-size;
119
- height: $checkbox-size;
120
- margin: 0;
121
- background-color: $unnnic-color-bg-base;
122
- border: 1px solid $unnnic-color-border-base;
123
- border-radius: $unnnic-radius-1;
124
- box-sizing: border-box;
125
-
126
- outline: none;
127
-
128
- &:checked {
129
- border-width: 0;
130
- background-color: $unnnic-color-bg-active;
131
- background-image: url('../../assets/icons/checkbox-checked.svg');
132
- background-repeat: no-repeat;
133
- background-position: center;
134
- }
135
-
136
- &:disabled,
137
- &:disabled:checked {
138
- background-color: $unnnic-color-bg-muted;
139
- border: 1px solid $unnnic-color-border-muted;
140
- }
141
-
142
- &:disabled:checked {
143
- background-image: url('../../assets/icons/checkbox-checked-disabled.svg');
116
+ &.disabled {
117
+ :deep(.primary) {
118
+ fill: $unnnic-color-neutral-cleanest;
119
+ }
144
120
  }
145
121
  }
146
122
 
147
123
  .unnnic-checkbox__label {
148
- margin: 0;
149
- font: $unnnic-font-body;
150
- color: $unnnic-color-fg-emphasized;
151
-
152
- &--disabled {
153
- color: $unnnic-color-fg-muted;
124
+ font-family: $unnnic-font-family-secondary;
125
+ font-weight: $unnnic-font-weight-regular;
126
+ color: $unnnic-color-neutral-darkest;
127
+
128
+ &__sm {
129
+ margin-left: $unnnic-inline-nano;
130
+ font-size: $unnnic-font-size-body-md;
131
+ line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
154
132
  }
155
- }
156
133
 
157
- .unnnic-checkbox__helper {
158
- margin: 0;
159
- margin-left: $checkbox-size + $unnnic-space-2;
160
- font: $unnnic-font-caption-2;
161
- color: $unnnic-color-fg-base;
134
+ &__md {
135
+ margin-left: $unnnic-inline-xs;
136
+ font-size: $unnnic-font-size-body-gt;
137
+ line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
138
+ }
162
139
  }
163
140
  </style>
@@ -24,28 +24,43 @@ describe('Checkbox', () => {
24
24
 
25
25
  it('should checkbox emit change events', async () => {
26
26
  wrapper = createWrapper();
27
- const checkbox = wrapper.find('input[type="checkbox"]');
27
+ const checkbox = wrapper.findComponent({ name: 'UnnnicIcon' });
28
28
 
29
29
  // click false to true
30
- await checkbox.trigger('change');
30
+ await checkbox.trigger('click');
31
31
  expect(wrapper.emitted('change')[0][0]).eq(true);
32
32
 
33
33
  // click true to false
34
34
  await wrapper.setProps({ modelValue: true });
35
- await checkbox.trigger('change');
35
+ await checkbox.trigger('click');
36
36
  expect(wrapper.emitted('change')[1][0]).eq(false);
37
37
 
38
38
  // click less to false
39
39
  await wrapper.setProps({ modelValue: 'less' });
40
- expect(wrapper.vm.valueName).eq('less');
41
- await checkbox.trigger('change');
40
+ expect(wrapper.vm.icon).eq('checkbox-less');
41
+ await checkbox.trigger('click');
42
42
  expect(wrapper.emitted('change')[2][0]).eq(false);
43
43
  });
44
44
 
45
45
  it('should checkbox disabled', async () => {
46
46
  wrapper = createWrapper({ disabled: true });
47
- const checkbox = wrapper.find('input[type="checkbox"]');
47
+ const checkbox = wrapper.findComponent({ name: 'UnnnicIcon' });
48
48
  await checkbox.trigger('click');
49
49
  expect(wrapper.emitted('change')).eq(undefined);
50
50
  });
51
+
52
+ it('should define sizes', async () => {
53
+ wrapper = createWrapper({ size: 'sm', textRight: 'Label' });
54
+ const checkbox = wrapper.findComponent({ name: 'UnnnicIcon' });
55
+ const label = wrapper.find('.unnnic-checkbox__label');
56
+
57
+ // sm
58
+ expect(checkbox.classes()).include('unnnic-icon__size--sm');
59
+ expect(label.classes()).include('unnnic-checkbox__label__sm');
60
+
61
+ // md
62
+ await wrapper.setProps({ size: 'md' });
63
+ expect(checkbox.classes()).include('unnnic-icon__size--md');
64
+ expect(label.classes()).include('unnnic-checkbox__label__md');
65
+ });
51
66
  });