@momentum-design/components 0.12.3 → 0.12.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,28 +1,229 @@
1
1
  import { CSSResult } from 'lit';
2
+ import type { PropertyValues, TemplateResult } from 'lit';
2
3
  import { Component } from '../../models';
3
- import { AvatarType } from './avatar.types';
4
+ import type { IconNames } from '../icon/icon.types';
5
+ import type { PresenceType } from '../presence/presence.types';
6
+ import type { AvatarSize } from './avatar.types';
4
7
  /**
5
- * @slot - This is a default/unnamed slot
8
+ * The `mdc-avatar` component is used to represent a person or a space.
9
+ * An avatar can be an icon, initials, counter and photo.
6
10
  *
7
- * @summary This is MyElement
11
+ * To set the photo of an avatar,
12
+ * you need to set "src" attribute.
13
+ *
14
+ * While the avatar image is loading, as a placeholder,
15
+ * we will show the initials text.
16
+ * If the initials are not specified then,
17
+ * we will show `user-regular` icon as a placeholder.
18
+ *
19
+ * By default, if there are no attributes specified,
20
+ * then the default avatar will be an icon with `user-regular` name.
21
+ *
22
+ * The avatar component is non clickable and non interactive/focusable component.
23
+ * If the avatar is typing, then the loading indicator will be displayed.
24
+ *
25
+ * @dependency mdc-icon
26
+ * @dependency mdc-presence
27
+ * @dependency mdc-text
8
28
  *
9
29
  * @tagname mdc-avatar
30
+ *
31
+ * @cssproperty --mdc-avatar-default-background-color - Allows customization of the default background color.
32
+ * @cssproperty --mdc-avatar-default-foreground-color - Allows customization of the default foreground color.
33
+ * @cssproperty --mdc-avatar-loading-indicator-background-color -
34
+ * Allows customization of the loading indicator background color.
35
+ * @cssproperty --mdc-avatar-loading-indicator-foreground-color -
36
+ * Allows customization of the loading indicator foreground color.
37
+ * @cssproperty --mdc-avatar-loading-overlay-background-color -
38
+ * Allows customization of the loading overlay background color.
10
39
  */
