@momentum-design/components 0.3.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.
@@ -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
  ],
@@ -568,39 +568,60 @@
568
568
  "declarations": [
569
569
  {
570
570
  "kind": "class",
571
- "description": "Text component, which helps creating a text element aligning with\nstyling.\n\nThe `type` attribute allows changing the type of text, like `heading-1`, etc.\n\nFor accessibility the `role` and `aria-level` on the component are going to be set\nautomatically based on the type e.g. heading-1 will lead to `role=\"heading\"` and `aria-level=1`.",
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
+ ],
579
+ "slots": [
580
+ {
581
+ "description": "Default slot for text content",
582
+ "name": ""
583
+ }
584
+ ],
573
585
  "members": [
574
586
  {
575
587
  "kind": "field",
576
588
  "name": "type",
577
589
  "type": {
578
- "text": "FontType | undefined"
590
+ "text": "FontType"
579
591
  },
580
592
  "privacy": "public",
581
- "description": "Text Type - defines how the text should be rendered\n\nPossible values: `heading-1` | `heading-2` | `heading-3` | `heading-4`\n| `heading-5` | `heading-6` | `heading-7` | `body-large` | `body-regular`\n| `body-small` | `image-title` | `label`;",
593
+ "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'",
582
594
  "attribute": "type",
583
595
  "reflects": true
584
596
  },
585
597
  {
586
- "kind": "method",
587
- "name": "handleTypeChanged",
588
- "privacy": "protected",
589
- "return": {
590
- "type": {
591
- "text": "void"
592
- }
593
- }
598
+ "kind": "field",
599
+ "name": "tagname",
600
+ "type": {
601
+ "text": "ValidTextTags | undefined"
602
+ },
603
+ "privacy": "public",
604
+ "description": "Specifies the HTML tag name for the text element. The default tag name is `p`.\nThis attribute is optional. When set, it changes the tag name of the text element.\n\nAcceptable values include: 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'small', 'span', 'div', 'section'.\n\nFor instance, setting this attribute to `h2` will render the text element as an `h2` element.\nNote that the styling is determined by the `type` attribute.",
605
+ "attribute": "tagname",
606
+ "reflects": true
594
607
  }
595
608
  ],
596
609
  "attributes": [
597
610
  {
598
611
  "name": "type",
599
612
  "type": {
600
- "text": "FontType | undefined"
613
+ "text": "FontType"
601
614
  },
602
- "description": "Text Type - defines how the text should be rendered\n\nPossible values: `heading-1` | `heading-2` | `heading-3` | `heading-4`\n| `heading-5` | `heading-6` | `heading-7` | `body-large` | `body-regular`\n| `body-small` | `image-title` | `label`;",
615
+ "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'",
603
616
  "fieldName": "type"
617
+ },
618
+ {
619
+ "name": "tagname",
620
+ "type": {
621
+ "text": "ValidTextTags | undefined"
622
+ },
623
+ "description": "Specifies the HTML tag name for the text element. The default tag name is `p`.\nThis attribute is optional. When set, it changes the tag name of the text element.\n\nAcceptable values include: 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'small', 'span', 'div', 'section'.\n\nFor instance, setting this attribute to `h2` will render the text element as an `h2` element.\nNote that the styling is determined by the `type` attribute.",
624
+ "fieldName": "tagname"
604
625
  }
605
626
  ],
606
627
  "superclass": {
@@ -608,7 +629,7 @@
608
629
  "module": "/src/models"
609
630
  },
610
631
  "tagName": "mdc-text",
611
- "jsDoc": "/**\n * Text component, which helps creating a text element aligning with\n * styling.\n *\n * The `type` attribute allows changing the type of text, like `heading-1`, etc.\n *\n * For accessibility the `role` and `aria-level` on the component are going to be set\n * automatically based on the type e.g. heading-1 will lead to `role=\"heading\"` and `aria-level=1`.\n *\n * @tagname mdc-text\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 */",
612
633
  "customElement": true
613
634
  }
614
635
  ],
@@ -652,7 +673,7 @@
652
673
  "slots": [
653
674
  {
654
675
  "description": "children",
655
- "name": "default"
676
+ "name": ""
656
677
  }
657
678
  ],
658
679
  "members": [
@@ -706,7 +727,7 @@
706
727
  "module": "/src/models"
707
728
  },
708
729
  "tagName": "mdc-themeprovider",
709
- "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 */",
710
731
  "customElement": true
711
732
  }
712
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,
@@ -1,14 +1,21 @@
1
1
  import Component from '../../components/text';
