@momentum-design/components 0.4.13 → 0.4.15

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.
Files changed (62) hide show
  1. package/dist/browser/index.js +86 -31
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/avatar/avatar.component.js +38 -32
  4. package/dist/components/avatar/avatar.constants.js +3 -9
  5. package/dist/components/avatar/avatar.styles.js +3 -5
  6. package/dist/components/avatar/avatar.types.js +1 -2
  7. package/dist/components/avatar/index.js +4 -7
  8. package/dist/components/badge/badge.component.d.ts +74 -29
  9. package/dist/components/badge/badge.component.js +182 -88
  10. package/dist/components/badge/badge.constants.d.ts +28 -4
  11. package/dist/components/badge/badge.constants.js +30 -12
  12. package/dist/components/badge/badge.styles.js +59 -19
  13. package/dist/components/badge/index.d.ts +2 -0
  14. package/dist/components/badge/index.js +6 -7
  15. package/dist/components/icon/icon.component.js +46 -40
  16. package/dist/components/icon/icon.constants.js +3 -8
  17. package/dist/components/icon/icon.styles.js +5 -7
  18. package/dist/components/icon/icon.utils.js +1 -4
  19. package/dist/components/icon/index.js +4 -7
  20. package/dist/components/iconprovider/iconprovider.component.js +39 -33
  21. package/dist/components/iconprovider/iconprovider.constants.js +3 -10
  22. package/dist/components/iconprovider/iconprovider.context.js +4 -6
  23. package/dist/components/iconprovider/index.js +4 -7
  24. package/dist/components/text/fonts.styles.js +2 -5
  25. package/dist/components/text/index.js +4 -7
  26. package/dist/components/text/text.component.js +35 -29
  27. package/dist/components/text/text.constants.js +3 -9
  28. package/dist/components/text/text.styles.js +5 -7
  29. package/dist/components/text/text.types.js +1 -2
  30. package/dist/components/themeprovider/index.js +4 -7
  31. package/dist/components/themeprovider/themeprovider.component.js +27 -21
  32. package/dist/components/themeprovider/themeprovider.constants.js +3 -8
  33. package/dist/components/themeprovider/themeprovider.context.js +4 -6
  34. package/dist/components/themeprovider/themeprovider.styles.js +3 -5
  35. package/dist/custom-elements.json +230 -51
  36. package/dist/index.js +7 -16
  37. package/dist/models/component/component.component.js +5 -8
  38. package/dist/models/component/component.styles.js +2 -4
  39. package/dist/models/component/component.types.js +1 -2
  40. package/dist/models/component/index.js +2 -5
  41. package/dist/models/index.js +3 -8
  42. package/dist/models/provider/index.js +2 -5
  43. package/dist/models/provider/provider.component.js +9 -12
  44. package/dist/models/provider/provider.styles.js +3 -5
  45. package/dist/react/avatar/index.js +8 -11
  46. package/dist/react/badge/index.d.ts +6 -3
  47. package/dist/react/badge/index.js +14 -14
  48. package/dist/react/icon/index.js +8 -11
  49. package/dist/react/iconprovider/index.js +8 -11
  50. package/dist/react/index.js +6 -18
  51. package/dist/react/text/index.js +8 -11
  52. package/dist/react/themeprovider/index.js +8 -11
  53. package/dist/utils/mixins/DisabledMixin.js +14 -10
  54. package/dist/utils/mixins/TabIndexMixin.js +14 -10
  55. package/dist/utils/provider/index.js +3 -5
  56. package/dist/utils/styles/index.js +4 -8
  57. package/dist/utils/tag-name/constants.js +1 -3
  58. package/dist/utils/tag-name/index.js +3 -6
  59. package/dist/utils/types.js +1 -2
  60. package/package.json +1 -1
  61. package/dist/components/badge/badge.types.d.ts +0 -1
  62. package/dist/components/badge/badge.types.js +0 -2
@@ -1,11 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const lit_1 = require("lit");
5
- const decorators_js_1 = require("lit/decorators.js");
6
- const text_styles_1 = tslib_1.__importDefault(require("./text.styles"));
7
- const models_1 = require("../../models");
8
- const text_constants_1 = require("./text.constants");
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 } from 'lit';
11
+ import { property } from 'lit/decorators.js';
12
+ import styles from './text.styles';
13
+ import { Component } from '../../models';
14
+ import { DEFAULTS } from './text.constants';
9
15
  /**
10
16
  * Text component for creating styled text elements.
11
17
  * It has to be mounted within the ThemeProvider to access color and font tokens.
@@ -24,7 +30,7 @@ const text_constants_1 = require("./text.constants");
24
30
  *
25
31
  * @csspart text - The text element
26
32
  */
