@momentum-design/components 0.12.3 → 0.12.5

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