@weni/unnnic-system 3.27.1 → 3.28.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/index.d.ts +142 -30
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +7872 -7805
- package/dist/unnnic.umd.js +31 -31
- package/package.json +1 -1
- 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 +9 -31
- package/src/components/ui/popover/PopoverFooter.vue +21 -6
- package/src/components/ui/popover/PopoverOption.vue +20 -10
- package/src/components/ui/popover/__tests__/PopoverFooter.spec.js +116 -0
- package/src/components/ui/popover/context.ts +4 -0
- package/src/stories/PopoverOption.stories.js +53 -0
- package/src/stories/Select.stories.js +119 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PopoverOption } from '../components/ui/popover';
|
|
2
|
+
import UnnnicTag from '../components/Tag/Tag.vue';
|
|
2
3
|
import colorsList from '../utils/colorsList';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
@@ -73,3 +74,55 @@ export const Default = {
|
|
|
73
74
|
`,
|
|
74
75
|
}),
|
|
75
76
|
};
|
|
77
|
+
|
|
78
|
+
export const WithTag = {
|
|
79
|
+
parameters: {
|
|
80
|
+
docs: {
|
|
81
|
+
description: {
|
|
82
|
+
story:
|
|
83
|
+
'Uses the default slot to render custom content, such as a label alongside a status tag. The option keeps the `space-between` layout, so the tag stays aligned to the end.',
|
|
84
|
+
},
|
|
85
|
+
source: {
|
|
86
|
+
code: `<UnnnicPopoverOption v-for="option in options" :key="option.value">
|
|
87
|
+
<span class="popover-option__label">{{ option.label }}</span>
|
|
88
|
+
<UnnnicTag
|
|
89
|
+
type="default"
|
|
90
|
+
size="small"
|
|
91
|
+
:scheme="statusConfig[option.status].scheme"
|
|
92
|
+
:text="statusConfig[option.status].text"
|
|
93
|
+
/>
|
|
94
|
+
</UnnnicPopoverOption>`,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
render: () => ({
|
|
99
|
+
components: { PopoverOption, UnnnicTag },
|
|
100
|
+
data() {
|
|
101
|
+
return {
|
|
102
|
+
options: [
|
|
103
|
+
{ label: 'John Doe', value: 'john-doe', status: 'online' },
|
|
104
|
+
{ label: 'Jane Doe', value: 'jane-doe', status: 'lunch' },
|
|
105
|
+
{ label: 'James Smith', value: 'james-smith', status: 'offline' },
|
|
106
|
+
],
|
|
107
|
+
statusConfig: {
|
|
108
|
+
online: { scheme: 'green', text: 'Online' },
|
|
109
|
+
lunch: { scheme: 'orange', text: 'Lunch' },
|
|
110
|
+
offline: { scheme: 'gray', text: 'Offline' },
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
template: `
|
|
115
|
+
<section style="display: flex; flex-direction: column; gap: 8px; width: 280px;">
|
|
116
|
+
<PopoverOption v-for="option in options" :key="option.value" :label="option.label">
|
|
117
|
+
<span style="flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{ option.label }}</span>
|
|
118
|
+
<unnnic-tag
|
|
119
|
+
type="default"
|
|
120
|
+
size="small"
|
|
121
|
+
:scheme="statusConfig[option.status].scheme"
|
|
122
|
+
:text="statusConfig[option.status].text"
|
|
123
|
+
/>
|
|
124
|
+
</PopoverOption>
|
|
125
|
+
</section>
|
|
126
|
+
`,
|
|
127
|
+
}),
|
|
128
|
+
};
|
|
@@ -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 },
|