@momentum-design/components 0.120.36 → 0.120.38
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.
- package/dist/browser/index.js +203 -203
- package/dist/browser/index.js.map +3 -3
- package/dist/components/animation/animation.component.d.ts +1 -1
- package/dist/components/animation/animation.component.js +5 -4
- package/dist/components/dialog/dialog.component.d.ts +1 -1
- package/dist/components/dialog/dialog.component.js +5 -5
- package/dist/components/icon/icon.component.d.ts +1 -1
- package/dist/components/icon/icon.component.js +4 -4
- package/dist/components/illustration/illustration.component.js +3 -2
- package/dist/components/popover/popover.component.d.ts +13 -0
- package/dist/components/popover/popover.component.js +30 -1
- package/dist/custom-elements.json +1166 -1166
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +5 -5
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ import { createRef, ref } from 'lit/directives/ref.js';
|
|
|
13
13
|
import lottie from 'lottie-web/build/player/lottie_light';
|
|
14
14
|
import animationManifest from '@momentum-design/animations/dist/manifest';
|
|
15
15
|
import { Component } from '../../models';
|
|
16
|
+
import { ROLE } from '../../utils/roles';
|
|
16
17
|
import styles from './animation.styles';
|
|
17
18
|
import { DEFAULTS } from './animation.constants';
|
|
18
19
|
/**
|
|
@@ -52,7 +53,7 @@ class Animation extends Component {
|
|
|
52
53
|
/**
|
|
53
54
|
* Aria-labelledby attribute to be set for accessibility
|
|
54
55
|
*/
|
|
55
|
-
this.
|
|
56
|
+
this.ariaLabelledby = null;
|
|
56
57
|
/**
|
|
57
58
|
* Container for the animation
|
|
58
59
|
*/
|
|
@@ -143,8 +144,8 @@ class Animation extends Component {
|
|
|
143
144
|
if (changedProperties.has('name') || changedProperties.has('loop') || changedProperties.has('autoplay')) {
|
|
144
145
|
this.getAnimationData();
|
|
145
146
|
}
|
|
146
|
-
if (changedProperties.has('ariaLabel') || changedProperties.has('
|
|
147
|
-
this.role = this.ariaLabel || this.
|
|
147
|
+
if (changedProperties.has('ariaLabel') || changedProperties.has('ariaLabelledby')) {
|
|
148
|
+
this.role = this.ariaLabel || this.ariaLabelledby ? ROLE.IMG : null;
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
disconnectedCallback() {
|
|
@@ -180,5 +181,5 @@ __decorate([
|
|
|
180
181
|
__decorate([
|
|
181
182
|
property({ type: String, attribute: 'aria-labelledby' }),
|
|
182
183
|
__metadata("design:type", Object)
|
|
183
|
-
], Animation.prototype, "
|
|
184
|
+
], Animation.prototype, "ariaLabelledby", void 0);
|
|
184
185
|
export default Animation;
|
|
@@ -117,7 +117,7 @@ declare class Dialog extends Dialog_base {
|
|
|
117
117
|
* Defines a string value for the aria-describedby attribute that refers to the element
|
|
118
118
|
* describing the dialog for accessibility
|
|
119
119
|
*/
|
|
120
|
-
|
|
120
|
+
ariaDescribedby: string | null;
|
|
121
121
|
/**
|
|
122
122
|
* Defines a string value for the aria-description attribute that refers to the element
|
|
123
123
|
* describing the dialog for accessibility
|
|
@@ -131,7 +131,7 @@ class Dialog extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(FooterMixin
|
|
|
131
131
|
* Defines a string value for the aria-describedby attribute that refers to the element
|
|
132
132
|
* describing the dialog for accessibility
|
|
133
133
|
*/
|
|
134
|
-
this.
|
|
134
|
+
this.ariaDescribedby = null;
|
|
135
135
|
/**
|
|
136
136
|
* Defines a string value for the aria-description attribute that refers to the element
|
|
137
137
|
* describing the dialog for accessibility
|
|
@@ -251,8 +251,8 @@ class Dialog extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(FooterMixin
|
|
|
251
251
|
this.updateFooterButtonColors(this.variant);
|
|
252
252
|
}
|
|
253
253
|
if (changedProperties.has('ariaLabel') ||
|
|
254
|
-
changedProperties.has('
|
|
255
|
-
changedProperties.has('
|
|
254
|
+
changedProperties.has('ariaLabelledby') ||
|
|
255
|
+
changedProperties.has('ariaDescribedby') ||
|
|
256
256
|
changedProperties.has('ariaDescription') ||
|
|
257
257
|
changedProperties.has('headerText') ||
|
|
258
258
|
changedProperties.has('descriptionText')) {
|
|
@@ -296,7 +296,7 @@ class Dialog extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(FooterMixin
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
// If aria-describedby or aria-description is already set, do not override it
|
|
299
|
-
if (!this.
|
|
299
|
+
if (!this.ariaDescribedby && !this.ariaDescription) {
|
|
300
300
|
if (this.descriptionText) {
|
|
301
301
|
this.setAttribute('aria-description', this.descriptionText);
|
|
302
302
|
}
|
|
@@ -462,7 +462,7 @@ __decorate([
|
|
|
462
462
|
__decorate([
|
|
463
463
|
property({ type: String, reflect: true, attribute: 'aria-describedby' }),
|
|
464
464
|
__metadata("design:type", Object)
|
|
465
|
-
], Dialog.prototype, "
|
|
465
|
+
], Dialog.prototype, "ariaDescribedby", void 0);
|
|
466
466
|
__decorate([
|
|
467
467
|
property({ type: String, reflect: true, attribute: 'aria-description' }),
|
|
468
468
|
__metadata("design:type", Object)
|
|
@@ -72,7 +72,7 @@ declare class Icon extends Component {
|
|
|
72
72
|
/**
|
|
73
73
|
* Aria-labelledby attribute to be set for accessibility
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
ariaLabelledby: string | null;
|
|
76
76
|
private readonly iconProviderContext;
|
|
77
77
|
private abortController?;
|
|
78
78
|
constructor();
|
|
@@ -77,7 +77,7 @@ class Icon extends Component {
|
|
|
77
77
|
/**
|
|
78
78
|
* Aria-labelledby attribute to be set for accessibility
|
|
79
79
|
*/
|
|
80
|
-
this.
|
|
80
|
+
this.ariaLabelledby = null;
|
|
81
81
|
this.iconProviderContext = providerUtils.consume({ host: this, context: IconProvider.Context });
|
|
82
82
|
this.abortController = new AbortController(); // Initialize AbortController
|
|
83
83
|
}
|
|
@@ -205,8 +205,8 @@ class Icon extends Component {
|
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
-
if (changedProperties.has('ariaLabel') || changedProperties.has('
|
|
209
|
-
this.role = this.ariaLabel || this.
|
|
208
|
+
if (changedProperties.has('ariaLabel') || changedProperties.has('ariaLabelledby')) {
|
|
209
|
+
this.role = this.ariaLabel || this.ariaLabelledby ? 'img' : null;
|
|
210
210
|
}
|
|
211
211
|
if (changedProperties.has('size') || changedProperties.has('lengthUnit')) {
|
|
212
212
|
this.updateSize();
|
|
@@ -263,7 +263,7 @@ __decorate([
|
|
|
263
263
|
__decorate([
|
|
264
264
|
property({ type: String, attribute: 'aria-labelledby' }),
|
|
265
265
|
__metadata("design:type", Object)
|
|
266
|
-
], Icon.prototype, "
|
|
266
|
+
], Icon.prototype, "ariaLabelledby", void 0);
|
|
267
267
|
__decorate([
|
|
268
268
|
state(),
|
|
269
269
|
__metadata("design:type", AbortController)
|
|
@@ -12,6 +12,7 @@ import { property, state } from 'lit/decorators.js';
|
|
|
12
12
|
import { Component } from '../../models';
|
|
13
13
|
import providerUtils from '../../utils/provider';
|
|
14
14
|
import IllustrationProvider from '../illustrationprovider/illustrationprovider.component';
|
|
15
|
+
import { ROLE } from '../../utils/roles';
|
|
15
16
|
import styles from './illustration.styles';
|
|
16
17
|
import { svgFetch } from './illustration.utils';
|
|
17
18
|
import { DEFAULTS } from './illustration.constants';
|
|
@@ -181,8 +182,8 @@ class Illustration extends Component {
|
|
|
181
182
|
}
|
|
182
183
|
});
|
|
183
184
|
}
|
|
184
|
-
if (changedProperties.has('ariaLabel') || changedProperties.has('
|
|
185
|
-
this.role = this.ariaLabel || this.ariaLabelledby ?
|
|
185
|
+
if (changedProperties.has('ariaLabel') || changedProperties.has('ariaLabelledby')) {
|
|
186
|
+
this.role = this.ariaLabel || this.ariaLabelledby ? ROLE.IMG : null;
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
189
|
disconnectedCallback() {
|
|
@@ -447,6 +447,19 @@ declare class Popover extends Popover_base {
|
|
|
447
447
|
*/
|
|
448
448
|
private positionPopover;
|
|
449
449
|
protected isEventFromTrigger(event: Event): boolean;
|
|
450
|
+
/**
|
|
451
|
+
* Detects if the current layout is in RTL (right-to-left) mode.
|
|
452
|
+
* @returns True if RTL, false if LTR
|
|
453
|
+
* @internal
|
|
454
|
+
*/
|
|
455
|
+
protected isRtl(): boolean;
|
|
456
|
+
/**
|
|
457
|
+
* Adjusts the placement for RTL layouts by flipping left/right directions.
|
|
458
|
+
* @param placement - The original placement value
|
|
459
|
+
* @returns The adjusted placement for RTL or original placement for LTR
|
|
460
|
+
* @internal
|
|
461
|
+
*/
|
|
462
|
+
protected adjustPlacementForRtl(placement: PopoverPlacement): PopoverPlacement;
|
|
450
463
|
render(): import("lit-html").TemplateResult<1>;
|
|
451
464
|
static styles: Array<CSSResult>;
|
|
452
465
|
}
|
|
@@ -648,8 +648,9 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
|
648
648
|
const { triggerElement } = this;
|
|
649
649
|
if (!triggerElement)
|
|
650
650
|
return;
|
|
651
|
+
const adjustedPlacement = this.adjustPlacementForRtl(this.placement);
|
|
651
652
|
const { x, y, middlewareData, placement } = await computePosition(triggerElement, this, {
|
|
652
|
-
placement:
|
|
653
|
+
placement: adjustedPlacement,
|
|
653
654
|
middleware,
|
|
654
655
|
strategy: this.strategy,
|
|
655
656
|
});
|
|
@@ -860,6 +861,34 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
|
|
|
860
861
|
}
|
|
861
862
|
return ((_a = event.target) === null || _a === void 0 ? void 0 : _a.id) === this.triggerID;
|
|
862
863
|
}
|
|
864
|
+
/**
|
|
865
|
+
* Detects if the current layout is in RTL (right-to-left) mode.
|
|
866
|
+
* @returns True if RTL, false if LTR
|
|
867
|
+
* @internal
|
|
868
|
+
*/
|
|
869
|
+
isRtl() {
|
|
870
|
+
return window.getComputedStyle(this).direction === 'rtl';
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Adjusts the placement for RTL layouts by flipping left/right directions.
|
|
874
|
+
* @param placement - The original placement value
|
|
875
|
+
* @returns The adjusted placement for RTL or original placement for LTR
|
|
876
|
+
* @internal
|
|
877
|
+
*/
|
|
878
|
+
adjustPlacementForRtl(placement) {
|
|
879
|
+
if (!this.isRtl()) {
|
|
880
|
+
return placement;
|
|
881
|
+
}
|
|
882
|
+
switch (placement) {
|
|
883
|
+
case POPOVER_PLACEMENT.LEFT: return POPOVER_PLACEMENT.RIGHT;
|
|
884
|
+
case POPOVER_PLACEMENT.LEFT_START: return POPOVER_PLACEMENT.RIGHT_START;
|
|
885
|
+
case POPOVER_PLACEMENT.LEFT_END: return POPOVER_PLACEMENT.RIGHT_END;
|
|
886
|
+
case POPOVER_PLACEMENT.RIGHT: return POPOVER_PLACEMENT.LEFT;
|
|
887
|
+
case POPOVER_PLACEMENT.RIGHT_START: return POPOVER_PLACEMENT.LEFT_START;
|
|
888
|
+
case POPOVER_PLACEMENT.RIGHT_END: return POPOVER_PLACEMENT.LEFT_END;
|
|
889
|
+
default: return placement;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
863
892
|
render() {
|
|
864
893
|
return html `
|
|
865
894
|
<div part="popover-hover-bridge"></div>
|