@weni/unnnic-system 3.2.5-alpha.0 → 3.2.5

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 (64) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/components/Button/Button.vue.d.ts.map +1 -1
  3. package/dist/components/Button/types.d.ts +1 -1
  4. package/dist/components/Button/types.d.ts.map +1 -1
  5. package/dist/components/Chip/Chip.vue.d.ts +8 -0
  6. package/dist/components/Chip/Chip.vue.d.ts.map +1 -0
  7. package/dist/components/Chip/types.d.ts +9 -0
  8. package/dist/components/Chip/types.d.ts.map +1 -0
  9. package/dist/components/DatePicker/DatePicker.vue.d.ts +2 -2
  10. package/dist/components/Disclaimer/types.d.ts +1 -1
  11. package/dist/components/Disclaimer/types.d.ts.map +1 -1
  12. package/dist/components/DropArea/DropArea.vue.d.ts +0 -2
  13. package/dist/components/DropArea/DropArea.vue.d.ts.map +1 -1
  14. package/dist/components/FormElement/FormElement.vue.d.ts +1 -1
  15. package/dist/components/Icon/types.d.ts +2 -1
  16. package/dist/components/Icon/types.d.ts.map +1 -1
  17. package/dist/components/Icon.vue.d.ts +2 -1
  18. package/dist/components/Icon.vue.d.ts.map +1 -1
  19. package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +3 -3
  20. package/dist/components/ModalDialog/ModalDialog.vue.d.ts +1 -1
  21. package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
  22. package/dist/components/ModalUpload/ModalUpload.vue.d.ts +0 -6
  23. package/dist/components/UploadArea/UploadArea.vue.d.ts +0 -6
  24. package/dist/components/index.d.ts +24 -54
  25. package/dist/components/index.d.ts.map +1 -1
  26. package/dist/{es-e4a6e990.mjs → es-a07e7553.mjs} +1 -1
  27. package/dist/{index-de083a7a.mjs → index-93aafec9.mjs} +7413 -7525
  28. package/dist/{pt-br-229e5ab3.mjs → pt-br-a81c613f.mjs} +1 -1
  29. package/dist/style.css +1 -1
  30. package/dist/unnnic.mjs +116 -118
  31. package/dist/unnnic.umd.js +41 -42
  32. package/package.json +2 -2
  33. package/src/assets/scss/scheme-colors.scss +132 -0
  34. package/src/assets/scss/unnnic.scss +2 -0
  35. package/src/components/Button/Button.vue +109 -58
  36. package/src/components/Button/types.ts +1 -0
  37. package/src/components/Card/Card.vue +12 -21
  38. package/src/components/Chip/Chip.vue +124 -0
  39. package/src/components/Chip/__tests__/Chip.spec.js +164 -0
  40. package/src/components/Chip/types.ts +8 -0
  41. package/src/components/Disclaimer/types.ts +1 -1
  42. package/src/components/DropArea/DropArea.vue +2 -26
  43. package/src/components/Icon/types.ts +4 -88
  44. package/src/components/Icon.vue +3 -91
  45. package/src/components/ModalDialog/ModalDialog.vue +29 -27
  46. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
  47. package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
  48. package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
  49. package/src/components/index.ts +7 -12
  50. package/src/stories/Button.stories.js +10 -1
  51. package/src/stories/Chip.stories.js +173 -0
  52. package/src/types/scheme-colors.d.ts +102 -0
  53. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +0 -9
  54. package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +0 -1
  55. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +0 -15
  56. package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +0 -1
  57. package/src/assets/img/previews/doc-preview.png +0 -0
  58. package/src/assets/img/previews/image-preview.png +0 -0
  59. package/src/assets/img/previews/video-preview.png +0 -0
  60. package/src/components/TemplatePreview/TemplatePreview.vue +0 -249
  61. package/src/components/TemplatePreview/TemplatePreviewModal.vue +0 -51
  62. package/src/components/TemplatePreview/types.d.ts +0 -16
  63. package/src/stories/TemplatePreview.stories.js +0 -94
  64. package/src/stories/TemplatePreviewModal.stories.js +0 -110
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.2.5-alpha.0",
3
+ "version": "3.2.5",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -100,4 +100,4 @@
100
100
  "vue-eslint-parser": "^9.4.2",
101
101
  "vue-tsc": "^3.0.5"
