@italia/popover 1.0.0-alpha.5 → 1.0.0-alpha.6
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 +1 -1
- package/dist/src/it-popover.js +76 -71
- package/dist/src/it-popover.js.map +1 -1
- package/package.json +6 -6
package/custom-elements.json
CHANGED
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
{
|
|
224
224
|
"kind": "variable",
|
|
225
225
|
"name": "meta",
|
|
226
|
-
"default": "{ title: 'Componenti/Popover', component: 'it-popover', tags: ['alpha', 'web-component', 'a11y-ok'], args: { placement: 'right', }, argTypes: { placement: { control: 'select', options: [ 'top', 'right', 'bottom', 'left', 'top-start', 'top-end', 'right-start', 'right-end', 'bottom-start', 'bottom-end', 'left-start', 'left-end', ], table: { defaultValue: { summary: 'bottom-start' }, }, }, }, parameters: { layout: 'padded',
|
|
226
|
+
"default": "{ title: 'Componenti/Popover', component: 'it-popover', tags: ['alpha', 'web-component', 'a11y-ok'], args: { placement: 'right', }, argTypes: { placement: { control: 'select', options: [ 'top', 'right', 'bottom', 'left', 'top-start', 'top-end', 'right-start', 'right-end', 'bottom-start', 'bottom-end', 'left-start', 'left-end', ], table: { defaultValue: { summary: 'bottom-start' }, }, }, }, parameters: { layout: 'padded', }, } satisfies Meta<PopoverProps>"
|
|
227
227
|
},
|
|
228
228
|
{
|
|
229
229
|
"kind": "variable",
|
package/dist/src/it-popover.js
CHANGED
|
@@ -1078,7 +1078,7 @@ if (typeof window !== 'undefined') {
|
|
|
1078
1078
|
window._itAnalytics = window._itAnalytics || {};
|
|
1079
1079
|
window._itAnalytics = {
|
|
1080
1080
|
...window._itAnalytics,
|
|
1081
|
-
version: '1.0.0-alpha.
|
|
1081
|
+
version: '1.0.0-alpha.6',
|
|
1082
1082
|
};
|
|
1083
1083
|
}
|
|
1084
1084
|
|
|
@@ -1273,6 +1273,71 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
1273
1273
|
return coords;
|
|
1274
1274
|
}
|
|
1275
1275
|
|
|
1276
|
+
/**
|
|
1277
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
1278
|
+
* element is overflowing a given clipping boundary on each side.
|
|
1279
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
1280
|
+
* - negative = how many pixels left before it will overflow
|
|
1281
|
+
* - 0 = lies flush with the boundary
|
|
1282
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
1283
|
+
*/
|
|
1284
|
+
async function detectOverflow(state, options) {
|
|
1285
|
+
var _await$platform$isEle;
|
|
1286
|
+
if (options === void 0) {
|
|
1287
|
+
options = {};
|
|
1288
|
+
}
|
|
1289
|
+
const {
|
|
1290
|
+
x,
|
|
1291
|
+
y,
|
|
1292
|
+
platform,
|
|
1293
|
+
rects,
|
|
1294
|
+
elements,
|
|
1295
|
+
strategy
|
|
1296
|
+
} = state;
|
|
1297
|
+
const {
|
|
1298
|
+
boundary = 'clippingAncestors',
|
|
1299
|
+
rootBoundary = 'viewport',
|
|
1300
|
+
elementContext = 'floating',
|
|
1301
|
+
altBoundary = false,
|
|
1302
|
+
padding = 0
|
|
1303
|
+
} = evaluate(options, state);
|
|
1304
|
+
const paddingObject = getPaddingObject(padding);
|
|
1305
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
1306
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
1307
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
1308
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
1309
|
+
boundary,
|
|
1310
|
+
rootBoundary,
|
|
1311
|
+
strategy
|
|
1312
|
+
}));
|
|
1313
|
+
const rect = elementContext === 'floating' ? {
|
|
1314
|
+
x,
|
|
1315
|
+
y,
|
|
1316
|
+
width: rects.floating.width,
|
|
1317
|
+
height: rects.floating.height
|
|
1318
|
+
} : rects.reference;
|
|
1319
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
1320
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
1321
|
+
x: 1,
|
|
1322
|
+
y: 1
|
|
1323
|
+
} : {
|
|
1324
|
+
x: 1,
|
|
1325
|
+
y: 1
|
|
1326
|
+
};
|
|
1327
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1328
|
+
elements,
|
|
1329
|
+
rect,
|
|
1330
|
+
offsetParent,
|
|
1331
|
+
strategy
|
|
1332
|
+
}) : rect);
|
|
1333
|
+
return {
|
|
1334
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
1335
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
1336
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
1337
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1276
1341
|
/**
|
|
1277
1342
|
* Computes the `x` and `y` coordinates that will place the floating element
|
|
1278
1343
|
* next to a given reference element.
|
|
@@ -1302,6 +1367,7 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
1302
1367
|
let middlewareData = {};
|
|
1303
1368
|
let resetCount = 0;
|
|
1304
1369
|
for (let i = 0; i < validMiddleware.length; i++) {
|
|
1370
|
+
var _platform$detectOverf;
|
|
1305
1371
|
const {
|
|
1306
1372
|
name,
|
|
1307
1373
|
fn
|
|
@@ -1319,7 +1385,10 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
1319
1385
|
strategy,
|
|
1320
1386
|
middlewareData,
|
|
1321
1387
|
rects,
|
|
1322
|
-
platform
|
|
1388
|
+
platform: {
|
|
1389
|
+
...platform,
|
|
1390
|
+
detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
|
|
1391
|
+
},
|
|
1323
1392
|
elements: {
|
|
1324
1393
|
reference,
|
|
1325
1394
|
floating
|
|
@@ -1364,71 +1433,6 @@ const computePosition$1 = async (reference, floating, config) => {
|
|
|
1364
1433
|
};
|
|
1365
1434
|
};
|
|
1366
1435
|
|
|
1367
|
-
/**
|
|
1368
|
-
* Resolves with an object of overflow side offsets that determine how much the
|
|
1369
|
-
* element is overflowing a given clipping boundary on each side.
|
|
1370
|
-
* - positive = overflowing the boundary by that number of pixels
|
|
1371
|
-
* - negative = how many pixels left before it will overflow
|
|
1372
|
-
* - 0 = lies flush with the boundary
|
|
1373
|
-
* @see https://floating-ui.com/docs/detectOverflow
|
|
1374
|
-
*/
|
|
1375
|
-
async function detectOverflow(state, options) {
|
|
1376
|
-
var _await$platform$isEle;
|
|
1377
|
-
if (options === void 0) {
|
|
1378
|
-
options = {};
|
|
1379
|
-
}
|
|
1380
|
-
const {
|
|
1381
|
-
x,
|
|
1382
|
-
y,
|
|
1383
|
-
platform,
|
|
1384
|
-
rects,
|
|
1385
|
-
elements,
|
|
1386
|
-
strategy
|
|
1387
|
-
} = state;
|
|
1388
|
-
const {
|
|
1389
|
-
boundary = 'clippingAncestors',
|
|
1390
|
-
rootBoundary = 'viewport',
|
|
1391
|
-
elementContext = 'floating',
|
|
1392
|
-
altBoundary = false,
|
|
1393
|
-
padding = 0
|
|
1394
|
-
} = evaluate(options, state);
|
|
1395
|
-
const paddingObject = getPaddingObject(padding);
|
|
1396
|
-
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
1397
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
1398
|
-
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
1399
|
-
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
1400
|
-
boundary,
|
|
1401
|
-
rootBoundary,
|
|
1402
|
-
strategy
|
|
1403
|
-
}));
|
|
1404
|
-
const rect = elementContext === 'floating' ? {
|
|
1405
|
-
x,
|
|
1406
|
-
y,
|
|
1407
|
-
width: rects.floating.width,
|
|
1408
|
-
height: rects.floating.height
|
|
1409
|
-
} : rects.reference;
|
|
1410
|
-
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
1411
|
-
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
1412
|
-
x: 1,
|
|
1413
|
-
y: 1
|
|
1414
|
-
} : {
|
|
1415
|
-
x: 1,
|
|
1416
|
-
y: 1
|
|
1417
|
-
};
|
|
1418
|
-
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1419
|
-
elements,
|
|
1420
|
-
rect,
|
|
1421
|
-
offsetParent,
|
|
1422
|
-
strategy
|
|
1423
|
-
}) : rect);
|
|
1424
|
-
return {
|
|
1425
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
1426
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
1427
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
1428
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
1429
|
-
};
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
1436
|
/**
|
|
1433
1437
|
* Provides data to position an inner element of the floating element so that it
|
|
1434
1438
|
* appears centered to the reference element.
|
|
@@ -1561,7 +1565,7 @@ const flip$1 = function (options) {
|
|
|
1561
1565
|
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
1562
1566
|
}
|
|
1563
1567
|
const placements = [initialPlacement, ...fallbackPlacements];
|
|
1564
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1568
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
1565
1569
|
const overflows = [];
|
|
1566
1570
|
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
1567
1571
|
if (checkMainAxis) {
|
|
@@ -1745,7 +1749,8 @@ const shift$1 = function (options) {
|
|
|
1745
1749
|
const {
|
|
1746
1750
|
x,
|
|
1747
1751
|
y,
|
|
1748
|
-
placement
|
|
1752
|
+
placement,
|
|
1753
|
+
platform
|
|
1749
1754
|
} = state;
|
|
1750
1755
|
const {
|
|
1751
1756
|
mainAxis: checkMainAxis = true,
|
|
@@ -1768,7 +1773,7 @@ const shift$1 = function (options) {
|
|
|
1768
1773
|
x,
|
|
1769
1774
|
y
|
|
1770
1775
|
};
|
|
1771
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1776
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
1772
1777
|
const crossAxis = getSideAxis(getSide(placement));
|
|
1773
1778
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
1774
1779
|
let mainAxisCoord = coords[mainAxis];
|
|
@@ -1832,7 +1837,7 @@ const size$1 = function (options) {
|
|
|
1832
1837
|
apply = () => {},
|
|
1833
1838
|
...detectOverflowOptions
|
|
1834
1839
|
} = evaluate(options, state);
|
|
1835
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1840
|
+
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
1836
1841
|
const side = getSide(placement);
|
|
1837
1842
|
const alignment = getAlignment(placement);
|
|
1838
1843
|
const isYAxis = getSideAxis(placement) === 'y';
|