11
40
  declare class Avatar extends Component {
12
- type?: AvatarType;
13
- alt?: string;
41
+ /**
42
+ * The src is the url which will be used to display the avatar.
43
+ * When the src is loading, we will display the initials as a placeholder.
44
+ */
14
45
  src?: string;
15
46
  /**
16
- * Scale of the avatar
47
+ * The initials to be displayed for the avatar.
48
+ */
49
+ initials?: string;
50
+ /**
51
+ * The presence is the status which can be used to display the
52
+ * activity state of a user or a space within an avatar component.
53
+ *
54
+ * Acceptable values include:
55
+ * - `active`
56
+ * - `away`
57
+ * - `away-calling`
58
+ * - `busy`
59
+ * - `dnd`
60
+ * - `meeting`
61
+ * - `on-call`
62
+ * - `on-device`
63
+ * - `on-mobile`
64
+ * - `pause`
65
+ * - `pto`
66
+ * - `presenting`
67
+ * - `quiet`
68
+ * - `scheduled`
69
+ */
70
+ presence?: PresenceType;
71
+ /**
72
+ * Acceptable values include:
73
+ * - xx_small
74
+ * - x_small
75
+ * - small
76
+ * - midsize
77
+ * - large
78
+ * - x_large
79
+ * - xx_large
80
+ *
81
+ * @default x_small
82
+ */
83
+ size: AvatarSize;
84
+ /**
85
+ * Name of the icon to be displayed inside the Avatar.
86
+ * Must be a valid icon name.
87
+ */
88
+ iconName?: IconNames;
89
+ /**
90
+ * The counter is the number which can be displayed on the avatar.
91
+ * The maximum number is 99 and if the give number is greater than 99,
92
+ * then the avatar will be displayed as `99+`.
93
+ * If the given number is a negative number,
94
+ * then the avatar will be displayed as `0`.
95
+ */
96
+ counter?: number;
97
+ /**
98
+ * Represents the typing indicator when the user is typing.
99
+ * @default false
100
+ */
101
+ isTyping: boolean;
102
+ /**
103
+ * @internal
104
+ */
105
+ private isPhotoLoaded;
106
+ /**
107
+ * @internal
108
+ * The avatar presence will be hidden if the avatar type is COUNTER.
109
+ * If the presence is set, it will be rendered as a child of the avatar.
110
+ *
111
+ * @param type - The type of the avatar.
112
+ * @returns The presence template or an empty template.
113
+ */
114
+ private getPresenceTemplateBasedOnType;
115
+ /**
116
+ * @internal
117
+ * Sets `isPhotoLoaded` to `true` when the avatar photo is loaded.
118
+ * This is used to hide the avatar photo initially and show it only when it is loaded.
119
+ */
120
+ private handleOnLoad;
121
+ /**
122
+ * @internal
123
+ * Handles errors that occur during the image loading process.
124
+ * Sets `isPhotoLoaded` to `false` to indicate the failure and throws an error message.
125
+ * The error message suggests checking the `src` attribute.
126
+ */
127
+ private handleOnError;
128
+ /**
129
+ * @internal
130
+ * Generates the photo template for the avatar component.
131
+ * Utilizes the `src` attribute to display an image.
132
+ * The photo remains hidden until it is fully loaded;
133
+ * upon successful loading, the `handleOnLoad` method sets `isPhotoLoaded` to true.
134
+ * In the event of a loading error, the `handleOnError` method sets `isPhotoLoaded` to false and raises an error.
135
+ *
136
+ * @returns The template result containing the avatar photo.
137
+ */
138
+ private photoTemplate;
139
+ /**
140
+ * @internal
141
+ * Generates the icon template for the photo avatar component.
142
+ * Utilizes the `mdc-icon` component to display an icon.
143
+ * If the `iconName` property is not provided, it defaults to the `DEFAULTS.ICON_NAME`.
144
+ *
145
+ * @returns The template result containing the avatar icon.
146
+ */
147
+ private iconTemplate;
148
+ /**
149
+ * @internal
150
+ * Generates the text template for the initials/counter avatar component.
151
+ * Utilizes the `mdc-text` component to display text.
152
+ *
153
+ * @param content - the text content to be displayed
154
+ * @returns The template result containing the avatar text.
155
+ */
156
+ private textTemplate;
157
+ /**
158
+ * @internal
159
+ * Generates the text content for counter avatar by converting the given number to a string.
160
+ * If the counter exceeds the maximum limit of 99, it will return the maximum limit as a string
161
+ * followed by a '+' character.
162
+ *
163
+ * @param counter - the number to be converted to a string
164
+ * @returns the counter text
165
+ */
166
+ private generateCounterText;
167
+ /**
168
+ * @internal
169
+ * Converts the given initials to uppercase and takes the first two characters.
170
+ * This is used to generate the text content for the initials avatar.
171
+ *
172
+ * @param initials - the string containing the initials
173
+ * @returns the first two uppercase characters of the given initials
174
+ */
175
+ private generateInitialsText;
176
+ /**
177
+ * @internal
178
+ * Generates the text content based on the given type.
179
+ * If the type is TEXT, it will use the initials property and generate the first two uppercase characters.
180
+ * If the type is COUNTER, it uses the value of counter property and
181
+ * generate the string representation of the counter.
182
+ * The generated content is then passed to the `textTemplate` method to generate the final template.
183
+ *
184
+ * @param type - the type of the avatar
185
+ * @returns the template result containing the avatar text
186
+ */
187
+ private generateTextContent;
188
+ /**
189
+ * @internal
190
+ * Returns the type of the avatar component based on the user-provided inputs.
191
+ *
192
+ * @returns the type of the avatar component
193
+ */
194
+ private getTypeBasedOnInputs;
195
+ /**
196
+ * @internal
197
+ * Returns the template result based on the type of the avatar component.
198
+ * The type is determined by `getTypeBasedOnInputs` based on user's input.
199
+ * Based on the generated type, template result is generated.
200
+ *
201
+ * @param type - the type of the avatar component
202
+ * @returns the template result containing the avatar content
203
+ */
204
+ private getTemplateBasedOnType;
205
+ /**
206
+ * @internal
207
+ * Represents the loading indicator for the avatar when typing.
208
+ * If the avatar is in typing state, this method returns a loading indicator
209
+ * comprising three small filled dots, scaled based on the avatar size.
210
+ *
211
+ * @returns The template result containing the loading indicator, or an empty template if not typing.
17
212
  */
18
- size?: number;
213
+ private getLoadingContent;
19
214
  /**
20
- * Updates the size by setting the width and height
215
+ * @internal
216
+ * Generates the photo placeholder content for the avatar component.
217
+ * If the photo is not yet loaded, and the avatar type is PHOTO with initials provided,
218
+ * it generates and returns the initials as a placeholder text.
219
+ * If the photo is already loaded, it returns an empty template.
220
+ *
221
+ * @param type - The type of the avatar.
222
+ * @returns The template result containing the placeholder content or an empty template.
21
223
  */
22
- private updateSize;
23
- updated(changedProperties: Map<string, any>): void;
24
- photoTemplate(): import("lit-html").TemplateResult<1>;
25
- render(): import("lit-html").TemplateResult<1>;
224
+ private getPhotoPlaceHolderContent;
225
+ update(changedProperties: PropertyValues): void;
226
+ render(): TemplateResult;
26
227
  static styles: Array<CSSResult>;
27
228
  }
