@weni/unnnic-system 3.9.1-alpha.4 → 3.9.2
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 +38 -0
- package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
- package/dist/components/Alert/Alert.vue.d.ts +116 -17
- package/dist/components/Alert/Alert.vue.d.ts.map +1 -1
- package/dist/components/Alert/Version1dot1.vue.d.ts +38 -2
- package/dist/components/Alert/Version1dot1.vue.d.ts.map +1 -1
- package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +2 -2
- package/dist/components/AudioRecorder/AudioPlayer.vue.d.ts +1 -1
- package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +5 -5
- package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +3 -3
- package/dist/components/Banner/Banner.vue.d.ts +1 -1
- package/dist/components/Banner/InfoBanner.vue.d.ts +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/Button/ButtonIcon.vue.d.ts +1 -1
- package/dist/components/Button/types.d.ts +1 -1
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/Card/AccountCard.vue.d.ts +5 -5
- package/dist/components/Card/BlankCard.vue.d.ts +1 -1
- package/dist/components/Card/Card.vue.d.ts +27 -27
- package/dist/components/Card/CardCompany.vue.d.ts +414 -11
- package/dist/components/Card/CardData.vue.d.ts +1 -1
- package/dist/components/Card/CardStatusesContainer.vue.d.ts +5 -5
- package/dist/components/Card/ContentCard.vue.d.ts +3 -3
- package/dist/components/Card/DashCard.vue.d.ts +5 -5
- package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
- package/dist/components/Card/MarketplaceCard.vue.d.ts +2 -2
- package/dist/components/Card/SimpleCard.vue.d.ts +3 -3
- package/dist/components/Card/StatusCard.vue.d.ts +2 -2
- package/dist/components/Card/TitleCard.vue.d.ts +3 -3
- package/dist/components/CardImage/CardImage.vue.d.ts +31 -24
- package/dist/components/CardInformation/CardInformation.vue.d.ts +5 -5
- package/dist/components/CardProject/CardProject.vue.d.ts +3 -3
- package/dist/components/Carousel/Carousel.vue.d.ts +416 -13
- package/dist/components/Carousel/TagCarousel.vue.d.ts +415 -12
- package/dist/components/ChartBar/ChartBar.vue.d.ts +5 -5
- package/dist/components/ChartLine/ChartLine.vue.d.ts +1 -1
- package/dist/components/ChatText/ChatText.vue.d.ts +2 -2
- package/dist/components/ChatsContact/ChatsContact.vue.d.ts +446 -21
- package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +1 -1
- package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts +1 -1
- package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
- package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +5 -5
- package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +2 -2
- package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +1 -1
- package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.vue.d.ts +26 -19
- package/dist/components/Checkbox/Checkbox.vue.d.ts.map +1 -1
- package/dist/components/Comment/Comment.vue.d.ts +1 -1
- package/dist/components/DataArea/DataArea.vue.d.ts +2 -2
- package/dist/components/DataTable/index.vue.d.ts +12 -2
- package/dist/components/DataTable/index.vue.d.ts.map +1 -1
- package/dist/components/DateFilter/DateFilter.vue.d.ts +39 -170
- package/dist/components/DatePicker/DatePicker.vue.d.ts +4 -4
- package/dist/components/Drawer/Drawer.vue.d.ts +4 -4
- package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
- package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
- package/dist/components/Flag.vue.d.ts +2 -2
- package/dist/components/FormElement/FormElement.vue.d.ts +28 -51
- package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
- package/dist/components/Icon.vue.d.ts +1 -1
- package/dist/components/Icon.vue.d.ts.map +1 -1
- package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
- package/dist/components/ImportCard/ImportCard.vue.d.ts +4 -4
- package/dist/components/Input/BaseInput.vue.d.ts +2 -11
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +39 -170
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +24 -33
- package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +44 -175
- package/dist/components/InputNext/InputNext.vue.d.ts +4 -4
- package/dist/components/Label/Label.vue.d.ts +15 -9
- package/dist/components/Label/Label.vue.d.ts.map +1 -1
- package/dist/components/Modal/Modal.vue.d.ts +2 -2
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts +6 -6
- package/dist/components/ModalNext/ModalNext.vue.d.ts +44 -175
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +9 -9
- package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts +14 -26
- package/dist/components/Pagination/Pagination.vue.d.ts +3 -3
- package/dist/components/ProgressBar/ProgressBar.vue.d.ts +1 -1
- package/dist/components/Radio/Radio.vue.d.ts +6 -10
- package/dist/components/Radio/Radio.vue.d.ts.map +1 -1
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +512 -69
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts.map +1 -1
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +414 -11
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +28 -21
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts.map +1 -1
- package/dist/components/SelectTime/index.vue.d.ts +24 -33
- package/dist/components/SkeletonLoading/skeletonTheme.vue.d.ts +1 -1
- package/dist/components/Slider/Slider.vue.d.ts +2 -2
- package/dist/components/StarRating/StarRating.vue.d.ts +1 -1
- package/dist/components/Switch/Switch.vue.d.ts +21 -55
- package/dist/components/Switch/Switch.vue.d.ts.map +1 -1
- package/dist/components/Tab/Tab.vue.d.ts +2 -13
- package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
- package/dist/components/TableNext/TablePagination.vue.d.ts +3 -3
- package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
- package/dist/components/Tag/BrandTag.vue.d.ts +51 -0
- package/dist/components/Tag/BrandTag.vue.d.ts.map +1 -0
- package/dist/components/Tag/DefaultTag.vue.d.ts +83 -4
- package/dist/components/Tag/DefaultTag.vue.d.ts.map +1 -1
- package/dist/components/Tag/IndicatorTag.vue.d.ts +151 -0
- package/dist/components/Tag/IndicatorTag.vue.d.ts.map +1 -0
- package/dist/components/Tag/Tag.vue.d.ts +414 -12
- package/dist/components/Tag/Tag.vue.d.ts.map +1 -1
- package/dist/components/Tag/TagNext.vue.d.ts +24 -0
- package/dist/components/Tag/TagNext.vue.d.ts.map +1 -0
- package/dist/components/TextArea/TextArea.vue.d.ts +30 -75
- package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
- package/dist/components/ToolTip/ToolTip.vue.d.ts +1 -1
- package/dist/components/Tour/Tour.vue.d.ts +3 -3
- package/dist/components/Tour/TourPopover.vue.d.ts +3 -3
- package/dist/components/UploadArea/UploadArea.vue.d.ts +4 -4
- package/dist/components/index.d.ts +6402 -4331
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +1 -1
- package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +1 -1
- package/dist/{es-db30a2ff.mjs → es-4aab69cb.mjs} +1 -1
- package/dist/{index-761bb714.mjs → index-789225a6.mjs} +10023 -10092
- package/dist/{pt-br-569fa4c1.mjs → pt-br-2f695ddd.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +151 -158
- package/dist/unnnic.umd.js +43 -42
- package/dist/utils/call.d.ts +1 -2
- package/dist/utils/call.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/Alert/Alert.vue +135 -26
- package/src/components/Alert/AlertBanner.vue +182 -0
- package/src/components/Alert/AlertCaller.vue +49 -0
- package/src/components/Alert/Version1dot1.vue +36 -0
- package/src/components/Alert/__tests__/Alert.spec.js +45 -2
- package/src/components/Alert/__tests__/AlertBanner.spec.js +89 -0
- package/src/components/Alert/__tests__/AlertCaller.spec.js +98 -0
- package/src/components/Alert/__tests__/Version1dot1.spec.js +21 -0
- package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +7 -11
- package/src/components/Alert/__tests__/__snapshots__/AlertBanner.spec.js.snap +2 -2
- package/src/components/Alert/__tests__/__snapshots__/Version1dot1.spec.js.snap +1 -1
- package/src/components/Button/Button.vue +117 -67
- package/src/components/Button/types.ts +1 -0
- package/src/components/ChatsContact/ChatsContact.vue +6 -10
- package/src/components/Checkbox/Checkbox.vue +65 -117
- package/src/components/Checkbox/__tests__/Checkbox.spec.js +21 -6
- package/src/components/DataTable/index.vue +48 -0
- package/src/components/FormElement/FormElement.vue +93 -63
- package/src/components/Icon.vue +0 -2
- package/src/components/Input/BaseInput.vue +12 -12
- package/src/components/Input/Input.scss +20 -19
- package/src/components/Input/Input.vue +55 -60
- package/src/components/Input/TextInput.vue +54 -25
- package/src/components/Input/__test__/Input.spec.js +33 -13
- package/src/components/Input/__test__/TextInput.spec.js +8 -6
- package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +5 -14
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
- package/src/components/Label/Label.vue +21 -52
- package/src/components/Label/__tests__/Label.spec.js +1 -1
- package/src/components/Label/__tests__/__snapshots__/Label.spec.js.snap +1 -1
- package/src/components/Radio/Radio.vue +66 -118
- package/src/components/Radio/__test__/Radio.spec.js +20 -14
- package/src/components/Radio/__test__/__snapshots__/Radio.spec.js.snap +3 -4
- package/src/components/SelectSmart/SelectSmart.vue +129 -28
- package/src/components/SelectSmart/__tests__/SelectSmart.spec.js +180 -4
- package/src/components/Switch/Switch.vue +91 -132
- package/src/components/Switch/__tests__/Switch.spec.js +75 -8
- package/src/components/Switch/__tests__/__snapshots__/Switch.spec.js.snap +6 -5
- package/src/components/Tab/Tab.vue +23 -37
- package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -1
- package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
- package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
- package/src/components/Tag/BrandTag.vue +96 -0
- package/src/components/Tag/DefaultTag.vue +107 -51
- package/src/components/Tag/IndicatorTag.vue +107 -0
- package/src/components/Tag/Tag.vue +79 -32
- package/src/components/Tag/TagNext.vue +60 -0
- package/src/components/TextArea/TextArea.vue +11 -40
- package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +3 -11
- package/src/components/index.ts +18 -33
- package/src/stories/Alert.stories.js +67 -6
- package/src/stories/Button.stories.js +39 -29
- package/src/stories/Checkbox.stories.js +4 -11
- package/src/stories/DataTable.stories.js +192 -0
- package/src/stories/Input.stories.js +76 -71
- package/src/stories/Label.stories.js +0 -7
- package/src/stories/Radio.stories.js +1 -28
- package/src/stories/SelectSmart.stories.js +289 -0
- package/src/stories/Switch.stories.js +5 -10
- package/src/stories/Tab.stories.js +4 -11
- package/src/stories/Tag.stories.js +43 -24
- package/src/stories/TextArea.stories.js +2 -14
- package/src/types/scheme-colors.d.ts +0 -1
- package/src/utils/call.js +18 -46
- package/dist/assets/tokens/colors.json.d.ts +0 -376
- package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts +0 -28
- package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts.map +0 -1
- package/dist/components/PageHeader/PageHeader.vue.d.ts +0 -28
- package/dist/components/PageHeader/PageHeader.vue.d.ts.map +0 -1
- package/dist/components/PageHeader/index.d.ts +0 -3
- package/dist/components/PageHeader/index.d.ts.map +0 -1
- package/dist/components/PageHeader/types.d.ts +0 -9
- package/dist/components/PageHeader/types.d.ts.map +0 -1
- package/dist/components/Tag/types.d.ts +0 -18
- package/dist/components/Tag/types.d.ts.map +0 -1
- package/dist/components/Toast/Toast.vue.d.ts +0 -16
- package/dist/components/Toast/Toast.vue.d.ts.map +0 -1
- package/dist/components/Toast/ToastManager.d.ts +0 -14
- package/dist/components/Toast/ToastManager.d.ts.map +0 -1
- package/dist/components/Toast/types.d.ts +0 -35
- package/dist/components/Toast/types.d.ts.map +0 -1
- package/src/assets/icons/checkbox-checked-disabled.svg +0 -3
- package/src/assets/icons/checkbox-checked.svg +0 -3
- package/src/assets/icons/checkbox-less-disabled.svg +0 -3
- package/src/assets/icons/checkbox-less.svg +0 -3
- package/src/assets/icons/radio-checked.svg +0 -3
- package/src/assets/icons/switch-checked-disabled.svg +0 -3
- package/src/assets/icons/switch-checked.svg +0 -3
- package/src/components/CheckboxGroup/CheckboxGroup.vue +0 -96
- package/src/components/PageHeader/PageHeader.vue +0 -148
- package/src/components/PageHeader/index.ts +0 -2
- package/src/components/PageHeader/types.ts +0 -10
- package/src/components/RadioGroup/RadioGroup.vue +0 -142
- package/src/components/Tag/types.ts +0 -19
- package/src/components/Toast/Toast.vue +0 -246
- package/src/components/Toast/ToastManager.ts +0 -110
- package/src/components/Toast/__tests__/Toast.spec.js +0 -291
- package/src/components/Toast/__tests__/ToastManager.spec.js +0 -294
- package/src/components/Toast/types.ts +0 -57
- package/src/stories/CheckboxGroup.stories.js +0 -105
- package/src/stories/PageHeader.stories.js +0 -330
- package/src/stories/RadioGroup.stories.js +0 -144
- package/src/stories/Toast.mdx +0 -123
- package/src/stories/Toast.stories.js +0 -126
|
@@ -303,3 +303,292 @@ Secondary.args = {
|
|
|
303
303
|
{ value: '7', label: 'Option 7' },
|
|
304
304
|
],
|
|
305
305
|
};
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Infinite Scroll Example
|
|
309
|
+
*
|
|
310
|
+
* This story demonstrates the infinite scroll feature.
|
|
311
|
+
* Scroll to the bottom of the options list to load more items.
|
|
312
|
+
*
|
|
313
|
+
* Features:
|
|
314
|
+
* - Loads 20 items per page
|
|
315
|
+
* - Simulates API delay (500ms)
|
|
316
|
+
* - Shows loading state while fetching
|
|
317
|
+
* - Stops loading when reaching the last page (5 pages total = 100 items)
|
|
318
|
+
* - Works with autocomplete and search
|
|
319
|
+
*/
|
|
320
|
+
export const InfiniteScroll = {
|
|
321
|
+
render: (args) => ({
|
|
322
|
+
components: {
|
|
323
|
+
unnnicFormElement,
|
|
324
|
+
unnnicSelectSmart,
|
|
325
|
+
},
|
|
326
|
+
setup() {
|
|
327
|
+
return { args };
|
|
328
|
+
},
|
|
329
|
+
data() {
|
|
330
|
+
return {
|
|
331
|
+
selectedOptions: [],
|
|
332
|
+
options: [],
|
|
333
|
+
currentPage: 1,
|
|
334
|
+
totalPages: 5,
|
|
335
|
+
itemsPerPage: 20,
|
|
336
|
+
};
|
|
337
|
+
},
|
|
338
|
+
computed: {
|
|
339
|
+
hasMoreData() {
|
|
340
|
+
return this.currentPage <= this.totalPages;
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
mounted() {
|
|
344
|
+
this.loadInitialOptions();
|
|
345
|
+
},
|
|
346
|
+
methods: {
|
|
347
|
+
async loadInitialOptions() {
|
|
348
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
349
|
+
|
|
350
|
+
const newOptions = Array.from({ length: this.itemsPerPage }, (_, i) => {
|
|
351
|
+
const itemNumber = (this.currentPage - 1) * this.itemsPerPage + i + 1;
|
|
352
|
+
return {
|
|
353
|
+
value: `item-${itemNumber}`,
|
|
354
|
+
label: `Item ${itemNumber}`,
|
|
355
|
+
description: `Description for item ${itemNumber}`,
|
|
356
|
+
};
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
this.options.push(...newOptions);
|
|
360
|
+
this.currentPage++;
|
|
361
|
+
},
|
|
362
|
+
async handleScrollEnd() {
|
|
363
|
+
if (!this.hasMoreData) {
|
|
364
|
+
this.$refs.selectSmart?.finishInfiniteScroll();
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
try {
|
|
369
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
370
|
+
|
|
371
|
+
const newOptions = Array.from(
|
|
372
|
+
{ length: this.itemsPerPage },
|
|
373
|
+
(_, i) => {
|
|
374
|
+
const itemNumber =
|
|
375
|
+
(this.currentPage - 1) * this.itemsPerPage + i + 1;
|
|
376
|
+
return {
|
|
377
|
+
value: `item-${itemNumber}`,
|
|
378
|
+
label: `Item ${itemNumber}`,
|
|
379
|
+
description: `Description for item ${itemNumber}`,
|
|
380
|
+
};
|
|
381
|
+
},
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
this.options.push(...newOptions);
|
|
385
|
+
this.currentPage++;
|
|
386
|
+
} catch (error) {
|
|
387
|
+
console.error('Error loading options:', error);
|
|
388
|
+
} finally {
|
|
389
|
+
this.$refs.selectSmart?.finishInfiniteScroll();
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
template: `
|
|
394
|
+
<unnnicFormElement label="Select with Infinite Scroll" message="Try scrolling to the bottom of the list">
|
|
395
|
+
<unnnicSelectSmart
|
|
396
|
+
ref="selectSmart"
|
|
397
|
+
v-model="selectedOptions"
|
|
398
|
+
:options="options"
|
|
399
|
+
:infinite-scroll="true"
|
|
400
|
+
:infinite-scroll-distance="20"
|
|
401
|
+
:infinite-scroll-can-load-more="() => hasMoreData"
|
|
402
|
+
:autocomplete="true"
|
|
403
|
+
:autocomplete-icon-left="true"
|
|
404
|
+
:autocomplete-clear-on-focus="true"
|
|
405
|
+
multiple
|
|
406
|
+
@scroll-end="handleScrollEnd"
|
|
407
|
+
/>
|
|
408
|
+
</unnnicFormElement>
|
|
409
|
+
`,
|
|
410
|
+
}),
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Infinite Scroll Simple Example
|
|
415
|
+
*
|
|
416
|
+
* A simpler version without multiple selection and descriptions.
|
|
417
|
+
* Useful for single selection scenarios.
|
|
418
|
+
*/
|
|
419
|
+
export const InfiniteScrollSimple = {
|
|
420
|
+
render: (args) => ({
|
|
421
|
+
components: {
|
|
422
|
+
unnnicFormElement,
|
|
423
|
+
unnnicSelectSmart,
|
|
424
|
+
},
|
|
425
|
+
setup() {
|
|
426
|
+
return { args };
|
|
427
|
+
},
|
|
428
|
+
data() {
|
|
429
|
+
return {
|
|
430
|
+
selectedOption: [],
|
|
431
|
+
options: [],
|
|
432
|
+
currentPage: 1,
|
|
433
|
+
totalPages: 3,
|
|
434
|
+
};
|
|
435
|
+
},
|
|
436
|
+
mounted() {
|
|
437
|
+
this.loadInitialOptions();
|
|
438
|
+
},
|
|
439
|
+
methods: {
|
|
440
|
+
async loadInitialOptions() {
|
|
441
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
442
|
+
|
|
443
|
+
const newOptions = Array.from({ length: 15 }, (_, i) => {
|
|
444
|
+
const itemNumber = (this.currentPage - 1) * 15 + i + 1;
|
|
445
|
+
return {
|
|
446
|
+
value: `option-${itemNumber}`,
|
|
447
|
+
label: `Option ${itemNumber}`,
|
|
448
|
+
};
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
this.options.push(...newOptions);
|
|
452
|
+
this.currentPage++;
|
|
453
|
+
},
|
|
454
|
+
async handleScrollEnd() {
|
|
455
|
+
if (this.currentPage > this.totalPages) {
|
|
456
|
+
this.$refs.selectSmart?.finishInfiniteScroll();
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
try {
|
|
461
|
+
await new Promise((resolve) => setTimeout(resolve, 400));
|
|
462
|
+
|
|
463
|
+
const newOptions = Array.from({ length: 15 }, (_, i) => {
|
|
464
|
+
const itemNumber = (this.currentPage - 1) * 15 + i + 1;
|
|
465
|
+
return {
|
|
466
|
+
value: `option-${itemNumber}`,
|
|
467
|
+
label: `Option ${itemNumber}`,
|
|
468
|
+
};
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
this.options.push(...newOptions);
|
|
472
|
+
this.currentPage++;
|
|
473
|
+
} catch (error) {
|
|
474
|
+
console.error('Error:', error);
|
|
475
|
+
} finally {
|
|
476
|
+
this.$refs.selectSmart?.finishInfiniteScroll();
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
template: `
|
|
481
|
+
<unnnicFormElement label="Simple Infinite Scroll">
|
|
482
|
+
<unnnicSelectSmart
|
|
483
|
+
ref="selectSmart"
|
|
484
|
+
v-model="selectedOption"
|
|
485
|
+
:options="options"
|
|
486
|
+
:infinite-scroll="true"
|
|
487
|
+
:infinite-scroll-distance="10"
|
|
488
|
+
:infinite-scroll-can-load-more="() => currentPage <= totalPages"
|
|
489
|
+
:autocomplete="true"
|
|
490
|
+
@scroll-end="handleScrollEnd"
|
|
491
|
+
/>
|
|
492
|
+
</unnnicFormElement>
|
|
493
|
+
`,
|
|
494
|
+
}),
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* External Search with Debounce Example
|
|
499
|
+
*
|
|
500
|
+
* Demonstrates how to use SelectSmart with external API search and debounce.
|
|
501
|
+
* The component disables internal filtering and lets the parent control the options.
|
|
502
|
+
*
|
|
503
|
+
* Features:
|
|
504
|
+
* - Debounced search (500ms delay)
|
|
505
|
+
* - Simulates API calls
|
|
506
|
+
* - Shows loading state during search
|
|
507
|
+
* - External filter control via disableInternalFilter prop
|
|
508
|
+
*/
|
|
509
|
+
export const ExternalSearchWithDebounce = {
|
|
510
|
+
render: (args) => ({
|
|
511
|
+
components: {
|
|
512
|
+
unnnicFormElement,
|
|
513
|
+
unnnicSelectSmart,
|
|
514
|
+
},
|
|
515
|
+
setup() {
|
|
516
|
+
return { args };
|
|
517
|
+
},
|
|
518
|
+
data() {
|
|
519
|
+
return {
|
|
520
|
+
selected: [],
|
|
521
|
+
options: [],
|
|
522
|
+
allOptions: [],
|
|
523
|
+
isSearching: false,
|
|
524
|
+
searchDebounceTimer: null,
|
|
525
|
+
};
|
|
526
|
+
},
|
|
527
|
+
mounted() {
|
|
528
|
+
this.allOptions = Array.from({ length: 50 }, (_, i) => ({
|
|
529
|
+
value: `item-${i + 1}`,
|
|
530
|
+
label: `Item ${i + 1}`,
|
|
531
|
+
description: `Description for item ${i + 1}`,
|
|
532
|
+
}));
|
|
533
|
+
this.options = [...this.allOptions];
|
|
534
|
+
},
|
|
535
|
+
methods: {
|
|
536
|
+
handleSearchValueUpdate(searchValue) {
|
|
537
|
+
if (this.searchDebounceTimer) {
|
|
538
|
+
clearTimeout(this.searchDebounceTimer);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
if (!searchValue || searchValue.trim() === '') {
|
|
542
|
+
this.options = [...this.allOptions];
|
|
543
|
+
this.isSearching = false;
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
this.isSearching = true;
|
|
548
|
+
|
|
549
|
+
this.searchDebounceTimer = setTimeout(async () => {
|
|
550
|
+
try {
|
|
551
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
552
|
+
|
|
553
|
+
const searchTerm = searchValue.toLowerCase();
|
|
554
|
+
const results = this.allOptions.filter((option) =>
|
|
555
|
+
option.label.toLowerCase().includes(searchTerm),
|
|
556
|
+
);
|
|
557
|
+
|
|
558
|
+
this.options = results;
|
|
559
|
+
} catch (error) {
|
|
560
|
+
console.error('Search error:', error);
|
|
561
|
+
this.options = [];
|
|
562
|
+
} finally {
|
|
563
|
+
this.isSearching = false;
|
|
564
|
+
}
|
|
565
|
+
}, 500);
|
|
566
|
+
},
|
|
567
|
+
},
|
|
568
|
+
beforeUnmount() {
|
|
569
|
+
if (this.searchDebounceTimer) {
|
|
570
|
+
clearTimeout(this.searchDebounceTimer);
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
template: `
|
|
574
|
+
<div>
|
|
575
|
+
<unnnicFormElement
|
|
576
|
+
label="Search with API (Debounced)"
|
|
577
|
+
message="Internal filter is disabled - parent controls filtering"
|
|
578
|
+
>
|
|
579
|
+
<unnnicSelectSmart
|
|
580
|
+
v-model="selected"
|
|
581
|
+
:options="options"
|
|
582
|
+
:disable-internal-filter="true"
|
|
583
|
+
:is-loading="isSearching"
|
|
584
|
+
:autocomplete="true"
|
|
585
|
+
:autocomplete-icon-left="true"
|
|
586
|
+
:autocomplete-clear-on-focus="true"
|
|
587
|
+
multiple
|
|
588
|
+
@update:search-value="handleSearchValueUpdate"
|
|
589
|
+
/>
|
|
590
|
+
</unnnicFormElement>
|
|
591
|
+
</div>
|
|
592
|
+
`,
|
|
593
|
+
}),
|
|
594
|
+
};
|
|
@@ -4,11 +4,9 @@ export default {
|
|
|
4
4
|
title: 'Form/Switch',
|
|
5
5
|
component: UnnnicSwitch,
|
|
6
6
|
argTypes: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
option: { control: { type: 'text' } },
|
|
11
|
-
helper: { control: { type: 'text' } },
|
|
7
|
+
size: { control: { type: 'select', options: ['small', 'medium'] } },
|
|
8
|
+
textLeft: { control: { type: 'text' } },
|
|
9
|
+
textRight: { control: { type: 'text' } },
|
|
12
10
|
disabled: { control: { type: 'boolean' } },
|
|
13
11
|
},
|
|
14
12
|
render: (args) => ({
|
|
@@ -34,11 +32,8 @@ export default {
|
|
|
34
32
|
|
|
35
33
|
export const Default = {
|
|
36
34
|
args: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
labelUseHtmlTooltip: true,
|
|
40
|
-
option: 'Option',
|
|
41
|
-
helper: 'Helper text',
|
|
35
|
+
size: 'medium',
|
|
36
|
+
textRight: 'Default',
|
|
42
37
|
disabled: false,
|
|
43
38
|
},
|
|
44
39
|
};
|
|
@@ -3,6 +3,9 @@ import unnnicTab from '../components/Tab/Tab.vue';
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'tabs/Tab',
|
|
5
5
|
component: unnnicTab,
|
|
6
|
+
argTypes: {
|
|
7
|
+
size: { control: { type: 'select', options: ['md', 'sm'] } },
|
|
8
|
+
},
|
|
6
9
|
render: (args) => ({
|
|
7
10
|
components: {
|
|
8
11
|
unnnicTab,
|
|
@@ -33,15 +36,6 @@ export default {
|
|
|
33
36
|
Second description
|
|
34
37
|
</p>
|
|
35
38
|
</template>
|
|
36
|
-
<template #tab-head-third>
|
|
37
|
-
Third
|
|
38
|
-
</template>
|
|
39
|
-
<template #tab-panel-third>
|
|
40
|
-
<h2 class="title">Third Content</h2>
|
|
41
|
-
<p class="description">
|
|
42
|
-
Third description
|
|
43
|
-
</p>
|
|
44
|
-
</template>
|
|
45
39
|
</unnnic-tab>
|
|
46
40
|
`,
|
|
47
41
|
}),
|
|
@@ -50,7 +44,6 @@ export default {
|
|
|
50
44
|
export const Default = {
|
|
51
45
|
args: {
|
|
52
46
|
initialTab: 'first',
|
|
53
|
-
tabs: ['first', 'second'
|
|
54
|
-
disabledTabs: ['third'],
|
|
47
|
+
tabs: ['first', 'second'],
|
|
55
48
|
},
|
|
56
49
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import UnnnicTag from '../components/Tag/Tag.vue';
|
|
2
|
+
import colorsList from '../utils/colorsList';
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
title: 'Data Display/Tag',
|
|
@@ -7,30 +8,13 @@ export default {
|
|
|
7
8
|
argTypes: {
|
|
8
9
|
text: { control: { type: 'text' } },
|
|
9
10
|
type: {
|
|
10
|
-
control: 'select',
|
|
11
|
-
options: ['default', 'brand', 'next'],
|
|
11
|
+
control: { type: 'select', options: ['default', 'indicator', 'brand'] },
|
|
12
12
|
},
|
|
13
13
|
scheme: {
|
|
14
|
-
control:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'purple',
|
|
19
|
-
'red',
|
|
20
|
-
'orange',
|
|
21
|
-
'yellow',
|
|
22
|
-
'gray',
|
|
23
|
-
'teal',
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
size: {
|
|
27
|
-
control: 'select',
|
|
28
|
-
options: ['small', 'medium'],
|
|
29
|
-
},
|
|
30
|
-
hasCloseIcon: { control: 'boolean' },
|
|
31
|
-
leftIcon: {
|
|
32
|
-
control: 'select',
|
|
33
|
-
options: [null, 'check_circle', 'sentiment_satisfied'],
|
|
14
|
+
control: {
|
|
15
|
+
type: 'select',
|
|
16
|
+
options: colorsList,
|
|
17
|
+
},
|
|
34
18
|
},
|
|
35
19
|
},
|
|
36
20
|
};
|
|
@@ -50,10 +34,45 @@ export const LeftIcon = {
|
|
|
50
34
|
},
|
|
51
35
|
};
|
|
52
36
|
|
|
53
|
-
export const
|
|
37
|
+
export const RightIcon = {
|
|
54
38
|
args: {
|
|
55
39
|
text: 'Label',
|
|
56
40
|
type: 'default',
|
|
57
|
-
|
|
41
|
+
rightIcon: 'check_circle',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const CloseIcon = {
|
|
46
|
+
args: {
|
|
47
|
+
text: 'Label',
|
|
48
|
+
type: 'default',
|
|
49
|
+
hasCloseIcon: true,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Next = {
|
|
54
|
+
args: {
|
|
55
|
+
text: 'Label',
|
|
56
|
+
type: 'next',
|
|
57
|
+
scheme: 'weni',
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Indicator = {
|
|
62
|
+
args: {
|
|
63
|
+
text: 'Tag Name',
|
|
64
|
+
type: 'indicator',
|
|
65
|
+
count: 100,
|
|
66
|
+
clickable: true,
|
|
67
|
+
hasBackButton: false,
|
|
68
|
+
enableTooltip: true,
|
|
69
|
+
tooltipText: 'This is the amount',
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const Brand = {
|
|
74
|
+
args: {
|
|
75
|
+
text: 'Settings',
|
|
76
|
+
type: 'brand',
|
|
58
77
|
},
|
|
59
78
|
};
|
|
@@ -37,7 +37,6 @@ export const Default = {
|
|
|
37
37
|
errors: [],
|
|
38
38
|
size: 'md',
|
|
39
39
|
message: 'Helper text',
|
|
40
|
-
tooltip: 'Tooltip',
|
|
41
40
|
},
|
|
42
41
|
};
|
|
43
42
|
|
|
@@ -48,7 +47,7 @@ export const Error = {
|
|
|
48
47
|
maxLength: 150,
|
|
49
48
|
disabled: false,
|
|
50
49
|
type: 'error',
|
|
51
|
-
|
|
50
|
+
error: 'Error text',
|
|
52
51
|
size: 'md',
|
|
53
52
|
},
|
|
54
53
|
};
|
|
@@ -85,7 +84,7 @@ export const ErrorSm = {
|
|
|
85
84
|
maxLength: 150,
|
|
86
85
|
disabled: false,
|
|
87
86
|
type: 'error',
|
|
88
|
-
|
|
87
|
+
error: 'Error text',
|
|
89
88
|
size: 'sm',
|
|
90
89
|
},
|
|
91
90
|
};
|
|
@@ -101,14 +100,3 @@ export const DisabledSm = {
|
|
|
101
100
|
message: 'Helper text',
|
|
102
101
|
},
|
|
103
102
|
};
|
|
104
|
-
|
|
105
|
-
export const ResizeNone = {
|
|
106
|
-
args: {
|
|
107
|
-
label: 'Label',
|
|
108
|
-
placeholder: 'Placeholder',
|
|
109
|
-
maxLength: 150,
|
|
110
|
-
disabled: false,
|
|
111
|
-
type: 'normal',
|
|
112
|
-
resize: 'none',
|
|
113
|
-
},
|
|
114
|
-
};
|
package/src/utils/call.js
CHANGED
|
@@ -1,58 +1,30 @@
|
|
|
1
1
|
import { createApp } from 'vue';
|
|
2
2
|
import Alert from '../components/Alert/Alert.vue';
|
|
3
3
|
import Modal from '../components/Modal/Modal.vue';
|
|
4
|
-
import ToastInstance from '../components/Toast/ToastManager';
|
|
5
4
|
import mitt from 'mitt';
|
|
6
5
|
|
|
7
6
|
const emitter = mitt();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
|
|
8
|
+
const callAlert = ({ props, containerRef }) => {
|
|
9
|
+
const AlertComponent = createApp(Alert, {
|
|
10
|
+
...props,
|
|
11
|
+
onClose: () => {
|
|
12
|
+
instance.$el.remove();
|
|
13
|
+
},
|
|
14
|
+
created() {
|
|
15
|
+
emitter.on(['close'], () => {
|
|
15
16
|
instance.$el.remove();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
const element = document.createElement('div');
|
|
24
|
-
const instance = AlertComponent.mount(element);
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
const element = document.createElement('div');
|
|
21
|
+
const instance = AlertComponent.mount(element);
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} else {
|
|
30
|
-
document.body.appendChild(instance.$el);
|
|
31
|
-
}
|
|
23
|
+
if (containerRef) {
|
|
24
|
+
instance.$el.style.position = 'absolute';
|
|
25
|
+
containerRef.appendChild(instance.$el);
|
|
32
26
|
} else {
|
|
33
|
-
|
|
34
|
-
success: 'success',
|
|
35
|
-
error: 'error',
|
|
36
|
-
attention: 'attention',
|
|
37
|
-
default: 'informational',
|
|
38
|
-
'feedback-green': 'success',
|
|
39
|
-
'feedback-red': 'error',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const toastProps = {
|
|
43
|
-
timeout: seconds ? seconds * 1000 : 5000,
|
|
44
|
-
type: typeMap[props.scheme || props.type] || typeMap.default,
|
|
45
|
-
|
|
46
|
-
onClose: () => {
|
|
47
|
-
emitter.emit(['close']);
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
ToastInstance.show({
|
|
52
|
-
title: props.text,
|
|
53
|
-
description: '',
|
|
54
|
-
...toastProps,
|
|
55
|
-
});
|
|
27
|
+
document.body.appendChild(instance.$el);
|
|
56
28
|
}
|
|
57
29
|
};
|
|
58
30
|
|