@weni/unnnic-system 3.0.4-alpha.1 → 3.0.5-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.0.4-alpha.1",
3
+ "version": "3.0.5-alpha.0",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -343,6 +343,7 @@ $scheme-colors:
343
343
  "bg-base" $unnnic-color-white,
344
344
  "bg-soft" $unnnic-color-gray-50,
345
345
  "bg-muted" $unnnic-color-gray-100,
346
+ "bg-active" $unnnic-color-teal-600,
346
347
  "bg-info" $unnnic-color-aux-blue-100,
347
348
  "bg-success" $unnnic-color-aux-green-100,
348
349
  "bg-warning" $unnnic-color-aux-yellow-50,
@@ -353,6 +354,7 @@ $scheme-colors:
353
354
  "fg-muted" $unnnic-color-gray-300,
354
355
  "fg-emphasized" $unnnic-color-gray-900,
355
356
  "fg-inverted" $unnnic-color-white,
357
+ "fg-active" $unnnic-color-teal-600,
356
358
  "fg-info" $unnnic-color-aux-blue-500,
357
359
  "fg-success" $unnnic-color-aux-green-500,
358
360
  "fg-warning" $unnnic-color-aux-yellow-500,
@@ -363,6 +365,7 @@ $scheme-colors:
363
365
  "border-soft" $unnnic-color-gray-100,
364
366
  "border-muted" $unnnic-color-gray-200,
365
367
  "border-emphasized" $unnnic-color-gray-400,
368
+ "border-active" $unnnic-color-teal-600,
366
369
  "border-info" $unnnic-color-aux-blue-300,
367
370
  "border-success" $unnnic-color-aux-green-300,
368
371
  "border-warning" $unnnic-color-aux-yellow-300,
@@ -86,6 +86,7 @@
86
86
  :active="
87
87
  option.value === modelValue || optionIsSelected(option)
88
88
  "
89
+ :disabled="optionIsSelected(option) && option.disableRemove"
89
90
  :focused="focusedOption && focusedOption.value === option.value"
90
91
  :allowCheckbox="!!multiple"
91
92
  :activeColor="type === 'secondary' ? 'secondary' : 'primary'"
@@ -142,6 +143,10 @@ export default {
142
143
  value: 'option1',
143
144
  label: 'Option1',
144
145
  },
146
+ {
147
+ value: 'option2',
148
+ label: 'Option2',
149
+ },
145
150
  ],
146
151
  },
147
152
  modelValue: {
@@ -203,6 +208,10 @@ export default {
203
208
  type: Boolean,
204
209
  default: false,
205
210
  },
211
+ multipleLimit: {
212
+ type: [Number, null],
213
+ default: null,
214
+ },
206
215
  },
207
216
 
208
217
  emits: ['update:searchValue', 'onChange', 'update:modelValue'],
@@ -363,11 +372,23 @@ export default {
363
372
 
364
373
  handleSelect(option) {
365
374
  if (option) {
366
- if (this.multiple && this.optionIsSelected(option)) {
375
+ if (
376
+ this.multiple &&
377
+ this.optionIsSelected(option) &&
378
+ !option.disableRemove
379
+ ) {
367
380
  this.unselectOption(option);
368
381
  return;
369
382
  }
370
383
 
384
+ if(this.multiple && option.disableRemove && this.optionIsSelected(option)) {
385
+ return;
386
+ }
387
+
388
+ if (this.multipleLimit && this.modelValue.length >= this.multipleLimit) {
389
+ return;
390
+ }
391
+
371
392
  this.selectOption(option);
372
393
  }
373
394
  },
@@ -10,7 +10,7 @@
10
10
  :key="option.value"
11
11
  class="unnnic-select-smart__options__multiple__selecteds__option"
12
12
  :text="option.label"
13
- hasCloseIcon
13
+ :hasCloseIcon="!option.disableRemove"
14
14
  @close="unselectOption(option)"
15
15
  />
16
16
  <p
@@ -19,6 +19,7 @@
19
19
  data-testid="checkbox"
20
20
  :modelValue="active"
21
21
  :size="size"
22
+ :disabled="disabled"
22
23
  />
23
24
  <div>
24
25
  <span
@@ -77,6 +78,10 @@ export default {
77
78
  type: Boolean,
78
79
  default: null,
79
80
  },
81
+ disabled: {
82
+ type: Boolean,
83
+ default: false,
84
+ },
80
85
  allowCheckbox: {
81
86
  type: Boolean,
82
87
  default: false,
@@ -284,7 +284,7 @@ export const Multiple = {
284
284
  { value: 'spain', label: 'Espanha' },
285
285
  { value: 'saudi_arabia', label: 'Arábia Saudita' },
286
286
  ],
287
- multiple: true,
287
+ multiple:true,
288
288
  multipleWithoutSelectsMessage: 'No country selected yet :(',
289
289
  },
290
290
  };