@momentum-design/components 0.104.9 → 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.
- package/dist/browser/index.js +210 -182
- package/dist/browser/index.js.map +3 -3
- package/dist/components/avatar/avatar.styles.js +28 -0
- package/dist/components/avatar/avatar.utils.js +9 -9
- package/dist/components/presence/presence.component.d.ts +14 -16
- package/dist/components/presence/presence.component.js +24 -36
- package/dist/components/presence/presence.constants.d.ts +11 -11
- package/dist/components/presence/presence.constants.js +12 -12
- package/dist/components/presence/presence.styles.js +16 -16
- package/dist/components/presence/presence.types.d.ts +3 -3
- package/dist/components/presence/presence.utils.d.ts +2 -1
- package/dist/components/presence/presence.utils.js +27 -15
- package/dist/components/selectlistbox/selectlistbox.component.d.ts +1 -1
- package/dist/components/selectlistbox/selectlistbox.component.js +2 -2
- package/dist/custom-elements.json +1219 -1213
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/package.json +1 -1
@@ -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 {
|
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
|
7
|
-
[AVATAR_SIZE[88]]: PRESENCE_SIZE
|
8
|
-
[AVATAR_SIZE[72]]: PRESENCE_SIZE
|
9
|
-
[AVATAR_SIZE[64]]: PRESENCE_SIZE
|
10
|
-
[AVATAR_SIZE[48]]: PRESENCE_SIZE
|
11
|
-
[AVATAR_SIZE[32]]: PRESENCE_SIZE
|
12
|
-
[AVATAR_SIZE[24]]: PRESENCE_SIZE
|
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
|
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
|
-
* -
|
54
|
-
* -
|
55
|
-
* -
|
56
|
-
* -
|
57
|
-
* -
|
58
|
-
* -
|
59
|
-
* -
|
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
|
62
|
-
* icons will be no smaller than 14px.
|
63
|
-
* @default
|
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
|
-
|
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,
|
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
|
-
* -
|
68
|
-
* -
|
69
|
-
* -
|
70
|
-
* -
|
71
|
-
* -
|
72
|
-
* -
|
73
|
-
* -
|
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
|
76
|
-
* icons will be no smaller than 14px.
|
77
|
-
* @default
|
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
|
-
|
88
|
-
|
89
|
-
|
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
|
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.
|
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:
|
153
|
-
__metadata("design:type",
|
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
|
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
|
19
|
-
readonly
|
20
|
-
readonly
|
21
|
-
readonly
|
22
|
-
readonly
|
23
|
-
readonly
|
24
|
-
readonly
|
25
|
-
readonly
|
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:
|
29
|
+
readonly SIZE: 32;
|
30
30
|
};
|
31
|
-
export { TAG_NAME, DEFAULTS,
|
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
|
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
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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:
|
30
|
-
SIZE:
|
29
|
+
TYPE: PRESENCE_TYPE.ACTIVE,
|
30
|
+
SIZE: PRESENCE_SIZE[32],
|
31
31
|
};
|
32
|
-
export { TAG_NAME, DEFAULTS,
|
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
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
34
|
-
width: 1.
|
35
|
-
height: 1.
|
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
|
-
|
38
|
-
width: 1.
|
39
|
-
height: 1.
|
37
|
+
:host([size='64'])::part(presence-content) {
|
38
|
+
width: 1.5625rem;
|
39
|
+
height: 1.5625rem;
|
40
40
|
}
|
41
|
-
|
42
|
-
width: 1.
|
43
|
-
height: 1.
|
41
|
+
:host([size='72'])::part(presence-content) {
|
42
|
+
width: 1.75rem;
|
43
|
+
height: 1.75rem;
|
44
44
|
}
|
45
|
-
|
46
|
-
width:
|
47
|
-
height:
|
45
|
+
:host([size='88'])::part(presence-content) {
|
46
|
+
width: 2.125rem;
|
47
|
+
height: 2.125rem;
|
48
48
|
}
|
49
|
-
|
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 {
|
3
|
-
type PresenceType = ValueOf<typeof
|
4
|
-
type PresenceSize = ValueOf<typeof
|
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 {
|
1
|
+
import { PRESENCE_TYPE, PRESENCE_SIZE } from './presence.constants';
|
2
2
|
export const getIconValue = (type) => {
|
3
3
|
switch (type) {
|
4
|
-
case
|
4
|
+
case PRESENCE_TYPE.AWAY:
|
5
5
|
return 'recents-presence-badge-filled';
|
6
|
-
case
|
6
|
+
case PRESENCE_TYPE.AWAY_CALLING:
|
7
7
|
return 'away-calling-presence-filled';
|
8
|
-
case
|
8
|
+
case PRESENCE_TYPE.BUSY:
|
9
9
|
return 'busy-presence-bold';
|
10
|
-
case
|
10
|
+
case PRESENCE_TYPE.DND:
|
11
11
|
return 'dnd-presence-badge-filled';
|
12
|
-
case
|
12
|
+
case PRESENCE_TYPE.MEETING:
|
13
13
|
return 'camera-filled';
|
14
|
-
case
|
14
|
+
case PRESENCE_TYPE.ON_CALL:
|
15
15
|
return 'handset-filled';
|
16
|
-
case
|
16
|
+
case PRESENCE_TYPE.ON_DEVICE:
|
17
17
|
return 'generic-device-video-badge-filled';
|
18
|
-
case
|
18
|
+
case PRESENCE_TYPE.ON_MOBILE:
|
19
19
|
return 'phone-badge-filled';
|
20
|
-
case
|
20
|
+
case PRESENCE_TYPE.PAUSE:
|
21
21
|
return 'pause-badge-filled';
|
22
|
-
case
|
22
|
+
case PRESENCE_TYPE.PTO:
|
23
23
|
return 'pto-presence-filled';
|
24
|
-
case
|
24
|
+
case PRESENCE_TYPE.PRESENTING:
|
25
25
|
return 'share-screen-badge-filled';
|
26
|
-
case
|
26
|
+
case PRESENCE_TYPE.QUIET:
|
27
27
|
return 'quiet-hours-presence-filled';
|
28
|
-
case
|
28
|
+
case PRESENCE_TYPE.SCHEDULED:
|
29
29
|
return 'meetings-presence-badge-filled';
|
30
|
-
case
|
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
|
+
};
|
@@ -12,7 +12,7 @@ import { Component } from '../../models';
|
|
12
12
|
* @slot default - This is a default/unnamed slot, which can be used to insert mdc-option components.
|
13
13
|
*/
|
14
14
|
declare class Selectlistbox extends Component {
|
15
|
-
|
15
|
+
connectedCallback(): void;
|
16
16
|
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
17
17
|
}
|
18
18
|
export default Selectlistbox;
|
@@ -13,8 +13,8 @@ import { ROLE } from '../../utils/roles';
|
|
13
13
|
* @slot default - This is a default/unnamed slot, which can be used to insert mdc-option components.
|
14
14
|
*/
|
15
15
|
class Selectlistbox extends Component {
|
16
|
-
|
17
|
-
super(
|
16
|
+
connectedCallback() {
|
17
|
+
super.connectedCallback();
|
18
18
|
this.role = ROLE.LISTBOX;
|
19
19
|
}
|
20
20
|
createRenderRoot() {
|