@momentum-design/components 0.80.5 → 0.81.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.
Files changed (33) hide show
  1. package/dist/browser/index.js +276 -239
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/dialog/dialog.component.d.ts +49 -21
  4. package/dist/components/dialog/dialog.component.js +143 -93
  5. package/dist/components/dialog/dialog.constants.d.ts +1 -0
  6. package/dist/components/dialog/dialog.constants.js +1 -0
  7. package/dist/components/popover/popover.component.d.ts +8 -1
  8. package/dist/components/popover/popover.component.js +16 -4
  9. package/dist/components/popover/popover.constants.d.ts +1 -0
  10. package/dist/components/popover/popover.constants.js +1 -0
  11. package/dist/components/popover/popover.utils.js +1 -1
  12. package/dist/components/skeleton/index.d.ts +7 -0
  13. package/dist/components/skeleton/index.js +4 -0
  14. package/dist/components/skeleton/skeleton.component.d.ts +46 -0
  15. package/dist/components/skeleton/skeleton.component.js +86 -0
  16. package/dist/components/skeleton/skeleton.constants.d.ts +11 -0
  17. package/dist/components/skeleton/skeleton.constants.js +12 -0
  18. package/dist/components/skeleton/skeleton.styles.d.ts +2 -0
  19. package/dist/components/skeleton/skeleton.styles.js +40 -0
  20. package/dist/components/skeleton/skeleton.types.d.ts +4 -0
  21. package/dist/components/skeleton/skeleton.types.js +1 -0
  22. package/dist/components/toggletip/toggletip.component.js +1 -0
  23. package/dist/components/tooltip/tooltip.component.js +0 -2
  24. package/dist/custom-elements.json +776 -486
  25. package/dist/index.d.ts +6 -3
  26. package/dist/index.js +4 -2
  27. package/dist/react/index.d.ts +2 -1
  28. package/dist/react/index.js +2 -1
  29. package/dist/react/skeleton/index.d.ts +25 -0
  30. package/dist/react/skeleton/index.js +34 -0
  31. package/dist/utils/mixins/FocusTrapMixin.d.ts +6 -5
  32. package/dist/utils/mixins/FocusTrapMixin.js +51 -22
  33. package/package.json +1 -1
