@momentum-design/components 0.129.10 → 0.129.12

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 type { CSSResult } from 'lit';
1
+ import type { CSSResult, TemplateResult } from 'lit';
2
2
  import { Component } from '../../models';
3
3
  import type { BannerVariant } from './banner.types';
4
4
  /**
@@ -51,7 +51,7 @@ declare class Banner extends Component {
51
51
  /**
52
52
  * Banner label text
53
53
  */
54
- label: string;
54
+ label?: string;
55
55
  /**
56
56
  * Banner secondary label text
57
57
  *
@@ -74,7 +74,7 @@ declare class Banner extends Component {
74
74
  * @returns Template result containing label and optional secondary label elements
75
75
  */
76
76
  private getTextLabel;
77
- render(): import("lit-html").TemplateResult<1>;
77
+ render(): TemplateResult<1>;
78
78
  static styles: Array<CSSResult>;
79
79
  }
80
80
  export default Banner;
@@ -63,10 +63,6 @@ class Banner extends Component {
63
63
  * @default 'custom'
64
64
  */
65
65
  this.variant = DEFAULTS.VARIANT;
66
- /**
67
- * Banner label text
68
- */
69
- this.label = '';
70
66
  }
71
67
  /**
72
68
  * @internal
@@ -79,12 +75,7 @@ class Banner extends Component {
79
75
  if (!iconName)
80
76
  return nothing;
81
77
  return html `
82
- <mdc-icon
83
- name="${iconName}"
84
- size="${DEFAULTS.PREFIX_ICON_SIZE}"
85
- part="leading-icon"
86
- length-unit="rem"
87
- ></mdc-icon>
78
+ <mdc-icon name="${iconName}" size="${DEFAULTS.PREFIX_ICON_SIZE}" part="leading-icon" length-unit="rem"></mdc-icon>
88
79
  `;
89
80
  }
90
81
  /**
@@ -115,12 +106,11 @@ class Banner extends Component {
115
106
  `;
116
107
  }
117
108
  render() {
118
- var _a;
119
109
  return html `
120
110
  <slot name="content">
121
111
  <div part="leading">
122
112
  <slot name="leading-icon">
123
- ${this.variant !== DEFAULTS.VARIANT ? this.renderIcon((_a = getIconNameForVariant(this.variant)) !== null && _a !== void 0 ? _a : '') : nothing}
113
+ ${this.variant !== DEFAULTS.VARIANT ? this.renderIcon(getIconNameForVariant(this.variant)) : nothing}
124
114
  </slot>
125
115
  <slot name="leading-text">
126
116
  <div part="leading-text">${this.getTextLabel()}</div>
@@ -1,3 +1,4 @@
1
+ import type { IconNames } from '../icon/icon.types';
1
2
  declare const TAG_NAME: "mdc-banner";
2
3
  /**
3
4
  * Banner variants
@@ -13,10 +14,10 @@ declare const BANNER_VARIANT: {
13
14
  * Icon names for variants
14
15
  */
15
16
  declare const VARIANT_ICON_NAMES: {
16
- readonly INFORMATIONAL_ICON_NAME: "info-circle-bold";
17
- readonly SUCCESS_ICON_NAME: "check-circle-bold";
18
- readonly WARNING_ICON_NAME: "warning-bold";
19
- readonly ERROR_ICON_NAME: "error-legacy-bold";
17
+ readonly INFORMATIONAL_ICON_NAME: Extract<IconNames, "info-circle-bold">;
18
+ readonly SUCCESS_ICON_NAME: Extract<IconNames, "check-circle-bold">;
19
+ readonly WARNING_ICON_NAME: Extract<IconNames, "warning-bold">;
20
+ readonly ERROR_ICON_NAME: Extract<IconNames, "error-legacy-bold">;
20
21
  };
