@weni/unnnic-system 3.12.3-alpha.0 → 3.12.3-alpha.1
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/MultSelectOption.vue.d.ts +17 -0
- package/dist/components/MultiSelect/MultSelectOption.vue.d.ts.map +1 -0
- package/dist/components/MultiSelect/index.vue.d.ts +44 -0
- package/dist/components/MultiSelect/index.vue.d.ts.map +1 -0
- package/dist/components/index.d.ts +23720 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/{es-59933601.mjs → es-239c29c2.mjs} +1 -1
- package/dist/{index-4fe9253b.mjs → index-40e176e4.mjs} +5124 -5130
- package/dist/{pt-br-10db3200.mjs → pt-br-5004a35e.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +1 -1
- package/dist/unnnic.umd.js +30 -30
- package/package.json +1 -1
- package/src/components/{MultiSelectV2 → MultiSelect}/MultSelectOption.vue +0 -18
- package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +81 -0
- package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +51 -0
- package/src/components/index.ts +3 -3
- package/src/stories/MultiSelect.stories.js +142 -46
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts +0 -163
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts.map +0 -1
- package/src/components/MultiSelect/MultiSelect.vue +0 -297
- package/src/components/MultiSelectV2/__tests__/__snapshots__/MultiSelect.spec.js.snap +0 -121
- package/src/components/MultiSelectV2/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +0 -51
- package/src/stories/MultiSelectV2.stories.js +0 -158
- /package/src/components/{MultiSelectV2 → MultiSelect}/__tests__/MultiSelect.spec.js +0 -0
- /package/src/components/{MultiSelectV2 → MultiSelect}/__tests__/MultiSelectOption.spec.js +0 -0
- /package/src/components/{MultiSelectV2 → MultiSelect}/index.vue +0 -0
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
:class="expand ? 'expand-multiselect' : 'normal-multiselect'"
|
|
4
|
-
tabindex="-1"
|
|
5
|
-
>
|
|
6
|
-
<span
|
|
7
|
-
v-if="label"
|
|
8
|
-
class="select-permission-label"
|
|
9
|
-
>{{ label }}</span
|
|
10
|
-
>
|
|
11
|
-
<div
|
|
12
|
-
class="select-permission"
|
|
13
|
-
tabindex="0"
|
|
14
|
-
@keypress="handleIsOpenKeyboard"
|
|
15
|
-
@click="active = !active"
|
|
16
|
-
>
|
|
17
|
-
<h6 class="title noselect">{{ inputTitle }}</h6>
|
|
18
|
-
<UnnnicIcon
|
|
19
|
-
:icon="active ? 'arrow-button-up-1' : 'arrow-button-down-1'"
|
|
20
|
-
size="sm"
|
|
21
|
-
scheme="neutral-dark"
|
|
22
|
-
/>
|
|
23
|
-
</div>
|
|
24
|
-
<div
|
|
25
|
-
v-if="active"
|
|
26
|
-
v-on-click-outside="onClickOutside"
|
|
27
|
-
class="select-content"
|
|
28
|
-
tabindex="0"
|
|
29
|
-
>
|
|
30
|
-
<div>
|
|
31
|
-
<template
|
|
32
|
-
v-for="(group, indexGroup) in modelValue"
|
|
33
|
-
:key="`group-${indexGroup}`"
|
|
34
|
-
>
|
|
35
|
-
<h6
|
|
36
|
-
v-if="!hideGroupTitle"
|
|
37
|
-
:key="`title-${indexGroup}`"
|
|
38
|
-
class="title"
|
|
39
|
-
>
|
|
40
|
-
{{ group.title }}
|
|
41
|
-
</h6>
|
|
42
|
-
<section>
|
|
43
|
-
<template
|
|
44
|
-
v-for="(item, indexItem) in group.items"
|
|
45
|
-
:key="`item-${indexItem}`"
|
|
46
|
-
>
|
|
47
|
-
<div
|
|
48
|
-
v-if="hideRadio"
|
|
49
|
-
:key="indexItem + 'input'"
|
|
50
|
-
class="unnnic-radio-container unnnic-radio-container--sm"
|
|
51
|
-
style="cursor: pointer"
|
|
52
|
-
@click="change(indexGroup, indexItem)"
|
|
53
|
-
>
|
|
54
|
-
<strong>{{ item.title }}</strong>
|
|
55
|
-
<span>{{ item.description }}</span>
|
|
56
|
-
</div>
|
|
57
|
-
<UnnnicRadio
|
|
58
|
-
v-else
|
|
59
|
-
id=""
|
|
60
|
-
:key="'else' + indexItem + 'input'"
|
|
61
|
-
name=""
|
|
62
|
-
:modelValue="group.selected"
|
|
63
|
-
:value="indexItem"
|
|
64
|
-
size="sm"
|
|
65
|
-
class=""
|
|
66
|
-
@update:model-value="change(indexGroup, $event)"
|
|
67
|
-
>
|
|
68
|
-
<strong>{{ item.title }}</strong>
|
|
69
|
-
<span>{{ item.description }}</span>
|
|
70
|
-
</UnnnicRadio>
|
|
71
|
-
</template>
|
|
72
|
-
</section>
|
|
73
|
-
</template>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</template>
|
|
78
|
-
|
|
79
|
-
<script>
|
|
80
|
-
import { vOnClickOutside } from '@vueuse/components';
|
|
81
|
-
import UnnnicIcon from '../Icon.vue';
|
|
82
|
-
import UnnnicRadio from '../Radio/Radio.vue';
|
|
83
|
-
|
|
84
|
-
export default {
|
|
85
|
-
name: 'UnnnicMultiSelect',
|
|
86
|
-
components: {
|
|
87
|
-
UnnnicIcon,
|
|
88
|
-
UnnnicRadio,
|
|
89
|
-
},
|
|
90
|
-
directives: {
|
|
91
|
-
onClickOutside: vOnClickOutside,
|
|
92
|
-
},
|
|
93
|
-
props: {
|
|
94
|
-
isOpen: {
|
|
95
|
-
default: false,
|
|
96
|
-
},
|
|
97
|
-
expand: {
|
|
98
|
-
default: false,
|
|
99
|
-
},
|
|
100
|
-
label: {
|
|
101
|
-
type: String,
|
|
102
|
-
default: '',
|
|
103
|
-
},
|
|
104
|
-
modelValue: {
|
|
105
|
-
type: Array,
|
|
106
|
-
default: () => [],
|
|
107
|
-
},
|
|
108
|
-
inputTitle: {
|
|
109
|
-
type: String,
|
|
110
|
-
default: 'Teste',
|
|
111
|
-
},
|
|
112
|
-
hideRadio: {
|
|
113
|
-
type: Boolean,
|
|
114
|
-
default: false,
|
|
115
|
-
},
|
|
116
|
-
hideGroupTitle: {
|
|
117
|
-
type: Boolean,
|
|
118
|
-
default: false,
|
|
119
|
-
},
|
|
120
|
-
unselectable: {
|
|
121
|
-
type: Boolean,
|
|
122
|
-
default: false,
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
data() {
|
|
127
|
-
return {
|
|
128
|
-
active: false,
|
|
129
|
-
};
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
watch: {
|
|
133
|
-
isOpen() {
|
|
134
|
-
this.active = this.open;
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
methods: {
|
|
138
|
-
handleIsOpenKeyboard(event) {
|
|
139
|
-
if (
|
|
140
|
-
document.querySelector('.select-permission:focus-visible') &&
|
|
141
|
-
event.keyCode === 32
|
|
142
|
-
) {
|
|
143
|
-
this.active = !this.active;
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
onClickOutside() {
|
|
148
|
-
if (!this.active) return;
|
|
149
|
-
this.active = false;
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
change(indexGroup, indexSelected) {
|
|
153
|
-
this.$emit(
|
|
154
|
-
'update:model-value',
|
|
155
|
-
this.modelValue.map((item, index) => {
|
|
156
|
-
if (index === indexGroup) {
|
|
157
|
-
let selected = indexSelected;
|
|
158
|
-
if (this.unselectable && item.selected === indexSelected) {
|
|
159
|
-
selected = -1;
|
|
160
|
-
}
|
|
161
|
-
return { ...item, selected };
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
return item;
|
|
165
|
-
}),
|
|
166
|
-
);
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
};
|
|
170
|
-
</script>
|
|
171
|
-
|
|
172
|
-
<style lang="scss" scoped>
|
|
173
|
-
@use '@/assets/scss/unnnic' as *;
|
|
174
|
-
|
|
175
|
-
.normal-multiselect,
|
|
176
|
-
.expand-multiselect {
|
|
177
|
-
user-select: none;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.normal-multiselect {
|
|
181
|
-
position: relative;
|
|
182
|
-
max-width: 319px;
|
|
183
|
-
|
|
184
|
-
.select-content {
|
|
185
|
-
max-width: 319px;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.expand-multiselect {
|
|
190
|
-
position: relative;
|
|
191
|
-
width: 100%;
|
|
192
|
-
|
|
193
|
-
.select-content {
|
|
194
|
-
width: 100%;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.noselect {
|
|
199
|
-
-webkit-touch-callout: none; /* iOS Safari */
|
|
200
|
-
-webkit-user-select: none; /* Safari */
|
|
201
|
-
-khtml-user-select: none; /* Konqueror HTML */
|
|
202
|
-
-moz-user-select: none; /* Old versions of Firefox */
|
|
203
|
-
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
204
|
-
user-select: none; /* Non-prefixed version, currently
|
|
205
|
-
supported by Chrome, Edge, Opera and Firefox */
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.select-permission,
|
|
209
|
-
.select-content > div {
|
|
210
|
-
padding: $unnnic-squish-xs;
|
|
211
|
-
background-color: $unnnic-color-neutral-snow;
|
|
212
|
-
|
|
213
|
-
border-radius: $unnnic-border-radius-sm;
|
|
214
|
-
border: $unnnic-border-width-thinner solid $unnnic-color-neutral-soft;
|
|
215
|
-
}
|
|
216
|
-
.select-permission {
|
|
217
|
-
display: flex;
|
|
218
|
-
flex-direction: row;
|
|
219
|
-
justify-content: space-between;
|
|
220
|
-
align-items: center;
|
|
221
|
-
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
222
|
-
|
|
223
|
-
cursor: pointer;
|
|
224
|
-
.icon {
|
|
225
|
-
margin-left: $unnnic-spacing-inline-xs;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
.select-permission-label {
|
|
229
|
-
display: block;
|
|
230
|
-
|
|
231
|
-
color: $unnnic-color-neutral-cloudy;
|
|
232
|
-
margin-bottom: $unnnic-spacing-stack-xs;
|
|
233
|
-
|
|
234
|
-
font-family: $unnnic-font-family-secondary;
|
|
235
|
-
font-size: $unnnic-font-size-body-gt;
|
|
236
|
-
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.title {
|
|
240
|
-
font-family: $unnnic-font-family-secondary;
|
|
241
|
-
font-size: $unnnic-font-size-body-gt;
|
|
242
|
-
margin: 0;
|
|
243
|
-
font-weight: $unnnic-font-weight-regular;
|
|
244
|
-
color: $unnnic-color-neutral-dark;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.select-content {
|
|
248
|
-
position: absolute;
|
|
249
|
-
margin-top: $unnnic-spacing-stack-xs;
|
|
250
|
-
|
|
251
|
-
> div {
|
|
252
|
-
box-shadow: $unnnic-shadow-level-near;
|
|
253
|
-
.title {
|
|
254
|
-
margin-bottom: $unnnic-spacing-stack-sm;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
& section {
|
|
258
|
-
display: flex;
|
|
259
|
-
flex-direction: column;
|
|
260
|
-
|
|
261
|
-
& + h6 {
|
|
262
|
-
margin-top: $unnnic-spacing-stack-sm;
|
|
263
|
-
padding-top: $unnnic-spacing-stack-sm;
|
|
264
|
-
border-top: $unnnic-border-width-thinner solid
|
|
265
|
-
$unnnic-color-neutral-darkest;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
strong,
|
|
269
|
-
span {
|
|
270
|
-
display: block;
|
|
271
|
-
font-family: $unnnic-font-family-secondary;
|
|
272
|
-
font-size: $unnnic-font-size-body-gt;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
strong {
|
|
276
|
-
font-weight: $unnnic-font-weight-regular;
|
|
277
|
-
}
|
|
278
|
-
span {
|
|
279
|
-
font-weight: $unnnic-font-weight-light;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
.unnnic-radio-container {
|
|
283
|
-
& + .unnnic-radio-container {
|
|
284
|
-
margin-top: $unnnic-spacing-stack-sm;
|
|
285
|
-
padding-top: $unnnic-spacing-stack-sm;
|
|
286
|
-
border-top: $unnnic-border-width-thinner solid
|
|
287
|
-
$unnnic-color-neutral-lightest;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
:deep(.unnnic-icon) {
|
|
291
|
-
margin-right: $unnnic-inline-xs;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
</style>
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with default props 1`] = `
|
|
4
|
-
"<div data-v-de5c711a="" class="unnnic-multi-select">
|
|
5
|
-
<section data-v-5a3125ac="" data-v-de5c711a="" class="unnnic-popover">
|
|
6
|
-
<div data-v-5a3125ac="" class="unnnic-popover__trigger" data-testid="popover-trigger">
|
|
7
|
-
<div data-v-d890ad85="" data-v-de5c711a="" class="unnnic-form md unnnic-multi-select__input">
|
|
8
|
-
<!--v-if-->
|
|
9
|
-
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-multi-select__input unnnic-form-input" 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 unnnic-multi-select__input unnnic-form-input input-itself" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" hascloudycolor="false" showclear="true" type="text" readonly="" value="">
|
|
10
|
-
<!--v-if-->
|
|
11
|
-
<section data-v-a0d36167="" class="icon-right-container"><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic--clickable icon-clear" data-testid="material-icon" translate="no">close</span><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant icon-right" data-testid="material-icon" translate="no">keyboard_arrow_down</span></section>
|
|
12
|
-
</div>
|
|
13
|
-
<section data-v-d890ad85="" class="unnnic-form__hints-container">
|
|
14
|
-
<section data-v-d890ad85="" class="unnnic-form__message-container">
|
|
15
|
-
<!--v-if-->
|
|
16
|
-
<!--v-if-->
|
|
17
|
-
</section>
|
|
18
|
-
<!--v-if-->
|
|
19
|
-
</section>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
<!--v-if-->
|
|
23
|
-
</section>
|
|
24
|
-
</div>"
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with disabled state 1`] = `
|
|
28
|
-
"<div data-v-de5c711a="" class="unnnic-multi-select">
|
|
29
|
-
<section data-v-5a3125ac="" data-v-de5c711a="" class="unnnic-popover">
|
|
30
|
-
<div data-v-5a3125ac="" class="unnnic-popover__trigger" data-testid="popover-trigger">
|
|
31
|
-
<div data-v-d890ad85="" data-v-de5c711a="" class="unnnic-form md unnnic-multi-select__input">
|
|
32
|
-
<!--v-if-->
|
|
33
|
-
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-multi-select__input unnnic-form-input" 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 unnnic-multi-select__input unnnic-form-input input-itself" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" hascloudycolor="false" showclear="true" type="text" readonly="" value="" disabled="">
|
|
34
|
-
<!--v-if-->
|
|
35
|
-
<section data-v-a0d36167="" class="icon-right-container"><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-muted unnnic-icon-size--ant unnnic--clickable icon-clear" data-testid="material-icon" translate="no">close</span><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-muted unnnic-icon-size--ant icon-right" data-testid="material-icon" translate="no">keyboard_arrow_down</span></section>
|
|
36
|
-
</div>
|
|
37
|
-
<section data-v-d890ad85="" class="unnnic-form__hints-container">
|
|
38
|
-
<section data-v-d890ad85="" class="unnnic-form__message-container">
|
|
39
|
-
<!--v-if-->
|
|
40
|
-
<!--v-if-->
|
|
41
|
-
</section>
|
|
42
|
-
<!--v-if-->
|
|
43
|
-
</section>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
<!--v-if-->
|
|
47
|
-
</section>
|
|
48
|
-
</div>"
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with multiple selected values 1`] = `
|
|
52
|
-
"<div data-v-de5c711a="" class="unnnic-multi-select">
|
|
53
|
-
<section data-v-5a3125ac="" data-v-de5c711a="" class="unnnic-popover">
|
|
54
|
-
<div data-v-5a3125ac="" class="unnnic-popover__trigger" data-testid="popover-trigger">
|
|
55
|
-
<div data-v-d890ad85="" data-v-de5c711a="" class="unnnic-form md unnnic-multi-select__input">
|
|
56
|
-
<!--v-if-->
|
|
57
|
-
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-multi-select__input unnnic-form-input" 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 unnnic-multi-select__input unnnic-form-input input-itself" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" hascloudycolor="false" showclear="true" type="text" readonly="" value="Option 1, Option 2">
|
|
58
|
-
<!--v-if-->
|
|
59
|
-
<section data-v-a0d36167="" class="icon-right-container"><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--color-gray-700 unnnic-icon-size--ant unnnic--clickable icon-clear" data-testid="material-icon" translate="no">close</span><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--color-gray-700 unnnic-icon-size--ant icon-right" data-testid="material-icon" translate="no">keyboard_arrow_down</span></section>
|
|
60
|
-
</div>
|
|
61
|
-
<section data-v-d890ad85="" class="unnnic-form__hints-container">
|
|
62
|
-
<section data-v-d890ad85="" class="unnnic-form__message-container">
|
|
63
|
-
<!--v-if-->
|
|
64
|
-
<!--v-if-->
|
|
65
|
-
</section>
|
|
66
|
-
<!--v-if-->
|
|
67
|
-
</section>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
<!--v-if-->
|
|
71
|
-
</section>
|
|
72
|
-
</div>"
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with search enabled 1`] = `
|
|
76
|
-
"<div data-v-de5c711a="" class="unnnic-multi-select">
|
|
77
|
-
<section data-v-5a3125ac="" data-v-de5c711a="" class="unnnic-popover">
|
|
78
|
-
<div data-v-5a3125ac="" class="unnnic-popover__trigger" data-testid="popover-trigger">
|
|
79
|
-
<div data-v-d890ad85="" data-v-de5c711a="" class="unnnic-form md unnnic-multi-select__input">
|
|
80
|
-
<!--v-if-->
|
|
81
|
-
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-multi-select__input unnnic-form-input" 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 unnnic-multi-select__input unnnic-form-input input-itself" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" hascloudycolor="false" showclear="true" type="text" readonly="" value="">
|
|
82
|
-
<!--v-if-->
|
|
83
|
-
<section data-v-a0d36167="" class="icon-right-container"><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic--clickable icon-clear" data-testid="material-icon" translate="no">close</span><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant icon-right" data-testid="material-icon" translate="no">keyboard_arrow_down</span></section>
|
|
84
|
-
</div>
|
|
85
|
-
<section data-v-d890ad85="" class="unnnic-form__hints-container">
|
|
86
|
-
<section data-v-d890ad85="" class="unnnic-form__message-container">
|
|
87
|
-
<!--v-if-->
|
|
88
|
-
<!--v-if-->
|
|
89
|
-
</section>
|
|
90
|
-
<!--v-if-->
|
|
91
|
-
</section>
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
<!--v-if-->
|
|
95
|
-
</section>
|
|
96
|
-
</div>"
|
|
97
|
-
`;
|
|
98
|
-
|
|
99
|
-
exports[`UnnnicMultiSelect.vue > snapshot testing > matches snapshot with selected values 1`] = `
|
|
100
|
-
"<div data-v-de5c711a="" class="unnnic-multi-select">
|
|
101
|
-
<section data-v-5a3125ac="" data-v-de5c711a="" class="unnnic-popover">
|
|
102
|
-
<div data-v-5a3125ac="" class="unnnic-popover__trigger" data-testid="popover-trigger">
|
|
103
|
-
<div data-v-d890ad85="" data-v-de5c711a="" class="unnnic-form md unnnic-multi-select__input">
|
|
104
|
-
<!--v-if-->
|
|
105
|
-
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-multi-select__input unnnic-form-input" 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 unnnic-multi-select__input unnnic-form-input input-itself" placeholder="" iconleft="" iconright="keyboard_arrow_down" iconleftclickable="false" iconrightclickable="false" hascloudycolor="false" showclear="true" type="text" readonly="" value="Option 1">
|
|
106
|
-
<!--v-if-->
|
|
107
|
-
<section data-v-a0d36167="" class="icon-right-container"><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--color-gray-700 unnnic-icon-size--ant unnnic--clickable icon-clear" data-testid="material-icon" translate="no">close</span><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--color-gray-700 unnnic-icon-size--ant icon-right" data-testid="material-icon" translate="no">keyboard_arrow_down</span></section>
|
|
108
|
-
</div>
|
|
109
|
-
<section data-v-d890ad85="" class="unnnic-form__hints-container">
|
|
110
|
-
<section data-v-d890ad85="" class="unnnic-form__message-container">
|
|
111
|
-
<!--v-if-->
|
|
112
|
-
<!--v-if-->
|
|
113
|
-
</section>
|
|
114
|
-
<!--v-if-->
|
|
115
|
-
</section>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
118
|
-
<!--v-if-->
|
|
119
|
-
</section>
|
|
120
|
-
</div>"
|
|
121
|
-
`;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`MultiSelectOption.vue > snapshot testing > matches snapshot with active state 1`] = `
|
|
4
|
-
"<div data-v-72fb6e0d="" class="unnnic-multi-select-option">
|
|
5
|
-
<section data-v-18939422="" data-v-72fb6e0d="" class="unnnic-checkbox-wrapper"><label data-v-18939422=""><input data-v-18939422="" class="unnnic-checkbox" type="checkbox" checked="">
|
|
6
|
-
<p data-v-18939422="" class="unnnic-checkbox__label" data-testid="checkbox-text-right">Test Option</p>
|
|
7
|
-
</label>
|
|
8
|
-
<!--v-if-->
|
|
9
|
-
</section>
|
|
10
|
-
</div>"
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
exports[`MultiSelectOption.vue > snapshot testing > matches snapshot with both active and disabled states 1`] = `
|
|
14
|
-
"<div data-v-72fb6e0d="" class="unnnic-multi-select-option">
|
|
15
|
-
<section data-v-18939422="" data-v-72fb6e0d="" class="unnnic-checkbox-wrapper"><label data-v-18939422=""><input data-v-18939422="" class="unnnic-checkbox" type="checkbox" disabled="" checked="">
|
|
16
|
-
<p data-v-18939422="" class="unnnic-checkbox__label unnnic-checkbox__label--disabled" data-testid="checkbox-text-right">Test Option</p>
|
|
17
|
-
</label>
|
|
18
|
-
<!--v-if-->
|
|
19
|
-
</section>
|
|
20
|
-
</div>"
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
exports[`MultiSelectOption.vue > snapshot testing > matches snapshot with default props 1`] = `
|
|
24
|
-
"<div data-v-72fb6e0d="" class="unnnic-multi-select-option">
|
|
25
|
-
<section data-v-18939422="" data-v-72fb6e0d="" class="unnnic-checkbox-wrapper"><label data-v-18939422=""><input data-v-18939422="" class="unnnic-checkbox" type="checkbox">
|
|
26
|
-
<p data-v-18939422="" class="unnnic-checkbox__label" data-testid="checkbox-text-right">Test Option</p>
|
|
27
|
-
</label>
|
|
28
|
-
<!--v-if-->
|
|
29
|
-
</section>
|
|
30
|
-
</div>"
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
exports[`MultiSelectOption.vue > snapshot testing > matches snapshot with disabled state 1`] = `
|
|
34
|
-
"<div data-v-72fb6e0d="" class="unnnic-multi-select-option">
|
|
35
|
-
<section data-v-18939422="" data-v-72fb6e0d="" class="unnnic-checkbox-wrapper"><label data-v-18939422=""><input data-v-18939422="" class="unnnic-checkbox" type="checkbox" disabled="">
|
|
36
|
-
<p data-v-18939422="" class="unnnic-checkbox__label unnnic-checkbox__label--disabled" data-testid="checkbox-text-right">Test Option</p>
|
|
37
|
-
</label>
|
|
38
|
-
<!--v-if-->
|
|
39
|
-
</section>
|
|
40
|
-
</div>"
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
exports[`MultiSelectOption.vue > snapshot testing > matches snapshot with focused state 1`] = `
|
|
44
|
-
"<div data-v-72fb6e0d="" class="unnnic-multi-select-option">
|
|
45
|
-
<section data-v-18939422="" data-v-72fb6e0d="" class="unnnic-checkbox-wrapper"><label data-v-18939422=""><input data-v-18939422="" class="unnnic-checkbox" type="checkbox">
|
|
46
|
-
<p data-v-18939422="" class="unnnic-checkbox__label" data-testid="checkbox-text-right">Test Option</p>
|
|
47
|
-
</label>
|
|
48
|
-
<!--v-if-->
|
|
49
|
-
</section>
|
|
50
|
-
</div>"
|
|
51
|
-
`;
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import UnnnicMultiSelect from '../components/MultiSelectV2/index.vue';
|
|
2
|
-
|
|
3
|
-
const options = [
|
|
4
|
-
{ label: 'Option 1', value: 'option1', altValue: 'alt_value_option1' },
|
|
5
|
-
{ label: 'Option 2', value: 'option2', altValue: 'alt_value_option2' },
|
|
6
|
-
{ label: 'Option 3', value: 'option3', altValue: 'alt_value_option3' },
|
|
7
|
-
{ label: 'Option 4', value: 'option4', altValue: 'alt_value_option4' },
|
|
8
|
-
{ label: 'Option 5', value: 'option5', altValue: 'alt_value_option5' },
|
|
9
|
-
{ label: 'Option 6', value: 'option6', altValue: 'alt_value_option6' },
|
|
10
|
-
{ label: 'Option 7', value: 'option7', altValue: 'alt_value_option7' },
|
|
11
|
-
{ label: 'Option 8', value: 'option8', altValue: 'alt_value_option8' },
|
|
12
|
-
{ label: 'Option 9', value: 'option9', altValue: 'alt_value_option9' },
|
|
13
|
-
{ label: 'Option 10', value: 'option10', disabled: true },
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
title: 'Form/MultiSelectV2',
|
|
18
|
-
component: UnnnicMultiSelect,
|
|
19
|
-
tags: ['autodocs'],
|
|
20
|
-
parameters: {
|
|
21
|
-
docs: {
|
|
22
|
-
description: {
|
|
23
|
-
component:
|
|
24
|
-
'MultiSelect is designed to solve common problems related to multiple option selection.',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
argTypes: {
|
|
29
|
-
options: {
|
|
30
|
-
description:
|
|
31
|
-
'List of items to be displayed in the options. If an item has a `disabled` key set to `true`, that item will be disabled. By default, the component looks for the `label` and `value` keys to display and update the model, but these are not required if you wish to customize them using the `itemLabel` and `itemValue` props, respectively.',
|
|
32
|
-
},
|
|
33
|
-
placeholder: {
|
|
34
|
-
description: 'Text to be displayed in the placeholder.',
|
|
35
|
-
},
|
|
36
|
-
label: {
|
|
37
|
-
description: 'Text to be displayed in the label.',
|
|
38
|
-
},
|
|
39
|
-
modelValue: {
|
|
40
|
-
description:
|
|
41
|
-
'Model variable. Its type will always match a list of the return type of the key specified by `itemValue`, or the entire options object when the `returnObject` property is set to `true`.',
|
|
42
|
-
},
|
|
43
|
-
returnObject: {
|
|
44
|
-
description:
|
|
45
|
-
'Prop to indicate that the full option object should be returned in the v-model.',
|
|
46
|
-
},
|
|
47
|
-
itemLabel: {
|
|
48
|
-
description:
|
|
49
|
-
'Field of the option item that should be used to render the option label.',
|
|
50
|
-
},
|
|
51
|
-
itemValue: {
|
|
52
|
-
description:
|
|
53
|
-
'Field of the option item that should be used to return value to v-model.',
|
|
54
|
-
},
|
|
55
|
-
type: {
|
|
56
|
-
description: 'Select state type',
|
|
57
|
-
},
|
|
58
|
-
errors: {
|
|
59
|
-
description:
|
|
60
|
-
"Error message or messages. When it's an array, the messages will be separated by commas.",
|
|
61
|
-
},
|
|
62
|
-
message: {
|
|
63
|
-
description: 'Help or hint message.',
|
|
64
|
-
},
|
|
65
|
-
size: {
|
|
66
|
-
description: 'Select size',
|
|
67
|
-
},
|
|
68
|
-
optionsLines: {
|
|
69
|
-
description:
|
|
70
|
-
'Number of options to display at most; if exceeded, scrolling will be enabled.',
|
|
71
|
-
},
|
|
72
|
-
enableSearch: {
|
|
73
|
-
description:
|
|
74
|
-
'If true, enables a search field displayed inside the options popover. The `update:search` event is emitted on each input.',
|
|
75
|
-
},
|
|
76
|
-
search: {
|
|
77
|
-
description: 'Search value.',
|
|
78
|
-
},
|
|
79
|
-
locale: {
|
|
80
|
-
description: 'Locale for i18n translations.',
|
|
81
|
-
},
|
|
82
|
-
disabled: {
|
|
83
|
-
description: 'Disable the select.',
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
render: (args) => ({
|
|
87
|
-
components: { UnnnicMultiSelect },
|
|
88
|
-
setup() {
|
|
89
|
-
const handleSearch = (value) => {
|
|
90
|
-
args.search = value;
|
|
91
|
-
};
|
|
92
|
-
return { args, handleSearch };
|
|
93
|
-
},
|
|
94
|
-
data() {
|
|
95
|
-
return {
|
|
96
|
-
exampleValue: [],
|
|
97
|
-
};
|
|
98
|
-
},
|
|
99
|
-
template: `
|
|
100
|
-
<p>modelValue: {{ exampleValue }}</p>
|
|
101
|
-
<unnnic-multi-select v-model="exampleValue" v-bind="args" @update:search="handleSearch" />
|
|
102
|
-
`,
|
|
103
|
-
}),
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export const Default = {
|
|
107
|
-
args: {
|
|
108
|
-
placeholder: 'Placeholder',
|
|
109
|
-
label: 'Label',
|
|
110
|
-
options,
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export const ReturnObject = {
|
|
115
|
-
args: {
|
|
116
|
-
returnObject: true,
|
|
117
|
-
placeholder: 'Placeholder',
|
|
118
|
-
label: 'Label',
|
|
119
|
-
options,
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export const AlternativeValueKey = {
|
|
124
|
-
args: {
|
|
125
|
-
itemValue: 'altValue',
|
|
126
|
-
placeholder: 'Placeholder',
|
|
127
|
-
label: 'Label',
|
|
128
|
-
options,
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
export const AlternativeValueLabel = {
|
|
133
|
-
args: {
|
|
134
|
-
itemLabel: 'altValue',
|
|
135
|
-
placeholder: 'Placeholder',
|
|
136
|
-
label: 'Label',
|
|
137
|
-
options,
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export const Disabled = {
|
|
142
|
-
args: {
|
|
143
|
-
placeholder: 'Placeholder',
|
|
144
|
-
label: 'Label',
|
|
145
|
-
options,
|
|
146
|
-
disabled: true,
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export const WithSearch = {
|
|
151
|
-
args: {
|
|
152
|
-
placeholder: 'Placeholder',
|
|
153
|
-
label: 'Label',
|
|
154
|
-
options,
|
|
155
|
-
enableSearch: true,
|
|
156
|
-
search: '',
|
|
157
|
-
},
|
|
158
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|