@@ -0,0 +1,86 @@
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 { Component } from '../../models';
13
+ import { DEFAULTS } from './skeleton.constants';
14
+ import styles from './skeleton.styles';
15
+ /**
16
+ * `mdc-skeleton` is a component that shows a grey placeholder area.
17
+ * It provides visual feedback to users that content is being loaded.
18
+ *
19
+ * **Skeleton Variants:**
20
+ * - **rectangular**: Default variant with 0.25rem border radius
21
+ * - **rounded**: Has 0.5rem border radius
22
+ * - **circular**: Has 50% border radius for circular shapes
23
+ * - **button**: Optimized for button placeholders with 1.25rem border radius
24
+ *
25
+ * **Sizing Behavior:**
26
+ * 1. If wrapping content, takes dimensions of wrapped content
27
+ * 2. Otherwise grows to fill parent container
28
+ *
29
+ * @tagname mdc-skeleton
30
+ *
31
+ * @slot - Content to wrap (optional). When provided, skeleton takes dimensions of this content.
32
+ *
33
+ * @cssproperty --mdc-skeleton-background-color - background color of the skeleton
34
+ * @cssproperty --mdc-skeleton-height - height of the skeleton
35
+ * @cssproperty --mdc-skeleton-width - width of the skeleton
36
+ */
37
+ class Skeleton extends Component {
38
+ constructor() {
39
+ super(...arguments);
40
+ /**
41
+ * The variant of skeleton to display
42
+ * - **rectangular**: Default rectangular shape with 0.25rem border radius
43
+ * - **rounded**: Rounded rectangle with 0.5rem border radius
44
+ * - **circular**: Circular shape with 50% border radius
45
+ * - **button**: Button placeholder with 1.25rem border radius
46
+ * @default rectangular
47
+ */
48
+ this.variant = DEFAULTS.VARIANT;
49
+ }
50
+ connectedCallback() {
51
+ super.connectedCallback();
52
+ this.setAttribute('aria-hidden', 'true');
53
+ }
54
+ firstUpdated(changedProperties) {
55
+ super.firstUpdated(changedProperties);
56
+ this.checkSlotContent();
57
+ }
58
+ checkSlotContent() {
59
+ var _a;
60
+ const slot = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
61
+ if (slot) {
62
+ const hasContent = slot.assignedNodes().length > 0;
63
+ if (hasContent) {
64
+ this.setAttribute('has-content', '');
65
+ }
66
+ else {
67
+ this.removeAttribute('has-content');
68
+ }
69
+ }
70
+ }
71
+ render() {
72
+ return html `<slot @slotchange=${this.checkSlotContent}></slot>`;
73
+ }
74
+ }
75
+ /**
76
+ * Styles associated with this component.
77
+ */
78
+ Skeleton.styles = [
79
+ ...Component.styles,
80
+ styles,
81
+ ];
82
+ __decorate([
83
+ property({ type: String, reflect: true }),
84
+ __metadata("design:type", String)
85
+ ], Skeleton.prototype, "variant", void 0);
86
+ export default Skeleton;
@@ -0,0 +1,11 @@
1
+ declare const TAG_NAME: "mdc-skeleton";
2
+ declare const SKELETON_VARIANTS: {
3
+ readonly BUTTON: "button";
4
+ readonly CIRCULAR: "circular";
5
+ readonly RECTANGULAR: "rectangular";
6
+ readonly ROUNDED: "rounded";
7
+ };
8
+ declare const DEFAULTS: {
9
+ VARIANT: "rectangular";
10
+ };
11
+ export { TAG_NAME, SKELETON_VARIANTS, DEFAULTS, };
@@ -0,0 +1,12 @@
1
+ import utils from '../../utils/tag-name';
2
+ const TAG_NAME = utils.constructTagName('skeleton');
3
+ const SKELETON_VARIANTS = {
4
+ BUTTON: 'button',
5
+ CIRCULAR: 'circular',
6
+ RECTANGULAR: 'rectangular',
7
+ ROUNDED: 'rounded',
8
+ };
9
+ const DEFAULTS = {
10
+ VARIANT: SKELETON_VARIANTS.RECTANGULAR,
11
+ };
12
+ export { TAG_NAME, SKELETON_VARIANTS, DEFAULTS, };
@@ -0,0 +1,2 @@
1
+ declare const styles: import("lit").CSSResult;
2
+ export default styles;
@@ -0,0 +1,40 @@
1
+ import { css } from 'lit';
2
+ const styles = css `
3
+ :host {
4
+ --mdc-skeleton-background-color: var(--mds-color-theme-background-skeleton-normal);
5
+ --mdc-skeleton-height: 100%;
6
+ --mdc-skeleton-width: 100%;
7
+ display: block;
8
+ overflow: hidden;
9
+ background-color: var(--mdc-skeleton-background-color);
10
+ height: var(--mdc-skeleton-height);
11
+ width: var(--mdc-skeleton-width);
12
+ }
13
+
14
+ :host([variant="rectangular"]) {
15
+ border-radius: 0.25rem;
16
+ }
17
+
18
+ :host([variant="rounded"]) {
19
+ border-radius: 0.5rem;
20
+ }
21
+
22
+ :host([variant="circular"]) {
23
+ border-radius: 50%;
24
+ }
25
+
26
+ :host([variant="button"]) {
27
+ border-radius: 1.25rem;
28
+ }
29
+
30
+ /* When there's slotted content, fit to content size */
31
+ :host([has-content]) {
32
+ width: fit-content;
33
+ height: fit-content;
34
+ }
35
+
36
+ ::slotted(*) {
37
+ visibility: hidden;
38
+ }
39
+ `;
40
+ export default styles;
@@ -0,0 +1,4 @@
1
+ import type { ValueOf } from '../../utils/types';
2
+ import { SKELETON_VARIANTS } from './skeleton.constants';
3
+ type SkeletonVariant = ValueOf<typeof SKELETON_VARIANTS>;
4
+ export type { SkeletonVariant };
@@ -0,0 +1 @@
1
+ export {};
@@ -70,6 +70,7 @@ class ToggleTip extends Popover {
70
70
  this.hideOnOutsideClick = true;
71
71
  this.disableAriaExpanded = false;
72
72
  this.focusBackToTrigger = true;
73
+ this.focusTrap = true;
73
74
  }
74
75
  /**
75
76
  * @returns The text content of all the nodes in the default slot, joined by a space.
@@ -57,10 +57,8 @@ class Tooltip extends Popover {
57
57
  this.placement = this.placement || DEFAULTS.PLACEMENT;
58
58
  this.role = ROLE.TOOLTIP;
59
59
  this.trigger = 'mouseenter focusin';
60
- this.enabledFocusTrap = false;
61
60
  this.enabledPreventScroll = false;
62
61
  this.flip = true;
63
- this.focusTrap = false;
64
62
  this.preventScroll = false;
65
63
  this.closeButton = false;
66
64
  this.hideOnOutsideClick = false;