21
22
  /**
22
23
  * Default values
@@ -25,4 +26,4 @@ declare const DEFAULTS: {
25
26
  readonly VARIANT: "custom";
26
27
  readonly PREFIX_ICON_SIZE: 1.25;
27
28
  };
28
- export { TAG_NAME, BANNER_VARIANT, DEFAULTS, VARIANT_ICON_NAMES };
29
+ export { BANNER_VARIANT, DEFAULTS, TAG_NAME, VARIANT_ICON_NAMES };
@@ -26,4 +26,4 @@ const DEFAULTS = {
26
26
  VARIANT: BANNER_VARIANT.CUSTOM,
27
27
  PREFIX_ICON_SIZE: 1.25,
28
28
  };
29
- export { TAG_NAME, BANNER_VARIANT, DEFAULTS, VARIANT_ICON_NAMES };
29
+ export { BANNER_VARIANT, DEFAULTS, TAG_NAME, VARIANT_ICON_NAMES };
@@ -1,3 +1,4 @@
1
+ import type { IconNames } from '../icon/icon.types';
1
2
  import type { BannerVariant } from './banner.types';
2
- declare const getIconNameForVariant: (variant: BannerVariant) => string | null;
3
+ declare const getIconNameForVariant: (variant: BannerVariant) => IconNames | null;
3
4
  export { getIconNameForVariant };
@@ -3,10 +3,18 @@ import type { CSSResult } from 'lit';
3
3
  import Popover from '../popover/popover.component';
4
4
  import type { TooltipType } from './tooltip.types';
5
5
  /**
6
+ * A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>
7
+ * Tooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.
8
+ *
9
+ * Because of this, tooltips cannot contain content that can be focused or interacted with.
10
+ * When a tooltip must contain a focusable element like a link or button, use a toggle tip instead.
11
+ *
6
12
  * A tooltip is triggered by mouse hover or by keyboard focus
7
13
  * and will disappear upon mouse exit or focus change.
8
14
  *
9
- * Note: Tooltips cannot contain content that can be focused or interacted with.
15
+ * Note:
16
+ * - Tooltips cannot contain content that can be focused or interacted with.
17
+ * - Tooltips will contain the default `aria-hidden="true"` so that VO will never focus the tooltip.
10
18
  *
11
19
  * @tagname mdc-tooltip
12
20
  *
@@ -11,14 +11,22 @@ import { property } from 'lit/decorators.js';
11
11
  import { v4 as uuidv4 } from 'uuid';
12
12
  import { ROLE } from '../../utils/roles';
13
13
  import Popover from '../popover/popover.component';
14
- import { POPOVER_PLACEMENT } from '../popover/popover.constants';
14
+ import { DEFAULTS as POPOVER_DEFAULTS, POPOVER_PLACEMENT } from '../popover/popover.constants';
15
15
  import { DEFAULTS, TOOLTIP_TYPES } from './tooltip.constants';
16
16
  import styles from './tooltip.styles';
17
17
  /**
18
+ * A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>
19
+ * Tooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.
20
+ *
21
+ * Because of this, tooltips cannot contain content that can be focused or interacted with.
22
+ * When a tooltip must contain a focusable element like a link or button, use a toggle tip instead.
23
+ *
18
24
  * A tooltip is triggered by mouse hover or by keyboard focus
19
25
  * and will disappear upon mouse exit or focus change.
20
26
  *
21
- * Note: Tooltips cannot contain content that can be focused or interacted with.
27
+ * Note:
28
+ * - Tooltips cannot contain content that can be focused or interacted with.
29
+ * - Tooltips will contain the default `aria-hidden="true"` so that VO will never focus the tooltip.
22
30
  *
23
31
  * @tagname mdc-tooltip
24
32
  *
@@ -47,24 +55,27 @@ class Tooltip extends Popover {
47
55
  }
48
56
  connectedCallback() {
49
57
  super.connectedCallback();
50
- this.backdrop = false;
58
+ this.role = ROLE.TOOLTIP;
59
+ // We don't want the tooltip to be visible for screen readers as they are not focusable
60
+ this.ariaHidden = DEFAULTS.ARIA_HIDDEN;
61
+ // Tooltip defaults
62
+ this.backdrop = DEFAULTS.BACKDROP;
51
63
  this.delay = this.delay || DEFAULTS.DELAY;
52
- this.focusTrap = false;
53
- this.hideOnBlur = true;
54
- this.hideOnEscape = true;
55
- this.interactive = false;
64
+ this.disableAriaExpanded = DEFAULTS.DISABLE_ARIA_EXPANDED;
65
+ this.hideOnBlur = DEFAULTS.HIDE_ON_BLUR;
66
+ this.hideOnEscape = DEFAULTS.HIDE_ON_ESCAPE;
56
67
  this.offset = this.offset || DEFAULTS.OFFSET;
57
68
  this.placement = this.placement || DEFAULTS.PLACEMENT;
58
- this.role = ROLE.TOOLTIP;
59
- this.trigger = 'mouseenter focusin';
60
- this.preventScroll = false;
61
- this.disableFlip = false;
62
- this.preventScroll = false;
63
- this.closeButton = false;
64
- this.hideOnOutsideClick = false;
65
- this.focusBackToTrigger = false;
66
- this.size = false;
67
- this.disableAriaExpanded = true;
69
+ this.trigger = DEFAULTS.TRIGGER;
70
+ // Popover defaults
71
+ this.closeButton = POPOVER_DEFAULTS.CLOSE_BUTTON;
72
+ this.disableFlip = POPOVER_DEFAULTS.DISABLE_FLIP;
73
+ this.focusBackToTrigger = POPOVER_DEFAULTS.FOCUS_BACK;
74
+ this.focusTrap = POPOVER_DEFAULTS.FOCUS_TRAP;
75
+ this.hideOnOutsideClick = POPOVER_DEFAULTS.HIDE_ON_CLICK_OUTSIDE;
76
+ this.interactive = POPOVER_DEFAULTS.INTERACTIVE;
77
+ this.preventScroll = POPOVER_DEFAULTS.PREVENT_SCROLL;
78
+ this.size = POPOVER_DEFAULTS.SIZE;
68
79
  }
69
80
  /**
70
81
  * Sets the type attribute for the tooltip component.
@@ -5,8 +5,13 @@ declare const TOOLTIP_TYPES: {
5
5
  readonly NONE: "none";
6
6
  };
7
7
  declare const DEFAULTS: {
8
+ readonly ARIA_HIDDEN: "true";
8
9
  readonly BACKDROP: false;
9
10
  readonly DELAY: "0,0";
11
+ readonly DISABLE_ARIA_EXPANDED: true;
12
+ readonly HIDE_ON_BLUR: true;
13
+ readonly HIDE_ON_ESCAPE: true;
14
+ readonly TRIGGER: "mouseenter focusin";
10
15
  readonly OFFSET: 4;
11
16
  readonly PLACEMENT: "top";
12
17
  readonly SHOW_ARROW: true;
@@ -1,5 +1,5 @@
1
1
  import utils from '../../utils/tag-name';
2
- import { POPOVER_PLACEMENT } from '../popover/popover.constants';
2
+ import { POPOVER_PLACEMENT, TRIGGER } from '../popover/popover.constants';
3
3
  const TAG_NAME = utils.constructTagName('tooltip');
4
4
  const TOOLTIP_TYPES = {
5
5
  DESCRIPTION: 'description',
@@ -7,8 +7,13 @@ const TOOLTIP_TYPES = {
7
7
  NONE: 'none',
8
8
  };
9
9
  const DEFAULTS = {
10
+ ARIA_HIDDEN: 'true',
10
11
  BACKDROP: false,
11
12
  DELAY: '0,0',
13
+ DISABLE_ARIA_EXPANDED: true,
14
+ HIDE_ON_BLUR: true,
15
+ HIDE_ON_ESCAPE: true,
16
+ TRIGGER: `${TRIGGER.MOUSEENTER} ${TRIGGER.FOCUSIN}`,
12
17
  OFFSET: 4,
13
18
  PLACEMENT: POPOVER_PLACEMENT.TOP,
14
19
  SHOW_ARROW: true,
@@ -153,8 +153,8 @@
153
153
  "attribute": "disabled",
154
154
  "reflects": true,
155
155
  "inheritedFrom": {
156
- "name": "AccordionButton",
157
- "module": "components/accordionbutton/accordionbutton.component.js"
156
+ "name": "DisabledMixin",
157
+ "module": "utils/mixins/DisabledMixin.js"
158
158
  }
159
159
  },
160
160
  {
@@ -412,8 +412,8 @@
412
412
  "default": "undefined",
413
413
  "fieldName": "disabled",
414
414
  "inheritedFrom": {
415
- "name": "AccordionButton",
416
- "module": "src/components/accordionbutton/accordionbutton.component.ts"
415
+ "name": "DisabledMixin",
416
+ "module": "src/utils/mixins/DisabledMixin.ts"
417
417
  }
418
418
  },
419
419
  {
@@ -4797,9 +4797,8 @@
4797
4797
  "kind": "field",
4798
4798
  "name": "label",
4799
4799
  "type": {
4800
- "text": "string"
4800
+ "text": "string | undefined"
4801
4801
  },
4802
- "default": "''",
4803
4802
  "description": "Banner label text",
4804
4803
  "attribute": "label",
4805
4804
  "reflects": true
@@ -4839,9 +4838,8 @@
4839
4838
  {
4840
4839
  "name": "label",
4841
4840
  "type": {
4842
- "text": "string"
4841
+ "text": "string | undefined"
4843
4842
  },
4844
- "default": "''",
4845
4843
  "description": "Banner label text",
4846
4844
  "fieldName": "label"
4847
4845
  },
@@ -51347,7 +51345,7 @@
51347
51345
  "declarations": [
51348
51346
  {
51349
51347
  "kind": "class",
51350
- "description": "A tooltip is triggered by mouse hover or by keyboard focus\nand will disappear upon mouse exit or focus change.\n\nNote: Tooltips cannot contain content that can be focused or interacted with.",
51348
+ "description": "A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>\nTooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.\n\nBecause of this, tooltips cannot contain content that can be focused or interacted with.\nWhen a tooltip must contain a focusable element like a link or button, use a toggle tip instead.\n\nA tooltip is triggered by mouse hover or by keyboard focus\nand will disappear upon mouse exit or focus change.\n\nNote:\n - Tooltips cannot contain content that can be focused or interacted with.\n - Tooltips will contain the default `aria-hidden=\"true\"` so that VO will never focus the tooltip.",
51351
51349
  "name": "Tooltip",
51352
51350
  "cssProperties": [
51353
51351
  {
@@ -53377,7 +53375,7 @@
53377
53375
  "module": "/src/components/popover/popover.component"
53378
53376
  },
53379
53377
  "tagName": "mdc-tooltip",
53380
- "jsDoc": "/**\n * A tooltip is triggered by mouse hover or by keyboard focus\n * and will disappear upon mouse exit or focus change.\n *\n * Note: Tooltips cannot contain content that can be focused or interacted with.\n *\n * @tagname mdc-tooltip\n *\n * @event shown - (React: onShown) This event is dispatched when the tooltip is shown\n * @event hidden - (React: onHidden) This event is dispatched when the tooltip is hidden\n * @event created - (React: onCreated) This event is dispatched when the tooltip is created (added to the DOM)\n * @event destroyed - (React: onDestroyed) This event is dispatched when the tooltip is destroyed (removed from the DOM)\n *\n * @cssproperty --mdc-tooltip-max-width - The maximum width of the tooltip.\n * @cssproperty --mdc-tooltip-padding - The padding of the tooltip.\n * @cssproperty --mdc-tooltip-text-color - The text color of the tooltip.\n * @cssproperty --mdc-tooltip-text-color-contrast - The text color of the tooltip when the color is contrast.\n *\n */",
53378
+ "jsDoc": "/**\n * A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>\n * Tooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.\n *\n * Because of this, tooltips cannot contain content that can be focused or interacted with.\n * When a tooltip must contain a focusable element like a link or button, use a toggle tip instead.\n *\n * A tooltip is triggered by mouse hover or by keyboard focus\n * and will disappear upon mouse exit or focus change.\n *\n * Note:\n * - Tooltips cannot contain content that can be focused or interacted with.\n * - Tooltips will contain the default `aria-hidden=\"true\"` so that VO will never focus the tooltip.\n *\n * @tagname mdc-tooltip\n *\n * @event shown - (React: onShown) This event is dispatched when the tooltip is shown\n * @event hidden - (React: onHidden) This event is dispatched when the tooltip is hidden\n * @event created - (React: onCreated) This event is dispatched when the tooltip is created (added to the DOM)\n * @event destroyed - (React: onDestroyed) This event is dispatched when the tooltip is destroyed (removed from the DOM)\n *\n * @cssproperty --mdc-tooltip-max-width - The maximum width of the tooltip.\n * @cssproperty --mdc-tooltip-padding - The padding of the tooltip.\n * @cssproperty --mdc-tooltip-text-color - The text color of the tooltip.\n * @cssproperty --mdc-tooltip-text-color-contrast - The text color of the tooltip when the color is contrast.\n *\n */",
53381
53379
  "customElement": true,
