@weni/unnnic-system 3.12.3-alpha.5 → 3.12.3-alpha.6
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/CHANGELOG.md +10 -0
- package/dist/components/MultiSelect/index.vue.d.ts +636 -1
- package/dist/components/MultiSelect/index.vue.d.ts.map +1 -1
- package/dist/components/Select/index.vue.d.ts +636 -1
- package/dist/components/Select/index.vue.d.ts.map +1 -1
- package/dist/components/index.d.ts +12 -6
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +4 -2
- package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +1 -1
- package/dist/{es-a9e51a05.mjs → es-ea43343d.mjs} +1 -1
- package/dist/{index-ade761d4.mjs → index-f40272b0.mjs} +7584 -7496
- package/dist/{pt-br-5395459d.mjs → pt-br-fdb63719.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +1 -1
- package/dist/unnnic.umd.js +33 -33
- package/package.json +1 -1
- package/src/components/FormElement/FormElement.vue +1 -1
- package/src/components/ModalDialog/ModalDialog.vue +1 -1
- package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +5 -4
- package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +5 -5
- package/src/components/MultiSelect/index.vue +43 -3
- package/src/components/Radio/Radio.vue +1 -1
- package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +4 -4
- package/src/components/Select/index.vue +11 -1
- package/src/components/Switch/Switch.vue +1 -1
- package/src/components/TemplatePreview/TemplatePreview.vue +2 -2
- package/src/components/TemplatePreview/TemplatePreviewModal.vue +1 -1
- package/src/components/ToolTip/ToolTip.vue +1 -1
- package/src/components/ui/popover/PopoverContent.vue +16 -13
- package/src/components/ui/popover/PopoverOption.vue +1 -1
- package/src/stories/MultiSelect.stories.js +4 -2
- package/src/stories/Popover.stories.js +5 -0
- package/src/stories/Select.stories.js +5 -2
package/package.json
CHANGED
|
@@ -282,19 +282,20 @@ describe('UnnnicMultiSelect.vue', () => {
|
|
|
282
282
|
|
|
283
283
|
describe('computed properties', () => {
|
|
284
284
|
test('calculatedMaxHeight returns correct value', () => {
|
|
285
|
-
const maxHeight = wrapper.vm.
|
|
285
|
+
const maxHeight = wrapper.vm.calculatedPopoverHeight;
|
|
286
|
+
console.log(maxHeight);
|
|
286
287
|
expect(maxHeight).toBe('228px');
|
|
287
288
|
});
|
|
288
289
|
|
|
289
290
|
test('calculatedMaxHeight includes search height when enabled', async () => {
|
|
290
291
|
await wrapper.setProps({ enableSearch: true });
|
|
291
|
-
const maxHeight = wrapper.vm.
|
|
292
|
+
const maxHeight = wrapper.vm.calculatedPopoverHeight;
|
|
292
293
|
expect(maxHeight).toBe('295px');
|
|
293
294
|
});
|
|
294
295
|
|
|
295
296
|
test('calculatedMaxHeight returns unset when no options', async () => {
|
|
296
297
|
await wrapper.setProps({ options: [] });
|
|
297
|
-
const maxHeight = wrapper.vm.
|
|
298
|
+
const maxHeight = wrapper.vm.calculatedPopoverHeight;
|
|
298
299
|
expect(maxHeight).toBe('unset');
|
|
299
300
|
});
|
|
300
301
|
|
|
@@ -458,7 +459,7 @@ describe('UnnnicMultiSelect.vue', () => {
|
|
|
458
459
|
test('handles empty options array', async () => {
|
|
459
460
|
await wrapper.setProps({ options: [] });
|
|
460
461
|
expect(wrapper.vm.filteredOptions).toEqual([]);
|
|
461
|
-
expect(wrapper.vm.
|
|
462
|
+
expect(wrapper.vm.calculatedPopoverHeight).toBe('unset');
|
|
462
463
|
});
|
|
463
464
|
|
|
464
465
|
test('handles empty modelValue array', async () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
3
|
exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with default props 1`] = `
|
|
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">
|
|
4
|
+
"<div data-v-03c7fb50="" class="unnnic-multi-select"><button data-v-9d52eef8="" data-v-03c7fb50="" class="unnnic-popover-trigger w-full" 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
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 use-focus-prop 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="">
|
|
@@ -19,7 +19,7 @@ exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with defaul
|
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
21
|
exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with disabled state 1`] = `
|
|
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">
|
|
22
|
+
"<div data-v-03c7fb50="" class="unnnic-multi-select"><button data-v-9d52eef8="" data-v-03c7fb50="" class="unnnic-popover-trigger w-full" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
23
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">
|
|
24
24
|
<!--v-if-->
|
|
25
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 use-focus-prop 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="">
|
|
@@ -37,7 +37,7 @@ exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with disabl
|
|
|
37
37
|
`;
|
|
38
38
|
|
|
39
39
|
exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with multiple selected values 1`] = `
|
|
40
|
-
"<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">
|
|
40
|
+
"<div data-v-03c7fb50="" class="unnnic-multi-select"><button data-v-9d52eef8="" data-v-03c7fb50="" class="unnnic-popover-trigger w-full" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
41
41
|
<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">
|
|
42
42
|
<!--v-if-->
|
|
43
43
|
<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 input--has-clear-icon use-focus-prop unnnic-multi-select__input unnnic-form-input input-itself" hascloudycolor="false" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" showclear="true" type="text" readonly="" value="Option 1, Option 2">
|
|
@@ -53,7 +53,7 @@ exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with multip
|
|
|
53
53
|
`;
|
|
54
54
|
|
|
55
55
|
exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with search enabled 1`] = `
|
|
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">
|
|
56
|
+
"<div data-v-03c7fb50="" class="unnnic-multi-select"><button data-v-9d52eef8="" data-v-03c7fb50="" class="unnnic-popover-trigger w-full" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
57
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">
|
|
58
58
|
<!--v-if-->
|
|
59
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 use-focus-prop 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="">
|
|
@@ -71,7 +71,7 @@ exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with search
|
|
|
71
71
|
`;
|
|
72
72
|
|
|
73
73
|
exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with selected values 1`] = `
|
|
74
|
-
"<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">
|
|
74
|
+
"<div data-v-03c7fb50="" class="unnnic-multi-select"><button data-v-9d52eef8="" data-v-03c7fb50="" class="unnnic-popover-trigger w-full" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
75
75
|
<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">
|
|
76
76
|
<!--v-if-->
|
|
77
77
|
<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 input--has-clear-icon use-focus-prop unnnic-multi-select__input unnnic-form-input input-itself" hascloudycolor="false" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" showclear="true" type="text" readonly="" value="Option 1">
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
:open="openPopover"
|
|
5
5
|
@update:open="openPopover = $event"
|
|
6
6
|
>
|
|
7
|
-
<PopoverTrigger>
|
|
7
|
+
<PopoverTrigger class="w-full">
|
|
8
8
|
<UnnnicInput
|
|
9
|
+
ref="multiSelectInputRef"
|
|
9
10
|
:modelValue="inputValue"
|
|
10
11
|
class="unnnic-multi-select__input"
|
|
11
12
|
readonly
|
|
@@ -24,7 +25,9 @@
|
|
|
24
25
|
</PopoverTrigger>
|
|
25
26
|
<PopoverContent
|
|
26
27
|
align="start"
|
|
27
|
-
|
|
28
|
+
class="h-full"
|
|
29
|
+
:style="popoverContentCustomStyles"
|
|
30
|
+
:width="inputWidthString"
|
|
28
31
|
>
|
|
29
32
|
<div class="unnnic-multi-select__content">
|
|
30
33
|
<UnnnicInput
|
|
@@ -35,6 +38,12 @@
|
|
|
35
38
|
iconLeft="search"
|
|
36
39
|
@update:model-value="handleSearch"
|
|
37
40
|
/>
|
|
41
|
+
<p
|
|
42
|
+
v-if="filteredOptions.length === 0"
|
|
43
|
+
class="unnnic-multi-select__content-no-results"
|
|
44
|
+
>
|
|
45
|
+
{{ $t('without_results') }}
|
|
46
|
+
</p>
|
|
38
47
|
<div class="unnnic-multi-select__options">
|
|
39
48
|
<UnnnicMultiSelectOption
|
|
40
49
|
v-for="(option, index) in filteredOptions"
|
|
@@ -59,6 +68,7 @@ import { computed, ref } from 'vue';
|
|
|
59
68
|
import { Popover, PopoverTrigger, PopoverContent } from '../ui/popover';
|
|
60
69
|
import UnnnicInput from '../Input/Input.vue';
|
|
61
70
|
import UnnnicMultiSelectOption from './MultSelectOption.vue';
|
|
71
|
+
import { useElementSize } from '@vueuse/core';
|
|
62
72
|
|
|
63
73
|
defineOptions({
|
|
64
74
|
name: 'UnnnicMultiSelect',
|
|
@@ -103,8 +113,26 @@ const props = withDefaults(defineProps<MultiSelectProps>(), {
|
|
|
103
113
|
});
|
|
104
114
|
|
|
105
115
|
const openPopover = ref(false);
|
|
116
|
+
const multiSelectInputRef = ref<HTMLInputElement | null>(null);
|
|
117
|
+
const { width: inputWidth } = useElementSize(multiSelectInputRef);
|
|
106
118
|
|
|
107
|
-
const
|
|
119
|
+
const inputWidthString = computed(() => {
|
|
120
|
+
return `${inputWidth.value}px`;
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const popoverContentCustomStyles = computed(() => {
|
|
124
|
+
const emptyFilteredOptions = filteredOptions.value?.length === 0;
|
|
125
|
+
return {
|
|
126
|
+
overflow: 'auto',
|
|
127
|
+
display: 'flex',
|
|
128
|
+
flexDirection: 'column',
|
|
129
|
+
minHeight: calculatedPopoverHeight.value,
|
|
130
|
+
maxHeight: emptyFilteredOptions ? 'unset' : calculatedPopoverHeight.value,
|
|
131
|
+
height: emptyFilteredOptions ? calculatedPopoverHeight.value : 'unset',
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const calculatedPopoverHeight = computed(() => {
|
|
108
136
|
if (!props.options || props.options.length === 0) return 'unset';
|
|
109
137
|
const popoverSearchGap = props.enableSearch ? 16 : 0;
|
|
110
138
|
const popoverGap = 24;
|
|
@@ -212,6 +240,18 @@ const handleSelectOption = (
|
|
|
212
240
|
padding: 0;
|
|
213
241
|
margin: 0;
|
|
214
242
|
gap: $unnnic-space-4;
|
|
243
|
+
|
|
244
|
+
height: -webkit-fill-available;
|
|
245
|
+
|
|
246
|
+
&-no-results {
|
|
247
|
+
margin: 0;
|
|
248
|
+
display: flex;
|
|
249
|
+
align-items: center;
|
|
250
|
+
justify-content: center;
|
|
251
|
+
height: 100%;
|
|
252
|
+
font: $unnnic-font-emphasis;
|
|
253
|
+
color: $unnnic-color-fg-muted;
|
|
254
|
+
}
|
|
215
255
|
}
|
|
216
256
|
|
|
217
257
|
&__options {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
3
|
exports[`UnnnicSelect.vue > snapshot testing > matches snapshot with default props 1`] = `
|
|
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">
|
|
4
|
+
"<div data-v-6077efb7="" class="unnnic-select"><button data-v-9d52eef8="" data-v-6077efb7="" class="unnnic-popover-trigger w-full" 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
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 use-focus-prop 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="">
|
|
@@ -19,7 +19,7 @@ exports[`UnnnicSelect.vue > snapshot testing > matches snapshot with default pro
|
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
21
|
exports[`UnnnicSelect.vue > snapshot testing > matches snapshot with disabled state 1`] = `
|
|
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">
|
|
22
|
+
"<div data-v-6077efb7="" class="unnnic-select"><button data-v-9d52eef8="" data-v-6077efb7="" class="unnnic-popover-trigger w-full" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
23
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">
|
|
24
24
|
<!--v-if-->
|
|
25
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 use-focus-prop 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="">
|
|
@@ -37,7 +37,7 @@ exports[`UnnnicSelect.vue > snapshot testing > matches snapshot with disabled st
|
|
|
37
37
|
`;
|
|
38
38
|
|
|
39
39
|
exports[`UnnnicSelect.vue > snapshot testing > matches snapshot with search enabled 1`] = `
|
|
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">
|
|
40
|
+
"<div data-v-6077efb7="" class="unnnic-select"><button data-v-9d52eef8="" data-v-6077efb7="" class="unnnic-popover-trigger w-full" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
41
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">
|
|
42
42
|
<!--v-if-->
|
|
43
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 use-focus-prop 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="">
|
|
@@ -55,7 +55,7 @@ exports[`UnnnicSelect.vue > snapshot testing > matches snapshot with search enab
|
|
|
55
55
|
`;
|
|
56
56
|
|
|
57
57
|
exports[`UnnnicSelect.vue > snapshot testing > matches snapshot with selected value 1`] = `
|
|
58
|
-
"<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">
|
|
58
|
+
"<div data-v-6077efb7="" class="unnnic-select"><button data-v-9d52eef8="" data-v-6077efb7="" class="unnnic-popover-trigger w-full" id="reka-popover-trigger-v-0" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="" data-state="closed">
|
|
59
59
|
<section data-v-9f8d6c86="" data-v-d890ad85="" data-v-6077efb7="" class="unnnic-form-element unnnic-form md unnnic-select__input" data-testid="form-element">
|
|
60
60
|
<!--v-if-->
|
|
61
61
|
<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 input--has-clear-icon use-focus-prop unnnic-select__input unnnic-form-input input-itself" hascloudycolor="false" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" showclear="true" type="text" readonly="" value="Option 1">
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
:open="openPopover"
|
|
8
8
|
@update:open="openPopover = $event"
|
|
9
9
|
>
|
|
10
|
-
<PopoverTrigger>
|
|
10
|
+
<PopoverTrigger class="w-full">
|
|
11
11
|
<UnnnicInput
|
|
12
|
+
ref="selectInputRef"
|
|
12
13
|
:modelValue="inputValue"
|
|
13
14
|
class="unnnic-select__input"
|
|
14
15
|
readonly
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
align="start"
|
|
30
31
|
:class="'h-full'"
|
|
31
32
|
:style="popoverContentCustomStyles"
|
|
33
|
+
:width="inputWidthString"
|
|
32
34
|
>
|
|
33
35
|
<div class="unnnic-select__content">
|
|
34
36
|
<UnnnicInput
|
|
@@ -67,6 +69,8 @@
|
|
|
67
69
|
|
|
68
70
|
<script setup lang="ts">
|
|
69
71
|
import { computed, ref, watch, nextTick } from 'vue';
|
|
72
|
+
import { useElementSize } from '@vueuse/core';
|
|
73
|
+
|
|
70
74
|
import UnnnicInput from '../Input/Input.vue';
|
|
71
75
|
|
|
72
76
|
import {
|
|
@@ -128,6 +132,12 @@ const emit = defineEmits<{
|
|
|
128
132
|
}>();
|
|
129
133
|
|
|
130
134
|
const openPopover = ref(false);
|
|
135
|
+
const selectInputRef = ref<HTMLInputElement | null>(null);
|
|
136
|
+
const { width: inputWidth } = useElementSize(selectInputRef);
|
|
137
|
+
|
|
138
|
+
const inputWidthString = computed(() => {
|
|
139
|
+
return `${inputWidth.value}px`;
|
|
140
|
+
});
|
|
131
141
|
|
|
132
142
|
watch(openPopover, () => {
|
|
133
143
|
if (!openPopover.value) {
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
}`"
|
|
14
14
|
>
|
|
15
15
|
<img
|
|
16
|
-
class="unnnic-template-preview__header__media__preview"
|
|
17
16
|
v-if="
|
|
18
17
|
template?.header.type === 'MEDIA' &&
|
|
19
18
|
template?.header.mediaType === 'IMAGE'
|
|
20
19
|
"
|
|
20
|
+
class="unnnic-template-preview__header__media__preview"
|
|
21
21
|
:src="template.header.src || imagePreview"
|
|
22
22
|
/>
|
|
23
23
|
<template
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
/>
|
|
51
51
|
</template>
|
|
52
52
|
<h1
|
|
53
|
-
class="unnnic-template-preview__header__text__preview"
|
|
54
53
|
v-else-if="template?.header.type === 'TEXT'"
|
|
54
|
+
class="unnnic-template-preview__header__text__preview"
|
|
55
55
|
>
|
|
56
56
|
{{ template.header.text }}
|
|
57
57
|
</h1>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<UnnnicModalDialog
|
|
3
3
|
:modelValue="modelValue"
|
|
4
|
-
@update:modelValue="$event === false && $emit('close')"
|
|
5
4
|
:title="defaultTranslations.title[props.locale]"
|
|
6
5
|
:showCloseIcon="true"
|
|
7
6
|
class="unnnic-template-preview-modal"
|
|
7
|
+
@update:model-value="$event === false && $emit('close')"
|
|
8
8
|
>
|
|
9
9
|
<UnnnicTemplatePreview :template="template" />
|
|
10
10
|
</UnnnicModalDialog>
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
<PopoverPortal>
|
|
3
3
|
<PopoverContent
|
|
4
4
|
v-bind="{ ...forwarded, ...$attrs }"
|
|
5
|
+
:style="{ width: contentWidth, zIndex: popoverZIndex }"
|
|
5
6
|
:class="
|
|
6
7
|
cn(
|
|
7
8
|
'unnnic-popover',
|
|
8
|
-
`unnnic-popover--size-${props.size}`,
|
|
9
9
|
'bg-popover text-popover-foreground outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
10
10
|
)
|
|
11
11
|
"
|
|
12
|
-
:style="{ zIndex: popoverZIndex }"
|
|
13
12
|
>
|
|
14
13
|
<section :class="`unnnic-popover__content ${props.class || ''}`">
|
|
15
14
|
<component
|
|
@@ -45,7 +44,8 @@ const props = withDefaults(
|
|
|
45
44
|
defineProps<
|
|
46
45
|
PopoverContentProps & {
|
|
47
46
|
class?: HTMLAttributes['class'];
|
|
48
|
-
size?:
|
|
47
|
+
size?: string;
|
|
48
|
+
width?: string;
|
|
49
49
|
}
|
|
50
50
|
>(),
|
|
51
51
|
{
|
|
@@ -53,6 +53,7 @@ const props = withDefaults(
|
|
|
53
53
|
sideOffset: 4,
|
|
54
54
|
size: 'medium',
|
|
55
55
|
class: '',
|
|
56
|
+
width: '',
|
|
56
57
|
},
|
|
57
58
|
);
|
|
58
59
|
const emits = defineEmits<PopoverContentEmits>();
|
|
@@ -83,6 +84,18 @@ const footerChildren = computed(() => {
|
|
|
83
84
|
(vnode: VNode) => getComponentName(vnode) === 'UnnnicPopoverFooter',
|
|
84
85
|
);
|
|
85
86
|
});
|
|
87
|
+
|
|
88
|
+
const contentWidth = computed(() => {
|
|
89
|
+
if (props.width) return props.width;
|
|
90
|
+
|
|
91
|
+
const sizes = {
|
|
92
|
+
small: '240px',
|
|
93
|
+
medium: '320px',
|
|
94
|
+
large: '400px',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return sizes[props.size as keyof typeof sizes];
|
|
98
|
+
});
|
|
86
99
|
</script>
|
|
87
100
|
|
|
88
101
|
<style lang="scss">
|
|
@@ -109,16 +122,6 @@ $popover-space: $unnnic-space-4;
|
|
|
109
122
|
border-radius: $unnnic-border-radius-pill;
|
|
110
123
|
}
|
|
111
124
|
|
|
112
|
-
&--size-small {
|
|
113
|
-
width: 240px;
|
|
114
|
-
}
|
|
115
|
-
&--size-medium {
|
|
116
|
-
width: 320px;
|
|
117
|
-
}
|
|
118
|
-
&--size-large {
|
|
119
|
-
width: 400px;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
125
|
&__content {
|
|
123
126
|
padding: $popover-space;
|
|
124
127
|
}
|
|
@@ -76,7 +76,7 @@ const schemeColor = computed(() => {
|
|
|
76
76
|
.unnnic-popover-option {
|
|
77
77
|
cursor: pointer;
|
|
78
78
|
border-radius: $unnnic-radius-2;
|
|
79
|
-
padding: $unnnic-space-2;
|
|
79
|
+
padding: $unnnic-space-2 $unnnic-space-4;
|
|
80
80
|
font: $unnnic-font-emphasis;
|
|
81
81
|
display: flex;
|
|
82
82
|
gap: $unnnic-space-2;
|
|
@@ -97,8 +97,10 @@ export default {
|
|
|
97
97
|
};
|
|
98
98
|
},
|
|
99
99
|
template: `
|
|
100
|
-
<
|
|
101
|
-
|
|
100
|
+
<div style="width: 300px;">
|
|
101
|
+
<p>modelValue: {{ exampleValue }}</p>
|
|
102
|
+
<unnnic-multi-select v-model="exampleValue" v-bind="args" @update:search="handleSearch" />
|
|
103
|
+
</div>
|
|
102
104
|
`,
|
|
103
105
|
}),
|
|
104
106
|
};
|
|
@@ -26,6 +26,11 @@ export default {
|
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
argTypes: {
|
|
29
|
+
width: {
|
|
30
|
+
control: { type: 'text' },
|
|
31
|
+
description:
|
|
32
|
+
'The width of the popover. This overrides the size prop. If not provided, the size prop will be used.',
|
|
33
|
+
},
|
|
29
34
|
size: {
|
|
30
35
|
control: { type: 'select' },
|
|
31
36
|
options: ['small', 'medium', 'large'],
|
|
@@ -97,8 +97,11 @@ export default {
|
|
|
97
97
|
};
|
|
98
98
|
},
|
|
99
99
|
template: `
|
|
100
|
-
<
|
|
101
|
-
|
|
100
|
+
<div style="width: 300px;">
|
|
101
|
+
<p>modelValue: {{ exampleValue }}</p>
|
|
102
|
+
<unnnic-select v-model="exampleValue" v-bind="args" @update:search="handleSearch" />
|
|
103
|
+
</div>
|
|
104
|
+
|
|
102
105
|
`,
|
|
103
106
|
}),
|
|
104
107
|
};
|