@weni/unnnic-system 3.12.3-alpha.3 → 3.12.3-alpha.4
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/dist/components/MultiSelect/index.vue.d.ts.map +1 -1
- package/dist/components/Select/index.vue.d.ts.map +1 -1
- package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +1 -1
- package/dist/{es-282e1be1.mjs → es-e4e4f53d.mjs} +1 -1
- package/dist/{index-3e8b73e8.mjs → index-492e2532.mjs} +3301 -3286
- package/dist/locales/en.json.d.ts +2 -1
- package/dist/locales/es.json.d.ts +2 -1
- package/dist/locales/pt_br.json.d.ts +2 -1
- package/dist/{pt-br-accccfeb.mjs → pt-br-ac2463c3.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +1 -1
- package/dist/unnnic.umd.js +23 -23
- package/package.json +1 -1
- package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +12 -6
- package/src/components/MultiSelect/index.vue +1 -1
- package/src/components/Select/__tests__/Select.spec.js +8 -8
- package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +12 -6
- package/src/components/Select/index.vue +45 -9
- package/src/components/ui/popover/PopoverContent.vue +15 -0
- package/src/locales/en.json +2 -1
- package/src/locales/es.json +2 -1
- package/src/locales/pt_br.json +2 -1
package/package.json
CHANGED
|
@@ -4,9 +4,11 @@ exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with defaul
|
|
|
4
4
|
"<div data-v-03c7fb50="" class="unnnic-multi-select"><button data-v-9d52eef8="" data-v-03c7fb50="" class="unnnic-popover-trigger" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
5
5
|
<section data-v-9f8d6c86="" data-v-d890ad85="" data-v-03c7fb50="" class="unnnic-form-element unnnic-form md unnnic-multi-select__input" data-testid="form-element">
|
|
6
6
|
<!--v-if-->
|
|
7
|
-
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-multi-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-multi-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right
|
|
7
|
+
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-multi-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-multi-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right unnnic-multi-select__input unnnic-form-input input-itself" hascloudycolor="false" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" showclear="false" type="text" readonly="" value="">
|
|
8
8
|
<!--v-if-->
|
|
9
|
-
<section data-v-a0d36167="" class="icon-right-container"
|
|
9
|
+
<section data-v-a0d36167="" class="icon-right-container">
|
|
10
|
+
<!--v-if--><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant icon-right" data-testid="material-icon" translate="no">keyboard_arrow_down</span>
|
|
11
|
+
</section>
|
|
10
12
|
</div>
|
|
11
13
|
<!--v-if-->
|
|
12
14
|
</section>
|
|
@@ -20,9 +22,11 @@ exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with disabl
|
|
|
20
22
|
"<div data-v-03c7fb50="" class="unnnic-multi-select"><button data-v-9d52eef8="" data-v-03c7fb50="" class="unnnic-popover-trigger" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
21
23
|
<section data-v-9f8d6c86="" data-v-d890ad85="" data-v-03c7fb50="" class="unnnic-form-element unnnic-form-element--disabled unnnic-form md unnnic-multi-select__input" data-testid="form-element">
|
|
22
24
|
<!--v-if-->
|
|
23
|
-
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-multi-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-multi-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right
|
|
25
|
+
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-multi-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-multi-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right unnnic-multi-select__input unnnic-form-input input-itself" hascloudycolor="false" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" showclear="false" type="text" readonly="" value="" disabled="">
|
|
24
26
|
<!--v-if-->
|
|
25
|
-
<section data-v-a0d36167="" class="icon-right-container"
|
|
27
|
+
<section data-v-a0d36167="" class="icon-right-container">
|
|
28
|
+
<!--v-if--><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-muted unnnic-icon-size--ant unnnic-icon__size--ant icon-right" data-testid="material-icon" translate="no">keyboard_arrow_down</span>
|
|
29
|
+
</section>
|
|
26
30
|
</div>
|
|
27
31
|
<!--v-if-->
|
|
28
32
|
</section>
|
|
@@ -52,9 +56,11 @@ exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with search
|
|
|
52
56
|
"<div data-v-03c7fb50="" class="unnnic-multi-select"><button data-v-9d52eef8="" data-v-03c7fb50="" class="unnnic-popover-trigger" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
53
57
|
<section data-v-9f8d6c86="" data-v-d890ad85="" data-v-03c7fb50="" class="unnnic-form-element unnnic-form md unnnic-multi-select__input" data-testid="form-element">
|
|
54
58
|
<!--v-if-->
|
|
55
|
-
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-multi-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-multi-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right
|
|
59
|
+
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-multi-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-multi-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right unnnic-multi-select__input unnnic-form-input input-itself" hascloudycolor="false" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" showclear="false" type="text" readonly="" value="">
|
|
56
60
|
<!--v-if-->
|
|
57
|
-
<section data-v-a0d36167="" class="icon-right-container"
|
|
61
|
+
<section data-v-a0d36167="" class="icon-right-container">
|
|
62
|
+
<!--v-if--><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant icon-right" data-testid="material-icon" translate="no">keyboard_arrow_down</span>
|
|
63
|
+
</section>
|
|
58
64
|
</div>
|
|
59
65
|
<!--v-if-->
|
|
60
66
|
</section>
|
|
@@ -245,20 +245,20 @@ describe('UnnnicSelect.vue', () => {
|
|
|
245
245
|
});
|
|
246
246
|
|
|
247
247
|
describe('computed properties', () => {
|
|
248
|
-
test('
|
|
249
|
-
const maxHeight = wrapper.vm.
|
|
248
|
+
test('calculatedPopoverHeight returns correct value', () => {
|
|
249
|
+
const maxHeight = wrapper.vm.calculatedPopoverHeight;
|
|
250
250
|
expect(maxHeight).toBe('235px');
|
|
251
251
|
});
|
|
252
252
|
|
|
253
|
-
test('
|
|
253
|
+
test('calculatedPopoverHeight includes search height when enabled', async () => {
|
|
254
254
|
await wrapper.setProps({ enableSearch: true });
|
|
255
|
-
const maxHeight = wrapper.vm.
|
|
256
|
-
expect(maxHeight).toBe('
|
|
255
|
+
const maxHeight = wrapper.vm.calculatedPopoverHeight;
|
|
256
|
+
expect(maxHeight).toBe('282px');
|
|
257
257
|
});
|
|
258
258
|
|
|
259
|
-
test('
|
|
259
|
+
test('calculatedPopoverHeight returns unset when no options', async () => {
|
|
260
260
|
await wrapper.setProps({ options: [] });
|
|
261
|
-
const maxHeight = wrapper.vm.
|
|
261
|
+
const maxHeight = wrapper.vm.calculatedPopoverHeight;
|
|
262
262
|
expect(maxHeight).toBe('unset');
|
|
263
263
|
});
|
|
264
264
|
|
|
@@ -360,7 +360,7 @@ describe('UnnnicSelect.vue', () => {
|
|
|
360
360
|
test('handles empty options array', async () => {
|
|
361
361
|
await wrapper.setProps({ options: [] });
|
|
362
362
|
expect(wrapper.vm.filteredOptions).toEqual([]);
|
|
363
|
-
expect(wrapper.vm.
|
|
363
|
+
expect(wrapper.vm.calculatedPopoverHeight).toBe('unset');
|
|
364
364
|
});
|
|
365
365
|
|
|
366
366
|
test('handles null modelValue', async () => {
|
|
@@ -4,9 +4,11 @@ exports[`UnnnicSelect.vue > snapshot testing > matches snapshot with default pro
|
|
|
4
4
|
"<div data-v-6077efb7="" class="unnnic-select"><button data-v-9d52eef8="" data-v-6077efb7="" class="unnnic-popover-trigger" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
5
5
|
<section data-v-9f8d6c86="" data-v-d890ad85="" data-v-6077efb7="" class="unnnic-form-element unnnic-form md unnnic-select__input" data-testid="form-element">
|
|
6
6
|
<!--v-if-->
|
|
7
|
-
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right
|
|
7
|
+
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right unnnic-select__input unnnic-form-input input-itself" hascloudycolor="false" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" showclear="false" type="text" readonly="" value="">
|
|
8
8
|
<!--v-if-->
|
|
9
|
-
<section data-v-a0d36167="" class="icon-right-container"
|
|
9
|
+
<section data-v-a0d36167="" class="icon-right-container">
|
|
10
|
+
<!--v-if--><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant icon-right" data-testid="material-icon" translate="no">keyboard_arrow_down</span>
|
|
11
|
+
</section>
|
|
10
12
|
</div>
|
|
11
13
|
<!--v-if-->
|
|
12
14
|
</section>
|
|
@@ -20,9 +22,11 @@ exports[`UnnnicSelect.vue > snapshot testing > matches snapshot with disabled st
|
|
|
20
22
|
"<div data-v-6077efb7="" class="unnnic-select"><button data-v-9d52eef8="" data-v-6077efb7="" class="unnnic-popover-trigger" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
21
23
|
<section data-v-9f8d6c86="" data-v-d890ad85="" data-v-6077efb7="" class="unnnic-form-element unnnic-form-element--disabled unnnic-form md unnnic-select__input" data-testid="form-element">
|
|
22
24
|
<!--v-if-->
|
|
23
|
-
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right
|
|
25
|
+
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right unnnic-select__input unnnic-form-input input-itself" hascloudycolor="false" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" showclear="false" type="text" readonly="" value="" disabled="">
|
|
24
26
|
<!--v-if-->
|
|
25
|
-
<section data-v-a0d36167="" class="icon-right-container"
|
|
27
|
+
<section data-v-a0d36167="" class="icon-right-container">
|
|
28
|
+
<!--v-if--><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-muted unnnic-icon-size--ant unnnic-icon__size--ant icon-right" data-testid="material-icon" translate="no">keyboard_arrow_down</span>
|
|
29
|
+
</section>
|
|
26
30
|
</div>
|
|
27
31
|
<!--v-if-->
|
|
28
32
|
</section>
|
|
@@ -36,9 +40,11 @@ exports[`UnnnicSelect.vue > snapshot testing > matches snapshot with search enab
|
|
|
36
40
|
"<div data-v-6077efb7="" class="unnnic-select"><button data-v-9d52eef8="" data-v-6077efb7="" class="unnnic-popover-trigger" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
37
41
|
<section data-v-9f8d6c86="" data-v-d890ad85="" data-v-6077efb7="" class="unnnic-form-element unnnic-form md unnnic-select__input" data-testid="form-element">
|
|
38
42
|
<!--v-if-->
|
|
39
|
-
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right
|
|
43
|
+
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-select__input unnnic-form-input" hascloudycolor="false" mask=""><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-select__input unnnic-form-input input-itself input size-md normal input--has-icon-right unnnic-select__input unnnic-form-input input-itself" hascloudycolor="false" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" showclear="false" type="text" readonly="" value="">
|
|
40
44
|
<!--v-if-->
|
|
41
|
-
<section data-v-a0d36167="" class="icon-right-container"
|
|
45
|
+
<section data-v-a0d36167="" class="icon-right-container">
|
|
46
|
+
<!--v-if--><span data-v-26446d8e="" data-v-a0d36167="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic-icon__size--ant icon-right" data-testid="material-icon" translate="no">keyboard_arrow_down</span>
|
|
47
|
+
</section>
|
|
42
48
|
</div>
|
|
43
49
|
<!--v-if-->
|
|
44
50
|
</section>
|
|
@@ -20,16 +20,14 @@
|
|
|
20
20
|
:message="props.message"
|
|
21
21
|
:iconRight="openPopover ? 'keyboard_arrow_up' : 'keyboard_arrow_down'"
|
|
22
22
|
:disabled="props.disabled"
|
|
23
|
-
showClear
|
|
23
|
+
:showClear="!!selectedItem"
|
|
24
24
|
@clear="emit('update:modelValue', '')"
|
|
25
25
|
/>
|
|
26
26
|
</PopoverTrigger>
|
|
27
27
|
<PopoverContent
|
|
28
28
|
align="start"
|
|
29
|
-
:
|
|
30
|
-
|
|
31
|
-
overflow: 'auto',
|
|
32
|
-
}"
|
|
29
|
+
:class="'h-full'"
|
|
30
|
+
:style="popoverContentCustomStyles"
|
|
33
31
|
>
|
|
34
32
|
<div class="unnnic-select__content">
|
|
35
33
|
<UnnnicInput
|
|
@@ -40,8 +38,15 @@
|
|
|
40
38
|
iconLeft="search"
|
|
41
39
|
@update:model-value="handleSearch"
|
|
42
40
|
/>
|
|
41
|
+
<p
|
|
42
|
+
v-if="filteredOptions.length === 0"
|
|
43
|
+
class="unnnic-select__content-no-results"
|
|
44
|
+
>
|
|
45
|
+
{{ $t('without_results') }}
|
|
46
|
+
</p>
|
|
43
47
|
<PopoverOption
|
|
44
48
|
v-for="(option, index) in filteredOptions"
|
|
49
|
+
v-else
|
|
45
50
|
:key="option[props.itemValue]"
|
|
46
51
|
:data-option-index="index"
|
|
47
52
|
data-testid="select-option"
|
|
@@ -69,6 +74,7 @@ import {
|
|
|
69
74
|
PopoverContent,
|
|
70
75
|
PopoverOption,
|
|
71
76
|
} from '../ui/popover/index';
|
|
77
|
+
|
|
72
78
|
import UnnnicI18n from '../../mixins/i18n';
|
|
73
79
|
|
|
74
80
|
defineOptions({
|
|
@@ -141,6 +147,7 @@ watch(openPopover, () => {
|
|
|
141
147
|
const handleKeyDown = (event) => {
|
|
142
148
|
const { key } = event;
|
|
143
149
|
const validKeys = ['ArrowUp', 'ArrowDown', 'Enter'];
|
|
150
|
+
|
|
144
151
|
if (validKeys.includes(key)) {
|
|
145
152
|
event.preventDefault();
|
|
146
153
|
if (key === 'ArrowUp') {
|
|
@@ -153,7 +160,7 @@ const handleKeyDown = (event) => {
|
|
|
153
160
|
focusedOptionIndex.value++;
|
|
154
161
|
scrollToOption(focusedOptionIndex.value);
|
|
155
162
|
}
|
|
156
|
-
if (key === 'Enter') {
|
|
163
|
+
if (key === 'Enter' && focusedOptionIndex.value !== -1) {
|
|
157
164
|
handleSelectOption(filteredOptions.value[focusedOptionIndex.value]);
|
|
158
165
|
}
|
|
159
166
|
}
|
|
@@ -174,15 +181,32 @@ const scrollToOption = (
|
|
|
174
181
|
});
|
|
175
182
|
};
|
|
176
183
|
|
|
177
|
-
const
|
|
184
|
+
const calculatedPopoverHeight = computed(() => {
|
|
178
185
|
if (!props.options || props.options.length === 0) return 'unset';
|
|
179
186
|
const popoverPadding = 32;
|
|
180
187
|
const popoverGap = 4;
|
|
181
188
|
// 37 = 21px (height) + 16px (padding)
|
|
182
189
|
const fieldsHeight = 37 * props.optionsLines;
|
|
190
|
+
const gapsCompensation = props.enableSearch ? 1 : 2;
|
|
191
|
+
|
|
183
192
|
const size =
|
|
184
|
-
fieldsHeight +
|
|
185
|
-
|
|
193
|
+
fieldsHeight +
|
|
194
|
+
popoverPadding +
|
|
195
|
+
(popoverGap * props.optionsLines - gapsCompensation);
|
|
196
|
+
|
|
197
|
+
return `${props.enableSearch ? size + 45 + 1 : size}px`;
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const popoverContentCustomStyles = computed(() => {
|
|
201
|
+
const emptyFilteredOptions = filteredOptions.value?.length === 0;
|
|
202
|
+
return {
|
|
203
|
+
overflow: 'auto',
|
|
204
|
+
display: 'flex',
|
|
205
|
+
flexDirection: 'column',
|
|
206
|
+
minHeight: calculatedPopoverHeight.value,
|
|
207
|
+
maxHeight: emptyFilteredOptions ? 'unset' : calculatedPopoverHeight.value,
|
|
208
|
+
height: emptyFilteredOptions ? calculatedPopoverHeight.value : 'unset',
|
|
209
|
+
};
|
|
186
210
|
});
|
|
187
211
|
|
|
188
212
|
const selectedItem = computed(() => {
|
|
@@ -256,6 +280,18 @@ const filteredOptions = computed(() => {
|
|
|
256
280
|
padding: 0;
|
|
257
281
|
margin: 0;
|
|
258
282
|
gap: $unnnic-space-1;
|
|
283
|
+
|
|
284
|
+
height: -webkit-fill-available;
|
|
285
|
+
|
|
286
|
+
&-no-results {
|
|
287
|
+
margin: 0;
|
|
288
|
+
display: flex;
|
|
289
|
+
align-items: center;
|
|
290
|
+
justify-content: center;
|
|
291
|
+
height: 100%;
|
|
292
|
+
font: $unnnic-font-emphasis;
|
|
293
|
+
color: $unnnic-color-fg-muted;
|
|
294
|
+
}
|
|
259
295
|
}
|
|
260
296
|
}
|
|
261
297
|
</style>
|
|
@@ -93,6 +93,21 @@ $popover-space: $unnnic-space-4;
|
|
|
93
93
|
.unnnic-popover {
|
|
94
94
|
border-radius: $unnnic-radius-2;
|
|
95
95
|
box-shadow: $unnnic-shadow-1;
|
|
96
|
+
border: 1px solid $unnnic-color-border-soft;
|
|
97
|
+
|
|
98
|
+
&::-webkit-scrollbar {
|
|
99
|
+
width: $unnnic-spacing-inline-nano;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&::-webkit-scrollbar-thumb {
|
|
103
|
+
background: $unnnic-color-neutral-cleanest;
|
|
104
|
+
border-radius: $unnnic-border-radius-pill;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&::-webkit-scrollbar-track {
|
|
108
|
+
background: $unnnic-color-neutral-soft;
|
|
109
|
+
border-radius: $unnnic-border-radius-pill;
|
|
110
|
+
}
|
|
96
111
|
|
|
97
112
|
&--size-small {
|
|
98
113
|
width: 240px;
|
package/src/locales/en.json
CHANGED
package/src/locales/es.json
CHANGED