@momentum-design/components 0.106.8 → 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.
@@ -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
  /**
@@ -95,7 +95,7 @@ class Chip extends IconNameMixin(Buttonsimple) {
95
95
  `;
96
96
  }
97
97
  }
98
- Chip.styles = [...Component.styles, ...styles];
98
+ Chip.styles = [...StaticChip.styles, ...styles];
99
99
  __decorate([
100
100
  property({ type: String, reflect: true }),
101
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
- white-space: nowrap;
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
  }
@@ -0,0 +1,9 @@
1
+ import StaticChip from './staticchip.component';
2
+ import '../text';
3
+ import '../icon';
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ ['mdc-staticchip']: StaticChip;
7
+ }
8
+ }
9
+ export default StaticChip;
@@ -0,0 +1,6 @@
1
+ import StaticChip from './staticchip.component';
2
+ import { TAG_NAME } from './staticchip.constants';
3
+ import '../text';
4
+ import '../icon';
5
+ StaticChip.register(TAG_NAME);
6
+ export default StaticChip;
@@ -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,2 @@
1
+ declare const _default: import("lit").CSSResult[];
2
+ export default _default;
@@ -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,4 @@
1
+ import type { ValueOf } from '../../utils/types';
2
+ import { COLOR } from './staticchip.constants';
3
+ type ColorType = ValueOf<typeof COLOR>;
4
+ export type { ColorType };
@@ -0,0 +1 @@
1
+ export {};