@weni/unnnic-system 3.2.1 → 3.2.3
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 +31 -0
- package/dist/components/Accordion/Accordion.vue.d.ts +13 -72
- package/dist/components/Alert/Alert.vue.d.ts +28 -146
- package/dist/components/Alert/Version1dot1.vue.d.ts +14 -73
- package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +13 -72
- package/dist/components/AudioRecorder/AudioPlayer.vue.d.ts +13 -72
- package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +39 -216
- package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +13 -72
- package/dist/components/Banner/Banner.vue.d.ts +13 -72
- package/dist/components/Banner/InfoBanner.vue.d.ts +13 -72
- package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +13 -72
- package/dist/components/Button/Button.vue.d.ts +21 -180
- package/dist/components/Button/Button.vue.d.ts.map +1 -1
- package/dist/components/Button/ButtonIcon.vue.d.ts +13 -72
- package/dist/components/Button/types.d.ts +16 -0
- package/dist/components/Button/types.d.ts.map +1 -0
- package/dist/components/Card/AccountCard.vue.d.ts +13 -72
- package/dist/components/Card/BlankCard.vue.d.ts +13 -72
- package/dist/components/Card/Card.vue.d.ts +107 -579
- package/dist/components/Card/CardCompany.vue.d.ts +40 -217
- package/dist/components/Card/CardData.vue.d.ts +13 -72
- package/dist/components/Card/CardStatusesContainer.vue.d.ts +26 -144
- package/dist/components/Card/ContentCard.vue.d.ts +13 -72
- package/dist/components/Card/DashCard.vue.d.ts +26 -144
- package/dist/components/Card/MarketplaceCard.vue.d.ts +13 -72
- package/dist/components/Card/SimpleCard.vue.d.ts +13 -72
- package/dist/components/Card/StatusCard.vue.d.ts +13 -72
- package/dist/components/Card/TitleCard.vue.d.ts +14 -73
- package/dist/components/CardImage/CardImage.vue.d.ts +39 -216
- package/dist/components/CardInformation/CardInformation.vue.d.ts +26 -144
- package/dist/components/CardProject/CardProject.vue.d.ts +14 -73
- package/dist/components/Carousel/Carousel.vue.d.ts +55 -291
- package/dist/components/Carousel/TagCarousel.vue.d.ts +53 -289
- package/dist/components/ChartBar/ChartBar.vue.d.ts +57 -252
- package/dist/components/ChatText/ChatText.vue.d.ts +13 -72
- package/dist/components/ChatsContact/ChatsContact.vue.d.ts +79 -433
- package/dist/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue.d.ts +13 -72
- package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +112 -291
- package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts.map +1 -1
- package/dist/components/ChatsMessage/ChatsMessageStatusBackdrop.vue.d.ts +26 -144
- package/dist/components/ChatsMessage/ChatsMessageText.vue.d.ts +42 -3
- package/dist/components/ChatsMessage/ChatsMessageText.vue.d.ts.map +1 -1
- package/dist/components/ChatsNavbar/ChatsNavbar.vue.d.ts +13 -72
- package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +13 -72
- package/dist/components/Checkbox/Checkbox.vue.d.ts +13 -72
- package/dist/components/DateFilter/DateFilter.vue.d.ts +17 -76
- package/dist/components/DatePicker/DatePicker.vue.d.ts +45 -181
- package/dist/components/Disclaimer/Disclaimer.vue.d.ts +5 -110
- package/dist/components/Disclaimer/Disclaimer.vue.d.ts.map +1 -1
- package/dist/components/Disclaimer/types.d.ts +7 -0
- package/dist/components/Disclaimer/types.d.ts.map +1 -0
- package/dist/components/Drawer/Drawer.vue.d.ts +57 -252
- package/dist/components/Dropdown/LanguageSelect.vue.d.ts +26 -144
- package/dist/components/Flag.vue.d.ts +13 -72
- package/dist/components/FormElement/FormElement.vue.d.ts +13 -72
- package/dist/components/FormElement/FormElement.vue.d.ts.map +1 -1
- package/dist/components/Icon/types.d.ts +13 -0
- package/dist/components/Icon/types.d.ts.map +1 -0
- package/dist/components/Icon.vue.d.ts +15 -72
- package/dist/components/Icon.vue.d.ts.map +1 -1
- package/dist/components/IconLoading/IconLoading.vue.d.ts +13 -72
- package/dist/components/ImportCard/ImportCard.vue.d.ts +57 -252
- package/dist/components/Input/BaseInput.vue.d.ts +1 -1
- package/dist/components/Input/Input.vue.d.ts +17 -76
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +16 -75
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +63 -258
- package/dist/components/InputNext/InputNext.vue.d.ts +14 -73
- package/dist/components/Modal/Modal.vue.d.ts +13 -72
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts +58 -253
- package/dist/components/ModalNext/ModalNext.vue.d.ts +74 -328
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +114 -504
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts +13 -72
- package/dist/components/Pagination/Pagination.vue.d.ts +44 -180
- package/dist/components/ProgressBar/ProgressBar.vue.d.ts +13 -72
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +83 -437
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +40 -217
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +13 -72
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts.map +1 -1
- package/dist/components/SelectTime/index.vue.d.ts +16 -75
- package/dist/components/Slider/Slider.vue.d.ts +13 -72
- package/dist/components/StarRating/StarRating.vue.d.ts +13 -72
- package/dist/components/Switch/Switch.vue.d.ts +15 -74
- package/dist/components/Tab/Tab.vue.d.ts +13 -72
- package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
- package/dist/components/TableNext/TablePagination.vue.d.ts +44 -180
- package/dist/components/TabsExpanded/TabsExpanded.vue.d.ts +13 -72
- package/dist/components/Tag/BrandTag.vue.d.ts +13 -72
- package/dist/components/Tag/DefaultTag.vue.d.ts +13 -72
- package/dist/components/Tag/IndicatorTag.vue.d.ts +13 -72
- package/dist/components/Tag/Tag.vue.d.ts +40 -217
- package/dist/components/TextArea/TextArea.vue.d.ts +14 -73
- package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
- package/dist/components/Tour/Tour.vue.d.ts +44 -180
- package/dist/components/Tour/TourPopover.vue.d.ts +44 -180
- package/dist/components/UploadArea/UploadArea.vue.d.ts +57 -252
- package/dist/components/index.d.ts +13873 -7950
- package/dist/components/index.d.ts.map +1 -1
- package/dist/{es-a01fbef6.mjs → es-cc886436.mjs} +1 -1
- package/dist/{index-653c8f92.mjs → index-d36790a8.mjs} +5832 -5834
- package/dist/{pt-br-8c017501.mjs → pt-br-5f433748.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +177 -90
- package/dist/unnnic.umd.js +40 -40
- package/package.json +2 -2
- package/src/components/Button/Button.vue +99 -128
- package/src/components/Button/types.ts +23 -0
- package/src/components/ChatsMessage/ChatsMessage.vue +15 -0
- package/src/components/ChatsMessage/ChatsMessageText.vue +58 -4
- package/src/components/Checkbox/__tests__/Checkbox.spec.js +3 -3
- package/src/components/Disclaimer/Disclaimer.vue +27 -25
- package/src/components/Disclaimer/__tests__/Disclaimer.spec.js +24 -10
- package/src/components/Disclaimer/types.ts +7 -0
- package/src/components/Icon/types.ts +114 -0
- package/src/components/Icon.vue +44 -76
- package/src/components/Switch/__tests__/Switch.spec.js +9 -9
- package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +5 -5
- package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +9 -9
- package/src/components/__tests__/Icon.spec.js +32 -18
- package/src/components/index.ts +93 -0
- package/src/stories/ChatsMessage.stories.js +7 -0
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
:size="iconSize"
|
|
31
31
|
:filled="iconsFilled"
|
|
32
32
|
:class="{ 'unnnic-button__icon-left': hasText }"
|
|
33
|
-
:style="{ visibility: loading ? 'hidden' :
|
|
33
|
+
:style="{ visibility: loading ? 'hidden' : 'visible' }"
|
|
34
34
|
:next="next"
|
|
35
35
|
data-testid="icon-left"
|
|
36
36
|
/>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
v-if="iconCenter"
|
|
40
40
|
:icon="iconCenter"
|
|
41
41
|
:scheme="iconScheme"
|
|
42
|
-
:style="{ visibility: loading ? 'hidden' :
|
|
42
|
+
:style="{ visibility: loading ? 'hidden' : 'visible' }"
|
|
43
43
|
:size="iconSize"
|
|
44
44
|
:filled="iconsFilled"
|
|
45
45
|
:next="next"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<span
|
|
50
50
|
v-if="!float"
|
|
51
51
|
class="unnnic-button__label"
|
|
52
|
-
:style="{ visibility: loading ? 'hidden' :
|
|
52
|
+
:style="{ visibility: loading ? 'hidden' : 'visible' }"
|
|
53
53
|
data-testid="button-label"
|
|
54
54
|
>
|
|
55
55
|
<slot /> {{ text }}
|
|
@@ -62,145 +62,116 @@
|
|
|
62
62
|
:size="iconSize"
|
|
63
63
|
:filled="iconsFilled"
|
|
64
64
|
:class="{ 'unnnic-button__icon-right': hasText }"
|
|
65
|
-
:style="{ visibility: loading ? 'hidden' :
|
|
65
|
+
:style="{ visibility: loading ? 'hidden' : 'visible' }"
|
|
66
66
|
:next="next"
|
|
67
67
|
data-testid="icon-right"
|
|
68
68
|
/>
|
|
69
69
|
</button>
|
|
70
70
|
</template>
|
|
71
71
|
|
|
72
|
-
<script>
|
|
72
|
+
<script setup lang="ts">
|
|
73
|
+
import { computed, watch, useSlots } from 'vue';
|
|
73
74
|
import UnnnicIcon from '../Icon.vue';
|
|
75
|
+
import type { ButtonProps, ButtonSize, ButtonType } from './types';
|
|
76
|
+
import type { SchemeColor } from '../Icon/types';
|
|
74
77
|
|
|
75
|
-
|
|
78
|
+
defineOptions({
|
|
76
79
|
name: 'UnnnicButton',
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
default: false,
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
disabled: {
|
|
119
|
-
type: Boolean,
|
|
120
|
-
default: false,
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
loading: {
|
|
124
|
-
type: Boolean,
|
|
125
|
-
default: false,
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
computed: {
|
|
129
|
-
buttonDisabled() {
|
|
130
|
-
return this.disabled || this.loading;
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
iconSize() {
|
|
134
|
-
if (this.size === 'small') return 'sm';
|
|
135
|
-
return 'md';
|
|
136
|
-
},
|
|
137
|
-
hasText() {
|
|
138
|
-
if (this.$slots.default) return true;
|
|
139
|
-
return this.text && this.text.length > 0;
|
|
140
|
-
},
|
|
141
|
-
iconScheme() {
|
|
142
|
-
if (this.buttonDisabled) {
|
|
143
|
-
return 'neutral-clean';
|
|
144
|
-
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export type { ButtonProps, ButtonSize, ButtonType };
|
|
83
|
+
|
|
84
|
+
const props = withDefaults(defineProps<ButtonProps>(), {
|
|
85
|
+
size: 'large',
|
|
86
|
+
text: '',
|
|
87
|
+
type: 'primary',
|
|
88
|
+
float: false,
|
|
89
|
+
iconLeft: '',
|
|
90
|
+
iconRight: '',
|
|
91
|
+
iconCenter: '',
|
|
92
|
+
iconsFilled: false,
|
|
93
|
+
next: false,
|
|
94
|
+
disabled: false,
|
|
95
|
+
loading: false,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const slots = useSlots();
|
|
99
|
+
|
|
100
|
+
const buttonDisabled = computed(() => {
|
|
101
|
+
return props.disabled || props.loading;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const iconSize = computed(() => {
|
|
105
|
+
if (props.size === 'small') return 'sm';
|
|
106
|
+
return 'md';
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const hasText = computed(() => {
|
|
110
|
+
if (slots.default) return true;
|
|
111
|
+
return props.text && props.text.length > 0;
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const iconScheme = computed((): SchemeColor => {
|
|
115
|
+
if (buttonDisabled.value) {
|
|
116
|
+
return 'neutral-clean';
|
|
117
|
+
}
|
|
145
118
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
validateProps() {
|
|
187
|
-
if (!this.isSizePropValid || !this.isTypePropValid) {
|
|
188
|
-
let errorMessage = 'TypeError:';
|
|
119
|
+
const typeToSchemeMap: Record<ButtonType, SchemeColor> = {
|
|
120
|
+
primary: 'neutral-white',
|
|
121
|
+
secondary: 'neutral-dark',
|
|
122
|
+
tertiary: 'neutral-dark',
|
|
123
|
+
alternative: 'neutral-white',
|
|
124
|
+
warning: 'neutral-white',
|
|
125
|
+
attention: 'neutral-white',
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
return typeToSchemeMap[props.type] || 'neutral-white';
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const isSizePropValid = computed(() => {
|
|
132
|
+
return (
|
|
133
|
+
props.size === 'large' ||
|
|
134
|
+
(!props.float && props.size === 'small') ||
|
|
135
|
+
(props.float && props.size === 'extra-large')
|
|
136
|
+
);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const isTypePropValid = computed(() => {
|
|
140
|
+
const validTypes: ButtonType[] = [
|
|
141
|
+
'primary',
|
|
142
|
+
'secondary',
|
|
143
|
+
'tertiary',
|
|
144
|
+
'alternative',
|
|
145
|
+
'warning',
|
|
146
|
+
'attention',
|
|
147
|
+
];
|
|
148
|
+
return validTypes.includes(props.type);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const validateProps = () => {
|
|
152
|
+
if (!isSizePropValid.value || !isTypePropValid.value) {
|
|
153
|
+
let errorMessage = 'TypeError:';
|
|
154
|
+
|
|
155
|
+
if (!isSizePropValid.value) {
|
|
156
|
+
errorMessage += ' Invalid size prop.';
|
|
157
|
+
errorMessage += ` Please provide 'large', 'small' (only if float prop is false), or 'extra-large' (only if float prop is true).`;
|
|
158
|
+
}
|
|
189
159
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
160
|
+
if (!isTypePropValid.value) {
|
|
161
|
+
errorMessage += ' Invalid type prop.';
|
|
162
|
+
}
|
|
194
163
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
164
|
+
throw new Error(errorMessage);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
198
167
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
168
|
+
watch(
|
|
169
|
+
() => props,
|
|
170
|
+
() => {
|
|
171
|
+
validateProps();
|
|
202
172
|
},
|
|
203
|
-
}
|
|
173
|
+
{ deep: true, immediate: true }
|
|
174
|
+
);
|
|
204
175
|
</script>
|
|
205
176
|
|
|
206
177
|
<style lang="scss" scoped>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type ButtonSize = 'small' | 'large' | 'extra-large';
|
|
2
|
+
|
|
3
|
+
export type ButtonType =
|
|
4
|
+
| 'primary'
|
|
5
|
+
| 'secondary'
|
|
6
|
+
| 'tertiary'
|
|
7
|
+
| 'alternative'
|
|
8
|
+
| 'warning'
|
|
9
|
+
| 'attention';
|
|
10
|
+
|
|
11
|
+
export interface ButtonProps {
|
|
12
|
+
size?: ButtonSize;
|
|
13
|
+
text?: string;
|
|
14
|
+
type?: ButtonType;
|
|
15
|
+
float?: boolean;
|
|
16
|
+
iconLeft?: string;
|
|
17
|
+
iconRight?: string;
|
|
18
|
+
iconCenter?: string;
|
|
19
|
+
iconsFilled?: boolean;
|
|
20
|
+
next?: boolean;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
class="unnnic-chats-message"
|
|
4
4
|
:class="{
|
|
5
5
|
sent: type === 'sent',
|
|
6
|
+
automatic: automatic,
|
|
6
7
|
sending: status === 'sending',
|
|
7
8
|
'is-document': isDocument,
|
|
8
9
|
'is-media': isMedia,
|
|
@@ -45,7 +46,9 @@
|
|
|
45
46
|
/>
|
|
46
47
|
<UnnnicChatsMessageText
|
|
47
48
|
v-if="isText"
|
|
49
|
+
:locale="locale"
|
|
48
50
|
:text="slotText"
|
|
51
|
+
:isAutomatic="automatic"
|
|
49
52
|
/>
|
|
50
53
|
<div
|
|
51
54
|
v-if="isDocument"
|
|
@@ -156,6 +159,10 @@ export default {
|
|
|
156
159
|
},
|
|
157
160
|
mixins: [UnnnicI18n],
|
|
158
161
|
props: {
|
|
162
|
+
locale: {
|
|
163
|
+
type: String,
|
|
164
|
+
default: 'en',
|
|
165
|
+
},
|
|
159
166
|
enableReply: {
|
|
160
167
|
type: Boolean,
|
|
161
168
|
default: false,
|
|
@@ -171,6 +178,10 @@ export default {
|
|
|
171
178
|
return ['received', 'sent'].includes(type);
|
|
172
179
|
},
|
|
173
180
|
},
|
|
181
|
+
automatic: {
|
|
182
|
+
type: Boolean,
|
|
183
|
+
default: false,
|
|
184
|
+
},
|
|
174
185
|
time: {
|
|
175
186
|
type: Date,
|
|
176
187
|
required: true,
|
|
@@ -323,6 +334,10 @@ $defaultLineHeight: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
|
323
334
|
|
|
324
335
|
&.sent {
|
|
325
336
|
background-color: #cff8f4;
|
|
337
|
+
|
|
338
|
+
&.automatic {
|
|
339
|
+
background-color: $unnnic-color-aux-blue-50;
|
|
340
|
+
}
|
|
326
341
|
}
|
|
327
342
|
|
|
328
343
|
&.sending {
|
|
@@ -1,18 +1,45 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<section class="unnnic-chats-message__text__container">
|
|
3
|
+
<p
|
|
4
|
+
class="unnnic-chats-message__text"
|
|
5
|
+
v-html="formattedText"
|
|
6
|
+
/>
|
|
7
|
+
<p v-if="isAutomatic" class="unnnic-chats-message__text--automatic">
|
|
8
|
+
{{ i18n('automatic_message') }}
|
|
9
|
+
</p>
|
|
10
|
+
</section>
|
|
6
11
|
</template>
|
|
7
12
|
|
|
8
13
|
<script>
|
|
14
|
+
import UnnnicI18n from '../../mixins/i18n';
|
|
15
|
+
|
|
9
16
|
export default {
|
|
10
17
|
name: 'ChatsMessageText',
|
|
18
|
+
mixins: [UnnnicI18n],
|
|
11
19
|
props: {
|
|
20
|
+
locale: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'en',
|
|
23
|
+
},
|
|
12
24
|
text: {
|
|
13
25
|
type: String,
|
|
14
26
|
required: true,
|
|
15
27
|
},
|
|
28
|
+
isAutomatic: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
data() {
|
|
34
|
+
return {
|
|
35
|
+
defaultTranslations: {
|
|
36
|
+
automatic_message: {
|
|
37
|
+
'pt-br': 'Mensagem de abertura automática',
|
|
38
|
+
en: 'Automatic Opening Message',
|
|
39
|
+
es: 'Mensaje de apertura automático',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
16
43
|
},
|
|
17
44
|
computed: {
|
|
18
45
|
formattedText() {
|
|
@@ -78,3 +105,30 @@ export default {
|
|
|
78
105
|
},
|
|
79
106
|
};
|
|
80
107
|
</script>
|
|
108
|
+
|
|
109
|
+
<style lang="scss" scoped>
|
|
110
|
+
@use '@/assets/scss/unnnic' as *;
|
|
111
|
+
|
|
112
|
+
* {
|
|
113
|
+
padding: 0;
|
|
114
|
+
margin: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.unnnic-chats-message__text {
|
|
118
|
+
&__container {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
gap: $unnnic-spacing-sm;
|
|
122
|
+
padding: $unnnic-spacing-nano 0;
|
|
123
|
+
font-size: $unnnic-font-size-body-gt;
|
|
124
|
+
color: $unnnic-color-neutral-dark;
|
|
125
|
+
line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
|
|
126
|
+
word-break: break-word;
|
|
127
|
+
}
|
|
128
|
+
&--automatic {
|
|
129
|
+
font-size: $unnnic-font-size-body-md;
|
|
130
|
+
line-height: $unnnic-line-height-caption-1;
|
|
131
|
+
color: $unnnic-color-aux-blue-500;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
</style>
|
|
@@ -24,7 +24,7 @@ describe('Checkbox', () => {
|
|
|
24
24
|
|
|
25
25
|
it('should checkbox emit change events', async () => {
|
|
26
26
|
wrapper = createWrapper();
|
|
27
|
-
const checkbox = wrapper.findComponent({ name: '
|
|
27
|
+
const checkbox = wrapper.findComponent({ name: 'UnnnicIcon' });
|
|
28
28
|
|
|
29
29
|
// click false to true
|
|
30
30
|
await checkbox.trigger('click');
|
|
@@ -44,14 +44,14 @@ describe('Checkbox', () => {
|
|
|
44
44
|
|
|
45
45
|
it('should checkbox disabled', async () => {
|
|
46
46
|
wrapper = createWrapper({ disabled: true });
|
|
47
|
-
const checkbox = wrapper.findComponent({ name: '
|
|
47
|
+
const checkbox = wrapper.findComponent({ name: 'UnnnicIcon' });
|
|
48
48
|
await checkbox.trigger('click');
|
|
49
49
|
expect(wrapper.emitted('change')).eq(undefined);
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
it('should define sizes', async () => {
|
|
53
53
|
wrapper = createWrapper({ size: 'sm', textRight: 'Label' });
|
|
54
|
-
const checkbox = wrapper.findComponent({ name: '
|
|
54
|
+
const checkbox = wrapper.findComponent({ name: 'UnnnicIcon' });
|
|
55
55
|
const label = wrapper.find('.unnnic-checkbox__label');
|
|
56
56
|
|
|
57
57
|
// sm
|
|
@@ -15,36 +15,38 @@
|
|
|
15
15
|
</section>
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
|
-
<script>
|
|
18
|
+
<script setup lang="ts">
|
|
19
19
|
import icons from '../../utils/iconList';
|
|
20
20
|
import colors from '../../utils/colorsList';
|
|
21
|
+
import UnnnicIcon from '../Icon.vue';
|
|
22
|
+
import type { DisclaimerProps } from './types';
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export default {
|
|
24
|
+
defineOptions({
|
|
25
25
|
name: 'UnnnicDisclaimer',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
default: 'neutral-darkest',
|
|
42
|
-
validator(value) {
|
|
43
|
-
return colors.includes(value);
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export type { DisclaimerProps };
|
|
29
|
+
|
|
30
|
+
const props = withDefaults(defineProps<DisclaimerProps>(), {
|
|
31
|
+
icon: 'alert-circle-1-1',
|
|
32
|
+
iconColor: 'neutral-darkest',
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const validateIcon = (value: string): boolean => {
|
|
36
|
+
return icons.includes(value);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const validateIconColor = (value: string): boolean => {
|
|
40
|
+
return colors.includes(value);
|
|
47
41
|
};
|
|
42
|
+
|
|
43
|
+
if (!validateIcon(props.icon as string)) {
|
|
44
|
+
console.warn(`Invalid icon prop: ${props.icon}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!validateIconColor(props.iconColor as string)) {
|
|
48
|
+
console.warn(`Invalid iconColor prop: ${props.iconColor}`);
|
|
49
|
+
}
|
|
48
50
|
</script>
|
|
49
51
|
|
|
50
52
|
<style lang="scss" scoped>
|
|
@@ -38,21 +38,35 @@ describe('Disclaimer', () => {
|
|
|
38
38
|
const iconComponent = wrapper.findComponent(
|
|
39
39
|
'[data-testid="disclaimer-icon"]',
|
|
40
40
|
);
|
|
41
|
-
expect(iconComponent.props('icon')).toBe(
|
|
42
|
-
expect(iconComponent.props('scheme')).toBe(
|
|
43
|
-
Disclaimer.props.iconColor.default,
|
|
44
|
-
);
|
|
41
|
+
expect(iconComponent.props('icon')).toBe('alert-circle-1-1');
|
|
42
|
+
expect(iconComponent.props('scheme')).toBe('neutral-darkest');
|
|
45
43
|
});
|
|
46
44
|
|
|
47
45
|
it('validates the icon prop correctly', () => {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
const wrapperValid = mount(Disclaimer, {
|
|
47
|
+
props: { text: 'Test', icon: 'alert-circle-1-1' },
|
|
48
|
+
global: { components: { UnnnicIcon: Icon } },
|
|
49
|
+
});
|
|
50
|
+
expect(wrapperValid.exists()).toBe(true);
|
|
51
|
+
|
|
52
|
+
const wrapperInvalid = mount(Disclaimer, {
|
|
53
|
+
props: { text: 'Test', icon: 'invalid-icon' },
|
|
54
|
+
global: { components: { UnnnicIcon: Icon } },
|
|
55
|
+
});
|
|
56
|
+
expect(wrapperInvalid.exists()).toBe(true);
|
|
51
57
|
});
|
|
52
58
|
|
|
53
59
|
it('validates the iconColor prop correctly', () => {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
const wrapperValid = mount(Disclaimer, {
|
|
61
|
+
props: { text: 'Test', iconColor: 'neutral-darkest' },
|
|
62
|
+
global: { components: { UnnnicIcon: Icon } },
|
|
63
|
+
});
|
|
64
|
+
expect(wrapperValid.exists()).toBe(true);
|
|
65
|
+
|
|
66
|
+
const wrapperInvalid = mount(Disclaimer, {
|
|
67
|
+
props: { text: 'Test', iconColor: 'invalid-color' },
|
|
68
|
+
global: { components: { UnnnicIcon: Icon } },
|
|
69
|
+
});
|
|
70
|
+
expect(wrapperInvalid.exists()).toBe(true);
|
|
57
71
|
});
|
|
58
72
|
});
|