@vonage/vivid 4.10.0 → 4.12.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/custom-elements.json +8630 -6433
- package/lib/badge/badge.d.ts +1 -1
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +1 -1
- package/lib/button/button.d.ts +1 -1
- package/lib/checkbox/checkbox.d.ts +5 -3
- package/lib/checkbox/checkbox.form-associated.d.ts +10 -0
- package/lib/enums.d.ts +1 -0
- package/lib/fab/fab.d.ts +2 -2
- package/lib/file-picker/file-picker.d.ts +3 -0
- package/lib/slider/slider.d.ts +30 -6
- package/lib/slider/slider.form-associated.d.ts +10 -0
- package/lib/split-button/split-button.d.ts +1 -1
- package/lib/tabs/tabs.d.ts +1 -0
- package/package.json +1 -1
- package/shared/aria-global2.cjs +93 -0
- package/shared/aria-global2.js +91 -0
- package/shared/breadcrumb-item.cjs +2 -89
- package/shared/breadcrumb-item.js +1 -88
- package/shared/definition11.cjs +200 -4
- package/shared/definition11.js +198 -3
- package/shared/definition15.cjs +34 -91
- package/shared/definition15.js +35 -92
- package/shared/definition16.cjs +9 -7
- package/shared/definition16.js +9 -7
- package/shared/definition20.cjs +1 -1
- package/shared/definition20.js +1 -1
- package/shared/definition21.cjs +1 -1
- package/shared/definition21.js +1 -1
- package/shared/definition24.cjs +156 -2
- package/shared/definition24.js +157 -3
- package/shared/definition25.cjs +106 -56
- package/shared/definition25.js +106 -56
- package/shared/definition35.cjs +2 -2
- package/shared/definition35.js +2 -2
- package/shared/definition37.cjs +1 -1
- package/shared/definition37.js +1 -1
- package/shared/definition4.cjs +5 -6
- package/shared/definition4.js +1 -2
- package/shared/definition40.cjs +11 -4
- package/shared/definition40.js +8 -1
- package/shared/definition42.cjs +3 -22
- package/shared/definition42.js +2 -21
- package/shared/definition43.cjs +1 -2
- package/shared/definition43.js +1 -2
- package/shared/definition44.js +1 -1
- package/shared/definition47.cjs +369 -502
- package/shared/definition47.js +370 -503
- package/shared/definition5.cjs +4 -4
- package/shared/definition5.js +1 -1
- package/shared/definition51.cjs +1 -1
- package/shared/definition51.js +1 -1
- package/shared/definition52.cjs +63 -26
- package/shared/definition52.js +63 -26
- package/shared/definition56.cjs +41 -43
- package/shared/definition56.js +41 -43
- package/shared/definition57.cjs +1 -1
- package/shared/definition57.js +1 -1
- package/shared/definition58.cjs +1 -1
- package/shared/definition58.js +1 -1
- package/shared/definition59.cjs +1 -1
- package/shared/definition59.js +1 -1
- package/shared/definition64.cjs +278 -90
- package/shared/definition64.js +278 -90
- package/shared/definition7.cjs +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.cjs +1 -1
- package/shared/definition8.js +1 -1
- package/shared/enums.cjs +1 -0
- package/shared/enums.js +1 -0
- package/shared/form-associated.js +1 -1
- package/shared/{patterns → foundation/anchor}/anchor.d.ts +1 -1
- package/shared/foundation/button/button.d.ts +27 -0
- package/shared/foundation/button/button.template.d.ts +4 -0
- package/shared/foundation/button/index.d.ts +2 -0
- package/shared/foundation/patterns/index.d.ts +1 -0
- package/shared/index.cjs +22 -2
- package/shared/index.js +22 -2
- package/shared/key-codes2.js +1 -1
- package/shared/presentationDate.cjs +4328 -4042
- package/shared/presentationDate.js +4327 -4041
- package/shared/slider.template.cjs +23 -1
- package/shared/slider.template.js +21 -2
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/vivid.api.json +52 -4
- package/shared/aria2.cjs +0 -11
- package/shared/aria2.js +0 -9
- package/shared/button.cjs +0 -202
- package/shared/button.js +0 -200
- /package/shared/{patterns → foundation/patterns}/aria-global.d.ts +0 -0
package/shared/definition64.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { F as FoundationElement, D as DOM, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { c as Button, a as buttonRegistries } from './definition11.js';
|
|
3
3
|
import { E as Elevation, e as elevationRegistries } from './definition63.js';
|
|
4
4
|
import { r as ref } from './ref.js';
|
|
5
5
|
import { w as when } from './when.js';
|
|
6
6
|
import { c as classNames } from './class-names.js';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Custom positioning reference element.
|
|
10
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
11
|
+
*/
|
|
12
|
+
|
|
8
13
|
const sides = ['top', 'right', 'bottom', 'left'];
|
|
9
14
|
const alignments = ['start', 'end'];
|
|
10
15
|
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
@@ -119,12 +124,21 @@ function getPaddingObject(padding) {
|
|
|
119
124
|
};
|
|
120
125
|
}
|
|
121
126
|
function rectToClientRect(rect) {
|
|
127
|
+
const {
|
|
128
|
+
x,
|
|
129
|
+
y,
|
|
130
|
+
width,
|
|
131
|
+
height
|
|
132
|
+
} = rect;
|
|
122
133
|
return {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
width,
|
|
135
|
+
height,
|
|
136
|
+
top: y,
|
|
137
|
+
left: x,
|
|
138
|
+
right: x + width,
|
|
139
|
+
bottom: y + height,
|
|
140
|
+
x,
|
|
141
|
+
y
|
|
128
142
|
};
|
|
129
143
|
}
|
|
130
144
|
|
|
@@ -186,7 +200,7 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
186
200
|
|
|
187
201
|
/**
|
|
188
202
|
* Computes the `x` and `y` coordinates that will place the floating element
|
|
189
|
-
* next to a reference element
|
|
203
|
+
* next to a given reference element.
|
|
190
204
|
*
|
|
191
205
|
* This export does not have any `platform` interface logic. You will need to
|
|
192
206
|
* write one for the platform you are using Floating UI with.
|
|
@@ -264,7 +278,6 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
264
278
|
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
265
279
|
}
|
|
266
280
|
i = -1;
|
|
267
|
-
continue;
|
|
268
281
|
}
|
|
269
282
|
}
|
|
270
283
|
return {
|
|
@@ -314,9 +327,10 @@ async function detectOverflow(state, options) {
|
|
|
314
327
|
strategy
|
|
315
328
|
}));
|
|
316
329
|
const rect = elementContext === 'floating' ? {
|
|
317
|
-
...rects.floating,
|
|
318
330
|
x,
|
|
319
|
-
y
|
|
331
|
+
y,
|
|
332
|
+
width: rects.floating.width,
|
|
333
|
+
height: rects.floating.height
|
|
320
334
|
} : rects.reference;
|
|
321
335
|
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
322
336
|
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
@@ -327,6 +341,7 @@ async function detectOverflow(state, options) {
|
|
|
327
341
|
y: 1
|
|
328
342
|
};
|
|
329
343
|
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
344
|
+
elements,
|
|
330
345
|
rect,
|
|
331
346
|
offsetParent,
|
|
332
347
|
strategy
|
|
@@ -344,7 +359,7 @@ async function detectOverflow(state, options) {
|
|
|
344
359
|
* appears centered to the reference element.
|
|
345
360
|
* @see https://floating-ui.com/docs/arrow
|
|
346
361
|
*/
|
|
347
|
-
const arrow = options => ({
|
|
362
|
+
const arrow$1 = options => ({
|
|
348
363
|
name: 'arrow',
|
|
349
364
|
options,
|
|
350
365
|
async fn(state) {
|
|
@@ -405,7 +420,7 @@ const arrow = options => ({
|
|
|
405
420
|
// to point to nothing for an aligned placement, adjust the offset of the
|
|
406
421
|
// floating element itself. To ensure `shift()` continues to take action,
|
|
407
422
|
// a single reset is performed when this is true.
|
|
408
|
-
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center
|
|
423
|
+
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
409
424
|
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
|
|
410
425
|
return {
|
|
411
426
|
[axis]: coords[axis] + alignmentOffset,
|
|
@@ -436,7 +451,7 @@ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
|
436
451
|
* preferred placement. Alternative to `flip`.
|
|
437
452
|
* @see https://floating-ui.com/docs/autoPlacement
|
|
438
453
|
*/
|
|
439
|
-
const autoPlacement = function (options) {
|
|
454
|
+
const autoPlacement$1 = function (options) {
|
|
440
455
|
if (options === void 0) {
|
|
441
456
|
options = {};
|
|
442
457
|
}
|
|
@@ -530,7 +545,7 @@ const autoPlacement = function (options) {
|
|
|
530
545
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
531
546
|
* @see https://floating-ui.com/docs/flip
|
|
532
547
|
*/
|
|
533
|
-
const flip = function (options) {
|
|
548
|
+
const flip$1 = function (options) {
|
|
534
549
|
if (options === void 0) {
|
|
535
550
|
options = {};
|
|
536
551
|
}
|
|
@@ -565,10 +580,12 @@ const flip = function (options) {
|
|
|
565
580
|
return {};
|
|
566
581
|
}
|
|
567
582
|
const side = getSide(placement);
|
|
583
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
568
584
|
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
569
585
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
570
586
|
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
571
|
-
|
|
587
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
|
|
588
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
572
589
|
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
573
590
|
}
|
|
574
591
|
const placements = [initialPlacement, ...fallbackPlacements];
|
|
@@ -614,8 +631,17 @@ const flip = function (options) {
|
|
|
614
631
|
switch (fallbackStrategy) {
|
|
615
632
|
case 'bestFit':
|
|
616
633
|
{
|
|
617
|
-
var _overflowsData$
|
|
618
|
-
const placement = (_overflowsData$
|
|
634
|
+
var _overflowsData$filter2;
|
|
635
|
+
const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
|
|
636
|
+
if (hasFallbackAxisSideDirection) {
|
|
637
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
638
|
+
return currentSideAxis === initialSideAxis ||
|
|
639
|
+
// Create a bias to the `y` side axis due to horizontal
|
|
640
|
+
// reading directions favoring greater width.
|
|
641
|
+
currentSideAxis === 'y';
|
|
642
|
+
}
|
|
643
|
+
return true;
|
|
644
|
+
}).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
619
645
|
if (placement) {
|
|
620
646
|
resetPlacement = placement;
|
|
621
647
|
}
|
|
@@ -655,7 +681,7 @@ function isAnySideFullyClipped(overflow) {
|
|
|
655
681
|
* when it is not in the same clipping context as the reference element.
|
|
656
682
|
* @see https://floating-ui.com/docs/hide
|
|
657
683
|
*/
|
|
658
|
-
const hide = function (options) {
|
|
684
|
+
const hide$1 = function (options) {
|
|
659
685
|
if (options === void 0) {
|
|
660
686
|
options = {};
|
|
661
687
|
}
|
|
@@ -740,7 +766,7 @@ function getRectsByLine(rects) {
|
|
|
740
766
|
* over multiple lines, such as hyperlinks or range selections.
|
|
741
767
|
* @see https://floating-ui.com/docs/inline
|
|
742
768
|
*/
|
|
743
|
-
const inline = function (options) {
|
|
769
|
+
const inline$1 = function (options) {
|
|
744
770
|
if (options === void 0) {
|
|
745
771
|
options = {};
|
|
746
772
|
}
|
|
@@ -841,6 +867,7 @@ const inline = function (options) {
|
|
|
841
867
|
|
|
842
868
|
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
843
869
|
// Derivable.
|
|
870
|
+
|
|
844
871
|
async function convertValueToCoords(state, options) {
|
|
845
872
|
const {
|
|
846
873
|
placement,
|
|
@@ -865,10 +892,9 @@ async function convertValueToCoords(state, options) {
|
|
|
865
892
|
crossAxis: 0,
|
|
866
893
|
alignmentAxis: null
|
|
867
894
|
} : {
|
|
868
|
-
mainAxis: 0,
|
|
869
|
-
crossAxis: 0,
|
|
870
|
-
alignmentAxis:
|
|
871
|
-
...rawValue
|
|
895
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
896
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
897
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
872
898
|
};
|
|
873
899
|
if (alignment && typeof alignmentAxis === 'number') {
|
|
874
900
|
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
@@ -889,7 +915,10 @@ async function convertValueToCoords(state, options) {
|
|
|
889
915
|
* object may be passed.
|
|
890
916
|
* @see https://floating-ui.com/docs/offset
|
|
891
917
|
*/
|
|
892
|
-
const offset = function (options) {
|
|
918
|
+
const offset$1 = function (options) {
|
|
919
|
+
if (options === void 0) {
|
|
920
|
+
options = 0;
|
|
921
|
+
}
|
|
893
922
|
return {
|
|
894
923
|
name: 'offset',
|
|
895
924
|
options,
|
|
@@ -926,7 +955,7 @@ const offset = function (options) {
|
|
|
926
955
|
* width of the reference element.
|
|
927
956
|
* @see https://floating-ui.com/docs/size
|
|
928
957
|
*/
|
|
929
|
-
const size = function (options) {
|
|
958
|
+
const size$1 = function (options) {
|
|
930
959
|
if (options === void 0) {
|
|
931
960
|
options = {};
|
|
932
961
|
}
|
|
@@ -934,6 +963,7 @@ const size = function (options) {
|
|
|
934
963
|
name: 'size',
|
|
935
964
|
options,
|
|
936
965
|
async fn(state) {
|
|
966
|
+
var _state$middlewareData, _state$middlewareData2;
|
|
937
967
|
const {
|
|
938
968
|
placement,
|
|
939
969
|
rects,
|
|
@@ -961,17 +991,18 @@ const size = function (options) {
|
|
|
961
991
|
widthSide = side;
|
|
962
992
|
heightSide = alignment === 'end' ? 'top' : 'bottom';
|
|
963
993
|
}
|
|
964
|
-
const
|
|
965
|
-
const
|
|
994
|
+
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
995
|
+
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
996
|
+
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
997
|
+
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
966
998
|
const noShift = !state.middlewareData.shift;
|
|
967
999
|
let availableHeight = overflowAvailableHeight;
|
|
968
1000
|
let availableWidth = overflowAvailableWidth;
|
|
969
|
-
if (
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
|
|
1001
|
+
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
1002
|
+
availableWidth = maximumClippingWidth;
|
|
1003
|
+
}
|
|
1004
|
+
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
1005
|
+
availableHeight = maximumClippingHeight;
|
|
975
1006
|
}
|
|
976
1007
|
if (noShift && !alignment) {
|
|
977
1008
|
const xMin = max(overflow.left, 0);
|
|
@@ -1002,6 +1033,9 @@ const size = function (options) {
|
|
|
1002
1033
|
};
|
|
1003
1034
|
};
|
|
1004
1035
|
|
|
1036
|
+
function hasWindow() {
|
|
1037
|
+
return typeof window !== 'undefined';
|
|
1038
|
+
}
|
|
1005
1039
|
function getNodeName(node) {
|
|
1006
1040
|
if (isNode(node)) {
|
|
1007
1041
|
return (node.nodeName || '').toLowerCase();
|
|
@@ -1013,24 +1047,32 @@ function getNodeName(node) {
|
|
|
1013
1047
|
}
|
|
1014
1048
|
function getWindow(node) {
|
|
1015
1049
|
var _node$ownerDocument;
|
|
1016
|
-
return (node == null
|
|
1050
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
1017
1051
|
}
|
|
1018
1052
|
function getDocumentElement(node) {
|
|
1019
1053
|
var _ref;
|
|
1020
1054
|
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
1021
1055
|
}
|
|
1022
1056
|
function isNode(value) {
|
|
1057
|
+
if (!hasWindow()) {
|
|
1058
|
+
return false;
|
|
1059
|
+
}
|
|
1023
1060
|
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
1024
1061
|
}
|
|
1025
1062
|
function isElement(value) {
|
|
1063
|
+
if (!hasWindow()) {
|
|
1064
|
+
return false;
|
|
1065
|
+
}
|
|
1026
1066
|
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
1027
1067
|
}
|
|
1028
1068
|
function isHTMLElement(value) {
|
|
1069
|
+
if (!hasWindow()) {
|
|
1070
|
+
return false;
|
|
1071
|
+
}
|
|
1029
1072
|
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
1030
1073
|
}
|
|
1031
1074
|
function isShadowRoot(value) {
|
|
1032
|
-
|
|
1033
|
-
if (typeof ShadowRoot === 'undefined') {
|
|
1075
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
1034
1076
|
return false;
|
|
1035
1077
|
}
|
|
1036
1078
|
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
@@ -1047,9 +1089,18 @@ function isOverflowElement(element) {
|
|
|
1047
1089
|
function isTableElement(element) {
|
|
1048
1090
|
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
1049
1091
|
}
|
|
1050
|
-
function
|
|
1092
|
+
function isTopLayer(element) {
|
|
1093
|
+
return [':popover-open', ':modal'].some(selector => {
|
|
1094
|
+
try {
|
|
1095
|
+
return element.matches(selector);
|
|
1096
|
+
} catch (e) {
|
|
1097
|
+
return false;
|
|
1098
|
+
}
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
function isContainingBlock(elementOrCss) {
|
|
1051
1102
|
const webkit = isWebKit();
|
|
1052
|
-
const css = getComputedStyle(
|
|
1103
|
+
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
1053
1104
|
|
|
1054
1105
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1055
1106
|
return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
|
|
@@ -1059,9 +1110,10 @@ function getContainingBlock(element) {
|
|
|
1059
1110
|
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1060
1111
|
if (isContainingBlock(currentNode)) {
|
|
1061
1112
|
return currentNode;
|
|
1062
|
-
} else {
|
|
1063
|
-
|
|
1113
|
+
} else if (isTopLayer(currentNode)) {
|
|
1114
|
+
return null;
|
|
1064
1115
|
}
|
|
1116
|
+
currentNode = getParentNode(currentNode);
|
|
1065
1117
|
}
|
|
1066
1118
|
return null;
|
|
1067
1119
|
}
|
|
@@ -1083,8 +1135,8 @@ function getNodeScroll(element) {
|
|
|
1083
1135
|
};
|
|
1084
1136
|
}
|
|
1085
1137
|
return {
|
|
1086
|
-
scrollLeft: element.
|
|
1087
|
-
scrollTop: element.
|
|
1138
|
+
scrollLeft: element.scrollX,
|
|
1139
|
+
scrollTop: element.scrollY
|
|
1088
1140
|
};
|
|
1089
1141
|
}
|
|
1090
1142
|
function getParentNode(node) {
|
|
@@ -1124,10 +1176,14 @@ function getOverflowAncestors(node, list, traverseIframes) {
|
|
|
1124
1176
|
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
1125
1177
|
const win = getWindow(scrollableAncestor);
|
|
1126
1178
|
if (isBody) {
|
|
1127
|
-
|
|
1179
|
+
const frameElement = getFrameElement(win);
|
|
1180
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
1128
1181
|
}
|
|
1129
1182
|
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1130
1183
|
}
|
|
1184
|
+
function getFrameElement(win) {
|
|
1185
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
1186
|
+
}
|
|
1131
1187
|
|
|
1132
1188
|
function getCssDimensions(element) {
|
|
1133
1189
|
const css = getComputedStyle(element);
|
|
@@ -1230,8 +1286,9 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1230
1286
|
if (domElement) {
|
|
1231
1287
|
const win = getWindow(domElement);
|
|
1232
1288
|
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1233
|
-
let
|
|
1234
|
-
|
|
1289
|
+
let currentWin = win;
|
|
1290
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
1291
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1235
1292
|
const iframeScale = getScale(currentIFrame);
|
|
1236
1293
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1237
1294
|
const css = getComputedStyle(currentIFrame);
|
|
@@ -1243,7 +1300,8 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1243
1300
|
height *= iframeScale.y;
|
|
1244
1301
|
x += left;
|
|
1245
1302
|
y += top;
|
|
1246
|
-
|
|
1303
|
+
currentWin = getWindow(currentIFrame);
|
|
1304
|
+
currentIFrame = getFrameElement(currentWin);
|
|
1247
1305
|
}
|
|
1248
1306
|
}
|
|
1249
1307
|
return rectToClientRect({
|
|
@@ -1254,15 +1312,42 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1254
1312
|
});
|
|
1255
1313
|
}
|
|
1256
1314
|
|
|
1315
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1316
|
+
// incorrect for RTL.
|
|
1317
|
+
function getWindowScrollBarX(element, rect) {
|
|
1318
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
1319
|
+
if (!rect) {
|
|
1320
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
1321
|
+
}
|
|
1322
|
+
return rect.left + leftScroll;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
|
|
1326
|
+
if (ignoreScrollbarX === void 0) {
|
|
1327
|
+
ignoreScrollbarX = false;
|
|
1328
|
+
}
|
|
1329
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
1330
|
+
const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
|
|
1331
|
+
// RTL <body> scrollbar.
|
|
1332
|
+
getWindowScrollBarX(documentElement, htmlRect));
|
|
1333
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
1334
|
+
return {
|
|
1335
|
+
x,
|
|
1336
|
+
y
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1257
1340
|
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1258
1341
|
let {
|
|
1342
|
+
elements,
|
|
1259
1343
|
rect,
|
|
1260
1344
|
offsetParent,
|
|
1261
1345
|
strategy
|
|
1262
1346
|
} = _ref;
|
|
1263
|
-
const
|
|
1347
|
+
const isFixed = strategy === 'fixed';
|
|
1264
1348
|
const documentElement = getDocumentElement(offsetParent);
|
|
1265
|
-
|
|
1349
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
1350
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1266
1351
|
return rect;
|
|
1267
1352
|
}
|
|
1268
1353
|
let scroll = {
|
|
@@ -1271,7 +1356,8 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1271
1356
|
};
|
|
1272
1357
|
let scale = createCoords(1);
|
|
1273
1358
|
const offsets = createCoords(0);
|
|
1274
|
-
|
|
1359
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1360
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1275
1361
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1276
1362
|
scroll = getNodeScroll(offsetParent);
|
|
1277
1363
|
}
|
|
@@ -1282,11 +1368,12 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1282
1368
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1283
1369
|
}
|
|
1284
1370
|
}
|
|
1371
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
|
|
1285
1372
|
return {
|
|
1286
1373
|
width: rect.width * scale.x,
|
|
1287
1374
|
height: rect.height * scale.y,
|
|
1288
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
|
|
1289
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
|
|
1375
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
1376
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
1290
1377
|
};
|
|
1291
1378
|
}
|
|
1292
1379
|
|
|
@@ -1294,12 +1381,6 @@ function getClientRects(element) {
|
|
|
1294
1381
|
return Array.from(element.getClientRects());
|
|
1295
1382
|
}
|
|
1296
1383
|
|
|
1297
|
-
function getWindowScrollBarX(element) {
|
|
1298
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
1299
|
-
// incorrect for RTL.
|
|
1300
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
1384
|
// Gets the entire size of the scrollable document area, even extending outside
|
|
1304
1385
|
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
1305
1386
|
function getDocumentRect(element) {
|
|
@@ -1374,9 +1455,10 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
|
|
|
1374
1455
|
} else {
|
|
1375
1456
|
const visualOffsets = getVisualOffsets(element);
|
|
1376
1457
|
rect = {
|
|
1377
|
-
...clippingAncestor,
|
|
1378
1458
|
x: clippingAncestor.x - visualOffsets.x,
|
|
1379
|
-
y: clippingAncestor.y - visualOffsets.y
|
|
1459
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
1460
|
+
width: clippingAncestor.width,
|
|
1461
|
+
height: clippingAncestor.height
|
|
1380
1462
|
};
|
|
1381
1463
|
}
|
|
1382
1464
|
return rectToClientRect(rect);
|
|
@@ -1432,7 +1514,7 @@ function getClippingRect(_ref) {
|
|
|
1432
1514
|
rootBoundary,
|
|
1433
1515
|
strategy
|
|
1434
1516
|
} = _ref;
|
|
1435
|
-
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1517
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1436
1518
|
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1437
1519
|
const firstClippingAncestor = clippingAncestors[0];
|
|
1438
1520
|
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
@@ -1452,7 +1534,14 @@ function getClippingRect(_ref) {
|
|
|
1452
1534
|
}
|
|
1453
1535
|
|
|
1454
1536
|
function getDimensions(element) {
|
|
1455
|
-
|
|
1537
|
+
const {
|
|
1538
|
+
width,
|
|
1539
|
+
height
|
|
1540
|
+
} = getCssDimensions(element);
|
|
1541
|
+
return {
|
|
1542
|
+
width,
|
|
1543
|
+
height
|
|
1544
|
+
};
|
|
1456
1545
|
}
|
|
1457
1546
|
|
|
1458
1547
|
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
@@ -1474,17 +1563,26 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
|
1474
1563
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1475
1564
|
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1476
1565
|
} else if (documentElement) {
|
|
1566
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
1567
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
1477
1568
|
offsets.x = getWindowScrollBarX(documentElement);
|
|
1478
1569
|
}
|
|
1479
1570
|
}
|
|
1571
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1572
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
1573
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
1480
1574
|
return {
|
|
1481
|
-
x
|
|
1482
|
-
y
|
|
1575
|
+
x,
|
|
1576
|
+
y,
|
|
1483
1577
|
width: rect.width,
|
|
1484
1578
|
height: rect.height
|
|
1485
1579
|
};
|
|
1486
1580
|
}
|
|
1487
1581
|
|
|
1582
|
+
function isStaticPositioned(element) {
|
|
1583
|
+
return getComputedStyle(element).position === 'static';
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1488
1586
|
function getTrueOffsetParent(element, polyfill) {
|
|
1489
1587
|
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
1490
1588
|
return null;
|
|
@@ -1492,40 +1590,56 @@ function getTrueOffsetParent(element, polyfill) {
|
|
|
1492
1590
|
if (polyfill) {
|
|
1493
1591
|
return polyfill(element);
|
|
1494
1592
|
}
|
|
1495
|
-
|
|
1593
|
+
let rawOffsetParent = element.offsetParent;
|
|
1594
|
+
|
|
1595
|
+
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
1596
|
+
// while Chrome and Safari return the <body> element. The <body> element must
|
|
1597
|
+
// be used to perform the correct calculations even if the <html> element is
|
|
1598
|
+
// non-static.
|
|
1599
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
1600
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
1601
|
+
}
|
|
1602
|
+
return rawOffsetParent;
|
|
1496
1603
|
}
|
|
1497
1604
|
|
|
1498
1605
|
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1499
1606
|
// such as table ancestors and cross browser bugs.
|
|
1500
1607
|
function getOffsetParent(element, polyfill) {
|
|
1501
|
-
const
|
|
1608
|
+
const win = getWindow(element);
|
|
1609
|
+
if (isTopLayer(element)) {
|
|
1610
|
+
return win;
|
|
1611
|
+
}
|
|
1502
1612
|
if (!isHTMLElement(element)) {
|
|
1503
|
-
|
|
1613
|
+
let svgOffsetParent = getParentNode(element);
|
|
1614
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1615
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1616
|
+
return svgOffsetParent;
|
|
1617
|
+
}
|
|
1618
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1619
|
+
}
|
|
1620
|
+
return win;
|
|
1504
1621
|
}
|
|
1505
1622
|
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1506
|
-
while (offsetParent && isTableElement(offsetParent) &&
|
|
1623
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1507
1624
|
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1508
1625
|
}
|
|
1509
|
-
if (offsetParent && (
|
|
1510
|
-
return
|
|
1626
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
1627
|
+
return win;
|
|
1511
1628
|
}
|
|
1512
|
-
return offsetParent || getContainingBlock(element) ||
|
|
1629
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
1513
1630
|
}
|
|
1514
1631
|
|
|
1515
|
-
const getElementRects = async function (
|
|
1516
|
-
let {
|
|
1517
|
-
reference,
|
|
1518
|
-
floating,
|
|
1519
|
-
strategy
|
|
1520
|
-
} = _ref;
|
|
1632
|
+
const getElementRects = async function (data) {
|
|
1521
1633
|
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1522
1634
|
const getDimensionsFn = this.getDimensions;
|
|
1635
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1523
1636
|
return {
|
|
1524
|
-
reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
|
|
1637
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1525
1638
|
floating: {
|
|
1526
1639
|
x: 0,
|
|
1527
1640
|
y: 0,
|
|
1528
|
-
|
|
1641
|
+
width: floatingDimensions.width,
|
|
1642
|
+
height: floatingDimensions.height
|
|
1529
1643
|
}
|
|
1530
1644
|
};
|
|
1531
1645
|
};
|
|
@@ -1553,8 +1667,9 @@ function observeMove(element, onMove) {
|
|
|
1553
1667
|
let timeoutId;
|
|
1554
1668
|
const root = getDocumentElement(element);
|
|
1555
1669
|
function cleanup() {
|
|
1670
|
+
var _io;
|
|
1556
1671
|
clearTimeout(timeoutId);
|
|
1557
|
-
io
|
|
1672
|
+
(_io = io) == null || _io.disconnect();
|
|
1558
1673
|
io = null;
|
|
1559
1674
|
}
|
|
1560
1675
|
function refresh(skip, threshold) {
|
|
@@ -1594,9 +1709,11 @@ function observeMove(element, onMove) {
|
|
|
1594
1709
|
return refresh();
|
|
1595
1710
|
}
|
|
1596
1711
|
if (!ratio) {
|
|
1712
|
+
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
|
1713
|
+
// to prevent an infinite loop of updates.
|
|
1597
1714
|
timeoutId = setTimeout(() => {
|
|
1598
1715
|
refresh(false, 1e-7);
|
|
1599
|
-
},
|
|
1716
|
+
}, 1000);
|
|
1600
1717
|
} else {
|
|
1601
1718
|
refresh(false, ratio);
|
|
1602
1719
|
}
|
|
@@ -1660,7 +1777,8 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1660
1777
|
resizeObserver.unobserve(floating);
|
|
1661
1778
|
cancelAnimationFrame(reobserveFrame);
|
|
1662
1779
|
reobserveFrame = requestAnimationFrame(() => {
|
|
1663
|
-
|
|
1780
|
+
var _resizeObserver;
|
|
1781
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
1664
1782
|
});
|
|
1665
1783
|
}
|
|
1666
1784
|
update();
|
|
@@ -1685,12 +1803,13 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1685
1803
|
}
|
|
1686
1804
|
update();
|
|
1687
1805
|
return () => {
|
|
1806
|
+
var _resizeObserver2;
|
|
1688
1807
|
ancestors.forEach(ancestor => {
|
|
1689
1808
|
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
1690
1809
|
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
1691
1810
|
});
|
|
1692
|
-
cleanupIo
|
|
1693
|
-
resizeObserver
|
|
1811
|
+
cleanupIo == null || cleanupIo();
|
|
1812
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
1694
1813
|
resizeObserver = null;
|
|
1695
1814
|
if (animationFrame) {
|
|
1696
1815
|
cancelAnimationFrame(frameId);
|
|
@@ -1698,10 +1817,63 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1698
1817
|
};
|
|
1699
1818
|
}
|
|
1700
1819
|
|
|
1820
|
+
/**
|
|
1821
|
+
* Modifies the placement by translating the floating element along the
|
|
1822
|
+
* specified axes.
|
|
1823
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
1824
|
+
* object may be passed.
|
|
1825
|
+
* @see https://floating-ui.com/docs/offset
|
|
1826
|
+
*/
|
|
1827
|
+
const offset = offset$1;
|
|
1828
|
+
|
|
1829
|
+
/**
|
|
1830
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
1831
|
+
* that has the most space available automatically, without needing to specify a
|
|
1832
|
+
* preferred placement. Alternative to `flip`.
|
|
1833
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
1834
|
+
*/
|
|
1835
|
+
const autoPlacement = autoPlacement$1;
|
|
1836
|
+
|
|
1837
|
+
/**
|
|
1838
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
1839
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
1840
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
1841
|
+
* @see https://floating-ui.com/docs/flip
|
|
1842
|
+
*/
|
|
1843
|
+
const flip = flip$1;
|
|
1844
|
+
|
|
1845
|
+
/**
|
|
1846
|
+
* Provides data that allows you to change the size of the floating element —
|
|
1847
|
+
* for instance, prevent it from overflowing the clipping boundary or match the
|
|
1848
|
+
* width of the reference element.
|
|
1849
|
+
* @see https://floating-ui.com/docs/size
|
|
1850
|
+
*/
|
|
1851
|
+
const size = size$1;
|
|
1852
|
+
|
|
1853
|
+
/**
|
|
1854
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
1855
|
+
* when it is not in the same clipping context as the reference element.
|
|
1856
|
+
* @see https://floating-ui.com/docs/hide
|
|
1857
|
+
*/
|
|
1858
|
+
const hide = hide$1;
|
|
1859
|
+
|
|
1860
|
+
/**
|
|
1861
|
+
* Provides data to position an inner element of the floating element so that it
|
|
1862
|
+
* appears centered to the reference element.
|
|
1863
|
+
* @see https://floating-ui.com/docs/arrow
|
|
1864
|
+
*/
|
|
1865
|
+
const arrow = arrow$1;
|
|
1866
|
+
|
|
1867
|
+
/**
|
|
1868
|
+
* Provides improved positioning for inline reference elements that can span
|
|
1869
|
+
* over multiple lines, such as hyperlinks or range selections.
|
|
1870
|
+
* @see https://floating-ui.com/docs/inline
|
|
1871
|
+
*/
|
|
1872
|
+
const inline = inline$1;
|
|
1873
|
+
|
|
1701
1874
|
/**
|
|
1702
1875
|
* Computes the `x` and `y` coordinates that will place the floating element
|
|
1703
|
-
* next to a reference element
|
|
1704
|
-
* strategy.
|
|
1876
|
+
* next to a given reference element.
|
|
1705
1877
|
*/
|
|
1706
1878
|
const computePosition = (reference, floating, options) => {
|
|
1707
1879
|
// This caches the expensive `getClippingElementAncestors` function so that
|
|
@@ -1801,7 +1973,10 @@ class Popup extends FoundationElement {
|
|
|
1801
1973
|
#cleanup;
|
|
1802
1974
|
openChanged(_, newValue) {
|
|
1803
1975
|
newValue ? this.$emit("vwc-popup:open") : this.$emit("vwc-popup:close");
|
|
1804
|
-
DOM.queueUpdate(() =>
|
|
1976
|
+
DOM.queueUpdate(() => {
|
|
1977
|
+
this.#updateAutoUpdate();
|
|
1978
|
+
this.#togglePopover();
|
|
1979
|
+
});
|
|
1805
1980
|
}
|
|
1806
1981
|
/**
|
|
1807
1982
|
* @internal
|
|
@@ -1815,6 +1990,9 @@ class Popup extends FoundationElement {
|
|
|
1815
1990
|
anchorChanged() {
|
|
1816
1991
|
this.#updateAutoUpdate();
|
|
1817
1992
|
}
|
|
1993
|
+
strategyChanged() {
|
|
1994
|
+
this.#togglePopover();
|
|
1995
|
+
}
|
|
1818
1996
|
connectedCallback() {
|
|
1819
1997
|
super.connectedCallback();
|
|
1820
1998
|
this.#updateAutoUpdate();
|
|
@@ -1836,6 +2014,15 @@ class Popup extends FoundationElement {
|
|
|
1836
2014
|
);
|
|
1837
2015
|
}
|
|
1838
2016
|
}
|
|
2017
|
+
#togglePopover() {
|
|
2018
|
+
if (this.popupEl && this.strategy === "fixed") {
|
|
2019
|
+
if (this.open) {
|
|
2020
|
+
this.popupEl.showPopover();
|
|
2021
|
+
} else {
|
|
2022
|
+
this.popupEl.hidePopover();
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
1839
2026
|
/**
|
|
1840
2027
|
* Updates popup's position
|
|
1841
2028
|
*
|
|
@@ -1921,7 +2108,7 @@ __decorateClass([
|
|
|
1921
2108
|
observable
|
|
1922
2109
|
], Popup.prototype, "anchor");
|
|
1923
2110
|
|
|
1924
|
-
const styles = ":host{display:var(--_popup-display, inline)}.control{border-radius:inherit;background:var(--vvd-color-surface-4dp);contain:layout}.control:not(.open){display:none}.popup-wrapper{white-space:initial;z-index:var(--_popup-z-index, 10);border-radius:8px;inline-size:max-content}.popup-wrapper:not(.absolute){position:fixed}.popup-wrapper.absolute{position:absolute;top:0;left:0}.popup-content{display:grid;color:var(--vvd-color-canvas-text)}.dismissible .popup-content{align-content:start;grid-template-columns:1fr auto}.arrow{position:absolute;z-index:-1;width:8px;height:8px;background:var(--vvd-color-surface-4dp);transform:rotate(45deg)}.dismissible-button{align-self:flex-start;margin-block-start:4px;margin-inline-end:4px}";
|
|
2111
|
+
const styles = ":host{display:var(--_popup-display, inline)}.control{border-radius:inherit;background:var(--vvd-color-surface-4dp);contain:layout}.control:not(.open){display:none}.popup-wrapper{white-space:initial;z-index:var(--_popup-z-index, 10);overflow:visible;padding:0;border:none;border-radius:8px;margin:0;inline-size:max-content}.popup-wrapper:not(.absolute){position:fixed}.popup-wrapper.absolute{position:absolute;top:0;left:0}.popup-content{display:grid;color:var(--vvd-color-canvas-text)}.dismissible .popup-content{align-content:start;grid-template-columns:1fr auto}.arrow{position:absolute;z-index:-1;width:8px;height:8px;background:var(--vvd-color-surface-4dp);transform:rotate(45deg)}.dismissible-button{align-self:flex-start;margin-block-start:4px;margin-inline-end:4px}";
|
|
1925
2112
|
|
|
1926
2113
|
const getClasses = ({ open, dismissible, alternate }) => classNames(
|
|
1927
2114
|
"control",
|
|
@@ -1929,14 +2116,15 @@ const getClasses = ({ open, dismissible, alternate }) => classNames(
|
|
|
1929
2116
|
["dismissible", Boolean(dismissible)],
|
|
1930
2117
|
["alternate", Boolean(alternate)]
|
|
1931
2118
|
);
|
|
2119
|
+
function handlePopover(x) {
|
|
2120
|
+
return x.strategy && x.strategy === "fixed" ? "manual" : null;
|
|
2121
|
+
}
|
|
1932
2122
|
const popupTemplate = (context) => {
|
|
1933
2123
|
const elevationTag = context.tagFor(Elevation);
|
|
1934
2124
|
const buttonTag = context.tagFor(Button);
|
|
1935
2125
|
return html`
|
|
1936
2126
|
<${elevationTag}>
|
|
1937
|
-
|
|
1938
|
-
"popupEl"
|
|
1939
|
-
)} part="popup-base">
|
|
2127
|
+
<div popover="${handlePopover}" class="popup-wrapper ${(x) => x.strategy}" ${ref("popupEl")} part="popup-base">
|
|
1940
2128
|
<div class="${getClasses}" aria-hidden="${(x) => x.open ? "false" : "true"}"
|
|
1941
2129
|
part="${(x) => x.alternate ? "vvd-theme-alternate" : ""}">
|
|
1942
2130
|
<div class="popup-content">
|