28
229
  export default Avatar;
@@ -7,78 +7,350 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
- import { html } from 'lit';
11
- import { property } from 'lit/decorators.js';
10
+ import { html, nothing } from 'lit';
11
+ import { property, state } from 'lit/decorators.js';
12
12
  import { ifDefined } from 'lit/directives/if-defined.js';
13
- import styles from './avatar.styles';
14
13
  import { Component } from '../../models';
15
- import { DEFAULTS, LENGTH_UNIT } from './avatar.constants';
14
+ import { AVATAR_TYPE, DEFAULTS, MAX_COUNTER } from './avatar.constants';
15
+ import styles from './avatar.styles';
16
+ import { getAvatarIconSize, getAvatarTextFontSize } from './avatar.utils';
16
17
  /**
17
- * @slot - This is a default/unnamed slot
18
+ * The `mdc-avatar` component is used to represent a person or a space.
19
+ * An avatar can be an icon, initials, counter and photo.
20
+ *
21
+ * To set the photo of an avatar,
22
+ * you need to set "src" attribute.
23
+ *
24
+ * While the avatar image is loading, as a placeholder,
25
+ * we will show the initials text.
26
+ * If the initials are not specified then,
27
+ * we will show `user-regular` icon as a placeholder.
28
+ *
29
+ * By default, if there are no attributes specified,
30
+ * then the default avatar will be an icon with `user-regular` name.
18
31
  *
19
- * @summary This is MyElement
32
+ * The avatar component is non clickable and non interactive/focusable component.
33
+ * If the avatar is typing, then the loading indicator will be displayed.
34
+ *
35
+ * @dependency mdc-icon
36
+ * @dependency mdc-presence
37
+ * @dependency mdc-text
20
38
  *
21
39
  * @tagname mdc-avatar
40
+ *
41
+ * @cssproperty --mdc-avatar-default-background-color - Allows customization of the default background color.
42
+ * @cssproperty --mdc-avatar-default-foreground-color - Allows customization of the default foreground color.
43
+ * @cssproperty --mdc-avatar-loading-indicator-background-color -
44
+ * Allows customization of the loading indicator background color.
45
+ * @cssproperty --mdc-avatar-loading-indicator-foreground-color -
46
+ * Allows customization of the loading indicator foreground color.
47
+ * @cssproperty --mdc-avatar-loading-overlay-background-color -
48
+ * Allows customization of the loading overlay background color.
22
49
  */
