@momentum-design/components 0.129.16 → 0.129.18

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.
@@ -1,4 +1,4 @@
1
- import { CSSResult } from 'lit';
1
+ import type { CSSResult, PropertyValues } from 'lit';
2
2
  import { AnimationItem } from 'lottie-web/build/player/lottie_light';
3
3
  import { Component } from '../../models';
4
4
  import type { AnimationNames, LoopType } from './animation.types';
@@ -17,6 +17,7 @@ import type { AnimationNames, LoopType } from './animation.types';
17
17
  declare class Animation extends Component {
18
18
  /**
19
19
  * Name of the animation (= filename)
20
+ * @default undefined
20
21
  */
21
22
  name?: AnimationNames;
22
23
  /**
@@ -24,30 +25,37 @@ declare class Animation extends Component {
24
25
  * - "true" - infinite
25
26
  * - "false" - no loop
26
27
  * - number - number of times to loop
28
+ * @default 'true'
27
29
  */
28
30
  loop?: LoopType;
29
31
  /**
30
32
  * Weather start the animation automatically
33
+ * @default true
31
34
  */
32
35
  autoplay?: boolean;
33
36
  /**
34
37
  * Aria-label attribute to be set for accessibility
38
+ * @default null
35
39
  */
36
40
  ariaLabel: string | null;
37
41
  /**
38
42
  * Aria-labelledby attribute to be set for accessibility
43
+ * @default null
39
44
  */
40
45
  ariaLabelledby: string | null;
41
46
  /**
42
47
  * Lottie animation instance
48
+ * @internal
43
49
  */
44
50
  private lottieInstance?;
45
51
  /**
46
52
  * Container for the animation
53
+ * @internal
47
54
  */
48
55
  private containerRef;
49
56
  /**
50
57
  * Exposed API of the animation library (lottie)
58
+ * @internal
51
59
  */
52
60
  get animation(): AnimationItem | undefined;
53
61
  private getLoopValue;
@@ -63,15 +71,16 @@ declare class Animation extends Component {
63
71
  * Import animation data dynamically
64
72
  */
65
73
  private getAnimationData;
66
- updated(changedProperties: Map<string, any>): void;
74
+ updated(changedProperties: PropertyValues): void;
67
75
  disconnectedCallback(): void;
68
76
  /**
69
77
  * Re-dispatch the complete event from the animation library
70
78
  *
71
79
  * This handler called with the animation instance instead of the component instance
72
80
  * so we need to bind it to the component instance. The arrow function just does that.
81
+ * @internal
73
82
  */
74
- onCompleteHandler: () => void;
83
+ private onCompleteHandler;
75
84
  render(): import("lit-html").TemplateResult<1>;
76
85
  static styles: Array<CSSResult>;
77
86
  }
@@ -31,31 +31,32 @@ import { DEFAULTS } from './animation.constants';
31
31
  class Animation extends Component {
32
32
  constructor() {
33
33
  super(...arguments);
34
- /**
35
- * Name of the animation (= filename)
36
- */
37
- this.name = DEFAULTS.NAME;
38
34
  /**
39
35
  * How many times to loop the animation
40
36
  * - "true" - infinite
41
37
  * - "false" - no loop
42
38
  * - number - number of times to loop
39
+ * @default 'true'
43
40
  */
44
41
  this.loop = DEFAULTS.LOOP;
45
42
  /**
46
43
  * Weather start the animation automatically
44
+ * @default true
47
45
  */
48
46
  this.autoplay = DEFAULTS.AUTO_PLAY;
49
47
  /**
50
48
  * Aria-label attribute to be set for accessibility
49
+ * @default null
51
50
  */
52
51
  this.ariaLabel = null;
53
52
  /**
54
53
  * Aria-labelledby attribute to be set for accessibility
54
+ * @default null
55
55
  */
56
56
  this.ariaLabelledby = null;
57
57
  /**
58
58
  * Container for the animation
59
+ * @internal
59
60
  */
60
61
  this.containerRef = createRef();
61
62
  /**
@@ -63,6 +64,7 @@ class Animation extends Component {
63
64
  *
64
65
  * This handler called with the animation instance instead of the component instance
65
66
  * so we need to bind it to the component instance. The arrow function just does that.
67
+ * @internal
66
68
  */
67
69
  this.onCompleteHandler = () => {
68
70
  const event = new CustomEvent('complete', {
@@ -74,6 +76,7 @@ class Animation extends Component {
74
76
  }
75
77
  /**
76
78
  * Exposed API of the animation library (lottie)
79
+ * @internal
77
80
  */
78
81
  get animation() {
79
82
  return this.lottieInstance;
@@ -1,6 +1,5 @@
1
1
  declare const TAG_NAME: "mdc-animation";
2
2
  declare const DEFAULTS: {
3
- readonly NAME: undefined;
4
3
  readonly AUTO_PLAY: true;
5
4
  readonly LOOP: "true";
6
5
  };
@@ -1,7 +1,6 @@
1
1
  import utils from '../../utils/tag-name';
2
2
  const TAG_NAME = utils.constructTagName('animation');
3
3
  const DEFAULTS = {
4
- NAME: undefined,
5
4
  AUTO_PLAY: true,
6
5
  LOOP: 'true',
7
6
  };
@@ -109,14 +109,6 @@ declare class Badge extends Badge_base {
109
109
  * Otherwise, the role will be null.
110
110
  */
111
111
  private setRoleByAriaLabel;
112
- /**
113
- * Generates the badge content based on the badge type.
114
- * Utilizes various helper methods to create the appropriate badge template based on the
115
- * current badge type. Supports 'dot', 'icon', 'counter', 'success', 'warning', and 'error'
116
- * types, returning the corresponding template result for each type.
117
- * @returns the TemplateResult for the current badge type.
118
- */
119
- private getBadgeContentBasedOnType;
120
112
  update(changedProperties: PropertyValues): void;
121
113
  render(): TemplateResult;
122
114
  static styles: Array<CSSResult>;
@@ -78,7 +78,7 @@ class Badge extends IconNameMixin(Component) {
78
78
  * where the badge will be layered on top of a button.
79
79
  * @default false
80
80
  */
81
- this.overlay = false;
81
+ this.overlay = DEFAULTS.OVERLAY;
82
82
  /**
83
83
  * Aria-label attribute to be set for accessibility
84
84
  * @default null
@@ -156,14 +156,13 @@ class Badge extends IconNameMixin(Component) {
156
156
  this.role = null;
157
157
  }
158
158
  }
159
- /**
160
- * Generates the badge content based on the badge type.
161
- * Utilizes various helper methods to create the appropriate badge template based on the
162
- * current badge type. Supports 'dot', 'icon', 'counter', 'success', 'warning', and 'error'
163
- * types, returning the corresponding template result for each type.
164
- * @returns the TemplateResult for the current badge type.
165
- */
166
- getBadgeContentBasedOnType() {
159
+ update(changedProperties) {
160
+ super.update(changedProperties);
161
+ if (changedProperties.has('ariaLabel')) {
162
+ this.setRoleByAriaLabel();
163
+ }
164
+ }
165
+ render() {
167
166
  if (this.variant && !Object.values(ICON_VARIANT).includes(this.variant)) {
168
167
  this.variant = DEFAULTS.VARIANT;
169
168
  }
@@ -185,15 +184,6 @@ class Badge extends IconNameMixin(Component) {
185
184
  return this.getBadgeDot();
186
185
  }
187
186
  }
188
- update(changedProperties) {
189
- super.update(changedProperties);
190
- if (changedProperties.has('ariaLabel')) {
191
- this.setRoleByAriaLabel();
192
- }
193
- }
194
- render() {
195
- return this.getBadgeContentBasedOnType();
196
- }
197
187
  }
198
188
  Badge.styles = [...Component.styles, ...styles];
199
189
  __decorate([
@@ -214,7 +204,7 @@ __decorate([
214
204
  ], Badge.prototype, "maxCounter", void 0);
215
205
  __decorate([
216
206
  property({ type: Boolean }),
217
- __metadata("design:type", Object)
207
+ __metadata("design:type", Boolean)
218
208
  ], Badge.prototype, "overlay", void 0);
219
209
  __decorate([
220
210
  property({ type: String, attribute: 'aria-label' }),
@@ -23,5 +23,6 @@ declare const DEFAULTS: {
23
23
  readonly MAX_COUNTER_LIMIT: 999;
24
24
  readonly VARIANT: "primary";
25
25
  readonly ICON_SIZE: 1;
26
+ readonly OVERLAY: false;
26
27
  };
27
- export { TAG_NAME, DEFAULTS, TYPE, ICON_VARIANT, ICON_NAMES_LIST };
28
+ export { DEFAULTS, ICON_NAMES_LIST, ICON_VARIANT, TAG_NAME, TYPE };
@@ -23,5 +23,6 @@ const DEFAULTS = {
23
23
  MAX_COUNTER_LIMIT: 999,
24
24
  VARIANT: ICON_VARIANT.PRIMARY,
25
25
  ICON_SIZE: 1,
26
+ OVERLAY: false,
26
27
  };
27
- export { TAG_NAME, DEFAULTS, TYPE, ICON_VARIANT, ICON_NAMES_LIST };
28
+ export { DEFAULTS, ICON_NAMES_LIST, ICON_VARIANT, TAG_NAME, TYPE };
@@ -1673,12 +1673,6 @@
1673
1673
  "description": "The `mdc-animation` component is a wrapper around the Lottie animation library.\nIt fetches the animation data dynamically based on the provided name and renders it.\nThis is a display only component that does not have any interactive functionality.\nFrom accessibility perspective, (by default) it is a decorative image component.",
1674
1674
  "name": "Animation",
1675
1675
  "members": [
1676
- {
1677
- "kind": "field",
1678
- "name": "animation",
1679
- "description": "Exposed API of the animation library (lottie)",
1680
- "readonly": true
1681
- },
1682
1676
  {
1683
1677
  "kind": "field",
1684
1678
  "name": "ariaLabel",
@@ -1706,28 +1700,30 @@
1706
1700
  "text": "boolean | undefined"
1707
1701
  },
1708
1702
  "description": "Weather start the animation automatically",
1703
+ "default": "true",
1709
1704
  "attribute": "autoplay",
1710
1705
  "reflects": true
1711
1706
  },
1712
- {
1713
- "kind": "field",
1714
- "name": "containerRef",
1715
- "type": {
1716
- "text": "Ref<HTMLDivElement>"
1717
- },
1718
- "privacy": "private",
1719
- "description": "Container for the animation"
1720
- },
1721
1707
  {
1722
1708
  "kind": "method",
1723
1709
  "name": "getAnimationData",
1724
1710
  "privacy": "private",
1711
+ "return": {
1712
+ "type": {
1713
+ "text": "void"
1714
+ }
1715
+ },
1725
1716
  "description": "Import animation data dynamically"
1726
1717
  },
1727
1718
  {
1728
1719
  "kind": "method",
1729
1720
  "name": "getLoopValue",
1730
- "privacy": "private"
1721
+ "privacy": "private",
1722
+ "return": {
1723
+ "type": {
1724
+ "text": "boolean | number"
1725
+ }
1726
+ }
1731
1727
  },
1732
1728
  {
1733
1729
  "kind": "field",
@@ -1736,18 +1732,10 @@
1736
1732
  "text": "LoopType | undefined"
1737
1733
  },
1738
1734
  "description": "How many times to loop the animation\n- \"true\" - infinite\n- \"false\" - no loop\n- number - number of times to loop",
1735
+ "default": "'true'",
1739
1736
  "attribute": "loop",
1740
1737
  "reflects": true
1741
1738
  },
1742
- {
1743
- "kind": "field",
1744
- "name": "lottieInstance",
1745
- "type": {
1746
- "text": "AnimationItem | undefined"
1747
- },
1748
- "privacy": "private",
1749
- "description": "Lottie animation instance"
1750
- },
1751
1739
  {
1752
1740
  "kind": "field",
1753
1741
  "name": "name",
@@ -1755,18 +1743,19 @@
1755
1743
  "text": "AnimationNames | undefined"
1756
1744
  },
1757
1745
  "description": "Name of the animation (= filename)",
1746
+ "default": "undefined",
1758
1747
  "attribute": "name",
1759
1748
  "reflects": true
1760
1749
  },
1761
- {
1762
- "kind": "field",
1763
- "name": "onCompleteHandler",
1764
- "description": "Re-dispatch the complete event from the animation library\n\nThis handler called with the animation instance instead of the component instance\nso we need to bind it to the component instance. The arrow function just does that."
1765
- },
1766
1750
  {
1767
1751
  "kind": "method",
1768
1752
  "name": "onLoadFailHandler",
1769
1753
  "privacy": "private",
1754
+ "return": {
1755
+ "type": {
1756
+ "text": "void"
1757
+ }
1758
+ },
1770
1759
  "parameters": [
1771
1760
  {
1772
1761
  "name": "error",
@@ -1781,6 +1770,11 @@
1781
1770
  "kind": "method",
1782
1771
  "name": "onLoadSuccessHandler",
1783
1772
  "privacy": "private",
1773
+ "return": {
1774
+ "type": {
1775
+ "text": "void"
1776
+ }
1777
+ },
1784
1778
  "parameters": [
1785
1779
  {
1786
1780
  "name": "animationData",
@@ -1819,6 +1813,7 @@
1819
1813
  "text": "AnimationNames | undefined"
1820
1814
  },
1821
1815
  "description": "Name of the animation (= filename)",
1816
+ "default": "undefined",
1822
1817
  "fieldName": "name"
1823
1818
  },
1824
1819
  {
@@ -1827,6 +1822,7 @@
1827
1822
  "text": "LoopType | undefined"
1828
1823
  },
1829
1824
  "description": "How many times to loop the animation\n- \"true\" - infinite\n- \"false\" - no loop\n- number - number of times to loop",
1825
+ "default": "'true'",
1830
1826
  "fieldName": "loop"
1831
1827
  },
1832
1828
  {
@@ -1835,6 +1831,7 @@
1835
1831
  "text": "boolean | undefined"
1836
1832
  },
1837
1833
  "description": "Weather start the animation automatically",
1834
+ "default": "true",
1838
1835
  "fieldName": "autoplay"
1839
1836
  },
1840
1837
  {
@@ -4496,17 +4493,6 @@
4496
4493
  "description": "Counter is the number which can be provided in the badge.",
4497
4494
  "attribute": "counter"
4498
4495
  },
4499
- {
4500
- "kind": "method",
4501
- "name": "getBadgeContentBasedOnType",
4502
- "privacy": "private",
4503
- "return": {
4504
- "type": {
4505
- "text": ""
4506
- }
4507
- },
4508
- "description": "Generates the badge content based on the badge type.\nUtilizes various helper methods to create the appropriate badge template based on the\ncurrent badge type. Supports 'dot', 'icon', 'counter', 'success', 'warning', and 'error'\ntypes, returning the corresponding template result for each type."
4509
- },
4510
4496
  {
4511
4497
  "kind": "method",
4512
4498
  "name": "getBadgeCounterText",
@@ -4607,8 +4593,8 @@
4607
4593
  "type": {
4608
4594
  "text": "boolean"
4609
4595
  },
4610
- "default": "false",
4611
4596
  "description": "Overlay is to add a thin outline to the badge.\nThis will help distinguish between the badge and the button,\nwhere the badge will be layered on top of a button.",
4597
+ "default": "false",
4612
4598
  "attribute": "overlay"
4613
4599
  },
4614
4600
  {
@@ -4684,8 +4670,8 @@
4684
4670
  "type": {
4685
4671
  "text": "boolean"
4686
4672
  },
4687
- "default": "false",
4688
4673
  "description": "Overlay is to add a thin outline to the badge.\nThis will help distinguish between the badge and the button,\nwhere the badge will be layered on top of a button.",
4674
+ "default": "false",
4689
4675
  "fieldName": "overlay"
4690
4676
  },
4691
4677
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@momentum-design/components",
3
3
  "packageManager": "yarn@3.2.4",
4
- "version": "0.129.16",
4
+ "version": "0.129.18",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"