@momentum-design/components 0.104.10 → 0.104.11

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.
@@ -79,6 +79,34 @@ const styles = [
79
79
  bottom: 0;
80
80
  right: 0;
81
81
  }
82
+
83
+ :host([size='124'])::part(presence) {
84
+ bottom: -0.25rem;
85
+ right: -0.21875rem;
86
+ }
87
+
88
+ :host([size='88'])::part(presence),
89
+ :host([size='72'])::part(presence),
90
+ :host([size='64'])::part(presence) {
91
+ bottom: -0.09375rem;
92
+ right: -0.09375rem;
93
+ }
94
+
95
+ :host([size='48'])::part(presence) {
96
+ bottom: -0.03125rem;
97
+ right: -0.03125rem;
98
+ }
99
+
100
+ :host([size='32'])::part(presence) {
101
+ bottom: -0.15625rem;
102
+ right: -0.15625rem;
103
+ }
104
+
105
+ :host([size='24'])::part(presence) {
106
+ bottom: -0.1875rem;
107
+ right: -0.1875rem;
108
+ }
109
+
82
110
  :host::part(loading-wrapper) {
83
111
  position: absolute;
84
112
  border-radius: 100vh;
@@ -1,17 +1,17 @@
1
- import { SIZE as PRESENCE_SIZE } from '../presence/presence.constants';
1
+ import { PRESENCE_SIZE } from '../presence/presence.constants';
2
2
  import { TYPE as FONT_TYPE } from '../text/text.constants';
3
3
  import { AVATAR_SIZE } from './avatar.constants';
4
4
  const getPresenceSize = (size) => {
5
5
  const avatarPresenceSizeMap = {
6
- [AVATAR_SIZE[124]]: PRESENCE_SIZE.XX_LARGE,
7
- [AVATAR_SIZE[88]]: PRESENCE_SIZE.X_LARGE,
8
- [AVATAR_SIZE[72]]: PRESENCE_SIZE.LARGE,
9
- [AVATAR_SIZE[64]]: PRESENCE_SIZE.MIDSIZE,
10
- [AVATAR_SIZE[48]]: PRESENCE_SIZE.SMALL,
11
- [AVATAR_SIZE[32]]: PRESENCE_SIZE.X_SMALL,
12
- [AVATAR_SIZE[24]]: PRESENCE_SIZE.XX_SMALL,
6
+ [AVATAR_SIZE[124]]: PRESENCE_SIZE[124],
7
+ [AVATAR_SIZE[88]]: PRESENCE_SIZE[88],
8
+ [AVATAR_SIZE[72]]: PRESENCE_SIZE[72],
9
+ [AVATAR_SIZE[64]]: PRESENCE_SIZE[64],
10
+ [AVATAR_SIZE[48]]: PRESENCE_SIZE[48],
11
+ [AVATAR_SIZE[32]]: PRESENCE_SIZE[32],
12
+ [AVATAR_SIZE[24]]: PRESENCE_SIZE[24],
13
13
  };
14
- return avatarPresenceSizeMap[size] || PRESENCE_SIZE.X_SMALL; // default size of presence
14
+ return avatarPresenceSizeMap[size] || PRESENCE_SIZE[32]; // default size of presence
15
15
  };
16
16
  const getAvatarIconSize = (size) => {
17
17
  const avatarIconSizeMap = {
@@ -1,4 +1,4 @@
1
- import { CSSResult } from 'lit';
1
+ import { CSSResult, PropertyValues } from 'lit';
2
2
  import { Component } from '../../models';
3
3
  import type { PresenceType, PresenceSize } from './presence.types';
4
4
  /**
@@ -49,18 +49,18 @@ declare class Presence extends Component {
49
49
  */
50
50
  type: PresenceType;
51
51
  /**
52
- * Acceptable values include:
53
- * - XX_SMALL
54
- * - X_SMALL
55
- * - SMALL
56
- * - MIDSIZE
57
- * - LARGE
58
- * - X_LARGE
59
- * - XX_LARGE
52
+ * Acceptable numeric values include:
53
+ * - 24
54
+ * - 32
55
+ * - 48
56
+ * - 64
57
+ * - 72
58
+ * - 88
59
+ * - 124
60
60
  *
61
- * Presence icons are minimum 14px in size, meaning XX_Small, X_Small and Small presence
62
- * icons will be no smaller than 14px.
63
- * @default small
61
+ * Presence icons are minimum 14px in size, meaning 24, 32, and 48 presence
62
+ * icons will be no smaller than 14px (for sizes 24, 32, 48).
63
+ * @default 32
64
64
  */
65
65
  size: PresenceSize;
66
66
  /**
@@ -68,10 +68,8 @@ declare class Presence extends Component {
68
68
  * State to track the current icon type (previous type until the new icon is loaded)
69
69
  */
70
70
  private currentIconType;
71
- /**
72
- * Get the size of the presence icon based on the given size type
73
- */
74
- private get iconSize();
71
+ update(changedProperties: PropertyValues): void;
72
+ private setSize;
75
73
  /**
76
74
  * Get the icon name based on the presence type
77
75
  */
@@ -10,9 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { html } from 'lit';
11
11
  import { property, state } from 'lit/decorators.js';
12
12
  import { Component } from '../../models';
13
- import { DEFAULTS, SIZE } from './presence.constants';
13
+ import { DEFAULTS, PRESENCE_SIZE } from './presence.constants';
14
14
  import styles from './presence.styles';
15
- import { getIconValue } from './presence.utils';
15
+ import { getIconValue, getPresenceIconSize } from './presence.utils';
16
16
  /**
17
17
  * The `mdc-presence` component is a versatile UI element used to
18
18
  * display the presence status of a user or entity within an avatar component.
@@ -63,18 +63,18 @@ class Presence extends Component {
63
63
  */
64
64
  this.type = DEFAULTS.TYPE;
65
65
  /**
66
- * Acceptable values include:
67
- * - XX_SMALL
68
- * - X_SMALL
69
- * - SMALL
70
- * - MIDSIZE
71
- * - LARGE
72
- * - X_LARGE
73
- * - XX_LARGE
66
+ * Acceptable numeric values include:
67
+ * - 24
68
+ * - 32
69
+ * - 48
70
+ * - 64
71
+ * - 72
72
+ * - 88
73
+ * - 124
74
74
  *
75
- * Presence icons are minimum 14px in size, meaning XX_Small, X_Small and Small presence
76
- * icons will be no smaller than 14px.
77
- * @default small
75
+ * Presence icons are minimum 14px in size, meaning 24, 32, and 48 presence
76
+ * icons will be no smaller than 14px (for sizes 24, 32, 48).
77
+ * @default 32
78
78
  */
79
79
  this.size = DEFAULTS.SIZE;
80
80
  /**
@@ -83,27 +83,15 @@ class Presence extends Component {
83
83
  */
84
84
  this.currentIconType = DEFAULTS.TYPE;
85
85
  }
86
- /**
87
- * Get the size of the presence icon based on the given size type
88
- */
89
- get iconSize() {
90
- switch (this.size) {
91
- case SIZE.MIDSIZE:
92
- return 1.16125;
93
- case SIZE.LARGE:
94
- return 1.30625;
95
- case SIZE.X_LARGE:
96
- return 1.596875;
97
- case SIZE.XX_LARGE:
98
- return 2.25;
99
- case SIZE.XX_SMALL:
100
- case SIZE.X_SMALL:
101
- case SIZE.SMALL:
102
- default:
103
- this.size = DEFAULTS.SIZE;
104
- return 0.875;
86
+ update(changedProperties) {
87
+ super.update(changedProperties);
88
+ if (changedProperties.has('size')) {
89
+ this.setSize(this.size);
105
90
  }
106
91
  }
92
+ setSize(size) {
93
+ this.setAttribute('size', Object.values(PRESENCE_SIZE).includes(size) ? `${size}` : DEFAULTS.SIZE.toString());
94
+ }
107
95
  /**
108
96
  * Get the icon name based on the presence type
109
97
  */
@@ -131,11 +119,11 @@ class Presence extends Component {
131
119
  }
132
120
  render() {
133
121
  return html `
134
- <div class="mdc-presence mdc-presence__${this.size}">
122
+ <div part="presence-content">
135
123
  <mdc-icon
136
124
  class="mdc-presence-icon mdc-presence-icon__${this.currentIconType}"
137
125
  name="${this.icon}"
138
- size="${this.iconSize}"
126
+ size="${getPresenceIconSize(this.size)}"
139
127
  @load="${this.handleOnLoad}"
140
128
  @error="${this.handleOnError}"
141
129
  ></mdc-icon>
@@ -149,8 +137,8 @@ __decorate([
149
137
  __metadata("design:type", String)
150
138
  ], Presence.prototype, "type", void 0);
151
139
  __decorate([
152
- property({ type: String, reflect: true }),
153
- __metadata("design:type", String)
140
+ property({ type: Number, reflect: true }),
141
+ __metadata("design:type", Number)
154
142
  ], Presence.prototype, "size", void 0);
155
143
  __decorate([
156
144
  state(),
@@ -1,5 +1,5 @@
1
1
  declare const TAG_NAME: "mdc-presence";
2
- declare const TYPE: {
2
+ declare const PRESENCE_TYPE: {
3
3
  readonly ACTIVE: "active";
4
4
  readonly AWAY: "away";
5
5
  readonly AWAY_CALLING: "away-calling";
@@ -15,17 +15,17 @@ declare const TYPE: {
15
15
  readonly QUIET: "quiet";
16
16
  readonly SCHEDULED: "scheduled";
17
17
  };
18
- declare const SIZE: {
19
- readonly XX_SMALL: "xx_small";
20
- readonly X_SMALL: "x_small";
21
- readonly SMALL: "small";
22
- readonly MIDSIZE: "midsize";
23
- readonly LARGE: "large";
24
- readonly X_LARGE: "x_large";
25
- readonly XX_LARGE: "xx_large";
18
+ declare const PRESENCE_SIZE: {
19
+ readonly 24: 24;
20
+ readonly 32: 32;
21
+ readonly 48: 48;
22
+ readonly 64: 64;
23
+ readonly 72: 72;
24
+ readonly 88: 88;
25
+ readonly 124: 124;
26
26
  };
27
27
  declare const DEFAULTS: {
28
28
  readonly TYPE: "active";
29
- readonly SIZE: "small";
29
+ readonly SIZE: 32;
30
30
  };
31
- export { TAG_NAME, DEFAULTS, TYPE, SIZE };
31
+ export { TAG_NAME, DEFAULTS, PRESENCE_TYPE, PRESENCE_SIZE };
@@ -1,6 +1,6 @@
1
1
  import utils from '../../utils/tag-name';
2
2
  const TAG_NAME = utils.constructTagName('presence');
3
- const TYPE = {
3
+ const PRESENCE_TYPE = {
4
4
  ACTIVE: 'active',
5
5
  AWAY: 'away',
6
6
  AWAY_CALLING: 'away-calling',
@@ -16,17 +16,17 @@ const TYPE = {
16
16
  QUIET: 'quiet',
17
17
  SCHEDULED: 'scheduled',
18
18
  };
19
- const SIZE = {
20
- XX_SMALL: 'xx_small',
21
- X_SMALL: 'x_small',
22
- SMALL: 'small',
23
- MIDSIZE: 'midsize',
24
- LARGE: 'large',
25
- X_LARGE: 'x_large',
26
- XX_LARGE: 'xx_large',
19
+ const PRESENCE_SIZE = {
20
+ 24: 24,
21
+ 32: 32,
22
+ 48: 48,
23
+ 64: 64,
24
+ 72: 72,
25
+ 88: 88,
26
+ 124: 124,
27
27
  };
28
28
  const DEFAULTS = {
29
- TYPE: TYPE.ACTIVE,
30
- SIZE: SIZE.SMALL,
29
+ TYPE: PRESENCE_TYPE.ACTIVE,
30
+ SIZE: PRESENCE_SIZE[32],
31
31
  };
32
- export { TAG_NAME, DEFAULTS, TYPE, SIZE };
32
+ export { TAG_NAME, DEFAULTS, PRESENCE_TYPE, PRESENCE_SIZE };
@@ -21,32 +21,32 @@ const styles = [
21
21
  --mdc-presence-overlay-background-color: var(--mds-color-theme-background-solid-primary-normal);
22
22
  }
23
23
 
24
- .mdc-presence {
24
+ :host::part(presence-content) {
25
25
  border-radius: 50%;
26
26
  background-color: var(--mdc-presence-overlay-background-color);
27
27
  display: flex;
28
28
  justify-content: center;
29
29
  align-items: center;
30
30
  }
31
- .mdc-presence__xx_small,
32
- .mdc-presence__x_small,
33
- .mdc-presence__small {
34
- width: 1.0625rem;
35
- height: 1.0625rem;
31
+ :host([size='24'])::part(presence-content),
32
+ :host([size='32'])::part(presence-content),
33
+ :host([size='48'])::part(presence-content) {
34
+ width: 1.125rem;
35
+ height: 1.125rem;
36
36
  }
37
- .mdc-presence__midsize {
38
- width: 1.419375rem;
39
- height: 1.419375rem;
37
+ :host([size='64'])::part(presence-content) {
38
+ width: 1.5625rem;
39
+ height: 1.5625rem;
40
40
  }
41
- .mdc-presence__large {
42
- width: 1.596875rem;
43
- height: 1.596875rem;
41
+ :host([size='72'])::part(presence-content) {
42
+ width: 1.75rem;
43
+ height: 1.75rem;
44
44
  }
45
- .mdc-presence__x_large {
46
- width: 1.951875rem;
47
- height: 1.951875rem;
45
+ :host([size='88'])::part(presence-content) {
46
+ width: 2.125rem;
47
+ height: 2.125rem;
48
48
  }
49
- .mdc-presence__xx_large {
49
+ :host([size='124'])::part(presence-content) {
50
50
  width: 2.75rem;
51
51
  height: 2.75rem;
52
52
  }
@@ -1,5 +1,5 @@
1
1
  import type { ValueOf } from '../../utils/types';
2
- import { TYPE, SIZE } from './presence.constants';
3
- type PresenceType = ValueOf<typeof TYPE>;
4
- type PresenceSize = ValueOf<typeof SIZE>;
2
+ import { PRESENCE_TYPE, PRESENCE_SIZE } from './presence.constants';
3
+ type PresenceType = ValueOf<typeof PRESENCE_TYPE>;
4
+ type PresenceSize = ValueOf<typeof PRESENCE_SIZE>;
5
5
  export type { PresenceType, PresenceSize };
@@ -1,2 +1,3 @@
1
- import type { PresenceType } from './presence.types';
1
+ import type { PresenceSize, PresenceType } from './presence.types';
2
2
  export declare const getIconValue: (type: PresenceType) => "active-presence-small-filled" | "away-calling-presence-filled" | "busy-presence-bold" | "camera-filled" | "dnd-presence-badge-filled" | "generic-device-video-badge-filled" | "handset-filled" | "meetings-presence-badge-filled" | "pause-badge-filled" | "phone-badge-filled" | "pto-presence-filled" | "quiet-hours-presence-filled" | "recents-presence-badge-filled" | "share-screen-badge-filled";
3
+ export declare const getPresenceIconSize: (size: PresenceSize) => number;
@@ -1,34 +1,46 @@
1
- import { TYPE } from './presence.constants';
1
+ import { PRESENCE_TYPE, PRESENCE_SIZE } from './presence.constants';
2
2
  export const getIconValue = (type) => {
3
3
  switch (type) {
4
- case TYPE.AWAY:
4
+ case PRESENCE_TYPE.AWAY:
5
5
  return 'recents-presence-badge-filled';
6
- case TYPE.AWAY_CALLING:
6
+ case PRESENCE_TYPE.AWAY_CALLING:
7
7
  return 'away-calling-presence-filled';
8
- case TYPE.BUSY:
8
+ case PRESENCE_TYPE.BUSY:
9
9
  return 'busy-presence-bold';
10
- case TYPE.DND:
10
+ case PRESENCE_TYPE.DND:
11
11
  return 'dnd-presence-badge-filled';
12
- case TYPE.MEETING:
12
+ case PRESENCE_TYPE.MEETING:
13
13
  return 'camera-filled';
14
- case TYPE.ON_CALL:
14
+ case PRESENCE_TYPE.ON_CALL:
15
15
  return 'handset-filled';
16
- case TYPE.ON_DEVICE:
16
+ case PRESENCE_TYPE.ON_DEVICE:
17
17
  return 'generic-device-video-badge-filled';
18
- case TYPE.ON_MOBILE:
18
+ case PRESENCE_TYPE.ON_MOBILE:
19
19
  return 'phone-badge-filled';
20
- case TYPE.PAUSE:
20
+ case PRESENCE_TYPE.PAUSE:
21
21
  return 'pause-badge-filled';
22
- case TYPE.PTO:
22
+ case PRESENCE_TYPE.PTO:
23
23
  return 'pto-presence-filled';
24
- case TYPE.PRESENTING:
24
+ case PRESENCE_TYPE.PRESENTING:
25
25
  return 'share-screen-badge-filled';
26
- case TYPE.QUIET:
26
+ case PRESENCE_TYPE.QUIET:
27
27
  return 'quiet-hours-presence-filled';
28
- case TYPE.SCHEDULED:
28
+ case PRESENCE_TYPE.SCHEDULED:
29
29
  return 'meetings-presence-badge-filled';
30
- case TYPE.ACTIVE:
30
+ case PRESENCE_TYPE.ACTIVE:
31
31
  default:
32
32
  return 'active-presence-small-filled';
33
33
  }
34
34
  };
35
+ export const getPresenceIconSize = (size) => {
36
+ const presenceIconSizeMap = {
37
+ [PRESENCE_SIZE[124]]: 2.25,
38
+ [PRESENCE_SIZE[88]]: 1.625,
39
+ [PRESENCE_SIZE[72]]: 1.3125,
40
+ [PRESENCE_SIZE[64]]: 1.1875,
41
+ [PRESENCE_SIZE[48]]: 0.875,
42
+ [PRESENCE_SIZE[32]]: 0.875,
43
+ [PRESENCE_SIZE[24]]: 0.875,
44
+ };
45
+ return presenceIconSizeMap[size] || 0.875; // default size of icon
46
+ };
@@ -28413,17 +28413,28 @@
28413
28413
  "type": {
28414
28414
  "text": "PresenceSize"
28415
28415
  },
28416
- "description": "Acceptable values include:\n- XX_SMALL\n- X_SMALL\n- SMALL\n- MIDSIZE\n- LARGE\n- X_LARGE\n- XX_LARGE\n\nPresence icons are minimum 14px in size, meaning XX_Small, X_Small and Small presence\nicons will be no smaller than 14px.",
28417
- "default": "small",
28416
+ "description": "Acceptable numeric values include:\n- 24\n- 32\n- 48\n- 64\n- 72\n- 88\n- 124\n\nPresence icons are minimum 14px in size, meaning 24, 32, and 48 presence\nicons will be no smaller than 14px (for sizes 24, 32, 48).",
28417
+ "default": "32",
28418
28418
  "attribute": "size",
28419
28419
  "reflects": true
28420
28420
  },
28421
28421
  {
28422
- "kind": "field",
28423
- "name": "iconSize",
28422
+ "kind": "method",
28423
+ "name": "setSize",
28424
28424
  "privacy": "private",
28425
- "description": "Get the size of the presence icon based on the given size type",
28426
- "readonly": true
28425
+ "return": {
28426
+ "type": {
28427
+ "text": "void"
28428
+ }
28429
+ },
28430
+ "parameters": [
28431
+ {
28432
+ "name": "size",
28433
+ "type": {
28434
+ "text": "PresenceSize"
28435
+ }
28436
+ }
28437
+ ]
28427
28438
  },
28428
28439
  {
28429
28440
  "kind": "field",
@@ -28470,8 +28481,8 @@
28470
28481
  "type": {
28471
28482
  "text": "PresenceSize"
28472
28483
  },
28473
- "description": "Acceptable values include:\n- XX_SMALL\n- X_SMALL\n- SMALL\n- MIDSIZE\n- LARGE\n- X_LARGE\n- XX_LARGE\n\nPresence icons are minimum 14px in size, meaning XX_Small, X_Small and Small presence\nicons will be no smaller than 14px.",
28474
- "default": "small",
28484
+ "description": "Acceptable numeric values include:\n- 24\n- 32\n- 48\n- 64\n- 72\n- 88\n- 124\n\nPresence icons are minimum 14px in size, meaning 24, 32, and 48 presence\nicons will be no smaller than 14px (for sizes 24, 32, 48).",
28485
+ "default": "32",
28475
28486
  "fieldName": "size"
28476
28487
  }
28477
28488
  ],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.104.10",
4
+ "version": "0.104.11",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"