2
2
  /**
3
- * Text component, which helps creating a text element aligning with
4
- * styling.
3
+ * Text component for creating styled text elements.
4
+ * It has to be mounted within the ThemeProvider to access color and font tokens.
5
5
  *
6
- * The `type` attribute allows changing the type of text, like `heading-1`, etc.
6
+ * The `type` attribute allows changing the text style.
7
+ * The `tagname` attribute allows changing the tag name of the text element.
8
+ * The default tag name is `p`.
7
9
  *
8
- * For accessibility the `role` and `aria-level` on the component are going to be set
9
- * automatically based on the type e.g. heading-1 will lead to `role="heading"` and `aria-level=1`.
10
+ * The `tagname` attribute should be a valid HTML tag name.
11
+ * If the `tagname` attribute is not a valid HTML tag name, the default tag name will be used.
12
+ *
13
+ * The styling is applied based on the `type` attribute.
10
14
  *
11
15
  * @tagname mdc-text
16
+ * @slot - Default slot for text content
17
+ *
18
+ * @csspart text - The text element
12
19
  */
13
20
  declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
14
21
  export default reactWrapper;
@@ -6,15 +6,22 @@ const react_1 = require("@lit/react");
6
6
  const text_1 = tslib_1.__importDefault(require("../../components/text"));
7
7
  const text_constants_1 = require("../../components/text/text.constants");
8
8
  /**
9
- * Text component, which helps creating a text element aligning with
10
- * styling.
9
+ * Text component for creating styled text elements.
10
+ * It has to be mounted within the ThemeProvider to access color and font tokens.
11
11
  *
12
- * The `type` attribute allows changing the type of text, like `heading-1`, etc.
12
+ * The `type` attribute allows changing the text style.
13
+ * The `tagname` attribute allows changing the tag name of the text element.
14
+ * The default tag name is `p`.
13
15
  *
14
- * For accessibility the `role` and `aria-level` on the component are going to be set
15
- * automatically based on the type e.g. heading-1 will lead to `role="heading"` and `aria-level=1`.
16
+ * The `tagname` attribute should be a valid HTML tag name.
17
+ * If the `tagname` attribute is not a valid HTML tag name, the default tag name will be used.
18
+ *
19
+ * The styling is applied based on the `type` attribute.
16
20
  *
17
21
  * @tagname mdc-text
22
+ * @slot - Default slot for text content
23
+ *
24
+ * @csspart text - The text element
18
25
  */
19
26
  const reactWrapper = (0, react_1.createComponent)({
20
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.3.0"
40
+ "version": "0.4.1"
41
41
  }
@@ -1,20 +0,0 @@
1
- import { FontType } from './text.types';
2
- /**
3
- * Check if passed in type is a heading
4
- * @param type - type to check
5
- * @returns boolean, true if it is a heading
6
- */
7
- declare const isHeading: (type: FontType) => boolean;
8
- /**
9
- * Get corresponding aria-role to type
10
- * @param type - type to find corresponding role for
11
- * @returns role
12
- */
13
- declare const getRole: (type?: FontType) => "heading" | "paragraph" | null;
14
- /**
15
- * Get corresponding aria-level to type
16
- * @param type - type to find corresponding level for
17
- * @returns aria-level (has to be a number)
18
- */
19
- declare const getAriaLevel: (type?: FontType) => string | null;
20
- export { isHeading, getAriaLevel, getRole };
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRole = exports.getAriaLevel = exports.isHeading = void 0;
4
- /**
5
- * Split the passed in type and return the parts
6
- */
7
- const getTypeParts = (type) => {
8
- const parts = type.split('-');
9
- return { firstPart: parts[0], secondPart: parts[1] };
10
- };
11
- /**
12
- * Check if passed in type is a heading
13
- * @param type - type to check
14
- * @returns boolean, true if it is a heading
15
- */
16
- const isHeading = (type) => {
17
- const { firstPart, secondPart } = getTypeParts(type);
18
- return firstPart === 'heading' && +secondPart > 0 && +secondPart < 7;
19
- };
20
- exports.isHeading = isHeading;
21
- /**
22
- * Get corresponding aria-role to type
23
- * @param type - type to find corresponding role for
24
- * @returns role
25
- */
26
- const getRole = (type) => {
27
- if (type) {
28
- if (isHeading(type)) {
29
- return 'heading';
30
- }
31
- return 'paragraph';
32
- }
33
- return null;
34
- };
35
- exports.getRole = getRole;
36
- /**
37
- * Get corresponding aria-level to type
38
- * @param type - type to find corresponding level for
39
- * @returns aria-level (has to be a number)
40
- */
41
- const getAriaLevel = (type) => {
42
- if (type) {
43
- if (isHeading(type)) {
44
- const { secondPart } = getTypeParts(type);
45
- return secondPart;
46
- }
47
- }
48
- return null;
49
- };
50
- exports.getAriaLevel = getAriaLevel;