@weni/unnnic-system 3.2.7 → 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 +15 -0
- package/dist/components/ChatsHeader/ChatsHeader.vue.d.ts.map +1 -1
- package/dist/components/ChatsMessage/ChatsMessageText.vue.d.ts.map +1 -1
- package/dist/components/Chip/Chip.vue.d.ts.map +1 -1
- package/dist/components/DataTable/index.vue.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.vue.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPicker.vue.d.ts.map +1 -1
- package/dist/components/Icon.vue.d.ts.map +1 -1
- package/dist/components/Tag/TagNext.vue.d.ts.map +1 -1
- package/dist/{es-57bb200f.mjs → es-b3e51efa.js} +1 -1
- package/dist/{index-5f770b98.mjs → index-b9e3c5e9.js} +57 -45
- package/dist/{pt-br-dc8f4568.mjs → pt-br-20887b32.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{unnnic.mjs → unnnic.js} +1 -1
- package/dist/{unnnic.umd.js → unnnic.umd.cjs} +5 -5
- package/package.json +9 -8
- 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 +1 -1
- package/src/components/Button/__tests__/Button.spec.js +2 -2
- package/src/components/Button/types.ts +1 -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 +1 -1
- package/src/components/Icon/types.ts +2 -2
- package/src/components/Icon.vue +3 -1
- package/src/components/Input/BaseInput.vue +2 -2
- package/src/components/InputDatePicker/InputDatePicker.vue +1 -1
- package/src/components/Label/Label.vue +2 -2
- 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/Tag/TagNext.vue +2 -8
- package/src/components/Tour/TourPopover.vue +1 -1
- package/src/components/__tests__/Icon.spec.js +2 -2
- package/src/components/index.ts +87 -87
- package/src/index.ts +1 -1
- package/src/main.ts +1 -1
- package/src/stories/Button.stories.js +1 -1
- 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/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
|
@@ -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) {
|
|
@@ -5,33 +5,45 @@ import UnnnicEmojiPicker from '../EmojiPicker.vue';
|
|
|
5
5
|
vi.mock('emoji-mart-vue-fast/src', () => ({
|
|
6
6
|
Picker: {
|
|
7
7
|
name: 'Picker',
|
|
8
|
-
props: [
|
|
8
|
+
props: [
|
|
9
|
+
'data',
|
|
10
|
+
'set',
|
|
11
|
+
'theme',
|
|
12
|
+
'preview',
|
|
13
|
+
'search',
|
|
14
|
+
'navPosition',
|
|
15
|
+
'noResultsEmoji',
|
|
16
|
+
'maxFrequentRows',
|
|
17
|
+
'i18n',
|
|
18
|
+
'color',
|
|
19
|
+
],
|
|
9
20
|
emits: ['select', 'click-outside'],
|
|
10
|
-
template: '<div class="emoji-mart-picker"></div>'
|
|
21
|
+
template: '<div class="emoji-mart-picker"></div>',
|
|
11
22
|
},
|
|
12
|
-
EmojiIndex: vi.fn().mockImplementation(() => ({}))
|
|
23
|
+
EmojiIndex: vi.fn().mockImplementation(() => ({})),
|
|
13
24
|
}));
|
|
14
25
|
|
|
15
26
|
vi.mock('emoji-mart-vue-fast/data/all.json', () => ({
|
|
16
|
-
default: {}
|
|
27
|
+
default: {},
|
|
17
28
|
}));
|
|
18
29
|
|
|
19
30
|
vi.mock('emoji-mart-vue-fast/css/emoji-mart.css', () => ({}));
|
|
20
31
|
|
|
21
32
|
vi.mock('../../utils/plugins/i18n', () => {
|
|
22
|
-
const current = 'pt-br'
|
|
33
|
+
const current = 'pt-br';
|
|
23
34
|
return {
|
|
24
35
|
default: {
|
|
25
36
|
global: {
|
|
26
|
-
get locale() {
|
|
37
|
+
get locale() {
|
|
38
|
+
return current;
|
|
39
|
+
},
|
|
27
40
|
set locale(_v) {},
|
|
28
41
|
t: (key) => `${key}`,
|
|
29
42
|
},
|
|
30
43
|
},
|
|
31
|
-
}
|
|
44
|
+
};
|
|
32
45
|
});
|
|
33
46
|
|
|
34
|
-
|
|
35
47
|
describe('UnnnicEmojiPicker', () => {
|
|
36
48
|
let wrapper;
|
|
37
49
|
|
|
@@ -50,12 +62,26 @@ describe('UnnnicEmojiPicker', () => {
|
|
|
50
62
|
stubs: {
|
|
51
63
|
Picker: {
|
|
52
64
|
name: 'Picker',
|
|
53
|
-
props: [
|
|
65
|
+
props: [
|
|
66
|
+
'data',
|
|
67
|
+
'set',
|
|
68
|
+
'theme',
|
|
69
|
+
'emoji',
|
|
70
|
+
'title',
|
|
71
|
+
'showPreview',
|
|
72
|
+
'search',
|
|
73
|
+
'navPosition',
|
|
74
|
+
'noResultsEmoji',
|
|
75
|
+
'maxFrequentRows',
|
|
76
|
+
'i18n',
|
|
77
|
+
'color',
|
|
78
|
+
],
|
|
54
79
|
emits: ['select', 'click-outside'],
|
|
55
|
-
template:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
80
|
+
template:
|
|
81
|
+
'<div class="emoji-mart-picker" @select="$emit(\'select\', $event)" @click-outside="$emit(\'click-outside\')"></div>',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
59
85
|
});
|
|
60
86
|
});
|
|
61
87
|
|
|
@@ -96,12 +122,26 @@ describe('UnnnicEmojiPicker', () => {
|
|
|
96
122
|
stubs: {
|
|
97
123
|
Picker: {
|
|
98
124
|
name: 'Picker',
|
|
99
|
-
props: [
|
|
125
|
+
props: [
|
|
126
|
+
'data',
|
|
127
|
+
'set',
|
|
128
|
+
'theme',
|
|
129
|
+
'emoji',
|
|
130
|
+
'title',
|
|
131
|
+
'showPreview',
|
|
132
|
+
'search',
|
|
133
|
+
'navPosition',
|
|
134
|
+
'noResultsEmoji',
|
|
135
|
+
'maxFrequentRows',
|
|
136
|
+
'i18n',
|
|
137
|
+
'color',
|
|
138
|
+
],
|
|
100
139
|
emits: ['select', 'click-outside'],
|
|
101
|
-
template:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
140
|
+
template:
|
|
141
|
+
'<div class="emoji-mart-picker" @select="$emit(\'select\', $event)"></div>',
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
105
145
|
});
|
|
106
146
|
|
|
107
147
|
const emojiMock = { id: 'smile', native: '😊' };
|
|
@@ -117,15 +157,15 @@ describe('UnnnicEmojiPicker', () => {
|
|
|
117
157
|
// Simula um click fora do componente
|
|
118
158
|
const outsideElement = document.createElement('div');
|
|
119
159
|
document.body.appendChild(outsideElement);
|
|
120
|
-
|
|
160
|
+
|
|
121
161
|
const clickEvent = new Event('click', { bubbles: true });
|
|
122
162
|
Object.defineProperty(clickEvent, 'target', { value: outsideElement });
|
|
123
|
-
|
|
163
|
+
|
|
124
164
|
document.dispatchEvent(clickEvent);
|
|
125
|
-
|
|
165
|
+
|
|
126
166
|
await wrapper.vm.$nextTick();
|
|
127
167
|
expect(wrapper.emitted('close')).toBeTruthy();
|
|
128
|
-
|
|
168
|
+
|
|
129
169
|
// Cleanup
|
|
130
170
|
document.body.removeChild(outsideElement);
|
|
131
171
|
});
|
|
@@ -133,7 +173,28 @@ describe('UnnnicEmojiPicker', () => {
|
|
|
133
173
|
it('renders bottom position class when position is bottom', async () => {
|
|
134
174
|
const custom = mount(UnnnicEmojiPicker, {
|
|
135
175
|
props: { position: 'bottom' },
|
|
136
|
-
global: {
|
|
176
|
+
global: {
|
|
177
|
+
stubs: {
|
|
178
|
+
Picker: {
|
|
179
|
+
name: 'Picker',
|
|
180
|
+
props: [
|
|
181
|
+
'data',
|
|
182
|
+
'set',
|
|
183
|
+
'theme',
|
|
184
|
+
'emoji',
|
|
185
|
+
'title',
|
|
186
|
+
'showPreview',
|
|
187
|
+
'search',
|
|
188
|
+
'navPosition',
|
|
189
|
+
'noResultsEmoji',
|
|
190
|
+
'maxFrequentRows',
|
|
191
|
+
'i18n',
|
|
192
|
+
'color',
|
|
193
|
+
],
|
|
194
|
+
template: '<div />',
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
},
|
|
137
198
|
});
|
|
138
199
|
expect(custom.classes()).toContain('emoji-picker--bottom');
|
|
139
200
|
custom.unmount();
|
package/src/components/Flag.vue
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { SchemeColor } from
|
|
1
|
+
import type { SchemeColor } from '@/types/scheme-colors';
|
|
2
2
|
|
|
3
3
|
// Re-export SchemeColor for backward compatibility
|
|
4
4
|
export type { SchemeColor };
|
|
5
5
|
|
|
6
|
-
export type IconSize =
|
|
6
|
+
export type IconSize =
|
|
7
7
|
| 'nano'
|
|
8
8
|
| 'xs'
|
|
9
9
|
| 'sm'
|
package/src/components/Icon.vue
CHANGED
|
@@ -74,7 +74,9 @@ const materialSymbolsName = computed(() => {
|
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
return (
|
|
77
|
+
return (
|
|
78
|
+
(OldIconsMap as Record<string, string>)[props.icon as string] || props.icon
|
|
79
|
+
);
|
|
78
80
|
});
|
|
79
81
|
|
|
80
82
|
const onClick = (event: Event) => {
|
|
@@ -110,8 +110,8 @@ export default {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
&.input--has-icon-left {
|
|
113
|
-
padding-left: $unnnic-spacing-sm + $unnnic-icon-size-sm +
|
|
114
|
-
$unnnic-border-width-thinner;
|
|
113
|
+
padding-left: $unnnic-spacing-sm + $unnnic-icon-size-sm +
|
|
114
|
+
$unnnic-spacing-xs - $unnnic-border-width-thinner;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
&.input--has-icon-right {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
>
|
|
21
21
|
<UnnnicDatePicker
|
|
22
22
|
v-if="showCalendarFilter"
|
|
23
|
+
v-model:equivalentOption="overwrittenValue"
|
|
23
24
|
:type="type"
|
|
24
25
|
:clearLabel="clearText"
|
|
25
26
|
:actionLabel="actionText"
|
|
@@ -31,7 +32,6 @@
|
|
|
31
32
|
:minDate="minDate"
|
|
32
33
|
:maxDate="maxDate"
|
|
33
34
|
:disableClear="disableClear"
|
|
34
|
-
v-model:equivalentOption="overwrittenValue"
|
|
35
35
|
@change="emitSelectDate"
|
|
36
36
|
@submit="changeDate"
|
|
37
37
|
/>
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
v-if="$slots.description?.().length"
|
|
91
91
|
name="description"
|
|
92
92
|
>
|
|
93
|
-
|
|
93
|
+
</slot>
|
|
94
94
|
|
|
95
95
|
<template v-else>{{ description }}</template>
|
|
96
96
|
</div>
|
|
@@ -158,7 +158,7 @@ import UnnnicInput from '../Input/Input.vue';
|
|
|
158
158
|
import UnnnicButton from '../Button/Button.vue';
|
|
159
159
|
|
|
160
160
|
export default {
|
|
161
|
-
name:
|
|
161
|
+
name: 'UnnnicModalNext',
|
|
162
162
|
components: {
|
|
163
163
|
UnnnicIcon,
|
|
164
164
|
UnnnicInput,
|
|
@@ -214,7 +214,12 @@ export default {
|
|
|
214
214
|
},
|
|
215
215
|
},
|
|
216
216
|
|
|
217
|
-
emits: [
|
|
217
|
+
emits: [
|
|
218
|
+
'update:searchValue',
|
|
219
|
+
'onChange',
|
|
220
|
+
'update:modelValue',
|
|
221
|
+
'onActiveChange',
|
|
222
|
+
],
|
|
218
223
|
|
|
219
224
|
data() {
|
|
220
225
|
return {
|
|
@@ -383,11 +388,18 @@ export default {
|
|
|
383
388
|
return;
|
|
384
389
|
}
|
|
385
390
|
|
|
386
|
-
if
|
|
391
|
+
if (
|
|
392
|
+
this.multiple &&
|
|
393
|
+
option.disableRemove &&
|
|
394
|
+
this.optionIsSelected(option)
|
|
395
|
+
) {
|
|
387
396
|
return;
|
|
388
397
|
}
|
|
389
398
|
|
|
390
|
-
if (
|
|
399
|
+
if (
|
|
400
|
+
this.multipleLimit &&
|
|
401
|
+
this.modelValue.length >= this.multipleLimit
|
|
402
|
+
) {
|
|
391
403
|
return;
|
|
392
404
|
}
|
|
393
405
|
|
|
@@ -561,7 +573,6 @@ export default {
|
|
|
561
573
|
const focusedOptionIndex = this.getOptionIndex('focused');
|
|
562
574
|
let newIndex;
|
|
563
575
|
|
|
564
|
-
// eslint-disable-next-line default-case
|
|
565
576
|
switch (key) {
|
|
566
577
|
case 'Escape':
|
|
567
578
|
this.active = false;
|
|
@@ -260,14 +260,14 @@ describe('SelectSmart.vue', () => {
|
|
|
260
260
|
it('should emit onActiveChange when toggling dropdown visibility', async () => {
|
|
261
261
|
// Open dropdown
|
|
262
262
|
await input().trigger('click');
|
|
263
|
-
|
|
263
|
+
|
|
264
264
|
// Close dropdown
|
|
265
265
|
await input().trigger('click');
|
|
266
266
|
|
|
267
267
|
const emittedEvents = wrapper.emitted('onActiveChange');
|
|
268
268
|
expect(emittedEvents).toBeTruthy();
|
|
269
269
|
expect(emittedEvents.length).toBe(2);
|
|
270
|
-
expect(emittedEvents[0][0]).toBe(true);
|
|
270
|
+
expect(emittedEvents[0][0]).toBe(true); // opened
|
|
271
271
|
expect(emittedEvents[1][0]).toBe(false); // closed
|
|
272
272
|
});
|
|
273
273
|
|
|
@@ -61,10 +61,14 @@ describe('Switch', () => {
|
|
|
61
61
|
|
|
62
62
|
it('should render the correct icon size based on the size prop', async () => {
|
|
63
63
|
await wrapper.setProps({ size: 'small' });
|
|
64
|
-
expect(wrapper.findComponent({ name: 'UnnnicIcon' }).props('size')).toBe(
|
|
64
|
+
expect(wrapper.findComponent({ name: 'UnnnicIcon' }).props('size')).toBe(
|
|
65
|
+
'sm',
|
|
66
|
+
);
|
|
65
67
|
|
|
66
68
|
await wrapper.setProps({ size: 'medium' });
|
|
67
|
-
expect(wrapper.findComponent({ name: 'UnnnicIcon' }).props('size')).toBe(
|
|
69
|
+
expect(wrapper.findComponent({ name: 'UnnnicIcon' }).props('size')).toBe(
|
|
70
|
+
'md',
|
|
71
|
+
);
|
|
68
72
|
});
|
|
69
73
|
|
|
70
74
|
it('should change the icon color based on the state', async () => {
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<section
|
|
3
|
-
:class="[
|
|
4
|
-
'unnnic-tag-next',
|
|
5
|
-
`unnnic-tag-next--${scheme}`
|
|
6
|
-
]"
|
|
7
|
-
>
|
|
2
|
+
<section :class="['unnnic-tag-next', `unnnic-tag-next--${scheme}`]">
|
|
8
3
|
<p class="unnnic-tag-next__text">
|
|
9
4
|
{{ text }}
|
|
10
5
|
</p>
|
|
@@ -61,6 +56,5 @@ export default {
|
|
|
61
56
|
background-color: $unnnic-color-weni-100;
|
|
62
57
|
color: $unnnic-color-weni-600;
|
|
63
58
|
}
|
|
64
|
-
|
|
65
59
|
}
|
|
66
|
-
</style>
|
|
60
|
+
</style>
|
|
@@ -128,7 +128,7 @@ export default {
|
|
|
128
128
|
left: attachedTop - popoverHeight / 2 + attachedHeight / 2,
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
const style = {
|
|
132
132
|
transform: `translate(${translateXMap[step.popoverPosition]}px, ${translateYMap[step.popoverPosition]}px)`,
|
|
133
133
|
transition: 'transform .3s ease',
|
|
134
134
|
};
|
|
@@ -35,8 +35,8 @@ const commonTests = async (wrapper) => {
|
|
|
35
35
|
describe('Icon', () => {
|
|
36
36
|
it('should accept valid lineHeight props', () => {
|
|
37
37
|
const validValues = ['sm', 'md', 'lg', null];
|
|
38
|
-
|
|
39
|
-
validValues.forEach(value => {
|
|
38
|
+
|
|
39
|
+
validValues.forEach((value) => {
|
|
40
40
|
const wrapper = createWrapper({ lineHeight: value });
|
|
41
41
|
expect(wrapper.exists()).toBe(true);
|
|
42
42
|
});
|