@weni/unnnic-system 3.2.7-alpha.0 → 3.2.8
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 +24 -0
- package/dist/components/Accordion/Accordion.vue.d.ts +1 -1
- package/dist/components/Alert/Alert.vue.d.ts +5 -5
- package/dist/components/Alert/Version1dot1.vue.d.ts +2 -2
- 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/ChatsMessage/ChatsMessageText.vue.d.ts.map +1 -1
- 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/Chip/Chip.vue.d.ts.map +1 -1
- 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 +27 -182
- package/dist/components/DatePicker/DatePicker.vue.d.ts +8 -8
- package/dist/components/DatePicker/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.vue.d.ts +7 -7
- package/dist/components/Drawer/Drawer.vue.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
- package/dist/components/Dropdown/LanguageSelect.vue.d.ts +3 -3
- package/dist/components/EmojiPicker/EmojiPicker.vue.d.ts.map +1 -1
- package/dist/components/Flag.vue.d.ts +2 -2
- package/dist/components/FormElement/FormElement.vue.d.ts +32 -38
- 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 +7 -7
- package/dist/components/Input/BaseInput.vue.d.ts +1 -10
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +27 -182
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +13 -31
- package/dist/components/InputDatePicker/InputDatePicker.vue.d.ts +37 -192
- package/dist/components/InputNext/InputNext.vue.d.ts +3 -3
- package/dist/components/Modal/Modal.vue.d.ts +2 -2
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts +10 -10
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
- package/dist/components/ModalNext/ModalNext.vue.d.ts +34 -189
- 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 +7 -7
- 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 +2 -2
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +27 -45
- 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 +13 -31
- 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 +2 -2
- package/dist/components/Tab/Tab.vue.d.ts +2 -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/Tag/TagNext.vue.d.ts.map +1 -1
- package/dist/components/TextArea/TextArea.vue.d.ts +32 -38
- package/dist/components/TextArea/TextArea.vue.d.ts.map +1 -1
- 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 +890 -2158
- package/dist/components/index.d.ts.map +1 -1
- package/dist/{es-a147ef18.mjs → es-b3e51efa.js} +1 -1
- package/dist/{index-802ab669.mjs → index-b9e3c5e9.js} +7649 -7812
- package/dist/{pt-br-cdc64aa4.mjs → pt-br-20887b32.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.js +182 -0
- package/dist/{unnnic.umd.js → unnnic.umd.cjs} +41 -42
- package/package.json +10 -9
- package/src/assets/icons/script-to-convert-svg-to-vue.js +4 -7
- package/src/components/AudioRecorder/AudioRecorder.vue +3 -2
- package/src/components/Button/Button.vue +109 -58
- package/src/components/Button/__tests__/Button.spec.js +2 -2
- package/src/components/Button/types.ts +2 -1
- package/src/components/Card/Card.vue +4 -1
- package/src/components/ChartMultiLine/Line/Line.vue +2 -1
- package/src/components/ChatsContact/ChatsContact.vue +1 -1
- package/src/components/ChatsHeader/ChatsHeader.vue +4 -2
- package/src/components/ChatsMessage/ChatsMessageText.vue +5 -5
- package/src/components/Chip/Chip.vue +62 -57
- package/src/components/Chip/__tests__/Chip.spec.js +18 -18
- package/src/components/DataTable/index.vue +8 -5
- package/src/components/DatePicker/DatePicker.vue +29 -16
- package/src/components/Drawer/Drawer.vue +4 -1
- package/src/components/Drawer/__tests__/Drawer.spec.js +9 -3
- package/src/components/DropArea/DropArea.vue +1 -1
- package/src/components/Dropdown/__tests__/Dropdown.spec.js +17 -17
- package/src/components/EmojiPicker/EmojiPicker.vue +57 -48
- package/src/components/EmojiPicker/__tests__/EmojiPicker.spec.js +84 -23
- package/src/components/Flag.vue +0 -1
- package/src/components/FormElement/FormElement.vue +91 -51
- package/src/components/Icon/types.ts +2 -2
- package/src/components/Icon.vue +3 -1
- package/src/components/Input/BaseInput.vue +12 -10
- package/src/components/Input/Input.scss +20 -17
- package/src/components/Input/Input.vue +28 -86
- package/src/components/Input/TextInput.vue +35 -27
- package/src/components/Input/__test__/TextInput.spec.js +5 -5
- package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +3 -12
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -1
- package/src/components/InputDatePicker/InputDatePicker.vue +1 -1
- package/src/components/Label/Label.vue +2 -2
- package/src/components/ModalDialog/ModalDialog.vue +29 -27
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -1
- package/src/components/ModalNext/ModalNext.vue +2 -2
- package/src/components/SelectSmart/SelectSmart.vue +15 -4
- package/src/components/SelectSmart/__tests__/SelectSmart.spec.js +2 -2
- package/src/components/Switch/__tests__/Switch.spec.js +6 -2
- package/src/components/TableNext/__test__/__snapshots__/TableNext.spec.js.snap +2 -2
- package/src/components/TableNext/__test__/__snapshots__/TablePagination.spec.js.snap +2 -2
- package/src/components/Tag/TagNext.vue +2 -8
- package/src/components/TextArea/TextArea.vue +9 -14
- package/src/components/TextArea/__test__/__snapshots__/TextArea.spec.js.snap +2 -7
- package/src/components/Tour/TourPopover.vue +1 -1
- package/src/components/__tests__/Icon.spec.js +2 -2
- package/src/components/index.ts +88 -96
- package/src/index.ts +1 -1
- package/src/main.ts +1 -1
- package/src/stories/Button.stories.js +11 -2
- package/src/stories/ChatsHeader.stories.js +1 -1
- package/src/stories/ChatsMessage.stories.js +0 -1
- package/src/stories/Chip.stories.js +7 -4
- package/src/stories/Input.stories.js +3 -17
- package/src/stories/SelectSmart.stories.js +1 -1
- package/src/stories/TableNext.stories.js +1 -1
- package/src/types/index.d.ts +2 -2
- package/src/types/scheme-colors.d.ts +1 -2
- package/src/types/unnnic-utils.d.ts +87 -87
- package/src/types/vue-shims.d.ts +1 -1
- package/src/types/vueuse-overrides.d.ts +2 -2
- package/src/utils/plugins/i18n.js +0 -1
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts +0 -9
- package/dist/components/TemplatePreview/TemplatePreview.vue.d.ts.map +0 -1
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts +0 -15
- package/dist/components/TemplatePreview/TemplatePreviewModal.vue.d.ts.map +0 -1
- package/dist/unnnic.mjs +0 -186
- 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/components/TemplatePreview/TemplatePreview.vue +0 -249
- package/src/components/TemplatePreview/TemplatePreviewModal.vue +0 -51
- package/src/components/TemplatePreview/types.d.ts +0 -16
- package/src/stories/TemplatePreview.stories.js +0 -94
- package/src/stories/TemplatePreviewModal.stories.js +0 -110
|
@@ -37,10 +37,10 @@ describe('Chip', () => {
|
|
|
37
37
|
describe('Selection state', () => {
|
|
38
38
|
it('should apply selected styling when isSelected is true', async () => {
|
|
39
39
|
await wrapper.setProps({ isSelected: true });
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
expect(wrapper.classes()).toContain('chip--is-selected');
|
|
42
42
|
expect(wrapper.classes()).not.toContain('chip--border');
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
const textElement = wrapper.find('.chip__text');
|
|
45
45
|
expect(textElement.classes()).toContain('chip__text--is-selected');
|
|
46
46
|
});
|
|
@@ -49,7 +49,7 @@ describe('Chip', () => {
|
|
|
49
49
|
describe('Count functionality', () => {
|
|
50
50
|
it('should render count when provided', async () => {
|
|
51
51
|
await wrapper.setProps({ count: 5 });
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
const countElement = wrapper.find('.chip__count');
|
|
54
54
|
expect(countElement.exists()).toBe(true);
|
|
55
55
|
expect(countElement.text()).toBe('5');
|
|
@@ -57,14 +57,14 @@ describe('Chip', () => {
|
|
|
57
57
|
|
|
58
58
|
it('should not render count when not provided or zero', async () => {
|
|
59
59
|
expect(wrapper.find('.chip__count').exists()).toBe(false);
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
await wrapper.setProps({ count: 0 });
|
|
62
62
|
expect(wrapper.find('.chip__count').exists()).toBe(false);
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('should apply selected styling to count when chip is selected', async () => {
|
|
66
66
|
await wrapper.setProps({ count: 3, isSelected: true });
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
const countElement = wrapper.find('.chip__count');
|
|
69
69
|
expect(countElement.classes()).toContain('chip__count--is-selected');
|
|
70
70
|
});
|
|
@@ -78,7 +78,7 @@ describe('Chip', () => {
|
|
|
78
78
|
|
|
79
79
|
it('should render correct icons for multiple type', async () => {
|
|
80
80
|
await wrapper.setProps({ type: 'multiple', isSelected: false });
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
let icon = wrapper.findComponent({ name: 'UnnnicIcon' });
|
|
83
83
|
expect(icon.exists()).toBe(true);
|
|
84
84
|
expect(icon.props('icon')).toBe('add');
|
|
@@ -86,7 +86,7 @@ describe('Chip', () => {
|
|
|
86
86
|
expect(icon.props('size')).toBe('sm');
|
|
87
87
|
|
|
88
88
|
await wrapper.setProps({ isSelected: true });
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
icon = wrapper.findComponent({ name: 'UnnnicIcon' });
|
|
91
91
|
expect(icon.props('icon')).toBe('close');
|
|
92
92
|
expect(icon.props('scheme')).toBe('teal-600');
|
|
@@ -95,21 +95,21 @@ describe('Chip', () => {
|
|
|
95
95
|
|
|
96
96
|
describe('Combined functionality', () => {
|
|
97
97
|
it('should render all elements correctly when combined', async () => {
|
|
98
|
-
await wrapper.setProps({
|
|
98
|
+
await wrapper.setProps({
|
|
99
99
|
text: 'Complete Chip',
|
|
100
100
|
count: 42,
|
|
101
101
|
type: 'multiple',
|
|
102
|
-
isSelected: true
|
|
102
|
+
isSelected: true,
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
expect(wrapper.text()).toContain('Complete Chip');
|
|
106
106
|
expect(wrapper.classes()).toContain('chip--is-selected');
|
|
107
|
-
|
|
107
|
+
|
|
108
108
|
const countElement = wrapper.find('.chip__count');
|
|
109
109
|
expect(countElement.exists()).toBe(true);
|
|
110
110
|
expect(countElement.text()).toBe('42');
|
|
111
111
|
expect(countElement.classes()).toContain('chip__count--is-selected');
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
const icon = wrapper.findComponent({ name: 'UnnnicIcon' });
|
|
114
114
|
expect(icon.exists()).toBe(true);
|
|
115
115
|
expect(icon.props('icon')).toBe('close');
|
|
@@ -119,16 +119,16 @@ describe('Chip', () => {
|
|
|
119
119
|
describe('Click functionality', () => {
|
|
120
120
|
it('should emit click event when clicked', async () => {
|
|
121
121
|
await wrapper.setProps({ isClickable: true });
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
await wrapper.trigger('click');
|
|
124
|
-
|
|
124
|
+
|
|
125
125
|
expect(wrapper.emitted().click).toBeTruthy();
|
|
126
126
|
expect(wrapper.emitted().click).toHaveLength(1);
|
|
127
127
|
});
|
|
128
128
|
|
|
129
129
|
it('should apply clickable styling when isClickable is true', async () => {
|
|
130
130
|
await wrapper.setProps({ isClickable: true });
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
expect(wrapper.classes()).toContain('chip--is-clickable');
|
|
133
133
|
});
|
|
134
134
|
|
|
@@ -138,7 +138,7 @@ describe('Chip', () => {
|
|
|
138
138
|
|
|
139
139
|
it('should emit click event even when not marked as clickable', async () => {
|
|
140
140
|
await wrapper.trigger('click');
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
expect(wrapper.emitted().click).toBeTruthy();
|
|
143
143
|
expect(wrapper.emitted().click).toHaveLength(1);
|
|
144
144
|
});
|
|
@@ -147,7 +147,7 @@ describe('Chip', () => {
|
|
|
147
147
|
describe('Edge cases', () => {
|
|
148
148
|
it('should handle negative count', async () => {
|
|
149
149
|
await wrapper.setProps({ count: -5 });
|
|
150
|
-
|
|
150
|
+
|
|
151
151
|
const countElement = wrapper.find('.chip__count');
|
|
152
152
|
expect(countElement.exists()).toBe(true);
|
|
153
153
|
expect(countElement.text()).toBe('-5');
|
|
@@ -155,10 +155,10 @@ describe('Chip', () => {
|
|
|
155
155
|
|
|
156
156
|
it('should handle empty text', async () => {
|
|
157
157
|
await wrapper.setProps({ text: '' });
|
|
158
|
-
|
|
158
|
+
|
|
159
159
|
const textElement = wrapper.find('.chip__text');
|
|
160
160
|
expect(textElement.exists()).toBe(true);
|
|
161
161
|
expect(textElement.text()).toBe('');
|
|
162
162
|
});
|
|
163
163
|
});
|
|
164
|
-
});
|
|
164
|
+
});
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
'unnnic-data-table__body-row--loading',
|
|
70
70
|
]"
|
|
71
71
|
>
|
|
72
|
-
<td
|
|
72
|
+
<td
|
|
73
73
|
:class="[
|
|
74
74
|
'unnnic-data-table__body-cell',
|
|
75
75
|
`unnnic-data-table__body-cell--${size}`,
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
v-if="slots['without-results']"
|
|
133
133
|
:class="[
|
|
134
134
|
'unnnic-data-table__body-cell',
|
|
135
|
-
`unnnic-data-table__body-cell--${size}
|
|
135
|
+
`unnnic-data-table__body-cell--${size}`,
|
|
136
136
|
]"
|
|
137
137
|
>
|
|
138
138
|
<slot name="without-results" />
|
|
@@ -212,8 +212,6 @@ const emit = defineEmits<{
|
|
|
212
212
|
'update:page': [page: number];
|
|
213
213
|
}>();
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
|
|
217
215
|
const props = withDefaults(defineProps<Props>(), {
|
|
218
216
|
isLoading: false,
|
|
219
217
|
size: 'md',
|
|
@@ -292,7 +290,12 @@ const handleClickHeader = (header: DataTableHeader) => {
|
|
|
292
290
|
? 'asc'
|
|
293
291
|
: nextSortOrderMapper[sort.value.order];
|
|
294
292
|
|
|
295
|
-
handleSort(
|
|
293
|
+
handleSort(
|
|
294
|
+
nextSort === ''
|
|
295
|
+
? { header: '', itemKey: '', order: '' }
|
|
296
|
+
: { header: header.title, itemKey: header.itemKey, order: nextSort },
|
|
297
|
+
nextSort,
|
|
298
|
+
);
|
|
296
299
|
};
|
|
297
300
|
|
|
298
301
|
const handleClickRow = (item: DataTableItem) => {
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
}"
|
|
51
51
|
@click="
|
|
52
52
|
date.properties.includes('inside month') &&
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
!date.properties.includes('out of range') &&
|
|
54
|
+
selectDate(date)
|
|
55
55
|
"
|
|
56
56
|
>
|
|
57
57
|
{{ getDate(date) }}
|
|
@@ -183,7 +183,13 @@
|
|
|
183
183
|
<div
|
|
184
184
|
v-for="(option, index) in periodsLocale"
|
|
185
185
|
:key="index"
|
|
186
|
-
:class="[
|
|
186
|
+
:class="[
|
|
187
|
+
'option',
|
|
188
|
+
{
|
|
189
|
+
selectable: option.id !== 'custom',
|
|
190
|
+
selected: optionSelected === option.id,
|
|
191
|
+
},
|
|
192
|
+
]"
|
|
187
193
|
@click="option.id === 'custom' ? null : autoSelect(option.id)"
|
|
188
194
|
>
|
|
189
195
|
{{ option.name }}
|
|
@@ -316,10 +322,6 @@ export default {
|
|
|
316
322
|
};
|
|
317
323
|
},
|
|
318
324
|
|
|
319
|
-
mounted() {
|
|
320
|
-
this.updateOptionSelected();
|
|
321
|
-
},
|
|
322
|
-
|
|
323
325
|
computed: {
|
|
324
326
|
openMonths() {
|
|
325
327
|
return [this.addMonth(this.referenceDate, -1), this.referenceDate];
|
|
@@ -365,6 +367,10 @@ export default {
|
|
|
365
367
|
},
|
|
366
368
|
},
|
|
367
369
|
|
|
370
|
+
mounted() {
|
|
371
|
+
this.updateOptionSelected();
|
|
372
|
+
},
|
|
373
|
+
|
|
368
374
|
methods: {
|
|
369
375
|
submit() {
|
|
370
376
|
this.$emit('submit', this.value);
|
|
@@ -372,7 +378,12 @@ export default {
|
|
|
372
378
|
if (this.optionSelected === 'custom') {
|
|
373
379
|
this.$emit('update:equivalentOption', '');
|
|
374
380
|
} else {
|
|
375
|
-
this.$emit(
|
|
381
|
+
this.$emit(
|
|
382
|
+
'update:equivalentOption',
|
|
383
|
+
this.periodsLocale.find(
|
|
384
|
+
({ id: periodId }) => periodId === this.optionSelected,
|
|
385
|
+
)?.name || '',
|
|
386
|
+
);
|
|
376
387
|
}
|
|
377
388
|
},
|
|
378
389
|
|
|
@@ -382,19 +393,21 @@ export default {
|
|
|
382
393
|
function isSameTime(date1, date2) {
|
|
383
394
|
return new Date(date1).getTime() === new Date(date2).getTime();
|
|
384
395
|
}
|
|
385
|
-
|
|
396
|
+
|
|
386
397
|
const period = this.periodsLocale.find(({ id: periodId }) => {
|
|
387
|
-
const {
|
|
388
|
-
|
|
389
|
-
endDate: periodEndDate,
|
|
390
|
-
} = this.getStartAndEndDateByPeriod(periodId);
|
|
398
|
+
const { startDate: periodStartDate, endDate: periodEndDate } =
|
|
399
|
+
this.getStartAndEndDateByPeriod(periodId);
|
|
391
400
|
|
|
392
|
-
return
|
|
401
|
+
return (
|
|
402
|
+
isSameTime(startDate, periodStartDate) &&
|
|
403
|
+
isSameTime(endDate, periodEndDate)
|
|
404
|
+
);
|
|
393
405
|
});
|
|
394
406
|
|
|
395
|
-
this.optionSelected =
|
|
407
|
+
this.optionSelected =
|
|
408
|
+
startDate || endDate ? (period ? period.id : 'custom') : '';
|
|
396
409
|
},
|
|
397
|
-
|
|
410
|
+
|
|
398
411
|
dateToString(date) {
|
|
399
412
|
return `${date.getMonth() + 1} ${date.getDate()} ${date.getFullYear()}`;
|
|
400
413
|
},
|
|
@@ -96,8 +96,12 @@ describe('Drawer.vue', () => {
|
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
expect(title().exists()).toBe(false);
|
|
99
|
-
expect(wrapper.find('[data-testid="custom-title"]').exists()).toBe(
|
|
100
|
-
|
|
99
|
+
expect(wrapper.find('[data-testid="custom-title"]').exists()).toBe(
|
|
100
|
+
true,
|
|
101
|
+
);
|
|
102
|
+
expect(wrapper.find('[data-testid="custom-title"]').text()).toBe(
|
|
103
|
+
'Custom Title Content',
|
|
104
|
+
);
|
|
101
105
|
});
|
|
102
106
|
|
|
103
107
|
it('should prioritize title slot over title prop', () => {
|
|
@@ -112,7 +116,9 @@ describe('Drawer.vue', () => {
|
|
|
112
116
|
});
|
|
113
117
|
|
|
114
118
|
expect(title().exists()).toBe(false);
|
|
115
|
-
expect(wrapper.find('[data-testid="custom-title"]').text()).toBe(
|
|
119
|
+
expect(wrapper.find('[data-testid="custom-title"]').text()).toBe(
|
|
120
|
+
'Slot Title',
|
|
121
|
+
);
|
|
116
122
|
});
|
|
117
123
|
});
|
|
118
124
|
});
|
|
@@ -100,10 +100,10 @@ describe('Dropdown.vue', () => {
|
|
|
100
100
|
it('should not toggle dropdown on trigger click when forceOpen is true', async () => {
|
|
101
101
|
await wrapper.setProps({ forceOpen: true, open: false });
|
|
102
102
|
const initialActiveState = wrapper.vm.active;
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
const trigger = wrapper.find('[data-testid="dropdown-trigger"]');
|
|
105
105
|
await trigger.trigger('click');
|
|
106
|
-
|
|
106
|
+
|
|
107
107
|
expect(wrapper.vm.active).toBe(initialActiveState);
|
|
108
108
|
expect(wrapper.emitted('update:open')).toBeFalsy();
|
|
109
109
|
});
|
|
@@ -113,41 +113,41 @@ describe('Dropdown.vue', () => {
|
|
|
113
113
|
expect(wrapper.vm.active).toBe(true);
|
|
114
114
|
|
|
115
115
|
await wrapper.vm.onClickOutside();
|
|
116
|
-
|
|
116
|
+
|
|
117
117
|
expect(wrapper.vm.active).toBe(true);
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
it('should not emit update:open when forceOpen is true and useOpenProp is true', async () => {
|
|
121
|
-
await wrapper.setProps({
|
|
122
|
-
forceOpen: true,
|
|
123
|
-
useOpenProp: true,
|
|
124
|
-
open: false
|
|
121
|
+
await wrapper.setProps({
|
|
122
|
+
forceOpen: true,
|
|
123
|
+
useOpenProp: true,
|
|
124
|
+
open: false,
|
|
125
125
|
});
|
|
126
|
-
|
|
126
|
+
|
|
127
127
|
const trigger = wrapper.find('[data-testid="dropdown-trigger"]');
|
|
128
128
|
await trigger.trigger('click');
|
|
129
|
-
|
|
129
|
+
|
|
130
130
|
expect(wrapper.emitted('update:open')).toBeFalsy();
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
it('should not close dropdown via onClickOutside when forceOpen is true and useOpenProp is true', async () => {
|
|
134
|
-
await wrapper.setProps({
|
|
135
|
-
forceOpen: true,
|
|
136
|
-
useOpenProp: true,
|
|
137
|
-
open: true
|
|
134
|
+
await wrapper.setProps({
|
|
135
|
+
forceOpen: true,
|
|
136
|
+
useOpenProp: true,
|
|
137
|
+
open: true,
|
|
138
138
|
});
|
|
139
|
-
|
|
139
|
+
|
|
140
140
|
await wrapper.vm.onClickOutside();
|
|
141
|
-
|
|
141
|
+
|
|
142
142
|
expect(wrapper.emitted('update:open')).toBeFalsy();
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
it('should allow normal behavior when forceOpen is false', async () => {
|
|
146
146
|
await wrapper.setProps({ forceOpen: false, open: false });
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
const trigger = wrapper.find('[data-testid="dropdown-trigger"]');
|
|
149
149
|
await trigger.trigger('click');
|
|
150
|
-
|
|
150
|
+
|
|
151
151
|
expect(wrapper.vm.active).toBe(true);
|
|
152
152
|
expect(wrapper.emitted('update:open')).toBeTruthy();
|
|
153
153
|
});
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
:showPreview="true"
|
|
15
15
|
showSkinTones
|
|
16
16
|
:search="true"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
:
|
|
17
|
+
navPosition="bottom"
|
|
18
|
+
noResultsEmoji="cry"
|
|
19
|
+
:maxFrequentRows="3"
|
|
20
20
|
:i18n="translations"
|
|
21
21
|
:color="accentColor"
|
|
22
22
|
@select="onEmojiSelect"
|
|
@@ -25,56 +25,62 @@
|
|
|
25
25
|
</template>
|
|
26
26
|
|
|
27
27
|
<script setup lang="ts">
|
|
28
|
-
import { computed, ref, onMounted, onUnmounted } from 'vue'
|
|
29
|
-
import { get } from 'lodash'
|
|
30
|
-
import i18n from '../../utils/plugins/i18n'
|
|
31
|
-
import { Picker, EmojiIndex } from 'emoji-mart-vue-fast/src'
|
|
32
|
-
import data from 'emoji-mart-vue-fast/data/all.json'
|
|
33
|
-
import 'emoji-mart-vue-fast/css/emoji-mart.css'
|
|
34
|
-
import UnnnicI18n from '../../mixins/i18n'
|
|
28
|
+
import { computed, ref, onMounted, onUnmounted } from 'vue';
|
|
29
|
+
import { get } from 'lodash';
|
|
30
|
+
import i18n from '../../utils/plugins/i18n';
|
|
31
|
+
import { Picker, EmojiIndex } from 'emoji-mart-vue-fast/src';
|
|
32
|
+
import data from 'emoji-mart-vue-fast/data/all.json';
|
|
33
|
+
import 'emoji-mart-vue-fast/css/emoji-mart.css';
|
|
34
|
+
import UnnnicI18n from '../../mixins/i18n';
|
|
35
35
|
|
|
36
36
|
defineOptions({
|
|
37
37
|
mixins: [UnnnicI18n],
|
|
38
|
-
})
|
|
38
|
+
});
|
|
39
39
|
|
|
40
40
|
interface Emoji {
|
|
41
|
-
id: string
|
|
42
|
-
native: string
|
|
41
|
+
id: string;
|
|
42
|
+
native: string;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface Props {
|
|
46
|
-
returnName?: boolean
|
|
47
|
-
position?: 'top' | 'bottom'
|
|
48
|
-
locale?: string
|
|
46
|
+
returnName?: boolean;
|
|
47
|
+
position?: 'top' | 'bottom';
|
|
48
|
+
locale?: string;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const props = withDefaults(defineProps<Props>(), {
|
|
52
52
|
returnName: false,
|
|
53
53
|
position: 'top',
|
|
54
|
-
locale: 'pt-br'
|
|
55
|
-
})
|
|
54
|
+
locale: 'pt-br',
|
|
55
|
+
});
|
|
56
56
|
|
|
57
57
|
const emit = defineEmits<{
|
|
58
|
-
close: []
|
|
59
|
-
emojiSelected: [emoji: string]
|
|
60
|
-
}>()
|
|
58
|
+
close: [];
|
|
59
|
+
emojiSelected: [emoji: string];
|
|
60
|
+
}>();
|
|
61
61
|
|
|
62
|
-
const emojiPickerRef = ref<HTMLElement>()
|
|
63
|
-
const emojiIndex = computed(() => new EmojiIndex(data))
|
|
62
|
+
const emojiPickerRef = ref<HTMLElement>();
|
|
63
|
+
const emojiIndex = computed(() => new EmojiIndex(data));
|
|
64
64
|
|
|
65
|
-
const accentColor = '#00A49F' // $unnnic-color-weni-600
|
|
65
|
+
const accentColor = '#00A49F'; // $unnnic-color-weni-600
|
|
66
66
|
|
|
67
|
-
const currentLocale = computed(() => props.locale || 'pt-br')
|
|
67
|
+
const currentLocale = computed(() => props.locale || 'pt-br');
|
|
68
68
|
|
|
69
69
|
const translation = (key: string) => {
|
|
70
|
-
const messages: Record<string, unknown> = i18n.global.messages as Record<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
const messages: Record<string, unknown> = i18n.global.messages as Record<
|
|
71
|
+
string,
|
|
72
|
+
unknown
|
|
73
|
+
>;
|
|
74
|
+
const loc = currentLocale.value;
|
|
75
|
+
const localeMsgs =
|
|
76
|
+
messages?.[loc] ||
|
|
77
|
+
messages?.[loc?.toLowerCase?.()] ||
|
|
78
|
+
messages?.[loc?.toUpperCase?.()];
|
|
79
|
+
const enMsgs = messages?.['en'];
|
|
80
|
+
return get(localeMsgs, key) || get(enMsgs, key) || key;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const title = computed(() => translation('emoji_picker.title'));
|
|
78
84
|
|
|
79
85
|
const translations = computed(() => ({
|
|
80
86
|
search: translation('emoji_picker.search'),
|
|
@@ -91,27 +97,30 @@ const translations = computed(() => ({
|
|
|
91
97
|
objects: translation('emoji_picker.categories.objects'),
|
|
92
98
|
symbols: translation('emoji_picker.categories.symbols'),
|
|
93
99
|
flags: translation('emoji_picker.categories.flags'),
|
|
94
|
-
custom: translation('emoji_picker.categories.custom')
|
|
95
|
-
}
|
|
96
|
-
}))
|
|
100
|
+
custom: translation('emoji_picker.categories.custom'),
|
|
101
|
+
},
|
|
102
|
+
}));
|
|
97
103
|
|
|
98
104
|
const handleClickOutside = (event: Event) => {
|
|
99
|
-
if (
|
|
100
|
-
|
|
105
|
+
if (
|
|
106
|
+
emojiPickerRef.value &&
|
|
107
|
+
!emojiPickerRef.value.contains(event.target as Node)
|
|
108
|
+
) {
|
|
109
|
+
emit('close');
|
|
101
110
|
}
|
|
102
|
-
}
|
|
111
|
+
};
|
|
103
112
|
|
|
104
113
|
onMounted(() => {
|
|
105
|
-
document.addEventListener('click', handleClickOutside)
|
|
106
|
-
})
|
|
114
|
+
document.addEventListener('click', handleClickOutside);
|
|
115
|
+
});
|
|
107
116
|
|
|
108
117
|
onUnmounted(() => {
|
|
109
|
-
document.removeEventListener('click', handleClickOutside)
|
|
110
|
-
})
|
|
118
|
+
document.removeEventListener('click', handleClickOutside);
|
|
119
|
+
});
|
|
111
120
|
|
|
112
121
|
const onEmojiSelect = (emoji: Emoji) => {
|
|
113
|
-
emit('emojiSelected', props.returnName ? emoji.id : emoji.native)
|
|
114
|
-
}
|
|
122
|
+
emit('emojiSelected', props.returnName ? emoji.id : emoji.native);
|
|
123
|
+
};
|
|
115
124
|
</script>
|
|
116
125
|
|
|
117
126
|
<style lang="scss" scoped>
|
|
@@ -137,7 +146,7 @@ const onEmojiSelect = (emoji: Emoji) => {
|
|
|
137
146
|
border: 1px solid rgb(244, 246, 248);
|
|
138
147
|
box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.1);
|
|
139
148
|
cursor: default;
|
|
140
|
-
color: #
|
|
149
|
+
color: #3b4151; // $unnnic-color-neutral-darkest
|
|
141
150
|
}
|
|
142
151
|
|
|
143
152
|
:deep(.emoji-mart-emoji) {
|
|
@@ -155,11 +164,11 @@ const onEmojiSelect = (emoji: Emoji) => {
|
|
|
155
164
|
|
|
156
165
|
:deep(.emoji-mart-anchor:hover),
|
|
157
166
|
:deep(.emoji-mart-anchor-selected) {
|
|
158
|
-
color: #
|
|
167
|
+
color: #00a49f; // $unnnic-color-weni-600
|
|
159
168
|
}
|
|
160
169
|
|
|
161
170
|
:deep(.emoji-mart-anchor-bar) {
|
|
162
|
-
background-color: #
|
|
171
|
+
background-color: #00a49f; // $unnnic-color-weni-600
|
|
163
172
|
}
|
|
164
173
|
|
|
165
174
|
:deep(.emoji-type-image.emoji-set-apple) {
|