@weni/unnnic-system 3.4.0 → 3.4.1-alpha.1
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 +1 -1
- package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
- package/dist/components/Alert/Alert.vue.d.ts +18 -119
- 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 +2 -2
- 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 +2 -2
- 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 +3 -3
- package/dist/components/Card/BlankCard.vue.d.ts +1 -1
- package/dist/components/Card/Card.vue.d.ts +21 -21
- package/dist/components/Card/CardCompany.vue.d.ts +8 -8
- package/dist/components/Card/CardData.vue.d.ts +1 -1
- package/dist/components/Card/CardStatusesContainer.vue.d.ts +4 -4
- package/dist/components/Card/ContentCard.vue.d.ts +2 -2
- package/dist/components/Card/DashCard.vue.d.ts +4 -4
- 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 +2 -2
- package/dist/components/CardImage/CardImage.vue.d.ts +24 -33
- package/dist/components/CardInformation/CardInformation.vue.d.ts +4 -4
- package/dist/components/CardProject/CardProject.vue.d.ts +3 -3
- package/dist/components/Carousel/Carousel.vue.d.ts +11 -11
- package/dist/components/Carousel/TagCarousel.vue.d.ts +9 -9
- package/dist/components/ChartBar/ChartBar.vue.d.ts +8 -8
- 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 +31 -40
- 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 -28
- 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 +176 -29
- package/dist/components/DatePicker/DatePicker.vue.d.ts +8 -8
- package/dist/components/Drawer/Drawer.vue.d.ts +7 -7
- 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 +38 -32
- package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
- package/dist/components/Icon.vue.d.ts +1 -1
- package/dist/components/IconLoading/IconLoading.vue.d.ts +1 -1
- package/dist/components/ImportCard/ImportCard.vue.d.ts +7 -7
- package/dist/components/Input/BaseInput.vue.d.ts +32 -1
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +176 -29
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +83 -14
- package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +186 -39
- 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 +9 -9
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
- package/dist/components/ModalNext/ModalNext.vue.d.ts +184 -37
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +14 -14
- 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 +6 -6
- 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 +113 -53
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +8 -8
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +20 -29
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts.map +1 -1
- package/dist/components/SelectTime/index.vue.d.ts +83 -14
- 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 +24 -25
- 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 +6 -6
- package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +1 -1
- package/dist/components/Tag/BrandTag.vue.d.ts +2 -2
- package/dist/components/Tag/DefaultTag.vue.d.ts +2 -2
- package/dist/components/Tag/IndicatorTag.vue.d.ts +2 -2
- package/dist/components/Tag/Tag.vue.d.ts +8 -8
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +9 -0
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +1 -0
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +15 -0
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +1 -0
- package/dist/components/TextArea/TextArea.vue.d.ts +38 -32
- 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 +6 -6
- package/dist/components/Tour/TourPopover.vue.d.ts +6 -6
- package/dist/components/UploadArea/UploadArea.vue.d.ts +7 -7
- package/dist/components/index.d.ts +2590 -1258
- package/dist/components/index.d.ts.map +1 -1
- 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-8265192e.mjs → es-eca523be.mjs} +1 -1
- package/dist/{index-832905fc.mjs → index-c84d6c3d.mjs} +18151 -11782
- package/dist/index.d.ts.map +1 -1
- 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-9ced3d4b.mjs → pt-br-dd7ba97f.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +177 -163
- package/dist/unnnic.umd.js +53 -50
- package/dist/utils/call.d.ts +2 -1
- package/dist/utils/call.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/assets/icons/checkbox-checked-disabled.svg +3 -0
- package/src/assets/icons/checkbox-checked.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/img/previews/doc-preview.png +0 -0
- package/src/assets/img/previews/image-preview.png +0 -0
- package/src/assets/img/previews/video-preview.png +0 -0
- package/src/assets/scss/scheme-colors.scss +115 -238
- package/src/assets/scss/tailwind.scss +15 -15
- package/src/components/Alert/Alert.vue +26 -135
- package/src/components/Alert/Version1dot1.vue +0 -36
- 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 +60 -108
- package/src/components/Button/types.ts +0 -1
- package/src/components/Checkbox/Checkbox.vue +88 -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 +51 -91
- package/src/components/Input/BaseInput.vue +31 -14
- package/src/components/Input/Input.scss +19 -21
- package/src/components/Input/Input.vue +94 -30
- package/src/components/Input/TextInput.vue +82 -58
- package/src/components/Input/__test__/TextInput.spec.js +5 -5
- package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +16 -3
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +7 -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 +1 -0
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
- 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 +110 -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/Switch/Switch.vue +91 -99
- package/src/components/Switch/__tests__/Switch.spec.js +8 -74
- package/src/components/Switch/__tests__/__snapshots__/Switch.spec.js.snap +3 -5
- 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/TemplatePreview/TemplatePreview.vue +252 -0
- package/src/components/TemplatePreview/TemplatePreviewModal.vue +51 -0
- package/src/components/TemplatePreview/types.d.ts +16 -0
- package/src/components/TextArea/TextArea.vue +13 -9
- package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +7 -2
- package/src/components/Toast/Toast.vue +236 -0
- package/src/components/Toast/ToastManager.ts +110 -0
- package/src/components/Toast/types.ts +57 -0
- package/src/components/index.ts +34 -4
- package/src/components/ui/popover/Popover.vue +15 -0
- package/src/components/ui/popover/PopoverContent.vue +98 -0
- package/src/components/ui/popover/PopoverTrigger.vue +12 -0
- package/src/components/ui/popover/index.ts +4 -0
- package/src/index.ts +1 -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 +2 -17
- package/src/stories/Checkbox.stories.js +9 -10
- package/src/stories/CheckboxGroup.stories.js +104 -0
- package/src/stories/Input.stories.js +22 -3
- package/src/stories/Label.stories.js +7 -0
- package/src/stories/Popover.stories.js +306 -0
- package/src/stories/RadioGroup.stories.js +139 -0
- package/src/stories/Select.stories.js +158 -0
- package/src/stories/Switch.stories.js +4 -5
- package/src/stories/Tab.stories.js +11 -4
- package/src/stories/TemplatePreview.stories.js +94 -0
- package/src/stories/TemplatePreviewModal.stories.js +110 -0
- 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
|
@@ -1,37 +1,41 @@
|
|
|
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="unnnic-checkbox"
|
|
7
|
+
type="checkbox"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
:checked="modelValue"
|
|
10
|
+
@change="click"
|
|
11
|
+
v-bind="pick($attrs, ['id', 'name'])"
|
|
12
|
+
/>
|
|
13
|
+
|
|
14
|
+
<p
|
|
15
|
+
v-if="label || textRight"
|
|
16
|
+
:class="[
|
|
17
|
+
'unnnic-checkbox__label',
|
|
18
|
+
{ 'unnnic-checkbox__label--disabled': disabled },
|
|
19
|
+
]"
|
|
20
|
+
data-testid="checkbox-text-right"
|
|
21
|
+
>
|
|
22
|
+
{{ label || textRight }}
|
|
23
|
+
</p>
|
|
24
|
+
</label>
|
|
25
|
+
|
|
26
|
+
<p
|
|
27
|
+
v-if="helper"
|
|
28
|
+
class="unnnic-checkbox__helper"
|
|
22
29
|
>
|
|
23
|
-
{{
|
|
24
|
-
</
|
|
25
|
-
</
|
|
30
|
+
{{ helper }}
|
|
31
|
+
</p>
|
|
32
|
+
</section>
|
|
26
33
|
</template>
|
|
27
34
|
|
|
28
35
|
<script>
|
|
29
|
-
import
|
|
36
|
+
import { pick } from 'lodash';
|
|
30
37
|
|
|
31
38
|
export default {
|
|
32
|
-
components: {
|
|
33
|
-
UnnnicIcon,
|
|
34
|
-
},
|
|
35
39
|
model: {
|
|
36
40
|
event: 'change',
|
|
37
41
|
},
|
|
@@ -50,13 +54,16 @@ export default {
|
|
|
50
54
|
default: false,
|
|
51
55
|
},
|
|
52
56
|
|
|
53
|
-
|
|
57
|
+
label: {
|
|
54
58
|
type: String,
|
|
55
|
-
default: '
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
default: '',
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
helper: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '',
|
|
59
65
|
},
|
|
66
|
+
|
|
60
67
|
textRight: {
|
|
61
68
|
type: String,
|
|
62
69
|
default: '',
|
|
@@ -75,25 +82,11 @@ export default {
|
|
|
75
82
|
|
|
76
83
|
return 'less';
|
|
77
84
|
},
|
|
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
85
|
},
|
|
95
86
|
|
|
96
87
|
methods: {
|
|
88
|
+
pick,
|
|
89
|
+
|
|
97
90
|
click() {
|
|
98
91
|
const isChecked = ['checked', 'less'].includes(this.valueName);
|
|
99
92
|
this.$emit('change', !isChecked);
|
|
@@ -106,35 +99,65 @@ export default {
|
|
|
106
99
|
<style lang="scss" scoped>
|
|
107
100
|
@use '@/assets/scss/unnnic' as *;
|
|
108
101
|
|
|
102
|
+
$checkbox-size: 21px;
|
|
103
|
+
|
|
109
104
|
.unnnic-checkbox-wrapper {
|
|
110
105
|
display: flex;
|
|
106
|
+
flex-direction: column;
|
|
111
107
|
align-items: flex-start;
|
|
112
|
-
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
label {
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
column-gap: $unnnic-space-2;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
.unnnic-checkbox {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
appearance: none;
|
|
118
|
+
width: $checkbox-size;
|
|
119
|
+
height: $checkbox-size;
|
|
120
|
+
margin: 0;
|
|
121
|
+
background-color: $unnnic-color-bg-base;
|
|
122
|
+
border: 1px solid $unnnic-color-border-base;
|
|
123
|
+
border-radius: $unnnic-radius-1;
|
|
124
|
+
box-sizing: border-box;
|
|
125
|
+
|
|
126
|
+
outline: none;
|
|
127
|
+
|
|
128
|
+
&:checked {
|
|
129
|
+
border-width: 0;
|
|
130
|
+
background-color: $unnnic-color-bg-active;
|
|
131
|
+
background-image: url('../../assets/icons/checkbox-checked.svg');
|
|
132
|
+
background-repeat: no-repeat;
|
|
133
|
+
background-position: center;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&:disabled,
|
|
137
|
+
&:disabled:checked {
|
|
138
|
+
background-color: $unnnic-color-bg-muted;
|
|
139
|
+
border: 1px solid $unnnic-color-border-muted;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&:disabled:checked {
|
|
143
|
+
background-image: url('../../assets/icons/checkbox-checked-disabled.svg');
|
|
120
144
|
}
|
|
121
145
|
}
|
|
122
146
|
|
|
123
147
|
.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
|
-
}
|
|
148
|
+
margin: 0;
|
|
149
|
+
font: $unnnic-font-body;
|
|
150
|
+
color: $unnnic-color-fg-emphasized;
|
|
133
151
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
font-size: $unnnic-font-size-body-gt;
|
|
137
|
-
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
|
|
152
|
+
&--disabled {
|
|
153
|
+
color: $unnnic-color-fg-muted;
|
|
138
154
|
}
|
|
139
155
|
}
|
|
156
|
+
|
|
157
|
+
.unnnic-checkbox__helper {
|
|
158
|
+
margin: 0;
|
|
159
|
+
margin-left: $checkbox-size + $unnnic-space-2;
|
|
160
|
+
font: $unnnic-font-caption-2;
|
|
161
|
+
color: $unnnic-color-fg-base;
|
|
162
|
+
}
|
|
140
163
|
</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
|
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section
|
|
3
|
+
:class="[
|
|
4
|
+
'unnnic-checkbox-group__container',
|
|
5
|
+
`unnnic-checkbox-group--state-${state}`,
|
|
6
|
+
]"
|
|
7
|
+
>
|
|
8
|
+
<UnnnicLabel
|
|
9
|
+
v-if="label"
|
|
10
|
+
:label="label"
|
|
11
|
+
:tooltip="labelTooltip"
|
|
12
|
+
:useHtmlTooltip="labelUseHtmlTooltip"
|
|
13
|
+
/>
|
|
14
|
+
|
|
15
|
+
<section class="unnnic-checkbox-group__checkboxes">
|
|
16
|
+
<slot />
|
|
17
|
+
</section>
|
|
18
|
+
|
|
19
|
+
<footer
|
|
20
|
+
v-if="helper"
|
|
21
|
+
class="unnnic-checkbox-group__helper"
|
|
22
|
+
>
|
|
23
|
+
{{ helper }}
|
|
24
|
+
</footer>
|
|
25
|
+
</section>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup>
|
|
29
|
+
import UnnnicLabel from '../Label/Label.vue';
|
|
30
|
+
|
|
31
|
+
const props = defineProps({
|
|
32
|
+
state: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: 'horizontal',
|
|
35
|
+
validator(value) {
|
|
36
|
+
return ['horizontal', 'vertical'].includes(value);
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
label: {
|
|
41
|
+
type: String,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
labelTooltip: {
|
|
45
|
+
type: String,
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
labelUseHtmlTooltip: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
helper: {
|
|
53
|
+
type: String,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style lang="scss" scoped>
|
|
59
|
+
@use '@/assets/scss/unnnic' as *;
|
|
60
|
+
|
|
61
|
+
.unnnic-checkbox-group {
|
|
62
|
+
&__container {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&__checkboxes {
|
|
68
|
+
margin-top: $unnnic-space-3;
|
|
69
|
+
|
|
70
|
+
display: flex;
|
|
71
|
+
gap: $unnnic-space-4 $unnnic-space-6;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&__helper {
|
|
75
|
+
margin-top: $unnnic-space-2;
|
|
76
|
+
font: $unnnic-font-caption-2;
|
|
77
|
+
color: $unnnic-color-fg-base;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&--state-horizontal {
|
|
81
|
+
.unnnic-checkbox-group__checkboxes {
|
|
82
|
+
flex-direction: row;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&--state-vertical {
|
|
87
|
+
.unnnic-checkbox-group__checkboxes {
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.unnnic-checkbox-group__helper {
|
|
92
|
+
margin-top: $unnnic-space-3;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
</style>
|
|
@@ -17,52 +17,31 @@
|
|
|
17
17
|
|
|
18
18
|
<slot></slot>
|
|
19
19
|
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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"
|
|
45
|
-
>
|
|
46
|
-
{{ fullySanitize(message) }}
|
|
47
|
-
|
|
48
|
-
<span
|
|
49
|
-
v-if="!shouldShowErrorSection && !!$slots.rightMessage"
|
|
50
|
-
class="unnnic-form-element__right-message"
|
|
51
|
-
>
|
|
20
|
+
<section class="unnnic-form-element__hints-container">
|
|
21
|
+
<section class="unnnic-form-element__message-container">
|
|
22
|
+
<p
|
|
23
|
+
v-if="message"
|
|
24
|
+
class="unnnic-form-element__message"
|
|
25
|
+
>
|
|
26
|
+
{{ fullySanitize(message) }}
|
|
27
|
+
</p>
|
|
28
|
+
<p
|
|
29
|
+
v-if="!!error.length"
|
|
30
|
+
class="unnnic-form-element__message error"
|
|
31
|
+
>
|
|
32
|
+
{{ Array.isArray(error) ? error.join(', ') : error }}
|
|
33
|
+
</p>
|
|
34
|
+
</section>
|
|
35
|
+
<p v-if="!!$slots.rightMessage">
|
|
52
36
|
<slot name="rightMessage"></slot>
|
|
53
|
-
</
|
|
54
|
-
</
|
|
37
|
+
</p>
|
|
38
|
+
</section>
|
|
55
39
|
</section>
|
|
56
40
|
</template>
|
|
57
41
|
|
|
58
42
|
<script>
|
|
59
|
-
import UnnnicIcon from '../../components/Icon.vue';
|
|
60
43
|
import { fullySanitize } from '../../utils/sanitize';
|
|
61
44
|
export default {
|
|
62
|
-
components: {
|
|
63
|
-
UnnnicIcon,
|
|
64
|
-
},
|
|
65
|
-
|
|
66
45
|
props: {
|
|
67
46
|
size: {
|
|
68
47
|
type: String,
|
|
@@ -70,28 +49,18 @@ export default {
|
|
|
70
49
|
validator: (size) => ['md', 'sm'].includes(size),
|
|
71
50
|
},
|
|
72
51
|
|
|
73
|
-
label: String,
|
|
52
|
+
label: { type: String, default: '' },
|
|
74
53
|
|
|
75
|
-
fixedLabel: Boolean,
|
|
54
|
+
fixedLabel: { type: Boolean, default: false },
|
|
76
55
|
|
|
77
56
|
error: {
|
|
78
57
|
type: [Boolean, String],
|
|
79
58
|
default: false,
|
|
80
59
|
},
|
|
81
60
|
|
|
82
|
-
message: String,
|
|
83
|
-
|
|
84
|
-
disabled: Boolean,
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
data() {
|
|
88
|
-
return {};
|
|
89
|
-
},
|
|
61
|
+
message: { type: String, default: '' },
|
|
90
62
|
|
|
91
|
-
|
|
92
|
-
shouldShowErrorSection() {
|
|
93
|
-
return this.error && (this.error !== true || !!this.$slots.rightMessage);
|
|
94
|
-
},
|
|
63
|
+
disabled: { type: Boolean, default: false },
|
|
95
64
|
},
|
|
96
65
|
methods: {
|
|
97
66
|
fullySanitize,
|
|
@@ -102,75 +71,66 @@ export default {
|
|
|
102
71
|
<style lang="scss" scoped>
|
|
103
72
|
@use '@/assets/scss/unnnic' as *;
|
|
104
73
|
|
|
74
|
+
* {
|
|
75
|
+
margin: $unnnic-space-0;
|
|
76
|
+
padding: $unnnic-space-0;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
}
|
|
79
|
+
|
|
105
80
|
.unnnic-form-element {
|
|
106
81
|
&__label {
|
|
107
|
-
|
|
108
|
-
margin-bottom: $unnnic-spacing-nano;
|
|
109
|
-
|
|
82
|
+
font: $unnnic-font-body;
|
|
110
83
|
color: $unnnic-color-neutral-cloudy;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
$label-bottom-spacing: 3px;
|
|
84
|
+
margin-bottom: $unnnic-space-1;
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
gap: $unnnic-space-2;
|
|
117
88
|
|
|
118
89
|
&--fixed {
|
|
119
|
-
margin-top: -$unnnic-font-size-body-gt - $unnnic-
|
|
120
|
-
$label-bottom-spacing;
|
|
90
|
+
margin-top: -$unnnic-font-size-body-gt - $unnnic-space-2 + $unnnic-space-1;
|
|
121
91
|
}
|
|
122
92
|
|
|
123
93
|
&--fixed {
|
|
124
|
-
margin-bottom: 0;
|
|
94
|
+
margin-bottom: $unnnic-space-0;
|
|
125
95
|
position: absolute;
|
|
126
|
-
padding: 0 $unnnic-
|
|
127
|
-
margin-left: $unnnic-
|
|
96
|
+
padding: $unnnic-space-0 $unnnic-space-1;
|
|
97
|
+
margin-left: $unnnic-space-2;
|
|
128
98
|
|
|
129
99
|
&:after {
|
|
130
100
|
content: ' ';
|
|
131
101
|
position: absolute;
|
|
132
|
-
left: 0;
|
|
133
|
-
bottom: $
|
|
102
|
+
left: $unnnic-space-0;
|
|
103
|
+
bottom: $unnnic-space-1 - $unnnic-border-width-thinner;
|
|
134
104
|
width: 100%;
|
|
135
105
|
height: $unnnic-border-width-thinner;
|
|
136
|
-
background-color: $unnnic-color-
|
|
106
|
+
background-color: $unnnic-color-white;
|
|
137
107
|
}
|
|
138
108
|
}
|
|
139
109
|
}
|
|
140
110
|
|
|
141
|
-
&__error,
|
|
142
111
|
&__message {
|
|
143
|
-
|
|
144
|
-
|
|
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;
|
|
112
|
+
&.error {
|
|
113
|
+
color: $unnnic-color-fg-critical;
|
|
114
|
+
}
|
|
151
115
|
}
|
|
152
116
|
|
|
153
|
-
&
|
|
117
|
+
&__hints-container {
|
|
154
118
|
display: flex;
|
|
155
|
-
|
|
119
|
+
justify-content: space-between;
|
|
120
|
+
margin-top: $unnnic-space-1;
|
|
121
|
+
font: $unnnic-font-caption-2;
|
|
122
|
+
color: $unnnic-color-fg-base;
|
|
156
123
|
}
|
|
157
124
|
|
|
158
|
-
&
|
|
159
|
-
margin-left: auto;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
&__error {
|
|
125
|
+
&__message-container {
|
|
163
126
|
display: flex;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
color: $unnnic-color-aux-red-500;
|
|
127
|
+
flex-direction: column;
|
|
128
|
+
gap: $unnnic-space-1;
|
|
168
129
|
}
|
|
169
130
|
|
|
170
131
|
&--disabled .unnnic-form-element__label,
|
|
171
132
|
&--disabled .unnnic-form-element__message {
|
|
172
133
|
user-select: none;
|
|
173
|
-
color: $unnnic-color-neutral-cleanest;
|
|
174
134
|
}
|
|
175
135
|
}
|
|
176
136
|
</style>
|
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
v-mask="mask"
|
|
5
5
|
v-bind="attributes"
|
|
6
6
|
:value="fullySanitize(modelValue)"
|
|
7
|
-
:class="classes"
|
|
7
|
+
:class="[classes, { focus: forceActiveStatus }]"
|
|
8
8
|
:type="nativeType"
|
|
9
|
+
:readonly="readonly"
|
|
9
10
|
/>
|
|
10
|
-
|
|
11
11
|
<input
|
|
12
12
|
v-else
|
|
13
13
|
v-bind="attributes"
|
|
14
14
|
:value="fullySanitize(modelValue)"
|
|
15
|
-
:class="classes"
|
|
15
|
+
:class="[classes, { focus: forceActiveStatus }]"
|
|
16
16
|
:type="nativeType"
|
|
17
|
+
:maxlength="maxlength"
|
|
18
|
+
:readonly="readonly"
|
|
17
19
|
/>
|
|
18
20
|
</template>
|
|
19
21
|
|
|
@@ -49,6 +51,19 @@ export default {
|
|
|
49
51
|
},
|
|
50
52
|
hasIconLeft: Boolean,
|
|
51
53
|
hasIconRight: Boolean,
|
|
54
|
+
hasClearIcon: Boolean,
|
|
55
|
+
maxlength: {
|
|
56
|
+
type: Number,
|
|
57
|
+
default: null,
|
|
58
|
+
},
|
|
59
|
+
readonly: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false,
|
|
62
|
+
},
|
|
63
|
+
forceActiveStatus: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false,
|
|
66
|
+
},
|
|
52
67
|
},
|
|
53
68
|
emits: ['update:modelValue'],
|
|
54
69
|
data() {
|
|
@@ -73,6 +88,7 @@ export default {
|
|
|
73
88
|
{
|
|
74
89
|
'input--has-icon-left': this.hasIconLeft,
|
|
75
90
|
'input--has-icon-right': this.hasIconRight,
|
|
91
|
+
'input--has-clear-icon': this.hasClearIcon,
|
|
76
92
|
},
|
|
77
93
|
];
|
|
78
94
|
},
|
|
@@ -96,27 +112,28 @@ export default {
|
|
|
96
112
|
&.size {
|
|
97
113
|
&-md {
|
|
98
114
|
@include input-md-font;
|
|
99
|
-
|
|
100
|
-
padding: ($unnnic-spacing-ant - $unnnic-border-width-thinner)
|
|
101
|
-
($unnnic-spacing-sm - $unnnic-border-width-thinner);
|
|
115
|
+
padding: $unnnic-space-3 $unnnic-space-4;
|
|
102
116
|
}
|
|
103
117
|
|
|
104
118
|
&-sm {
|
|
105
119
|
@include input-sm-font;
|
|
106
|
-
|
|
107
|
-
padding: $unnnic-spacing-xs
|
|
108
|
-
($unnnic-spacing-sm - $unnnic-border-width-thinner);
|
|
120
|
+
padding: $unnnic-space-2 $unnnic-space-4;
|
|
109
121
|
}
|
|
110
122
|
}
|
|
111
123
|
|
|
112
124
|
&.input--has-icon-left {
|
|
113
|
-
padding-left: $unnnic-
|
|
114
|
-
$unnnic-spacing-xs - $unnnic-border-width-thinner;
|
|
125
|
+
padding-left: $unnnic-space-10;
|
|
115
126
|
}
|
|
116
127
|
|
|
117
128
|
&.input--has-icon-right {
|
|
118
|
-
padding-right: $unnnic-
|
|
119
|
-
|
|
129
|
+
padding-right: $unnnic-space-10;
|
|
130
|
+
&.input--has-clear-icon {
|
|
131
|
+
padding-right: $unnnic-space-10 + $unnnic-space-6;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&.input--has-clear-icon {
|
|
136
|
+
padding-right: $unnnic-space-10;
|
|
120
137
|
}
|
|
121
138
|
|
|
122
139
|
&.error {
|
|
@@ -126,7 +143,7 @@ export default {
|
|
|
126
143
|
&:-ms-input-placeholder,
|
|
127
144
|
&::-ms-input-placeholder {
|
|
128
145
|
/* Internet Explorer 10-11 */
|
|
129
|
-
color: $unnnic-color-
|
|
146
|
+
color: $unnnic-color-fg-muted;
|
|
130
147
|
}
|
|
131
148
|
}
|
|
132
149
|
</style>
|