@momentum-design/components 0.120.36 → 0.120.37
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 +173 -173
- package/dist/browser/index.js.map +3 -3
- package/dist/components/popover/popover.component.d.ts +13 -0
- package/dist/components/popover/popover.component.js +30 -1
- package/dist/custom-elements.json +352 -352
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/package.json +1 -1
|
@@ -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>
|