@momentum-design/components 0.4.0 → 0.4.1

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,7 +10,7 @@ import IconProviderContext from './iconprovider.context';
10
10
  *
11
11
  * @tagname mdc-iconprovider
12
12
  *
13
- * @slot default - children
13
+ * @slot - children
14
14
  */
15
15
  declare class IconProvider extends Provider<IconProviderContext> {
16
16
  constructor();
@@ -15,7 +15,7 @@ const iconprovider_constants_1 = require("./iconprovider.constants");
15
15
  *
16
16
  * @tagname mdc-iconprovider
17
17
  *
18
- * @slot default - children
18
+ * @slot - children
19
19
  */
20
20
  class IconProvider extends models_1.Provider {
21
21
  constructor() {
@@ -16,6 +16,8 @@ import type { FontType, ValidTextTags } from './text.types';
16
16
  *
17
17
  * @tagname mdc-text
18
18
  * @slot - Default slot for text content
19
+ *
20
+ * @csspart text - The text element
19
21
  */
20
22
  declare class Text extends Component {
21
23
  /**
@@ -21,6 +21,8 @@ const text_constants_1 = require("./text.constants");
21
21
  *
22
22
  * @tagname mdc-text
23
23
  * @slot - Default slot for text content
24
+ *
25
+ * @csspart text - The text element
24
26
  */
25
27
  class Text extends models_1.Component {
26
28
  constructor() {
@@ -70,23 +72,23 @@ class Text extends models_1.Component {
70
72
  * For instance, setting this attribute to `h2` will render the text element as an `h2` element.
71
73
  * Note that the styling is determined by the `type` attribute.
72
74
  */
73
- this.tagname = text_constants_1.DEFAULTS.TAGNAME;
75
+ this.tagname = text_constants_1.DEFAULTS.TEXT_ELEMENT_TAGNAME;
74
76
  }
75
77
  render() {
76
78
  // Lit does not support dynamically changing values for the tag name of a custom element.
77
79
  // Read more: https://lit.dev/docs/templates/expressions/#invalid-locations
78
80
  switch (this.tagname) {
79
- case 'h1': return (0, lit_1.html) `<h1 part=${text_constants_1.PART_NAME}><slot></slot></h1>`;
80
- case 'h2': return (0, lit_1.html) `<h2 part=${text_constants_1.PART_NAME}><slot></slot></h2>`;
81
- case 'h3': return (0, lit_1.html) `<h3 part=${text_constants_1.PART_NAME}><slot></slot></h3>`;
82
- case 'h4': return (0, lit_1.html) `<h4 part=${text_constants_1.PART_NAME}><slot></slot></h4>`;
83
- case 'h5': return (0, lit_1.html) `<h5 part=${text_constants_1.PART_NAME}><slot></slot></h5>`;
84
- case 'h6': return (0, lit_1.html) `<h6 part=${text_constants_1.PART_NAME}><slot></slot></h6>`;
85
- case 'div': return (0, lit_1.html) `<div part=${text_constants_1.PART_NAME}><slot></slot></div>`;
86
- case 'p': return (0, lit_1.html) `<p part=${text_constants_1.PART_NAME}><slot></slot></p>`;
87
- case 'span': return (0, lit_1.html) `<span part=${text_constants_1.PART_NAME}><slot></slot></span>`;
88
- case 'small': return (0, lit_1.html) `<small part=${text_constants_1.PART_NAME}><slot></slot></small>`;
89
- default: return (0, lit_1.html) `<p part=${text_constants_1.PART_NAME}><slot></slot></p>`;
81
+ case 'h1': return (0, lit_1.html) `<h1 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h1>`;
82
+ case 'h2': return (0, lit_1.html) `<h2 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h2>`;
83
+ case 'h3': return (0, lit_1.html) `<h3 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h3>`;
84
+ case 'h4': return (0, lit_1.html) `<h4 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h4>`;
85
+ case 'h5': return (0, lit_1.html) `<h5 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h5>`;
86
+ case 'h6': return (0, lit_1.html) `<h6 part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></h6>`;
87
+ case 'div': return (0, lit_1.html) `<div part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></div>`;
88
+ case 'span': return (0, lit_1.html) `<span part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></span>`;
89
+ case 'small': return (0, lit_1.html) `<small part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></small>`;
90
+ case 'p':
91
+ default: return (0, lit_1.html) `<p part=${text_constants_1.DEFAULTS.CSS_PART_TEXT}><slot></slot></p>`;
90
92
  }
91
93
  }
92
94
  }
@@ -1,12 +1,12 @@
1
1
  import type { FontType, ValidTextTags } from './text.types';
2
2
  declare const TAG_NAME: "mdc-text";
3
- declare const PART_NAME = "text";
4
3
  declare const VALUES: {
5
4
  TYPE: Array<FontType>;
6
5
  TAGNAME: Array<ValidTextTags>;
7
6
  };
8
7
  declare const DEFAULTS: {
9
- TAGNAME: ValidTextTags;
10
8
  TYPE: FontType;
9
+ TEXT_ELEMENT_TAGNAME: ValidTextTags;
10
+ CSS_PART_TEXT: string;
11
11
  };
12
- export { TAG_NAME, DEFAULTS, VALUES, PART_NAME };
12
+ export { TAG_NAME, DEFAULTS, VALUES };
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PART_NAME = exports.VALUES = exports.DEFAULTS = exports.TAG_NAME = void 0;
3
+ exports.VALUES = exports.DEFAULTS = exports.TAG_NAME = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const tag_name_1 = tslib_1.__importDefault(require("../../utils/tag-name"));
6
6
  const TAG_NAME = tag_name_1.default.constructTagName('text');
7
7
  exports.TAG_NAME = TAG_NAME;
8
- const PART_NAME = 'text';
9
- exports.PART_NAME = PART_NAME;
10
8
  const VALUES = {
11
9
  TYPE: [
12
10
  'body-small-regular',
@@ -55,7 +53,8 @@ const VALUES = {
55
53
  };
56
54
  exports.VALUES = VALUES;
57
55
  const DEFAULTS = {
58
- TAGNAME: 'p',
59
56
  TYPE: 'body-midsize-regular',
57
+ TEXT_ELEMENT_TAGNAME: 'p',
58
+ CSS_PART_TEXT: 'text',
60
59
  };
61
60
  exports.DEFAULTS = DEFAULTS;
@@ -15,7 +15,7 @@ import ThemeProviderContext from './themeprovider.context';
15
15
  *
16
16
  * @tagname mdc-themeprovider
17
17
  *
18
- * @slot default - children
18
+ * @slot - children
19
19
  *
20
20
  * @cssproperty --mdc-themeprovider-color-default - Option to override the default color,
21
21
  * default: color-theme-text-primary-normal
@@ -20,7 +20,7 @@ const themeprovider_styles_1 = tslib_1.__importDefault(require("./themeprovider.
20
20
  *
21
21
  * @tagname mdc-themeprovider
22
22
  *
23
- * @slot default - children
23
+ * @slot - children
24
24
  *
25
25
  * @cssproperty --mdc-themeprovider-color-default - Option to override the default color,
26
26
  * default: color-theme-text-primary-normal
@@ -439,7 +439,7 @@
439
439
  "slots": [
440
440
  {
441
441
  "description": "children",
442
- "name": "default"
442
+ "name": ""
443
443
  }
444
444
  ],
445
445
  "members": [
@@ -547,7 +547,7 @@
547
547
  "module": "/src/models"
548
548
  },
549
549
  "tagName": "mdc-iconprovider",
550
- "jsDoc": "/**\n * IconProvider component, which allows to be consumed from sub components\n * (see `providerUtils.consume` for how to consume)\n *\n * Bundling icons will be up to the consumer of this component, such\n * that only a url has to be passed in from which the icons will be\n * fetched.\n *\n * @tagname mdc-iconprovider\n *\n * @slot default - children\n */",
550
+ "jsDoc": "/**\n * IconProvider component, which allows to be consumed from sub components\n * (see `providerUtils.consume` for how to consume)\n *\n * Bundling icons will be up to the consumer of this component, such\n * that only a url has to be passed in from which the icons will be\n * fetched.\n *\n * @tagname mdc-iconprovider\n *\n * @slot - children\n */",
551
551
  "customElement": true
552
552
  }
553
553
  ],
@@ -570,6 +570,12 @@
570
570
  "kind": "class",
571
571
  "description": "Text component for creating styled text elements.\nIt has to be mounted within the ThemeProvider to access color and font tokens.\n\nThe `type` attribute allows changing the text style.\nThe `tagname` attribute allows changing the tag name of the text element.\nThe default tag name is `p`.\n\nThe `tagname` attribute should be a valid HTML tag name.\nIf the `tagname` attribute is not a valid HTML tag name, the default tag name will be used.\n\nThe styling is applied based on the `type` attribute.",
572
572
  "name": "Text",
573
+ "cssParts": [
574
+ {
575
+ "description": "The text element",
576
+ "name": "text"
577
+ }
578
+ ],
573
579
  "slots": [
574
580
  {
575
581
  "description": "Default slot for text content",
@@ -623,7 +629,7 @@
623
629
  "module": "/src/models"
624
630
  },
625
631
  "tagName": "mdc-text",
626
- "jsDoc": "/**\n * Text component for creating styled text elements.\n * It has to be mounted within the ThemeProvider to access color and font tokens.\n *\n * The `type` attribute allows changing the text style.\n * The `tagname` attribute allows changing the tag name of the text element.\n * The default tag name is `p`.\n *\n * The `tagname` attribute should be a valid HTML tag name.\n * If the `tagname` attribute is not a valid HTML tag name, the default tag name will be used.\n *\n * The styling is applied based on the `type` attribute.\n *\n * @tagname mdc-text\n * @slot - Default slot for text content\n */",
632
+ "jsDoc": "/**\n * Text component for creating styled text elements.\n * It has to be mounted within the ThemeProvider to access color and font tokens.\n *\n * The `type` attribute allows changing the text style.\n * The `tagname` attribute allows changing the tag name of the text element.\n * The default tag name is `p`.\n *\n * The `tagname` attribute should be a valid HTML tag name.\n * If the `tagname` attribute is not a valid HTML tag name, the default tag name will be used.\n *\n * The styling is applied based on the `type` attribute.\n *\n * @tagname mdc-text\n * @slot - Default slot for text content\n *\n * @csspart text - The text element\n */",
627
633
  "customElement": true
628
634
  }
629
635
  ],
@@ -667,7 +673,7 @@
667
673
  "slots": [
668
674
  {
669
675
  "description": "children",
670
- "name": "default"
676
+ "name": ""
671
677
  }
672
678
  ],
673
679
  "members": [
@@ -721,7 +727,7 @@
721
727
  "module": "/src/models"
722
728
  },
723
729
  "tagName": "mdc-themeprovider",
724
- "jsDoc": "/**\n * ThemeProvider component, which sets the passed in themeclass as class.\n * If the themeclass switches, the existing themeclass will be removed as a class\n * and the new themeclass will be added.\n *\n * CSS variables defined in the themeclass will be used for the styling of child dom nodes.\n *\n * Themeclass context can be be consumed from Lit child components\n * (see providerUtils.consume for how to consume)\n *\n * ThemeProvider also includes basic font defaults for text.\n *\n * @tagname mdc-themeprovider\n *\n * @slot default - children\n *\n * @cssproperty --mdc-themeprovider-color-default - Option to override the default color,\n * default: color-theme-text-primary-normal\n * @cssproperty --mdc-themeprovider-font-family - Option to override the font family,\n * default: `Momentum` (from momentum-design/fonts)\n * @cssproperty --mdc-themeprovider-font-weight - Option to override the font weight, default: `400`\n * @cssproperty --mdc-themeprovider-letter-spacing-adjustment - Option to override the default letter-spacing,\n * default: `-0.25px` (this is to match the old CiscoSans)\n */",
730
+ "jsDoc": "/**\n * ThemeProvider component, which sets the passed in themeclass as class.\n * If the themeclass switches, the existing themeclass will be removed as a class\n * and the new themeclass will be added.\n *\n * CSS variables defined in the themeclass will be used for the styling of child dom nodes.\n *\n * Themeclass context can be be consumed from Lit child components\n * (see providerUtils.consume for how to consume)\n *\n * ThemeProvider also includes basic font defaults for text.\n *\n * @tagname mdc-themeprovider\n *\n * @slot - children\n *\n * @cssproperty --mdc-themeprovider-color-default - Option to override the default color,\n * default: color-theme-text-primary-normal\n * @cssproperty --mdc-themeprovider-font-family - Option to override the font family,\n * default: `Momentum` (from momentum-design/fonts)\n * @cssproperty --mdc-themeprovider-font-weight - Option to override the font weight, default: `400`\n * @cssproperty --mdc-themeprovider-letter-spacing-adjustment - Option to override the default letter-spacing,\n * default: `-0.25px` (this is to match the old CiscoSans)\n */",
725
731
  "customElement": true
726
732
  }
727
733
  ],
@@ -9,7 +9,7 @@ import Component from '../../components/iconprovider';
9
9
  *
10
10
  * @tagname mdc-iconprovider
11
11
  *
12
- * @slot default - children
12
+ * @slot - children
13
13
  */
14
14
  declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
15
15
  export default reactWrapper;
@@ -15,7 +15,7 @@ const iconprovider_constants_1 = require("../../components/iconprovider/iconprov
15
15
  *
16
16
  * @tagname mdc-iconprovider
17
17
  *
18
- * @slot default - children
18
+ * @slot - children
19
19
  */
20
20
  const reactWrapper = (0, react_1.createComponent)({
21
21
  tagName: iconprovider_constants_1.TAG_NAME,
@@ -14,6 +14,8 @@ import Component from '../../components/text';
14
14
  *
15
15
  * @tagname mdc-text
16
16
  * @slot - Default slot for text content
17
+ *
18
+ * @csspart text - The text element
17
19
  */
18
20
  declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
19
21
  export default reactWrapper;
@@ -20,6 +20,8 @@ const text_constants_1 = require("../../components/text/text.constants");
20
20
  *
21
21
  * @tagname mdc-text
22
22
  * @slot - Default slot for text content
23
+ *
24
+ * @csspart text - The text element
23
25
  */
24
26
  const reactWrapper = (0, react_1.createComponent)({
25
27
  tagName: text_constants_1.TAG_NAME,
@@ -13,7 +13,7 @@ import Component from '../../components/themeprovider';
13
13
  *
14
14
  * @tagname mdc-themeprovider
15
15
  *
16
- * @slot default - children
16
+ * @slot - children
17
17
  *
18
18
  * @cssproperty --mdc-themeprovider-color-default - Option to override the default color,
19
19
  * default: color-theme-text-primary-normal
@@ -19,7 +19,7 @@ const themeprovider_constants_1 = require("../../components/themeprovider/themep
19
19
  *
20
20
  * @tagname mdc-themeprovider
21
21
  *
22
- * @slot default - children
22
+ * @slot - children
23
23
  *
24
24
  * @cssproperty --mdc-themeprovider-color-default - Option to override the default color,
25
25
  * default: color-theme-text-primary-normal
package/package.json CHANGED
@@ -37,5 +37,5 @@
37
37
  "@momentum-design/icons": "*",
38
38
  "@momentum-design/tokens": "*"
39
39
  },
40
- "version": "0.4.0"
40
+ "version": "0.4.1"
41
41
  }