@italia/tooltip 1.0.0-alpha.17 → 1.0.0-alpha.18
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/LICENSE +8 -15
- package/dist/src/it-tooltip.d.ts.map +1 -1
- package/dist/src/it-tooltip.js +167 -73
- package/dist/src/it-tooltip.js.map +1 -1
- package/package.json +6 -6
package/LICENSE
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
Copyright (c) 2025, the respective contributors, as shown by the AUTHORS file.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
18
|
-
SOFTWARE.
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"it-tooltip.d.ts","sourceRoot":"","sources":["../../src/it-tooltip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAQ,cAAc,EAAE,MAAM,KAAK,CAAC;AAG3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AASnD,qBACa,SAAU,SAAQ,aAAa;IAC1C,MAAM,CAAC,MAAM,+BAAU;IAEvB,MAAM,CAAC,MAAM,SAAK;IAElB,MAAM,CAAC,mBAAmB,SAAO;IAEW,IAAI,UAAS;IAE5B,UAAU,UAAS;IAEpB,SAAS,EAAE,gBAAgB,CAAS;IAEb,MAAM,EAAE,OAAO,CAAS;IAE5C,OAAO,CAAC,YAAY,CAAmB;IAEvC,OAAO,CAAC,YAAY,CAAmB;IAEnD,OAAO,CAAC,eAAe,CAAe;IAEhC,OAAO,CAAC,aAAa,CAAe;IAE7D,eAAe,UAAS;IAExB,OAAO,CAAC,eAAe,CAA4B;IAEnD,OAAO,CAAC,YAAY,CAA4B;IAEhD,OAAO,KAAK,eAAe,GAE1B;IAED,OAAO,CAAC,QAAQ,CAAC,CAAa;IAE9B,OAAO,CAAC,aAAa,CAEnB;IAEF,OAAO,CAAC,aAAa,CAOnB;IAEF,OAAO,CAAC,oBAAoB,CAO1B;IAEF,OAAO,CAAC,UAAU,CAEhB;IAEF,OAAO,CAAC,WAAW,CAEjB;IAEF,OAAO,CAAC,UAAU,CAEhB;IAEF,oBAAoB,IAAI,IAAI;IAU5B,OAAO,CAAC,mBAAmB;
|
|
1
|
+
{"version":3,"file":"it-tooltip.d.ts","sourceRoot":"","sources":["../../src/it-tooltip.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAQ,cAAc,EAAE,MAAM,KAAK,CAAC;AAG3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AASnD,qBACa,SAAU,SAAQ,aAAa;IAC1C,MAAM,CAAC,MAAM,+BAAU;IAEvB,MAAM,CAAC,MAAM,SAAK;IAElB,MAAM,CAAC,mBAAmB,SAAO;IAEW,IAAI,UAAS;IAE5B,UAAU,UAAS;IAEpB,SAAS,EAAE,gBAAgB,CAAS;IAEb,MAAM,EAAE,OAAO,CAAS;IAE5C,OAAO,CAAC,YAAY,CAAmB;IAEvC,OAAO,CAAC,YAAY,CAAmB;IAEnD,OAAO,CAAC,eAAe,CAAe;IAEhC,OAAO,CAAC,aAAa,CAAe;IAE7D,eAAe,UAAS;IAExB,OAAO,CAAC,eAAe,CAA4B;IAEnD,OAAO,CAAC,YAAY,CAA4B;IAEhD,OAAO,KAAK,eAAe,GAE1B;IAED,OAAO,CAAC,QAAQ,CAAC,CAAa;IAE9B,OAAO,CAAC,aAAa,CAEnB;IAEF,OAAO,CAAC,aAAa,CAOnB;IAEF,OAAO,CAAC,oBAAoB,CAO1B;IAEF,OAAO,CAAC,UAAU,CAEhB;IAEF,OAAO,CAAC,WAAW,CAEjB;IAEF,OAAO,CAAC,UAAU,CAEhB;IAEF,oBAAoB,IAAI,IAAI;IAU5B,OAAO,CAAC,mBAAmB;IAU3B,SAAS,CAAC,YAAY,CAAC,kBAAkB,EAAE,cAAc,GAAG,IAAI;IAMhE,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAc3D,OAAO,CAAC,UAAU;IA2BlB,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,KAAK;IAyCb,OAAO,CAAC,KAAK;IAUN,WAAW,IAAI,IAAI;IAInB,WAAW,IAAI,IAAI;IAInB,MAAM,IAAI,IAAI;IAIrB,MAAM;CAoBP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,SAAS,CAAC;KACzB;CACF"}
|
package/dist/src/it-tooltip.js
CHANGED
|
@@ -35,14 +35,80 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
35
35
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
const ARIA_IDREF_ATTRIBUTES = new Map([
|
|
39
|
+
['aria-activedescendant', 'ariaActivedescendantElement'],
|
|
40
|
+
['aria-controls', 'ariaControlsElements'],
|
|
41
|
+
['aria-describedby', 'ariaDescribedByElements'],
|
|
42
|
+
['aria-details', 'ariaDetailsElements'],
|
|
43
|
+
['aria-errormessage', 'ariaErrormessageElements'],
|
|
44
|
+
['aria-flowto', 'ariaFlowtoElements'],
|
|
45
|
+
['aria-labelledby', 'ariaLabelledByElements'],
|
|
46
|
+
['aria-owns', 'ariaOwnsElements'],
|
|
47
|
+
]);
|
|
48
|
+
function resolveAriaIdRefs(element, value) {
|
|
49
|
+
const ids = value
|
|
50
|
+
.trim()
|
|
51
|
+
.split(/\s+/)
|
|
52
|
+
.filter((id) => id.length > 0);
|
|
53
|
+
if (ids.length === 0)
|
|
54
|
+
return null;
|
|
55
|
+
const root = element.getRootNode();
|
|
56
|
+
let resolvedElements = [];
|
|
57
|
+
if (root instanceof ShadowRoot) {
|
|
58
|
+
resolvedElements = ids.map((id) => root.getElementById(id));
|
|
59
|
+
}
|
|
60
|
+
else if (root instanceof Document) {
|
|
61
|
+
resolvedElements = ids.map((id) => root.getElementById(id));
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
resolvedElements = ids.map((id) => document.getElementById(id));
|
|
65
|
+
}
|
|
66
|
+
if (resolvedElements.filter((el) => el !== null).length === 0) {
|
|
67
|
+
resolvedElements = ids.map((id) => document.getElementById(id));
|
|
68
|
+
}
|
|
69
|
+
const validElements = resolvedElements.filter((el) => el !== null);
|
|
70
|
+
return validElements.length === ids.length ? validElements : null;
|
|
71
|
+
}
|
|
72
|
+
function setInternalsProperty(el, name, resolvedElements) {
|
|
73
|
+
if (name === 'aria-activedescendant') {
|
|
74
|
+
const [firstElement] = resolvedElements;
|
|
75
|
+
// eslint-disable-next-line no-param-reassign
|
|
76
|
+
el[name] = firstElement;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// eslint-disable-next-line no-param-reassign
|
|
80
|
+
el[name] = resolvedElements;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
38
83
|
class SetAttributesDirective extends Directive {
|
|
39
84
|
update(part, [attributes]) {
|
|
40
85
|
const el = part.element;
|
|
86
|
+
const internals = el.internals ?? null;
|
|
41
87
|
for (const [name, value] of Object.entries(attributes)) {
|
|
42
|
-
if (value
|
|
43
|
-
el.setAttribute(name, value);
|
|
44
|
-
else
|
|
88
|
+
if (value == null) {
|
|
45
89
|
el.removeAttribute(name);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const internalsPropertyName = ARIA_IDREF_ATTRIBUTES.get(name);
|
|
93
|
+
if (internalsPropertyName) {
|
|
94
|
+
const resolvedElements = resolveAriaIdRefs(el, String(value));
|
|
95
|
+
if (resolvedElements) {
|
|
96
|
+
if (internals) {
|
|
97
|
+
// Set on ElementInternals
|
|
98
|
+
setInternalsProperty(internals, internalsPropertyName, resolvedElements);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
// Set internals property on shadowdom item
|
|
102
|
+
el.setAttribute(name, String(value));
|
|
103
|
+
setInternalsProperty(el, internalsPropertyName, resolvedElements);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
// Non-ARIA IDREF attributes: set normally
|
|
109
|
+
el.setAttribute(name, String(value));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
46
112
|
}
|
|
47
113
|
return null;
|
|
48
114
|
}
|
|
@@ -410,6 +476,26 @@ class BaseComponent extends LitElement {
|
|
|
410
476
|
// generate internal _id
|
|
411
477
|
const prefix = this.id?.length > 0 ? this.id : this.tagName.toLowerCase();
|
|
412
478
|
this._id = this.generateId(prefix);
|
|
479
|
+
this.ariaAttributesObserver = new MutationObserver((mutations) => {
|
|
480
|
+
const shouldUpdate = mutations.some((mutation) => {
|
|
481
|
+
if (mutation.type !== 'attributes' || !mutation.attributeName) {
|
|
482
|
+
return false;
|
|
483
|
+
}
|
|
484
|
+
return mutation.attributeName === 'it-role' || mutation.attributeName.startsWith('it-aria-');
|
|
485
|
+
});
|
|
486
|
+
if (shouldUpdate) {
|
|
487
|
+
this.requestUpdate();
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
this.ariaAttributesObserver.observe(this, {
|
|
491
|
+
attributes: true,
|
|
492
|
+
attributeOldValue: true,
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
disconnectedCallback() {
|
|
496
|
+
this.ariaAttributesObserver?.disconnect();
|
|
497
|
+
this.ariaAttributesObserver = undefined;
|
|
498
|
+
super.disconnectedCallback();
|
|
413
499
|
}
|
|
414
500
|
}
|
|
415
501
|
const BaseLocalizedComponent = LocalizeMixin(BaseComponent);
|
|
@@ -842,7 +928,7 @@ class FormControl extends BaseLocalizedComponent {
|
|
|
842
928
|
});
|
|
843
929
|
// TODO: verificare se serve davvero con il fatto che usiamo form-controller
|
|
844
930
|
// static formAssociated = true;
|
|
845
|
-
//
|
|
931
|
+
// @property()
|
|
846
932
|
// internals = this.attachInternals();
|
|
847
933
|
this._touched = false;
|
|
848
934
|
/** The name of the input, submitted as a name/value pair with form data. */
|
|
@@ -1090,7 +1176,7 @@ if (typeof window !== 'undefined') {
|
|
|
1090
1176
|
window._itAnalytics = window._itAnalytics || {};
|
|
1091
1177
|
window._itAnalytics = {
|
|
1092
1178
|
...window._itAnalytics,
|
|
1093
|
-
version: '1.0.0-alpha.
|
|
1179
|
+
version: '1.0.0-alpha.18',
|
|
1094
1180
|
};
|
|
1095
1181
|
}
|
|
1096
1182
|
|
|
@@ -1113,10 +1199,6 @@ const oppositeSideMap = {
|
|
|
1113
1199
|
bottom: 'top',
|
|
1114
1200
|
top: 'bottom'
|
|
1115
1201
|
};
|
|
1116
|
-
const oppositeAlignmentMap = {
|
|
1117
|
-
start: 'end',
|
|
1118
|
-
end: 'start'
|
|
1119
|
-
};
|
|
1120
1202
|
function clamp(start, value, end) {
|
|
1121
1203
|
return max(start, min(value, end));
|
|
1122
1204
|
}
|
|
@@ -1135,9 +1217,9 @@ function getOppositeAxis(axis) {
|
|
|
1135
1217
|
function getAxisLength(axis) {
|
|
1136
1218
|
return axis === 'y' ? 'height' : 'width';
|
|
1137
1219
|
}
|
|
1138
|
-
const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
|
|
1139
1220
|
function getSideAxis(placement) {
|
|
1140
|
-
|
|
1221
|
+
const firstChar = placement[0];
|
|
1222
|
+
return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
|
|
1141
1223
|
}
|
|
1142
1224
|
function getAlignmentAxis(placement) {
|
|
1143
1225
|
return getOppositeAxis(getSideAxis(placement));
|
|
@@ -1160,7 +1242,7 @@ function getExpandedPlacements(placement) {
|
|
|
1160
1242
|
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
1161
1243
|
}
|
|
1162
1244
|
function getOppositeAlignmentPlacement(placement) {
|
|
1163
|
-
return placement.replace(
|
|
1245
|
+
return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
|
|
1164
1246
|
}
|
|
1165
1247
|
const lrPlacement = ['left', 'right'];
|
|
1166
1248
|
const rlPlacement = ['right', 'left'];
|
|
@@ -1191,7 +1273,8 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
|
1191
1273
|
return list;
|
|
1192
1274
|
}
|
|
1193
1275
|
function getOppositePlacement(placement) {
|
|
1194
|
-
|
|
1276
|
+
const side = getSide(placement);
|
|
1277
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
1195
1278
|
}
|
|
1196
1279
|
function expandPaddingObject(padding) {
|
|
1197
1280
|
return {
|
|
@@ -1350,6 +1433,9 @@ async function detectOverflow(state, options) {
|
|
|
1350
1433
|
};
|
|
1351
1434
|
}
|
|
1352
1435
|
|
|
1436
|
+
// Maximum number of resets that can occur before bailing to avoid infinite reset loops.
|
|
1437
|
+
const MAX_RESET_COUNT = 50;
|
|
1438
|
+
|
|
1353
1439
|
/**
|
|
1354
1440
|
* Computes the `x` and `y` coordinates that will place the floating element
|
|
1355
1441
|
* next to a given reference element.
|
|
@@ -1364,7 +1450,10 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
1364
1450
|
middleware = [],
|
|
1365
1451
|
platform
|
|
1366
1452
|
} = config;
|
|
1367
|
-
const
|
|
1453
|
+
const platformWithDetectOverflow = platform.detectOverflow ? platform : {
|
|
1454
|
+
...platform,
|
|
1455
|
+
detectOverflow
|
|
1456
|
+
};
|
|
1368
1457
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
1369
1458
|
let rects = await platform.getElementRects({
|
|
1370
1459
|
reference,
|
|
@@ -1376,14 +1465,17 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
1376
1465
|
y
|
|
1377
1466
|
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
1378
1467
|
let statefulPlacement = placement;
|
|
1379
|
-
let middlewareData = {};
|
|
1380
1468
|
let resetCount = 0;
|
|
1381
|
-
|
|
1382
|
-
|
|
1469
|
+
const middlewareData = {};
|
|
1470
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
1471
|
+
const currentMiddleware = middleware[i];
|
|
1472
|
+
if (!currentMiddleware) {
|
|
1473
|
+
continue;
|
|
1474
|
+
}
|
|
1383
1475
|
const {
|
|
1384
1476
|
name,
|
|
1385
1477
|
fn
|
|
1386
|
-
} =
|
|
1478
|
+
} = currentMiddleware;
|
|
1387
1479
|
const {
|
|
1388
1480
|
x: nextX,
|
|
1389
1481
|
y: nextY,
|
|
@@ -1397,10 +1489,7 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
1397
1489
|
strategy,
|
|
1398
1490
|
middlewareData,
|
|
1399
1491
|
rects,
|
|
1400
|
-
platform:
|
|
1401
|
-
...platform,
|
|
1402
|
-
detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
|
|
1403
|
-
},
|
|
1492
|
+
platform: platformWithDetectOverflow,
|
|
1404
1493
|
elements: {
|
|
1405
1494
|
reference,
|
|
1406
1495
|
floating
|
|
@@ -1408,14 +1497,11 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
1408
1497
|
});
|
|
1409
1498
|
x = nextX != null ? nextX : x;
|
|
1410
1499
|
y = nextY != null ? nextY : y;
|
|
1411
|
-
middlewareData = {
|
|
1412
|
-
...middlewareData,
|
|
1413
|
-
|
|
1414
|
-
...middlewareData[name],
|
|
1415
|
-
...data
|
|
1416
|
-
}
|
|
1500
|
+
middlewareData[name] = {
|
|
1501
|
+
...middlewareData[name],
|
|
1502
|
+
...data
|
|
1417
1503
|
};
|
|
1418
|
-
if (reset && resetCount
|
|
1504
|
+
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
1419
1505
|
resetCount++;
|
|
1420
1506
|
if (typeof reset === 'object') {
|
|
1421
1507
|
if (reset.placement) {
|
|
@@ -1868,7 +1954,6 @@ function isShadowRoot(value) {
|
|
|
1868
1954
|
}
|
|
1869
1955
|
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
1870
1956
|
}
|
|
1871
|
-
const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
|
|
1872
1957
|
function isOverflowElement(element) {
|
|
1873
1958
|
const {
|
|
1874
1959
|
overflow,
|
|
@@ -1876,32 +1961,35 @@ function isOverflowElement(element) {
|
|
|
1876
1961
|
overflowY,
|
|
1877
1962
|
display
|
|
1878
1963
|
} = getComputedStyle$1(element);
|
|
1879
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) &&
|
|
1964
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
|
1880
1965
|
}
|
|
1881
|
-
const tableElements = /*#__PURE__*/new Set(['table', 'td', 'th']);
|
|
1882
1966
|
function isTableElement(element) {
|
|
1883
|
-
return
|
|
1967
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
1884
1968
|
}
|
|
1885
|
-
const topLayerSelectors = [':popover-open', ':modal'];
|
|
1886
1969
|
function isTopLayer(element) {
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
return
|
|
1890
|
-
} catch (_e) {
|
|
1891
|
-
return false;
|
|
1970
|
+
try {
|
|
1971
|
+
if (element.matches(':popover-open')) {
|
|
1972
|
+
return true;
|
|
1892
1973
|
}
|
|
1893
|
-
})
|
|
1974
|
+
} catch (_e) {
|
|
1975
|
+
// no-op
|
|
1976
|
+
}
|
|
1977
|
+
try {
|
|
1978
|
+
return element.matches(':modal');
|
|
1979
|
+
} catch (_e) {
|
|
1980
|
+
return false;
|
|
1981
|
+
}
|
|
1894
1982
|
}
|
|
1895
|
-
const
|
|
1896
|
-
const
|
|
1897
|
-
const
|
|
1983
|
+
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
1984
|
+
const containRe = /paint|layout|strict|content/;
|
|
1985
|
+
const isNotNone = value => !!value && value !== 'none';
|
|
1986
|
+
let isWebKitValue;
|
|
1898
1987
|
function isContainingBlock(elementOrCss) {
|
|
1899
|
-
const webkit = isWebKit();
|
|
1900
1988
|
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
1901
1989
|
|
|
1902
1990
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
1903
1991
|
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
1904
|
-
return
|
|
1992
|
+
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
|
1905
1993
|
}
|
|
1906
1994
|
function getContainingBlock(element) {
|
|
1907
1995
|
let currentNode = getParentNode(element);
|
|
@@ -1916,12 +2004,13 @@ function getContainingBlock(element) {
|
|
|
1916
2004
|
return null;
|
|
1917
2005
|
}
|
|
1918
2006
|
function isWebKit() {
|
|
1919
|
-
if (
|
|
1920
|
-
|
|
2007
|
+
if (isWebKitValue == null) {
|
|
2008
|
+
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
|
2009
|
+
}
|
|
2010
|
+
return isWebKitValue;
|
|
1921
2011
|
}
|
|
1922
|
-
const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
|
|
1923
2012
|
function isLastTraversableNode(node) {
|
|
1924
|
-
return
|
|
2013
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
1925
2014
|
}
|
|
1926
2015
|
function getComputedStyle$1(element) {
|
|
1927
2016
|
return getWindow(element).getComputedStyle(element);
|
|
@@ -1977,8 +2066,9 @@ function getOverflowAncestors(node, list, traverseIframes) {
|
|
|
1977
2066
|
if (isBody) {
|
|
1978
2067
|
const frameElement = getFrameElement(win);
|
|
1979
2068
|
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
2069
|
+
} else {
|
|
2070
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1980
2071
|
}
|
|
1981
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1982
2072
|
}
|
|
1983
2073
|
function getFrameElement(win) {
|
|
1984
2074
|
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
@@ -2155,7 +2245,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
2155
2245
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
2156
2246
|
scroll = getNodeScroll(offsetParent);
|
|
2157
2247
|
}
|
|
2158
|
-
if (
|
|
2248
|
+
if (isOffsetParentAnElement) {
|
|
2159
2249
|
const offsetRect = getBoundingClientRect(offsetParent);
|
|
2160
2250
|
scale = getScale(offsetParent);
|
|
2161
2251
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
@@ -2243,7 +2333,6 @@ function getViewportRect(element, strategy) {
|
|
|
2243
2333
|
};
|
|
2244
2334
|
}
|
|
2245
2335
|
|
|
2246
|
-
const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
|
|
2247
2336
|
// Returns the inner client rect, subtracting scrollbars if present.
|
|
2248
2337
|
function getInnerBoundingClientRect(element, strategy) {
|
|
2249
2338
|
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
@@ -2308,7 +2397,7 @@ function getClippingElementAncestors(element, cache) {
|
|
|
2308
2397
|
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
2309
2398
|
currentContainingBlockComputedStyle = null;
|
|
2310
2399
|
}
|
|
2311
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle &&
|
|
2400
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
2312
2401
|
if (shouldDropCurrentNode) {
|
|
2313
2402
|
// Drop non-containing blocks.
|
|
2314
2403
|
result = result.filter(ancestor => ancestor !== currentNode);
|
|
@@ -2333,20 +2422,23 @@ function getClippingRect(_ref) {
|
|
|
2333
2422
|
} = _ref;
|
|
2334
2423
|
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
2335
2424
|
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
2336
|
-
const
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2425
|
+
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
2426
|
+
let top = firstRect.top;
|
|
2427
|
+
let right = firstRect.right;
|
|
2428
|
+
let bottom = firstRect.bottom;
|
|
2429
|
+
let left = firstRect.left;
|
|
2430
|
+
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
2431
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
2432
|
+
top = max(rect.top, top);
|
|
2433
|
+
right = min(rect.right, right);
|
|
2434
|
+
bottom = min(rect.bottom, bottom);
|
|
2435
|
+
left = max(rect.left, left);
|
|
2436
|
+
}
|
|
2345
2437
|
return {
|
|
2346
|
-
width:
|
|
2347
|
-
height:
|
|
2348
|
-
x:
|
|
2349
|
-
y:
|
|
2438
|
+
width: right - left,
|
|
2439
|
+
height: bottom - top,
|
|
2440
|
+
x: left,
|
|
2441
|
+
y: top
|
|
2350
2442
|
};
|
|
2351
2443
|
}
|
|
2352
2444
|
|
|
@@ -2597,7 +2689,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
2597
2689
|
animationFrame = false
|
|
2598
2690
|
} = options;
|
|
2599
2691
|
const referenceEl = unwrapElement(reference);
|
|
2600
|
-
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
|
2692
|
+
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
|
|
2601
2693
|
ancestors.forEach(ancestor => {
|
|
2602
2694
|
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
2603
2695
|
passive: true
|
|
@@ -2610,7 +2702,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
2610
2702
|
if (elementResize) {
|
|
2611
2703
|
resizeObserver = new ResizeObserver(_ref => {
|
|
2612
2704
|
let [firstEntry] = _ref;
|
|
2613
|
-
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
2705
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
|
2614
2706
|
// Prevent update loops when using the `size` middleware.
|
|
2615
2707
|
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
2616
2708
|
resizeObserver.unobserve(floating);
|
|
@@ -2625,7 +2717,9 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
2625
2717
|
if (referenceEl && !animationFrame) {
|
|
2626
2718
|
resizeObserver.observe(referenceEl);
|
|
2627
2719
|
}
|
|
2628
|
-
|
|
2720
|
+
if (floating) {
|
|
2721
|
+
resizeObserver.observe(floating);
|
|
2722
|
+
}
|
|
2629
2723
|
}
|
|
2630
2724
|
let frameId;
|
|
2631
2725
|
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
@@ -2939,8 +3033,8 @@ let ItTooltip = ItTooltip_1 = class ItTooltip extends BaseComponent {
|
|
|
2939
3033
|
_cleanupDescribedBy() {
|
|
2940
3034
|
if (!this._lastTrigger)
|
|
2941
3035
|
return;
|
|
2942
|
-
if (
|
|
2943
|
-
this._lastTrigger.
|
|
3036
|
+
if (this._lastTrigger.tagName.startsWith('IT-')) {
|
|
3037
|
+
this._lastTrigger.removeAttribute('it-aria-describedby');
|
|
2944
3038
|
}
|
|
2945
3039
|
else {
|
|
2946
3040
|
this._lastTrigger.removeAttribute('aria-describedby');
|
|
@@ -2985,8 +3079,8 @@ let ItTooltip = ItTooltip_1 = class ItTooltip extends BaseComponent {
|
|
|
2985
3079
|
else {
|
|
2986
3080
|
content.setAttribute('aria-hidden', 'true');
|
|
2987
3081
|
}
|
|
2988
|
-
if (
|
|
2989
|
-
trigger.
|
|
3082
|
+
if (trigger.tagName.startsWith('IT-')) {
|
|
3083
|
+
trigger.setAttribute('it-aria-describedby', content.id);
|
|
2990
3084
|
}
|
|
2991
3085
|
else {
|
|
2992
3086
|
trigger.setAttribute('aria-describedby', content.id);
|