23
50
  class Avatar extends Component {
24
51
  constructor() {
25
52
  super(...arguments);
26
- this.type = DEFAULTS.TYPE;
27
53
  /**
28
- * Scale of the avatar
54
+ * Acceptable values include:
55
+ * - xx_small
56
+ * - x_small
57
+ * - small
58
+ * - midsize
59
+ * - large
60
+ * - x_large
61
+ * - xx_large
62
+ *
63
+ * @default x_small
29
64
  */
30
65
  this.size = DEFAULTS.SIZE;
66
+ /**
67
+ * Represents the typing indicator when the user is typing.
68
+ * @default false
69
+ */
70
+ this.isTyping = false;
71
+ /**
72
+ * @internal
73
+ */
74
+ this.isPhotoLoaded = false;
31
75
  }
32
76
  /**
33
- * Updates the size by setting the width and height
77
+ * @internal
78
+ * The avatar presence will be hidden if the avatar type is COUNTER.
79
+ * If the presence is set, it will be rendered as a child of the avatar.
80
+ *
81
+ * @param type - The type of the avatar.
82
+ * @returns The presence template or an empty template.
34
83
  */
35
- updateSize() {
36
- if (this.size) {
37
- const value = `${this.size}${LENGTH_UNIT}`;
38
- this.style.width = value;
39
- this.style.height = value;
84
+ getPresenceTemplateBasedOnType(type) {
85
+ // avatar type of counter should not have presence
86
+ if (type === AVATAR_TYPE.COUNTER && (this.counter || this.counter === 0)) {
87
+ return nothing;
88
+ }
89
+ if (this.presence) {
90
+ return html `
91
+ <mdc-presence class="presence" type="${this.presence}" size="${this.size}"></mdc-presence>
92
+ `;
40
93
  }
94
+ return nothing;
95
+ }
96
+ /**
97
+ * @internal
98
+ * Sets `isPhotoLoaded` to `true` when the avatar photo is loaded.
99
+ * This is used to hide the avatar photo initially and show it only when it is loaded.
100
+ */
101
+ handleOnLoad() {
102
+ this.isPhotoLoaded = true;
41
103
  }
42
- updated(changedProperties) {
43
- super.updated(changedProperties);
44
- if (changedProperties.has('size')) {
45
- this.updateSize();
104
+ /**
105
+ * @internal
106
+ * Handles errors that occur during the image loading process.
107
+ * Sets `isPhotoLoaded` to `false` to indicate the failure and throws an error message.
108
+ * The error message suggests checking the `src` attribute.
109
+ */
110
+ handleOnError() {
111
+ this.isPhotoLoaded = false;
112
+ if (this.onerror) {
113
+ this.onerror('There was a problem while fetching the <img/>. Please check the src attribute and try again.');
46
114
  }
47
115
  }
116
+ /**
117
+ * @internal
118
+ * Generates the photo template for the avatar component.
119
+ * Utilizes the `src` attribute to display an image.
120
+ * The photo remains hidden until it is fully loaded;
121
+ * upon successful loading, the `handleOnLoad` method sets `isPhotoLoaded` to true.
122
+ * In the event of a loading error, the `handleOnError` method sets `isPhotoLoaded` to false and raises an error.
123
+ *
124
+ * @returns The template result containing the avatar photo.
125
+ */
48
126
  photoTemplate() {
49
127
  return html `
50
128
  <img
129
+ class="photo"
51
130
  src="${ifDefined(this.src)}"
52
- alt="${ifDefined(this.alt)}"
131
+ aria-hidden="true"
132
+ ?hidden="${!this.isPhotoLoaded}"
133
+ @load="${this.handleOnLoad}"
134
+ @error="${this.handleOnError}"
53
135
  />
54
136
  `;
55
137
  }
56
- render() {
57
- let content;
58
- if (this.type === 'photo') {
59
- content = this.photoTemplate();
138
+ /**
139
+ * @internal
140
+ * Generates the icon template for the photo avatar component.
141
+ * Utilizes the `mdc-icon` component to display an icon.
142
+ * If the `iconName` property is not provided, it defaults to the `DEFAULTS.ICON_NAME`.
143
+ *
144
+ * @returns The template result containing the avatar icon.
145
+ */
146
+ iconTemplate() {
147
+ const name = this.iconName || DEFAULTS.ICON_NAME;
148
+ return html `
149
+ <mdc-icon
150
+ name="${ifDefined(name)}"
151
+ length-unit="rem"
152
+ size="${getAvatarIconSize(this.size)}"
153
+ ></mdc-icon>
154
+ `;
155
+ }
156
+ /**
157
+ * @internal
158
+ * Generates the text template for the initials/counter avatar component.
159
+ * Utilizes the `mdc-text` component to display text.
160
+ *
161
+ * @param content - the text content to be displayed
162
+ * @returns The template result containing the avatar text.
163
+ */
164
+ textTemplate(content) {
165
+ return html `
166
+ <mdc-text
167
+ type="${getAvatarTextFontSize(this.size)}"
168
+ tagname="span"
169
+ >
170
+ ${content}
171
+ </mdc-text>
172
+ `;
173
+ }
174
+ /**
175
+ * @internal
176
+ * Generates the text content for counter avatar by converting the given number to a string.
177
+ * If the counter exceeds the maximum limit of 99, it will return the maximum limit as a string
178
+ * followed by a '+' character.
179
+ *
180
+ * @param counter - the number to be converted to a string
181
+ * @returns the counter text
182
+ */
183
+ generateCounterText(counter) {
184
+ // If the consumer provides a negative number, we set it to 0.
185
+ if (counter < 0) {
186
+ return '0';
187
+ }
188
+ if (counter > MAX_COUNTER) {
189
+ return `${MAX_COUNTER}+`;
190
+ }
191
+ return counter.toString();
192
+ }
193
+ /**
194
+ * @internal
195
+ * Converts the given initials to uppercase and takes the first two characters.
196
+ * This is used to generate the text content for the initials avatar.
197
+ *
198
+ * @param initials - the string containing the initials
199
+ * @returns the first two uppercase characters of the given initials
200
+ */
201
+ generateInitialsText(initials) {
202
+ return initials.toUpperCase().slice(0, 2);
203
+ }
204
+ /**
205
+ * @internal
206
+ * Generates the text content based on the given type.
207
+ * If the type is TEXT, it will use the initials property and generate the first two uppercase characters.
208
+ * If the type is COUNTER, it uses the value of counter property and
209
+ * generate the string representation of the counter.
210
+ * The generated content is then passed to the `textTemplate` method to generate the final template.
211
+ *
212
+ * @param type - the type of the avatar
213
+ * @returns the template result containing the avatar text
214
+ */
215
+ generateTextContent(type) {
216
+ let content = '';
217
+ if (type === AVATAR_TYPE.TEXT && this.initials) {
218
+ content = this.generateInitialsText(this.initials);
60
219
  }
61
- else {
62
- content = html ``;
220
+ if (type === AVATAR_TYPE.COUNTER && (this.counter || this.counter === 0)) {
221
+ content = this.generateCounterText(this.counter);
63
222
  }
64
- return html `${content}`;
223
+ return this.textTemplate(content);
224
+ }
225
+ /**
226
+ * @internal
227
+ * Returns the type of the avatar component based on the user-provided inputs.
228
+ *
229
+ * @returns the type of the avatar component
230
+ */
231
+ getTypeBasedOnInputs() {
232
+ if (this.src) {
233
+ return AVATAR_TYPE.PHOTO;
234
+ }
235
+ if (this.iconName) {
236
+ return AVATAR_TYPE.ICON;
237
+ }
238
+ if (this.initials) {
239
+ return AVATAR_TYPE.TEXT;
240
+ }
241
+ if (this.counter || this.counter === 0) {
242
+ return AVATAR_TYPE.COUNTER;
243
+ }
244
+ return AVATAR_TYPE.ICON;
245
+ }
246
+ /**
247
+ * @internal
248
+ * Returns the template result based on the type of the avatar component.
249
+ * The type is determined by `getTypeBasedOnInputs` based on user's input.
250
+ * Based on the generated type, template result is generated.
251
+ *
252
+ * @param type - the type of the avatar component
253
+ * @returns the template result containing the avatar content
254
+ */
255
+ getTemplateBasedOnType(type) {
256
+ switch (type) {
257
+ case AVATAR_TYPE.PHOTO:
258
+ return this.photoTemplate();
259
+ case AVATAR_TYPE.TEXT:
260
+ case AVATAR_TYPE.COUNTER:
261
+ return this.generateTextContent(type);
262
+ case AVATAR_TYPE.ICON:
263
+ default:
264
+ return this.iconTemplate();
265
+ }
266
+ }
267
+ /**
268
+ * @internal
269
+ * Represents the loading indicator for the avatar when typing.
270
+ * If the avatar is in typing state, this method returns a loading indicator
271
+ * comprising three small filled dots, scaled based on the avatar size.
272
+ *
273
+ * @returns The template result containing the loading indicator, or an empty template if not typing.
274
+ */
275
+ getLoadingContent() {
276
+ if (!this.isTyping) {
277
+ return nothing;
278
+ }
279
+ return html `<div class="loading__wrapper"><div class="loader"></div></div>`;
280
+ }
281
+ /**
282
+ * @internal
283
+ * Generates the photo placeholder content for the avatar component.
284
+ * If the photo is not yet loaded, and the avatar type is PHOTO with initials provided,
285
+ * it generates and returns the initials as a placeholder text.
286
+ * If the photo is already loaded, it returns an empty template.
287
+ *
288
+ * @param type - The type of the avatar.
289
+ * @returns The template result containing the placeholder content or an empty template.
290
+ */
291
+ getPhotoPlaceHolderContent(type) {
292
+ // if photo is already loaded then no need to show placeholder
293
+ if (this.isPhotoLoaded) {
294
+ return nothing;
295
+ }
296
+ if (type === AVATAR_TYPE.PHOTO) {
297
+ if (this.initials) {
298
+ return this.textTemplate(this.generateInitialsText(this.initials));
299
+ }
300
+ return this.iconTemplate();
301
+ }
302
+ return nothing;
303
+ }
304
+ update(changedProperties) {
305
+ super.update(changedProperties);
306
+ if (changedProperties.has('src') && !this.src) {
307
+ // Reset photo loaded if src is empty
308
+ this.isPhotoLoaded = false;
309
+ }
310
+ }
311
+ render() {
312
+ const type = this.getTypeBasedOnInputs();
313
+ return html `
314
+ <div class="content" aria-hidden="true">
315
+ ${this.getPhotoPlaceHolderContent(type)}
316
+ ${this.getTemplateBasedOnType(type)}
317
+ ${this.getLoadingContent()}
318
+ ${this.getPresenceTemplateBasedOnType(type)}
319
+ </div>
320
+ `;
65
321
  }
66
322
  }
67
323
  Avatar.styles = [...Component.styles, ...styles];
68
324
  __decorate([
69
- property({ type: String, reflect: true }),
325
+ property({ type: String }),
70
326
  __metadata("design:type", String)
71
- ], Avatar.prototype, "type", void 0);
327
+ ], Avatar.prototype, "src", void 0);
72
328
  __decorate([
73
329
  property({ type: String }),
74
330
  __metadata("design:type", String)
75
- ], Avatar.prototype, "alt", void 0);
331
+ ], Avatar.prototype, "initials", void 0);
76
332
  __decorate([
77
333
  property({ type: String }),
78
334
  __metadata("design:type", String)
79
- ], Avatar.prototype, "src", void 0);
335
+ ], Avatar.prototype, "presence", void 0);
336
+ __decorate([
337
+ property({ type: String, reflect: true }),
338
+ __metadata("design:type", String)
339
+ ], Avatar.prototype, "size", void 0);
340
+ __decorate([
341
+ property({ type: String, attribute: 'icon-name' }),
342
+ __metadata("design:type", String)
343
+ ], Avatar.prototype, "iconName", void 0);
80
344
  __decorate([
81
345
  property({ type: Number }),
82
346
  __metadata("design:type", Number)
83
- ], Avatar.prototype, "size", void 0);
347
+ ], Avatar.prototype, "counter", void 0);
348
+ __decorate([
349
+ property({ type: Boolean, attribute: 'is-typing' }),
350
+ __metadata("design:type", Object)
351
+ ], Avatar.prototype, "isTyping", void 0);
352
+ __decorate([
353
+ state(),
354
+ __metadata("design:type", Object)
355
+ ], Avatar.prototype, "isPhotoLoaded", void 0);
84
356
  export default Avatar;
