blip-ds 1.198.2 → 1.200.0
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/blip-ds/bds-avatar-group.entry.js +19 -7
- package/dist/blip-ds/bds-avatar-group.system.entry.js +1 -1
- package/dist/blip-ds/bds-avatar.entry.js +19 -10
- package/dist/blip-ds/bds-avatar.system.entry.js +1 -1
- package/dist/blip-ds/bds-input-editable.entry.js +111 -21
- package/dist/blip-ds/bds-input-editable.system.entry.js +1 -1
- package/dist/blip-ds/bds-radio.entry.js +10 -3
- package/dist/blip-ds/bds-radio.system.entry.js +1 -1
- package/dist/blip-ds/blip-ds.esm.js +1 -1
- package/dist/blip-ds/blip-ds.system.js +1 -1
- package/dist/blip-ds/p-2c2f2e1e.system.entry.js +1 -0
- package/dist/blip-ds/p-36b0af8a.entry.js +1 -0
- package/dist/blip-ds/p-47075e60.system.entry.js +1 -0
- package/dist/blip-ds/p-775e9eba.entry.js +1 -0
- package/dist/blip-ds/p-8532c751.entry.js +1 -0
- package/dist/blip-ds/p-8936d3d8.entry.js +1 -0
- package/dist/blip-ds/p-9e39846b.system.entry.js +1 -0
- package/dist/blip-ds/p-a4ac8b27.system.js +1 -1
- package/dist/blip-ds/p-abc55863.system.entry.js +1 -0
- package/dist/cjs/bds-avatar-group.cjs.entry.js +18 -6
- package/dist/cjs/bds-avatar.cjs.entry.js +18 -9
- package/dist/cjs/bds-input-editable.cjs.entry.js +111 -21
- package/dist/cjs/bds-radio.cjs.entry.js +9 -2
- package/dist/cjs/blip-ds.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/avatar/avatar.css +44 -38
- package/dist/collection/components/avatar/avatar.js +47 -21
- package/dist/collection/components/avatar-group/avatar-group.css +65 -12
- package/dist/collection/components/avatar-group/avatar-group.js +51 -6
- package/dist/collection/components/input-editable/input-editable.css +275 -8
- package/dist/collection/components/input-editable/input-editable.js +218 -21
- package/dist/collection/components/radio/radio.css +65 -13
- package/dist/collection/components/radio/radio.js +17 -7
- package/dist/esm/bds-avatar-group.entry.js +19 -7
- package/dist/esm/bds-avatar.entry.js +19 -10
- package/dist/esm/bds-input-editable.entry.js +111 -21
- package/dist/esm/bds-radio.entry.js +10 -3
- package/dist/esm/blip-ds.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/bds-avatar-group.entry.js +1 -1
- package/dist/esm-es5/bds-avatar.entry.js +1 -1
- package/dist/esm-es5/bds-input-editable.entry.js +1 -1
- package/dist/esm-es5/bds-radio.entry.js +1 -1
- package/dist/esm-es5/blip-ds.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/types/components/avatar/avatar.d.ts +4 -0
- package/dist/types/components/avatar-group/avatar-group.d.ts +5 -0
- package/dist/types/components/input-editable/input-editable.d.ts +62 -13
- package/dist/types/components/radio/radio.d.ts +1 -0
- package/dist/types/components.d.ts +40 -0
- package/package.json +1 -1
- package/dist/blip-ds/p-15332863.system.entry.js +0 -1
- package/dist/blip-ds/p-537ae882.entry.js +0 -1
- package/dist/blip-ds/p-54a2db99.entry.js +0 -1
- package/dist/blip-ds/p-62716567.system.entry.js +0 -1
- package/dist/blip-ds/p-6b559ead.system.entry.js +0 -1
- package/dist/blip-ds/p-77364a3c.entry.js +0 -1
- package/dist/blip-ds/p-b21373d5.entry.js +0 -1
- package/dist/blip-ds/p-de710f3f.system.entry.js +0 -1
|
@@ -16,42 +16,31 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* Define media query values
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Font sizes have been converted to rem considering a base size of 16px.
|
|
24
|
-
*/
|
|
19
|
+
.host {
|
|
20
|
+
position: relative;
|
|
21
|
+
}
|
|
22
|
+
|
|
25
23
|
.avatar {
|
|
26
|
-
|
|
27
|
-
font-family: "Nunito Sans", "Tahoma", "Helvetica", "Arial", sans-serif;
|
|
28
|
-
font-style: normal;
|
|
29
|
-
font-weight: normal;
|
|
30
|
-
margin: 0;
|
|
31
|
-
margin-block-start: 0;
|
|
32
|
-
margin-block-end: 0;
|
|
33
|
-
margin-inline-start: 0;
|
|
34
|
-
margin-inline-end: 0;
|
|
35
|
-
padding: 0;
|
|
36
|
-
border: 0;
|
|
37
|
-
border-radius: 72px;
|
|
24
|
+
border-radius: 40px;
|
|
38
25
|
display: flex;
|
|
39
26
|
justify-content: center;
|
|
40
27
|
align-items: center;
|
|
41
28
|
overflow: hidden;
|
|
29
|
+
appearance: none;
|
|
30
|
+
height: 100%;
|
|
42
31
|
}
|
|
43
32
|
.avatar__text {
|
|
44
|
-
color: #
|
|
33
|
+
color: #202c44;
|
|
45
34
|
}
|
|
46
35
|
.avatar__icon {
|
|
47
|
-
color: #
|
|
36
|
+
color: #202c44;
|
|
48
37
|
}
|
|
49
38
|
.avatar__img {
|
|
50
39
|
width: 100%;
|
|
51
40
|
height: auto;
|
|
52
41
|
}
|
|
53
42
|
.avatar__ellipsis {
|
|
54
|
-
color: #
|
|
43
|
+
color: #ffffff;
|
|
55
44
|
}
|
|
56
45
|
.avatar__btn {
|
|
57
46
|
position: relative;
|
|
@@ -66,14 +55,14 @@
|
|
|
66
55
|
height: auto;
|
|
67
56
|
}
|
|
68
57
|
.avatar__btn__text {
|
|
69
|
-
color: #
|
|
58
|
+
color: #202c44;
|
|
70
59
|
opacity: 1;
|
|
71
60
|
-webkit-transition: all 0.5s;
|
|
72
61
|
-moz-transition: all 0.5s;
|
|
73
62
|
transition: all 0.5s;
|
|
74
63
|
}
|
|
75
64
|
.avatar__btn__icon {
|
|
76
|
-
color: #
|
|
65
|
+
color: #202c44;
|
|
77
66
|
opacity: 1;
|
|
78
67
|
-webkit-transition: all 0.5s;
|
|
79
68
|
-moz-transition: all 0.5s;
|
|
@@ -88,15 +77,13 @@
|
|
|
88
77
|
align-items: center;
|
|
89
78
|
top: 0;
|
|
90
79
|
left: 0;
|
|
91
|
-
background-color:
|
|
80
|
+
background-color: #ffffff;
|
|
92
81
|
cursor: pointer;
|
|
93
82
|
opacity: 0;
|
|
94
|
-
-webkit-transition: all 0.5s;
|
|
95
|
-
-moz-transition: all 0.5s;
|
|
96
83
|
transition: all 0.5s;
|
|
97
84
|
}
|
|
98
85
|
.avatar__btn__thumb__icon {
|
|
99
|
-
color: #
|
|
86
|
+
color: #202c44;
|
|
100
87
|
}
|
|
101
88
|
.avatar__btn__name {
|
|
102
89
|
position: absolute;
|
|
@@ -114,7 +101,7 @@
|
|
|
114
101
|
transition: all 0.5s;
|
|
115
102
|
}
|
|
116
103
|
.avatar__btn__name__icon {
|
|
117
|
-
color: #
|
|
104
|
+
color: #202c44;
|
|
118
105
|
}
|
|
119
106
|
.avatar__btn__empty {
|
|
120
107
|
position: absolute;
|
|
@@ -132,7 +119,7 @@
|
|
|
132
119
|
transition: all 0.5s;
|
|
133
120
|
}
|
|
134
121
|
.avatar__btn__empty__icon {
|
|
135
|
-
color: #
|
|
122
|
+
color: #202c44;
|
|
136
123
|
}
|
|
137
124
|
.avatar__size--micro {
|
|
138
125
|
width: 24px;
|
|
@@ -141,43 +128,48 @@
|
|
|
141
128
|
.avatar__size--extra-small {
|
|
142
129
|
width: 32px;
|
|
143
130
|
height: 32px;
|
|
131
|
+
min-width: 32px;
|
|
144
132
|
}
|
|
145
133
|
.avatar__size--small {
|
|
146
134
|
width: 40px;
|
|
147
135
|
height: 40px;
|
|
136
|
+
min-width: 40px;
|
|
148
137
|
}
|
|
149
138
|
.avatar__size--standard {
|
|
150
139
|
width: 56px;
|
|
151
140
|
height: 56px;
|
|
141
|
+
min-width: 56px;
|
|
152
142
|
}
|
|
153
143
|
.avatar__size--large {
|
|
154
144
|
width: 64px;
|
|
155
145
|
height: 64px;
|
|
146
|
+
min-width: 64px;
|
|
156
147
|
}
|
|
157
148
|
.avatar__size--extra-large {
|
|
158
149
|
width: 72px;
|
|
159
150
|
height: 72px;
|
|
151
|
+
min-width: 72px;
|
|
160
152
|
}
|
|
161
153
|
.avatar__color--neutral {
|
|
162
|
-
background-color: #
|
|
154
|
+
background-color: #e7edf4;
|
|
163
155
|
}
|
|
164
|
-
.avatar__color--
|
|
165
|
-
background-color: #
|
|
156
|
+
.avatar__color--yellow {
|
|
157
|
+
background-color: #fff6a8;
|
|
166
158
|
}
|
|
167
|
-
.avatar__color--
|
|
168
|
-
background-color: #
|
|
159
|
+
.avatar__color--blue {
|
|
160
|
+
background-color: #80e3eb;
|
|
169
161
|
}
|
|
170
162
|
.avatar__color--green {
|
|
171
|
-
background-color: #
|
|
163
|
+
background-color: #90e6bc;
|
|
172
164
|
}
|
|
173
165
|
.avatar__color--brown {
|
|
174
|
-
background-color: #
|
|
166
|
+
background-color: #ffd29e;
|
|
175
167
|
}
|
|
176
168
|
.avatar__color--pink {
|
|
177
|
-
background-color: #
|
|
169
|
+
background-color: #fdacc5;
|
|
178
170
|
}
|
|
179
171
|
.avatar:hover .avatar__btn__thumb {
|
|
180
|
-
opacity:
|
|
172
|
+
opacity: 0.65;
|
|
181
173
|
}
|
|
182
174
|
.avatar:hover .avatar__btn__text {
|
|
183
175
|
opacity: 0;
|
|
@@ -190,4 +182,18 @@
|
|
|
190
182
|
}
|
|
191
183
|
.avatar:hover .avatar__btn__empty {
|
|
192
184
|
opacity: 1;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.focus:focus-visible {
|
|
188
|
+
display: flex;
|
|
189
|
+
position: absolute;
|
|
190
|
+
border: 2px solid #c226fb;
|
|
191
|
+
border-radius: 4px;
|
|
192
|
+
width: 100%;
|
|
193
|
+
height: 100%;
|
|
194
|
+
top: -4px;
|
|
195
|
+
left: -4px;
|
|
196
|
+
padding-right: 4px;
|
|
197
|
+
padding-bottom: 4px;
|
|
198
|
+
outline: none;
|
|
193
199
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, h, Prop } from '@stencil/core';
|
|
1
|
+
import { Component, h, Prop, Event, Host } from '@stencil/core';
|
|
2
2
|
export class BdsAvatar {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.typoSize = 'fs-20';
|
|
@@ -40,7 +40,7 @@ export class BdsAvatar {
|
|
|
40
40
|
break;
|
|
41
41
|
case 'small':
|
|
42
42
|
this.typoSize = 'fs-16';
|
|
43
|
-
this.iconSize = 'small';
|
|
43
|
+
this.iconSize = 'x-small';
|
|
44
44
|
break;
|
|
45
45
|
case 'standard':
|
|
46
46
|
this.typoSize = 'fs-20';
|
|
@@ -48,11 +48,11 @@ export class BdsAvatar {
|
|
|
48
48
|
break;
|
|
49
49
|
case 'large':
|
|
50
50
|
this.typoSize = 'fs-24';
|
|
51
|
-
this.iconSize = 'large';
|
|
51
|
+
this.iconSize = 'xxx-large';
|
|
52
52
|
break;
|
|
53
53
|
case 'extra-large':
|
|
54
54
|
this.typoSize = 'fs-32';
|
|
55
|
-
this.iconSize = '
|
|
55
|
+
this.iconSize = 'xxx-large';
|
|
56
56
|
break;
|
|
57
57
|
default:
|
|
58
58
|
this.typoSize = 'fs-20';
|
|
@@ -60,30 +60,40 @@ export class BdsAvatar {
|
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
+
onUploadClick(e) {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
this.bdsClickAvatar.emit(e);
|
|
66
|
+
}
|
|
67
|
+
handleClickKey(event) {
|
|
68
|
+
if ((event.key === 'Enter' || event.key === ' ') && this.upload) {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
this.bdsClickAvatar.emit();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
63
73
|
render() {
|
|
64
|
-
const avatarColor = ['
|
|
74
|
+
const avatarColor = ['yellow', 'blue', 'green', 'brown', 'pink'];
|
|
65
75
|
const randColor = avatarColor[Math.floor(Math.random() * avatarColor.length)];
|
|
66
76
|
const avatarBgColor = !this.name || this.ellipsis ? 'neutral' : randColor;
|
|
67
77
|
const arrayName = this.name ? this.name.split(' ') : [];
|
|
68
78
|
const firstName = arrayName.length ? arrayName.shift().charAt(0) : '';
|
|
69
79
|
const lastName = arrayName.length ? arrayName.pop().charAt(0) : '';
|
|
70
|
-
const Element = this.upload ? 'button' : 'div';
|
|
71
80
|
this.selectTypoSize(this.size);
|
|
72
|
-
return (h(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
return (h(Host, { class: { host: true, [`avatar__size--${this.size}`]: true } },
|
|
82
|
+
h("div", { class: {
|
|
83
|
+
avatar: true,
|
|
84
|
+
[`avatar__color--${avatarBgColor}`]: true,
|
|
85
|
+
upload: this.upload,
|
|
86
|
+
}, "data-test": this.dataTest }, this.ellipsis ? (h("bds-typo", { margin: false, class: "avatar__ellipsis", variant: this.typoSize, tag: "span" }, `+${this.ellipsis}`)) : this.thumbnail ? (this.upload && this.size !== 'micro' ? (h("div", { class: "avatar__btn", onClick: () => this.onUploadClick },
|
|
87
|
+
h("img", { class: "avatar__btn__img", src: this.thumbnail }),
|
|
88
|
+
h("div", { class: "avatar__btn__thumb" },
|
|
89
|
+
h("bds-icon", { class: "avatar__btn__thumb__icon", name: "upload", theme: "outline", size: this.iconSize })))) : (h("img", { class: "avatar__img", src: this.thumbnail }))) : this.name ? (this.upload && this.size !== 'micro' ? (h("div", { class: "avatar__btn", onClick: () => this.onUploadClick },
|
|
90
|
+
h("bds-typo", { margin: false, class: "avatar__btn__text", variant: this.typoSize, tag: "span" }, firstName + lastName),
|
|
91
|
+
h("div", { class: "avatar__btn__name" },
|
|
92
|
+
h("bds-icon", { class: "avatar__btn__name__icon", name: "upload", theme: "outline", size: this.iconSize })))) : (h("bds-typo", { margin: false, class: "avatar__text", variant: this.typoSize, tag: "span" }, firstName + lastName))) : this.upload && this.size !== 'micro' ? (h("div", { class: "avatar__btn", onClick: () => this.onUploadClick },
|
|
93
|
+
h("bds-icon", { class: "avatar__btn__icon", name: "user-default", theme: "outline", size: this.iconSize }),
|
|
94
|
+
h("div", { class: "avatar__btn__empty" },
|
|
95
|
+
h("bds-icon", { class: "avatar__btn__empty__icon", name: "upload", theme: "outline", size: this.iconSize })))) : (h("bds-icon", { class: "avatar__icon", name: "user-default", theme: "outline", size: this.iconSize }))),
|
|
96
|
+
this.upload && this.size !== 'micro' ? (h("div", { tabindex: "0", onClick: () => this.handleClickKey, class: "focus" })) : ('')));
|
|
87
97
|
}
|
|
88
98
|
static get is() { return "bds-avatar"; }
|
|
89
99
|
static get originalStyleUrls() { return {
|
|
@@ -206,4 +216,20 @@ export class BdsAvatar {
|
|
|
206
216
|
"defaultValue": "null"
|
|
207
217
|
}
|
|
208
218
|
}; }
|
|
219
|
+
static get events() { return [{
|
|
220
|
+
"method": "bdsClickAvatar",
|
|
221
|
+
"name": "bdsClickAvatar",
|
|
222
|
+
"bubbles": true,
|
|
223
|
+
"cancelable": true,
|
|
224
|
+
"composed": true,
|
|
225
|
+
"docs": {
|
|
226
|
+
"tags": [],
|
|
227
|
+
"text": ""
|
|
228
|
+
},
|
|
229
|
+
"complexType": {
|
|
230
|
+
"original": "any",
|
|
231
|
+
"resolved": "any",
|
|
232
|
+
"references": {}
|
|
233
|
+
}
|
|
234
|
+
}]; }
|
|
209
235
|
}
|
|
@@ -16,37 +16,56 @@
|
|
|
16
16
|
/**
|
|
17
17
|
* Define media query values
|
|
18
18
|
*/
|
|
19
|
+
.host {
|
|
20
|
+
position: relative;
|
|
21
|
+
height: fit-content;
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
.avatar__group {
|
|
20
25
|
display: flex;
|
|
21
26
|
}
|
|
22
27
|
.avatar__group > *:nth-child(1) {
|
|
23
|
-
z-index:
|
|
28
|
+
z-index: 1;
|
|
24
29
|
}
|
|
25
30
|
.avatar__group > *:nth-child(2) {
|
|
26
|
-
z-index:
|
|
31
|
+
z-index: 2;
|
|
27
32
|
}
|
|
28
33
|
.avatar__group > *:nth-child(3) {
|
|
29
34
|
z-index: 3;
|
|
30
35
|
}
|
|
31
36
|
.avatar__group > *:nth-child(4) {
|
|
32
|
-
z-index:
|
|
37
|
+
z-index: 4;
|
|
33
38
|
}
|
|
34
39
|
.avatar__group > *:nth-child(5) {
|
|
35
|
-
z-index:
|
|
40
|
+
z-index: 5;
|
|
41
|
+
}
|
|
42
|
+
.avatar__group > *:nth-child(6) {
|
|
43
|
+
z-index: 6;
|
|
44
|
+
width: auto;
|
|
45
|
+
}
|
|
46
|
+
.avatar__group > *:nth-child(6) div {
|
|
47
|
+
background-color: #1a2437;
|
|
48
|
+
padding: 0 16px;
|
|
49
|
+
width: auto;
|
|
50
|
+
}
|
|
51
|
+
.avatar__group__click--true {
|
|
52
|
+
cursor: pointer;
|
|
36
53
|
}
|
|
37
54
|
.avatar__group .avatar {
|
|
38
|
-
border: 2px solid #ffffff;
|
|
39
55
|
position: relative;
|
|
40
56
|
}
|
|
41
57
|
.avatar__group__size--extra-small {
|
|
42
|
-
margin-left:
|
|
58
|
+
margin-left: 8px;
|
|
43
59
|
}
|
|
44
60
|
.avatar__group__size--extra-small > * {
|
|
45
|
-
margin-left: -
|
|
61
|
+
margin-left: -8px;
|
|
62
|
+
}
|
|
63
|
+
.avatar__group__size--extra-small > *:nth-child(6) div {
|
|
64
|
+
padding: 0 8px;
|
|
46
65
|
}
|
|
47
66
|
.avatar__group__size--extra-small .avatar {
|
|
48
|
-
width: 32px;
|
|
49
67
|
height: 32px;
|
|
68
|
+
padding: 0 8px;
|
|
50
69
|
}
|
|
51
70
|
.avatar__group__size--small {
|
|
52
71
|
margin-left: 8px;
|
|
@@ -55,16 +74,50 @@
|
|
|
55
74
|
margin-left: -8px;
|
|
56
75
|
}
|
|
57
76
|
.avatar__group__size--small .avatar {
|
|
58
|
-
width: 40px;
|
|
59
77
|
height: 40px;
|
|
78
|
+
padding: 0 8px;
|
|
60
79
|
}
|
|
61
80
|
.avatar__group__size--standard {
|
|
62
|
-
margin-left:
|
|
81
|
+
margin-left: 16px;
|
|
63
82
|
}
|
|
64
83
|
.avatar__group__size--standard > * {
|
|
65
|
-
margin-left: -
|
|
84
|
+
margin-left: -16px;
|
|
66
85
|
}
|
|
67
86
|
.avatar__group__size--standard .avatar {
|
|
68
|
-
width: 56px;
|
|
69
87
|
height: 56px;
|
|
88
|
+
padding: 0 8px;
|
|
89
|
+
}
|
|
90
|
+
.avatar__group__size--large {
|
|
91
|
+
margin-left: 16px;
|
|
92
|
+
}
|
|
93
|
+
.avatar__group__size--large > * {
|
|
94
|
+
margin-left: -16px;
|
|
95
|
+
}
|
|
96
|
+
.avatar__group__size--large .avatar {
|
|
97
|
+
height: 64px;
|
|
98
|
+
padding: 0 8px;
|
|
99
|
+
}
|
|
100
|
+
.avatar__group__size--extra-large {
|
|
101
|
+
margin-left: 16px;
|
|
102
|
+
}
|
|
103
|
+
.avatar__group__size--extra-large > * {
|
|
104
|
+
margin-left: -16px;
|
|
105
|
+
}
|
|
106
|
+
.avatar__group__size--extra-large .avatar {
|
|
107
|
+
height: 72px;
|
|
108
|
+
padding: 0 8px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.focus:focus-visible {
|
|
112
|
+
display: flex;
|
|
113
|
+
position: absolute;
|
|
114
|
+
border: 2px solid #c226fb;
|
|
115
|
+
border-radius: 4px;
|
|
116
|
+
width: 100%;
|
|
117
|
+
height: 100%;
|
|
118
|
+
top: -4px;
|
|
119
|
+
left: -4px;
|
|
120
|
+
padding-right: 4px;
|
|
121
|
+
padding-bottom: 4px;
|
|
122
|
+
outline: none;
|
|
70
123
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, h, Host, State, Prop } from '@stencil/core';
|
|
1
|
+
import { Component, h, Host, State, Prop, Event } from '@stencil/core';
|
|
2
2
|
export class AvatarGroup {
|
|
3
3
|
constructor() {
|
|
4
4
|
/**
|
|
@@ -7,6 +7,16 @@ export class AvatarGroup {
|
|
|
7
7
|
*/
|
|
8
8
|
this.size = 'standard';
|
|
9
9
|
}
|
|
10
|
+
handleClickGroup(e) {
|
|
11
|
+
e.preventDefault();
|
|
12
|
+
this.bdsClickAvatarGroup.emit(e);
|
|
13
|
+
}
|
|
14
|
+
handleClickKey(event) {
|
|
15
|
+
if ((event.key === 'Enter' || event.key === ' ') && this.canClick) {
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
this.bdsClickAvatarGroup.emit();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
10
20
|
parseUsers() {
|
|
11
21
|
if (this.users) {
|
|
12
22
|
try {
|
|
@@ -19,16 +29,18 @@ export class AvatarGroup {
|
|
|
19
29
|
}
|
|
20
30
|
componentWillLoad() {
|
|
21
31
|
this.users && this.parseUsers();
|
|
22
|
-
this.leftoversUsers = this.internalUsers.length -
|
|
32
|
+
this.leftoversUsers = this.internalUsers.length - 5;
|
|
23
33
|
}
|
|
24
34
|
render() {
|
|
25
|
-
return (h(Host,
|
|
35
|
+
return (h(Host, { class: "host" },
|
|
26
36
|
h("div", { class: {
|
|
27
37
|
avatar__group: true,
|
|
28
38
|
[`avatar__group__size--${this.size}`]: true,
|
|
29
|
-
|
|
30
|
-
.
|
|
31
|
-
.
|
|
39
|
+
[`avatar__group__click--${this.canClick}`]: true,
|
|
40
|
+
}, onClick: () => this.handleClickGroup }, this.internalUsers ? (this.internalUsers
|
|
41
|
+
.slice(0, 6)
|
|
42
|
+
.map((user, i, row) => i + 1 === row.length && this.internalUsers.length > 5 ? (h("bds-avatar", { size: this.size, ellipsis: this.leftoversUsers })) : (h("bds-avatar", { id: user.id, name: user.name, thumbnail: user.thumbnail, size: this.size })))) : (h("slot", null))),
|
|
43
|
+
this.canClick ? h("div", { class: "focus", tabindex: "0", onClick: () => this.handleClickKey }) : ''));
|
|
32
44
|
}
|
|
33
45
|
static get is() { return "bds-avatar-group"; }
|
|
34
46
|
static get originalStyleUrls() { return {
|
|
@@ -81,10 +93,43 @@ export class AvatarGroup {
|
|
|
81
93
|
},
|
|
82
94
|
"attribute": "users",
|
|
83
95
|
"reflect": false
|
|
96
|
+
},
|
|
97
|
+
"canClick": {
|
|
98
|
+
"type": "boolean",
|
|
99
|
+
"mutable": false,
|
|
100
|
+
"complexType": {
|
|
101
|
+
"original": "boolean",
|
|
102
|
+
"resolved": "boolean",
|
|
103
|
+
"references": {}
|
|
104
|
+
},
|
|
105
|
+
"required": false,
|
|
106
|
+
"optional": true,
|
|
107
|
+
"docs": {
|
|
108
|
+
"tags": [],
|
|
109
|
+
"text": ""
|
|
110
|
+
},
|
|
111
|
+
"attribute": "can-click",
|
|
112
|
+
"reflect": false
|
|
84
113
|
}
|
|
85
114
|
}; }
|
|
86
115
|
static get states() { return {
|
|
87
116
|
"internalUsers": {},
|
|
88
117
|
"leftoversUsers": {}
|
|
89
118
|
}; }
|
|
119
|
+
static get events() { return [{
|
|
120
|
+
"method": "bdsClickAvatarGroup",
|
|
121
|
+
"name": "bdsClickAvatarGroup",
|
|
122
|
+
"bubbles": true,
|
|
123
|
+
"cancelable": true,
|
|
124
|
+
"composed": true,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": ""
|
|
128
|
+
},
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "any",
|
|
131
|
+
"resolved": "any",
|
|
132
|
+
"references": {}
|
|
133
|
+
}
|
|
134
|
+
}]; }
|
|
90
135
|
}
|