27
- class Text extends models_1.Component {
33
+ class Text extends Component {
28
34
  constructor() {
29
35
  super(...arguments);
30
36
  /**
@@ -62,7 +68,7 @@ class Text extends models_1.Component {
62
68
  * - 'headline-small-light'
63
69
  * - 'headline-small-regular'
64
70
  */
65
- this.type = text_constants_1.DEFAULTS.TYPE;
71
+ this.type = DEFAULTS.TYPE;
66
72
  /**
67
73
  * Specifies the HTML tag name for the text element. The default tag name is `p`.
68
74
  * This attribute is optional. When set, it changes the tag name of the text element.
@@ -83,33 +89,33 @@ class Text extends models_1.Component {
83
89
  * For instance, setting this attribute to `h2` will render the text element as an `h2` element.
84
90
  * Note that the styling is determined by the `type` attribute.
85
91
  */
86
- this.tagname = text_constants_1.DEFAULTS.TEXT_ELEMENT_TAGNAME;
92
+ this.tagname = DEFAULTS.TEXT_ELEMENT_TAGNAME;
87
93
  }
88
94
  render() {
89
95
  // Lit does not support dynamically changing values for the tag name of a custom element.
90
96
  // Read more: https://lit.dev/docs/templates/expressions/#invalid-locations
91
97
  switch (this.tagname) {
92
- case 'h1': return (0, lit_1.html) `<h1 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h1>`;
93
- case 'h2': return (0, lit_1.html) `<h2 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h2>`;
94
- case 'h3': return (0, lit_1.html) `<h3 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h3>`;
95
- case 'h4': return (0, lit_1.html) `<h4 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h4>`;
96
- case 'h5': return (0, lit_1.html) `<h5 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h5>`;
97
- case 'h6': return (0, lit_1.html) `<h6 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h6>`;
98
- case 'div': return (0, lit_1.html) `<div part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></div>`;
99
- case 'span': return (0, lit_1.html) `<span part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></span>`;
100
- case 'small': return (0, lit_1.html) `<small part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></small>`;
98
+ case 'h1': return html `<h1 part=${DEFAULTS.CSS_PART_TEXT}><slot></slot></h1>`;
99
+ case 'h2': return html `<h2 part=${DEFAULTS.CSS_PART_TEXT}><slot></slot></h2>`;
100
+ case 'h3': return html `<h3 part=${DEFAULTS.CSS_PART_TEXT}><slot></slot></h3>`;
101
+ case 'h4': return html `<h4 part=${DEFAULTS.CSS_PART_TEXT}><slot></slot></h4>`;
102
+ case 'h5': return html `<h5 part=${DEFAULTS.CSS_PART_TEXT}><slot></slot></h5>`;
103
+ case 'h6': return html `<h6 part=${DEFAULTS.CSS_PART_TEXT}><slot></slot></h6>`;
104
+ case 'div': return html `<div part=${DEFAULTS.CSS_PART_TEXT}><slot></slot></div>`;
105
+ case 'span': return html `<span part=${DEFAULTS.CSS_PART_TEXT}><slot></slot></span>`;
106
+ case 'small': return html `<small part=${DEFAULTS.CSS_PART_TEXT}><slot></slot></small>`;
101
107
  case 'p':
102
- default: return (0, lit_1.html) `<p part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></p>`;
108
+ default: return html `<p part=${DEFAULTS.CSS_PART_TEXT}><slot></slot></p>`;
103
109
  }
104
110
  }
105
111
  }
106
- Text.styles = [...models_1.Component.styles, ...text_styles_1.default];
107
- tslib_1.__decorate([
108
- (0, decorators_js_1.property)({ attribute: 'type', reflect: true, type: String }),
109
- tslib_1.__metadata("design:type", String)
112
+ Text.styles = [...Component.styles, ...styles];
113
+ __decorate([
114
+ property({ attribute: 'type', reflect: true, type: String }),
115
+ __metadata("design:type", String)
110
116
  ], Text.prototype, "type", void 0);
111
- tslib_1.__decorate([
112
- (0, decorators_js_1.property)({ attribute: 'tagname', reflect: true, type: String }),
113
- tslib_1.__metadata("design:type", String)
117
+ __decorate([
118
+ property({ attribute: 'tagname', reflect: true, type: String }),
119
+ __metadata("design:type", String)
114
120
  ], Text.prototype, "tagname", void 0);
115
- exports.default = Text;
121
+ export default Text;
@@ -1,10 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VALUES = exports.DEFAULTS = exports.TAG_NAME = void 0;
4
- const tslib_1 = require("tslib");
5
- const tag_name_1 = tslib_1.__importDefault(require("../../utils/tag-name"));
6
- const TAG_NAME = tag_name_1.default.constructTagName('text');
7
- exports.TAG_NAME = TAG_NAME;
1
+ import utils from '../../utils/tag-name';
2
+ const TAG_NAME = utils.constructTagName('text');
8
3
  const VALUES = {
9
4
  TYPE: [
10
5
  'body-small-regular',
@@ -50,10 +45,9 @@ const VALUES = {
50
45
  'div',
51
46
  ],
52
47
  };
53
- exports.VALUES = VALUES;
54
48
  const DEFAULTS = {
55
49
  TYPE: 'body-midsize-regular',
56
50
  TEXT_ELEMENT_TAGNAME: 'p',
57
51
  CSS_PART_TEXT: 'text',
58
52
  };
59
- exports.DEFAULTS = DEFAULTS;
53
+ export { TAG_NAME, DEFAULTS, VALUES };
@@ -1,9 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const lit_1 = require("lit");
4
- const fonts_styles_1 = require("./fonts.styles");
1
+ import { css } from 'lit';
2
+ import { fontsStyles } from './fonts.styles';
5
3
  const styles = [
6
- (0, lit_1.css) `
4
+ css `
7
5
  :host {
8
6
  --mdc-text-font-family: var(--mdc-themeprovider-font-family);
9
7
 
@@ -12,6 +10,6 @@ const styles = [
12
10
  }
13
11
  `,
14
12
  // type specific font styles:
15
- fonts_styles_1.fontsStyles,
13
+ fontsStyles,
16
14
  ];
17
- exports.default = styles;
15
+ export default styles;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const themeprovider_component_1 = tslib_1.__importDefault(require("./themeprovider.component"));
5
- const themeprovider_constants_1 = require("./themeprovider.constants");
6
- themeprovider_component_1.default.register(themeprovider_constants_1.TAG_NAME);
7
- exports.default = themeprovider_component_1.default;
1
+ import ThemeProvider from './themeprovider.component';
2
+ import { TAG_NAME } from './themeprovider.constants';
3
+ ThemeProvider.register(TAG_NAME);
4
+ export default ThemeProvider;
@@ -1,11 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const decorators_js_1 = require("lit/decorators.js");
5
- const themeprovider_constants_1 = require("./themeprovider.constants");
6
- const models_1 = require("../../models");
7
- const themeprovider_context_1 = tslib_1.__importDefault(require("./themeprovider.context"));
8
- const themeprovider_styles_1 = tslib_1.__importDefault(require("./themeprovider.styles"));
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 { property, state } from 'lit/decorators.js';
11
+ import { DEFAULTS } from './themeprovider.constants';
12
+ import { Provider } from '../../models';
13
+ import ThemeProviderContext from './themeprovider.context';
14
+ import styles from './themeprovider.styles';
9
15
  /**
10
16
  * ThemeProvider component, which sets the passed in themeclass as class.
11
17
  * If the themeclass switches, the existing themeclass will be removed as a class
@@ -30,11 +36,11 @@ const themeprovider_styles_1 = tslib_1.__importDefault(require("./themeprovider.
30
36
  * @cssproperty --mdc-themeprovider-letter-spacing-adjustment - Option to override the default letter-spacing,
31
37
  * default: `-0.25px` (this is to match the old CiscoSans)
32
38
  */
33
- class ThemeProvider extends models_1.Provider {
39
+ class ThemeProvider extends Provider {
34
40
  constructor() {
35
41
  super({
36
- context: themeprovider_context_1.default.context,
37
- initialValue: new themeprovider_context_1.default(themeprovider_constants_1.DEFAULTS.THEMECLASS),
42
+ context: ThemeProviderContext.context,
43
+ initialValue: new ThemeProviderContext(DEFAULTS.THEMECLASS),
38
44
  });
39
45
  /**
40
46
  * Current theme class
@@ -45,13 +51,13 @@ class ThemeProvider extends models_1.Provider {
45
51
  *
46
52
  * Default: 'mds-theme-stable-darkWebex'
47
53
  */
48
- this.themeclass = themeprovider_constants_1.DEFAULTS.THEMECLASS;
54
+ this.themeclass = DEFAULTS.THEMECLASS;
49
55
  }
50
56
  /**
51
57
  * Context object of the ThemeProvider, to be consumed by child components
52
58
  */
53
59
  static get Context() {
54
- return themeprovider_context_1.default.context;
60
+ return ThemeProviderContext.context;
55
61
  }
56
62
  updated(changedProperties) {
57
63
  super.updated(changedProperties);
@@ -87,13 +93,13 @@ class ThemeProvider extends models_1.Provider {
87
93
  }
88
94
  }
89
95
  }
90
- ThemeProvider.styles = [...models_1.Provider.styles, ...themeprovider_styles_1.default];
91
- tslib_1.__decorate([
92
- (0, decorators_js_1.state)(),
93
- tslib_1.__metadata("design:type", String)
96
+ ThemeProvider.styles = [...Provider.styles, ...styles];
97
+ __decorate([
98
+ state(),
99
+ __metadata("design:type", String)
94
100
  ], ThemeProvider.prototype, "currentThemeClass", void 0);
95
- tslib_1.__decorate([
96
- (0, decorators_js_1.property)({ type: String }),
97
- tslib_1.__metadata("design:type", String)
101
+ __decorate([
102
+ property({ type: String }),
103
+ __metadata("design:type", String)
98
104
  ], ThemeProvider.prototype, "themeclass", void 0);
99
- exports.default = ThemeProvider;
105
+ export default ThemeProvider;
@@ -1,12 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TAG_NAME = exports.DEFAULTS = void 0;
4
- const tslib_1 = require("tslib");
5
1
  /* eslint-disable implicit-arrow-linebreak */
6
- const tag_name_1 = tslib_1.__importDefault(require("../../utils/tag-name"));
7
- const TAG_NAME = tag_name_1.default.constructTagName('themeprovider');
8
- exports.TAG_NAME = TAG_NAME;
2
+ import utils from '../../utils/tag-name';
3
+ const TAG_NAME = utils.constructTagName('themeprovider');
9
4
  const DEFAULTS = {
10
5
  THEMECLASS: 'mds-theme-stable-darkWebex',
11
6
  };
12
- exports.DEFAULTS = DEFAULTS;
7
+ export { DEFAULTS, TAG_NAME };
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const context_1 = require("@lit/context");
4
- const themeprovider_constants_1 = require("./themeprovider.constants");
1
+ import { createContext } from '@lit/context';
2
+ import { TAG_NAME } from './themeprovider.constants';
5
3
  class ThemeProviderContext {
6
4
  // constructor to allow setting the defaultThemeClass
7
5
  constructor(defaultThemeClass) {
@@ -9,5 +7,5 @@ class ThemeProviderContext {
9
7
  }
10
8
  }
11
9
  // create typed lit context as part of the ThemeProviderContext
12
- ThemeProviderContext.context = (0, context_1.createContext)(themeprovider_constants_1.TAG_NAME);
13
- exports.default = ThemeProviderContext;
10
+ ThemeProviderContext.context = createContext(TAG_NAME);
11
+ export default ThemeProviderContext;
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const lit_1 = require("lit");
4
- const styles = (0, lit_1.css) `
1
+ import { css } from 'lit';
2
+ const styles = css `
5
3
  :host {
6
4
  --mdc-themeprovider-color-default: var(--mds-color-theme-text-primary-normal);
7
5
  --mdc-themeprovider-font-family: var(--mds-font-family-primary);
@@ -15,4 +13,4 @@ const styles = (0, lit_1.css) `
15
13
  letter-spacing: var(--mdc-themeprovider-letter-spacing-adjustment);
16
14
  }
17
15
  `;
18
- exports.default = [styles];
16
+ export default [styles];