53382
53380
  "slots": [
53383
53381
  {
@@ -2,10 +2,18 @@ import { type EventName } from '@lit/react';
2
2
  import Component from '../../components/tooltip';
3
3
  import type { Events as EventsInherited } from '../../components/popover/popover.types';
4
4
  /**
5
+ * A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>
6
+ * Tooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.
7
+ *
8
+ * Because of this, tooltips cannot contain content that can be focused or interacted with.
9
+ * When a tooltip must contain a focusable element like a link or button, use a toggle tip instead.
10
+ *
5
11
  * A tooltip is triggered by mouse hover or by keyboard focus
6
12
  * and will disappear upon mouse exit or focus change.
7
13
  *
8
- * Note: Tooltips cannot contain content that can be focused or interacted with.
14
+ * Note:
15
+ * - Tooltips cannot contain content that can be focused or interacted with.
16
+ * - Tooltips will contain the default `aria-hidden="true"` so that VO will never focus the tooltip.
9
17
  *
10
18
  * @tagname mdc-tooltip
11
19
  *
@@ -3,10 +3,18 @@ import { createComponent } from '@lit/react';
3
3
  import Component from '../../components/tooltip';
4
4
  import { TAG_NAME } from '../../components/tooltip/tooltip.constants';
5
5
  /**
6
+ * A Tooltip is a special type of popovers that provide additional context to content on the screen. <br/>
7
+ * Tooltip is triggered by mouse hover or by keyboard focus and will disappear upon mouse exit or focus change.
8
+ *
9
+ * Because of this, tooltips cannot contain content that can be focused or interacted with.
10
+ * When a tooltip must contain a focusable element like a link or button, use a toggle tip instead.
11
+ *
6
12
  * A tooltip is triggered by mouse hover or by keyboard focus
7
13
  * and will disappear upon mouse exit or focus change.
8
14
  *
9
- * Note: Tooltips cannot contain content that can be focused or interacted with.
15
+ * Note:
16
+ * - Tooltips cannot contain content that can be focused or interacted with.
17
+ * - Tooltips will contain the default `aria-hidden="true"` so that VO will never focus the tooltip.
10
18
  *
11
19
  * @tagname mdc-tooltip
12
20
  *
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.10",
4
+ "version": "0.129.12",
5
5
  "engines": {
6
6
  "node": ">=20.0.0",
7
7
  "npm": ">=8.0.0"