@weni/unnnic-system 3.27.1 → 3.28.2-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/dist/style.css +1 -1
- package/dist/unnnic.mjs +4993 -4934
- package/dist/unnnic.umd.js +27 -27
- package/package.json +2 -2
- package/src/components/Select/__tests__/Select.spec.js +139 -0
- package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +3 -3
- package/src/components/Select/index.vue +148 -3
- package/src/components/ui/popover/PopoverContent.vue +25 -11
- package/src/components/ui/popover/PopoverFooter.vue +1 -5
- package/src/components/ui/popover/PopoverOption.vue +20 -10
- package/src/stories/PopoverOption.stories.js +53 -0
- package/src/stories/Select.stories.js +119 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import UnnnicSelect from '../components/Select/index.vue';
|
|
2
|
+
import UnnnicTag from '../components/Tag/Tag.vue';
|
|
2
3
|
|
|
3
4
|
const options = [
|
|
4
5
|
{ label: 'Option 1', value: 'option1', altValue: 'alt_value_option1' },
|
|
@@ -181,6 +182,124 @@ export const WithSearch = {
|
|
|
181
182
|
},
|
|
182
183
|
};
|
|
183
184
|
|
|
185
|
+
export const WithStatus = {
|
|
186
|
+
parameters: {
|
|
187
|
+
docs: {
|
|
188
|
+
description: {
|
|
189
|
+
story:
|
|
190
|
+
'Customizes option and selected content through the `#option` and `#selected` scoped slots. The status tag lives entirely in the consumer, keeping the Select decoupled from the concept of status.',
|
|
191
|
+
},
|
|
192
|
+
source: {
|
|
193
|
+
code: `<UnnnicSelect
|
|
194
|
+
v-model="selected"
|
|
195
|
+
:options="options"
|
|
196
|
+
label="Representative"
|
|
197
|
+
placeholder="Select a representative"
|
|
198
|
+
clearable
|
|
199
|
+
>
|
|
200
|
+
<template #option="{ label, option }">
|
|
201
|
+
<span class="select-status__label">{{ label }}</span>
|
|
202
|
+
<UnnnicTag
|
|
203
|
+
type="default"
|
|
204
|
+
size="small"
|
|
205
|
+
:scheme="statusConfig[option.status].scheme"
|
|
206
|
+
:text="statusConfig[option.status].text"
|
|
207
|
+
/>
|
|
208
|
+
</template>
|
|
209
|
+
|
|
210
|
+
<template #selected="{ label, option }">
|
|
211
|
+
<span class="select-status__label">{{ label }}</span>
|
|
212
|
+
<UnnnicTag
|
|
213
|
+
type="default"
|
|
214
|
+
size="small"
|
|
215
|
+
:scheme="statusConfig[option.status].scheme"
|
|
216
|
+
:text="statusConfig[option.status].text"
|
|
217
|
+
/>
|
|
218
|
+
</template>
|
|
219
|
+
</UnnnicSelect>`,
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
render: () => ({
|
|
224
|
+
components: { UnnnicSelect, UnnnicTag },
|
|
225
|
+
data() {
|
|
226
|
+
return {
|
|
227
|
+
emptyValue: null,
|
|
228
|
+
selectedValue: 'anna',
|
|
229
|
+
statusOptions: [
|
|
230
|
+
{ label: 'Ana', value: 'ana', status: 'online' },
|
|
231
|
+
{ label: 'Anna', value: 'anna', status: 'online' },
|
|
232
|
+
{ label: 'Davi', value: 'davi', status: 'lunch' },
|
|
233
|
+
{ label: 'João', value: 'joao', status: 'offline' },
|
|
234
|
+
{ label: 'Ricardo', value: 'ricardo', status: 'offline' },
|
|
235
|
+
],
|
|
236
|
+
statusConfig: {
|
|
237
|
+
online: { scheme: 'green', text: 'Online' },
|
|
238
|
+
lunch: { scheme: 'orange', text: 'Lunch' },
|
|
239
|
+
offline: { scheme: 'gray', text: 'Offline' },
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
},
|
|
243
|
+
template: `
|
|
244
|
+
<div style="width: 512px; display: flex; flex-direction: column; gap: 32px;">
|
|
245
|
+
<unnnic-select
|
|
246
|
+
v-model="emptyValue"
|
|
247
|
+
:options="statusOptions"
|
|
248
|
+
label="Representative"
|
|
249
|
+
placeholder="Select a representative"
|
|
250
|
+
clearable
|
|
251
|
+
>
|
|
252
|
+
<template #option="{ label, option }">
|
|
253
|
+
<span style="flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ label }}</span>
|
|
254
|
+
<unnnic-tag
|
|
255
|
+
type="default"
|
|
256
|
+
size="small"
|
|
257
|
+
:scheme="statusConfig[option.status].scheme"
|
|
258
|
+
:text="statusConfig[option.status].text"
|
|
259
|
+
/>
|
|
260
|
+
</template>
|
|
261
|
+
<template #selected="{ label, option }">
|
|
262
|
+
<span style="flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ label }}</span>
|
|
263
|
+
<unnnic-tag
|
|
264
|
+
type="default"
|
|
265
|
+
size="small"
|
|
266
|
+
:scheme="statusConfig[option.status].scheme"
|
|
267
|
+
:text="statusConfig[option.status].text"
|
|
268
|
+
/>
|
|
269
|
+
</template>
|
|
270
|
+
</unnnic-select>
|
|
271
|
+
|
|
272
|
+
<unnnic-select
|
|
273
|
+
v-model="selectedValue"
|
|
274
|
+
:options="statusOptions"
|
|
275
|
+
label="Representative"
|
|
276
|
+
placeholder="Select a representative"
|
|
277
|
+
clearable
|
|
278
|
+
>
|
|
279
|
+
<template #option="{ label, option }">
|
|
280
|
+
<span style="flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ label }}</span>
|
|
281
|
+
<unnnic-tag
|
|
282
|
+
type="default"
|
|
283
|
+
size="small"
|
|
284
|
+
:scheme="statusConfig[option.status].scheme"
|
|
285
|
+
:text="statusConfig[option.status].text"
|
|
286
|
+
/>
|
|
287
|
+
</template>
|
|
288
|
+
<template #selected="{ label, option }">
|
|
289
|
+
<span style="flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ label }}</span>
|
|
290
|
+
<unnnic-tag
|
|
291
|
+
type="default"
|
|
292
|
+
size="small"
|
|
293
|
+
:scheme="statusConfig[option.status].scheme"
|
|
294
|
+
:text="statusConfig[option.status].text"
|
|
295
|
+
/>
|
|
296
|
+
</template>
|
|
297
|
+
</unnnic-select>
|
|
298
|
+
</div>
|
|
299
|
+
`,
|
|
300
|
+
}),
|
|
301
|
+
};
|
|
302
|
+
|
|
184
303
|
export const WithInfiniteScroll = {
|
|
185
304
|
render: () => ({
|
|
186
305
|
components: { UnnnicSelect },
|