@brightspace-ui/core 3.142.1 → 3.143.0
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/components/list/list-item-mixin.js +3 -0
- package/components/popover/demo/popover.html +42 -33
- package/components/popover/popover-mixin.js +211 -92
- package/custom-elements.json +11 -0
- package/lang/ar.js +85 -12
- package/lang/cy.js +85 -12
- package/lang/da.js +85 -12
- package/lang/de.js +85 -12
- package/lang/en-gb.js +85 -12
- package/lang/en.js +85 -12
- package/lang/es-es.js +85 -12
- package/lang/es.js +85 -12
- package/lang/fr-fr.js +85 -12
- package/lang/fr.js +85 -12
- package/lang/haw.js +85 -12
- package/lang/hi.js +85 -12
- package/lang/ja.js +77 -12
- package/lang/ko.js +77 -12
- package/lang/mi.js +85 -12
- package/lang/nl.js +85 -12
- package/lang/pt.js +85 -12
- package/lang/sv.js +85 -12
- package/lang/tr.js +85 -12
- package/lang/zh-cn.js +77 -12
- package/lang/zh-tw.js +78 -12
- package/package.json +1 -1
@@ -6,12 +6,25 @@ import { css, html, nothing } from 'lit';
|
|
6
6
|
import { getComposedActiveElement, getFirstFocusableDescendant, getPreviousFocusableAncestor } from '../../helpers/focus.js';
|
7
7
|
import { getComposedParent, isComposedAncestor } from '../../helpers/dom.js';
|
8
8
|
import { _offscreenStyleDeclarations } from '../offscreen/offscreen.js';
|
9
|
+
import { classMap } from 'lit/directives/class-map.js';
|
9
10
|
import { styleMap } from 'lit/directives/style-map.js';
|
10
11
|
import { tryGetIfrauBackdropService } from '../../helpers/ifrauBackdropService.js';
|
11
12
|
|
13
|
+
export const positionLocations = Object.freeze({
|
14
|
+
blockEnd: 'block-end',
|
15
|
+
blockStart: 'block-start',
|
16
|
+
inlineEnd: 'inline-end',
|
17
|
+
inlineStart: 'inline-start'
|
18
|
+
});
|
19
|
+
export const positionSpans = Object.freeze({
|
20
|
+
all: 'all',
|
21
|
+
end: 'end',
|
22
|
+
start: 'start'
|
23
|
+
});
|
24
|
+
|
12
25
|
const defaultPreferredPosition = {
|
13
|
-
location:
|
14
|
-
span:
|
26
|
+
location: positionLocations.blockEnd,
|
27
|
+
span: positionSpans.all,
|
15
28
|
allowFlip: true
|
16
29
|
};
|
17
30
|
const minBackdropHeightMobile = 42;
|
@@ -20,6 +33,12 @@ const pointerLength = 16;
|
|
20
33
|
const pointerRotatedLength = Math.SQRT2 * parseFloat(pointerLength);
|
21
34
|
const isSupported = ('popover' in HTMLElement.prototype);
|
22
35
|
|
36
|
+
const getScrollbarWidth = () => {
|
37
|
+
const width = window.innerWidth - document.documentElement.clientWidth;
|
38
|
+
if (width > 0) return width + 1; // 16 when present, but can be 0 even if visible (ex. MacOS depending on settings)
|
39
|
+
else return 0;
|
40
|
+
};
|
41
|
+
|
23
42
|
export const PopoverMixin = superclass => class extends superclass {
|
24
43
|
|
25
44
|
static get properties() {
|
@@ -127,6 +146,17 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
127
146
|
position: absolute;
|
128
147
|
z-index: 1;
|
129
148
|
}
|
149
|
+
:host([_location="block-start"]) .pointer {
|
150
|
+
clip: rect(9px, 21px, 22px, -3px);
|
151
|
+
}
|
152
|
+
:host([_location="inline-start"]) .pointer,
|
153
|
+
:host([_location="inline-end"]) .pointer.pointer-mirror {
|
154
|
+
clip: rect(-3px, 21px, 21px, 10px);
|
155
|
+
}
|
156
|
+
:host([_location="inline-end"]) .pointer,
|
157
|
+
:host([_location="inline-start"]) .pointer.pointer-mirror {
|
158
|
+
clip: rect(-3px, 8px, 21px, -3px);
|
159
|
+
}
|
130
160
|
|
131
161
|
.pointer > div {
|
132
162
|
background-color: var(--d2l-popover-background-color, var(--d2l-popover-default-background-color));
|
@@ -138,10 +168,6 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
138
168
|
width: ${pointerLength}px;
|
139
169
|
}
|
140
170
|
|
141
|
-
:host([_location="block-start"]) .pointer {
|
142
|
-
clip: rect(9px, 21px, 22px, -3px);
|
143
|
-
}
|
144
|
-
|
145
171
|
:host([_location="block-start"]) .pointer > div {
|
146
172
|
box-shadow: 4px 4px 12px -5px rgba(32, 33, 34, 0.2); /* ferrite */
|
147
173
|
}
|
@@ -278,7 +304,10 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
278
304
|
}
|
279
305
|
|
280
306
|
configure(properties) {
|
281
|
-
this._margin = properties
|
307
|
+
if (properties?.margin) this._margin = properties.margin;
|
308
|
+
else if (properties?.position?.location === positionLocations.inlineStart
|
309
|
+
|| properties?.position?.location === positionLocations.inlineEnd) this._margin = 0;
|
310
|
+
else this._margin = 18;
|
282
311
|
this._maxHeight = properties?.maxHeight;
|
283
312
|
this._maxWidth = properties?.maxWidth;
|
284
313
|
this._minHeight = properties?.minHeight;
|
@@ -296,8 +325,8 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
296
325
|
|| this._preferredPosition?.span !== properties.position?.span
|
297
326
|
|| this._preferredPosition?.allowFlip !== properties.position?.allowFlip) {
|
298
327
|
this._preferredPosition = {
|
299
|
-
location: properties?.position?.location ??
|
300
|
-
span: properties?.position?.span ??
|
328
|
+
location: properties?.position?.location ?? positionLocations.blockEnd,
|
329
|
+
span: properties?.position?.span ?? positionSpans.all,
|
301
330
|
allowFlip: properties?.position?.allowFlip ?? true
|
302
331
|
};
|
303
332
|
}
|
@@ -371,11 +400,12 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
371
400
|
};
|
372
401
|
|
373
402
|
// space in viewport
|
403
|
+
const prefersInline = this._preferredPosition.location === positionLocations.inlineStart || this._preferredPosition.location === positionLocations.inlineEnd;
|
374
404
|
const spaceAround = this.#constrainSpaceAround({
|
375
405
|
// allow for opener offset + outer margin
|
376
|
-
above: openerRect.top - this._offset - this._margin,
|
406
|
+
above: openerRect.top - (prefersInline ? 0 : this._offset) - this._margin,
|
377
407
|
// allow for opener offset + outer margin
|
378
|
-
below: window.innerHeight - openerRect.bottom - this._offset - this._margin,
|
408
|
+
below: window.innerHeight - openerRect.bottom - (prefersInline ? 0 : this._offset) - this._margin,
|
379
409
|
// allow for outer margin
|
380
410
|
left: openerRect.left - 20,
|
381
411
|
// allow for outer margin
|
@@ -398,7 +428,9 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
398
428
|
if (options.updateHeight) {
|
399
429
|
|
400
430
|
// calculate height available to the popover contents for overflow because that is the only area capable of scrolling
|
401
|
-
const availableHeight = (this._location ===
|
431
|
+
const availableHeight = (this._location === positionLocations.inlineStart || this._location === positionLocations.inlineEnd)
|
432
|
+
? (spaceAround.above + spaceAround.below + openerRect.height)
|
433
|
+
: (this._location === positionLocations.blockStart ? spaceAround.above : spaceAround.below);
|
402
434
|
|
403
435
|
if (!this._noAutoFit && availableHeight && availableHeight > 0) {
|
404
436
|
// only apply maximum if it's less than space available and the header/footer alone won't exceed it (content must be visible)
|
@@ -409,8 +441,6 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
409
441
|
await this.updateComplete;
|
410
442
|
}
|
411
443
|
|
412
|
-
// todo: handle inline-start and inline-end locations
|
413
|
-
|
414
444
|
}
|
415
445
|
|
416
446
|
/** @ignore */
|
@@ -434,9 +464,9 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
434
464
|
const mobileTrayLocation = this._mobile ? this._mobileTrayLocation : null;
|
435
465
|
|
436
466
|
let stylesMap;
|
437
|
-
if (mobileTrayLocation ===
|
467
|
+
if (mobileTrayLocation === positionLocations.blockEnd) {
|
438
468
|
stylesMap = this.#getMobileTrayBlockStyleMaps();
|
439
|
-
} else if (mobileTrayLocation ===
|
469
|
+
} else if (mobileTrayLocation === positionLocations.inlineStart || mobileTrayLocation === positionLocations.inlineEnd) {
|
440
470
|
stylesMap = this.#getMobileTrayInlineStyleMaps();
|
441
471
|
} else {
|
442
472
|
stylesMap = this.#getStyleMaps();
|
@@ -478,8 +508,12 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
478
508
|
}
|
479
509
|
}
|
480
510
|
|
511
|
+
const pointerClasses = {
|
512
|
+
'pointer': true,
|
513
|
+
'pointer-mirror': this._rtl
|
514
|
+
};
|
481
515
|
const pointer = !this._noPointer ? html`
|
482
|
-
<div class="
|
516
|
+
<div class="${classMap(pointerClasses)}" style="${styleMap(pointerPositionStyles)}">
|
483
517
|
<div></div>
|
484
518
|
</div>
|
485
519
|
` : nothing;
|
@@ -580,9 +614,9 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
580
614
|
#constrainSpaceAround(spaceAround, spaceRequired, openerRect) {
|
581
615
|
const constrained = { ...spaceAround };
|
582
616
|
|
583
|
-
if ((this._preferredPosition.span ===
|
617
|
+
if ((this._preferredPosition.span === positionSpans.end && !this._rtl) || (this._preferredPosition.span === positionSpans.start && this._rtl)) {
|
584
618
|
constrained.left = Math.max(0, spaceRequired.width - (openerRect.width + spaceAround.right));
|
585
|
-
} else if ((this._preferredPosition.span ===
|
619
|
+
} else if ((this._preferredPosition.span === positionSpans.end && this._rtl) || (this._preferredPosition.span === positionSpans.start && !this._rtl)) {
|
586
620
|
constrained.right = Math.max(0, spaceRequired.width - (openerRect.width + spaceAround.left));
|
587
621
|
}
|
588
622
|
|
@@ -621,28 +655,46 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
621
655
|
return preferred.location;
|
622
656
|
}
|
623
657
|
|
624
|
-
if (preferred.location ===
|
625
|
-
if (spaceAround.below >= spaceRequired.height) return
|
626
|
-
if (spaceAround.above >= spaceRequired.height) return
|
658
|
+
if (preferred.location === positionLocations.blockEnd) {
|
659
|
+
if (spaceAround.below >= spaceRequired.height) return positionLocations.blockEnd;
|
660
|
+
if (spaceAround.above >= spaceRequired.height) return positionLocations.blockStart;
|
627
661
|
// if auto-fit is enabled, scroll will be enabled for the inner content so it will always fit in the available space so pick the largest space it can be displayed in
|
628
|
-
if (!this.noAutoFit) return spaceAround.above > spaceAround.below ?
|
629
|
-
if (spaceAroundScroll.below >= spaceRequired.height) return
|
630
|
-
if (spaceAroundScroll.above >= spaceRequired.height) return
|
662
|
+
if (!this.noAutoFit) return spaceAround.above > spaceAround.below ? positionLocations.blockStart : positionLocations.blockEnd;
|
663
|
+
if (spaceAroundScroll.below >= spaceRequired.height) return positionLocations.blockEnd;
|
664
|
+
if (spaceAroundScroll.above >= spaceRequired.height) return positionLocations.blockStart;
|
631
665
|
}
|
632
666
|
|
633
|
-
if (preferred.location ===
|
634
|
-
if (spaceAround.above >= spaceRequired.height) return
|
635
|
-
if (spaceAround.below >= spaceRequired.height) return
|
667
|
+
if (preferred.location === positionLocations.blockStart) {
|
668
|
+
if (spaceAround.above >= spaceRequired.height) return positionLocations.blockStart;
|
669
|
+
if (spaceAround.below >= spaceRequired.height) return positionLocations.blockEnd;
|
636
670
|
// if auto-fit is enabled, scroll will be enabled for the inner content so it will always fit in the available space so pick the largest space it can be displayed in
|
637
|
-
if (!this.noAutoFit) return spaceAround.above > spaceAround.below ?
|
638
|
-
if (spaceAroundScroll.above >= spaceRequired.height) return
|
639
|
-
if (spaceAroundScroll.below >= spaceRequired.height) return
|
671
|
+
if (!this.noAutoFit) return spaceAround.above > spaceAround.below ? positionLocations.blockStart : positionLocations.blockEnd;
|
672
|
+
if (spaceAroundScroll.above >= spaceRequired.height) return positionLocations.blockStart;
|
673
|
+
if (spaceAroundScroll.below >= spaceRequired.height) return positionLocations.blockEnd;
|
640
674
|
}
|
641
675
|
|
642
|
-
|
676
|
+
if (preferred.location === positionLocations.inlineEnd) {
|
677
|
+
if (this._rtl) {
|
678
|
+
if (spaceAround.left >= spaceRequired.width) return positionLocations.inlineEnd;
|
679
|
+
if (spaceAround.right >= spaceRequired.width) return positionLocations.inlineStart;
|
680
|
+
} else {
|
681
|
+
if (spaceAround.right >= spaceRequired.width) return positionLocations.inlineEnd;
|
682
|
+
if (spaceAround.left >= spaceRequired.width) return positionLocations.inlineStart;
|
683
|
+
}
|
684
|
+
}
|
685
|
+
|
686
|
+
if (preferred.location === positionLocations.inlineStart) {
|
687
|
+
if (this._rtl) {
|
688
|
+
if (spaceAround.right >= spaceRequired.width) return positionLocations.inlineStart;
|
689
|
+
if (spaceAround.left >= spaceRequired.width) return positionLocations.inlineEnd;
|
690
|
+
} else {
|
691
|
+
if (spaceAround.left >= spaceRequired.width) return positionLocations.inlineStart;
|
692
|
+
if (spaceAround.right >= spaceRequired.width) return positionLocations.inlineEnd;
|
693
|
+
}
|
694
|
+
}
|
643
695
|
|
644
696
|
// if auto-fit is disabled and it doesn't fit in the scrollable space above or below, always open down because it can add scrollable space
|
645
|
-
return
|
697
|
+
return positionLocations.blockEnd;
|
646
698
|
}
|
647
699
|
|
648
700
|
#getMobileTrayBlockStyleMaps() {
|
@@ -743,11 +795,11 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
743
795
|
|
744
796
|
let inlineEndOverride;
|
745
797
|
let inlineStartOverride;
|
746
|
-
if (this._mobileTrayLocation ===
|
798
|
+
if (this._mobileTrayLocation === positionLocations.inlineEnd) {
|
747
799
|
// On non-responsive pages, the innerWidth may be wider than the screen,
|
748
800
|
// override right to stick to right of viewport
|
749
801
|
inlineEndOverride = `${Math.max(window.innerWidth - window.screen.width, 0)}px`;
|
750
|
-
} else if (this._mobileTrayLocation ===
|
802
|
+
} else if (this._mobileTrayLocation === positionLocations.inlineStart) {
|
751
803
|
// On non-responsive pages, the innerWidth may be wider than the screen,
|
752
804
|
// override left to stick to left of viewport
|
753
805
|
inlineStartOverride = `${Math.max(window.innerWidth - window.screen.width, 0)}px`;
|
@@ -794,33 +846,55 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
794
846
|
|
795
847
|
const pointerRect = pointer.getBoundingClientRect();
|
796
848
|
|
797
|
-
if (this.
|
798
|
-
|
799
|
-
if (
|
800
|
-
|
801
|
-
|
849
|
+
if (this._location === positionLocations.blockEnd || this._location === positionLocations.blockStart) {
|
850
|
+
|
851
|
+
if (this._preferredPosition.span !== positionSpans.all) {
|
852
|
+
const xAdjustment = Math.min(20 + ((pointerRotatedLength - pointerLength) / 2), (openerRect.width - pointerLength) / 2);
|
853
|
+
if (!this._rtl) {
|
854
|
+
if (this._preferredPosition.span === positionSpans.end) {
|
855
|
+
position.left = openerRect.left + xAdjustment;
|
856
|
+
} else {
|
857
|
+
position.right = (openerRect.right * -1) + xAdjustment;
|
858
|
+
}
|
802
859
|
} else {
|
803
|
-
|
860
|
+
if (this._preferredPosition.span === positionSpans.end) {
|
861
|
+
position.right = window.innerWidth - openerRect.right + xAdjustment - getScrollbarWidth();
|
862
|
+
} else {
|
863
|
+
position.left = (window.innerWidth - openerRect.left - xAdjustment - getScrollbarWidth()) * -1;
|
864
|
+
}
|
804
865
|
}
|
805
866
|
} else {
|
806
|
-
if (this.
|
807
|
-
position.
|
867
|
+
if (!this._rtl) {
|
868
|
+
position.left = openerRect.left + ((openerRect.width - pointerRect.width) / 2);
|
808
869
|
} else {
|
809
|
-
position.
|
870
|
+
position.right = window.innerWidth - openerRect.left - ((openerRect.width + pointerRect.width) / 2) - getScrollbarWidth();
|
810
871
|
}
|
811
872
|
}
|
812
|
-
|
813
|
-
if (
|
814
|
-
position.
|
873
|
+
|
874
|
+
if (this._location === positionLocations.blockStart) {
|
875
|
+
position.bottom = window.innerHeight - openerRect.top + this._offset - 8; // 8 minor adjustment to position pointer at edge of content
|
815
876
|
} else {
|
816
|
-
position.
|
877
|
+
position.top = openerRect.top + openerRect.height + this._offset - 7; // 7 minor adjustment to position pointer at edge of content
|
878
|
+
}
|
879
|
+
|
880
|
+
} else if (this._location === positionLocations.inlineEnd || this._location === positionLocations.inlineStart) {
|
881
|
+
|
882
|
+
position.top = openerRect.top + (openerRect.height / 2) - (pointerLength / 2);
|
883
|
+
|
884
|
+
if (this._location === positionLocations.inlineStart) {
|
885
|
+
if (!this._rtl) {
|
886
|
+
position.right = (openerRect.left - this._offset + 7) * -1; // 7 minor adjustment to position pointer at edge of content
|
887
|
+
} else {
|
888
|
+
position.left = (window.innerWidth - openerRect.right + 7 - this._offset - getScrollbarWidth()) * -1; // 7 minor adjustment to position pointer at edge of content
|
889
|
+
}
|
890
|
+
} else {
|
891
|
+
if (!this._rtl) {
|
892
|
+
position.left = openerRect.left + openerRect.width + this._offset - 7; // 7 minor adjustment to position pointer at edge of content
|
893
|
+
} else {
|
894
|
+
position.right = window.innerWidth - openerRect.left - 7 + this._offset - getScrollbarWidth(); // 7 minor adjustment to position pointer at edge of content
|
895
|
+
}
|
817
896
|
}
|
818
|
-
}
|
819
897
|
|
820
|
-
if (this._location === 'block-start') {
|
821
|
-
position.bottom = window.innerHeight - openerRect.top + this._offset - 8;
|
822
|
-
} else {
|
823
|
-
position.top = openerRect.top + openerRect.height + this._offset - 7;
|
824
898
|
}
|
825
899
|
|
826
900
|
return position;
|
@@ -829,79 +903,124 @@ export const PopoverMixin = superclass => class extends superclass {
|
|
829
903
|
#getPosition(spaceAround, openerRect, contentRect) {
|
830
904
|
const position = {};
|
831
905
|
|
832
|
-
if (this._location ===
|
906
|
+
if (this._location === positionLocations.blockEnd || this._location === positionLocations.blockStart) {
|
833
907
|
|
834
908
|
const xAdjustment = this.#getPositionXAdjustment(spaceAround, openerRect, contentRect);
|
835
909
|
if (xAdjustment !== null) {
|
836
910
|
if (!this._rtl) {
|
837
911
|
position.left = openerRect.left + xAdjustment;
|
838
912
|
} else {
|
839
|
-
position.right = window.innerWidth - openerRect.left - openerRect.width + xAdjustment;
|
913
|
+
position.right = window.innerWidth - openerRect.left - openerRect.width + xAdjustment - getScrollbarWidth();
|
840
914
|
}
|
841
915
|
}
|
842
916
|
|
843
|
-
if (this._location ===
|
917
|
+
if (this._location === positionLocations.blockStart) {
|
844
918
|
position.bottom = window.innerHeight - openerRect.top + this._offset;
|
845
919
|
} else {
|
846
920
|
position.top = openerRect.top + openerRect.height + this._offset;
|
847
921
|
}
|
848
922
|
|
849
|
-
}
|
923
|
+
} else if (this._location === positionLocations.inlineEnd || this._location === positionLocations.inlineStart) {
|
850
924
|
|
851
|
-
|
925
|
+
const yAdjustment = this.#getPositionYAdjustment(spaceAround, openerRect, contentRect);
|
926
|
+
if (yAdjustment !== null) {
|
927
|
+
position.top = openerRect.top + yAdjustment;
|
928
|
+
}
|
929
|
+
|
930
|
+
if (this._location === positionLocations.inlineStart) {
|
931
|
+
if (!this._rtl) {
|
932
|
+
position.right = (openerRect.left - this._offset) * -1;
|
933
|
+
} else {
|
934
|
+
position.left = (window.innerWidth - openerRect.right - this._offset - getScrollbarWidth()) * -1;
|
935
|
+
}
|
936
|
+
} else {
|
937
|
+
if (!this._rtl) {
|
938
|
+
position.left = openerRect.left + openerRect.width + this._offset;
|
939
|
+
} else {
|
940
|
+
position.right = window.innerWidth - openerRect.left + this._offset - getScrollbarWidth();
|
941
|
+
}
|
942
|
+
}
|
943
|
+
|
944
|
+
}
|
852
945
|
|
853
946
|
return position;
|
854
947
|
}
|
855
948
|
|
856
949
|
#getPositionXAdjustment(spaceAround, openerRect, contentRect) {
|
857
950
|
|
858
|
-
if (this._location
|
951
|
+
if (this._location !== positionLocations.blockEnd && this._location !== positionLocations.blockStart) return null;
|
952
|
+
|
953
|
+
const centerDelta = contentRect.width - openerRect.width;
|
954
|
+
const contentXAdjustment = centerDelta / 2;
|
859
955
|
|
860
|
-
|
861
|
-
|
956
|
+
if (this._preferredPosition.span === positionSpans.all && centerDelta <= 0) {
|
957
|
+
// center with target (opener wider than content)
|
958
|
+
return contentXAdjustment * -1;
|
959
|
+
}
|
960
|
+
if (this._preferredPosition.span === positionSpans.all && spaceAround.left > contentXAdjustment && spaceAround.right > contentXAdjustment) {
|
961
|
+
// center with target (content wider than opener and enough space around)
|
962
|
+
return contentXAdjustment * -1;
|
963
|
+
}
|
862
964
|
|
863
|
-
|
864
|
-
|
865
|
-
|
965
|
+
if (!this._rtl) {
|
966
|
+
if (spaceAround.left < contentXAdjustment) {
|
967
|
+
// slide content right (not enough space to center)
|
968
|
+
return spaceAround.left * -1;
|
969
|
+
} else if (spaceAround.right < contentXAdjustment) {
|
970
|
+
// slide content left (not enough space to center)
|
971
|
+
return (centerDelta * -1) + spaceAround.right;
|
866
972
|
}
|
867
|
-
|
868
|
-
|
869
|
-
|
973
|
+
} else {
|
974
|
+
if (spaceAround.left < contentXAdjustment) {
|
975
|
+
// slide content right (not enough space to center)
|
976
|
+
return (centerDelta * -1) + spaceAround.left;
|
977
|
+
} else if (spaceAround.right < contentXAdjustment) {
|
978
|
+
// slide content left (not enough space to center)
|
979
|
+
return spaceAround.right * -1;
|
870
980
|
}
|
981
|
+
}
|
871
982
|
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
// slide content left (not enough space to center)
|
878
|
-
return (centerDelta * -1) + spaceAround.right;
|
879
|
-
}
|
983
|
+
if (this._preferredPosition.span !== positionSpans.all) {
|
984
|
+
// shift it (not enough space to align as requested)
|
985
|
+
const shift = Math.min((openerRect.width / 2) - (20 + pointerLength / 2), 0); // 20 ~= 1rem
|
986
|
+
if (this._preferredPosition.span === positionSpans.end) {
|
987
|
+
return shift;
|
880
988
|
} else {
|
881
|
-
|
882
|
-
// slide content right (not enough space to center)
|
883
|
-
return (centerDelta * -1) + spaceAround.left;
|
884
|
-
} else if (spaceAround.right < contentXAdjustment) {
|
885
|
-
// slide content left (not enough space to center)
|
886
|
-
return spaceAround.right * -1;
|
887
|
-
}
|
989
|
+
return openerRect.width - contentRect.width - shift;
|
888
990
|
}
|
991
|
+
}
|
889
992
|
|
890
|
-
|
891
|
-
// shift it (not enough space to align as requested)
|
892
|
-
const shift = Math.min((openerRect.width / 2) - (20 + pointerLength / 2), 0); // 20 ~= 1rem
|
893
|
-
if (this._preferredPosition.span === 'end') {
|
894
|
-
return shift;
|
895
|
-
} else {
|
896
|
-
return openerRect.width - contentRect.width - shift;
|
897
|
-
}
|
898
|
-
}
|
993
|
+
return null;
|
899
994
|
|
995
|
+
}
|
996
|
+
|
997
|
+
#getPositionYAdjustment(spaceAround, openerRect, contentRect) {
|
998
|
+
|
999
|
+
if (this._location !== positionLocations.inlineEnd && this._location !== positionLocations.inlineStart) return null;
|
1000
|
+
|
1001
|
+
const centerDelta = contentRect.height - openerRect.height;
|
1002
|
+
const contentYAdjustment = centerDelta / 2;
|
1003
|
+
|
1004
|
+
if (this._preferredPosition.span === positionSpans.all && centerDelta <= 0) {
|
1005
|
+
// center with target (opener taller than content)
|
1006
|
+
return contentYAdjustment * -1;
|
900
1007
|
}
|
901
1008
|
|
902
|
-
|
1009
|
+
if (this._preferredPosition.span === positionSpans.all && spaceAround.above > contentYAdjustment && spaceAround.below > contentYAdjustment) {
|
1010
|
+
// center with target (content wider than opener and enough space around)
|
1011
|
+
return contentYAdjustment * -1;
|
1012
|
+
}
|
1013
|
+
|
1014
|
+
if (spaceAround.above < contentYAdjustment) {
|
1015
|
+
// slide content down (not enough space to center)
|
1016
|
+
return spaceAround.above * -1;
|
1017
|
+
} else if (spaceAround.below < contentYAdjustment) {
|
1018
|
+
// slide content up (not enough space to center)
|
1019
|
+
return (centerDelta * -1) + spaceAround.below;
|
1020
|
+
}
|
903
1021
|
|
904
1022
|
return null;
|
1023
|
+
|
905
1024
|
}
|
906
1025
|
|
907
1026
|
#getStyleMaps() {
|
package/custom-elements.json
CHANGED
@@ -11519,6 +11519,11 @@
|
|
11519
11519
|
"name": "d2l-test-popover",
|
11520
11520
|
"path": "./components/popover/test/popover.js",
|
11521
11521
|
"attributes": [
|
11522
|
+
{
|
11523
|
+
"name": "margin",
|
11524
|
+
"description": "Margin to include when computing space available.",
|
11525
|
+
"type": "number"
|
11526
|
+
},
|
11522
11527
|
{
|
11523
11528
|
"name": "max-height",
|
11524
11529
|
"description": "Max-height. Note that the default behaviour is to be as tall as necessary within the viewport, so this property is usually not needed.",
|
@@ -11580,6 +11585,12 @@
|
|
11580
11585
|
}
|
11581
11586
|
],
|
11582
11587
|
"properties": [
|
11588
|
+
{
|
11589
|
+
"name": "margin",
|
11590
|
+
"attribute": "margin",
|
11591
|
+
"description": "Margin to include when computing space available.",
|
11592
|
+
"type": "number"
|
11593
|
+
},
|
11583
11594
|
{
|
11584
11595
|
"name": "maxHeight",
|
11585
11596
|
"attribute": "max-height",
|
package/lang/ar.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
export default {
|
2
|
+
"__test__": "This will be removed in a follow-up PR (before translation)",
|
2
3
|
"components.alert.close": "إغلاق التنبيه",
|
3
4
|
"components.breadcrumbs.breadcrumb": "شريط التنقل",
|
4
5
|
"components.button-add.addItem": "إضافة عنصر",
|
@@ -22,14 +23,33 @@ export default {
|
|
22
23
|
"components.filter.clearAnnounce": "جارٍ مسح عوامل التصفية لـ: {filterName}",
|
23
24
|
"components.filter.clearDescription": "مسح عوامل التصفية لـ: {filterName}",
|
24
25
|
"components.filter.loading": "يتم تحميل عوامل التصفية",
|
25
|
-
"components.filter.filterCountDescription":
|
26
|
+
"components.filter.filterCountDescription":
|
27
|
+
`{number, plural,
|
28
|
+
=0 {لم يتم تطبيق عوامل تصفية.}
|
29
|
+
one {تم تطبيق {number} عامل تصفية}
|
30
|
+
other {تم تطبيق {number} من عوامل التصفية.}
|
31
|
+
}`,
|
26
32
|
"components.filter.filters": "عوامل التصفية",
|
27
33
|
"components.filter.noFilters": "ما من عوامل تصفية متوفرة",
|
28
|
-
"components.filter.searchResults":
|
34
|
+
"components.filter.searchResults":
|
35
|
+
`{number, plural,
|
36
|
+
=0 {ما من نتائج بحث}
|
37
|
+
one {{number} نتيجة بحث}
|
38
|
+
other {{number} من نتائج البحث}
|
39
|
+
}`,
|
29
40
|
"components.filter.selectedFirstListLabel": "{headerText}. تظهر عوامل التصفية المحددة أولاً.",
|
30
41
|
"components.filter.singleDimensionDescription": "التصفية حسب: {filterName}",
|
31
|
-
"components.filter-dimension-set-date-text-value.textHours":
|
32
|
-
|
42
|
+
"components.filter-dimension-set-date-text-value.textHours":
|
43
|
+
`{num, plural,
|
44
|
+
=1 {آخر ساعة}
|
45
|
+
other {آخر {num} من الساعات}
|
46
|
+
}`,
|
47
|
+
"components.filter-dimension-set-date-text-value.textDays":
|
48
|
+
`{num, plural,
|
49
|
+
=0 {يوم}
|
50
|
+
one {آخر {num} يوم}
|
51
|
+
other {آخر {num} من الأيام}
|
52
|
+
}`,
|
33
53
|
"components.filter-dimension-set-date-text-value.textMonths": "آخر {num} من الأشهر",
|
34
54
|
"components.filter-dimension-set-date-time-range-value.label": "{text}، التوسيع لاختيار التواريخ",
|
35
55
|
"components.filter-dimension-set-date-time-range-value.valueTextRange": "{startValue} إلى {endValue}",
|
@@ -39,13 +59,35 @@ export default {
|
|
39
59
|
"components.form-element.defaultError": "{label} غير صالحة",
|
40
60
|
"components.form-element.defaultFieldLabel": "الحقل",
|
41
61
|
"components.form-element.input.email.typeMismatch": "البريد الإلكتروني غير صالح",
|
42
|
-
"components.form-element.input.number.rangeError":
|
43
|
-
|
44
|
-
|
62
|
+
"components.form-element.input.number.rangeError":
|
63
|
+
`{minExclusive, select,
|
64
|
+
true {{maxExclusive, select,
|
65
|
+
true {يجب أن يكون الرقم أكبر من {min} وأقل من {max}.}
|
66
|
+
other {يجب أن يكون الرقم أكبر من {min} وأقل من أو مساويًا لـ {max}.}
|
67
|
+
}}
|
68
|
+
other {{maxExclusive, select,
|
69
|
+
true {يجب أن يكون الرقم أكبر من أو مساويًا لـ {min} وأقل من {max}.}
|
70
|
+
other {يجب أن يكون الرقم أكبر من أو مساويًا لـ {min} وأقل من أو مساويًا لـ {max}.}
|
71
|
+
}}
|
72
|
+
}`,
|
73
|
+
"components.form-element.input.number.rangeOverflow":
|
74
|
+
`{maxExclusive, select,
|
75
|
+
true {يجب أن يكون الرقم أقل من {max}.}
|
76
|
+
other {يجب أن يكون الرقم أقل من أو مساويًا لـ {max}.}
|
77
|
+
}`,
|
78
|
+
"components.form-element.input.number.rangeUnderflow":
|
79
|
+
`{minExclusive, select,
|
80
|
+
true {يجب أن يكون الرقم أكبر من {min}.}
|
81
|
+
other {يجب أن يكون الرقم أكبر من أو مساويًا لـ {min}.}
|
82
|
+
}`,
|
45
83
|
"components.form-element.input.text.tooShort": "يجب أن تتألف التسمية {label} من {minlength} من الأحرف على الأقل",
|
46
84
|
"components.form-element.input.url.typeMismatch": "عنوان URL غير صالح",
|
47
85
|
"components.form-element.valueMissing": "{label} مطلوبة",
|
48
|
-
"components.form-error-summary.errorSummary":
|
86
|
+
"components.form-error-summary.errorSummary":
|
87
|
+
`{count, plural,
|
88
|
+
one {تم العثور على {count} خطأ في المعلومات التي أرسلتها}
|
89
|
+
other {تم العثور على {count} من الأخطاء في المعلومات التي أرسلتها}
|
90
|
+
}`,
|
49
91
|
"components.form-error-summary.text": "تبديل تفاصيل الخطأ",
|
50
92
|
"components.input-color.backgroundColor": "لون الخلفية",
|
51
93
|
"components.input-color.foregroundColor": "لون المقدمة",
|
@@ -109,10 +151,22 @@ export default {
|
|
109
151
|
"components.overflow-group.moreActions": "مزيد من الإجراءات",
|
110
152
|
"components.pager-load-more.action": "تحميل المزيد",
|
111
153
|
"components.pager-load-more.action-with-page-size": "تحميل {count} إضافي",
|
112
|
-
"components.pageable.info":
|
113
|
-
|
154
|
+
"components.pageable.info":
|
155
|
+
`{count, plural,
|
156
|
+
one {{countFormatted} مادة واحد}
|
157
|
+
other {{countFormatted} من المواد}
|
158
|
+
}`,
|
159
|
+
"components.pageable.info-with-total":
|
160
|
+
`{totalCount, plural,
|
161
|
+
one {{countFormatted} من أصل {totalCountFormatted} مادة واحدة}
|
162
|
+
other {{countFormatted} من أصل {totalCountFormatted} من المواد}
|
163
|
+
}`,
|
114
164
|
"components.pager-load-more.status-loading": "تحميل المزيد من المواد",
|
115
|
-
"components.selection.action-max-hint":
|
165
|
+
"components.selection.action-max-hint":
|
166
|
+
`{count, plural,
|
167
|
+
one {يتم التعطيل عند تحديد أكثر من {countFormatted} عنصر}
|
168
|
+
other {يتم التعطيل عند تحديد أكثر من {countFormatted} من العناصر}
|
169
|
+
}`,
|
116
170
|
"components.selection.action-required-hint": "حدد عنصرًا لتنفيذ هذا الإجراء",
|
117
171
|
"components.selection.select-all": "تحديد الكل",
|
118
172
|
"components.selection.select-all-items": "تحديد كل المواد الـ {count}.",
|
@@ -125,7 +179,26 @@ export default {
|
|
125
179
|
"components.switch.conditions": "يجب استيفاء الشروط",
|
126
180
|
"components.table-col-sort-button.addSortOrder": "التحديد لإضافة ترتيب الفرز",
|
127
181
|
"components.table-col-sort-button.changeSortOrder": "التحديد لتغيير ترتيب الفرز",
|
128
|
-
"components.table-col-sort-button.title":
|
182
|
+
"components.table-col-sort-button.title":
|
183
|
+
`{sourceType, select,
|
184
|
+
dates {{direction, select,
|
185
|
+
desc {الفرز من الجديد إلى القديم}
|
186
|
+
other {الفرز من القديم إلى الجديد}
|
187
|
+
}}
|
188
|
+
numbers {{direction, select,
|
189
|
+
desc {الفرز من الأعلى إلى الأدنى}
|
190
|
+
other {الفرز من الأدنى إلى الأعلى}
|
191
|
+
}}
|
192
|
+
words {{direction, select,
|
193
|
+
desc {الفرز من ي إلى أ}
|
194
|
+
other {الفرز من أ إلى ي}
|
195
|
+
}}
|
196
|
+
value {الفرز {selectedMenuItemText}}
|
197
|
+
other {{direction, select,
|
198
|
+
desc {الفرز تنازليًا}
|
199
|
+
other {الفرز تصاعديًا}
|
200
|
+
}}
|
201
|
+
}`,
|
129
202
|
"components.table-controls.label": "إجراءات للجدول",
|
130
203
|
"components.tabs.next": "التمرير إلى الأمام",
|
131
204
|
"components.tabs.previous": "التمرير إلى الخلف",
|