@momentum-design/components 0.106.7 → 0.107.0
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 +358 -349
- package/dist/browser/index.js.map +4 -4
- package/dist/components/alertchip/alertchip.component.d.ts +5 -0
- package/dist/components/alertchip/alertchip.component.js +5 -0
- package/dist/components/alertchip/alertchip.types.d.ts +9 -2
- package/dist/components/chip/chip.component.d.ts +7 -0
- package/dist/components/chip/chip.component.js +9 -2
- package/dist/components/chip/chip.constants.d.ts +1 -12
- package/dist/components/chip/chip.constants.js +1 -12
- package/dist/components/chip/chip.styles.js +1 -59
- package/dist/components/chip/chip.types.d.ts +9 -2
- package/dist/components/filterchip/filterchip.component.d.ts +13 -0
- package/dist/components/filterchip/filterchip.component.js +13 -0
- package/dist/components/filterchip/filterchip.types.d.ts +9 -0
- package/dist/components/filterchip/filterchip.types.js +1 -0
- package/dist/components/inputchip/inputchip.component.d.ts +4 -0
- package/dist/components/inputchip/inputchip.component.js +5 -1
- package/dist/components/staticchip/index.d.ts +9 -0
- package/dist/components/staticchip/index.js +6 -0
- package/dist/components/staticchip/staticchip.component.d.ts +54 -0
- package/dist/components/staticchip/staticchip.component.js +89 -0
- package/dist/components/staticchip/staticchip.constants.d.ts +19 -0
- package/dist/components/staticchip/staticchip.constants.js +21 -0
- package/dist/components/staticchip/staticchip.styles.d.ts +2 -0
- package/dist/components/staticchip/staticchip.styles.js +66 -0
- package/dist/components/staticchip/staticchip.types.d.ts +4 -0
- package/dist/components/staticchip/staticchip.types.js +1 -0
- package/dist/custom-elements.json +497 -340
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/alertchip/index.d.ts +5 -0
- package/dist/react/alertchip/index.js +5 -0
- package/dist/react/chip/index.d.ts +7 -0
- package/dist/react/chip/index.js +7 -0
- package/dist/react/filterchip/index.d.ts +13 -0
- package/dist/react/filterchip/index.js +13 -0
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +2 -1
- package/dist/react/inputchip/index.d.ts +4 -0
- package/dist/react/inputchip/index.js +4 -0
- package/dist/react/staticchip/index.d.ts +20 -0
- package/dist/react/staticchip/index.js +29 -0
- package/package.json +1 -1
@@ -21,6 +21,11 @@ import type { VariantType } from './alertchip.types';
|
|
21
21
|
*
|
22
22
|
* @csspart icon - The alert icon
|
23
23
|
* @csspart label - The text label of the alertchip
|
24
|
+
*
|
25
|
+
* @event click - (React: onClick) This event is dispatched when the chip is clicked.
|
26
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the chip.
|
27
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the chip.
|
28
|
+
* @event focus - (React: onFocus) This event is dispatched when the chip receives focus.
|
24
29
|
*/
|
25
30
|
declare class AlertChip extends Buttonsimple {
|
26
31
|
/**
|
@@ -34,6 +34,11 @@ import { getAlertIcon } from './alertchip.utils';
|
|
34
34
|
*
|
35
35
|
* @csspart icon - The alert icon
|
36
36
|
* @csspart label - The text label of the alertchip
|
37
|
+
*
|
38
|
+
* @event click - (React: onClick) This event is dispatched when the chip is clicked.
|
39
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the chip.
|
40
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the chip.
|
41
|
+
* @event focus - (React: onFocus) This event is dispatched when the chip receives focus.
|
37
42
|
*/
|
38
43
|
class AlertChip extends Buttonsimple {
|
39
44
|
constructor() {
|
@@ -1,6 +1,13 @@
|
|
1
|
-
import type { ValueOf } from '../../utils/types';
|
1
|
+
import type { OverrideEventTarget, ValueOf } from '../../utils/types';
|
2
2
|
import type { IconNames } from '../icon/icon.types';
|
3
|
+
import type AlertChip from './alertchip.component';
|
3
4
|
import { VARIANTS } from './alertchip.constants';
|
4
5
|
type VariantType = ValueOf<typeof VARIANTS>;
|
5
6
|
type IconListType = Extract<IconNames, 'error-legacy-badge-filled' | 'warning-badge-filled' | 'check-circle-badge-filled' | 'dnd-presence-badge-filled' | 'info-badge-filled'>;
|
6
|
-
|
7
|
+
interface Events {
|
8
|
+
onClickEvent: OverrideEventTarget<MouseEvent, AlertChip>;
|
9
|
+
onKeyDownEvent: OverrideEventTarget<KeyboardEvent, AlertChip>;
|
10
|
+
onKeyUpEvent: OverrideEventTarget<KeyboardEvent, AlertChip>;
|
11
|
+
onFocusEvent: OverrideEventTarget<FocusEvent, AlertChip>;
|
12
|
+
}
|
13
|
+
export type { VariantType, IconListType, Events };
|
@@ -21,6 +21,13 @@ declare const Chip_base: import("../../utils/mixins/index.types").Constructor<im
|
|
21
21
|
* @cssproperty --mdc-chip-border-color - The border color of the chip.
|
22
22
|
* @cssproperty --mdc-chip-background-color - The background color of the chip.
|
23
23
|
*
|
24
|
+
* @csspart label - The label part of the chip.
|
25
|
+
*
|
26
|
+
* @event click - (React: onClick) This event is dispatched when the chip is clicked.
|
27
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the chip.
|
28
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the chip.
|
29
|
+
* @event focus - (React: onFocus) This event is dispatched when the chip receives focus.
|
30
|
+
*
|
24
31
|
*/
|
25
32
|
declare class Chip extends Chip_base {
|
26
33
|
/**
|
@@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
import { html, nothing } from 'lit';
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
12
|
import { IconNameMixin } from '../../utils/mixins/IconNameMixin';
|
13
|
-
import { Component } from '../../models';
|
14
13
|
import Buttonsimple from '../buttonsimple/buttonsimple.component';
|
14
|
+
import StaticChip from '../staticchip/staticchip.component';
|
15
15
|
import { DEFAULTS } from './chip.constants';
|
16
16
|
import styles from './chip.styles';
|
17
17
|
/**
|
@@ -33,6 +33,13 @@ import styles from './chip.styles';
|
|
33
33
|
* @cssproperty --mdc-chip-border-color - The border color of the chip.
|
34
34
|
* @cssproperty --mdc-chip-background-color - The background color of the chip.
|
35
35
|
*
|
36
|
+
* @csspart label - The label part of the chip.
|
37
|
+
*
|
38
|
+
* @event click - (React: onClick) This event is dispatched when the chip is clicked.
|
39
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the chip.
|
40
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the chip.
|
41
|
+
* @event focus - (React: onFocus) This event is dispatched when the chip receives focus.
|
42
|
+
*
|
36
43
|
*/
|
37
44
|
class Chip extends IconNameMixin(Buttonsimple) {
|
38
45
|
constructor() {
|
@@ -88,7 +95,7 @@ class Chip extends IconNameMixin(Buttonsimple) {
|
|
88
95
|
`;
|
89
96
|
}
|
90
97
|
}
|
91
|
-
Chip.styles = [...
|
98
|
+
Chip.styles = [...StaticChip.styles, ...styles];
|
92
99
|
__decorate([
|
93
100
|
property({ type: String, reflect: true }),
|
94
101
|
__metadata("design:type", String)
|
@@ -1,16 +1,5 @@
|
|
1
|
+
import { COLOR } from '../staticchip/staticchip.constants';
|
1
2
|
declare const TAG_NAME: "mdc-chip";
|
2
|
-
declare const COLOR: {
|
3
|
-
readonly DEFAULT: "default";
|
4
|
-
readonly COBALT: "cobalt";
|
5
|
-
readonly GOLD: "gold";
|
6
|
-
readonly LIME: "lime";
|
7
|
-
readonly MINT: "mint";
|
8
|
-
readonly ORANGE: "orange";
|
9
|
-
readonly PINK: "pink";
|
10
|
-
readonly PURPLE: "purple";
|
11
|
-
readonly SLATE: "slate";
|
12
|
-
readonly VIOLET: "violet";
|
13
|
-
};
|
14
3
|
declare const DEFAULTS: {
|
15
4
|
readonly COLOR: "default";
|
16
5
|
readonly TEXT_TYPE: "body-midsize-regular";
|
@@ -1,20 +1,9 @@
|
|
1
1
|
import { ROLE } from '../../utils/roles';
|
2
2
|
import utils from '../../utils/tag-name';
|
3
3
|
import { BUTTON_SIZES } from '../buttonsimple/buttonsimple.constants';
|
4
|
+
import { COLOR } from '../staticchip/staticchip.constants';
|
4
5
|
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
5
6
|
const TAG_NAME = utils.constructTagName('chip');
|
6
|
-
const COLOR = {
|
7
|
-
DEFAULT: 'default',
|
8
|
-
COBALT: 'cobalt',
|
9
|
-
GOLD: 'gold',
|
10
|
-
LIME: 'lime',
|
11
|
-
MINT: 'mint',
|
12
|
-
ORANGE: 'orange',
|
13
|
-
PINK: 'pink',
|
14
|
-
PURPLE: 'purple',
|
15
|
-
SLATE: 'slate',
|
16
|
-
VIOLET: 'violet',
|
17
|
-
};
|
18
7
|
const DEFAULTS = {
|
19
8
|
COLOR: COLOR.DEFAULT,
|
20
9
|
TEXT_TYPE: TYPE.BODY_MIDSIZE_REGULAR,
|
@@ -2,21 +2,8 @@ import { css } from 'lit';
|
|
2
2
|
import { hostFitContentStyles, hostFocusRingStyles } from '../../utils/styles';
|
3
3
|
const styles = css `
|
4
4
|
:host {
|
5
|
-
height: 1.5rem;
|
6
|
-
gap: 0.25rem;
|
7
|
-
padding: 0 0.5rem;
|
8
|
-
border-radius: 0.25rem;
|
9
|
-
border: 1px solid;
|
10
5
|
cursor: pointer;
|
11
|
-
|
12
|
-
|
13
|
-
--mdc-chip-color: var(--mds-color-theme-text-primary-normal);
|
14
|
-
--mdc-chip-border-color: var(--mds-color-theme-outline-button-normal);
|
15
|
-
--mdc-chip-background-color: var(--mds-color-theme-background-label-default-normal);
|
16
|
-
|
17
|
-
color: var(--mdc-chip-color);
|
18
|
-
border-color: var(--mdc-chip-border-color);
|
19
|
-
background-color: var(--mdc-chip-background-color);
|
6
|
+
height: 1.5rem;
|
20
7
|
}
|
21
8
|
|
22
9
|
:host([color='default']:hover) {
|
@@ -27,11 +14,6 @@ const styles = css `
|
|
27
14
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-default-active);
|
28
15
|
}
|
29
16
|
|
30
|
-
:host([color='cobalt']) {
|
31
|
-
--mdc-chip-border-color: var(--mds-color-theme-outline-theme-normal);
|
32
|
-
--mdc-chip-background-color: var(--mds-color-theme-background-label-cobalt-normal);
|
33
|
-
}
|
34
|
-
|
35
17
|
:host([color='cobalt']:hover) {
|
36
18
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-cobalt-hover);
|
37
19
|
}
|
@@ -40,11 +22,6 @@ const styles = css `
|
|
40
22
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-cobalt-active);
|
41
23
|
}
|
42
24
|
|
43
|
-
:host([color='gold']) {
|
44
|
-
--mdc-chip-border-color: var(--mds-color-theme-outline-label-gold);
|
45
|
-
--mdc-chip-background-color: var(--mds-color-theme-background-label-gold-normal);
|
46
|
-
}
|
47
|
-
|
48
25
|
:host([color='gold']:hover) {
|
49
26
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-gold-hover);
|
50
27
|
}
|
@@ -53,11 +30,6 @@ const styles = css `
|
|
53
30
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-gold-active);
|
54
31
|
}
|
55
32
|
|
56
|
-
:host([color='lime']) {
|
57
|
-
--mdc-chip-border-color: var(--mds-color-theme-outline-label-lime);
|
58
|
-
--mdc-chip-background-color: var(--mds-color-theme-background-label-lime-normal);
|
59
|
-
}
|
60
|
-
|
61
33
|
:host([color='lime']:hover) {
|
62
34
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-lime-hover);
|
63
35
|
}
|
@@ -66,11 +38,6 @@ const styles = css `
|
|
66
38
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-lime-active);
|
67
39
|
}
|
68
40
|
|
69
|
-
:host([color='mint']) {
|
70
|
-
--mdc-chip-border-color: var(--mds-color-theme-outline-label-mint);
|
71
|
-
--mdc-chip-background-color: var(--mds-color-theme-background-label-mint-normal);
|
72
|
-
}
|
73
|
-
|
74
41
|
:host([color='mint']:hover) {
|
75
42
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-mint-hover);
|
76
43
|
}
|
@@ -79,11 +46,6 @@ const styles = css `
|
|
79
46
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-mint-active);
|
80
47
|
}
|
81
48
|
|
82
|
-
:host([color='pink']) {
|
83
|
-
--mdc-chip-border-color: var(--mds-color-theme-outline-label-pink);
|
84
|
-
--mdc-chip-background-color: var(--mds-color-theme-background-label-pink-normal);
|
85
|
-
}
|
86
|
-
|
87
49
|
:host([color='pink']:hover) {
|
88
50
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-pink-hover);
|
89
51
|
}
|
@@ -92,11 +54,6 @@ const styles = css `
|
|
92
54
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-pink-active);
|
93
55
|
}
|
94
56
|
|
95
|
-
:host([color='purple']) {
|
96
|
-
--mdc-chip-border-color: var(--mds-color-theme-outline-label-purple);
|
97
|
-
--mdc-chip-background-color: var(--mds-color-theme-background-label-purple-normal);
|
98
|
-
}
|
99
|
-
|
100
57
|
:host([color='purple']:hover) {
|
101
58
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-purple-hover);
|
102
59
|
}
|
@@ -105,11 +62,6 @@ const styles = css `
|
|
105
62
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-purple-active);
|
106
63
|
}
|
107
64
|
|
108
|
-
:host([color='orange']) {
|
109
|
-
--mdc-chip-border-color: var(--mds-color-theme-outline-label-orange);
|
110
|
-
--mdc-chip-background-color: var(--mds-color-theme-background-label-orange-normal);
|
111
|
-
}
|
112
|
-
|
113
65
|
:host([color='orange']:hover) {
|
114
66
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-orange-hover);
|
115
67
|
}
|
@@ -118,11 +70,6 @@ const styles = css `
|
|
118
70
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-orange-active);
|
119
71
|
}
|
120
72
|
|
121
|
-
:host([color='slate']) {
|
122
|
-
--mdc-chip-border-color: var(--mds-color-theme-outline-label-slate);
|
123
|
-
--mdc-chip-background-color: var(--mds-color-theme-background-label-slate-normal);
|
124
|
-
}
|
125
|
-
|
126
73
|
:host([color='slate']:hover) {
|
127
74
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-slate-hover);
|
128
75
|
}
|
@@ -131,11 +78,6 @@ const styles = css `
|
|
131
78
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-slate-active);
|
132
79
|
}
|
133
80
|
|
134
|
-
:host([color='violet']) {
|
135
|
-
--mdc-chip-border-color: var(--mds-color-theme-outline-label-violet);
|
136
|
-
--mdc-chip-background-color: var(--mds-color-theme-background-label-violet-normal);
|
137
|
-
}
|
138
|
-
|
139
81
|
:host([color='violet']:hover) {
|
140
82
|
--mdc-chip-background-color: var(--mds-color-theme-background-label-violet-hover);
|
141
83
|
}
|
@@ -1,4 +1,11 @@
|
|
1
|
-
import type { ValueOf } from '../../utils/types';
|
1
|
+
import type { OverrideEventTarget, ValueOf } from '../../utils/types';
|
2
|
+
import type Chip from './chip.component';
|
2
3
|
import { COLOR } from './chip.constants';
|
3
4
|
type ColorType = ValueOf<typeof COLOR>;
|
4
|
-
|
5
|
+
interface Events {
|
6
|
+
onClickEvent: OverrideEventTarget<MouseEvent, Chip>;
|
7
|
+
onKeyDownEvent: OverrideEventTarget<KeyboardEvent, Chip>;
|
8
|
+
onKeyUpEvent: OverrideEventTarget<KeyboardEvent, Chip>;
|
9
|
+
onFocusEvent: OverrideEventTarget<FocusEvent, Chip>;
|
10
|
+
}
|
11
|
+
export type { ColorType, Events };
|
@@ -8,6 +8,19 @@ import Chip from '../chip/chip.component';
|
|
8
8
|
*
|
9
9
|
* @tagname mdc-filterchip
|
10
10
|
*
|
11
|
+
* @dependency mdc-icon
|
12
|
+
* @dependency mdc-text
|
13
|
+
*
|
14
|
+
* @csspart label - The label part of the chip.
|
15
|
+
*
|
16
|
+
* @cssproperty --mdc-chip-color - The color of the chip.
|
17
|
+
* @cssproperty --mdc-chip-border-color - The border color of the chip.
|
18
|
+
* @cssproperty --mdc-chip-background-color - The background color of the chip.
|
19
|
+
*
|
20
|
+
* @event click - (React: onClick) This event is dispatched when the chip is clicked.
|
21
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the chip.
|
22
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the chip.
|
23
|
+
* @event focus - (React: onFocus) This event is dispatched when the chip receives focus.
|
11
24
|
*/
|
12
25
|
declare class FilterChip extends Chip {
|
13
26
|
/**
|
@@ -19,6 +19,19 @@ import { DEFAULTS } from './filterchip.constants';
|
|
19
19
|
*
|
20
20
|
* @tagname mdc-filterchip
|
21
21
|
*
|
22
|
+
* @dependency mdc-icon
|
23
|
+
* @dependency mdc-text
|
24
|
+
*
|
25
|
+
* @csspart label - The label part of the chip.
|
26
|
+
*
|
27
|
+
* @cssproperty --mdc-chip-color - The color of the chip.
|
28
|
+
* @cssproperty --mdc-chip-border-color - The border color of the chip.
|
29
|
+
* @cssproperty --mdc-chip-background-color - The background color of the chip.
|
30
|
+
*
|
31
|
+
* @event click - (React: onClick) This event is dispatched when the chip is clicked.
|
32
|
+
* @event keydown - (React: onKeyDown) This event is dispatched when a key is pressed down on the chip.
|
33
|
+
* @event keyup - (React: onKeyUp) This event is dispatched when a key is released on the chip.
|
34
|
+
* @event focus - (React: onFocus) This event is dispatched when the chip receives focus.
|
22
35
|
*/
|
23
36
|
class FilterChip extends Chip {
|
24
37
|
constructor() {
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { OverrideEventTarget } from '../../utils/types';
|
2
|
+
import type FilterChip from './filterchip.component';
|
3
|
+
interface Events {
|
4
|
+
onClickEvent: OverrideEventTarget<MouseEvent, FilterChip>;
|
5
|
+
onKeyDownEvent: OverrideEventTarget<KeyboardEvent, FilterChip>;
|
6
|
+
onKeyUpEvent: OverrideEventTarget<KeyboardEvent, FilterChip>;
|
7
|
+
onFocusEvent: OverrideEventTarget<FocusEvent, FilterChip>;
|
8
|
+
}
|
9
|
+
export type { Events };
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -16,6 +16,10 @@ declare const InputChip_base: import("../../utils/mixins/index.types").Construct
|
|
16
16
|
*
|
17
17
|
* @event remove - This event is dispatched when the close button is activated. It bubbles and is composed.
|
18
18
|
*
|
19
|
+
* @csspart label - The label part of the chip.
|
20
|
+
* @csspart icon - The icon part of the chip.
|
21
|
+
* @csspart close-icon - The close icon part of the chip.
|
22
|
+
*
|
19
23
|
* @cssproperty --mdc-chip-color - The color of the chip.
|
20
24
|
* @cssproperty --mdc-chip-border-color - The border color of the chip.
|
21
25
|
* @cssproperty --mdc-chip-background-color - The background color of the chip.
|
@@ -29,6 +29,10 @@ import { DEFAULTS } from './inputchip.constants';
|
|
29
29
|
*
|
30
30
|
* @event remove - This event is dispatched when the close button is activated. It bubbles and is composed.
|
31
31
|
*
|
32
|
+
* @csspart label - The label part of the chip.
|
33
|
+
* @csspart icon - The icon part of the chip.
|
34
|
+
* @csspart close-icon - The close icon part of the chip.
|
35
|
+
*
|
32
36
|
* @cssproperty --mdc-chip-color - The color of the chip.
|
33
37
|
* @cssproperty --mdc-chip-border-color - The border color of the chip.
|
34
38
|
* @cssproperty --mdc-chip-background-color - The background color of the chip.
|
@@ -62,7 +66,7 @@ class InputChip extends IconNameMixin(DisabledMixin(Component)) {
|
|
62
66
|
renderIcon() {
|
63
67
|
if (!this.iconName)
|
64
68
|
return nothing;
|
65
|
-
return html ` <mdc-icon name="${this.iconName}" length-unit="rem" size="1"></mdc-icon> `;
|
69
|
+
return html ` <mdc-icon part="icon" name="${this.iconName}" length-unit="rem" size="1"></mdc-icon> `;
|
66
70
|
}
|
67
71
|
/**
|
68
72
|
* Handles the behavior of the close button on click event.
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import { CSSResult } from 'lit';
|
2
|
+
import { Component } from '../../models';
|
3
|
+
import type { ColorType } from './staticchip.types';
|
4
|
+
declare const StaticChip_base: import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/IconNameMixin").IconNameMixinInterface> & typeof Component;
|
5
|
+
/**
|
6
|
+
* mdc-staticchip is an static element that can be used to represent a chip. It supports a leading icon along with label.
|
7
|
+
*
|
8
|
+
* It is recommended to keep the label text for the chip component concise and compact.
|
9
|
+
* For best results, we recommend limiting the <b>maximum length of the label text to 20 characters</b>, including empty spaces to split words.
|
10
|
+
*
|
11
|
+
*
|
12
|
+
* @tagname mdc-staticchip
|
13
|
+
*
|
14
|
+
* @dependency mdc-icon
|
15
|
+
* @dependency mdc-text
|
16
|
+
*
|
17
|
+
* @cssproperty --mdc-chip-color - The color of the static chip.
|
18
|
+
* @cssproperty --mdc-chip-border-color - The border color of the static chip.
|
19
|
+
* @cssproperty --mdc-chip-background-color - The background color of the static chip.
|
20
|
+
*
|
21
|
+
*/
|
22
|
+
declare class StaticChip extends StaticChip_base {
|
23
|
+
/**
|
24
|
+
* The color of the chip. It supports the following colors
|
25
|
+
* - default
|
26
|
+
* - cobalt
|
27
|
+
* - gold
|
28
|
+
* - lime
|
29
|
+
* - mint
|
30
|
+
* - orange
|
31
|
+
* - pink
|
32
|
+
* - purple
|
33
|
+
* - slate
|
34
|
+
* - violet
|
35
|
+
*
|
36
|
+
* @default default
|
37
|
+
*/
|
38
|
+
color: ColorType;
|
39
|
+
/**
|
40
|
+
* The visible label text of the chip.
|
41
|
+
*
|
42
|
+
* We recommend limiting the <b>maximum length of the label text to 20 characters</b>,
|
43
|
+
* including empty spaces to split words.
|
44
|
+
*/
|
45
|
+
label: string;
|
46
|
+
/**
|
47
|
+
* Renders the icon element if available.
|
48
|
+
* @returns The icon element if available, otherwise nothing.
|
49
|
+
*/
|
50
|
+
private renderIcon;
|
51
|
+
render(): import("lit-html").TemplateResult<1>;
|
52
|
+
static styles: Array<CSSResult>;
|
53
|
+
}
|
54
|
+
export default StaticChip;
|
@@ -0,0 +1,89 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
import { html, nothing } from 'lit';
|
11
|
+
import { property } from 'lit/decorators.js';
|
12
|
+
import { IconNameMixin } from '../../utils/mixins/IconNameMixin';
|
13
|
+
import { Component } from '../../models';
|
14
|
+
import { DEFAULTS } from './staticchip.constants';
|
15
|
+
import styles from './staticchip.styles';
|
16
|
+
/**
|
17
|
+
* mdc-staticchip is an static element that can be used to represent a chip. It supports a leading icon along with label.
|
18
|
+
*
|
19
|
+
* It is recommended to keep the label text for the chip component concise and compact.
|
20
|
+
* For best results, we recommend limiting the <b>maximum length of the label text to 20 characters</b>, including empty spaces to split words.
|
21
|
+
*
|
22
|
+
*
|
23
|
+
* @tagname mdc-staticchip
|
24
|
+
*
|
25
|
+
* @dependency mdc-icon
|
26
|
+
* @dependency mdc-text
|
27
|
+
*
|
28
|
+
* @cssproperty --mdc-chip-color - The color of the static chip.
|
29
|
+
* @cssproperty --mdc-chip-border-color - The border color of the static chip.
|
30
|
+
* @cssproperty --mdc-chip-background-color - The background color of the static chip.
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
class StaticChip extends IconNameMixin(Component) {
|
34
|
+
constructor() {
|
35
|
+
super(...arguments);
|
36
|
+
/**
|
37
|
+
* The color of the chip. It supports the following colors
|
38
|
+
* - default
|
39
|
+
* - cobalt
|
40
|
+
* - gold
|
41
|
+
* - lime
|
42
|
+
* - mint
|
43
|
+
* - orange
|
44
|
+
* - pink
|
45
|
+
* - purple
|
46
|
+
* - slate
|
47
|
+
* - violet
|
48
|
+
*
|
49
|
+
* @default default
|
50
|
+
*/
|
51
|
+
this.color = DEFAULTS.COLOR;
|
52
|
+
/**
|
53
|
+
* The visible label text of the chip.
|
54
|
+
*
|
55
|
+
* We recommend limiting the <b>maximum length of the label text to 20 characters</b>,
|
56
|
+
* including empty spaces to split words.
|
57
|
+
*/
|
58
|
+
this.label = '';
|
59
|
+
}
|
60
|
+
/**
|
61
|
+
* Renders the icon element if available.
|
62
|
+
* @returns The icon element if available, otherwise nothing.
|
63
|
+
*/
|
64
|
+
renderIcon() {
|
65
|
+
if (!this.iconName)
|
66
|
+
return nothing;
|
67
|
+
return html ` <mdc-icon name="${this.iconName}" length-unit="rem" size="1"></mdc-icon> `;
|
68
|
+
}
|
69
|
+
render() {
|
70
|
+
return html `
|
71
|
+
${this.renderIcon()}
|
72
|
+
${this.label
|
73
|
+
? html `<mdc-text part="label" type="${DEFAULTS.TEXT_TYPE}" tagname="${DEFAULTS.TAG_NAME}"
|
74
|
+
>${this.label}</mdc-text
|
75
|
+
>`
|
76
|
+
: nothing}
|
77
|
+
`;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
StaticChip.styles = [...Component.styles, ...styles];
|
81
|
+
__decorate([
|
82
|
+
property({ type: String, reflect: true }),
|
83
|
+
__metadata("design:type", String)
|
84
|
+
], StaticChip.prototype, "color", void 0);
|
85
|
+
__decorate([
|
86
|
+
property({ type: String }),
|
87
|
+
__metadata("design:type", Object)
|
88
|
+
], StaticChip.prototype, "label", void 0);
|
89
|
+
export default StaticChip;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
declare const TAG_NAME: "mdc-staticchip";
|
2
|
+
declare const COLOR: {
|
3
|
+
readonly DEFAULT: "default";
|
4
|
+
readonly COBALT: "cobalt";
|
5
|
+
readonly GOLD: "gold";
|
6
|
+
readonly LIME: "lime";
|
7
|
+
readonly MINT: "mint";
|
8
|
+
readonly ORANGE: "orange";
|
9
|
+
readonly PINK: "pink";
|
10
|
+
readonly PURPLE: "purple";
|
11
|
+
readonly SLATE: "slate";
|
12
|
+
readonly VIOLET: "violet";
|
13
|
+
};
|
14
|
+
declare const DEFAULTS: {
|
15
|
+
readonly COLOR: "default";
|
16
|
+
readonly TEXT_TYPE: "body-midsize-regular";
|
17
|
+
readonly TAG_NAME: "span";
|
18
|
+
};
|
19
|
+
export { TAG_NAME, COLOR, DEFAULTS };
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import utils from '../../utils/tag-name';
|
2
|
+
import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
|
3
|
+
const TAG_NAME = utils.constructTagName('staticchip');
|
4
|
+
const COLOR = {
|
5
|
+
DEFAULT: 'default',
|
6
|
+
COBALT: 'cobalt',
|
7
|
+
GOLD: 'gold',
|
8
|
+
LIME: 'lime',
|
9
|
+
MINT: 'mint',
|
10
|
+
ORANGE: 'orange',
|
11
|
+
PINK: 'pink',
|
12
|
+
PURPLE: 'purple',
|
13
|
+
SLATE: 'slate',
|
14
|
+
VIOLET: 'violet',
|
15
|
+
};
|
16
|
+
const DEFAULTS = {
|
17
|
+
COLOR: COLOR.DEFAULT,
|
18
|
+
TEXT_TYPE: TYPE.BODY_MIDSIZE_REGULAR,
|
19
|
+
TAG_NAME: VALID_TEXT_TAGS.SPAN,
|
20
|
+
};
|
21
|
+
export { TAG_NAME, COLOR, DEFAULTS };
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
import { hostFitContentStyles } from '../../utils/styles';
|
3
|
+
const styles = css `
|
4
|
+
:host {
|
5
|
+
height: 1.5rem;
|
6
|
+
gap: 0.25rem;
|
7
|
+
padding: 0 0.5rem;
|
8
|
+
border-radius: 0.25rem;
|
9
|
+
border: 1px solid;
|
10
|
+
white-space: nowrap;
|
11
|
+
|
12
|
+
--mdc-chip-color: var(--mds-color-theme-text-primary-normal);
|
13
|
+
--mdc-chip-border-color: var(--mds-color-theme-outline-button-normal);
|
14
|
+
--mdc-chip-background-color: var(--mds-color-theme-background-label-default-normal);
|
15
|
+
|
16
|
+
color: var(--mdc-chip-color);
|
17
|
+
border-color: var(--mdc-chip-border-color);
|
18
|
+
background-color: var(--mdc-chip-background-color);
|
19
|
+
}
|
20
|
+
|
21
|
+
:host([color='cobalt']) {
|
22
|
+
--mdc-chip-border-color: var(--mds-color-theme-outline-theme-normal);
|
23
|
+
--mdc-chip-background-color: var(--mds-color-theme-background-label-cobalt-normal);
|
24
|
+
}
|
25
|
+
|
26
|
+
:host([color='gold']) {
|
27
|
+
--mdc-chip-border-color: var(--mds-color-theme-outline-label-gold);
|
28
|
+
--mdc-chip-background-color: var(--mds-color-theme-background-label-gold-normal);
|
29
|
+
}
|
30
|
+
|
31
|
+
:host([color='lime']) {
|
32
|
+
--mdc-chip-border-color: var(--mds-color-theme-outline-label-lime);
|
33
|
+
--mdc-chip-background-color: var(--mds-color-theme-background-label-lime-normal);
|
34
|
+
}
|
35
|
+
|
36
|
+
:host([color='mint']) {
|
37
|
+
--mdc-chip-border-color: var(--mds-color-theme-outline-label-mint);
|
38
|
+
--mdc-chip-background-color: var(--mds-color-theme-background-label-mint-normal);
|
39
|
+
}
|
40
|
+
|
41
|
+
:host([color='pink']) {
|
42
|
+
--mdc-chip-border-color: var(--mds-color-theme-outline-label-pink);
|
43
|
+
--mdc-chip-background-color: var(--mds-color-theme-background-label-pink-normal);
|
44
|
+
}
|
45
|
+
|
46
|
+
:host([color='purple']) {
|
47
|
+
--mdc-chip-border-color: var(--mds-color-theme-outline-label-purple);
|
48
|
+
--mdc-chip-background-color: var(--mds-color-theme-background-label-purple-normal);
|
49
|
+
}
|
50
|
+
|
51
|
+
:host([color='orange']) {
|
52
|
+
--mdc-chip-border-color: var(--mds-color-theme-outline-label-orange);
|
53
|
+
--mdc-chip-background-color: var(--mds-color-theme-background-label-orange-normal);
|
54
|
+
}
|
55
|
+
|
56
|
+
:host([color='slate']) {
|
57
|
+
--mdc-chip-border-color: var(--mds-color-theme-outline-label-slate);
|
58
|
+
--mdc-chip-background-color: var(--mds-color-theme-background-label-slate-normal);
|
59
|
+
}
|
60
|
+
|
61
|
+
:host([color='violet']) {
|
62
|
+
--mdc-chip-border-color: var(--mds-color-theme-outline-label-violet);
|
63
|
+
--mdc-chip-background-color: var(--mds-color-theme-background-label-violet-normal);
|
64
|
+
}
|
65
|
+
`;
|
66
|
+
export default [hostFitContentStyles, styles];
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|