102
102
  }
103
- }
103
+ }
@@ -0,0 +1,132 @@
1
+ @use './colors' as *;
2
+ @use './deprecated/colors' as *;
3
+
4
+ // Global scheme colors mapping for all components
5
+
6
+ $unnnic-scheme-colors:
7
+ 'background-solo' $unnnic-color-teal-50,
8
+ 'background-sky' $unnnic-color-gray-50,
9
+ 'background-grass' $unnnic-color-green-50,
10
+ 'background-carpet' $unnnic-color-gray-50,
11
+ 'background-snow' $unnnic-color-white,
12
+ 'background-lightest' $unnnic-color-gray-50,
13
+ 'background-white' $unnnic-color-white,
14
+
15
+ 'neutral-black' $unnnic-color-gray-900,
16
+ 'neutral-darkest' $unnnic-color-gray-800,
17
+ 'neutral-dark' $unnnic-color-gray-700,
18
+ 'neutral-cloudy' $unnnic-color-gray-500,
19
+ 'neutral-cleanest' $unnnic-color-gray-200,
20
+ 'neutral-clean' $unnnic-color-gray-300,
21
+ 'neutral-soft' $unnnic-color-gray-100,
22
+ 'neutral-lightest' $unnnic-color-gray-50,
23
+ 'neutral-light' $unnnic-color-gray-50,
24
+ 'neutral-white' $unnnic-color-white,
25
+ 'neutral-snow' $unnnic-color-white,
26
+
27
+ 'feedback-red' $unnnic-color-red-500,
28
+ 'feedback-green' $unnnic-color-green-500,
29
+ 'feedback-yellow' $unnnic-color-yellow-500,
30
+ 'feedback-blue' $unnnic-color-blue-500,
31
+ 'feedback-grey' $unnnic-color-gray-500,
32
+
33
+ 'aux-blue' $unnnic-color-blue-500,
34
+ 'aux-purple' $unnnic-color-purple-500,
35
+ 'aux-orange' $unnnic-color-orange-500,
36
+ 'aux-lemon' $unnnic-color-yellow-400,
37
+ 'aux-pink' $unnnic-color-red-300,
38
+ 'aux-baby-blue' $unnnic-color-blue-200,
39
+ 'aux-baby-yellow' $unnnic-color-yellow-200,
40
+ 'aux-baby-red' $unnnic-color-red-200,
41
+ 'aux-baby-green' $unnnic-color-green-200,
42
+ 'aux-baby-pink' $unnnic-color-red-100,
43
+
44
+ 'aux-green-100' $unnnic-color-green-100,
45
+ 'aux-green-300' $unnnic-color-green-300,
46
+ 'aux-green-500' $unnnic-color-green-500,
47
+ 'aux-green-700' $unnnic-color-green-700,
48
+ 'aux-green-900' $unnnic-color-green-900,
49
+ 'aux-blue-100' $unnnic-color-blue-100,
50
+ 'aux-blue-300' $unnnic-color-blue-300,
51
+ 'aux-blue-500' $unnnic-color-blue-500,
52
+ 'aux-blue-700' $unnnic-color-blue-700,
53
+ 'aux-blue-900' $unnnic-color-blue-900,
54
+ 'aux-purple-100' $unnnic-color-purple-100,
55
+ 'aux-purple-300' $unnnic-color-purple-300,
56
+ 'aux-purple-500' $unnnic-color-purple-500,
57
+ 'aux-purple-700' $unnnic-color-purple-700,
58
+ 'aux-purple-900' $unnnic-color-purple-900,
59
+ 'aux-red-100' $unnnic-color-red-100,
60
+ 'aux-red-300' $unnnic-color-red-300,
61
+ 'aux-red-500' $unnnic-color-red-500,
62
+ 'aux-red-700' $unnnic-color-red-700,
63
+ 'aux-red-900' $unnnic-color-red-900,
64
+ 'aux-orange-100' $unnnic-color-orange-100,
65
+ 'aux-orange-300' $unnnic-color-orange-300,
66
+ 'aux-orange-500' $unnnic-color-orange-500,
67
+ 'aux-orange-700' $unnnic-color-orange-700,
68
+ 'aux-orange-900' $unnnic-color-orange-900,
69
+ 'aux-yellow-100' $unnnic-color-yellow-100,
70
+ 'aux-yellow-300' $unnnic-color-yellow-300,
71
+ 'aux-yellow-500' $unnnic-color-yellow-500,
72
+ 'aux-yellow-700' $unnnic-color-yellow-700,
73
+ 'aux-yellow-900' $unnnic-color-yellow-900,
74
+
75
+ 'floweditor-blue' $unnnic-color-blue-600,
76
+ 'floweditor-purple' $unnnic-color-purple-600,
77
+ 'floweditor-wine' $unnnic-color-red-800,
78
+ 'floweditor-orange' $unnnic-color-orange-600,
79
+ 'floweditor-pink' $unnnic-color-red-400,
80
+ 'floweditor-turquoise' $unnnic-color-teal-500,
81
+ 'floweditor-green' $unnnic-color-green-600,
82
+
83
+ 'weni-50' $unnnic-color-teal-50,
84
+ 'weni-100' $unnnic-color-teal-100,
85
+ 'weni-200' $unnnic-color-teal-200,
86
+ 'weni-300' $unnnic-color-teal-300,
87
+ 'weni-400' $unnnic-color-teal-400,
88
+ 'weni-500' $unnnic-color-teal-500,
89
+ 'weni-600' $unnnic-color-teal-600,
90
+ 'weni-700' $unnnic-color-teal-700,
91
+ 'weni-800' $unnnic-color-teal-800,
92
+ 'weni-900' $unnnic-color-teal-900,
93
+ 'weni-950' $unnnic-color-teal-950,
94
+ 'brand-weni' $unnnic-color-teal-600,
95
+ 'brand-weni-dark' $unnnic-color-teal-800,
96
+ 'brand-weni-soft' $unnnic-color-teal-100,
97
+ 'brand-sec-dark' $unnnic-color-blue-800,
98
+ 'brand-sec-soft' $unnnic-color-blue-100,
99
+ 'brand-sec' $unnnic-color-blue-600,
100
+
101
+ 'bg-base' $unnnic-color-bg-base,
102
+ 'bg-soft' $unnnic-color-bg-soft,
103
+
104
+ 'teal-50' $unnnic-color-teal-50,
105
+ 'teal-100' $unnnic-color-teal-100,
106
+ 'teal-200' $unnnic-color-teal-200,
107
+ 'teal-300' $unnnic-color-teal-300,
108
+ 'teal-400' $unnnic-color-teal-400,
109
+ 'teal-500' $unnnic-color-teal-500,
110
+ 'teal-600' $unnnic-color-teal-600,
111
+ 'teal-700' $unnnic-color-teal-700,
112
+ 'teal-800' $unnnic-color-teal-800,
113
+ 'teal-900' $unnnic-color-teal-900,
114
+ 'teal-950' $unnnic-color-teal-950;
115
+
116
+ @mixin generate-scheme-classes($component-name, $property: 'background-color') {
117
+ @each $name, $color in $unnnic-scheme-colors {
118
+ .#{$component-name}--#{$name} {
119
+ #{$property}: $color;
120
+ }
121
+ }
122
+ }
123
+
124
+ @function get-scheme-color($name) {
125
+ @each $scheme-name, $color in $unnnic-scheme-colors {
126
+ @if $scheme-name == $name {
127
+ @return $color;
128
+ }
129
+ }
130
+ @warn "Scheme color '#{$name}' not found in $unnnic-scheme-colors";
131
+ @return null;
132
+ }
@@ -8,6 +8,7 @@
8
8
  @forward './spaces';
