@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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weni/unnnic-system",
|
|
3
|
-
"version": "3.2.
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "3.2.8",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"src",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"build": "vite build",
|
|
31
31
|
"build:types": "vue-tsc && vite build",
|
|
32
32
|
"preview": "vite preview",
|
|
33
|
-
"lint": "eslint
|
|
33
|
+
"lint": "eslint src/**/*.{js,vue,ts} --fix",
|
|
34
34
|
"format": "prettier --write src/",
|
|
35
35
|
"type-check": "vue-tsc --noEmit",
|
|
36
36
|
"storybook": "storybook dev -p 6006",
|
|
@@ -80,14 +80,15 @@
|
|
|
80
80
|
"@vitest/coverage-istanbul": "^1.6.0",
|
|
81
81
|
"@vitest/coverage-v8": "^1.6.0",
|
|
82
82
|
"@vitest/ui": "^1.6.0",
|
|
83
|
-
"@vue/eslint-config-prettier": "^
|
|
83
|
+
"@vue/eslint-config-prettier": "^10.2.0",
|
|
84
|
+
"@vue/eslint-config-typescript": "^14.6.0",
|
|
84
85
|
"@vue/test-utils": "^2.4.6",
|
|
85
|
-
"eslint": "^
|
|
86
|
-
"eslint
|
|
87
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
86
|
+
"@weni/eslint-config": "^2.0.0",
|
|
87
|
+
"eslint": "^9.33.0",
|
|
88
88
|
"eslint-plugin-storybook": "^0.8.0",
|
|
89
|
-
"eslint-plugin-vue": "
|
|
89
|
+
"eslint-plugin-vue": "10.4.0",
|
|
90
90
|
"jsdom": "^24.1.1",
|
|
91
|
+
"prettier": "3.6.2",
|
|
91
92
|
"react": "^18.2.0",
|
|
92
93
|
"react-dom": "^18.2.0",
|
|
93
94
|
"sass": "^1.63.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
|
|
3
|
-
const files =
|
|
3
|
+
const files = readdirSync('.');
|
|
4
4
|
|
|
5
5
|
files
|
|
6
6
|
.filter((name) => name.endsWith('.svg'))
|
|
@@ -11,10 +11,7 @@ files
|
|
|
11
11
|
.map((word) => word.slice(0, 1).toUpperCase() + word.slice(1))
|
|
12
12
|
.join('');
|
|
13
13
|
|
|
14
|
-
const content =
|
|
14
|
+
const content = readFileSync(file + '.svg', { encoding: 'utf8' });
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
pascalCaseName + '.vue',
|
|
18
|
-
`<template>${content}</template>`,
|
|
19
|
-
);
|
|
16
|
+
writeFileSync(pascalCaseName + '.vue', `<template>${content}</template>`);
|
|
20
17
|
});
|
|
@@ -66,7 +66,6 @@ const filterData = (audioBuffer) => {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
const normalizeData = (filteredData) => {
|
|
69
|
-
// eslint-disable-next-line no-restricted-properties
|
|
70
69
|
const multiplier = Math.pow(Math.max(...filteredData), -1);
|
|
71
70
|
return filteredData.map((n) => n * multiplier);
|
|
72
71
|
};
|
|
@@ -273,7 +272,9 @@ export default {
|
|
|
273
272
|
this.audio.addEventListener('timeupdate', () => {
|
|
274
273
|
if (this.status !== 'playing') return;
|
|
275
274
|
|
|
276
|
-
this.currentTime = isNaN(this.audio.currentTime)
|
|
275
|
+
this.currentTime = isNaN(this.audio.currentTime)
|
|
276
|
+
? 0
|
|
277
|
+
: this.audio.currentTime;
|
|
277
278
|
});
|
|
278
279
|
|
|
279
280
|
this.audio.addEventListener('ended', () => {
|
|
@@ -91,10 +91,10 @@ describe('Button', () => {
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
it('should render filled icons when iconsFilled prop is true', async () => {
|
|
94
|
-
const wrapper = createWrapper({
|
|
94
|
+
const wrapper = createWrapper({
|
|
95
95
|
iconLeft: 'search-1',
|
|
96
96
|
iconRight: 'search-1',
|
|
97
|
-
iconsFilled: true
|
|
97
|
+
iconsFilled: true,
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
const leftIcon = wrapper.findComponent('[data-testid="icon-left"]');
|
|
@@ -194,7 +194,10 @@ export default {
|
|
|
194
194
|
<style lang="scss">
|
|
195
195
|
@use '@/assets/scss/unnnic' as *;
|
|
196
196
|
|
|
197
|
-
$card-needed-colors:
|
|
197
|
+
$card-needed-colors:
|
|
198
|
+
'feedback-red', 'feedback-green', 'feedback-yellow', 'feedback-blue',
|
|
199
|
+
'feedback-grey', 'aux-blue', 'aux-purple', 'aux-orange', 'aux-lemon',
|
|
200
|
+
'aux-pink', 'brand-weni-soft';
|
|
198
201
|
|
|
199
202
|
@each $name, $color in $unnnic-scheme-colors {
|
|
200
203
|
@if index($card-needed-colors, $name) {
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
/>
|
|
120
120
|
</button>
|
|
121
121
|
<p
|
|
122
|
-
v-else-if="(unreadMessages && !selected) ||
|
|
122
|
+
v-else-if="(unreadMessages && !selected) || forceShowUnreadMessages"
|
|
123
123
|
class="chats-contact__infos__unread-messages"
|
|
124
124
|
:title="i18n('unread_messages', unreadMessages, { unreadMessages })"
|
|
125
125
|
>
|
|
@@ -68,7 +68,10 @@
|
|
|
68
68
|
<slot />
|
|
69
69
|
</div>
|
|
70
70
|
</main>
|
|
71
|
-
<slot
|
|
71
|
+
<slot
|
|
72
|
+
v-if="slots['right']"
|
|
73
|
+
name="right"
|
|
74
|
+
/>
|
|
72
75
|
<UnnnicButton
|
|
73
76
|
v-else-if="close"
|
|
74
77
|
class="unnnic-chats-header__close--sm"
|
|
@@ -127,7 +130,6 @@ const slots = useSlots();
|
|
|
127
130
|
defineEmits<{
|
|
128
131
|
crumbClick: [crumb: { name: string; path: string }];
|
|
129
132
|
}>();
|
|
130
|
-
|
|
131
133
|
</script>
|
|
132
134
|
|
|
133
135
|
<style lang="scss">
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
class="unnnic-chats-message__text"
|
|
5
5
|
v-html="formattedText"
|
|
6
6
|
/>
|
|
7
|
-
<p
|
|
7
|
+
<p
|
|
8
|
+
v-if="isAutomatic"
|
|
9
|
+
class="unnnic-chats-message__text--automatic"
|
|
10
|
+
>
|
|
8
11
|
{{ i18n('automatic_message') }}
|
|
9
12
|
</p>
|
|
10
13
|
</section>
|
|
@@ -49,14 +52,12 @@ export default {
|
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
function removeHtmlDangerousContent(text) {
|
|
52
|
-
// eslint-disable-next-line default-param-last
|
|
53
55
|
return text.replace(
|
|
54
56
|
/<(\/)?([^> ]+)( [^>]+)?>/gi,
|
|
55
57
|
($1, $2 = '', $3, $4 = '') => {
|
|
56
58
|
if (['b', 'i', 'u', 'ul', 'li', 'br', 'div'].includes($3)) {
|
|
57
59
|
const complements = [];
|
|
58
60
|
|
|
59
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
60
61
|
for (const i of $4.matchAll(
|
|
61
62
|
/((?<name1>[^ =]+)="(?<value1>[^"]*)"|(?<name2>[^ =]+)='(?<value2>[^"]*)')/g,
|
|
62
63
|
)) {
|
|
@@ -66,7 +67,6 @@ export default {
|
|
|
66
67
|
if (name === 'style') {
|
|
67
68
|
const styles = [];
|
|
68
69
|
|
|
69
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
70
70
|
for (const j of value.matchAll(
|
|
71
71
|
/(?<propertyName>[^:]+):(?<propertyValue>[^;]+);?/g,
|
|
72
72
|
)) {
|
|
@@ -131,4 +131,4 @@ export default {
|
|
|
131
131
|
color: $unnnic-color-aux-blue-500;
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
</style>
|
|
134
|
+
</style>
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
<!-- eslint-disable vue/multi-word-component-names -->
|
|
2
2
|
<template>
|
|
3
|
-
<section
|
|
3
|
+
<section
|
|
4
4
|
:class="[
|
|
5
5
|
'chip',
|
|
6
6
|
chipClass,
|
|
7
7
|
{
|
|
8
8
|
'chip--border': shouldShowBorder,
|
|
9
|
-
'chip--is-clickable': isClickable
|
|
10
|
-
}
|
|
9
|
+
'chip--is-clickable': isClickable,
|
|
10
|
+
},
|
|
11
11
|
]"
|
|
12
12
|
@click="onClick"
|
|
13
13
|
>
|
|
14
14
|
<p :class="['chip__text', textColorClass]">{{ text }}</p>
|
|
15
|
-
<p
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
<p
|
|
16
|
+
v-if="count"
|
|
17
|
+
:class="['chip__count', countColorClass]"
|
|
18
|
+
>
|
|
19
|
+
{{ count }}
|
|
20
|
+
</p>
|
|
21
|
+
<UnnnicIcon
|
|
22
|
+
v-if="type === 'multiple'"
|
|
23
|
+
:icon="isSelected ? 'close' : 'add'"
|
|
24
|
+
:scheme="isSelected ? 'teal-600' : 'feedback-grey'"
|
|
25
|
+
class="chip__icon"
|
|
26
|
+
size="sm"
|
|
22
27
|
/>
|
|
23
28
|
</section>
|
|
24
29
|
</template>
|
|
@@ -47,7 +52,7 @@ const textColorClass = computed(() => {
|
|
|
47
52
|
return 'chip__text--is-selected';
|
|
48
53
|
}
|
|
49
54
|
return '';
|
|
50
|
-
});
|
|
55
|
+
});
|
|
51
56
|
|
|
52
57
|
const countColorClass = computed(() => {
|
|
53
58
|
if (props.isSelected) {
|
|
@@ -65,60 +70,60 @@ const chipClass = computed(() => {
|
|
|
65
70
|
@use '@/assets/scss/unnnic' as *;
|
|
66
71
|
|
|
67
72
|
.chip {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
display: inline-flex;
|
|
74
|
+
height: 26px;
|
|
75
|
+
padding: $unnnic-space-1 $unnnic-space-3;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: $unnnic-space-2;
|
|
79
|
+
flex-shrink: 0;
|
|
80
|
+
border-radius: 600px;
|
|
81
|
+
background-color: $unnnic-color-bg-base;
|
|
82
|
+
|
|
83
|
+
&:hover {
|
|
84
|
+
background-color: $unnnic-color-bg-soft;
|
|
85
|
+
}
|
|
77
86
|
|
|
87
|
+
&--is-selected {
|
|
88
|
+
background-color: $unnnic-color-teal-100;
|
|
78
89
|
&:hover {
|
|
79
|
-
|
|
90
|
+
background-color: $unnnic-color-teal-200;
|
|
80
91
|
}
|
|
92
|
+
}
|
|
81
93
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
background-color: $unnnic-color-teal-200;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
94
|
+
&--is-clickable {
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
}
|
|
88
97
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
&--border {
|
|
94
|
-
border: 1px solid $unnnic-color-border-base;
|
|
95
|
-
}
|
|
98
|
+
&--border {
|
|
99
|
+
border: 1px solid $unnnic-color-border-base;
|
|
100
|
+
}
|
|
96
101
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
&__text {
|
|
103
|
+
color: $unnnic-color-fg-base;
|
|
104
|
+
font: $unnnic-font-caption-1;
|
|
100
105
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
106
|
+
&--is-selected {
|
|
107
|
+
color: $unnnic-color-fg-active;
|
|
104
108
|
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&__count {
|
|
112
|
+
display: flex;
|
|
113
|
+
padding: 0 $unnnic-space-2;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: 10px;
|
|
117
|
+
border-radius: 600px;
|
|
118
|
+
background: $unnnic-color-bg-soft;
|
|
119
|
+
color: $unnnic-color-fg-base;
|
|
120
|
+
font: $unnnic-font-caption-1;
|
|
121
|
+
font-weight: $unnnic-font-weight-medium;
|
|
105
122
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
justify-content: center;
|
|
110
|
-
align-items: center;
|
|
111
|
-
gap: 10px;
|
|
112
|
-
border-radius: 600px;
|
|
113
|
-
background: $unnnic-color-bg-soft;
|
|
114
|
-
color: $unnnic-color-fg-base;
|
|
115
|
-
font: $unnnic-font-caption-1;
|
|
116
|
-
font-weight: $unnnic-font-weight-medium;
|
|
117
|
-
|
|
118
|
-
&--is-selected {
|
|
119
|
-
color: $unnnic-color-fg-active;
|
|
120
|
-
background: $unnnic-color-white;
|
|
121
|
-
}
|
|
123
|
+
&--is-selected {
|
|
124
|
+
color: $unnnic-color-fg-active;
|
|
125
|
+
background: $unnnic-color-white;
|
|
122
126
|
}
|
|
127
|
+
}
|
|
123
128
|
}
|
|
124
|
-
</style>
|
|
129
|
+
</style>
|
|
@@ -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
|
});
|