@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
|
@@ -1,45 +1,29 @@
|
|
|
1
1
|
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
2
|
<template>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'unnnic-radio__label',
|
|
23
|
-
{ 'unnnic-radio__label--disabled': disabled },
|
|
24
|
-
]"
|
|
25
|
-
>
|
|
26
|
-
{{ label }}
|
|
27
|
-
<slot />
|
|
28
|
-
</p>
|
|
29
|
-
|
|
30
|
-
<footer
|
|
31
|
-
v-if="helper"
|
|
32
|
-
class="unnnic-radio__helper"
|
|
33
|
-
>
|
|
34
|
-
{{ helper }}
|
|
35
|
-
</footer>
|
|
36
|
-
</label>
|
|
37
|
-
</section>
|
|
3
|
+
<div
|
|
4
|
+
:class="[
|
|
5
|
+
'unnnic-radio-container',
|
|
6
|
+
`unnnic-radio-container--${size}`,
|
|
7
|
+
disabled ? 'disabled' : null,
|
|
8
|
+
]"
|
|
9
|
+
@click="click"
|
|
10
|
+
>
|
|
11
|
+
<UnnnicIcon
|
|
12
|
+
class="unnnic-radio"
|
|
13
|
+
:icon="icon"
|
|
14
|
+
:scheme="color"
|
|
15
|
+
:size="size"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<span class="label">
|
|
19
|
+
<slot />
|
|
20
|
+
</span>
|
|
21
|
+
</div>
|
|
38
22
|
</template>
|
|
39
23
|
|
|
40
24
|
<script setup>
|
|
41
|
-
import {
|
|
42
|
-
import
|
|
25
|
+
import { computed } from 'vue';
|
|
26
|
+
import UnnnicIcon from '../Icon.vue';
|
|
43
27
|
|
|
44
28
|
const props = defineProps({
|
|
45
29
|
modelValue: {
|
|
@@ -54,115 +38,79 @@ const props = defineProps({
|
|
|
54
38
|
type: Boolean,
|
|
55
39
|
default: false,
|
|
56
40
|
},
|
|
57
|
-
|
|
58
|
-
type: String,
|
|
59
|
-
default: '',
|
|
60
|
-
},
|
|
61
|
-
name: {
|
|
62
|
-
type: String,
|
|
63
|
-
default: '',
|
|
64
|
-
},
|
|
65
|
-
helper: {
|
|
41
|
+
size: {
|
|
66
42
|
type: String,
|
|
67
|
-
default: '',
|
|
43
|
+
default: 'md',
|
|
44
|
+
validator(value) {
|
|
45
|
+
return ['md', 'sm'].includes(value);
|
|
46
|
+
},
|
|
68
47
|
},
|
|
69
48
|
});
|
|
70
49
|
|
|
71
50
|
const emit = defineEmits(['update:modelValue']);
|
|
72
51
|
|
|
73
|
-
const
|
|
74
|
-
|
|
52
|
+
const valueName = computed(() =>
|
|
53
|
+
props.modelValue === props.value ? 'selected' : 'default',
|
|
54
|
+
);
|
|
55
|
+
const icon = computed(
|
|
56
|
+
() =>
|
|
57
|
+
({
|
|
58
|
+
selected: 'radio-selected',
|
|
59
|
+
default: props.disabled ? 'radio-disable' : 'radio-default',
|
|
60
|
+
})[valueName.value],
|
|
61
|
+
);
|
|
62
|
+
const color = computed(() => {
|
|
63
|
+
if (props.disabled) {
|
|
64
|
+
return 'brand-sec';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return valueName.value === 'selected' ? 'brand-weni' : 'neutral-cleanest';
|
|
68
|
+
});
|
|
75
69
|
|
|
76
70
|
function click() {
|
|
77
71
|
if (!props.disabled) {
|
|
78
72
|
emit('update:modelValue', props.value);
|
|
79
|
-
|
|
80
|
-
if (contextModelValue) {
|
|
81
|
-
contextModelValue.value = props.value;
|
|
82
|
-
}
|
|
83
73
|
}
|
|
84
74
|
}
|
|
85
|
-
|
|
86
|
-
const computedModelValue = computed(() => {
|
|
87
|
-
return contextModelValue?.value || props.modelValue;
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const computedName = computed(() => {
|
|
91
|
-
return contextName?.value || props.name;
|
|
92
|
-
});
|
|
93
75
|
</script>
|
|
94
76
|
|
|
95
77
|
<style lang="scss" scoped>
|
|
96
78
|
@use '@/assets/scss/unnnic' as *;
|
|
97
79
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
.unnnic-radio {
|
|
80
|
+
.unnnic-radio-container {
|
|
101
81
|
display: inline-flex;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
&__input-wrapper {
|
|
105
|
-
width: fit-content;
|
|
106
|
-
|
|
107
|
-
display: grid;
|
|
108
|
-
grid-template-columns: $radio-size auto;
|
|
109
|
-
grid-template-rows: auto auto;
|
|
110
|
-
align-items: center;
|
|
111
|
-
column-gap: $unnnic-space-2;
|
|
82
|
+
align-items: center;
|
|
112
83
|
|
|
84
|
+
&:not(.disabled) {
|
|
113
85
|
cursor: pointer;
|
|
114
|
-
|
|
115
|
-
&--disabled {
|
|
116
|
-
cursor: not-allowed;
|
|
117
|
-
}
|
|
118
86
|
}
|
|
119
87
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
min-width: $radio-size;
|
|
123
|
-
width: $radio-size;
|
|
124
|
-
height: $radio-size;
|
|
125
|
-
margin: 0;
|
|
126
|
-
background-color: $unnnic-color-bg-base;
|
|
127
|
-
border: 1px solid $unnnic-color-border-base;
|
|
128
|
-
border-radius: $unnnic-radius-full;
|
|
129
|
-
box-sizing: border-box;
|
|
130
|
-
outline: none;
|
|
131
|
-
|
|
132
|
-
cursor: pointer;
|
|
133
|
-
|
|
134
|
-
&:checked {
|
|
135
|
-
border-width: 0;
|
|
136
|
-
background-color: $unnnic-color-bg-active;
|
|
137
|
-
background-image: url('@/assets/icons/radio-checked.svg');
|
|
138
|
-
background-position: center;
|
|
139
|
-
background-repeat: no-repeat;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
&:disabled {
|
|
143
|
-
background-color: $unnnic-color-bg-muted;
|
|
144
|
-
border: 1px solid $unnnic-color-border-muted;
|
|
145
|
-
|
|
146
|
-
cursor: not-allowed;
|
|
147
|
-
}
|
|
88
|
+
&--sm .unnnic-radio {
|
|
89
|
+
margin: $unnnic-spacing-stack-nano $unnnic-spacing-inline-nano;
|
|
148
90
|
}
|
|
149
91
|
|
|
150
|
-
|
|
151
|
-
margin: 0;
|
|
152
|
-
|
|
153
|
-
|
|
92
|
+
&--md .unnnic-radio {
|
|
93
|
+
margin: $unnnic-spacing-stack-nano 0;
|
|
94
|
+
margin-left: $unnnic-spacing-inline-nano;
|
|
95
|
+
margin-right: $unnnic-spacing-inline-xs;
|
|
96
|
+
}
|
|
154
97
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
98
|
+
.label {
|
|
99
|
+
font-family: $unnnic-font-family-secondary;
|
|
100
|
+
font-weight: $unnnic-font-weight-regular;
|
|
101
|
+
color: $unnnic-color-neutral-darkest;
|
|
102
|
+
margin: $unnnic-spacing-stack-nano 0;
|
|
103
|
+
margin-right: $unnnic-spacing-inline-nano;
|
|
158
104
|
}
|
|
159
105
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
106
|
+
&--sm .label {
|
|
107
|
+
font-size: $unnnic-font-size-body-md;
|
|
108
|
+
line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
|
|
109
|
+
}
|
|
163
110
|
|
|
164
|
-
|
|
165
|
-
|
|
111
|
+
&--md .label {
|
|
112
|
+
font-size: $unnnic-font-size-body-gt;
|
|
113
|
+
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
|
|
166
114
|
}
|
|
167
115
|
}
|
|
168
116
|
</style>
|
|
@@ -33,35 +33,41 @@ describe('Radio.vue', () => {
|
|
|
33
33
|
expect(wrapper.exists()).toBe(true);
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
test('renders
|
|
37
|
-
const
|
|
38
|
-
expect(
|
|
39
|
-
expect(
|
|
40
|
-
expect(
|
|
41
|
-
expect(
|
|
36
|
+
test('renders UnnnicIcon component with correct props', () => {
|
|
37
|
+
const unnnicIcon = wrapper.findComponent(UnnnicIcon);
|
|
38
|
+
expect(unnnicIcon.exists()).toBe(true);
|
|
39
|
+
expect(unnnicIcon.props('icon')).toBe('radio-default');
|
|
40
|
+
expect(unnnicIcon.props('scheme')).toBe('neutral-cleanest');
|
|
41
|
+
expect(unnnicIcon.props('size')).toBe('md');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test('applies the correct size class', async () => {
|
|
45
|
+
expect(wrapper.classes()).toContain('unnnic-radio-container--md');
|
|
46
|
+
|
|
47
|
+
await wrapper.setProps({ size: 'sm' });
|
|
48
|
+
expect(wrapper.classes()).toContain('unnnic-radio-container--sm');
|
|
42
49
|
});
|
|
43
50
|
|
|
44
51
|
test('applies disabled class when disabled prop is true', async () => {
|
|
45
52
|
await wrapper.setProps({ disabled: true });
|
|
46
|
-
expect(wrapper.
|
|
47
|
-
'unnnic-radio__label--disabled',
|
|
48
|
-
);
|
|
53
|
+
expect(wrapper.classes()).toContain('disabled');
|
|
49
54
|
});
|
|
50
55
|
|
|
51
56
|
test('icon changes based on valueName', async () => {
|
|
52
57
|
await wrapper.setProps({ modelValue: 'option1' });
|
|
53
|
-
const
|
|
54
|
-
expect(
|
|
58
|
+
const unnnicIcon = wrapper.findComponent(UnnnicIcon);
|
|
59
|
+
expect(unnnicIcon.props('icon')).toBe('radio-selected');
|
|
55
60
|
});
|
|
56
61
|
|
|
57
62
|
test('icon and color change when disabled is true', async () => {
|
|
58
63
|
await wrapper.setProps({ disabled: true });
|
|
59
|
-
const
|
|
60
|
-
expect(
|
|
64
|
+
const unnnicIcon = wrapper.findComponent(UnnnicIcon);
|
|
65
|
+
expect(unnnicIcon.props('icon')).toBe('radio-disable');
|
|
66
|
+
expect(unnnicIcon.props('scheme')).toBe('brand-sec');
|
|
61
67
|
});
|
|
62
68
|
|
|
63
69
|
test('emits update:modelValue with correct value when clicked and not disabled', async () => {
|
|
64
|
-
await wrapper.
|
|
70
|
+
await wrapper.trigger('click');
|
|
65
71
|
expect(wrapper.emitted('update:modelValue')).toBeTruthy();
|
|
66
72
|
expect(wrapper.emitted('update:modelValue')[0]).toEqual(['option1']);
|
|
67
73
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
3
|
exports[`Radio.vue > matches the snapshot 1`] = `
|
|
4
|
-
"<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
</label></section>"
|
|
4
|
+
"<div data-v-38c6bf5e="" class="unnnic-radio-container unnnic-radio-container--md"><svg data-v-26446d8e="" data-v-38c6bf5e="" width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" class="unnnic-icon unnnic-icon--size-svg-md unnnic-icon__size--md unnnic-icon-scheme--neutral-cleanest unnnic-radio" data-testid="custom-icon">
|
|
5
|
+
<circle cx="20" cy="20.0005" r="14.5" stroke="#3B414D" class="primary-stroke"></circle>
|
|
6
|
+
</svg><span data-v-38c6bf5e="" class="label">Option 1</span></div>"
|
|
8
7
|
`;
|
|
@@ -74,30 +74,42 @@
|
|
|
74
74
|
scheme="neutral-dark"
|
|
75
75
|
size="sm"
|
|
76
76
|
/>
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
77
|
+
<template v-else>
|
|
78
|
+
<SelectSmartOption
|
|
79
|
+
v-for="(option, index) in filterOptions(options)"
|
|
80
|
+
:key="option.value"
|
|
81
|
+
data-testid="option"
|
|
82
|
+
:label="option.label"
|
|
83
|
+
:description="option.description"
|
|
84
|
+
:tabindex="index"
|
|
85
|
+
:size="size"
|
|
86
|
+
:active="
|
|
87
|
+
option.value === modelValue || optionIsSelected(option)
|
|
88
|
+
"
|
|
89
|
+
:disabled="optionIsSelected(option) && option.disableRemove"
|
|
90
|
+
:focused="
|
|
91
|
+
focusedOption && focusedOption.value === option.value
|
|
92
|
+
"
|
|
93
|
+
:allowCheckbox="!!multiple"
|
|
94
|
+
:activeColor="type === 'secondary' ? 'secondary' : 'primary'"
|
|
95
|
+
@click="handleSelect(option)"
|
|
96
|
+
/>
|
|
97
|
+
<div
|
|
98
|
+
v-if="infiniteScroll && infiniteScrollLoading"
|
|
99
|
+
class="unnnic-select-smart__options-infinite-loading"
|
|
100
|
+
>
|
|
101
|
+
<UnnnicIconLoading
|
|
102
|
+
scheme="neutral-dark"
|
|
103
|
+
size="sm"
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
<p
|
|
107
|
+
v-if="filterOptions(options).length === 0"
|
|
108
|
+
class="unnnic-select-smart__options--no-results"
|
|
109
|
+
>
|
|
110
|
+
{{ i18n('without_results') }}
|
|
111
|
+
</p>
|
|
112
|
+
</template>
|
|
101
113
|
</div>
|
|
102
114
|
</div>
|
|
103
115
|
</div>
|
|
@@ -108,6 +120,7 @@
|
|
|
108
120
|
|
|
109
121
|
<script>
|
|
110
122
|
import { vOnClickOutside } from '@vueuse/components';
|
|
123
|
+
import { useInfiniteScroll } from '@vueuse/core';
|
|
111
124
|
|
|
112
125
|
import SelectSmartOption from './SelectSmartOption.vue';
|
|
113
126
|
import SelectSmartMultipleHeader from './SelectSmartMultipleHeader.vue';
|
|
@@ -212,6 +225,22 @@ export default {
|
|
|
212
225
|
type: [Number, null],
|
|
213
226
|
default: null,
|
|
214
227
|
},
|
|
228
|
+
infiniteScroll: {
|
|
229
|
+
type: Boolean,
|
|
230
|
+
default: false,
|
|
231
|
+
},
|
|
232
|
+
infiniteScrollDistance: {
|
|
233
|
+
type: Number,
|
|
234
|
+
default: 10,
|
|
235
|
+
},
|
|
236
|
+
infiniteScrollCanLoadMore: {
|
|
237
|
+
type: Function,
|
|
238
|
+
default: () => true,
|
|
239
|
+
},
|
|
240
|
+
disableInternalFilter: {
|
|
241
|
+
type: Boolean,
|
|
242
|
+
default: false,
|
|
243
|
+
},
|
|
215
244
|
},
|
|
216
245
|
|
|
217
246
|
emits: [
|
|
@@ -219,6 +248,7 @@ export default {
|
|
|
219
248
|
'onChange',
|
|
220
249
|
'update:modelValue',
|
|
221
250
|
'onActiveChange',
|
|
251
|
+
'scroll-end',
|
|
222
252
|
],
|
|
223
253
|
|
|
224
254
|
data() {
|
|
@@ -232,6 +262,9 @@ export default {
|
|
|
232
262
|
|
|
233
263
|
multipleSelectedsTags: 2,
|
|
234
264
|
|
|
265
|
+
infiniteScrollReset: null,
|
|
266
|
+
infiniteScrollLoading: false,
|
|
267
|
+
|
|
235
268
|
defaultTranslations: {
|
|
236
269
|
without_results: {
|
|
237
270
|
'pt-br': 'Nenhum resultado encontrado',
|
|
@@ -318,6 +351,10 @@ export default {
|
|
|
318
351
|
this.scrollToOption(activeOptionIndex, 'center');
|
|
319
352
|
}
|
|
320
353
|
}
|
|
354
|
+
|
|
355
|
+
if (newValue && this.infiniteScroll) {
|
|
356
|
+
this.setupInfiniteScroll();
|
|
357
|
+
}
|
|
321
358
|
});
|
|
322
359
|
},
|
|
323
360
|
|
|
@@ -368,9 +405,62 @@ export default {
|
|
|
368
405
|
) {
|
|
369
406
|
this.selectOption(this.options?.[0]);
|
|
370
407
|
}
|
|
408
|
+
|
|
409
|
+
this.setupInfiniteScroll();
|
|
410
|
+
},
|
|
411
|
+
|
|
412
|
+
beforeUnmount() {
|
|
413
|
+
if (this.infiniteScrollReset) {
|
|
414
|
+
this.infiniteScrollReset();
|
|
415
|
+
}
|
|
371
416
|
},
|
|
372
417
|
|
|
373
418
|
methods: {
|
|
419
|
+
setupInfiniteScroll() {
|
|
420
|
+
if (!this.infiniteScroll) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
this.$nextTick(() => {
|
|
425
|
+
const scrollElement = this.$refs.selectSmartOptionsScrollArea;
|
|
426
|
+
|
|
427
|
+
if (!scrollElement) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
const { reset } = useInfiniteScroll(
|
|
432
|
+
scrollElement,
|
|
433
|
+
() => {
|
|
434
|
+
if (!this.infiniteScrollLoading) {
|
|
435
|
+
this.infiniteScrollLoading = true;
|
|
436
|
+
this.$emit('scroll-end');
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
distance: this.infiniteScrollDistance,
|
|
441
|
+
canLoadMore: () => {
|
|
442
|
+
return (
|
|
443
|
+
this.infiniteScrollCanLoadMore() && !this.infiniteScrollLoading
|
|
444
|
+
);
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
this.infiniteScrollReset = reset;
|
|
450
|
+
});
|
|
451
|
+
},
|
|
452
|
+
|
|
453
|
+
finishInfiniteScroll() {
|
|
454
|
+
this.infiniteScrollLoading = false;
|
|
455
|
+
},
|
|
456
|
+
|
|
457
|
+
resetInfiniteScroll() {
|
|
458
|
+
this.infiniteScrollLoading = false;
|
|
459
|
+
if (this.infiniteScrollReset) {
|
|
460
|
+
this.infiniteScrollReset();
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
|
|
374
464
|
optionIsSelected(option) {
|
|
375
465
|
return this.modelValue.some(
|
|
376
466
|
(selectedOption) => selectedOption.value === option.value,
|
|
@@ -421,6 +511,10 @@ export default {
|
|
|
421
511
|
},
|
|
422
512
|
|
|
423
513
|
filterOptions(options) {
|
|
514
|
+
if (this.disableInternalFilter) {
|
|
515
|
+
return options;
|
|
516
|
+
}
|
|
517
|
+
|
|
424
518
|
const searchValue = this.searchValue.toLowerCase();
|
|
425
519
|
|
|
426
520
|
const searchTerms = searchValue
|
|
@@ -636,10 +730,9 @@ export default {
|
|
|
636
730
|
|
|
637
731
|
margin-top: $unnnic-spacing-nano;
|
|
638
732
|
|
|
639
|
-
border-radius: $unnnic-radius-
|
|
640
|
-
border: 1px solid $unnnic-color-border-base;
|
|
733
|
+
border-radius: $unnnic-border-radius-sm;
|
|
641
734
|
|
|
642
|
-
box-shadow: $unnnic-shadow-
|
|
735
|
+
box-shadow: $unnnic-shadow-level-near;
|
|
643
736
|
|
|
644
737
|
background-color: $unnnic-color-background-snow;
|
|
645
738
|
|
|
@@ -649,6 +742,14 @@ export default {
|
|
|
649
742
|
justify-self: center;
|
|
650
743
|
}
|
|
651
744
|
|
|
745
|
+
&-infinite-loading {
|
|
746
|
+
display: flex;
|
|
747
|
+
justify-content: center;
|
|
748
|
+
align-items: center;
|
|
749
|
+
padding: $unnnic-spacing-xs 0;
|
|
750
|
+
min-height: 40px;
|
|
751
|
+
}
|
|
752
|
+
|
|
652
753
|
&__scroll-area {
|
|
653
754
|
@function calc-max-height($value) {
|
|
654
755
|
@return ($value * $unnnic-font-size) - ($unnnic-spacing-xs * 2);
|
|
@@ -656,7 +757,7 @@ export default {
|
|
|
656
757
|
|
|
657
758
|
display: grid;
|
|
658
759
|
|
|
659
|
-
margin: $unnnic-
|
|
760
|
+
margin: $unnnic-spacing-xs;
|
|
660
761
|
margin-right: $unnnic-inline-xs;
|
|
661
762
|
padding-right: $unnnic-inline-xs;
|
|
662
763
|
|