@weni/unnnic-system 3.9.3-alpha.0 → 3.9.4
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 +12 -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 +1 -1
- package/dist/components/DataTable/index.vue.d.ts.map +1 -1
- package/dist/components/DateFilter/DateFilter.vue.d.ts +41 -251
- 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 -33
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +41 -251
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +25 -85
- package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +46 -256
- package/dist/components/InputNext/InputNext.vue.d.ts +5 -5
- 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 +46 -256
- 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 +470 -120
- 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 +25 -85
- 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 +33 -78
- 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 +7710 -6271
- 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-61b41785.mjs → es-8146fb1b.mjs} +1 -1
- package/dist/{index-10160248.mjs → index-724ed422.mjs} +8813 -9353
- package/dist/locales/en.json.d.ts +1 -2
- package/dist/locales/es.json.d.ts +1 -2
- package/dist/locales/pt_br.json.d.ts +1 -2
- package/dist/{pt-br-31a68683.mjs → pt-br-af294ec9.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +151 -158
- package/dist/unnnic.umd.js +36 -35
- package/dist/utils/call.d.ts +1 -2
- package/dist/utils/call.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/assets/scss/radii.scss +1 -1
- package/src/assets/scss/scheme-colors.scss +223 -309
- package/src/assets/tokens/radii.json +1 -1
- 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/FormElement/FormElement.vue +93 -63
- package/src/components/Icon.vue +0 -2
- package/src/components/Input/BaseInput.vue +14 -33
- package/src/components/Input/Input.scss +22 -22
- package/src/components/Input/Input.vue +56 -79
- package/src/components/Input/TextInput.vue +65 -81
- 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 +4 -17
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -7
- 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 +3 -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 +12 -41
- package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +3 -11
- package/src/components/index.ts +18 -33
- package/src/locales/en.json +1 -2
- package/src/locales/es.json +1 -2
- package/src/locales/pt_br.json +1 -2
- 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/Input.stories.js +76 -71
- package/src/stories/Label.stories.js +0 -7
- package/src/stories/Radio.stories.js +1 -28
- 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/MultiSelectV2/MultSelectOption.vue +0 -67
- package/src/components/MultiSelectV2/__tests__/MultiSelect.spec.js +0 -556
- package/src/components/MultiSelectV2/__tests__/MultiSelectOption.spec.js +0 -229
- 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/components/MultiSelectV2/index.vue +0 -221
- 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/Popover/__tests__/Popover.spec.js +0 -147
- package/src/components/Popover/__tests__/__snapshots__/Popover.spec.js.snap +0 -8
- package/src/components/Popover/index.vue +0 -146
- package/src/components/RadioGroup/RadioGroup.vue +0 -142
- package/src/components/Select/SelectOption.vue +0 -65
- package/src/components/Select/__tests__/Select.spec.js +0 -412
- package/src/components/Select/__tests__/SelectItem.spec.js +0 -330
- package/src/components/Select/__tests__/SelectOption.spec.js +0 -174
- package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +0 -97
- package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +0 -15
- package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +0 -25
- package/src/components/Select/index.vue +0 -249
- 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/MultiSelectV2.stories.js +0 -158
- package/src/stories/PageHeader.stories.js +0 -330
- package/src/stories/RadioGroup.stories.js +0 -144
- package/src/stories/Select.stories.js +0 -158
- package/src/stories/Toast.mdx +0 -123
- package/src/stories/Toast.stories.js +0 -126
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="unnnic-select"
|
|
4
|
-
@keydown="handleKeyDown"
|
|
5
|
-
>
|
|
6
|
-
<UnnnicPopover
|
|
7
|
-
v-model="openPopover"
|
|
8
|
-
:popoverBalloonProps="{ maxHeight: calculatedMaxHeight }"
|
|
9
|
-
>
|
|
10
|
-
<template #trigger>
|
|
11
|
-
<UnnnicInput
|
|
12
|
-
:modelValue="inputValue"
|
|
13
|
-
class="unnnic-select__input"
|
|
14
|
-
readonly
|
|
15
|
-
:forceActiveStatus="openPopover"
|
|
16
|
-
:size="props.size"
|
|
17
|
-
:placeholder="props.placeholder"
|
|
18
|
-
:label="props.label"
|
|
19
|
-
:errors="props.errors"
|
|
20
|
-
:message="props.message"
|
|
21
|
-
:iconRight="openPopover ? 'keyboard_arrow_up' : 'keyboard_arrow_down'"
|
|
22
|
-
:disabled="props.disabled"
|
|
23
|
-
showClear
|
|
24
|
-
@clear="emit('update:modelValue', '')"
|
|
25
|
-
/>
|
|
26
|
-
</template>
|
|
27
|
-
<template #content>
|
|
28
|
-
<div class="unnnic-select__content">
|
|
29
|
-
<UnnnicInput
|
|
30
|
-
v-if="props.enableSearch"
|
|
31
|
-
class="unnnic-select__input-search"
|
|
32
|
-
:modelValue="props.search"
|
|
33
|
-
:placeholder="$t('search')"
|
|
34
|
-
iconLeft="search"
|
|
35
|
-
@update:model-value="handleSearch"
|
|
36
|
-
/>
|
|
37
|
-
<UnnnicSelectOption
|
|
38
|
-
v-for="(option, index) in filteredOptions"
|
|
39
|
-
:key="option[props.itemValue]"
|
|
40
|
-
:data-option-index="index"
|
|
41
|
-
:label="option[props.itemLabel]"
|
|
42
|
-
:active="
|
|
43
|
-
option[props.itemValue] === selectedItem?.[props.itemValue]
|
|
44
|
-
"
|
|
45
|
-
:focused="focusedOptionIndex === index"
|
|
46
|
-
:disabled="option.disabled"
|
|
47
|
-
@click="handleSelectOption(option)"
|
|
48
|
-
/>
|
|
49
|
-
</div>
|
|
50
|
-
</template>
|
|
51
|
-
</UnnnicPopover>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
|
|
55
|
-
<script setup lang="ts">
|
|
56
|
-
import { computed, ref, watch, nextTick } from 'vue';
|
|
57
|
-
import UnnnicInput from '../Input/Input.vue';
|
|
58
|
-
import UnnnicPopover from '../Popover/index.vue';
|
|
59
|
-
import UnnnicSelectOption from './SelectOption.vue';
|
|
60
|
-
import UnnnicI18n from '../../mixins/i18n';
|
|
61
|
-
|
|
62
|
-
defineOptions({
|
|
63
|
-
name: 'UnnnicSelect',
|
|
64
|
-
mixins: [UnnnicI18n],
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
interface SelectProps {
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
|
-
options: Array<{ [key: string]: any }>;
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
|
-
modelValue: any;
|
|
72
|
-
returnObject?: boolean;
|
|
73
|
-
itemLabel?: string;
|
|
74
|
-
itemValue?: string;
|
|
75
|
-
placeholder?: string;
|
|
76
|
-
label?: string;
|
|
77
|
-
type?: 'normal' | 'error';
|
|
78
|
-
errors?: string | Array<string>;
|
|
79
|
-
message?: string;
|
|
80
|
-
size?: 'sm' | 'md';
|
|
81
|
-
optionsLines?: number;
|
|
82
|
-
enableSearch?: boolean;
|
|
83
|
-
search?: string;
|
|
84
|
-
locale?: string;
|
|
85
|
-
disabled?: boolean;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const props = withDefaults(defineProps<SelectProps>(), {
|
|
89
|
-
size: 'md',
|
|
90
|
-
type: 'normal',
|
|
91
|
-
placeholder: '',
|
|
92
|
-
optionsLines: 5,
|
|
93
|
-
returnObject: false,
|
|
94
|
-
itemLabel: 'label',
|
|
95
|
-
itemValue: 'value',
|
|
96
|
-
locale: 'en',
|
|
97
|
-
enableSearch: false,
|
|
98
|
-
disabled: false,
|
|
99
|
-
label: '',
|
|
100
|
-
errors: '',
|
|
101
|
-
message: '',
|
|
102
|
-
search: '',
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
const emit = defineEmits<{
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
|
-
'update:modelValue': [value: any];
|
|
108
|
-
'update:search': [value: string];
|
|
109
|
-
}>();
|
|
110
|
-
|
|
111
|
-
const openPopover = ref(false);
|
|
112
|
-
|
|
113
|
-
watch(openPopover, () => {
|
|
114
|
-
if (!openPopover.value) {
|
|
115
|
-
handleSearch('');
|
|
116
|
-
} else {
|
|
117
|
-
focusedOptionIndex.value = -1;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (openPopover.value && props.modelValue) {
|
|
121
|
-
const selectedOptionIndex = props.options.findIndex(
|
|
122
|
-
(option) =>
|
|
123
|
-
option[props.itemValue] === selectedItem.value?.[props.itemValue],
|
|
124
|
-
);
|
|
125
|
-
scrollToOption(selectedOptionIndex, 'instant', 'center');
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const handleKeyDown = (event) => {
|
|
130
|
-
const { key } = event;
|
|
131
|
-
const validKeys = ['ArrowUp', 'ArrowDown', 'Enter'];
|
|
132
|
-
if (validKeys.includes(key)) {
|
|
133
|
-
event.preventDefault();
|
|
134
|
-
if (key === 'ArrowUp') {
|
|
135
|
-
if (focusedOptionIndex.value === 0) return;
|
|
136
|
-
focusedOptionIndex.value--;
|
|
137
|
-
scrollToOption(focusedOptionIndex.value);
|
|
138
|
-
}
|
|
139
|
-
if (key === 'ArrowDown') {
|
|
140
|
-
if (focusedOptionIndex.value === filteredOptions.value.length - 1) return;
|
|
141
|
-
focusedOptionIndex.value++;
|
|
142
|
-
scrollToOption(focusedOptionIndex.value);
|
|
143
|
-
}
|
|
144
|
-
if (key === 'Enter') {
|
|
145
|
-
handleSelectOption(filteredOptions.value[focusedOptionIndex.value]);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const focusedOptionIndex = ref<number>(-1);
|
|
151
|
-
|
|
152
|
-
const scrollToOption = (
|
|
153
|
-
index: number,
|
|
154
|
-
behavior: 'smooth' | 'instant' = 'smooth',
|
|
155
|
-
block: 'center' | 'start' | 'end' | 'nearest' = 'center',
|
|
156
|
-
) => {
|
|
157
|
-
nextTick(() => {
|
|
158
|
-
const option = document.querySelector(`[data-option-index="${index}"]`);
|
|
159
|
-
if (option) {
|
|
160
|
-
option.scrollIntoView({ behavior, block });
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const calculatedMaxHeight = computed(() => {
|
|
166
|
-
if (!props.options || props.options.length === 0) return 'unset';
|
|
167
|
-
const popoverPadding = 32;
|
|
168
|
-
const popoverGap = 4;
|
|
169
|
-
// 37 = 21px (height) + 16px (padding)
|
|
170
|
-
const fieldsHeight = 37 * props.optionsLines;
|
|
171
|
-
const size =
|
|
172
|
-
fieldsHeight + popoverPadding + (popoverGap * props.optionsLines - 2);
|
|
173
|
-
return `${props.enableSearch ? size + 54 : size}px`;
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
const selectedItem = computed(() => {
|
|
177
|
-
if (props.returnObject) return props.modelValue;
|
|
178
|
-
|
|
179
|
-
return props.options.find(
|
|
180
|
-
(option) => option[props.itemValue] === props.modelValue,
|
|
181
|
-
);
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
const inputValue = computed(() => {
|
|
185
|
-
return selectedItem.value?.[props.itemLabel];
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
const handleSelectOption = (option) => {
|
|
189
|
-
if (
|
|
190
|
-
option[props.itemValue] === selectedItem.value?.[props.itemValue] ||
|
|
191
|
-
option.disabled
|
|
192
|
-
)
|
|
193
|
-
return;
|
|
194
|
-
|
|
195
|
-
emit(
|
|
196
|
-
'update:modelValue',
|
|
197
|
-
props.returnObject ? option : option[props.itemValue],
|
|
198
|
-
);
|
|
199
|
-
openPopover.value = false;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const handleSearch = (value: string) => {
|
|
203
|
-
emit('update:search', value);
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
const filteredOptions = computed(() => {
|
|
207
|
-
if (!props.enableSearch || !props.search) return props.options;
|
|
208
|
-
|
|
209
|
-
return props.options.filter(
|
|
210
|
-
(option) =>
|
|
211
|
-
option[props.itemLabel]
|
|
212
|
-
.toLowerCase()
|
|
213
|
-
.includes(props.search?.toLowerCase()) ||
|
|
214
|
-
option[props.itemValue]
|
|
215
|
-
.toLowerCase()
|
|
216
|
-
.includes(props.search?.toLowerCase()),
|
|
217
|
-
);
|
|
218
|
-
});
|
|
219
|
-
</script>
|
|
220
|
-
|
|
221
|
-
<style lang="scss" scoped>
|
|
222
|
-
@use '@/assets/scss/unnnic' as *;
|
|
223
|
-
|
|
224
|
-
:deep(.unnnic-select__input) {
|
|
225
|
-
cursor: pointer;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
:deep(.unnnic-select__input-search) {
|
|
229
|
-
> .icon-left {
|
|
230
|
-
color: $unnnic-color-fg-base;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
:deep(.unnnic-select__input) {
|
|
235
|
-
> .icon-right {
|
|
236
|
-
color: $unnnic-color-fg-base;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.unnnic-select {
|
|
241
|
-
&__content {
|
|
242
|
-
display: flex;
|
|
243
|
-
flex-direction: column;
|
|
244
|
-
padding: 0;
|
|
245
|
-
margin: 0;
|
|
246
|
-
gap: $unnnic-space-1;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
</style>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type TagType = 'default' | 'brand' | 'next';
|
|
2
|
-
export type TagSize = 'small' | 'medium';
|
|
3
|
-
|
|
4
|
-
export interface TagProps {
|
|
5
|
-
type?: TagType;
|
|
6
|
-
size?: TagSize;
|
|
7
|
-
text?: string;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
scheme?: string;
|
|
10
|
-
leftIcon?: string;
|
|
11
|
-
hasCloseIcon?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface DefaultTagProps {
|
|
15
|
-
text?: string;
|
|
16
|
-
size?: TagSize;
|
|
17
|
-
scheme?: string;
|
|
18
|
-
leftIcon?: string;
|
|
19
|
-
}
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Transition
|
|
3
|
-
name="toast-slide"
|
|
4
|
-
appear
|
|
5
|
-
data-testid="toast-transition"
|
|
6
|
-
@after-leave="$emit('destroy')"
|
|
7
|
-
>
|
|
8
|
-
<aside
|
|
9
|
-
v-if="isVisible"
|
|
10
|
-
:class="['unnnic-toast', `unnnic-toast--${type}`]"
|
|
11
|
-
:role="type === 'error' ? 'alert' : 'status'"
|
|
12
|
-
:aria-live="type === 'error' ? 'assertive' : 'polite'"
|
|
13
|
-
data-testid="toast"
|
|
14
|
-
>
|
|
15
|
-
<section
|
|
16
|
-
class="unnnic-toast__content"
|
|
17
|
-
data-testid="toast-content"
|
|
18
|
-
>
|
|
19
|
-
<header
|
|
20
|
-
class="unnnic-toast__header"
|
|
21
|
-
data-testid="toast-header"
|
|
22
|
-
>
|
|
23
|
-
<UnnnicIcon
|
|
24
|
-
:icon="typeConfig.icon"
|
|
25
|
-
:scheme="typeConfig.scheme"
|
|
26
|
-
size="ant"
|
|
27
|
-
data-testid="toast-type-icon"
|
|
28
|
-
/>
|
|
29
|
-
|
|
30
|
-
<h3
|
|
31
|
-
class="unnnic-toast__title"
|
|
32
|
-
data-testid="toast-title"
|
|
33
|
-
>
|
|
34
|
-
{{ title }}
|
|
35
|
-
</h3>
|
|
36
|
-
|
|
37
|
-
<UnnnicIcon
|
|
38
|
-
icon="close"
|
|
39
|
-
scheme="neutral-dark"
|
|
40
|
-
size="ant"
|
|
41
|
-
clickable
|
|
42
|
-
class="unnnic-toast__close"
|
|
43
|
-
data-testid="toast-close-icon"
|
|
44
|
-
@click="handleClose"
|
|
45
|
-
@keydown.enter="handleClose"
|
|
46
|
-
/>
|
|
47
|
-
</header>
|
|
48
|
-
|
|
49
|
-
<p
|
|
50
|
-
v-if="description"
|
|
51
|
-
data-testid="toast-text"
|
|
52
|
-
class="unnnic-toast__text"
|
|
53
|
-
>
|
|
54
|
-
{{ description }}
|
|
55
|
-
</p>
|
|
56
|
-
</section>
|
|
57
|
-
|
|
58
|
-
<UnnnicButton
|
|
59
|
-
v-if="button"
|
|
60
|
-
type="tertiary"
|
|
61
|
-
:text="button.text"
|
|
62
|
-
class="unnnic-toast__action-button"
|
|
63
|
-
data-testid="toast-action-button"
|
|
64
|
-
@click="handleAction"
|
|
65
|
-
@keydown.enter="handleAction"
|
|
66
|
-
@keydown.space.prevent="handleAction"
|
|
67
|
-
/>
|
|
68
|
-
</aside>
|
|
69
|
-
</Transition>
|
|
70
|
-
</template>
|
|
71
|
-
|
|
72
|
-
<script setup lang="ts">
|
|
73
|
-
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
|
74
|
-
|
|
75
|
-
import UnnnicIcon from '@/components/Icon.vue';
|
|
76
|
-
import UnnnicButton from '@/components/Button/Button.vue';
|
|
77
|
-
|
|
78
|
-
import type { ToastProps, ToastEmits } from './types';
|
|
79
|
-
import type { SchemeColor } from '@/types/scheme-colors';
|
|
80
|
-
|
|
81
|
-
defineOptions({
|
|
82
|
-
name: 'UnnnicToast',
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const props = withDefaults(defineProps<ToastProps>(), {
|
|
86
|
-
title: '',
|
|
87
|
-
description: '',
|
|
88
|
-
button: undefined,
|
|
89
|
-
timeout: 5000,
|
|
90
|
-
type: 'informational',
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const emit = defineEmits<ToastEmits>();
|
|
94
|
-
|
|
95
|
-
const isVisible = ref(false);
|
|
96
|
-
let timeoutId: number | null = null;
|
|
97
|
-
|
|
98
|
-
const typeConfig = computed(() => {
|
|
99
|
-
const configMap = {
|
|
100
|
-
informational: { icon: 'info', scheme: 'blue-500' },
|
|
101
|
-
attention: { icon: 'error', scheme: 'yellow-500' },
|
|
102
|
-
success: { icon: 'check_circle', scheme: 'green-500' },
|
|
103
|
-
error: { icon: 'cancel', scheme: 'red-500' },
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
return configMap[props.type || 'informational'] as {
|
|
107
|
-
icon: string;
|
|
108
|
-
scheme: SchemeColor;
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
const handleClose = () => {
|
|
113
|
-
isVisible.value = false;
|
|
114
|
-
emit('close');
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const handleAction = () => {
|
|
118
|
-
if (props.button?.action) {
|
|
119
|
-
props.button.action();
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const startTimeout = () => {
|
|
124
|
-
if (props.timeout > 0) {
|
|
125
|
-
timeoutId = window.setTimeout(() => {
|
|
126
|
-
handleClose();
|
|
127
|
-
}, props.timeout);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const stopTimeout = () => {
|
|
132
|
-
if (timeoutId) {
|
|
133
|
-
window.clearTimeout(timeoutId);
|
|
134
|
-
timeoutId = null;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
onMounted(() => {
|
|
139
|
-
isVisible.value = true;
|
|
140
|
-
startTimeout();
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
onUnmounted(() => {
|
|
144
|
-
stopTimeout();
|
|
145
|
-
});
|
|
146
|
-
</script>
|
|
147
|
-
|
|
148
|
-
<style lang="scss" scoped>
|
|
149
|
-
@use '@/assets/scss/unnnic' as *;
|
|
150
|
-
|
|
151
|
-
.unnnic-toast {
|
|
152
|
-
position: fixed;
|
|
153
|
-
bottom: $unnnic-space-4;
|
|
154
|
-
right: $unnnic-space-4;
|
|
155
|
-
z-index: 9999;
|
|
156
|
-
|
|
157
|
-
display: flex;
|
|
158
|
-
align-items: flex-end;
|
|
159
|
-
flex-direction: column;
|
|
160
|
-
gap: $unnnic-space-2;
|
|
161
|
-
|
|
162
|
-
min-width: 250px;
|
|
163
|
-
max-width: 450px;
|
|
164
|
-
padding: $unnnic-space-4;
|
|
165
|
-
|
|
166
|
-
border-radius: $unnnic-radius-2;
|
|
167
|
-
box-shadow: $unnnic-shadow-2;
|
|
168
|
-
border: 1px solid $unnnic-color-border-base;
|
|
169
|
-
|
|
170
|
-
&--informational {
|
|
171
|
-
border-color: $unnnic-color-border-info;
|
|
172
|
-
background-color: $unnnic-color-bg-info;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
&--attention {
|
|
176
|
-
border-color: $unnnic-color-border-warning;
|
|
177
|
-
background-color: $unnnic-color-bg-warning;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&--success {
|
|
181
|
-
border-color: $unnnic-color-border-success;
|
|
182
|
-
background-color: $unnnic-color-bg-success;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
&--error {
|
|
186
|
-
border-color: $unnnic-color-border-critical;
|
|
187
|
-
background-color: $unnnic-color-bg-critical;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
&__content,
|
|
191
|
-
&__header {
|
|
192
|
-
width: 100%;
|
|
193
|
-
|
|
194
|
-
display: flex;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
&__content {
|
|
198
|
-
flex-direction: column;
|
|
199
|
-
gap: $unnnic-space-1;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
&__header {
|
|
203
|
-
align-items: center;
|
|
204
|
-
gap: $unnnic-space-2;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
&__title {
|
|
208
|
-
flex: 1;
|
|
209
|
-
|
|
210
|
-
margin: 0;
|
|
211
|
-
|
|
212
|
-
font: $unnnic-font-action;
|
|
213
|
-
color: $unnnic-color-fg-emphasized;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
&__text {
|
|
217
|
-
margin: 0;
|
|
218
|
-
margin-left: $unnnic-space-7;
|
|
219
|
-
|
|
220
|
-
font: $unnnic-font-caption-2;
|
|
221
|
-
color: $unnnic-color-fg-emphasized;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Animations
|
|
226
|
-
.toast-slide-enter-active,
|
|
227
|
-
.toast-slide-leave-active {
|
|
228
|
-
transition: all 0.3s ease;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.toast-slide-enter-from {
|
|
232
|
-
transform: translateY(100%);
|
|
233
|
-
opacity: 0;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.toast-slide-leave-to {
|
|
237
|
-
transform: translateY(100%);
|
|
238
|
-
opacity: 0;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
.toast-slide-enter-to,
|
|
242
|
-
.toast-slide-leave-from {
|
|
243
|
-
transform: translateY(0);
|
|
244
|
-
opacity: 1;
|
|
245
|
-
}
|
|
246
|
-
</style>
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { createApp } from 'vue';
|
|
2
|
-
import Toast from './Toast.vue';
|
|
3
|
-
import type {
|
|
4
|
-
ToastProps,
|
|
5
|
-
ToastInstance,
|
|
6
|
-
ToastOptions,
|
|
7
|
-
ToastCall,
|
|
8
|
-
} from './types';
|
|
9
|
-
|
|
10
|
-
class ToastManager implements ToastManager {
|
|
11
|
-
private toasts: Map<string, ToastInstance> = new Map();
|
|
12
|
-
private container: HTMLElement | null = null;
|
|
13
|
-
private nextId = 0;
|
|
14
|
-
|
|
15
|
-
private createContainer(): HTMLElement {
|
|
16
|
-
if (this.container) {
|
|
17
|
-
return this.container;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
this.container = document.createElement('div');
|
|
21
|
-
this.container.setAttribute('unnnic-toast-container', 'true');
|
|
22
|
-
|
|
23
|
-
document.body.appendChild(this.container);
|
|
24
|
-
return this.container;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
private generateId(): string {
|
|
28
|
-
return `toast-${++this.nextId}`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
show(props: ToastProps): ToastInstance {
|
|
32
|
-
const id = this.generateId();
|
|
33
|
-
const container = this.createContainer();
|
|
34
|
-
|
|
35
|
-
const toastWrapper = document.createElement('div');
|
|
36
|
-
|
|
37
|
-
// Create promise that resolves when toast is destroyed
|
|
38
|
-
let resolvePromise: () => void;
|
|
39
|
-
const promise = new Promise<void>((resolve) => {
|
|
40
|
-
resolvePromise = resolve;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const app = createApp(Toast, {
|
|
44
|
-
...props,
|
|
45
|
-
onClose: () => {
|
|
46
|
-
this.close(id);
|
|
47
|
-
},
|
|
48
|
-
onDestroy: () => {
|
|
49
|
-
app.unmount();
|
|
50
|
-
toastWrapper.remove();
|
|
51
|
-
resolvePromise(); // Resolve the promise when toast is destroyed
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
app.mount(toastWrapper);
|
|
56
|
-
container.appendChild(toastWrapper);
|
|
57
|
-
|
|
58
|
-
const toastInstance: ToastInstance = {
|
|
59
|
-
id,
|
|
60
|
-
props,
|
|
61
|
-
close: () => this.close(id),
|
|
62
|
-
promise,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
this.toasts.set(id, toastInstance);
|
|
66
|
-
return toastInstance;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
close(id: string): void {
|
|
70
|
-
const toast = this.toasts.get(id);
|
|
71
|
-
if (toast) {
|
|
72
|
-
this.toasts.delete(id);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const toastManager = new ToastManager();
|
|
78
|
-
|
|
79
|
-
export const toast: ToastCall = {
|
|
80
|
-
info: (title: string, description?: string, options?: ToastOptions) =>
|
|
81
|
-
toastManager.show({
|
|
82
|
-
title,
|
|
83
|
-
description,
|
|
84
|
-
...options,
|
|
85
|
-
type: 'informational',
|
|
86
|
-
}).promise,
|
|
87
|
-
success: (title: string, description?: string, options?: ToastOptions) =>
|
|
88
|
-
toastManager.show({
|
|
89
|
-
title,
|
|
90
|
-
description,
|
|
91
|
-
...options,
|
|
92
|
-
type: 'success',
|
|
93
|
-
}).promise,
|
|
94
|
-
attention: (title: string, description?: string, options?: ToastOptions) =>
|
|
95
|
-
toastManager.show({
|
|
96
|
-
title,
|
|
97
|
-
description,
|
|
98
|
-
...options,
|
|
99
|
-
type: 'attention',
|
|
100
|
-
}).promise,
|
|
101
|
-
error: (title: string, description?: string, options?: ToastOptions) =>
|
|
102
|
-
toastManager.show({
|
|
103
|
-
title,
|
|
104
|
-
description,
|
|
105
|
-
...options,
|
|
106
|
-
type: 'error',
|
|
107
|
-
}).promise,
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export default toastManager;
|