design-system-next 2.26.6 → 2.26.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/dist/design-system-next.es.js +3374 -3333
- package/dist/design-system-next.es.js.gz +0 -0
- package/dist/design-system-next.umd.js +11 -11
- package/dist/design-system-next.umd.js.gz +0 -0
- package/package.json +1 -1
- package/src/components/avatar/avatar.vue +7 -7
- package/src/components/avatar/use-avatar.ts +1 -1
- package/src/components/list/list-item/list-item.ts +8 -1
- package/src/components/list/list-item/list-item.vue +12 -1
- package/src/components/list/list-item/use-list-item.ts +5 -1
- package/src/components/list/list.ts +8 -0
- package/src/components/list/list.vue +4 -0
- package/src/components/select/select-multiple/select-multiple.ts +8 -0
- package/src/components/select/select-multiple/select-multiple.vue +2 -0
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="spr-h-fit spr-w-fit">
|
|
3
3
|
<div v-if="!props.loading && !imageError" :class="avatarClasses.baseClasses">
|
|
4
|
-
<template v-if="
|
|
5
|
-
<div :class="avatarClasses.
|
|
4
|
+
<template v-if="props.variant === 'count' || props.variant === 'initial'">
|
|
5
|
+
<div :class="avatarClasses.initialsContainerClasses">
|
|
6
|
+
{{ props.variant === 'count' ? `+${props.count}` : getInitials }}
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
<template v-else>
|
|
10
|
+
<div v-if="props.variant || $slots.default" :class="avatarClasses.imageContainerClasses">
|
|
6
11
|
<slot>
|
|
7
12
|
<img v-if="src" :src="src" :alt="alt" @error="handleImageError" />
|
|
8
13
|
<Icon v-else :icon="getIconVariant" />
|
|
9
14
|
</slot>
|
|
10
15
|
</div>
|
|
11
16
|
</template>
|
|
12
|
-
<template v-else>
|
|
13
|
-
<div :class="avatarClasses.initialsContainerClasses">
|
|
14
|
-
{{ props.variant === 'count' ? `+${props.count}` : getInitials }}
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
17
|
|
|
18
18
|
<span v-if="props.notification" :class="avatarClasses.notificationClasses">
|
|
19
19
|
<spr-badge :text="props.notificationText" variant="danger" :size="getAvatarSize.notif" />
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
2
|
import type { MenuListType } from '../list';
|
|
3
|
-
|
|
4
3
|
export const listItemPropTypes = {
|
|
5
4
|
item: {
|
|
6
5
|
type: Object as PropType<MenuListType>,
|
|
@@ -50,6 +49,14 @@ export const listItemPropTypes = {
|
|
|
50
49
|
type: Boolean,
|
|
51
50
|
default: false,
|
|
52
51
|
},
|
|
52
|
+
avatarVariant: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: '',
|
|
55
|
+
},
|
|
56
|
+
avatarSource: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: '',
|
|
59
|
+
},
|
|
53
60
|
};
|
|
54
61
|
|
|
55
62
|
export const listItemEmitTypes = {
|
|
@@ -46,6 +46,16 @@
|
|
|
46
46
|
>
|
|
47
47
|
<Icon class="spr-text-xl" :icon="iconName" />
|
|
48
48
|
</span>
|
|
49
|
+
|
|
50
|
+
<span v-if="hasAvatar">
|
|
51
|
+
<spr-avatar
|
|
52
|
+
size="sm"
|
|
53
|
+
:initial="props.avatarSource || listItem.text"
|
|
54
|
+
:variant="props.avatarVariant"
|
|
55
|
+
:src="props.avatarSource"
|
|
56
|
+
/>
|
|
57
|
+
</span>
|
|
58
|
+
|
|
49
59
|
<div
|
|
50
60
|
:class="[
|
|
51
61
|
'spr-flex spr-flex-auto spr-flex-col spr-justify-start',
|
|
@@ -106,6 +116,7 @@ import { Icon } from '@iconify/vue';
|
|
|
106
116
|
import SprCheckbox from '@/components/checkbox/checkbox.vue';
|
|
107
117
|
import SprRadio from '@/components/radio/radio.vue';
|
|
108
118
|
import SprLozenge from '@/components/lozenge/lozenge.vue';
|
|
119
|
+
import SprAvatar from '@/components/avatar/avatar.vue';
|
|
109
120
|
|
|
110
121
|
import { LOZENGE_TONE } from '@/components/lozenge/lozenge';
|
|
111
122
|
|
|
@@ -115,5 +126,5 @@ import { useListItem } from './use-list-item';
|
|
|
115
126
|
const props = defineProps(listItemPropTypes);
|
|
116
127
|
const emit = defineEmits(listItemEmitTypes);
|
|
117
128
|
|
|
118
|
-
const { listItem, hasIcon, iconName, iconClasses, hasSublevels, showLozengeMode } = useListItem(props, emit);
|
|
129
|
+
const { listItem, hasIcon, iconName, iconClasses, hasSublevels, showLozengeMode, hasAvatar } = useListItem(props, emit);
|
|
119
130
|
</script>
|
|
@@ -14,13 +14,16 @@ export function useListItem(
|
|
|
14
14
|
iconClasses: ComputedRef<string>;
|
|
15
15
|
hasSublevels: ComputedRef<boolean>;
|
|
16
16
|
showLozengeMode: ComputedRef<boolean>;
|
|
17
|
+
hasAvatar: ComputedRef<boolean>;
|
|
17
18
|
} {
|
|
18
|
-
const { item, itemIcon, itemIconTone, itemIconFill, lozenge } = toRefs(props);
|
|
19
|
+
const { item, itemIcon, itemIconTone, itemIconFill, lozenge, avatarVariant } = toRefs(props);
|
|
19
20
|
|
|
20
21
|
const listItem = computed(() => item?.value);
|
|
21
22
|
|
|
22
23
|
const hasIcon = computed(() => !!(itemIcon.value || item?.value!.icon));
|
|
23
24
|
|
|
25
|
+
const hasAvatar = computed(() => !!(avatarVariant.value && !hasIcon.value));
|
|
26
|
+
|
|
24
27
|
const iconName = computed(() => itemIcon.value || item?.value!.icon || '');
|
|
25
28
|
|
|
26
29
|
const iconClasses = computed(() => {
|
|
@@ -64,6 +67,7 @@ export function useListItem(
|
|
|
64
67
|
return {
|
|
65
68
|
listItem,
|
|
66
69
|
hasIcon,
|
|
70
|
+
hasAvatar,
|
|
67
71
|
iconName,
|
|
68
72
|
iconClasses,
|
|
69
73
|
hasSublevels,
|
|
@@ -131,6 +131,14 @@ export const listPropTypes = {
|
|
|
131
131
|
type: Boolean,
|
|
132
132
|
default: false,
|
|
133
133
|
},
|
|
134
|
+
avatarVariant: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: '',
|
|
137
|
+
},
|
|
138
|
+
avatarSource: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: '',
|
|
141
|
+
},
|
|
134
142
|
};
|
|
135
143
|
|
|
136
144
|
export const listEmitTypes = {
|
|
@@ -70,6 +70,8 @@
|
|
|
70
70
|
:item-icon-fill="props.itemIconFill"
|
|
71
71
|
:disabled-unselected-items="props.disabledUnselectedItems"
|
|
72
72
|
:radio-list="props.radioList"
|
|
73
|
+
:avatar-variant="props.avatarVariant"
|
|
74
|
+
:avatar-source="props.avatarSource"
|
|
73
75
|
@select="handleSelectedItem(item)"
|
|
74
76
|
/>
|
|
75
77
|
<div v-if="props.infiniteScrollLoader" class="spr-flex spr-items-center spr-justify-center spr-p-2">
|
|
@@ -98,6 +100,8 @@
|
|
|
98
100
|
:item-icon-fill="props.itemIconFill"
|
|
99
101
|
:disabled-unselected-items="props.disabledUnselectedItems"
|
|
100
102
|
:radio-list="props.radioList"
|
|
103
|
+
:avatar-variant="props.avatarVariant"
|
|
104
|
+
:avatar-source="props.avatarSource"
|
|
101
105
|
@select="handleSelectedItem(item)"
|
|
102
106
|
/>
|
|
103
107
|
<div v-if="props.infiniteScrollLoader" class="spr-flex spr-items-center spr-justify-center spr-p-2">
|
|
@@ -213,6 +213,14 @@ export const multiSelectPropTypes = {
|
|
|
213
213
|
type: Boolean,
|
|
214
214
|
default: false,
|
|
215
215
|
},
|
|
216
|
+
avatarVariant: {
|
|
217
|
+
type: String,
|
|
218
|
+
default: '',
|
|
219
|
+
},
|
|
220
|
+
avatarSource: {
|
|
221
|
+
type: String,
|
|
222
|
+
default: '',
|
|
223
|
+
},
|
|
216
224
|
};
|
|
217
225
|
|
|
218
226
|
export const multiSelectEmitTypes = {
|
|
@@ -166,6 +166,8 @@
|
|
|
166
166
|
:disabled-local-search="props.disabledLocalSearch"
|
|
167
167
|
:disabled-unselected-items="props.disabledUnselectedItems"
|
|
168
168
|
:allow-select-all="props.allowSelectAll"
|
|
169
|
+
:avatar-variant="props.avatarVariant"
|
|
170
|
+
:avatar-source="props.avatarSource"
|
|
169
171
|
multi-select
|
|
170
172
|
@update:model-value="handleMultiSelectedItem"
|
|
171
173
|
@get-single-selected-item="emit('get-single-selected-item', $event)"
|