@weni/unnnic-system 3.6.0 → 3.7.1-alpha.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 +8 -1
- package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
- package/dist/components/Alert/Alert.vue.d.ts +18 -117
- 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 +5 -5
- 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 +7 -7
- package/dist/components/Carousel/TagCarousel.vue.d.ts +6 -6
- 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 +27 -34
- 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 +253 -43
- 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 +33 -2
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +253 -43
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +86 -26
- package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +259 -49
- package/dist/components/InputNext/InputNext.vue.d.ts +5 -5
- 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 +199 -34
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
- package/dist/components/ModalNext/ModalNext.vue.d.ts +258 -48
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +8 -8
- package/dist/components/MoodRating/MoodRating.vue.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts +20 -14
- 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 +8 -6
- package/dist/components/Radio/Radio.vue.d.ts.map +1 -1
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +115 -62
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +5 -5
- 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 +87 -27
- package/dist/components/SkeletonLoading/skeletonTheme.vue.d.ts +2 -2
- 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/BrandTag.vue.d.ts +1 -1
- package/dist/components/Tag/DefaultTag.vue.d.ts +1 -1
- package/dist/components/Tag/IndicatorTag.vue.d.ts +2 -2
- package/dist/components/Tag/Tag.vue.d.ts +5 -5
- package/dist/components/TextArea/TextArea.vue.d.ts +66 -30
- 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 +4057 -1342
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/ui/dialog/Dialog.vue.d.ts +23 -0
- package/dist/components/ui/dialog/Dialog.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +19 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +40 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts +25 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts +29 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts +23 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +19 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/index.d.ts +8 -0
- package/dist/components/ui/dialog/index.d.ts.map +1 -0
- package/dist/components/ui/popover/Popover.vue.d.ts +23 -0
- package/dist/components/ui/popover/Popover.vue.d.ts.map +1 -0
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +43 -0
- package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +1 -0
- package/dist/components/ui/popover/PopoverTrigger.vue.d.ts +19 -0
- package/dist/components/ui/popover/PopoverTrigger.vue.d.ts.map +1 -0
- package/dist/components/ui/popover/index.d.ts +5 -0
- package/dist/components/ui/popover/index.d.ts.map +1 -0
- package/dist/{es-92fbe460.mjs → es-3d0df246.mjs} +1 -1
- package/dist/{index-0da47957.mjs → index-8cf13f7a.mjs} +19106 -10952
- package/dist/locales/en.json.d.ts +2 -1
- package/dist/locales/es.json.d.ts +2 -1
- package/dist/locales/pt_br.json.d.ts +2 -1
- package/dist/{pt-br-c29b6c9a.mjs → pt-br-b04d6fba.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +195 -172
- package/dist/unnnic.umd.js +56 -50
- package/dist/utils/call.d.ts +2 -1
- package/dist/utils/call.d.ts.map +1 -1
- package/package.json +4 -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/assets/scss/tailwind.scss +8 -0
- package/src/components/Alert/Alert.vue +26 -135
- package/src/components/Alert/SIMPLE_MIGRATION_GUIDE.md +152 -0
- 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__/Version1dot1.spec.js.snap +2 -2
- package/src/components/Button/Button.vue +72 -117
- package/src/components/Button/types.ts +0 -1
- package/src/components/Checkbox/Checkbox.vue +98 -64
- 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 +26 -1
- package/src/components/Input/BaseInput.vue +33 -14
- package/src/components/Input/Input.scss +19 -21
- package/src/components/Input/Input.vue +77 -56
- package/src/components/Input/TextInput.vue +80 -68
- 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/ModalDialog/ModalDialog.vue +60 -146
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -22
- package/src/components/Popover/__tests__/Popover.spec.js +147 -0
- package/src/components/Popover/__tests__/__snapshots__/Popover.spec.js.snap +8 -0
- package/src/components/Popover/index.vue +146 -0
- package/src/components/Radio/Radio.vue +80 -67
- package/src/components/Radio/__test__/Radio.spec.js +14 -20
- package/src/components/Radio/__test__/__snapshots__/Radio.spec.js.snap +3 -3
- package/src/components/RadioGroup/RadioGroup.vue +142 -0
- package/src/components/Select/SelectOption.vue +65 -0
- package/src/components/Select/__tests__/Select.spec.js +412 -0
- package/src/components/Select/__tests__/SelectItem.spec.js +330 -0
- package/src/components/Select/__tests__/SelectOption.spec.js +174 -0
- package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +97 -0
- package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +15 -0
- package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +25 -0
- package/src/components/Select/index.vue +245 -0
- package/src/components/SelectSmart/SelectSmart.vue +4 -3
- package/src/components/Switch/Switch.vue +123 -96
- 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/TextArea/TextArea.vue +34 -11
- 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 +284 -0
- package/src/components/Toast/__tests__/ToastManager.spec.js +294 -0
- package/src/components/Toast/types.ts +57 -0
- package/src/components/index.ts +58 -9
- package/src/components/ui/dialog/Dialog.vue +15 -0
- package/src/components/ui/dialog/DialogClose.vue +25 -0
- package/src/components/ui/dialog/DialogContent.vue +114 -0
- package/src/components/ui/dialog/DialogFooter.vue +46 -0
- package/src/components/ui/dialog/DialogHeader.vue +78 -0
- package/src/components/ui/dialog/DialogTitle.vue +34 -0
- package/src/components/ui/dialog/DialogTrigger.vue +12 -0
- package/src/components/ui/dialog/index.ts +7 -0
- package/src/components/ui/popover/Popover.vue +19 -0
- package/src/components/ui/popover/PopoverContent.vue +98 -0
- package/src/components/ui/popover/PopoverTrigger.vue +23 -0
- package/src/components/ui/popover/index.ts +4 -0
- package/src/locales/en.json +2 -1
- package/src/locales/es.json +2 -1
- package/src/locales/pt_br.json +2 -1
- 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/Dialog.stories.js +832 -0
- package/src/stories/Icon.stories.js +24 -15
- package/src/stories/Input.stories.js +71 -76
- package/src/stories/Label.stories.js +7 -0
- package/src/stories/ModalDialog.mdx +3 -0
- package/src/stories/ModalDialog.stories.js +1 -1
- package/src/stories/Popover.stories.js +306 -0
- package/src/stories/RadioGroup.stories.js +144 -0
- package/src/stories/Select.stories.js +158 -0
- package/src/stories/Switch.stories.js +10 -5
- package/src/stories/Tab.stories.js +11 -4
- package/src/stories/TextArea.stories.js +13 -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/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
|
@@ -6,19 +6,16 @@
|
|
|
6
6
|
:class="[
|
|
7
7
|
'unnnic-button',
|
|
8
8
|
`unnnic-button--size-${size}`,
|
|
9
|
-
`unnnic-button--${
|
|
9
|
+
`unnnic-button--${buttonType}`,
|
|
10
10
|
iconCenter ? `unnnic-button--icon-on-center` : null,
|
|
11
11
|
float ? `unnnic-button--float` : null,
|
|
12
12
|
]"
|
|
13
13
|
>
|
|
14
|
-
<
|
|
14
|
+
<UnnnicIconLoading
|
|
15
15
|
v-if="loading"
|
|
16
|
-
icon="loading-circle-1"
|
|
17
16
|
:scheme="iconScheme"
|
|
18
17
|
:size="iconSize"
|
|
19
|
-
:filled="iconsFilled"
|
|
20
18
|
:style="{ position: 'absolute' }"
|
|
21
|
-
class="rotation"
|
|
22
19
|
data-testid="icon-loading"
|
|
23
20
|
/>
|
|
24
21
|
|
|
@@ -30,6 +27,7 @@
|
|
|
30
27
|
:filled="iconsFilled"
|
|
31
28
|
:class="{ 'unnnic-button__icon-left': hasText }"
|
|
32
29
|
:style="{ visibility: loading ? 'hidden' : 'visible' }"
|
|
30
|
+
:next="next"
|
|
33
31
|
data-testid="icon-left"
|
|
34
32
|
/>
|
|
35
33
|
|
|
@@ -40,6 +38,7 @@
|
|
|
40
38
|
:style="{ visibility: loading ? 'hidden' : 'visible' }"
|
|
41
39
|
:size="iconSize"
|
|
42
40
|
:filled="iconsFilled"
|
|
41
|
+
:next="next"
|
|
43
42
|
data-testid="icon-center"
|
|
44
43
|
/>
|
|
45
44
|
|
|
@@ -60,6 +59,7 @@
|
|
|
60
59
|
:filled="iconsFilled"
|
|
61
60
|
:class="{ 'unnnic-button__icon-right': hasText }"
|
|
62
61
|
:style="{ visibility: loading ? 'hidden' : 'visible' }"
|
|
62
|
+
:next="next"
|
|
63
63
|
data-testid="icon-right"
|
|
64
64
|
/>
|
|
65
65
|
</button>
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
<script setup lang="ts">
|
|
69
69
|
import { computed, watch, useSlots } from 'vue';
|
|
70
70
|
import UnnnicIcon from '../Icon.vue';
|
|
71
|
+
import UnnnicIconLoading from '../IconLoading/IconLoading.vue';
|
|
71
72
|
import type { ButtonProps, ButtonSize, ButtonType } from './types';
|
|
72
73
|
import type { SchemeColor } from '@/types/scheme-colors';
|
|
73
74
|
|
|
@@ -86,6 +87,7 @@ const props = withDefaults(defineProps<ButtonProps>(), {
|
|
|
86
87
|
iconRight: '',
|
|
87
88
|
iconCenter: '',
|
|
88
89
|
iconsFilled: false,
|
|
90
|
+
next: false,
|
|
89
91
|
disabled: false,
|
|
90
92
|
loading: false,
|
|
91
93
|
});
|
|
@@ -97,8 +99,8 @@ const buttonDisabled = computed(() => {
|
|
|
97
99
|
});
|
|
98
100
|
|
|
99
101
|
const iconSize = computed(() => {
|
|
100
|
-
if (props.size === '
|
|
101
|
-
return '
|
|
102
|
+
if (props.size === 'extra-large') return 'lg';
|
|
103
|
+
return 'ant';
|
|
102
104
|
});
|
|
103
105
|
|
|
104
106
|
const hasText = computed(() => {
|
|
@@ -115,12 +117,11 @@ const iconScheme = computed((): SchemeColor => {
|
|
|
115
117
|
primary: 'neutral-white',
|
|
116
118
|
secondary: 'neutral-dark',
|
|
117
119
|
tertiary: 'neutral-dark',
|
|
118
|
-
alternative: 'neutral-white',
|
|
119
120
|
warning: 'neutral-white',
|
|
120
121
|
attention: 'neutral-white',
|
|
121
122
|
};
|
|
122
123
|
|
|
123
|
-
return typeToSchemeMap[
|
|
124
|
+
return typeToSchemeMap[buttonType.value] || 'neutral-white';
|
|
124
125
|
});
|
|
125
126
|
|
|
126
127
|
const isSizePropValid = computed(() => {
|
|
@@ -131,16 +132,23 @@ const isSizePropValid = computed(() => {
|
|
|
131
132
|
);
|
|
132
133
|
});
|
|
133
134
|
|
|
135
|
+
const buttonType = computed(() => {
|
|
136
|
+
return (
|
|
137
|
+
{
|
|
138
|
+
alternative: 'tertiary',
|
|
139
|
+
}[props.type] || props.type
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
|
|
134
143
|
const isTypePropValid = computed(() => {
|
|
135
144
|
const validTypes: ButtonType[] = [
|
|
136
145
|
'primary',
|
|
137
146
|
'secondary',
|
|
138
147
|
'tertiary',
|
|
139
|
-
'alternative',
|
|
140
148
|
'warning',
|
|
141
149
|
'attention',
|
|
142
150
|
];
|
|
143
|
-
return validTypes.includes(
|
|
151
|
+
return validTypes.includes(buttonType.value);
|
|
144
152
|
});
|
|
145
153
|
|
|
146
154
|
const validateProps = () => {
|
|
@@ -154,6 +162,8 @@ const validateProps = () => {
|
|
|
154
162
|
|
|
155
163
|
if (!isTypePropValid.value) {
|
|
156
164
|
errorMessage += ' Invalid type prop.';
|
|
165
|
+
errorMessage +=
|
|
166
|
+
' Please provide one of the following types: primary, secondary, tertiary, warning, attention. Alternative is discontinued and it was forced renamed to tertiary.';
|
|
157
167
|
}
|
|
158
168
|
|
|
159
169
|
throw new Error(errorMessage);
|
|
@@ -191,16 +201,23 @@ watch(
|
|
|
191
201
|
display: inline-flex;
|
|
192
202
|
align-items: center;
|
|
193
203
|
justify-content: center;
|
|
194
|
-
border-radius: $unnnic-
|
|
204
|
+
border-radius: $unnnic-radius-2;
|
|
195
205
|
border: 0;
|
|
196
206
|
outline: none;
|
|
197
207
|
overflow: hidden;
|
|
198
208
|
white-space: nowrap;
|
|
199
|
-
font
|
|
200
|
-
font-family: $unnnic-font-family-secondary;
|
|
209
|
+
font: $unnnic-font-action;
|
|
201
210
|
cursor: pointer;
|
|
202
211
|
position: relative;
|
|
203
212
|
|
|
213
|
+
transition-property: color, background-color, border-color;
|
|
214
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
215
|
+
transition-duration: 0.15s;
|
|
216
|
+
|
|
217
|
+
* > {
|
|
218
|
+
cursor: pointer;
|
|
219
|
+
}
|
|
220
|
+
|
|
204
221
|
&__icon {
|
|
205
222
|
&-left {
|
|
206
223
|
margin-right: $unnnic-inline-nano;
|
|
@@ -211,129 +228,91 @@ watch(
|
|
|
211
228
|
}
|
|
212
229
|
}
|
|
213
230
|
|
|
231
|
+
&--primary,
|
|
232
|
+
&--warning,
|
|
233
|
+
&--attention {
|
|
234
|
+
color: $unnnic-color-fg-inverted;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
&--secondary,
|
|
238
|
+
&--tertiary {
|
|
239
|
+
color: $unnnic-color-fg-emphasized;
|
|
240
|
+
}
|
|
241
|
+
|
|
214
242
|
&--primary {
|
|
215
|
-
background-color: $unnnic-color-
|
|
216
|
-
color: $unnnic-color-neutral-white;
|
|
243
|
+
background-color: $unnnic-color-bg-active;
|
|
217
244
|
|
|
218
245
|
&:hover:enabled {
|
|
219
|
-
background-color: $unnnic-color-
|
|
246
|
+
background-color: $unnnic-color-teal-700;
|
|
220
247
|
}
|
|
221
248
|
|
|
222
249
|
&:active:enabled {
|
|
223
|
-
background-color: $unnnic-color-
|
|
250
|
+
background-color: $unnnic-color-teal-800;
|
|
224
251
|
}
|
|
225
252
|
}
|
|
226
253
|
|
|
227
254
|
&--secondary {
|
|
228
|
-
background-color: $unnnic-color-
|
|
229
|
-
color: $unnnic-color-neutral-dark;
|
|
255
|
+
background-color: $unnnic-color-bg-base;
|
|
230
256
|
box-shadow: inset 0 0 0 $unnnic-border-width-thinner
|
|
231
|
-
$unnnic-color-
|
|
257
|
+
$unnnic-color-border-base;
|
|
232
258
|
|
|
233
259
|
&:hover:enabled {
|
|
234
|
-
background-color: $unnnic-color-
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
&:disabled {
|
|
238
|
-
box-shadow: none;
|
|
260
|
+
background-color: $unnnic-color-gray-50;
|
|
239
261
|
}
|
|
240
262
|
|
|
241
263
|
&:active:enabled {
|
|
242
|
-
background-color: $unnnic-color-
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
&--tertiary {
|
|
247
|
-
background-color: transparent;
|
|
248
|
-
color: $unnnic-color-neutral-dark;
|
|
249
|
-
|
|
250
|
-
&:hover:enabled {
|
|
251
|
-
background-color: $unnnic-color-neutral-light;
|
|
264
|
+
background-color: $unnnic-color-gray-100;
|
|
252
265
|
}
|
|
253
266
|
|
|
254
267
|
&:disabled {
|
|
255
|
-
|
|
256
|
-
cursor: not-allowed;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
&:active:enabled {
|
|
260
|
-
background-color: $unnnic-color-neutral-soft;
|
|
268
|
+
box-shadow: none;
|
|
261
269
|
}
|
|
262
270
|
}
|
|
263
271
|
|
|
264
|
-
&--
|
|
265
|
-
background-color:
|
|
266
|
-
color: $unnnic-color-weni-800;
|
|
267
|
-
|
|
268
|
-
:deep(svg .primary) {
|
|
269
|
-
fill: $unnnic-color-weni-800;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
:deep(svg .primary-stroke) {
|
|
273
|
-
stroke: $unnnic-color-weni-800;
|
|
274
|
-
}
|
|
272
|
+
&--tertiary {
|
|
273
|
+
background-color: transparent;
|
|
275
274
|
|
|
276
275
|
&:hover:enabled {
|
|
277
|
-
background-color: $unnnic-color-
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
&:disabled {
|
|
281
|
-
:deep(svg .primary) {
|
|
282
|
-
fill: $unnnic-color-neutral-clean;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
:deep(svg .primary-stroke) {
|
|
286
|
-
stroke: $unnnic-color-neutral-clean;
|
|
287
|
-
}
|
|
276
|
+
background-color: rgba($unnnic-color-gray-400, 0.1);
|
|
288
277
|
}
|
|
289
278
|
|
|
290
279
|
&:active:enabled {
|
|
291
|
-
background-color: $unnnic-color-
|
|
292
|
-
color: $unnnic-color-weni-900;
|
|
293
|
-
|
|
294
|
-
:deep(svg .primary) {
|
|
295
|
-
fill: $unnnic-color-weni-900;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
:deep(svg .primary-stroke) {
|
|
299
|
-
stroke: $unnnic-color-weni-900;
|
|
300
|
-
}
|
|
280
|
+
background-color: rgba($unnnic-color-gray-400, 0.2);
|
|
301
281
|
}
|
|
302
282
|
}
|
|
303
283
|
|
|
304
284
|
&--warning {
|
|
305
|
-
background-color: $unnnic-color-
|
|
285
|
+
background-color: $unnnic-color-red-500;
|
|
306
286
|
color: $unnnic-color-neutral-white;
|
|
307
287
|
|
|
308
288
|
&:hover:enabled {
|
|
309
|
-
background-color: $unnnic-color-
|
|
289
|
+
background-color: $unnnic-color-red-600;
|
|
310
290
|
}
|
|
311
291
|
|
|
312
292
|
&:active:enabled {
|
|
313
|
-
background-color: $unnnic-color-
|
|
293
|
+
background-color: $unnnic-color-red-700;
|
|
314
294
|
}
|
|
315
295
|
}
|
|
316
296
|
|
|
317
297
|
&--attention {
|
|
318
|
-
background-color: $unnnic-color-
|
|
319
|
-
color: $unnnic-color-neutral-white;
|
|
298
|
+
background-color: $unnnic-color-yellow-500;
|
|
320
299
|
|
|
321
300
|
&:hover:enabled {
|
|
322
|
-
background-color: $unnnic-color-
|
|
301
|
+
background-color: $unnnic-color-yellow-600;
|
|
323
302
|
}
|
|
324
303
|
|
|
325
304
|
&:active:enabled {
|
|
326
|
-
background-color: $unnnic-color-
|
|
305
|
+
background-color: $unnnic-color-yellow-700;
|
|
327
306
|
}
|
|
328
307
|
}
|
|
329
308
|
|
|
330
309
|
&--primary:disabled,
|
|
331
310
|
&--secondary:disabled,
|
|
332
|
-
&--
|
|
311
|
+
&--tertiary:disabled,
|
|
333
312
|
&--warning:disabled,
|
|
334
313
|
&--attention:disabled {
|
|
335
|
-
background-color: $unnnic-color-
|
|
336
|
-
color: $unnnic-color-
|
|
314
|
+
background-color: $unnnic-color-bg-muted;
|
|
315
|
+
color: $unnnic-color-fg-muted;
|
|
337
316
|
cursor: not-allowed;
|
|
338
317
|
}
|
|
339
318
|
|
|
@@ -346,26 +325,12 @@ watch(
|
|
|
346
325
|
box-shadow: $unnnic-shadow-level-near;
|
|
347
326
|
}
|
|
348
327
|
|
|
349
|
-
&--size {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
&-small {
|
|
353
|
-
padding: $unnnic-squish-xs;
|
|
354
|
-
font-size: $unnnic-font-size-body-gt;
|
|
355
|
-
line-height: ($unnnic-font-size-body-gt + $unnnic-line-height-medium);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
&-extra-large {
|
|
359
|
-
height: 58px;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
&-large {
|
|
363
|
-
height: 46px;
|
|
364
|
-
}
|
|
328
|
+
&--size-large {
|
|
329
|
+
padding: $unnnic-space-3 $unnnic-space-4;
|
|
330
|
+
}
|
|
365
331
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}
|
|
332
|
+
&--size-small {
|
|
333
|
+
padding: $unnnic-space-2 $unnnic-space-4;
|
|
369
334
|
}
|
|
370
335
|
}
|
|
371
336
|
</style>
|
|
@@ -383,29 +348,19 @@ watch(
|
|
|
383
348
|
}
|
|
384
349
|
|
|
385
350
|
&-large {
|
|
386
|
-
height:
|
|
387
|
-
width:
|
|
351
|
+
height: 45px;
|
|
352
|
+
width: 45px;
|
|
388
353
|
}
|
|
389
354
|
|
|
390
355
|
&-large,
|
|
391
356
|
&-extra-large {
|
|
392
357
|
padding: $unnnic-inset-xs;
|
|
393
|
-
|
|
394
|
-
.unnnic-icon {
|
|
395
|
-
width: $unnnic-icon-size-md;
|
|
396
|
-
height: $unnnic-icon-size-md;
|
|
397
|
-
}
|
|
398
358
|
}
|
|
399
359
|
|
|
400
360
|
&-small {
|
|
401
361
|
padding: $unnnic-inset-nano;
|
|
402
|
-
height:
|
|
403
|
-
width:
|
|
404
|
-
|
|
405
|
-
.unnnic-icon {
|
|
406
|
-
width: $unnnic-icon-size-ant;
|
|
407
|
-
height: $unnnic-icon-size-ant;
|
|
408
|
-
}
|
|
362
|
+
height: 37px;
|
|
363
|
+
width: 37px;
|
|
409
364
|
}
|
|
410
365
|
}
|
|
411
366
|
}
|
|
@@ -1,37 +1,44 @@
|
|
|
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
|
-
|
|
3
|
+
<section class="unnnic-checkbox-wrapper">
|
|
4
|
+
<label>
|
|
5
|
+
<input
|
|
6
|
+
:class="[
|
|
7
|
+
'unnnic-checkbox',
|
|
8
|
+
{ 'unnnic-checkbox--less': modelValue === 'less' },
|
|
9
|
+
]"
|
|
10
|
+
type="checkbox"
|
|
11
|
+
:disabled="disabled"
|
|
12
|
+
:checked="modelValue === 'less' || modelValue"
|
|
13
|
+
@change="click"
|
|
14
|
+
v-bind="pick($attrs, ['id', 'name'])"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
<p
|
|
18
|
+
v-if="label || textRight"
|
|
19
|
+
:class="[
|
|
20
|
+
'unnnic-checkbox__label',
|
|
21
|
+
{ 'unnnic-checkbox__label--disabled': disabled },
|
|
22
|
+
]"
|
|
23
|
+
data-testid="checkbox-text-right"
|
|
24
|
+
>
|
|
25
|
+
{{ label || textRight }}
|
|
26
|
+
</p>
|
|
27
|
+
</label>
|
|
28
|
+
|
|
29
|
+
<p
|
|
30
|
+
v-if="helper"
|
|
31
|
+
class="unnnic-checkbox__helper"
|
|
22
32
|
>
|
|
23
|
-
{{
|
|
24
|
-
</
|
|
25
|
-
</
|
|
33
|
+
{{ helper }}
|
|
34
|
+
</p>
|
|
35
|
+
</section>
|
|
26
36
|
</template>
|
|
27
37
|
|
|
28
38
|
<script>
|
|
29
|
-
import
|
|
39
|
+
import { pick } from 'lodash';
|
|
30
40
|
|
|
31
41
|
export default {
|
|
32
|
-
components: {
|
|
33
|
-
UnnnicIcon,
|
|
34
|
-
},
|
|
35
42
|
model: {
|
|
36
43
|
event: 'change',
|
|
37
44
|
},
|
|
@@ -50,13 +57,16 @@ export default {
|
|
|
50
57
|
default: false,
|
|
51
58
|
},
|
|
52
59
|
|
|
53
|
-
|
|
60
|
+
label: {
|
|
54
61
|
type: String,
|
|
55
|
-
default: '
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
default: '',
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
helper: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: '',
|
|
59
68
|
},
|
|
69
|
+
|
|
60
70
|
textRight: {
|
|
61
71
|
type: String,
|
|
62
72
|
default: '',
|
|
@@ -75,25 +85,11 @@ export default {
|
|
|
75
85
|
|
|
76
86
|
return 'less';
|
|
77
87
|
},
|
|
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
|
-
},
|
|
94
88
|
},
|
|
95
89
|
|
|
96
90
|
methods: {
|
|
91
|
+
pick,
|
|
92
|
+
|
|
97
93
|
click() {
|
|
98
94
|
const isChecked = ['checked', 'less'].includes(this.valueName);
|
|
99
95
|
this.$emit('change', !isChecked);
|
|
@@ -106,35 +102,73 @@ export default {
|
|
|
106
102
|
<style lang="scss" scoped>
|
|
107
103
|
@use '@/assets/scss/unnnic' as *;
|
|
108
104
|
|
|
105
|
+
$checkbox-size: 21px;
|
|
106
|
+
|
|
109
107
|
.unnnic-checkbox-wrapper {
|
|
110
108
|
display: flex;
|
|
109
|
+
flex-direction: column;
|
|
111
110
|
align-items: flex-start;
|
|
112
|
-
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
label {
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
column-gap: $unnnic-space-2;
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
.unnnic-checkbox {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
appearance: none;
|
|
121
|
+
width: $checkbox-size;
|
|
122
|
+
height: $checkbox-size;
|
|
123
|
+
margin: 0;
|
|
124
|
+
background-color: $unnnic-color-bg-base;
|
|
125
|
+
border: 1px solid $unnnic-color-border-base;
|
|
126
|
+
border-radius: $unnnic-radius-1;
|
|
127
|
+
box-sizing: border-box;
|
|
128
|
+
|
|
129
|
+
outline: none;
|
|
130
|
+
|
|
131
|
+
&:checked {
|
|
132
|
+
border-width: 0;
|
|
133
|
+
background-color: $unnnic-color-bg-active;
|
|
134
|
+
background-image: url('../../assets/icons/checkbox-checked.svg');
|
|
135
|
+
background-repeat: no-repeat;
|
|
136
|
+
background-position: center;
|
|
137
|
+
|
|
138
|
+
&.unnnic-checkbox--less {
|
|
139
|
+
background-image: url('../../assets/icons/checkbox-less.svg');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&:disabled,
|
|
144
|
+
&:disabled:checked {
|
|
145
|
+
background-color: $unnnic-color-bg-muted;
|
|
146
|
+
border: 1px solid $unnnic-color-border-muted;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&:disabled:checked {
|
|
150
|
+
background-image: url('../../assets/icons/checkbox-checked-disabled.svg');
|
|
151
|
+
|
|
152
|
+
&.unnnic-checkbox--less {
|
|
153
|
+
background-image: url('../../assets/icons/checkbox-less-disabled.svg');
|
|
119
154
|
}
|
|
120
155
|
}
|
|
121
156
|
}
|
|
122
157
|
|
|
123
158
|
.unnnic-checkbox__label {
|
|
124
|
-
|
|
125
|
-
font
|
|
126
|
-
color: $unnnic-color-
|
|
127
|
-
|
|
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;
|
|
132
|
-
}
|
|
159
|
+
margin: 0;
|
|
160
|
+
font: $unnnic-font-body;
|
|
161
|
+
color: $unnnic-color-fg-emphasized;
|
|
133
162
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
font-size: $unnnic-font-size-body-gt;
|
|
137
|
-
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
|
|
163
|
+
&--disabled {
|
|
164
|
+
color: $unnnic-color-fg-muted;
|
|
138
165
|
}
|
|
139
166
|
}
|
|
167
|
+
|
|
168
|
+
.unnnic-checkbox__helper {
|
|
169
|
+
margin: 0;
|
|
170
|
+
margin-left: $checkbox-size + $unnnic-space-2;
|
|
171
|
+
font: $unnnic-font-caption-2;
|
|
172
|
+
color: $unnnic-color-fg-base;
|
|
173
|
+
}
|
|
140
174
|
</style>
|
|
@@ -24,43 +24,28 @@ 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.find('input[type="checkbox"]');
|
|
28
28
|
|
|
29
29
|
// click false to true
|
|
30
|
-
await checkbox.trigger('
|
|
30
|
+
await checkbox.trigger('change');
|
|
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('change');
|
|
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.valueName).eq('less');
|
|
41
|
+
await checkbox.trigger('change');
|
|
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.find('input[type="checkbox"]');
|
|
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
|
-
});
|
|
66
51
|
});
|