@weni/unnnic-system 3.4.0 → 3.4.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 +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 +8 -8
- 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 +15 -15
- 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 +3 -3
- 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 +97 -28
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +8 -8
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +4 -4
- 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 +2402 -1146
- 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-479daf92.mjs} +1 -1
- package/dist/{index-832905fc.mjs → index-a8aa7094.mjs} +18065 -11737
- 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-32c84cc8.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +141 -129
- 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/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/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 +30 -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/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,11 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
:class="[
|
|
4
|
-
'text-input',
|
|
5
|
-
`size--${size}`,
|
|
6
|
-
`text-input--icon-right-size-${iconRightSize}`,
|
|
7
|
-
]"
|
|
8
|
-
>
|
|
2
|
+
<div :class="['text-input', `size--${size}`]">
|
|
9
3
|
<BaseInput
|
|
10
4
|
v-bind="attributes"
|
|
11
5
|
ref="base-input"
|
|
@@ -18,6 +12,10 @@
|
|
|
18
12
|
class="input-itself"
|
|
19
13
|
:hasIconLeft="!!iconLeft"
|
|
20
14
|
:hasIconRight="!!iconRight || allowTogglePassword"
|
|
15
|
+
:hasClearIcon="showClear"
|
|
16
|
+
:maxlength="maxlength"
|
|
17
|
+
:readonly="readonly"
|
|
18
|
+
:forceActiveStatus="forceActiveStatus"
|
|
21
19
|
@focus="onFocus"
|
|
22
20
|
@blur="onBlur"
|
|
23
21
|
/>
|
|
@@ -26,24 +24,34 @@
|
|
|
26
24
|
v-if="iconLeft"
|
|
27
25
|
:scheme="iconScheme"
|
|
28
26
|
:icon="iconLeft"
|
|
29
|
-
size="
|
|
27
|
+
size="ant"
|
|
30
28
|
:clickable="iconLeftClickable"
|
|
31
29
|
:class="['icon-left', { clickable: iconLeftClickable }]"
|
|
32
30
|
@click="onIconLeftClick"
|
|
33
31
|
/>
|
|
34
32
|
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
<section class="icon-right-container">
|
|
34
|
+
<UnnnicIcon
|
|
35
|
+
v-if="showClear"
|
|
36
|
+
class="icon-clear"
|
|
37
|
+
:scheme="iconScheme"
|
|
38
|
+
icon="close"
|
|
39
|
+
size="ant"
|
|
40
|
+
clickable
|
|
41
|
+
@click.stop="onClearClick"
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
<UnnnicIcon
|
|
45
|
+
v-if="iconRightSvg"
|
|
46
|
+
:scheme="iconScheme"
|
|
47
|
+
:icon="iconRightSvg"
|
|
48
|
+
size="ant"
|
|
49
|
+
:clickable="iconRightClickable || allowTogglePassword"
|
|
50
|
+
class="icon-right"
|
|
51
|
+
:class="{ clickable: iconRightClickable || allowTogglePassword }"
|
|
52
|
+
@click="onIconRightClick"
|
|
53
|
+
/>
|
|
54
|
+
</section>
|
|
47
55
|
</div>
|
|
48
56
|
</template>
|
|
49
57
|
|
|
@@ -92,10 +100,6 @@ export default {
|
|
|
92
100
|
type: Boolean,
|
|
93
101
|
default: null,
|
|
94
102
|
},
|
|
95
|
-
iconRightSize: {
|
|
96
|
-
type: String,
|
|
97
|
-
default: 'sm',
|
|
98
|
-
},
|
|
99
103
|
allowTogglePassword: {
|
|
100
104
|
type: Boolean,
|
|
101
105
|
default: null,
|
|
@@ -108,8 +112,28 @@ export default {
|
|
|
108
112
|
type: String,
|
|
109
113
|
default: 'md',
|
|
110
114
|
},
|
|
115
|
+
maxlength: {
|
|
116
|
+
type: Number,
|
|
117
|
+
default: null,
|
|
118
|
+
},
|
|
119
|
+
disabled: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: false,
|
|
122
|
+
},
|
|
123
|
+
readonly: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: false,
|
|
126
|
+
},
|
|
127
|
+
forceActiveStatus: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: false,
|
|
130
|
+
},
|
|
131
|
+
showClear: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: false,
|
|
134
|
+
},
|
|
111
135
|
},
|
|
112
|
-
emits: ['icon-left-click', 'icon-right-click'],
|
|
136
|
+
emits: ['icon-left-click', 'icon-right-click', 'clear'],
|
|
113
137
|
data() {
|
|
114
138
|
return {
|
|
115
139
|
isFocused: false,
|
|
@@ -118,7 +142,7 @@ export default {
|
|
|
118
142
|
},
|
|
119
143
|
computed: {
|
|
120
144
|
isDisabled() {
|
|
121
|
-
return this.$attrs.disabled;
|
|
145
|
+
return this.$attrs.disabled || this.disabled;
|
|
122
146
|
},
|
|
123
147
|
|
|
124
148
|
iconRightSvg() {
|
|
@@ -131,22 +155,22 @@ export default {
|
|
|
131
155
|
|
|
132
156
|
iconScheme() {
|
|
133
157
|
if (this.type === 'error') {
|
|
134
|
-
return '
|
|
158
|
+
return 'fg-critical';
|
|
135
159
|
}
|
|
136
160
|
|
|
137
161
|
if (this.isDisabled) {
|
|
138
|
-
return '
|
|
162
|
+
return 'fg-muted';
|
|
139
163
|
}
|
|
140
164
|
|
|
141
|
-
if (this.modelValue || this.isFocused) {
|
|
142
|
-
return '
|
|
165
|
+
if (this.modelValue || this.isFocused || this.forceActiveStatus) {
|
|
166
|
+
return 'color-gray-700';
|
|
143
167
|
}
|
|
144
168
|
|
|
145
169
|
if (this.hasCloudyColor) {
|
|
146
|
-
return '
|
|
170
|
+
return 'fg-base';
|
|
147
171
|
}
|
|
148
172
|
|
|
149
|
-
return '
|
|
173
|
+
return 'fg-base';
|
|
150
174
|
},
|
|
151
175
|
|
|
152
176
|
attributes() {
|
|
@@ -171,6 +195,10 @@ export default {
|
|
|
171
195
|
if (this.iconLeftClickable) this.$emit('icon-left-click');
|
|
172
196
|
},
|
|
173
197
|
|
|
198
|
+
onClearClick() {
|
|
199
|
+
this.$emit('clear');
|
|
200
|
+
},
|
|
201
|
+
|
|
174
202
|
onIconRightClick() {
|
|
175
203
|
if (this.attributes.disabled) return;
|
|
176
204
|
if (this.allowTogglePassword) this.showPassword = !this.showPassword;
|
|
@@ -183,42 +211,38 @@ export default {
|
|
|
183
211
|
<style lang="scss" scoped>
|
|
184
212
|
@use '@/assets/scss/unnnic' as *;
|
|
185
213
|
|
|
214
|
+
.text-input {
|
|
215
|
+
position: relative;
|
|
216
|
+
}
|
|
217
|
+
|
|
186
218
|
.icon {
|
|
187
|
-
&-left
|
|
188
|
-
|
|
219
|
+
&-left {
|
|
220
|
+
position: absolute;
|
|
221
|
+
top: 50%;
|
|
222
|
+
transform: translateY(-50%);
|
|
223
|
+
left: $unnnic-space-4;
|
|
224
|
+
|
|
189
225
|
&:not(.clickable) {
|
|
190
226
|
pointer-events: none;
|
|
191
227
|
}
|
|
192
228
|
}
|
|
193
229
|
|
|
194
|
-
&-
|
|
230
|
+
&-right-container {
|
|
195
231
|
position: absolute;
|
|
196
|
-
top:
|
|
197
|
-
|
|
198
|
-
|
|
232
|
+
top: 50%;
|
|
233
|
+
transform: translateY(-50%);
|
|
234
|
+
right: $unnnic-space-4;
|
|
199
235
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
right: $unnnic-inline-sm - $unnnic-border-width-thinner;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
.text-input {
|
|
207
|
-
position: relative;
|
|
236
|
+
display: flex;
|
|
237
|
+
align-items: center;
|
|
238
|
+
gap: $unnnic-space-2;
|
|
208
239
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
240
|
+
.icon-clear {
|
|
241
|
+
cursor: pointer;
|
|
242
|
+
}
|
|
243
|
+
.icon-right:not(.clickable) {
|
|
244
|
+
pointer-events: none;
|
|
213
245
|
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
&.size--sm.text-input--icon-right-size-ant .icon-right {
|
|
217
|
-
top: 0.5625 * $unnnic-font-size;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
&.size--md.text-input--icon-right-size-ant .icon-right {
|
|
221
|
-
top: 0.8125 * $unnnic-font-size;
|
|
222
246
|
}
|
|
223
247
|
}
|
|
224
248
|
</style>
|
|
@@ -74,22 +74,22 @@ describe('TextInput.vue', () => {
|
|
|
74
74
|
|
|
75
75
|
test('computes the correct iconScheme based on various states', async () => {
|
|
76
76
|
await wrapper.setProps({ type: 'error' });
|
|
77
|
-
expect(wrapper.vm.iconScheme).toBe('
|
|
77
|
+
expect(wrapper.vm.iconScheme).toBe('fg-critical');
|
|
78
78
|
|
|
79
79
|
await wrapper.setProps({ type: 'normal' });
|
|
80
80
|
await wrapper.setData({ isDisabled: true });
|
|
81
|
-
expect(wrapper.vm.iconScheme).toBe('
|
|
81
|
+
expect(wrapper.vm.iconScheme).toBe('fg-base');
|
|
82
82
|
|
|
83
83
|
await wrapper.setData({ isDisabled: false });
|
|
84
84
|
await wrapper.setProps({ modelValue: 'text' });
|
|
85
|
-
expect(wrapper.vm.iconScheme).toBe('
|
|
85
|
+
expect(wrapper.vm.iconScheme).toBe('color-gray-700');
|
|
86
86
|
|
|
87
87
|
await wrapper.setData({ isFocused: true });
|
|
88
|
-
expect(wrapper.vm.iconScheme).toBe('
|
|
88
|
+
expect(wrapper.vm.iconScheme).toBe('color-gray-700');
|
|
89
89
|
|
|
90
90
|
await wrapper.setProps({ hasCloudyColor: true, modelValue: '' });
|
|
91
91
|
await wrapper.setData({ isFocused: false });
|
|
92
|
-
expect(wrapper.vm.iconScheme).toBe('
|
|
92
|
+
expect(wrapper.vm.iconScheme).toBe('fg-base');
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
test('attributes computed property returns combined attributes and props', () => {
|
|
@@ -2,8 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Input.vue > matches the snapshot 1`] = `
|
|
4
4
|
"<div data-v-d890ad85="" class="unnnic-form md">
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
<section data-v-7f222291="" data-v-d890ad85="" class="unnnic-label unnnic-form__label">
|
|
6
|
+
<p data-v-7f222291="" class="unnnic-label__label">Sample Label</p>
|
|
7
|
+
<!--v-if-->
|
|
8
|
+
</section>
|
|
9
|
+
<div data-v-a0d36167="" data-v-d890ad85="" class="text-input size--md unnnic-form-input" mask="####-####"><input data-v-86533b41="" data-v-a0d36167="" class="unnnic-form-input input-itself input size-md normal input--has-icon-left input--has-icon-right unnnic-form-input input-itself" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" hascloudycolor="false" showclear="false" type="text" value=""><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic--clickable icon-left clickable" data-testid="material-icon" translate="no">search</span>
|
|
10
|
+
<section data-v-a0d36167="" class="icon-right-container">
|
|
11
|
+
<!--v-if--><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic--clickable icon-right clickable" data-testid="material-icon" translate="no">clear</span>
|
|
12
|
+
</section>
|
|
13
|
+
</div>
|
|
14
|
+
<section data-v-d890ad85="" class="unnnic-form__hints-container">
|
|
15
|
+
<section data-v-d890ad85="" class="unnnic-form__message-container">
|
|
16
|
+
<p data-v-d890ad85="" class="unnnic-form__message">Error message</p>
|
|
17
|
+
<!--v-if-->
|
|
18
|
+
</section>
|
|
19
|
+
<!--v-if-->
|
|
20
|
+
</section>
|
|
8
21
|
</div>"
|
|
9
22
|
`;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`TextInput.vue > matches the snapshot 1`] = `
|
|
3
|
+
exports[`TextInput.vue > matches the snapshot 1`] = `
|
|
4
|
+
"<div data-v-a0d36167="" class="text-input size--md"><input data-v-86533b41="" data-v-a0d36167="" placeholder="Enter text" iconleft="search" iconright="clear" iconleftclickable="true" iconrightclickable="true" allowtogglepassword="false" hascloudycolor="false" showclear="false" class="input-itself input size-md normal input--has-icon-left input--has-icon-right input-itself" type="text" value=""><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic--clickable icon-left clickable" data-testid="material-icon" translate="no">search</span>
|
|
5
|
+
<section data-v-a0d36167="" class="icon-right-container">
|
|
6
|
+
<!--v-if--><span data-v-26446d8e="" data-v-a0d36167="" class="material-symbols-rounded unnnic-icon-scheme--fg-base unnnic-icon-size--ant unnnic--clickable icon-right clickable" data-testid="material-icon" translate="no">clear</span>
|
|
7
|
+
</section>
|
|
8
|
+
</div>"
|
|
9
|
+
`;
|
|
@@ -1,34 +1,65 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<section class="unnnic-label">
|
|
3
|
+
<p class="unnnic-label__label">{{ fullySanitize(props.label) }}</p>
|
|
4
|
+
<UnnnicToolTip
|
|
5
|
+
v-if="tooltip"
|
|
6
|
+
enabled
|
|
7
|
+
:text="tooltip"
|
|
8
|
+
:enableHtml="props.useHtmlTooltip"
|
|
9
|
+
>
|
|
10
|
+
<UnnnicIcon
|
|
11
|
+
icon="help"
|
|
12
|
+
size="sm"
|
|
13
|
+
scheme="fg-base"
|
|
14
|
+
/>
|
|
15
|
+
</UnnnicToolTip>
|
|
16
|
+
</section>
|
|
3
17
|
</template>
|
|
4
18
|
|
|
5
|
-
<script>
|
|
6
|
-
import { fullySanitize } from '
|
|
7
|
-
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { fullySanitize } from '@/utils/sanitize';
|
|
21
|
+
|
|
22
|
+
import UnnnicToolTip from '../ToolTip/ToolTip.vue';
|
|
23
|
+
import UnnnicIcon from '../Icon.vue';
|
|
24
|
+
|
|
25
|
+
defineOptions({
|
|
8
26
|
name: 'UnnnicLabel',
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export interface LabelProps {
|
|
30
|
+
label?: string;
|
|
31
|
+
tooltip?: string;
|
|
32
|
+
useHtmlTooltip?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const props = withDefaults(defineProps<LabelProps>(), {
|
|
36
|
+
label: '',
|
|
37
|
+
tooltip: '',
|
|
38
|
+
useHtmlTooltip: false,
|
|
39
|
+
});
|
|
19
40
|
</script>
|
|
20
41
|
|
|
21
|
-
<style lang="scss">
|
|
42
|
+
<style lang="scss" scoped>
|
|
22
43
|
@use '@/assets/scss/unnnic' as *;
|
|
23
44
|
|
|
45
|
+
* {
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
padding: $unnnic-space-0;
|
|
48
|
+
margin: $unnnic-space-0;
|
|
49
|
+
}
|
|
50
|
+
|
|
24
51
|
.unnnic-label {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
gap: $unnnic-space-2;
|
|
55
|
+
color: $unnnic-color-fg-base;
|
|
56
|
+
|
|
25
57
|
&__label {
|
|
26
|
-
font
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
margin: $unnnic-spacing-stack-xs 0;
|
|
58
|
+
font: $unnnic-font-body;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:deep(.unnnic-tooltip) {
|
|
62
|
+
display: flex;
|
|
32
63
|
}
|
|
33
64
|
}
|
|
34
65
|
</style>
|
|
@@ -24,7 +24,7 @@ describe('Label', () => {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it('applies the correct classes and styles', () => {
|
|
27
|
-
const label = wrapper.
|
|
27
|
+
const label = wrapper.find('.unnnic-label__label');
|
|
28
28
|
expect(label.html()).toMatchSnapshot();
|
|
29
29
|
});
|
|
30
30
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
|
-
exports[`Label > applies the correct classes and styles 1`] = `"<p class="unnnic-label__label">Label Test</p>"`;
|
|
3
|
+
exports[`Label > applies the correct classes and styles 1`] = `"<p data-v-7f222291="" class="unnnic-label__label">Label Test</p>"`;
|
|
@@ -11,7 +11,7 @@ exports[`ModalDialog.vue > Elements rendering > matches the snapshot 1`] = `
|
|
|
11
11
|
<unnnic-icon-stub data-v-68ebadeb="" filled="false" next="false" icon="test-icon" clickable="false" size="md" scheme="neutral-darkest" data-testid="title-icon" class="unnnic-modal-dialog__container__title-icon"></unnnic-icon-stub>
|
|
12
12
|
<h1 data-v-68ebadeb="" class="unnnic-modal-dialog__container__title-text" data-testid="title-text">Test Title</h1>
|
|
13
13
|
</section>
|
|
14
|
-
<unnnic-icon-stub data-v-68ebadeb="" filled="false" next="false" icon="close" clickable="true" size="md" scheme="neutral-
|
|
14
|
+
<unnnic-icon-stub data-v-68ebadeb="" filled="false" next="false" icon="close" clickable="true" size="md" scheme="neutral-cloudy" data-testid="close-icon"></unnnic-icon-stub>
|
|
15
15
|
</header>
|
|
16
16
|
<section data-v-68ebadeb="" class="unnnic-modal-dialog__container__content"></section>
|
|
17
17
|
<section data-v-68ebadeb="" data-testid="actions-section" class="unnnic-modal-dialog__container__actions">
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { beforeEach, describe, expect, afterEach, test, vi } from 'vitest';
|
|
3
|
+
import UnnnicPopover from '@/components/Popover/index.vue';
|
|
4
|
+
|
|
5
|
+
vi.mock('@vueuse/core', () => ({
|
|
6
|
+
onClickOutside: vi.fn(),
|
|
7
|
+
useResizeObserver: vi.fn(),
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
describe('UnnnicPopover.vue', () => {
|
|
11
|
+
let wrapper;
|
|
12
|
+
|
|
13
|
+
const defaultSlots = {
|
|
14
|
+
trigger: '<button data-testid="trigger-button">Click me</button>',
|
|
15
|
+
content: '<div data-testid="popover-content">Popover content</div>',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const mountWrapper = (props) => {
|
|
19
|
+
return mount(UnnnicPopover, {
|
|
20
|
+
slots: defaultSlots,
|
|
21
|
+
props: {
|
|
22
|
+
...props,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
wrapper = mountWrapper();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
afterEach(() => {
|
|
32
|
+
wrapper?.unmount();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('renders correctly', () => {
|
|
36
|
+
expect(wrapper.exists()).toBe(true);
|
|
37
|
+
expect(wrapper.find('.unnnic-popover').exists()).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('renders trigger slot', () => {
|
|
41
|
+
const trigger = wrapper.find('[data-testid="popover-trigger"]');
|
|
42
|
+
const triggerButton = wrapper.find('[data-testid="trigger-button"]');
|
|
43
|
+
|
|
44
|
+
expect(trigger.exists()).toBe(true);
|
|
45
|
+
expect(triggerButton.exists()).toBe(true);
|
|
46
|
+
expect(triggerButton.text()).toBe('Click me');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('renders content slot inside balloon', async () => {
|
|
50
|
+
wrapper.vm.open = true;
|
|
51
|
+
await wrapper.vm.$nextTick();
|
|
52
|
+
const balloon = wrapper.find('[data-testid="popover-balloon"]');
|
|
53
|
+
const content = wrapper.find('[data-testid="popover-content"]');
|
|
54
|
+
|
|
55
|
+
expect(balloon.exists()).toBe(true);
|
|
56
|
+
expect(content.exists()).toBe(true);
|
|
57
|
+
expect(content.text()).toBe('Popover content');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('balloon is hidden by default', () => {
|
|
61
|
+
const balloon = wrapper.find('[data-testid="popover-balloon"]');
|
|
62
|
+
expect(balloon.exists()).toBe(false);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('toggles balloon visibility when trigger is clicked', async () => {
|
|
66
|
+
const trigger = wrapper.find('[data-testid="popover-trigger"]');
|
|
67
|
+
|
|
68
|
+
let balloon = wrapper.find('[data-testid="popover-balloon"]');
|
|
69
|
+
|
|
70
|
+
expect(balloon.exists()).toBe(false);
|
|
71
|
+
|
|
72
|
+
await trigger.trigger('click');
|
|
73
|
+
await wrapper.vm.$nextTick();
|
|
74
|
+
|
|
75
|
+
balloon = wrapper.find('[data-testid="popover-balloon"]');
|
|
76
|
+
|
|
77
|
+
expect(balloon.exists()).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('uses modelValue when provided', async () => {
|
|
81
|
+
const wrapper = mountWrapper({ modelValue: true });
|
|
82
|
+
const balloon = wrapper.find('[data-testid="popover-balloon"]');
|
|
83
|
+
expect(balloon.isVisible()).toBe(true);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('emits update:modelValue when open state changes', async () => {
|
|
87
|
+
await wrapper.setProps({ modelValue: false });
|
|
88
|
+
|
|
89
|
+
const trigger = wrapper.find('[data-testid="popover-trigger"]');
|
|
90
|
+
await trigger.trigger('click');
|
|
91
|
+
|
|
92
|
+
expect(wrapper.emitted('update:modelValue')).toBeTruthy();
|
|
93
|
+
expect(wrapper.emitted('update:modelValue')[0]).toEqual([true]);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('does not emit update:modelValue when modelValue is undefined', async () => {
|
|
97
|
+
const trigger = wrapper.find('[data-testid="popover-trigger"]');
|
|
98
|
+
await trigger.trigger('click');
|
|
99
|
+
|
|
100
|
+
expect(wrapper.emitted('update:modelValue')).toBeFalsy();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('exposes open ref', () => {
|
|
104
|
+
expect(wrapper.vm.open).toBeDefined();
|
|
105
|
+
expect(typeof wrapper.vm.open).toBe('boolean');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test('open ref can be controlled programmatically', async () => {
|
|
109
|
+
wrapper.vm.open = true;
|
|
110
|
+
await wrapper.vm.$nextTick();
|
|
111
|
+
|
|
112
|
+
const balloon = wrapper.find('[data-testid="popover-balloon"]');
|
|
113
|
+
expect(balloon.isVisible()).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
test('persistent prop prevents closing on outside click', async () => {
|
|
117
|
+
await wrapper.setProps({ persistent: true });
|
|
118
|
+
|
|
119
|
+
const { onClickOutside } = await import('@vueuse/core');
|
|
120
|
+
const mockOnClickOutside = vi.mocked(onClickOutside);
|
|
121
|
+
|
|
122
|
+
const callback = mockOnClickOutside.mock.calls[0][1];
|
|
123
|
+
|
|
124
|
+
wrapper.vm.open = true;
|
|
125
|
+
await wrapper.vm.$nextTick();
|
|
126
|
+
|
|
127
|
+
callback();
|
|
128
|
+
|
|
129
|
+
const balloon = wrapper.find('[data-testid="popover-balloon"]');
|
|
130
|
+
expect(balloon.isVisible()).toBe(true);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('applies correct CSS classes', async () => {
|
|
134
|
+
wrapper.vm.open = true;
|
|
135
|
+
await wrapper.vm.$nextTick();
|
|
136
|
+
|
|
137
|
+
const popover = wrapper.find('.unnnic-popover');
|
|
138
|
+
const balloon = wrapper.find('.unnnic-popover__balloon');
|
|
139
|
+
|
|
140
|
+
expect(popover.exists()).toBe(true);
|
|
141
|
+
expect(balloon.exists()).toBe(true);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('matches the snapshot', () => {
|
|
145
|
+
expect(wrapper.html()).toMatchSnapshot();
|
|
146
|
+
});
|
|
147
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`UnnnicPopover.vue > matches the snapshot 1`] = `
|
|
4
|
+
"<section data-v-5a3125ac="" class="unnnic-popover">
|
|
5
|
+
<div data-v-5a3125ac="" class="unnnic-popover__trigger" data-testid="popover-trigger"><button data-testid="trigger-button">Click me</button></div>
|
|
6
|
+
<!--v-if-->
|
|
7
|
+
</section>"
|
|
8
|
+
`;
|