@weni/unnnic-system 3.10.0 → 3.11.0
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 +80 -0
- package/dist/assets/tokens/colors.json.d.ts +376 -0
- package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
- package/dist/components/Alert/Alert.vue.d.ts +17 -116
- package/dist/components/Alert/Alert.vue.d.ts.map +1 -1
- package/dist/components/Alert/Version1dot1.vue.d.ts +2 -38
- 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 +11 -414
- 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 +24 -31
- 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 +13 -416
- package/dist/components/Carousel/TagCarousel.vue.d.ts +12 -415
- 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 +21 -446
- 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 +19 -26
- package/dist/components/Checkbox/Checkbox.vue.d.ts.map +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts +28 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts.map +1 -0
- 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 +170 -39
- 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 +51 -28
- 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 +11 -2
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +170 -39
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +33 -24
- package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +175 -44
- package/dist/components/InputNext/InputNext.vue.d.ts +4 -4
- package/dist/components/Label/Label.vue.d.ts +9 -15
- 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 +175 -44
- 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 +26 -14
- package/dist/components/PageHeader/PageHeader.vue.d.ts +28 -0
- package/dist/components/PageHeader/PageHeader.vue.d.ts.map +1 -0
- package/dist/components/PageHeader/index.d.ts +3 -0
- package/dist/components/PageHeader/index.d.ts.map +1 -0
- package/dist/components/PageHeader/types.d.ts +9 -0
- package/dist/components/PageHeader/types.d.ts.map +1 -0
- 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 +10 -6
- package/dist/components/Radio/Radio.vue.d.ts.map +1 -1
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +68 -469
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +11 -414
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +21 -28
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts.map +1 -1
- package/dist/components/SelectTime/index.vue.d.ts +33 -24
- 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 +55 -21
- package/dist/components/Switch/Switch.vue.d.ts.map +1 -1
- package/dist/components/Tab/Tab.vue.d.ts +13 -2
- 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/DefaultTag.vue.d.ts +4 -83
- package/dist/components/Tag/DefaultTag.vue.d.ts.map +1 -1
- package/dist/components/Tag/Tag.vue.d.ts +12 -414
- package/dist/components/Tag/Tag.vue.d.ts.map +1 -1
- package/dist/components/Tag/types.d.ts +18 -0
- package/dist/components/Tag/types.d.ts.map +1 -0
- package/dist/components/TextArea/TextArea.vue.d.ts +78 -33
- package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
- package/dist/components/Toast/Toast.vue.d.ts +16 -0
- package/dist/components/Toast/Toast.vue.d.ts.map +1 -0
- package/dist/components/Toast/ToastManager.d.ts +14 -0
- package/dist/components/Toast/ToastManager.d.ts.map +1 -0
- package/dist/components/Toast/types.d.ts +35 -0
- package/dist/components/Toast/types.d.ts.map +1 -0
- 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 +8910 -10904
- 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-4b899f97.mjs → es-e3248052.mjs} +1 -1
- package/dist/{index-23489897.mjs → index-f67d5b30.mjs} +9289 -8806
- package/dist/{pt-br-5a914a63.mjs → pt-br-f6f53acd.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +181 -173
- package/dist/unnnic.umd.js +35 -36
- package/dist/utils/call.d.ts +2 -1
- package/dist/utils/call.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/assets/icons/checkbox-checked-disabled.svg +3 -0
- package/src/assets/icons/checkbox-checked.svg +3 -0
- package/src/assets/icons/checkbox-less-disabled.svg +3 -0
- package/src/assets/icons/checkbox-less.svg +3 -0
- package/src/assets/icons/radio-checked.svg +3 -0
- package/src/assets/icons/switch-checked-disabled.svg +3 -0
- package/src/assets/icons/switch-checked.svg +3 -0
- package/src/components/Alert/Alert.vue +26 -135
- package/src/components/Alert/Version1dot1.vue +0 -36
- package/src/components/Alert/__tests__/Alert.spec.js +2 -45
- package/src/components/Alert/__tests__/Version1dot1.spec.js +0 -21
- package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +11 -7
- 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 +67 -117
- package/src/components/Button/types.ts +0 -1
- package/src/components/ChatsContact/ChatsContact.vue +10 -6
- package/src/components/Checkbox/Checkbox.vue +117 -65
- package/src/components/Checkbox/__tests__/Checkbox.spec.js +6 -21
- package/src/components/CheckboxGroup/CheckboxGroup.vue +96 -0
- package/src/components/FormElement/FormElement.vue +63 -93
- package/src/components/Icon.vue +2 -0
- package/src/components/Input/BaseInput.vue +12 -12
- package/src/components/Input/Input.scss +19 -20
- package/src/components/Input/Input.vue +60 -55
- package/src/components/Input/TextInput.vue +25 -54
- package/src/components/Input/__test__/Input.spec.js +13 -33
- package/src/components/Input/__test__/TextInput.spec.js +6 -8
- package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +14 -5
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
- package/src/components/Label/Label.vue +52 -21
- 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/PageHeader/PageHeader.vue +148 -0
- package/src/components/PageHeader/index.ts +2 -0
- package/src/components/PageHeader/types.ts +10 -0
- package/src/components/Radio/Radio.vue +118 -66
- package/src/components/Radio/__test__/Radio.spec.js +14 -20
- package/src/components/Radio/__test__/__snapshots__/Radio.spec.js.snap +4 -3
- package/src/components/RadioGroup/RadioGroup.vue +142 -0
- package/src/components/SelectSmart/SelectSmart.vue +4 -3
- package/src/components/Switch/Switch.vue +132 -91
- package/src/components/Switch/__tests__/Switch.spec.js +8 -75
- package/src/components/Switch/__tests__/__snapshots__/Switch.spec.js.snap +5 -6
- package/src/components/Tab/Tab.vue +37 -23
- 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/DefaultTag.vue +51 -107
- package/src/components/Tag/Tag.vue +32 -79
- package/src/components/Tag/types.ts +19 -0
- package/src/components/TextArea/TextArea.vue +41 -12
- package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +11 -3
- package/src/components/Toast/Toast.vue +246 -0
- package/src/components/Toast/ToastManager.ts +110 -0
- package/src/components/Toast/__tests__/Toast.spec.js +291 -0
- package/src/components/Toast/__tests__/ToastManager.spec.js +294 -0
- package/src/components/Toast/types.ts +57 -0
- package/src/components/index.ts +33 -17
- package/src/stories/Alert.stories.js +6 -67
- package/src/stories/Button.stories.js +29 -39
- package/src/stories/Checkbox.stories.js +11 -4
- package/src/stories/CheckboxGroup.stories.js +105 -0
- package/src/stories/Input.stories.js +71 -76
- package/src/stories/Label.stories.js +7 -0
- package/src/stories/PageHeader.stories.js +330 -0
- package/src/stories/Radio.stories.js +28 -1
- package/src/stories/RadioGroup.stories.js +144 -0
- package/src/stories/Switch.stories.js +10 -5
- package/src/stories/Tab.stories.js +11 -4
- package/src/stories/Tag.stories.js +24 -43
- package/src/stories/TextArea.stories.js +14 -2
- package/src/stories/Toast.mdx +123 -0
- package/src/stories/Toast.stories.js +126 -0
- package/src/types/scheme-colors.d.ts +1 -0
- package/src/utils/call.js +46 -18
- package/dist/components/Tag/BrandTag.vue.d.ts +0 -51
- package/dist/components/Tag/BrandTag.vue.d.ts.map +0 -1
- package/dist/components/Tag/IndicatorTag.vue.d.ts +0 -151
- package/dist/components/Tag/IndicatorTag.vue.d.ts.map +0 -1
- package/dist/components/Tag/TagNext.vue.d.ts +0 -24
- package/dist/components/Tag/TagNext.vue.d.ts.map +0 -1
- package/src/components/Alert/AlertBanner.vue +0 -182
- package/src/components/Alert/AlertCaller.vue +0 -49
- package/src/components/Alert/__tests__/AlertBanner.spec.js +0 -89
- package/src/components/Alert/__tests__/AlertCaller.spec.js +0 -98
- package/src/components/Tag/BrandTag.vue +0 -96
- package/src/components/Tag/IndicatorTag.vue +0 -107
- package/src/components/Tag/TagNext.vue +0 -60
|
@@ -1,49 +1,60 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
v-if="
|
|
5
|
-
|
|
6
|
-
:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`unnnic-switch__label__${size}`,
|
|
10
|
-
]"
|
|
11
|
-
>
|
|
12
|
-
{{ textLeft }}
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<UnnnicIcon
|
|
16
|
-
:class="{ 'unnnic-switch__icon': true, active: isActive }"
|
|
17
|
-
:icon="currentIcon"
|
|
18
|
-
:size="iconSize"
|
|
19
|
-
:scheme="iconScheme"
|
|
20
|
-
:lineHeight="iconLineHeight"
|
|
21
|
-
:disabled="disabled"
|
|
22
|
-
:clickable="!disabled"
|
|
23
|
-
data-test-id="switch-icon"
|
|
24
|
-
@click="toggleState"
|
|
2
|
+
<section class="unnnic-switch">
|
|
3
|
+
<UnnnicLabel
|
|
4
|
+
v-if="label"
|
|
5
|
+
:label="label"
|
|
6
|
+
:tooltip="labelTooltip"
|
|
7
|
+
:useHtmlTooltip="labelUseHtmlTooltip"
|
|
8
|
+
class="unnnic-switch__label"
|
|
25
9
|
/>
|
|
26
10
|
|
|
27
|
-
<
|
|
28
|
-
v-if="textRight"
|
|
29
|
-
data-test-id="switch-text-right"
|
|
11
|
+
<label
|
|
30
12
|
:class="[
|
|
31
|
-
'unnnic-
|
|
32
|
-
'unnnic-
|
|
33
|
-
`unnnic-switch__label__${size}`,
|
|
13
|
+
'unnnic-switch__input-wrapper',
|
|
14
|
+
{ 'unnnic-switch__input-wrapper--disabled': disabled },
|
|
34
15
|
]"
|
|
35
16
|
>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
<input
|
|
18
|
+
class="unnnic-switch__input"
|
|
19
|
+
type="checkbox"
|
|
20
|
+
:disabled="disabled"
|
|
21
|
+
:checked="modelValue"
|
|
22
|
+
@change="toggleState"
|
|
23
|
+
v-bind="pick($attrs, ['id', 'name'])"
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
<p
|
|
27
|
+
v-if="option || textLeft || textRight"
|
|
28
|
+
:class="[
|
|
29
|
+
'unnnic-switch__option',
|
|
30
|
+
{ 'unnnic-switch__option--disabled': disabled },
|
|
31
|
+
]"
|
|
32
|
+
data-testid="switch-option"
|
|
33
|
+
>
|
|
34
|
+
{{ option }}
|
|
35
|
+
{{ textLeft }}
|
|
36
|
+
{{ textRight }}
|
|
37
|
+
</p>
|
|
38
|
+
</label>
|
|
39
|
+
|
|
40
|
+
<p
|
|
41
|
+
v-if="helper"
|
|
42
|
+
class="unnnic-switch__helper"
|
|
43
|
+
>
|
|
44
|
+
{{ helper }}
|
|
45
|
+
</p>
|
|
46
|
+
</section>
|
|
39
47
|
</template>
|
|
40
48
|
|
|
41
49
|
<script>
|
|
42
|
-
import
|
|
50
|
+
import { pick } from 'lodash';
|
|
51
|
+
import UnnnicLabel from '../Label/Label.vue';
|
|
43
52
|
|
|
44
53
|
export default {
|
|
45
54
|
name: 'UnnnicSwitch',
|
|
46
|
-
components: {
|
|
55
|
+
components: {
|
|
56
|
+
UnnnicLabel,
|
|
57
|
+
},
|
|
47
58
|
props: {
|
|
48
59
|
size: {
|
|
49
60
|
type: String,
|
|
@@ -52,6 +63,32 @@ export default {
|
|
|
52
63
|
return ['small', 'medium'].indexOf(value) !== -1;
|
|
53
64
|
},
|
|
54
65
|
},
|
|
66
|
+
|
|
67
|
+
label: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: '',
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
labelTooltip: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: '',
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
labelUseHtmlTooltip: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: false,
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
option: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: '',
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
helper: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: '',
|
|
90
|
+
},
|
|
91
|
+
|
|
55
92
|
textLeft: {
|
|
56
93
|
type: String,
|
|
57
94
|
default: '',
|
|
@@ -78,33 +115,6 @@ export default {
|
|
|
78
115
|
isActive: false,
|
|
79
116
|
};
|
|
80
117
|
},
|
|
81
|
-
computed: {
|
|
82
|
-
currentIcon() {
|
|
83
|
-
if (this.disabled) {
|
|
84
|
-
return this.isActive
|
|
85
|
-
? 'switch-selected-disabled'
|
|
86
|
-
: 'switch-default-disabled';
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return 'switch-default';
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
iconSize() {
|
|
93
|
-
return this.size === 'small' ? 'sm' : 'md';
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
iconScheme() {
|
|
97
|
-
if (this.disabled) {
|
|
98
|
-
return 'neutral-soft';
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return this.isActive === false ? 'neutral-soft' : 'brand-weni';
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
iconLineHeight() {
|
|
105
|
-
return this.size === 'small' ? 'sm' : '';
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
118
|
|
|
109
119
|
watch: {
|
|
110
120
|
modelValue: {
|
|
@@ -116,6 +126,8 @@ export default {
|
|
|
116
126
|
},
|
|
117
127
|
|
|
118
128
|
methods: {
|
|
129
|
+
pick,
|
|
130
|
+
|
|
119
131
|
toggleState() {
|
|
120
132
|
if (!this.disabled) {
|
|
121
133
|
if (this.useVModel) {
|
|
@@ -133,51 +145,80 @@ export default {
|
|
|
133
145
|
<style lang="scss" scoped>
|
|
134
146
|
@use '@/assets/scss/unnnic' as *;
|
|
135
147
|
|
|
148
|
+
$switch-width: 38px;
|
|
149
|
+
$switch-height: 20px;
|
|
150
|
+
|
|
136
151
|
.unnnic-switch {
|
|
137
152
|
display: flex;
|
|
138
|
-
flex-direction:
|
|
153
|
+
flex-direction: column;
|
|
139
154
|
|
|
140
|
-
&
|
|
141
|
-
|
|
142
|
-
font-weight: $unnnic-font-weight-regular;
|
|
143
|
-
color: $unnnic-color-neutral-dark;
|
|
155
|
+
&__input-wrapper {
|
|
156
|
+
width: fit-content;
|
|
144
157
|
|
|
145
|
-
|
|
146
|
-
|
|
158
|
+
display: flex;
|
|
159
|
+
align-items: center;
|
|
160
|
+
column-gap: $unnnic-space-2;
|
|
147
161
|
|
|
148
|
-
|
|
149
|
-
font-size: $unnnic-font-size-body-md;
|
|
150
|
-
line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
|
|
151
|
-
}
|
|
162
|
+
cursor: pointer;
|
|
152
163
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
|
|
164
|
+
&--disabled {
|
|
165
|
+
cursor: not-allowed;
|
|
156
166
|
}
|
|
157
167
|
}
|
|
158
168
|
|
|
159
|
-
&
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
:
|
|
164
|
-
|
|
169
|
+
&__input {
|
|
170
|
+
appearance: none;
|
|
171
|
+
width: $switch-width;
|
|
172
|
+
min-width: $switch-width;
|
|
173
|
+
height: $switch-height;
|
|
174
|
+
margin: 0;
|
|
175
|
+
background-color: $unnnic-color-bg-muted;
|
|
176
|
+
border-radius: $unnnic-radius-3;
|
|
177
|
+
box-sizing: border-box;
|
|
178
|
+
outline: none;
|
|
179
|
+
|
|
180
|
+
background-image: url('@/assets/icons/switch-checked.svg');
|
|
181
|
+
background-repeat: no-repeat;
|
|
182
|
+
background-position: 4px center;
|
|
183
|
+
|
|
184
|
+
transition:
|
|
185
|
+
120ms linear background-position,
|
|
186
|
+
120ms linear background-color;
|
|
187
|
+
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
|
|
190
|
+
&:checked {
|
|
191
|
+
background-color: $unnnic-color-bg-active;
|
|
192
|
+
background-position: 20px center;
|
|
165
193
|
}
|
|
166
194
|
|
|
167
|
-
|
|
168
|
-
:
|
|
169
|
-
|
|
170
|
-
|
|
195
|
+
&:disabled {
|
|
196
|
+
background-color: $unnnic-color-bg-muted;
|
|
197
|
+
background-image: url('@/assets/icons/switch-checked-disabled.svg');
|
|
198
|
+
|
|
199
|
+
cursor: not-allowed;
|
|
171
200
|
}
|
|
172
201
|
}
|
|
173
|
-
}
|
|
174
202
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
203
|
+
&__label {
|
|
204
|
+
margin-bottom: $unnnic-space-3;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
&__option {
|
|
208
|
+
margin: 0;
|
|
209
|
+
font: $unnnic-font-body;
|
|
210
|
+
color: $unnnic-color-fg-emphasized;
|
|
211
|
+
|
|
212
|
+
&--disabled {
|
|
213
|
+
color: $unnnic-color-fg-muted;
|
|
214
|
+
}
|
|
178
215
|
}
|
|
179
|
-
|
|
180
|
-
|
|
216
|
+
|
|
217
|
+
&__helper {
|
|
218
|
+
margin: 0;
|
|
219
|
+
margin-left: $switch-width + $unnnic-space-2;
|
|
220
|
+
font: $unnnic-font-caption-2;
|
|
221
|
+
color: $unnnic-color-fg-base;
|
|
181
222
|
}
|
|
182
223
|
}
|
|
183
224
|
</style>
|
|
@@ -12,93 +12,26 @@ describe('Switch', () => {
|
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
wrapper = createWrapper({ modelValue: false });
|
|
14
14
|
});
|
|
15
|
-
it('should render the component correctly with default props', () => {
|
|
16
|
-
expect(wrapper.exists()).toBe(true);
|
|
17
|
-
expect(wrapper.findComponent({ name: 'UnnnicIcon' }).exists()).toBe(true);
|
|
18
|
-
expect(wrapper.text()).toBe('');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should render the left text (textLeft) when provided', async () => {
|
|
22
|
-
await wrapper.setProps({ textLeft: 'Left Text' });
|
|
23
|
-
|
|
24
|
-
// This check ensures that the icon is placed before the switch text
|
|
25
|
-
const switchChildren = wrapper.findComponent(Switch).element.children;
|
|
26
|
-
expect(switchChildren[0].getAttribute('data-test-id')).toBe(
|
|
27
|
-
'switch-text-left',
|
|
28
|
-
);
|
|
29
|
-
expect(switchChildren[1].getAttribute('data-test-id')).toBe('switch-icon');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should render the right text (textRight) when provided', async () => {
|
|
33
|
-
await wrapper.setProps({ textRight: 'Right Text' });
|
|
34
|
-
|
|
35
|
-
// This check ensures that the icon is placed after the switch text
|
|
36
|
-
const switchChildren = wrapper.findComponent(Switch).element.children;
|
|
37
|
-
expect(switchChildren[0].getAttribute('data-test-id')).toBe('switch-icon');
|
|
38
|
-
expect(switchChildren[1].getAttribute('data-test-id')).toBe(
|
|
39
|
-
'switch-text-right',
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should render the correct icon when the switch is disabled/enabled', async () => {
|
|
44
|
-
await wrapper.setProps({ disabled: true });
|
|
45
|
-
const disabledIconComponent = wrapper.findComponent({ name: 'UnnnicIcon' });
|
|
46
|
-
expect(disabledIconComponent.props('icon')).toBe('switch-default-disabled');
|
|
47
15
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
expect(enabledIconComponent.props('icon')).toBe('switch-selected-disabled');
|
|
51
|
-
});
|
|
16
|
+
it('should render the option when provided', async () => {
|
|
17
|
+
await wrapper.setProps({ option: 'Option Text' });
|
|
52
18
|
|
|
53
|
-
|
|
54
|
-
expect(
|
|
55
|
-
await wrapper.setProps({ modelValue: true });
|
|
56
|
-
expect(wrapper.vm.isActive).toBe(true);
|
|
57
|
-
expect(wrapper.findComponent({ name: 'UnnnicIcon' }).props('icon')).toBe(
|
|
58
|
-
'switch-default',
|
|
59
|
-
);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('should render the correct icon size based on the size prop', async () => {
|
|
63
|
-
await wrapper.setProps({ size: 'small' });
|
|
64
|
-
expect(wrapper.findComponent({ name: 'UnnnicIcon' }).props('size')).toBe(
|
|
65
|
-
'sm',
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
await wrapper.setProps({ size: 'medium' });
|
|
69
|
-
expect(wrapper.findComponent({ name: 'UnnnicIcon' }).props('size')).toBe(
|
|
70
|
-
'md',
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('should change the icon color based on the state', async () => {
|
|
75
|
-
expect(wrapper.findComponent({ name: 'UnnnicIcon' }).props('scheme')).toBe(
|
|
76
|
-
'neutral-soft',
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
await wrapper.setProps({ modelValue: true });
|
|
80
|
-
expect(wrapper.findComponent({ name: 'UnnnicIcon' }).props('scheme')).toBe(
|
|
81
|
-
'brand-weni',
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
await wrapper.setProps({ disabled: true });
|
|
85
|
-
expect(wrapper.findComponent({ name: 'UnnnicIcon' }).props('scheme')).toBe(
|
|
86
|
-
'neutral-soft',
|
|
87
|
-
);
|
|
19
|
+
const switchOption = wrapper.find('[data-testid="switch-option"]');
|
|
20
|
+
expect(switchOption.text()).toBe('Option Text');
|
|
88
21
|
});
|
|
89
22
|
|
|
90
23
|
it('should toggle isActive state and emit the correct event when toggleState is called', async () => {
|
|
91
24
|
const initialIsActive = wrapper.vm.isActive;
|
|
92
|
-
const
|
|
93
|
-
await
|
|
25
|
+
const switchInput = wrapper.find('input[type="checkbox"]');
|
|
26
|
+
await switchInput.trigger('change');
|
|
94
27
|
expect(wrapper.emitted('update:model-value')).toBeTruthy();
|
|
95
28
|
expect(wrapper.vm.isActive).toBe(!initialIsActive);
|
|
96
29
|
});
|
|
97
30
|
|
|
98
31
|
it('should not change state when disabled is true', async () => {
|
|
99
32
|
await wrapper.setProps({ disabled: true });
|
|
100
|
-
const
|
|
101
|
-
await
|
|
33
|
+
const switchInput = wrapper.find('input[type="checkbox"]');
|
|
34
|
+
await switchInput.trigger('change');
|
|
102
35
|
expect(wrapper.emitted('update:model-value')).toBeFalsy();
|
|
103
36
|
expect(wrapper.vm.isActive).toBe(false);
|
|
104
37
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
3
|
exports[`Switch > should match the snapshot 1`] = `
|
|
4
|
-
"<
|
|
5
|
-
<!--v-if--><
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
</svg>
|
|
4
|
+
"<section data-v-e4356c9d="" class="unnnic-switch">
|
|
5
|
+
<!--v-if--><label data-v-e4356c9d="" class="unnnic-switch__input-wrapper"><input data-v-e4356c9d="" class="unnnic-switch__input" type="checkbox">
|
|
6
|
+
<!--v-if-->
|
|
7
|
+
</label>
|
|
9
8
|
<!--v-if-->
|
|
10
|
-
</
|
|
9
|
+
</section>"
|
|
11
10
|
`;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
class="tab-head"
|
|
10
10
|
:class="{
|
|
11
11
|
'tab-head--active': localValue === tab,
|
|
12
|
+
'tab-head--disabled': disabledTabs?.includes(tab),
|
|
12
13
|
}"
|
|
13
14
|
@click="change(tab)"
|
|
14
15
|
>
|
|
@@ -20,10 +21,9 @@
|
|
|
20
21
|
side="bottom"
|
|
21
22
|
>
|
|
22
23
|
<UnnnicIcon
|
|
23
|
-
icon="
|
|
24
|
+
icon="help"
|
|
24
25
|
:size="size === 'sm' ? 'xs' : 'sm'"
|
|
25
|
-
|
|
26
|
-
scheme="neutral-cleanest"
|
|
26
|
+
scheme="fg-base"
|
|
27
27
|
/>
|
|
28
28
|
</UnnnicToolTip>
|
|
29
29
|
</li>
|
|
@@ -65,6 +65,13 @@ export default {
|
|
|
65
65
|
tabs: {
|
|
66
66
|
type: Array,
|
|
67
67
|
default: null,
|
|
68
|
+
validator: (tabs) => {
|
|
69
|
+
return tabs.every((tab) => typeof tab === 'string') && tabs.length <= 5;
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
disabledTabs: {
|
|
73
|
+
type: Array,
|
|
74
|
+
default: null,
|
|
68
75
|
},
|
|
69
76
|
},
|
|
70
77
|
emits: ['change'],
|
|
@@ -105,6 +112,10 @@ export default {
|
|
|
105
112
|
return '';
|
|
106
113
|
},
|
|
107
114
|
change(value) {
|
|
115
|
+
if (this.disabledTabs?.includes(value)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
108
119
|
this.localValue = value;
|
|
109
120
|
this.$emit('change', this.localValue);
|
|
110
121
|
},
|
|
@@ -119,18 +130,15 @@ export default {
|
|
|
119
130
|
display: flex;
|
|
120
131
|
align-items: flex-start;
|
|
121
132
|
justify-content: space-between;
|
|
122
|
-
color: $unnnic-color-
|
|
123
|
-
font
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
line-height: ($unnnic-font-size-body-lg + $unnnic-line-height-medium);
|
|
127
|
-
margin-bottom: $unnnic-inset-sm;
|
|
128
|
-
border-bottom: $unnnic-border-width-thinner solid $unnnic-color-neutral-soft;
|
|
133
|
+
color: $unnnic-color-fg-base;
|
|
134
|
+
font: $unnnic-font-action;
|
|
135
|
+
margin-bottom: $unnnic-space-4;
|
|
136
|
+
border-bottom: $unnnic-border-width-thinner solid $unnnic-color-border-base;
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
.tab-content {
|
|
132
140
|
display: flex;
|
|
133
|
-
gap: $unnnic-
|
|
141
|
+
gap: $unnnic-space-6;
|
|
134
142
|
|
|
135
143
|
margin: 0;
|
|
136
144
|
padding: 0;
|
|
@@ -139,27 +147,24 @@ export default {
|
|
|
139
147
|
|
|
140
148
|
.tab-head {
|
|
141
149
|
display: flex;
|
|
142
|
-
gap: $unnnic-
|
|
150
|
+
gap: $unnnic-space-2;
|
|
143
151
|
align-items: center;
|
|
144
152
|
|
|
145
153
|
cursor: pointer;
|
|
146
|
-
|
|
154
|
+
padding: $unnnic-space-2 $unnnic-space-4;
|
|
147
155
|
|
|
148
156
|
.unnnic-tooltip {
|
|
149
157
|
display: flex;
|
|
150
158
|
}
|
|
151
159
|
|
|
152
160
|
&:hover {
|
|
153
|
-
color: $unnnic-color-
|
|
161
|
+
color: $unnnic-color-fg-emphasized;
|
|
154
162
|
}
|
|
155
163
|
}
|
|
156
164
|
|
|
157
165
|
.tab-head--active {
|
|
158
|
-
|
|
159
|
-
font
|
|
160
|
-
color: $unnnic-color-neutral-black;
|
|
161
|
-
font-size: $unnnic-font-size-body-lg;
|
|
162
|
-
line-height: ($unnnic-font-size-body-lg + $unnnic-line-height-medium);
|
|
166
|
+
color: $unnnic-color-fg-emphasized;
|
|
167
|
+
font: $unnnic-font-action;
|
|
163
168
|
transition: 0.4s;
|
|
164
169
|
|
|
165
170
|
position: relative;
|
|
@@ -168,14 +173,23 @@ export default {
|
|
|
168
173
|
content: '';
|
|
169
174
|
|
|
170
175
|
position: absolute;
|
|
171
|
-
bottom:
|
|
172
|
-
left:
|
|
176
|
+
bottom: 0;
|
|
177
|
+
left: 0;
|
|
173
178
|
|
|
174
179
|
display: block;
|
|
175
180
|
|
|
176
|
-
width:
|
|
181
|
+
width: 100%;
|
|
177
182
|
|
|
178
|
-
border-bottom: $unnnic-border-width-thin solid $unnnic-color-
|
|
183
|
+
border-bottom: $unnnic-border-width-thin solid $unnnic-color-border-active;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.tab-head--disabled {
|
|
188
|
+
color: $unnnic-color-fg-muted;
|
|
189
|
+
cursor: default;
|
|
190
|
+
|
|
191
|
+
&:hover {
|
|
192
|
+
color: $unnnic-color-fg-muted;
|
|
179
193
|
}
|
|
180
194
|
}
|
|
181
195
|
|
|
@@ -4,7 +4,7 @@ exports[`Tab.vue > matches the snapshot 1`] = `
|
|
|
4
4
|
"<div data-v-b4e39fac="" class="tab size-md">
|
|
5
5
|
<header data-v-b4e39fac="" class="tab-header">
|
|
6
6
|
<ul data-v-b4e39fac="" class="tab-content">
|
|
7
|
-
<li data-v-b4e39fac="" class="tab-head">tab1<div data-v-bf0cf546="" data-v-b4e39fac="" class="unnnic-tooltip"><span data-v-26446d8e="" data-v-b4e39fac="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--
|
|
7
|
+
<li data-v-b4e39fac="" class="tab-head">tab1<div data-v-bf0cf546="" data-v-b4e39fac="" class="unnnic-tooltip"><span data-v-26446d8e="" data-v-b4e39fac="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--sm unnnic-icon__size--sm" data-testid="material-icon" translate="no">help</span><span data-v-bf0cf546="" class="unnnic-tooltip-label unnnic-tooltip-label-bottom" data-testid="tooltip-label" style="left: 0px; top: 8px;">Tooltip text <br data-v-bf0cf546=""><!--v-if--></span></div>
|
|
8
8
|
</li>
|
|
9
9
|
<li data-v-b4e39fac="" class="tab-head tab-head--active">tab2
|
|
10
10
|
<!--v-if-->
|
|
@@ -42,7 +42,7 @@ exports[`TableNext.vue > matches the snapshot 1`] = `
|
|
|
42
42
|
<p data-v-e29458bb="" class="table-pagination__count" data-testid="count">1 - 1 of 1</p>
|
|
43
43
|
<div data-v-0eeff8cb="" data-v-e29458bb="" class="pagination"><button data-v-ceff2a60="" data-v-0eeff8cb="" data-test="previous-button" disabled="" class="unnnic-button unnnic-button--size-small unnnic-button--tertiary unnnic-button--icon-on-center">
|
|
44
44
|
<!--v-if-->
|
|
45
|
-
<!--v-if--><span data-v-26446d8e="" data-v-ceff2a60="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--neutral-clean unnnic-icon-size--
|
|
45
|
+
<!--v-if--><span data-v-26446d8e="" data-v-ceff2a60="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--neutral-clean unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable" data-testid="icon-center" translate="no" style="visibility: visible;">chevron_left</span><span data-v-ceff2a60="" class="unnnic-button__label" style="visibility: visible;" data-testid="button-label"> </span>
|
|
46
46
|
<!--v-if-->
|
|
47
47
|
</button><button data-v-ceff2a60="" data-v-0eeff8cb="" data-test="page-button" class="unnnic-button unnnic-button--size-small unnnic-button--secondary">
|
|
48
48
|
<!--v-if-->
|
|
@@ -51,7 +51,7 @@ exports[`TableNext.vue > matches the snapshot 1`] = `
|
|
|
51
51
|
<!--v-if-->
|
|
52
52
|
</button><button data-v-ceff2a60="" data-v-0eeff8cb="" data-test="next-button" disabled="" class="unnnic-button unnnic-button--size-small unnnic-button--tertiary unnnic-button--icon-on-center">
|
|
53
53
|
<!--v-if-->
|
|
54
|
-
<!--v-if--><span data-v-26446d8e="" data-v-ceff2a60="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--neutral-clean unnnic-icon-size--
|
|
54
|
+
<!--v-if--><span data-v-26446d8e="" data-v-ceff2a60="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--neutral-clean unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable" data-testid="icon-center" translate="no" style="visibility: visible;">chevron_right</span><span data-v-ceff2a60="" class="unnnic-button__label" style="visibility: visible;" data-testid="button-label"> </span>
|
|
55
55
|
<!--v-if-->
|
|
56
56
|
</button></div>
|
|
57
57
|
</section>
|
|
@@ -5,7 +5,7 @@ exports[`TablePagination.vue > matches the snapshot 1`] = `
|
|
|
5
5
|
<p data-v-e29458bb="" class="table-pagination__count" data-testid="count">1 - 10 of 100</p>
|
|
6
6
|
<div data-v-0eeff8cb="" data-v-e29458bb="" class="pagination"><button data-v-ceff2a60="" data-v-0eeff8cb="" data-test="previous-button" disabled="" class="unnnic-button unnnic-button--size-small unnnic-button--tertiary unnnic-button--icon-on-center">
|
|
7
7
|
<!--v-if-->
|
|
8
|
-
<!--v-if--><span data-v-26446d8e="" data-v-ceff2a60="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--neutral-clean unnnic-icon-size--
|
|
8
|
+
<!--v-if--><span data-v-26446d8e="" data-v-ceff2a60="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--neutral-clean unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable" data-testid="icon-center" translate="no" style="visibility: visible;">chevron_left</span><span data-v-ceff2a60="" class="unnnic-button__label" style="visibility: visible;" data-testid="button-label"> </span>
|
|
9
9
|
<!--v-if-->
|
|
10
10
|
</button><button data-v-ceff2a60="" data-v-0eeff8cb="" data-test="page-button" class="unnnic-button unnnic-button--size-small unnnic-button--secondary">
|
|
11
11
|
<!--v-if-->
|
|
@@ -34,7 +34,7 @@ exports[`TablePagination.vue > matches the snapshot 1`] = `
|
|
|
34
34
|
<!--v-if-->
|
|
35
35
|
</button><button data-v-ceff2a60="" data-v-0eeff8cb="" data-test="next-button" class="unnnic-button unnnic-button--size-small unnnic-button--tertiary unnnic-button--icon-on-center">
|
|
36
36
|
<!--v-if-->
|
|
37
|
-
<!--v-if--><span data-v-26446d8e="" data-v-ceff2a60="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--neutral-dark unnnic-icon-size--
|
|
37
|
+
<!--v-if--><span data-v-26446d8e="" data-v-ceff2a60="" class="unnnic-icon material-symbols-rounded unnnic-icon-scheme--neutral-dark unnnic-icon-size--ant unnnic-icon__size--ant unnnic--clickable" data-testid="icon-center" translate="no" style="visibility: visible;">chevron_right</span><span data-v-ceff2a60="" class="unnnic-button__label" style="visibility: visible;" data-testid="button-label"> </span>
|
|
38
38
|
<!--v-if-->
|
|
39
39
|
</button></div>
|
|
40
40
|
</section>"
|