@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,49 +1,37 @@
|
|
|
1
1
|
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
2
|
<template>
|
|
3
|
-
<
|
|
4
|
-
<
|
|
3
|
+
<div class="unnnic-checkbox-wrapper">
|
|
4
|
+
<UnnnicIcon
|
|
5
|
+
class="unnnic-checkbox"
|
|
6
|
+
:class="{ disabled }"
|
|
7
|
+
:icon="icon"
|
|
8
|
+
:scheme="color"
|
|
9
|
+
:clickable="!disabled"
|
|
10
|
+
:size="size"
|
|
11
|
+
@click="click"
|
|
12
|
+
/>
|
|
13
|
+
|
|
14
|
+
<div
|
|
15
|
+
v-if="textRight"
|
|
5
16
|
:class="[
|
|
6
|
-
'unnnic-
|
|
7
|
-
|
|
17
|
+
'unnnic-checkbox__label',
|
|
18
|
+
'unnnic-checkbox__label__right',
|
|
19
|
+
`unnnic-checkbox__label__${size}`,
|
|
8
20
|
]"
|
|
21
|
+
data-testid="checkbox-text-right"
|
|
9
22
|
>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{ 'unnnic-checkbox__input--less': modelValue === 'less' },
|
|
14
|
-
]"
|
|
15
|
-
type="checkbox"
|
|
16
|
-
:disabled="disabled"
|
|
17
|
-
:checked="modelValue === 'less' || modelValue"
|
|
18
|
-
@change="click"
|
|
19
|
-
v-bind="pick($attrs, ['id', 'name'])"
|
|
20
|
-
/>
|
|
21
|
-
|
|
22
|
-
<p
|
|
23
|
-
v-if="label || textRight"
|
|
24
|
-
:class="[
|
|
25
|
-
'unnnic-checkbox__label',
|
|
26
|
-
{ 'unnnic-checkbox__label--disabled': disabled },
|
|
27
|
-
]"
|
|
28
|
-
data-testid="checkbox-text-right"
|
|
29
|
-
>
|
|
30
|
-
{{ label || textRight }}
|
|
31
|
-
</p>
|
|
32
|
-
</label>
|
|
33
|
-
|
|
34
|
-
<p
|
|
35
|
-
v-if="helper"
|
|
36
|
-
class="unnnic-checkbox__helper"
|
|
37
|
-
>
|
|
38
|
-
{{ helper }}
|
|
39
|
-
</p>
|
|
40
|
-
</section>
|
|
23
|
+
{{ textRight }}
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
41
26
|
</template>
|
|
42
27
|
|
|
43
28
|
<script>
|
|
44
|
-
import
|
|
29
|
+
import UnnnicIcon from '../Icon.vue';
|
|
45
30
|
|
|
46
31
|
export default {
|
|
32
|
+
components: {
|
|
33
|
+
UnnnicIcon,
|
|
34
|
+
},
|
|
47
35
|
model: {
|
|
48
36
|
event: 'change',
|
|
49
37
|
},
|
|
@@ -62,16 +50,13 @@ export default {
|
|
|
62
50
|
default: false,
|
|
63
51
|
},
|
|
64
52
|
|
|
65
|
-
|
|
66
|
-
type: String,
|
|
67
|
-
default: '',
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
helper: {
|
|
53
|
+
size: {
|
|
71
54
|
type: String,
|
|
72
|
-
default: '',
|
|
55
|
+
default: 'md',
|
|
56
|
+
validator(value) {
|
|
57
|
+
return ['md', 'sm'].includes(value);
|
|
58
|
+
},
|
|
73
59
|
},
|
|
74
|
-
|
|
75
60
|
textRight: {
|
|
76
61
|
type: String,
|
|
77
62
|
default: '',
|
|
@@ -90,11 +75,25 @@ export default {
|
|
|
90
75
|
|
|
91
76
|
return 'less';
|
|
92
77
|
},
|
|
78
|
+
|
|
79
|
+
icon() {
|
|
80
|
+
return {
|
|
81
|
+
checked: 'checkbox-select',
|
|
82
|
+
default: this.disabled ? 'checkbox-disable' : 'checkbox-default',
|
|
83
|
+
less: 'checkbox-less',
|
|
84
|
+
}[this.valueName];
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
color() {
|
|
88
|
+
if (this.valueName === 'default') {
|
|
89
|
+
return 'neutral-clean';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return 'brand-weni';
|
|
93
|
+
},
|
|
93
94
|
},
|
|
94
95
|
|
|
95
96
|
methods: {
|
|
96
|
-
pick,
|
|
97
|
-
|
|
98
97
|
click() {
|
|
99
98
|
const isChecked = ['checked', 'less'].includes(this.valueName);
|
|
100
99
|
this.$emit('change', !isChecked);
|
|
@@ -107,86 +106,35 @@ export default {
|
|
|
107
106
|
<style lang="scss" scoped>
|
|
108
107
|
@use '@/assets/scss/unnnic' as *;
|
|
109
108
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
.unnnic-checkbox {
|
|
109
|
+
.unnnic-checkbox-wrapper {
|
|
113
110
|
display: flex;
|
|
114
|
-
flex-direction: column;
|
|
115
111
|
align-items: flex-start;
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
}
|
|
116
114
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
align-items: center;
|
|
122
|
-
column-gap: $unnnic-space-2;
|
|
123
|
-
|
|
124
|
-
cursor: pointer;
|
|
125
|
-
|
|
126
|
-
&--disabled {
|
|
127
|
-
cursor: not-allowed;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
&__input {
|
|
132
|
-
appearance: none;
|
|
133
|
-
width: $checkbox-size;
|
|
134
|
-
min-width: $checkbox-size;
|
|
135
|
-
height: $checkbox-size;
|
|
136
|
-
margin: 0;
|
|
137
|
-
background-color: $unnnic-color-bg-base;
|
|
138
|
-
border: 1px solid $unnnic-color-border-base;
|
|
139
|
-
border-radius: $unnnic-radius-1;
|
|
140
|
-
box-sizing: border-box;
|
|
141
|
-
|
|
142
|
-
outline: none;
|
|
143
|
-
|
|
144
|
-
cursor: pointer;
|
|
145
|
-
|
|
146
|
-
&:checked {
|
|
147
|
-
border-width: 0;
|
|
148
|
-
background-color: $unnnic-color-bg-active;
|
|
149
|
-
background-image: url('../../assets/icons/checkbox-checked.svg');
|
|
150
|
-
background-repeat: no-repeat;
|
|
151
|
-
background-position: center;
|
|
152
|
-
|
|
153
|
-
&.unnnic-checkbox__input--less {
|
|
154
|
-
background-image: url('../../assets/icons/checkbox-less.svg');
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
&:disabled,
|
|
159
|
-
&:disabled:checked {
|
|
160
|
-
background-color: $unnnic-color-bg-muted;
|
|
161
|
-
border: 1px solid $unnnic-color-border-muted;
|
|
162
|
-
|
|
163
|
-
cursor: not-allowed;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
&:disabled:checked {
|
|
167
|
-
background-image: url('../../assets/icons/checkbox-checked-disabled.svg');
|
|
168
|
-
|
|
169
|
-
&.unnnic-checkbox__input--less {
|
|
170
|
-
background-image: url('../../assets/icons/checkbox-less-disabled.svg');
|
|
171
|
-
}
|
|
115
|
+
.unnnic-checkbox {
|
|
116
|
+
&.disabled {
|
|
117
|
+
:deep(.primary) {
|
|
118
|
+
fill: $unnnic-color-neutral-cleanest;
|
|
172
119
|
}
|
|
173
120
|
}
|
|
121
|
+
}
|
|
174
122
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
123
|
+
.unnnic-checkbox__label {
|
|
124
|
+
font-family: $unnnic-font-family-secondary;
|
|
125
|
+
font-weight: $unnnic-font-weight-regular;
|
|
126
|
+
color: $unnnic-color-neutral-darkest;
|
|
179
127
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
128
|
+
&__sm {
|
|
129
|
+
margin-left: $unnnic-inline-nano;
|
|
130
|
+
font-size: $unnnic-font-size-body-md;
|
|
131
|
+
line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
|
|
183
132
|
}
|
|
184
133
|
|
|
185
|
-
&
|
|
186
|
-
margin:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
color: $unnnic-color-fg-base;
|
|
134
|
+
&__md {
|
|
135
|
+
margin-left: $unnnic-inline-xs;
|
|
136
|
+
font-size: $unnnic-font-size-body-gt;
|
|
137
|
+
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
|
|
190
138
|
}
|
|
191
139
|
}
|
|
192
140
|
</style>
|
|
@@ -24,28 +24,43 @@ describe('Checkbox', () => {
|
|
|
24
24
|
|
|
25
25
|
it('should checkbox emit change events', async () => {
|
|
26
26
|
wrapper = createWrapper();
|
|
27
|
-
const checkbox = wrapper.
|
|
27
|
+
const checkbox = wrapper.findComponent({ name: 'UnnnicIcon' });
|
|
28
28
|
|
|
29
29
|
// click false to true
|
|
30
|
-
await checkbox.trigger('
|
|
30
|
+
await checkbox.trigger('click');
|
|
31
31
|
expect(wrapper.emitted('change')[0][0]).eq(true);
|
|
32
32
|
|
|
33
33
|
// click true to false
|
|
34
34
|
await wrapper.setProps({ modelValue: true });
|
|
35
|
-
await checkbox.trigger('
|
|
35
|
+
await checkbox.trigger('click');
|
|
36
36
|
expect(wrapper.emitted('change')[1][0]).eq(false);
|
|
37
37
|
|
|
38
38
|
// click less to false
|
|
39
39
|
await wrapper.setProps({ modelValue: 'less' });
|
|
40
|
-
expect(wrapper.vm.
|
|
41
|
-
await checkbox.trigger('
|
|
40
|
+
expect(wrapper.vm.icon).eq('checkbox-less');
|
|
41
|
+
await checkbox.trigger('click');
|
|
42
42
|
expect(wrapper.emitted('change')[2][0]).eq(false);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
it('should checkbox disabled', async () => {
|
|
46
46
|
wrapper = createWrapper({ disabled: true });
|
|
47
|
-
const checkbox = wrapper.
|
|
47
|
+
const checkbox = wrapper.findComponent({ name: 'UnnnicIcon' });
|
|
48
48
|
await checkbox.trigger('click');
|
|
49
49
|
expect(wrapper.emitted('change')).eq(undefined);
|
|
50
50
|
});
|
|
51
|
+
|
|
52
|
+
it('should define sizes', async () => {
|
|
53
|
+
wrapper = createWrapper({ size: 'sm', textRight: 'Label' });
|
|
54
|
+
const checkbox = wrapper.findComponent({ name: 'UnnnicIcon' });
|
|
55
|
+
const label = wrapper.find('.unnnic-checkbox__label');
|
|
56
|
+
|
|
57
|
+
// sm
|
|
58
|
+
expect(checkbox.classes()).include('unnnic-icon__size--sm');
|
|
59
|
+
expect(label.classes()).include('unnnic-checkbox__label__sm');
|
|
60
|
+
|
|
61
|
+
// md
|
|
62
|
+
await wrapper.setProps({ size: 'md' });
|
|
63
|
+
expect(checkbox.classes()).include('unnnic-icon__size--md');
|
|
64
|
+
expect(label.classes()).include('unnnic-checkbox__label__md');
|
|
65
|
+
});
|
|
51
66
|
});
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
</tr>
|
|
57
57
|
</thead>
|
|
58
58
|
<tbody
|
|
59
|
+
ref="tbodyRef"
|
|
59
60
|
:class="[
|
|
60
61
|
'unnnic-data-table__body',
|
|
61
62
|
{ 'unnnic-data-table__body--hide-headers': props.hideHeaders },
|
|
@@ -120,6 +121,27 @@
|
|
|
120
121
|
</td>
|
|
121
122
|
</template>
|
|
122
123
|
</tr>
|
|
124
|
+
<tr
|
|
125
|
+
v-if="props.infiniteScroll && props.isLoadingMore"
|
|
126
|
+
:class="[
|
|
127
|
+
'unnnic-data-table__body-row',
|
|
128
|
+
'unnnic-data-table__body-row--loading-more',
|
|
129
|
+
]"
|
|
130
|
+
>
|
|
131
|
+
<td
|
|
132
|
+
:class="[
|
|
133
|
+
'unnnic-data-table__body-cell',
|
|
134
|
+
`unnnic-data-table__body-cell--${size}`,
|
|
135
|
+
]"
|
|
136
|
+
>
|
|
137
|
+
<img
|
|
138
|
+
class="unnnic-data-table__body-cell--loading"
|
|
139
|
+
data-testid="body-row-loading-more"
|
|
140
|
+
src="../../assets/icons/weni-loading.svg"
|
|
141
|
+
height="40"
|
|
142
|
+
/>
|
|
143
|
+
</td>
|
|
144
|
+
</tr>
|
|
123
145
|
</template>
|
|
124
146
|
<tr
|
|
125
147
|
v-else
|
|
@@ -166,6 +188,7 @@
|
|
|
166
188
|
|
|
167
189
|
<script setup lang="ts">
|
|
168
190
|
import { computed, ComputedRef, ref, useSlots } from 'vue';
|
|
191
|
+
import { useInfiniteScroll } from '@vueuse/core';
|
|
169
192
|
|
|
170
193
|
import Icon from '../Icon.vue';
|
|
171
194
|
import IconArrowsDefault from '../icons/iconArrowsDefault.vue';
|
|
@@ -205,6 +228,10 @@ interface Props {
|
|
|
205
228
|
pageInterval?: number;
|
|
206
229
|
locale?: string;
|
|
207
230
|
sort?: SortState;
|
|
231
|
+
infiniteScroll?: boolean;
|
|
232
|
+
infiniteScrollDistance?: number;
|
|
233
|
+
infiniteScrollDisabled?: boolean;
|
|
234
|
+
isLoadingMore?: boolean;
|
|
208
235
|
}
|
|
209
236
|
|
|
210
237
|
defineOptions({
|
|
@@ -217,6 +244,7 @@ const emit = defineEmits<{
|
|
|
217
244
|
'update:sort': [sort: { header: string; itemKey: string; order: string }];
|
|
218
245
|
itemClick: [item: DataTableItem];
|
|
219
246
|
'update:page': [page: number];
|
|
247
|
+
loadMore: [];
|
|
220
248
|
}>();
|
|
221
249
|
|
|
222
250
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -233,6 +261,10 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
233
261
|
pageInterval: 5,
|
|
234
262
|
locale: 'en',
|
|
235
263
|
sort: undefined,
|
|
264
|
+
infiniteScroll: false,
|
|
265
|
+
infiniteScrollDistance: 100,
|
|
266
|
+
infiniteScrollDisabled: false,
|
|
267
|
+
isLoadingMore: false,
|
|
236
268
|
});
|
|
237
269
|
|
|
238
270
|
const defaultTranslations = {
|
|
@@ -318,6 +350,21 @@ const handleClickRow = (item: DataTableItem) => {
|
|
|
318
350
|
|
|
319
351
|
emit('itemClick', item);
|
|
320
352
|
};
|
|
353
|
+
|
|
354
|
+
const tbodyRef = ref<HTMLElement | null>(null);
|
|
355
|
+
|
|
356
|
+
const handleLoadMore = () => {
|
|
357
|
+
if (props.infiniteScrollDisabled || props.isLoading || props.isLoadingMore) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
emit('loadMore');
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
if (props.infiniteScroll) {
|
|
364
|
+
useInfiniteScroll(tbodyRef, handleLoadMore, {
|
|
365
|
+
distance: props.infiniteScrollDistance,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
321
368
|
</script>
|
|
322
369
|
|
|
323
370
|
<style scoped lang="scss">
|
|
@@ -428,6 +475,7 @@ $tableBorder: $unnnic-border-width-thinner solid $unnnic-color-neutral-soft;
|
|
|
428
475
|
grid-template-columns: v-bind(gridTemplateColumns);
|
|
429
476
|
|
|
430
477
|
&--loading,
|
|
478
|
+
&--loading-more,
|
|
431
479
|
&--without-results {
|
|
432
480
|
grid-template-columns: 1fr;
|
|
433
481
|
}
|
|
@@ -3,53 +3,66 @@
|
|
|
3
3
|
class="unnnic-form-element"
|
|
4
4
|
:class="{ 'unnnic-form-element--disabled': disabled }"
|
|
5
5
|
>
|
|
6
|
-
<
|
|
6
|
+
<p
|
|
7
7
|
v-if="label"
|
|
8
|
-
:label="label"
|
|
9
|
-
:tooltip="tooltip"
|
|
10
8
|
:class="[
|
|
11
9
|
'unnnic-form-element__label',
|
|
12
10
|
{
|
|
13
11
|
'unnnic-form-element__label--fixed': fixedLabel,
|
|
14
12
|
},
|
|
15
13
|
]"
|
|
16
|
-
|
|
14
|
+
>
|
|
15
|
+
{{ fullySanitize(label) }}
|
|
16
|
+
</p>
|
|
17
17
|
|
|
18
18
|
<slot></slot>
|
|
19
19
|
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
<p
|
|
21
|
+
v-if="shouldShowErrorSection"
|
|
22
|
+
class="unnnic-form-element__error"
|
|
23
|
+
>
|
|
24
|
+
<template v-if="error !== true">
|
|
25
|
+
<UnnnicIcon
|
|
26
|
+
size="sm"
|
|
27
|
+
icon="warning"
|
|
28
|
+
scheme="aux-red-500"
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
{{ fullySanitize(error) }}
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<span
|
|
35
|
+
v-if="!!$slots.rightMessage"
|
|
36
|
+
class="unnnic-form-element__right-message"
|
|
37
|
+
>
|
|
38
|
+
<slot name="rightMessage"></slot>
|
|
39
|
+
</span>
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
<p
|
|
43
|
+
v-if="message || !!$slots.rightMessage"
|
|
44
|
+
class="unnnic-form-element__message"
|
|
23
45
|
>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class="unnnic-form-element__message error"
|
|
34
|
-
>
|
|
35
|
-
{{ Array.isArray(error) ? error.join(', ') : error }}
|
|
36
|
-
</p>
|
|
37
|
-
</section>
|
|
38
|
-
<p v-if="!!$slots.rightMessage">
|
|
39
|
-
<slot name="rightMessage" />
|
|
40
|
-
</p>
|
|
41
|
-
</section>
|
|
46
|
+
{{ fullySanitize(message) }}
|
|
47
|
+
|
|
48
|
+
<span
|
|
49
|
+
v-if="!shouldShowErrorSection && !!$slots.rightMessage"
|
|
50
|
+
class="unnnic-form-element__right-message"
|
|
51
|
+
>
|
|
52
|
+
<slot name="rightMessage"></slot>
|
|
53
|
+
</span>
|
|
54
|
+
</p>
|
|
42
55
|
</section>
|
|
43
56
|
</template>
|
|
44
57
|
|
|
45
|
-
<script
|
|
58
|
+
<script>
|
|
59
|
+
import UnnnicIcon from '../../components/Icon.vue';
|
|
46
60
|
import { fullySanitize } from '../../utils/sanitize';
|
|
47
|
-
import UnnnicLabel from '../Label/Label.vue';
|
|
48
|
-
|
|
49
61
|
export default {
|
|
50
62
|
components: {
|
|
51
|
-
|
|
63
|
+
UnnnicIcon,
|
|
52
64
|
},
|
|
65
|
+
|
|
53
66
|
props: {
|
|
54
67
|
size: {
|
|
55
68
|
type: String,
|
|
@@ -57,20 +70,28 @@ export default {
|
|
|
57
70
|
validator: (size) => ['md', 'sm'].includes(size),
|
|
58
71
|
},
|
|
59
72
|
|
|
60
|
-
label:
|
|
73
|
+
label: String,
|
|
61
74
|
|
|
62
|
-
fixedLabel:
|
|
75
|
+
fixedLabel: Boolean,
|
|
63
76
|
|
|
64
77
|
error: {
|
|
65
78
|
type: [Boolean, String],
|
|
66
79
|
default: false,
|
|
67
80
|
},
|
|
68
81
|
|
|
69
|
-
message:
|
|
82
|
+
message: String,
|
|
70
83
|
|
|
71
|
-
disabled:
|
|
84
|
+
disabled: Boolean,
|
|
85
|
+
},
|
|
72
86
|
|
|
73
|
-
|
|
87
|
+
data() {
|
|
88
|
+
return {};
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
computed: {
|
|
92
|
+
shouldShowErrorSection() {
|
|
93
|
+
return this.error && (this.error !== true || !!this.$slots.rightMessage);
|
|
94
|
+
},
|
|
74
95
|
},
|
|
75
96
|
methods: {
|
|
76
97
|
fullySanitize,
|
|
@@ -81,66 +102,75 @@ export default {
|
|
|
81
102
|
<style lang="scss" scoped>
|
|
82
103
|
@use '@/assets/scss/unnnic' as *;
|
|
83
104
|
|
|
84
|
-
* {
|
|
85
|
-
margin: $unnnic-space-0;
|
|
86
|
-
padding: $unnnic-space-0;
|
|
87
|
-
box-sizing: border-box;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
105
|
.unnnic-form-element {
|
|
91
106
|
&__label {
|
|
92
|
-
|
|
107
|
+
margin: 0;
|
|
108
|
+
margin-bottom: $unnnic-spacing-nano;
|
|
109
|
+
|
|
93
110
|
color: $unnnic-color-neutral-cloudy;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
111
|
+
font-family: $unnnic-font-family-secondary;
|
|
112
|
+
font-weight: $unnnic-font-weight-regular;
|
|
113
|
+
font-size: $unnnic-font-size-body-gt;
|
|
114
|
+
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
|
|
115
|
+
|
|
116
|
+
$label-bottom-spacing: 3px;
|
|
98
117
|
|
|
99
118
|
&--fixed {
|
|
100
|
-
margin-top: -$unnnic-font-size-body-gt - $unnnic-
|
|
119
|
+
margin-top: -$unnnic-font-size-body-gt - $unnnic-line-height-md +
|
|
120
|
+
$label-bottom-spacing;
|
|
101
121
|
}
|
|
102
122
|
|
|
103
123
|
&--fixed {
|
|
104
|
-
margin-bottom:
|
|
124
|
+
margin-bottom: 0;
|
|
105
125
|
position: absolute;
|
|
106
|
-
padding:
|
|
107
|
-
margin-left: $unnnic-
|
|
126
|
+
padding: 0 $unnnic-spacing-nano;
|
|
127
|
+
margin-left: $unnnic-spacing-xs;
|
|
108
128
|
|
|
109
129
|
&:after {
|
|
110
130
|
content: ' ';
|
|
111
131
|
position: absolute;
|
|
112
|
-
left:
|
|
113
|
-
bottom: $
|
|
132
|
+
left: 0;
|
|
133
|
+
bottom: $label-bottom-spacing - $unnnic-border-width-thinner;
|
|
114
134
|
width: 100%;
|
|
115
135
|
height: $unnnic-border-width-thinner;
|
|
116
|
-
background-color: $unnnic-color-white;
|
|
136
|
+
background-color: $unnnic-color-neutral-white;
|
|
117
137
|
}
|
|
118
138
|
}
|
|
119
139
|
}
|
|
120
140
|
|
|
141
|
+
&__error,
|
|
121
142
|
&__message {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
143
|
+
margin: 0;
|
|
144
|
+
margin-top: $unnnic-spacing-stack-nano;
|
|
145
|
+
|
|
146
|
+
color: $unnnic-color-neutral-cloudy;
|
|
147
|
+
font-family: $unnnic-font-family-secondary;
|
|
148
|
+
font-weight: $unnnic-font-weight-regular;
|
|
149
|
+
font-size: $unnnic-font-size-body-md;
|
|
150
|
+
line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
|
|
125
151
|
}
|
|
126
152
|
|
|
127
|
-
&
|
|
153
|
+
&__message {
|
|
128
154
|
display: flex;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
155
|
+
column-gap: $unnnic-spacing-nano;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&__right-message {
|
|
159
|
+
margin-left: auto;
|
|
133
160
|
}
|
|
134
161
|
|
|
135
|
-
&
|
|
162
|
+
&__error {
|
|
136
163
|
display: flex;
|
|
137
|
-
|
|
138
|
-
|
|
164
|
+
column-gap: $unnnic-spacing-nano;
|
|
165
|
+
align-items: center;
|
|
166
|
+
|
|
167
|
+
color: $unnnic-color-aux-red-500;
|
|
139
168
|
}
|
|
140
169
|
|
|
141
170
|
&--disabled .unnnic-form-element__label,
|
|
142
171
|
&--disabled .unnnic-form-element__message {
|
|
143
172
|
user-select: none;
|
|
173
|
+
color: $unnnic-color-neutral-cleanest;
|
|
144
174
|
}
|
|
145
175
|
}
|
|
146
176
|
</style>
|
package/src/components/Icon.vue
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
:class="classes"
|
|
8
8
|
:type="nativeType"
|
|
9
9
|
/>
|
|
10
|
+
|
|
10
11
|
<input
|
|
11
12
|
v-else
|
|
12
13
|
v-bind="attributes"
|
|
13
14
|
:value="fullySanitize(modelValue)"
|
|
14
15
|
:class="classes"
|
|
15
16
|
:type="nativeType"
|
|
16
|
-
:maxlength="maxlength"
|
|
17
17
|
/>
|
|
18
18
|
</template>
|
|
19
19
|
|
|
@@ -49,10 +49,6 @@ export default {
|
|
|
49
49
|
},
|
|
50
50
|
hasIconLeft: Boolean,
|
|
51
51
|
hasIconRight: Boolean,
|
|
52
|
-
maxlength: {
|
|
53
|
-
type: Number,
|
|
54
|
-
default: null,
|
|
55
|
-
},
|
|
56
52
|
},
|
|
57
53
|
emits: ['update:modelValue'],
|
|
58
54
|
data() {
|
|
@@ -100,23 +96,27 @@ export default {
|
|
|
100
96
|
&.size {
|
|
101
97
|
&-md {
|
|
102
98
|
@include input-md-font;
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
|
|
100
|
+
padding: ($unnnic-spacing-ant - $unnnic-border-width-thinner)
|
|
101
|
+
($unnnic-spacing-sm - $unnnic-border-width-thinner);
|
|
105
102
|
}
|
|
106
103
|
|
|
107
104
|
&-sm {
|
|
108
105
|
@include input-sm-font;
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
|
|
107
|
+
padding: $unnnic-spacing-xs
|
|
108
|
+
($unnnic-spacing-sm - $unnnic-border-width-thinner);
|
|
111
109
|
}
|
|
112
110
|
}
|
|
113
111
|
|
|
114
112
|
&.input--has-icon-left {
|
|
115
|
-
padding-left: $unnnic-
|
|
113
|
+
padding-left: $unnnic-spacing-sm + $unnnic-icon-size-sm +
|
|
114
|
+
$unnnic-spacing-xs - $unnnic-border-width-thinner;
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
&.input--has-icon-right {
|
|
119
|
-
padding-right: $unnnic-
|
|
118
|
+
padding-right: $unnnic-spacing-sm + $unnnic-icon-size-sm +
|
|
119
|
+
$unnnic-spacing-xs - $unnnic-border-width-thinner;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
&.error {
|
|
@@ -126,7 +126,7 @@ export default {
|
|
|
126
126
|
&:-ms-input-placeholder,
|
|
127
127
|
&::-ms-input-placeholder {
|
|
128
128
|
/* Internet Explorer 10-11 */
|
|
129
|
-
color: $unnnic-color-
|
|
129
|
+
color: $unnnic-color-brand-sec;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
</style>
|