@@ -1,7 +1,14 @@
1
1
  declare const TAG_NAME: "mdc-avatar";
2
- declare const LENGTH_UNIT = "rem";
2
+ declare const AVATAR_TYPE: {
3
+ readonly COUNTER: "counter";
4
+ readonly ICON: "icon";
5
+ readonly PHOTO: "photo";
6
+ readonly TEXT: "text";
7
+ };
8
+ declare const MAX_COUNTER = 99;
3
9
  declare const DEFAULTS: {
4
10
  readonly TYPE: "photo";
5
- readonly SIZE: 1.5;
11
+ readonly SIZE: "x_small";
12
+ readonly ICON_NAME: "user-regular";
6
13
  };
7
- export { TAG_NAME, DEFAULTS, LENGTH_UNIT };
14
+ export { TAG_NAME, DEFAULTS, AVATAR_TYPE, MAX_COUNTER, };
@@ -1,8 +1,17 @@
1
1
  import utils from '../../utils/tag-name';
2
+ import { SIZE as AVATAR_SIZE } from '../presence/presence.constants';
2
3
  const TAG_NAME = utils.constructTagName('avatar');
3
- const LENGTH_UNIT = 'rem';
4
+ const AVATAR_TYPE = {
5
+ COUNTER: 'counter',
6
+ ICON: 'icon',
7
+ PHOTO: 'photo',
8
+ TEXT: 'text',
9
+ };
10
+ const MAX_COUNTER = 99;
11
+ const ICON_NAME = 'user-regular';
4
12
  const DEFAULTS = {
5
- TYPE: 'photo',
6
- SIZE: 1.5,
13
+ TYPE: AVATAR_TYPE.PHOTO,
14
+ SIZE: AVATAR_SIZE.X_SMALL,
15
+ ICON_NAME,
7
16
  };
8
- export { TAG_NAME, DEFAULTS, LENGTH_UNIT };
17
+ export { TAG_NAME, DEFAULTS, AVATAR_TYPE, MAX_COUNTER, };
@@ -1,2 +1,2 @@
1
- declare const _default: import("lit").CSSResult[];
2
- export default _default;
1
+ declare const styles: import("lit").CSSResult[];
2
+ export default styles;