@webitel/ui-sdk 1.0.22 → 1.0.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "1.0.22",
3
+ "version": "1.0.25",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -0,0 +1,9 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import WtAvatar from '../wt-avatar.vue';
3
+
4
+ describe('WtAvatar', () => {
5
+ it('renders a component', () => {
6
+ const wrapper = shallowMount(WtAvatar);
7
+ expect(wrapper.isVisible()).toBe(true);
8
+ });
9
+ });
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <div
3
+ class="wt-avatar"
4
+ :class="[`wt-avatar--size-${size}`]"
5
+ >
6
+ <wt-badge
7
+ v-if="badge"
8
+ :color-variable="badgeColorVar"
9
+ ></wt-badge>
10
+ <img
11
+ class="wt-avatar__img"
12
+ src="../../../assets/components/atoms/wt-avatar/default-avatar.svg"
13
+ alt="avatar"
14
+ >
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ import AbstractUserStatus from '../../../enums/AbstractUserStatus/AbstractUserStatus.enum';
20
+
21
+ export default {
22
+ name: 'wt-avatar',
23
+ props: {
24
+ size: {
25
+ type: String,
26
+ default: 'md',
27
+ options: ['md'],
28
+ },
29
+ badge: {
30
+ type: Boolean,
31
+ default: false,
32
+ },
33
+ status: {
34
+ type: String,
35
+ options: AbstractUserStatus,
36
+ default: AbstractUserStatus.OFFLINE,
37
+ },
38
+ },
39
+ computed: {
40
+ badgeColorVar() {
41
+ switch (this.status) {
42
+ case AbstractUserStatus.ACTIVE: return 'online-color';
43
+ case AbstractUserStatus.DND: return 'dnd-color';
44
+ case AbstractUserStatus.BUSY: return 'busy-color';
45
+ case AbstractUserStatus.OFFLINE: return 'offline-color';
46
+ default: return 'offline-color';
47
+ }
48
+ },
49
+ },
50
+ };
51
+ </script>
52
+
53
+ <style lang="scss" scoped>
54
+ .wt-avatar {
55
+ position: relative;
56
+ width: var(--avatar-size);
57
+ height: var(--avatar-size);
58
+
59
+ &__img {
60
+ width: 100%;
61
+ height: 100%;
62
+ }
63
+ }
64
+ </style>
@@ -0,0 +1,9 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import WtBadge from '../wt-badge.vue';
3
+
4
+ describe('WtBadge', () => {
5
+ it('renders a component', () => {
6
+ const wrapper = shallowMount(WtBadge);
7
+ expect(wrapper.isVisible()).toBe(true);
8
+ });
9
+ });
@@ -0,0 +1,39 @@
1
+ <template>
2
+ <aside
3
+ class="wt-badge"
4
+ :class="{ 'wt-badge--outside': outside }"
5
+ :style="{ background: `var(--${colorVariable})` }"
6
+ ></aside>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: 'wt-badge',
12
+ props: {
13
+ colorVariable: {
14
+ type: String,
15
+ default: 'false-color',
16
+ description: 'see all available colors in webitel-ui docs',
17
+ },
18
+ outside: {
19
+ type: Boolean,
20
+ default: false,
21
+ },
22
+ },
23
+ };
24
+ </script>
25
+
26
+ <style lang="scss" scoped>
27
+ .wt-badge {
28
+ position: absolute;
29
+ top: 0;
30
+ right: 0;
31
+ width: var(--wt-badge-size);
32
+ height: var(--wt-badge-size);
33
+ border-radius: 50%;
34
+
35
+ &--outside {
36
+ transform: translate(-100%, -100%);
37
+ }
38
+ }
39
+ </style>
@@ -1,4 +1,6 @@
1
1
  import Vue from 'vue';
2
+ import WtAvatar from './atoms/wt-avatar/wt-avatar.vue';
3
+ import WtBadge from './atoms/wt-badge/wt-badge.vue';
2
4
  import WtIcon from './atoms/wt-icon/wt-icon.vue';
3
5
  import WtIndicator from './atoms/wt-indicator/wt-indicator.vue';
4
6
  import WtInputInfo from './atoms/wt-input-info/wt-input-info.vue';
@@ -48,6 +50,8 @@ import WtTableActions from './organisms/wt-table-actions/wt-table-actions.vue';
48
50
  import WtTableColumnSelect from './organisms/wt-table-column-select/wt-table-column-select.vue';
49
51
 
50
52
  const Components = {
53
+ WtAvatar,
54
+ WtBadge,
51
55
  WtIcon,
52
56
  WtIndicator,
53
57
  WtInputInfo,
@@ -1,3 +1,5 @@
1
+ @import 'atoms/wt-avatar/variables';
2
+ @import 'atoms/wt-badge/variables';
1
3
  @import 'atoms/wt-chip/variables';
2
4
  @import "atoms/wt-button/variables";
3
5
  @import "atoms/wt-icon/variables";
@@ -0,0 +1,9 @@
1
+ :root {
2
+ --avatar-size--md: var(--spacing-md);
3
+ --avatar-size: var(--avatar-size--md);
4
+
5
+ --online-color: var(--true-color);
6
+ --dnd-color: var(--accent-color);
7
+ --busy-color: var(--false-color);
8
+ --offline-color: var(--secondary-color);
9
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --wt-badge-size: var(--spacing-xs);
3
+ }
@@ -0,0 +1,8 @@
1
+ const AbstractUserStatus = Object.freeze({
2
+ ACTIVE: 'active',
3
+ DND: 'dnd',
4
+ BUSY: 'busy',
5
+ OFFLINE: 'offline',
6
+ });
7
+
8
+ export default AbstractUserStatus;
@@ -22,9 +22,7 @@ export default class QueryFiltersStoreModule extends BaseStoreModule {
22
22
  let newValue = value;
23
23
  if (newValue) {
24
24
  if (multiple && !Array.isArray(newValue)) newValue = [newValue];
25
- } else {
26
- newValue = defaultValue;
27
- }
25
+ } else if (newValue === null || newValue === undefined) newValue = defaultValue;
28
26
  context.commit('SET_FILTER', { filter, value: newValue });
29
27
  },
30
28
  RESET_FILTERS: (context) => {
@@ -67,6 +67,12 @@ describe('QueryFiltersStoreModule actions', () => {
67
67
  expect(context.commit)
68
68
  .toHaveBeenCalledWith('SET_FILTER', { filter: filter.filter, value: [] });
69
69
  });
70
+ it('SET_FILTER: sets "false" value filter', () => {
71
+ const filter = { filter: valueFilter, value: false };
72
+ module.actions.SET_FILTER(context, filter);
73
+ expect(context.commit)
74
+ .toHaveBeenCalledWith('SET_FILTER', { filter: filter.filter, value: false });
75
+ });
70
76
  it('calls RESET_FILTERS mutation on RESET_FILTERS action call', () => {
71
77
  module.actions.RESET_FILTERS(context);
72
78
  expect(context.commit).toHaveBeenCalledWith('RESET_FILTERS');