@momentum-design/components 0.7.6 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/index.js +26 -26
- package/dist/browser/index.js.map +3 -3
- package/dist/components/badge/badge.component.d.ts +4 -0
- package/dist/components/badge/badge.component.js +4 -0
- package/dist/components/iconprovider/iconprovider.component.d.ts +5 -2
- package/dist/components/iconprovider/iconprovider.component.js +6 -3
- package/dist/components/iconprovider/iconprovider.constants.d.ts +3 -2
- package/dist/components/iconprovider/iconprovider.constants.js +7 -6
- package/dist/components/presence/presence.component.d.ts +2 -2
- package/dist/components/presence/presence.component.js +24 -24
- package/dist/components/text/text.component.d.ts +1 -0
- package/dist/components/text/text.component.js +1 -0
- package/dist/custom-elements.json +20 -6
- package/package.json +1 -1
@@ -37,6 +37,7 @@ declare class Badge extends Component {
|
|
37
37
|
/**
|
38
38
|
* Type of the variant can be `primary` or `secondary`.
|
39
39
|
* It defines the background and foreground color of the icon.
|
40
|
+
* @default primary
|
40
41
|
*/
|
41
42
|
variant: string;
|
42
43
|
/**
|
@@ -46,16 +47,19 @@ declare class Badge extends Component {
|
|
46
47
|
/**
|
47
48
|
* The maximum number can be set up to 999, anything above that will be rendered as _999+_.
|
48
49
|
* The max counter can be `9`, `99` or `999`.
|
50
|
+
* @default 99
|
49
51
|
*/
|
50
52
|
maxCounter: number;
|
51
53
|
/**
|
52
54
|
* Overlay is to add a thin outline to the badge.
|
53
55
|
* This will help distinguish between the badge and the button,
|
54
56
|
* where the badge will be layered on top of a button.
|
57
|
+
* @default false
|
55
58
|
*/
|
56
59
|
overlay: boolean;
|
57
60
|
/**
|
58
61
|
* Aria-label attribute to be set for accessibility
|
62
|
+
* @default null
|
59
63
|
*/
|
60
64
|
ariaLabel: string | null;
|
61
65
|
/**
|
@@ -43,21 +43,25 @@ class Badge extends Component {
|
|
43
43
|
/**
|
44
44
|
* Type of the variant can be `primary` or `secondary`.
|
45
45
|
* It defines the background and foreground color of the icon.
|
46
|
+
* @default primary
|
46
47
|
*/
|
47
48
|
this.variant = DEFAULTS.VARIANT;
|
48
49
|
/**
|
49
50
|
* The maximum number can be set up to 999, anything above that will be rendered as _999+_.
|
50
51
|
* The max counter can be `9`, `99` or `999`.
|
52
|
+
* @default 99
|
51
53
|
*/
|
52
54
|
this.maxCounter = DEFAULTS.MAX_COUNTER;
|
53
55
|
/**
|
54
56
|
* Overlay is to add a thin outline to the badge.
|
55
57
|
* This will help distinguish between the badge and the button,
|
56
58
|
* where the badge will be layered on top of a button.
|
59
|
+
* @default false
|
57
60
|
*/
|
58
61
|
this.overlay = false;
|
59
62
|
/**
|
60
63
|
* Aria-label attribute to be set for accessibility
|
64
|
+
* @default null
|
61
65
|
*/
|
62
66
|
this.ariaLabel = null;
|
63
67
|
}
|
@@ -25,16 +25,19 @@ declare class IconProvider extends Provider<IconProviderContext> {
|
|
25
25
|
*/
|
26
26
|
url?: string;
|
27
27
|
/**
|
28
|
-
* File extension of icons
|
28
|
+
* File extension of icons
|
29
|
+
* @default svg
|
29
30
|
*/
|
30
31
|
fileExtension?: string;
|
31
32
|
/**
|
32
|
-
* Length unit used for sizing of icons
|
33
|
+
* Length unit used for sizing of icons
|
34
|
+
* @default em
|
33
35
|
*/
|
34
36
|
lengthUnit: string;
|
35
37
|
/**
|
36
38
|
* The default size of the icon.
|
37
39
|
* If not set, it falls back to the size defined by the length unit.
|
40
|
+
* @default 1
|
38
41
|
*/
|
39
42
|
size?: number;
|
40
43
|
private updateValuesInContext;
|
@@ -31,18 +31,21 @@ class IconProvider extends Provider {
|
|
31
31
|
initialValue: new IconProviderContext(),
|
32
32
|
});
|
33
33
|
/**
|
34
|
-
* File extension of icons
|
34
|
+
* File extension of icons
|
35
|
+
* @default svg
|
35
36
|
*/
|
36
37
|
this.fileExtension = DEFAULTS.FILE_EXTENSION;
|
37
38
|
/**
|
38
|
-
* Length unit used for sizing of icons
|
39
|
+
* Length unit used for sizing of icons
|
40
|
+
* @default em
|
39
41
|
*/
|
40
42
|
this.lengthUnit = DEFAULTS.LENGTH_UNIT;
|
41
43
|
/**
|
42
44
|
* The default size of the icon.
|
43
45
|
* If not set, it falls back to the size defined by the length unit.
|
46
|
+
* @default 1
|
44
47
|
*/
|
45
|
-
this.size = DEFAULTS.
|
48
|
+
this.size = DEFAULTS.SIZE;
|
46
49
|
}
|
47
50
|
/**
|
48
51
|
* Context object of the IconProvider, to be consumed by child components
|
@@ -1,9 +1,10 @@
|
|
1
1
|
declare const TAG_NAME: "mdc-iconprovider";
|
2
2
|
declare const ALLOWED_FILE_EXTENSIONS: string[];
|
3
3
|
declare const ALLOWED_LENGTH_UNITS: string[];
|
4
|
+
declare const LENGTH_UNIT_SIZE: Record<string, number>;
|
4
5
|
declare const DEFAULTS: {
|
5
6
|
FILE_EXTENSION: string;
|
6
7
|
LENGTH_UNIT: string;
|
7
|
-
|
8
|
+
SIZE: number;
|
8
9
|
};
|
9
|
-
export { TAG_NAME, DEFAULTS, ALLOWED_FILE_EXTENSIONS, ALLOWED_LENGTH_UNITS };
|
10
|
+
export { TAG_NAME, DEFAULTS, ALLOWED_FILE_EXTENSIONS, ALLOWED_LENGTH_UNITS, LENGTH_UNIT_SIZE };
|
@@ -2,13 +2,14 @@ import utils from '../../utils/tag-name';
|
|
2
2
|
const TAG_NAME = utils.constructTagName('iconprovider');
|
3
3
|
const ALLOWED_FILE_EXTENSIONS = ['svg'];
|
4
4
|
const ALLOWED_LENGTH_UNITS = ['em', 'rem', 'px'];
|
5
|
+
const LENGTH_UNIT_SIZE = {
|
6
|
+
px: 16,
|
7
|
+
em: 1,
|
8
|
+
rem: 1,
|
9
|
+
};
|
5
10
|
const DEFAULTS = {
|
6
11
|
FILE_EXTENSION: 'svg',
|
7
12
|
LENGTH_UNIT: 'em',
|
8
|
-
|
9
|
-
px: 16,
|
10
|
-
em: 1,
|
11
|
-
rem: 1,
|
12
|
-
},
|
13
|
+
SIZE: LENGTH_UNIT_SIZE.em,
|
13
14
|
};
|
14
|
-
export { TAG_NAME, DEFAULTS, ALLOWED_FILE_EXTENSIONS, ALLOWED_LENGTH_UNITS };
|
15
|
+
export { TAG_NAME, DEFAULTS, ALLOWED_FILE_EXTENSIONS, ALLOWED_LENGTH_UNITS, LENGTH_UNIT_SIZE };
|
@@ -28,7 +28,7 @@ declare class Presence extends Component {
|
|
28
28
|
* - `presenting`
|
29
29
|
* - `quiet`
|
30
30
|
* - `scheduled`
|
31
|
-
*
|
31
|
+
* @default active
|
32
32
|
*/
|
33
33
|
type: string;
|
34
34
|
/**
|
@@ -40,7 +40,7 @@ declare class Presence extends Component {
|
|
40
40
|
* - LARGE
|
41
41
|
* - X_LARGE
|
42
42
|
* - XX_LARGE
|
43
|
-
*
|
43
|
+
* @default small
|
44
44
|
*/
|
45
45
|
size: string;
|
46
46
|
/**
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
import { html } from 'lit';
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
12
|
import { Component } from '../../models';
|
13
|
-
import { DEFAULTS } from './presence.constants';
|
13
|
+
import { DEFAULTS, PRESENCE_SIZE, PRESENCE_TYPE } from './presence.constants';
|
14
14
|
import styles from './presence.styles';
|
15
15
|
/**
|
16
16
|
* The `mdc-presence` component is a versatile UI element used to
|
@@ -42,7 +42,7 @@ class Presence extends Component {
|
|
42
42
|
* - `presenting`
|
43
43
|
* - `quiet`
|
44
44
|
* - `scheduled`
|
45
|
-
*
|
45
|
+
* @default active
|
46
46
|
*/
|
47
47
|
this.type = DEFAULTS.TYPE;
|
48
48
|
/**
|
@@ -54,7 +54,7 @@ class Presence extends Component {
|
|
54
54
|
* - LARGE
|
55
55
|
* - X_LARGE
|
56
56
|
* - XX_LARGE
|
57
|
-
*
|
57
|
+
* @default small
|
58
58
|
*/
|
59
59
|
this.size = DEFAULTS.SIZE;
|
60
60
|
}
|
@@ -63,17 +63,17 @@ class Presence extends Component {
|
|
63
63
|
*/
|
64
64
|
get iconSize() {
|
65
65
|
switch (this.size) {
|
66
|
-
case
|
66
|
+
case PRESENCE_SIZE.MIDSIZE:
|
67
67
|
return 1.16125;
|
68
|
-
case
|
68
|
+
case PRESENCE_SIZE.LARGE:
|
69
69
|
return 1.30625;
|
70
|
-
case
|
70
|
+
case PRESENCE_SIZE.X_LARGE:
|
71
71
|
return 1.596875;
|
72
|
-
case
|
72
|
+
case PRESENCE_SIZE.XX_LARGE:
|
73
73
|
return 2.25;
|
74
|
-
case
|
75
|
-
case
|
76
|
-
case
|
74
|
+
case PRESENCE_SIZE.XX_SMALL:
|
75
|
+
case PRESENCE_SIZE.X_SMALL:
|
76
|
+
case PRESENCE_SIZE.SMALL:
|
77
77
|
default:
|
78
78
|
this.size = DEFAULTS.SIZE;
|
79
79
|
return 0.875;
|
@@ -84,33 +84,33 @@ class Presence extends Component {
|
|
84
84
|
*/
|
85
85
|
get icon() {
|
86
86
|
switch (this.type) {
|
87
|
-
case
|
87
|
+
case PRESENCE_TYPE.AWAY:
|
88
88
|
return 'recents-presence-badge-filled';
|
89
|
-
case
|
89
|
+
case PRESENCE_TYPE.AWAY_CALLING:
|
90
90
|
return 'away-calling-presence-filled';
|
91
|
-
case
|
91
|
+
case PRESENCE_TYPE.BUSY:
|
92
92
|
return 'busy-presence-bold';
|
93
|
-
case
|
93
|
+
case PRESENCE_TYPE.DND:
|
94
94
|
return 'dnd-presence-badge-filled';
|
95
|
-
case
|
95
|
+
case PRESENCE_TYPE.MEETING:
|
96
96
|
return 'camera-filled';
|
97
|
-
case
|
97
|
+
case PRESENCE_TYPE.ON_CALL:
|
98
98
|
return 'handset-filled';
|
99
|
-
case
|
99
|
+
case PRESENCE_TYPE.ON_DEVICE:
|
100
100
|
return 'generic-device-video-badge-filled';
|
101
|
-
case
|
101
|
+
case PRESENCE_TYPE.ON_MOBILE:
|
102
102
|
return 'phone-badge-filled';
|
103
|
-
case
|
103
|
+
case PRESENCE_TYPE.PAUSE:
|
104
104
|
return 'pause-badge-filled';
|
105
|
-
case
|
105
|
+
case PRESENCE_TYPE.PTO:
|
106
106
|
return 'pto-presence-filled';
|
107
|
-
case
|
107
|
+
case PRESENCE_TYPE.PRESENTING:
|
108
108
|
return 'share-screen-badge-filled';
|
109
|
-
case
|
109
|
+
case PRESENCE_TYPE.QUIET:
|
110
110
|
return 'quiet-hours-presence-filled';
|
111
|
-
case
|
111
|
+
case PRESENCE_TYPE.SCHEDULED:
|
112
112
|
return 'meetings-presence-badge-filled';
|
113
|
-
case
|
113
|
+
case PRESENCE_TYPE.ACTIVE:
|
114
114
|
default:
|
115
115
|
this.type = DEFAULTS.TYPE;
|
116
116
|
return 'active-presence-small-filled';
|
@@ -146,6 +146,7 @@
|
|
146
146
|
"kind": "field",
|
147
147
|
"name": "variant",
|
148
148
|
"description": "Type of the variant can be `primary` or `secondary`.\nIt defines the background and foreground color of the icon.",
|
149
|
+
"default": "primary",
|
149
150
|
"attribute": "variant",
|
150
151
|
"reflects": true
|
151
152
|
},
|
@@ -165,6 +166,7 @@
|
|
165
166
|
"text": "number"
|
166
167
|
},
|
167
168
|
"description": "The maximum number can be set up to 999, anything above that will be rendered as _999+_.\nThe max counter can be `9`, `99` or `999`.",
|
169
|
+
"default": "99",
|
168
170
|
"attribute": "max-counter",
|
169
171
|
"reflects": true
|
170
172
|
},
|
@@ -391,6 +393,7 @@
|
|
391
393
|
{
|
392
394
|
"name": "variant",
|
393
395
|
"description": "Type of the variant can be `primary` or `secondary`.\nIt defines the background and foreground color of the icon.",
|
396
|
+
"default": "primary",
|
394
397
|
"fieldName": "variant"
|
395
398
|
},
|
396
399
|
{
|
@@ -407,6 +410,7 @@
|
|
407
410
|
"text": "number"
|
408
411
|
},
|
409
412
|
"description": "The maximum number can be set up to 999, anything above that will be rendered as _999+_.\nThe max counter can be `9`, `99` or `999`.",
|
413
|
+
"default": "99",
|
410
414
|
"fieldName": "maxCounter"
|
411
415
|
},
|
412
416
|
{
|
@@ -658,7 +662,8 @@
|
|
658
662
|
"type": {
|
659
663
|
"text": "string | undefined"
|
660
664
|
},
|
661
|
-
"description": "File extension of icons
|
665
|
+
"description": "File extension of icons",
|
666
|
+
"default": "svg",
|
662
667
|
"attribute": "file-extension",
|
663
668
|
"reflects": true
|
664
669
|
},
|
@@ -668,7 +673,8 @@
|
|
668
673
|
"type": {
|
669
674
|
"text": "string"
|
670
675
|
},
|
671
|
-
"description": "Length unit used for sizing of icons
|
676
|
+
"description": "Length unit used for sizing of icons",
|
677
|
+
"default": "em",
|
672
678
|
"attribute": "length-unit",
|
673
679
|
"reflects": true
|
674
680
|
},
|
@@ -678,8 +684,8 @@
|
|
678
684
|
"type": {
|
679
685
|
"text": "number | undefined"
|
680
686
|
},
|
681
|
-
"default": "DEFAULTS.LENGTH_UNIT_SIZE[DEFAULTS.LENGTH_UNIT]",
|
682
687
|
"description": "The default size of the icon.\nIf not set, it falls back to the size defined by the length unit.",
|
688
|
+
"default": "1",
|
683
689
|
"attribute": "size",
|
684
690
|
"reflects": true
|
685
691
|
},
|
@@ -713,7 +719,8 @@
|
|
713
719
|
"type": {
|
714
720
|
"text": "string | undefined"
|
715
721
|
},
|
716
|
-
"description": "File extension of icons
|
722
|
+
"description": "File extension of icons",
|
723
|
+
"default": "svg",
|
717
724
|
"fieldName": "fileExtension"
|
718
725
|
},
|
719
726
|
{
|
@@ -721,7 +728,8 @@
|
|
721
728
|
"type": {
|
722
729
|
"text": "string"
|
723
730
|
},
|
724
|
-
"description": "Length unit used for sizing of icons
|
731
|
+
"description": "Length unit used for sizing of icons",
|
732
|
+
"default": "em",
|
725
733
|
"fieldName": "lengthUnit"
|
726
734
|
},
|
727
735
|
{
|
@@ -729,8 +737,8 @@
|
|
729
737
|
"type": {
|
730
738
|
"text": "number | undefined"
|
731
739
|
},
|
732
|
-
"default": "DEFAULTS.LENGTH_UNIT_SIZE[DEFAULTS.LENGTH_UNIT]",
|
733
740
|
"description": "The default size of the icon.\nIf not set, it falls back to the size defined by the length unit.",
|
741
|
+
"default": "1",
|
734
742
|
"fieldName": "size"
|
735
743
|
}
|
736
744
|
],
|
@@ -767,6 +775,7 @@
|
|
767
775
|
"kind": "field",
|
768
776
|
"name": "type",
|
769
777
|
"description": "Supported presence types:\n- `active`\n- `away`\n- `away-calling`\n- `busy`\n- `dnd`\n- `meeting`\n- `on-call`\n- `on-device`\n- `on-mobile`\n- `pause`\n- `pto`\n- `presenting`\n- `quiet`\n- `scheduled`",
|
778
|
+
"default": "active",
|
770
779
|
"attribute": "type",
|
771
780
|
"reflects": true
|
772
781
|
},
|
@@ -774,6 +783,7 @@
|
|
774
783
|
"kind": "field",
|
775
784
|
"name": "size",
|
776
785
|
"description": "Acceptable values include:\n- XX_SMALL\n- X_SMALL\n- SMALL\n- MIDSIZE\n- LARGE\n- X_LARGE\n- XX_LARGE",
|
786
|
+
"default": "small",
|
777
787
|
"attribute": "size",
|
778
788
|
"reflects": true
|
779
789
|
},
|
@@ -796,11 +806,13 @@
|
|
796
806
|
{
|
797
807
|
"name": "type",
|
798
808
|
"description": "Supported presence types:\n- `active`\n- `away`\n- `away-calling`\n- `busy`\n- `dnd`\n- `meeting`\n- `on-call`\n- `on-device`\n- `on-mobile`\n- `pause`\n- `pto`\n- `presenting`\n- `quiet`\n- `scheduled`",
|
809
|
+
"default": "active",
|
799
810
|
"fieldName": "type"
|
800
811
|
},
|
801
812
|
{
|
802
813
|
"name": "size",
|
803
814
|
"description": "Acceptable values include:\n- XX_SMALL\n- X_SMALL\n- SMALL\n- MIDSIZE\n- LARGE\n- X_LARGE\n- XX_LARGE",
|
815
|
+
"default": "small",
|
804
816
|
"fieldName": "size"
|
805
817
|
}
|
806
818
|
],
|
@@ -850,6 +862,7 @@
|
|
850
862
|
"name": "type",
|
851
863
|
"privacy": "public",
|
852
864
|
"description": "Specifies the text style to be applied.\n\nAcceptable values include:\n\n- 'body-small-regular'\n- 'body-small-medium'\n- 'body-small-bold'\n- 'body-midsize-regular'\n- 'body-midsize-medium'\n- 'body-midsize-bold'\n- 'body-large-regular'\n- 'body-large-medium'\n- 'body-large-bold'\n- 'body-small-regular-underline'\n- 'body-small-medium-underline'\n- 'body-midsize-regular-underline'\n- 'body-midsize-medium-underline'\n- 'body-large-regular-underline'\n- 'body-large-medium-underline'\n- 'heading-small-regular'\n- 'heading-small-medium'\n- 'heading-small-bold'\n- 'heading-midsize-regular'\n- 'heading-midsize-medium'\n- 'heading-midsize-bold'\n- 'heading-large-regular'\n- 'heading-large-medium'\n- 'heading-large-bold'\n- 'heading-xlarge-regular'\n- 'heading-xlarge-medium'\n- 'heading-xlarge-bold'\n- 'headline-small-light'\n- 'headline-small-regular'",
|
865
|
+
"default": "body-large-regular",
|
853
866
|
"attribute": "type",
|
854
867
|
"reflects": true
|
855
868
|
},
|
@@ -866,6 +879,7 @@
|
|
866
879
|
{
|
867
880
|
"name": "type",
|
868
881
|
"description": "Specifies the text style to be applied.\n\nAcceptable values include:\n\n- 'body-small-regular'\n- 'body-small-medium'\n- 'body-small-bold'\n- 'body-midsize-regular'\n- 'body-midsize-medium'\n- 'body-midsize-bold'\n- 'body-large-regular'\n- 'body-large-medium'\n- 'body-large-bold'\n- 'body-small-regular-underline'\n- 'body-small-medium-underline'\n- 'body-midsize-regular-underline'\n- 'body-midsize-medium-underline'\n- 'body-large-regular-underline'\n- 'body-large-medium-underline'\n- 'heading-small-regular'\n- 'heading-small-medium'\n- 'heading-small-bold'\n- 'heading-midsize-regular'\n- 'heading-midsize-medium'\n- 'heading-midsize-bold'\n- 'heading-large-regular'\n- 'heading-large-medium'\n- 'heading-large-bold'\n- 'heading-xlarge-regular'\n- 'heading-xlarge-medium'\n- 'heading-xlarge-bold'\n- 'headline-small-light'\n- 'headline-small-regular'",
|
882
|
+
"default": "body-large-regular",
|
869
883
|
"fieldName": "type"
|
870
884
|
},
|
871
885
|
{
|
package/package.json
CHANGED