9
9
  @forward './icon-sizes';
10
10
  @forward './colors';
11
+ @forward './scheme-colors';
11
12
 
12
13
  @use './deprecated/colors' as *;
13
14
  @use './deprecated/fonts' as *;
@@ -19,6 +20,7 @@
19
20
  @use './spaces' as *;
20
21
  @use './icon-sizes' as *;
21
22
  @use './colors' as *;
23
+ @use './scheme-colors' as *;
22
24
 
23
25
  .unnnic {
24
26
  &--clickable {
@@ -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,9 +72,8 @@
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
- import type { SchemeColor } from '../Icon/types';
76
+ import type { SchemeColor } from '@/types/scheme-colors';
74
77
 
75
78
  defineOptions({
76
79
  name: 'UnnnicButton',
@@ -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,21 +136,16 @@ const isSizePropValid = computed(() => {
132
136
  );
133
137
  });
134
138
 
135
- const buttonType = computed(() => {
136
- return {
137
- 'alternative': 'tertiary',
138
- }[props.type] || props.type;
139
- });
140
-
141
139
  const isTypePropValid = computed(() => {
142
140
  const validTypes: ButtonType[] = [
143
141
  'primary',
144
142
  'secondary',
145
143
  'tertiary',
144
+ 'alternative',
146
145
  'warning',
147
146
  'attention',
148
147
  ];
149
- return validTypes.includes(buttonType.value);
148
+ return validTypes.includes(props.type);
150
149
  });
151
150
 
152
151
  const validateProps = () => {
@@ -160,7 +159,6 @@ const validateProps = () => {
160
159
 
161
160
  if (!isTypePropValid.value) {
162
161
  errorMessage += ' Invalid type prop.';
163
- errorMessage += ' Please provide one of the following types: primary, secondary, tertiary, warning, attention. Alternative is discontinued and it was forced renamed to tertiary.';
164
162
  }
165
163
 
166
164
  throw new Error(errorMessage);
@@ -198,12 +196,13 @@ watch(
198
196
  display: inline-flex;
199
197
  align-items: center;
200
198
  justify-content: center;
201
- border-radius: $unnnic-radius-2;
199
+ border-radius: $unnnic-border-radius-sm;
202
200
  border: 0;
203
201
  outline: none;
204
202
  overflow: hidden;
205
203
  white-space: nowrap;
206
- font: $unnnic-font-action;
204
+ font-weight: $unnnic-font-weight-regular;
205
+ font-family: $unnnic-font-family-secondary;
207
206
  cursor: pointer;
208
207
  position: relative;
209
208
 
@@ -217,91 +216,129 @@ watch(
217
216
  }
218
217
  }
219
218
 
220
- &--primary,
221
- &--warning,
222
- &--attention {
223
- color: $unnnic-color-fg-inverted;
224
- }
225
-
226
- &--secondary,
227
- &--tertiary {
228
- color: $unnnic-color-fg-emphasized;
229
- }
230
-
231
219
  &--primary {
232
- background-color: $unnnic-color-bg-active;
220
+ background-color: $unnnic-color-weni-600;
221
+ color: $unnnic-color-neutral-white;
233
222
 
234
223
  &:hover:enabled {
235
- background-color: $unnnic-color-teal-700;
224
+ background-color: $unnnic-color-weni-700;
236
225
  }
237
226
 
238
227
  &:active:enabled {
239
- background-color: $unnnic-color-teal-800;
228
+ background-color: $unnnic-color-weni-800;
240
229
  }
241
230
  }
242
231
 
243
232
  &--secondary {
244
- background-color: $unnnic-color-bg-base;
233
+ background-color: $unnnic-color-neutral-white;
234
+ color: $unnnic-color-neutral-dark;
245
235
  box-shadow: inset 0 0 0 $unnnic-border-width-thinner
246
- $unnnic-color-border-base;
236
+ $unnnic-color-neutral-cleanest;
247
237
 
248
238
  &:hover:enabled {
249
- background-color: $unnnic-color-gray-50;
250
- }
251
-
252
- &:active:enabled {
253
- background-color: $unnnic-color-gray-100;
239
+ background-color: $unnnic-color-neutral-light;
254
240
  }
255
241
 
256
242
  &:disabled {
257
243
  box-shadow: none;
258
244
  }
245
+
246
+ &:active:enabled {
247
+ background-color: $unnnic-color-neutral-soft;
248
+ }
259
249
  }
260
250
 
261
251
  &--tertiary {
262
252
  background-color: transparent;
253
+ color: $unnnic-color-neutral-dark;
263
254
 
264
255
  &:hover:enabled {
265
- 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;
266
262
  }
267
263
 
268
264
  &:active:enabled {
269
- 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
+ }
270
306
  }
271
307
  }
272
308
 
273
309
  &--warning {
274
- background-color: $unnnic-color-red-500;
310
+ background-color: $unnnic-color-aux-red-500;
275
311
  color: $unnnic-color-neutral-white;
276
312
 
277
313
  &:hover:enabled {
278
- background-color: $unnnic-color-red-600;
314
+ background-color: $unnnic-color-aux-red-700;
279
315
  }
280
316
 
281
317
  &:active:enabled {
282
- background-color: $unnnic-color-red-700;
318
+ background-color: $unnnic-color-aux-red-900;
283
319
  }
284
320
  }
285
321
 
286
322
  &--attention {
287
- background-color: $unnnic-color-yellow-500;
323
+ background-color: $unnnic-color-aux-yellow-500;
324
+ color: $unnnic-color-neutral-white;
288
325
 
289
326
  &:hover:enabled {
290
- background-color: $unnnic-color-yellow-600;
327
+ background-color: $unnnic-color-aux-yellow-700;
291
328
  }
292
329
 
293
330
  &:active:enabled {
294
- background-color: $unnnic-color-yellow-700;
331
+ background-color: $unnnic-color-aux-yellow-900;
295
332
  }
296
333
  }
297
334
 
298
335
  &--primary:disabled,
299
336
  &--secondary:disabled,
300
- &--tertiary:disabled,
337
+ &--alternative:disabled,
301
338
  &--warning:disabled,
302
339
  &--attention:disabled {
303
- background-color: $unnnic-color-bg-muted;
304
- color: $unnnic-color-fg-muted;
340
+ background-color: $unnnic-color-neutral-soft;
341
+ color: $unnnic-color-neutral-clean;
305
342
  cursor: not-allowed;
306
343
  }
307
344
 
@@ -314,12 +351,26 @@ watch(
314
351
  box-shadow: $unnnic-shadow-level-near;
315
352
  }
316
353
 
317
- &--size-large {
318
- padding: $unnnic-space-3 $unnnic-space-4;
319
- }
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
+ }
320
366
 
321
- &--size-small {
322
- padding: $unnnic-space-2 $unnnic-space-4;
367
+ &-large {
368
+ height: 46px;
369
+ }
370
+
371
+ &-small {
372
+ height: 38px;
373
+ }
323
374
  }
324
375
  }
325
376
  </style>
@@ -337,8 +388,8 @@ watch(
337
388
  }
338
389
 
339
390
  &-large {
340
- height: 45px;
341
- width: 45px;
391
+ height: 46px;
392
+ width: 46px;
342
393
  }
343
394
 
344
395
  &-large,
@@ -353,8 +404,8 @@ watch(
353
404
 
354
405
  &-small {
355
406
  padding: $unnnic-inset-nano;
356
- height: 37px;
357
- width: 37px;
407
+ height: 38px;
408
+ width: 38px;
358
409
 
359
410
  .unnnic-icon {
360
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
 
@@ -194,29 +194,20 @@ export default {
194
194
  <style lang="scss">
195
195
  @use '@/assets/scss/unnnic' as *;
196
196
 
197
- $scheme-colors:
198
- 'feedback-red' $unnnic-color-feedback-red,
199
- 'feedback-green' $unnnic-color-feedback-green,
200
- 'feedback-yellow' $unnnic-color-feedback-yellow,
201
- 'feedback-blue' $unnnic-color-feedback-blue,
202
- 'feedback-grey' $unnnic-color-feedback-grey,
203
- 'aux-blue' $unnnic-color-aux-blue,
204
- 'aux-purple' $unnnic-color-aux-purple,
205
- 'aux-orange' $unnnic-color-aux-orange,
206
- 'aux-lemon' $unnnic-color-aux-lemon,
207
- 'aux-pink' $unnnic-color-aux-pink,
208
- 'brand-weni-soft' $unnnic-color-brand-weni-soft;
197
+ $card-needed-colors: 'feedback-red', 'feedback-green', 'feedback-yellow', 'feedback-blue', 'feedback-grey', 'aux-blue', 'aux-purple', 'aux-orange', 'aux-lemon', 'aux-pink', 'brand-weni-soft';
209
198
 
210
- @each $name, $color in $scheme-colors {
211
- .unnnic-card-scheme {
212
- &--#{$name} {
213
- background-color: rgba($color, $unnnic-opacity-level-extra-light);
214
- color: $color;
215
- &--icon {
199
+ @each $name, $color in $unnnic-scheme-colors {
200
+ @if index($card-needed-colors, $name) {
201
+ .unnnic-card-scheme {
202
+ &--#{$name} {
203
+ background-color: rgba($color, $unnnic-opacity-level-extra-light);
216
204
  color: $color;
217
- }
218
- &--border {
219
- border-left: 0.25 * $unnnic-font-size solid $color;
205
+ &--icon {
206
+ color: $color;
207
+ }
208
+ &--border {
209
+ border-left: 0.25 * $unnnic-font-size solid $color;
210
+ }
220
211
  }
221
212
  }
222
213
  }
@@ -0,0 +1,124 @@
1
+ <!-- eslint-disable vue/multi-word-component-names -->
2
+ <template>
3
+ <section
4
+ :class="[
5
+ 'chip',
6
+ chipClass,
7
+ {
8
+ 'chip--border': shouldShowBorder,
9
+ 'chip--is-clickable': isClickable
10
+ }
11
+ ]"
12
+ @click="onClick"
13
+ >
14
+ <p :class="['chip__text', textColorClass]">{{ text }}</p>
15
+ <p v-if="count" :class="['chip__count', countColorClass]">{{ count }}</p>
16
+ <UnnnicIcon
17
+ v-if="type === 'multiple'"
18
+ :icon="isSelected ? 'close' : 'add'"
19
+ :scheme="isSelected ? 'teal-600' : 'feedback-grey'"
20
+ class="chip__icon"
21
+ size="sm"
22
+ />
23
+ </section>
24
+ </template>
25
+
26
+ <script setup lang="ts">
27
+ import { computed } from 'vue';
28
+ import UnnnicIcon from '../Icon.vue';
29
+ import type { ChipProps } from './types';
30
+
31
+ const props = defineProps<ChipProps>();
32
+
33
+ const emit = defineEmits<{
34
+ click: [event: Event];
35
+ }>();
36
+
37
+ const onClick = (event: Event) => {
38
+ emit('click', event);
39
+ };
40
+
41
+ const shouldShowBorder = computed(() => {
42
+ return !props.isSelected;
43
+ });
44
+
45
+ const textColorClass = computed(() => {
46
+ if (props.isSelected) {
47
+ return 'chip__text--is-selected';
48
+ }
49
+ return '';
50
+ });
51
+
52
+ const countColorClass = computed(() => {
53
+ if (props.isSelected) {
54
+ return 'chip__count--is-selected';
55
+ }
56
+ return '';
57
+ });
58
+
59
+ const chipClass = computed(() => {
60
+ return props.isSelected ? 'chip--is-selected' : '';
61
+ });
62
+ </script>
63
+
64
+ <style lang="scss" scoped>
65
+ @use '@/assets/scss/unnnic' as *;
66
+
67
+ .chip {
68
+ display: inline-flex;
69
+ height: 26px;
70
+ padding: $unnnic-space-1 $unnnic-space-3;
71
+ justify-content: center;
72
+ align-items: center;
73
+ gap: $unnnic-space-2;
74
+ flex-shrink: 0;
75
+ border-radius: 600px;
76
+ background-color: $unnnic-color-bg-base;
77
+
78
+ &:hover {
79
+ background-color: $unnnic-color-bg-soft;
80
+ }
81
+
82
+ &--is-selected {
83
+ background-color: $unnnic-color-teal-100;
84
+ &:hover {
85
+ background-color: $unnnic-color-teal-200;
86
+ }
87
+ }
88
+
89
+ &--is-clickable {
90
+ cursor: pointer;
91
+ }
92
+
93
+ &--border {
94
+ border: 1px solid $unnnic-color-border-base;
95
+ }
96
+
97
+ &__text {
98
+ color: $unnnic-color-fg-base;
99
+ font: $unnnic-font-caption-1;
100
+
101
+ &--is-selected {
102
+ color: $unnnic-color-fg-active;
103
+ }
104
+ }
105
+
106
+ &__count {
107
+ display: flex;
108
+ padding: 0 $unnnic-space-2;
109
+ justify-content: center;
110
+ align-items: center;
111
+ gap: 10px;
112
+ border-radius: 600px;
113
+ background: $unnnic-color-bg-soft;
114
+ color: $unnnic-color-fg-base;
115
+ font: $unnnic-font-caption-1;
116
+ font-weight: $unnnic-font-weight-medium;
117
+
118
+ &--is-selected {
119
+ color: $unnnic-color-fg-active;
120
+ background: $unnnic-color-white;
121
+ }
122
+ }
123
+ }
124
+ </style>