@swisspost/design-system-components 2.1.0 → 7.1.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/README.md +1 -1
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/check-one-of-f4f5d0c0.js +8 -0
- package/dist/cjs/heading-levels-608d432e.js +5 -0
- package/dist/cjs/{index-8c288b1a.js → index-a1440961.js} +2 -6
- package/dist/cjs/index-de783b23.js +1394 -0
- package/dist/cjs/index.cjs.js +21 -15
- package/dist/cjs/loader.cjs.js +5 -3
- package/dist/cjs/{package-96a46572.js → package-dacf5ec2.js} +1 -1
- package/dist/cjs/{post-accordion-9d27458a.js → post-accordion-225de951.js} +40 -23
- package/dist/cjs/post-accordion-item-935e122a.js +52 -0
- package/dist/cjs/post-accordion-item.cjs.entry.js +6 -4
- package/dist/cjs/post-accordion.cjs.entry.js +5 -3
- package/dist/cjs/post-alert-6041a34c.js +98 -0
- package/dist/cjs/post-alert.cjs.entry.js +5 -4
- package/dist/cjs/post-card-control-3c089d8e.js +314 -0
- package/dist/cjs/post-card-control.cjs.entry.js +14 -0
- package/dist/cjs/{post-collapsible-1867015c.js → post-collapsible-562268e9.js} +7 -7
- package/dist/cjs/post-collapsible.cjs.entry.js +5 -4
- package/dist/cjs/post-components.cjs.js +13 -11
- package/dist/cjs/{post-icon-07a67b83.js → post-icon-973d5c46.js} +5 -5
- package/dist/cjs/post-icon.cjs.entry.js +5 -4
- package/dist/cjs/post-popover-b0844e71.js +104 -0
- package/dist/cjs/post-popover.cjs.entry.js +3 -3
- package/dist/cjs/{post-popovercontainer-003c0819.js → post-popovercontainer-5bb6a804.js} +254 -55
- package/dist/cjs/post-popovercontainer.cjs.entry.js +3 -3
- package/dist/cjs/post-rating-d2845096.js +88 -0
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/post-tab-header-6496a51b.js +32 -0
- package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-panel-6a9c4a4f.js → post-tab-panel-25bd8c74.js} +3 -3
- package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/{post-tabs-2eb6f376.js → post-tabs-4e4ee252.js} +23 -21
- package/dist/cjs/post-tabs.cjs.entry.js +3 -3
- package/dist/cjs/post-tag-cbc458ed.js +47 -0
- package/dist/cjs/post-tag.cjs.entry.js +11 -0
- package/dist/cjs/{post-tooltip-260d0627.js → post-tooltip-805bc0c0.js} +13 -9
- package/dist/cjs/post-tooltip.cjs.entry.js +3 -3
- package/dist/collection/collection-manifest.json +5 -3
- package/dist/collection/components/post-accordion/post-accordion.js +68 -25
- package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +17 -12
- package/dist/collection/components/post-alert/alert-types.js +1 -1
- package/dist/collection/components/post-alert/post-alert.css +2 -2
- package/dist/collection/components/post-alert/post-alert.js +9 -9
- package/dist/collection/components/post-card-control/post-card-control.css +31 -0
- package/dist/collection/components/post-card-control/post-card-control.js +523 -0
- package/dist/collection/components/post-collapsible/post-collapsible.css +1 -1
- package/dist/collection/components/post-collapsible/post-collapsible.js +6 -6
- package/dist/collection/components/post-icon/post-icon.js +4 -4
- package/dist/collection/components/post-popover/post-popover.css +29 -1
- package/dist/collection/components/post-popover/post-popover.js +3 -3
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +7 -7
- package/dist/collection/components/post-rating/post-rating.css +28 -0
- package/dist/collection/components/post-rating/post-rating.js +8 -8
- package/dist/collection/components/post-tab-header/post-tab-header.css +30 -2
- package/dist/collection/components/post-tab-header/post-tab-header.js +3 -3
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +2 -2
- package/dist/collection/components/post-tabs/post-tabs.css +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +23 -21
- package/dist/collection/components/post-tag/post-tag.css +31 -0
- package/dist/collection/components/post-tag/post-tag.js +119 -0
- package/dist/collection/components/post-tooltip/post-tooltip.js +12 -9
- package/dist/collection/index.js +2 -0
- package/dist/collection/types/heading-levels.js +1 -0
- package/dist/collection/types/index.js +1 -0
- package/dist/collection/utils/index.js +1 -0
- package/dist/collection/utils/sass-export.js +16 -0
- package/dist/components/check-one-of.js +6 -0
- package/dist/components/heading-levels.js +3 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index2.js +1 -5
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +9 -8
- package/dist/components/post-accordion2.js +42 -22
- package/dist/components/post-alert2.js +7 -7
- package/dist/components/post-card-control.d.ts +11 -0
- package/dist/components/post-card-control.js +6 -0
- package/dist/components/post-card-control2.js +345 -0
- package/dist/components/post-collapsible2.js +4 -4
- package/dist/components/post-icon2.js +2 -2
- package/dist/components/post-popover2.js +2 -2
- package/dist/components/post-popovercontainer2.js +252 -53
- package/dist/components/post-rating2.js +6 -6
- package/dist/components/post-tab-header2.js +2 -2
- package/dist/components/post-tab-panel2.js +1 -1
- package/dist/components/post-tabs2.js +21 -19
- package/dist/components/post-tag.d.ts +11 -0
- package/dist/components/post-tag.js +6 -0
- package/dist/components/post-tag2.js +74 -0
- package/dist/components/post-tooltip2.js +11 -7
- package/dist/docs.d.ts +34 -0
- package/dist/docs.json +538 -25
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/check-one-of-6b3ef8eb.js +6 -0
- package/dist/esm/heading-levels-5b7b4349.js +3 -0
- package/dist/esm/index-cf1d5611.js +1365 -0
- package/dist/esm/{index-b444db27.js → index-d1eba94c.js} +1 -5
- package/dist/esm/index.js +19 -15
- package/dist/esm/loader.js +6 -4
- package/dist/esm/{package-50a9c0c3.js → package-a837c1ad.js} +1 -1
- package/dist/esm/{post-accordion-33fe4f0e.js → post-accordion-fdd22c1d.js} +40 -23
- package/dist/esm/post-accordion-item-336f568c.js +50 -0
- package/dist/esm/post-accordion-item.entry.js +6 -4
- package/dist/esm/post-accordion.entry.js +5 -3
- package/dist/esm/post-alert-f48527d8.js +96 -0
- package/dist/esm/post-alert.entry.js +5 -4
- package/dist/esm/post-card-control-3e6a5855.js +312 -0
- package/dist/esm/post-card-control.entry.js +6 -0
- package/dist/esm/{post-collapsible-50dc361b.js → post-collapsible-486ab980.js} +7 -7
- package/dist/esm/post-collapsible.entry.js +5 -4
- package/dist/esm/post-components.js +14 -12
- package/dist/esm/{post-icon-00f314ae.js → post-icon-19fdfc4d.js} +5 -5
- package/dist/esm/post-icon.entry.js +5 -4
- package/dist/esm/post-popover-17164186.js +102 -0
- package/dist/esm/post-popover.entry.js +3 -3
- package/dist/esm/{post-popovercontainer-62e1fd82.js → post-popovercontainer-d19f9646.js} +254 -55
- package/dist/esm/post-popovercontainer.entry.js +3 -3
- package/dist/esm/post-rating-ea204778.js +86 -0
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/post-tab-header-a97cdef2.js +30 -0
- package/dist/esm/post-tab-header.entry.js +3 -3
- package/dist/esm/{post-tab-panel-37a1331f.js → post-tab-panel-e6999395.js} +3 -3
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/{post-tabs-c4e65a45.js → post-tabs-524c699a.js} +23 -21
- package/dist/esm/post-tabs.entry.js +3 -3
- package/dist/esm/post-tag-e2035a81.js +45 -0
- package/dist/esm/post-tag.entry.js +3 -0
- package/dist/esm/{post-tooltip-033f63fa.js → post-tooltip-e4fc9c0c.js} +13 -9
- package/dist/esm/post-tooltip.entry.js +3 -3
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-07cc4853.entry.js +1 -0
- package/dist/post-components/p-0e410cec.entry.js +1 -0
- package/dist/post-components/p-14e22434.entry.js +1 -0
- package/dist/post-components/p-18a2ef27.js +1 -0
- package/dist/post-components/p-18b571e3.js +2 -0
- package/dist/post-components/p-247a1668.js +1 -0
- package/dist/post-components/p-2f4c40ee.js +1 -0
- package/dist/post-components/p-39a1dcb8.entry.js +1 -0
- package/dist/post-components/p-3b0988a1.js +1 -0
- package/dist/post-components/p-3ee18d14.entry.js +1 -0
- package/dist/post-components/p-4575a570.js +1 -0
- package/dist/post-components/p-59da0b80.js +1 -0
- package/dist/post-components/p-611b3c41.js +1 -0
- package/dist/post-components/p-63277771.entry.js +1 -0
- package/dist/post-components/p-67df1075.js +1 -0
- package/dist/post-components/p-74db9b35.entry.js +1 -0
- package/dist/post-components/p-7bb79254.entry.js +1 -0
- package/dist/post-components/p-8398de7b.entry.js +1 -0
- package/dist/post-components/p-9a59f2c7.js +1 -0
- package/dist/post-components/p-c4a7208a.js +1 -0
- package/dist/post-components/{p-7e7833f7.js → p-c85913ed.js} +3 -3
- package/dist/post-components/p-caaa5b4c.entry.js +1 -0
- package/dist/post-components/p-cf10d355.js +1 -0
- package/dist/post-components/p-d1f516dd.js +1 -0
- package/dist/post-components/p-d2eb0f0b.js +1 -0
- package/dist/post-components/p-d70f33cd.js +1 -0
- package/dist/post-components/p-da049db2.entry.js +1 -0
- package/dist/post-components/p-db114d1d.entry.js +1 -0
- package/dist/post-components/p-e1255160.js +1 -0
- package/dist/post-components/p-e929ddbc.js +1 -0
- package/dist/post-components/p-ebb54756.entry.js +1 -0
- package/dist/post-components/p-ed22dec0.js +1 -0
- package/dist/post-components/p-f5d8f3fe.entry.js +1 -0
- package/dist/post-components/p-f91c0e1b.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-accordion/post-accordion.d.ts +8 -2
- package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +3 -2
- package/dist/types/components/post-alert/alert-types.d.ts +2 -2
- package/dist/types/components/post-alert/post-alert.d.ts +2 -2
- package/dist/types/components/post-card-control/post-card-control.d.ts +112 -0
- package/dist/types/components/post-collapsible/post-collapsible.d.ts +1 -1
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +1 -1
- package/dist/types/components/post-rating/post-rating.d.ts +2 -2
- package/dist/types/components/post-tabs/post-tabs.d.ts +1 -1
- package/dist/types/components/post-tag/post-tag.d.ts +27 -0
- package/dist/types/components.d.ts +191 -15
- package/dist/types/css-modules.js +0 -0
- package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/types/css-modules.d.ts +6 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/types/heading-levels.d.ts +2 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/sass-export.d.ts +2 -0
- package/package.json +22 -22
- package/dist/cjs/index-f243643b.js +0 -2051
- package/dist/cjs/post-accordion-item-61fb55fa.js +0 -51
- package/dist/cjs/post-alert-a810f5b9.js +0 -98
- package/dist/cjs/post-popover-9610b64c.js +0 -104
- package/dist/cjs/post-rating-75574abd.js +0 -88
- package/dist/cjs/post-tab-header-85424e32.js +0 -32
- package/dist/esm/index-1708db56.js +0 -2022
- package/dist/esm/post-accordion-item-1fd95c9f.js +0 -49
- package/dist/esm/post-alert-65d67f69.js +0 -96
- package/dist/esm/post-popover-40bfd1b7.js +0 -102
- package/dist/esm/post-rating-f7a79ed4.js +0 -86
- package/dist/esm/post-tab-header-0683252a.js +0 -30
- package/dist/post-components/p-00dcad55.js +0 -1
- package/dist/post-components/p-01e57281.entry.js +0 -1
- package/dist/post-components/p-06c989fb.entry.js +0 -1
- package/dist/post-components/p-07ffb6de.entry.js +0 -1
- package/dist/post-components/p-10b4cf7a.js +0 -2
- package/dist/post-components/p-26c658c1.entry.js +0 -1
- package/dist/post-components/p-2a964700.js +0 -1
- package/dist/post-components/p-35f14000.js +0 -1
- package/dist/post-components/p-3fb09ecd.js +0 -1
- package/dist/post-components/p-4b0a45d8.entry.js +0 -1
- package/dist/post-components/p-53e8e4e7.entry.js +0 -1
- package/dist/post-components/p-598b11b6.js +0 -1
- package/dist/post-components/p-5b6ee52a.entry.js +0 -1
- package/dist/post-components/p-8139faa4.entry.js +0 -1
- package/dist/post-components/p-8cd6d7c2.js +0 -1
- package/dist/post-components/p-99a9602e.js +0 -1
- package/dist/post-components/p-a2775477.entry.js +0 -1
- package/dist/post-components/p-a905b16b.entry.js +0 -1
- package/dist/post-components/p-aa02111b.js +0 -1
- package/dist/post-components/p-b135d3e2.js +0 -1
- package/dist/post-components/p-b81e61ed.entry.js +0 -1
- package/dist/post-components/p-d6bc34ff.js +0 -1
- package/dist/post-components/p-da2b8e26.entry.js +0 -1
- package/dist/post-components/p-f0476913.js +0 -1
- package/dist/post-components/p-f0e82e63.js +0 -1
- package/dist/post-components/p-ff0e1564.js +0 -1
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
4
|
-
const _package = require('./package-
|
|
3
|
+
const index = require('./index-de783b23.js');
|
|
4
|
+
const _package = require('./package-dacf5ec2.js');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Custom positioning reference element.
|
|
8
8
|
* @see https://floating-ui.com/docs/virtual-elements
|
|
9
9
|
*/
|
|
10
|
+
|
|
11
|
+
const sides = ['top', 'right', 'bottom', 'left'];
|
|
12
|
+
const alignments = ['start', 'end'];
|
|
13
|
+
const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
|
|
10
14
|
const min = Math.min;
|
|
11
15
|
const max = Math.max;
|
|
12
16
|
const round = Math.round;
|
|
@@ -420,6 +424,109 @@ const arrow$1 = options => ({
|
|
|
420
424
|
}
|
|
421
425
|
});
|
|
422
426
|
|
|
427
|
+
function getPlacementList(alignment, autoAlignment, allowedPlacements) {
|
|
428
|
+
const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);
|
|
429
|
+
return allowedPlacementsSortedByAlignment.filter(placement => {
|
|
430
|
+
if (alignment) {
|
|
431
|
+
return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
|
|
432
|
+
}
|
|
433
|
+
return true;
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
438
|
+
* that has the most space available automatically, without needing to specify a
|
|
439
|
+
* preferred placement. Alternative to `flip`.
|
|
440
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
441
|
+
*/
|
|
442
|
+
const autoPlacement = function (options) {
|
|
443
|
+
if (options === void 0) {
|
|
444
|
+
options = {};
|
|
445
|
+
}
|
|
446
|
+
return {
|
|
447
|
+
name: 'autoPlacement',
|
|
448
|
+
options,
|
|
449
|
+
async fn(state) {
|
|
450
|
+
var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
|
|
451
|
+
const {
|
|
452
|
+
rects,
|
|
453
|
+
middlewareData,
|
|
454
|
+
placement,
|
|
455
|
+
platform,
|
|
456
|
+
elements
|
|
457
|
+
} = state;
|
|
458
|
+
const {
|
|
459
|
+
crossAxis = false,
|
|
460
|
+
alignment,
|
|
461
|
+
allowedPlacements = placements,
|
|
462
|
+
autoAlignment = true,
|
|
463
|
+
...detectOverflowOptions
|
|
464
|
+
} = evaluate(options, state);
|
|
465
|
+
const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
|
|
466
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
467
|
+
const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
|
|
468
|
+
const currentPlacement = placements$1[currentIndex];
|
|
469
|
+
if (currentPlacement == null) {
|
|
470
|
+
return {};
|
|
471
|
+
}
|
|
472
|
+
const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
|
|
473
|
+
|
|
474
|
+
// Make `computeCoords` start from the right place.
|
|
475
|
+
if (placement !== currentPlacement) {
|
|
476
|
+
return {
|
|
477
|
+
reset: {
|
|
478
|
+
placement: placements$1[0]
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
|
|
483
|
+
const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
|
|
484
|
+
placement: currentPlacement,
|
|
485
|
+
overflows: currentOverflows
|
|
486
|
+
}];
|
|
487
|
+
const nextPlacement = placements$1[currentIndex + 1];
|
|
488
|
+
|
|
489
|
+
// There are more placements to check.
|
|
490
|
+
if (nextPlacement) {
|
|
491
|
+
return {
|
|
492
|
+
data: {
|
|
493
|
+
index: currentIndex + 1,
|
|
494
|
+
overflows: allOverflows
|
|
495
|
+
},
|
|
496
|
+
reset: {
|
|
497
|
+
placement: nextPlacement
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
const placementsSortedByMostSpace = allOverflows.map(d => {
|
|
502
|
+
const alignment = getAlignment(d.placement);
|
|
503
|
+
return [d.placement, alignment && crossAxis ?
|
|
504
|
+
// Check along the mainAxis and main crossAxis side.
|
|
505
|
+
d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
|
|
506
|
+
// Check only the mainAxis.
|
|
507
|
+
d.overflows[0], d.overflows];
|
|
508
|
+
}).sort((a, b) => a[1] - b[1]);
|
|
509
|
+
const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
|
|
510
|
+
// Aligned placements should not check their opposite crossAxis
|
|
511
|
+
// side.
|
|
512
|
+
getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
|
|
513
|
+
const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
|
|
514
|
+
if (resetPlacement !== placement) {
|
|
515
|
+
return {
|
|
516
|
+
data: {
|
|
517
|
+
index: currentIndex + 1,
|
|
518
|
+
overflows: allOverflows
|
|
519
|
+
},
|
|
520
|
+
reset: {
|
|
521
|
+
placement: resetPlacement
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
return {};
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
|
|
423
530
|
/**
|
|
424
531
|
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
425
532
|
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
@@ -535,6 +642,75 @@ const flip$1 = function (options) {
|
|
|
535
642
|
};
|
|
536
643
|
};
|
|
537
644
|
|
|
645
|
+
function getSideOffsets(overflow, rect) {
|
|
646
|
+
return {
|
|
647
|
+
top: overflow.top - rect.height,
|
|
648
|
+
right: overflow.right - rect.width,
|
|
649
|
+
bottom: overflow.bottom - rect.height,
|
|
650
|
+
left: overflow.left - rect.width
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
function isAnySideFullyClipped(overflow) {
|
|
654
|
+
return sides.some(side => overflow[side] >= 0);
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
658
|
+
* when it is not in the same clipping context as the reference element.
|
|
659
|
+
* @see https://floating-ui.com/docs/hide
|
|
660
|
+
*/
|
|
661
|
+
const hide = function (options) {
|
|
662
|
+
if (options === void 0) {
|
|
663
|
+
options = {};
|
|
664
|
+
}
|
|
665
|
+
return {
|
|
666
|
+
name: 'hide',
|
|
667
|
+
options,
|
|
668
|
+
async fn(state) {
|
|
669
|
+
const {
|
|
670
|
+
rects
|
|
671
|
+
} = state;
|
|
672
|
+
const {
|
|
673
|
+
strategy = 'referenceHidden',
|
|
674
|
+
...detectOverflowOptions
|
|
675
|
+
} = evaluate(options, state);
|
|
676
|
+
switch (strategy) {
|
|
677
|
+
case 'referenceHidden':
|
|
678
|
+
{
|
|
679
|
+
const overflow = await detectOverflow(state, {
|
|
680
|
+
...detectOverflowOptions,
|
|
681
|
+
elementContext: 'reference'
|
|
682
|
+
});
|
|
683
|
+
const offsets = getSideOffsets(overflow, rects.reference);
|
|
684
|
+
return {
|
|
685
|
+
data: {
|
|
686
|
+
referenceHiddenOffsets: offsets,
|
|
687
|
+
referenceHidden: isAnySideFullyClipped(offsets)
|
|
688
|
+
}
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
case 'escaped':
|
|
692
|
+
{
|
|
693
|
+
const overflow = await detectOverflow(state, {
|
|
694
|
+
...detectOverflowOptions,
|
|
695
|
+
altBoundary: true
|
|
696
|
+
});
|
|
697
|
+
const offsets = getSideOffsets(overflow, rects.floating);
|
|
698
|
+
return {
|
|
699
|
+
data: {
|
|
700
|
+
escapedOffsets: offsets,
|
|
701
|
+
escaped: isAnySideFullyClipped(offsets)
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
default:
|
|
706
|
+
{
|
|
707
|
+
return {};
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
|
|
538
714
|
function getBoundingRect(rects) {
|
|
539
715
|
const minX = min(...rects.map(rect => rect.left));
|
|
540
716
|
const minY = min(...rects.map(rect => rect.top));
|
|
@@ -715,7 +891,7 @@ async function convertValueToCoords(state, options) {
|
|
|
715
891
|
* object may be passed.
|
|
716
892
|
* @see https://floating-ui.com/docs/offset
|
|
717
893
|
*/
|
|
718
|
-
const offset = function (options) {
|
|
894
|
+
const offset$1 = function (options) {
|
|
719
895
|
if (options === void 0) {
|
|
720
896
|
options = 0;
|
|
721
897
|
}
|
|
@@ -1201,8 +1377,9 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1201
1377
|
if (domElement) {
|
|
1202
1378
|
const win = getWindow(domElement);
|
|
1203
1379
|
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1204
|
-
let
|
|
1205
|
-
|
|
1380
|
+
let currentWin = win;
|
|
1381
|
+
let currentIFrame = currentWin.frameElement;
|
|
1382
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1206
1383
|
const iframeScale = getScale(currentIFrame);
|
|
1207
1384
|
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1208
1385
|
const css = getComputedStyle(currentIFrame);
|
|
@@ -1214,7 +1391,8 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1214
1391
|
height *= iframeScale.y;
|
|
1215
1392
|
x += left;
|
|
1216
1393
|
y += top;
|
|
1217
|
-
|
|
1394
|
+
currentWin = getWindow(currentIFrame);
|
|
1395
|
+
currentIFrame = currentWin.frameElement;
|
|
1218
1396
|
}
|
|
1219
1397
|
}
|
|
1220
1398
|
return rectToClientRect({
|
|
@@ -1226,27 +1404,14 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
|
|
|
1226
1404
|
}
|
|
1227
1405
|
|
|
1228
1406
|
const topLayerSelectors = [':popover-open', ':modal'];
|
|
1229
|
-
function
|
|
1230
|
-
|
|
1231
|
-
let x = 0;
|
|
1232
|
-
let y = 0;
|
|
1233
|
-
function setIsTopLayer(selector) {
|
|
1407
|
+
function isTopLayer(element) {
|
|
1408
|
+
return topLayerSelectors.some(selector => {
|
|
1234
1409
|
try {
|
|
1235
|
-
|
|
1236
|
-
} catch (e) {
|
|
1237
|
-
|
|
1238
|
-
topLayerSelectors.forEach(selector => {
|
|
1239
|
-
setIsTopLayer(selector);
|
|
1240
|
-
});
|
|
1241
|
-
if (isTopLayer) {
|
|
1242
|
-
const containingBlock = getContainingBlock(floating);
|
|
1243
|
-
if (containingBlock) {
|
|
1244
|
-
const rect = containingBlock.getBoundingClientRect();
|
|
1245
|
-
x = rect.x;
|
|
1246
|
-
y = rect.y;
|
|
1410
|
+
return element.matches(selector);
|
|
1411
|
+
} catch (e) {
|
|
1412
|
+
return false;
|
|
1247
1413
|
}
|
|
1248
|
-
}
|
|
1249
|
-
return [isTopLayer, x, y];
|
|
1414
|
+
});
|
|
1250
1415
|
}
|
|
1251
1416
|
|
|
1252
1417
|
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
@@ -1256,9 +1421,10 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1256
1421
|
offsetParent,
|
|
1257
1422
|
strategy
|
|
1258
1423
|
} = _ref;
|
|
1424
|
+
const isFixed = strategy === 'fixed';
|
|
1259
1425
|
const documentElement = getDocumentElement(offsetParent);
|
|
1260
|
-
const
|
|
1261
|
-
if (offsetParent === documentElement ||
|
|
1426
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
1427
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1262
1428
|
return rect;
|
|
1263
1429
|
}
|
|
1264
1430
|
let scroll = {
|
|
@@ -1268,7 +1434,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
1268
1434
|
let scale = createCoords(1);
|
|
1269
1435
|
const offsets = createCoords(0);
|
|
1270
1436
|
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1271
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement &&
|
|
1437
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1272
1438
|
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
1273
1439
|
scroll = getNodeScroll(offsetParent);
|
|
1274
1440
|
}
|
|
@@ -1429,7 +1595,7 @@ function getClippingRect(_ref) {
|
|
|
1429
1595
|
rootBoundary,
|
|
1430
1596
|
strategy
|
|
1431
1597
|
} = _ref;
|
|
1432
|
-
const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1598
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
1433
1599
|
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
1434
1600
|
const firstClippingAncestor = clippingAncestors[0];
|
|
1435
1601
|
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
@@ -1459,7 +1625,7 @@ function getDimensions(element) {
|
|
|
1459
1625
|
};
|
|
1460
1626
|
}
|
|
1461
1627
|
|
|
1462
|
-
function getRectRelativeToOffsetParent(element, offsetParent, strategy
|
|
1628
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
1463
1629
|
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1464
1630
|
const documentElement = getDocumentElement(offsetParent);
|
|
1465
1631
|
const isFixed = strategy === 'fixed';
|
|
@@ -1481,17 +1647,8 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy, floating
|
|
|
1481
1647
|
offsets.x = getWindowScrollBarX(documentElement);
|
|
1482
1648
|
}
|
|
1483
1649
|
}
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
const [isTopLayer, topLayerX, topLayerY] = topLayer(floating);
|
|
1487
|
-
if (isTopLayer) {
|
|
1488
|
-
x += topLayerX;
|
|
1489
|
-
y += topLayerY;
|
|
1490
|
-
if (isOffsetParentAnElement) {
|
|
1491
|
-
x += offsetParent.clientLeft;
|
|
1492
|
-
y += offsetParent.clientTop;
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1650
|
+
const x = rect.left + scroll.scrollLeft - offsets.x;
|
|
1651
|
+
const y = rect.top + scroll.scrollTop - offsets.y;
|
|
1495
1652
|
return {
|
|
1496
1653
|
x,
|
|
1497
1654
|
y,
|
|
@@ -1500,6 +1657,10 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy, floating
|
|
|
1500
1657
|
};
|
|
1501
1658
|
}
|
|
1502
1659
|
|
|
1660
|
+
function isStaticPositioned(element) {
|
|
1661
|
+
return getComputedStyle(element).position === 'static';
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1503
1664
|
function getTrueOffsetParent(element, polyfill) {
|
|
1504
1665
|
if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
|
|
1505
1666
|
return null;
|
|
@@ -1513,29 +1674,41 @@ function getTrueOffsetParent(element, polyfill) {
|
|
|
1513
1674
|
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
1514
1675
|
// such as table ancestors and cross browser bugs.
|
|
1515
1676
|
function getOffsetParent(element, polyfill) {
|
|
1516
|
-
const
|
|
1677
|
+
const win = getWindow(element);
|
|
1678
|
+
if (isTopLayer(element)) {
|
|
1679
|
+
return win;
|
|
1680
|
+
}
|
|
1517
1681
|
if (!isHTMLElement(element)) {
|
|
1518
|
-
|
|
1682
|
+
let svgOffsetParent = getParentNode(element);
|
|
1683
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
1684
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
1685
|
+
return svgOffsetParent;
|
|
1686
|
+
}
|
|
1687
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
1688
|
+
}
|
|
1689
|
+
return win;
|
|
1519
1690
|
}
|
|
1520
1691
|
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
1521
|
-
while (offsetParent && isTableElement(offsetParent) &&
|
|
1692
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
1522
1693
|
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
1523
1694
|
}
|
|
1524
|
-
if (offsetParent && (
|
|
1525
|
-
return
|
|
1695
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
1696
|
+
return win;
|
|
1526
1697
|
}
|
|
1527
|
-
return offsetParent || getContainingBlock(element) ||
|
|
1698
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
1528
1699
|
}
|
|
1529
1700
|
|
|
1530
1701
|
const getElementRects = async function (data) {
|
|
1531
1702
|
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
1532
1703
|
const getDimensionsFn = this.getDimensions;
|
|
1704
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
1533
1705
|
return {
|
|
1534
|
-
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy
|
|
1706
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
1535
1707
|
floating: {
|
|
1536
1708
|
x: 0,
|
|
1537
1709
|
y: 0,
|
|
1538
|
-
|
|
1710
|
+
width: floatingDimensions.width,
|
|
1711
|
+
height: floatingDimensions.height
|
|
1539
1712
|
}
|
|
1540
1713
|
};
|
|
1541
1714
|
};
|
|
@@ -1605,9 +1778,11 @@ function observeMove(element, onMove) {
|
|
|
1605
1778
|
return refresh();
|
|
1606
1779
|
}
|
|
1607
1780
|
if (!ratio) {
|
|
1781
|
+
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
|
1782
|
+
// to prevent an infinite loop of updates.
|
|
1608
1783
|
timeoutId = setTimeout(() => {
|
|
1609
1784
|
refresh(false, 1e-7);
|
|
1610
|
-
},
|
|
1785
|
+
}, 1000);
|
|
1611
1786
|
} else {
|
|
1612
1787
|
refresh(false, ratio);
|
|
1613
1788
|
}
|
|
@@ -1711,6 +1886,23 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
1711
1886
|
};
|
|
1712
1887
|
}
|
|
1713
1888
|
|
|
1889
|
+
/**
|
|
1890
|
+
* Modifies the placement by translating the floating element along the
|
|
1891
|
+
* specified axes.
|
|
1892
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
1893
|
+
* object may be passed.
|
|
1894
|
+
* @see https://floating-ui.com/docs/offset
|
|
1895
|
+
*/
|
|
1896
|
+
const offset = offset$1;
|
|
1897
|
+
|
|
1898
|
+
/**
|
|
1899
|
+
* Optimizes the visibility of the floating element by choosing the placement
|
|
1900
|
+
* that has the most space available automatically, without needing to specify a
|
|
1901
|
+
* preferred placement. Alternative to `flip`.
|
|
1902
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
1903
|
+
*/
|
|
1904
|
+
autoPlacement;
|
|
1905
|
+
|
|
1714
1906
|
/**
|
|
1715
1907
|
* Optimizes the visibility of the floating element by shifting it in order to
|
|
1716
1908
|
* keep it in view when it will overflow the clipping boundary.
|
|
@@ -1734,6 +1926,13 @@ const flip = flip$1;
|
|
|
1734
1926
|
*/
|
|
1735
1927
|
const size = size$1;
|
|
1736
1928
|
|
|
1929
|
+
/**
|
|
1930
|
+
* Provides data to hide the floating element in applicable situations, such as
|
|
1931
|
+
* when it is not in the same clipping context as the reference element.
|
|
1932
|
+
* @see https://floating-ui.com/docs/hide
|
|
1933
|
+
*/
|
|
1934
|
+
hide;
|
|
1935
|
+
|
|
1737
1936
|
/**
|
|
1738
1937
|
* Provides data to position an inner element of the floating element so that it
|
|
1739
1938
|
* appears centered to the reference element.
|
|
@@ -1834,7 +2033,7 @@ const computePosition = (reference, floating, options) => {
|
|
|
1834
2033
|
}
|
|
1835
2034
|
`,E=null;function I(e){if(E===null)try{E=new CSSStyleSheet,E.replaceSync(C);}catch{E=!1;}if(E===!1){let t=document.createElement("style");t.textContent=C,e instanceof Document?e.head.prepend(t):e.prepend(t);}else e.adoptedStyleSheets=[E,...e.adoptedStyleSheets];}function K(){window.ToggleEvent=window.ToggleEvent||c;function e(n){return n?.includes(":popover-open")&&(n=n.replace(J,"$1.\\:popover-open")),n}f(Document.prototype,"querySelector",e),f(Document.prototype,"querySelectorAll",e),f(Element.prototype,"querySelector",e),f(Element.prototype,"querySelectorAll",e),f(Element.prototype,"matches",e),f(Element.prototype,"closest",e),f(DocumentFragment.prototype,"querySelectorAll",e),f(DocumentFragment.prototype,"querySelectorAll",e),Object.defineProperties(HTMLElement.prototype,{popover:{enumerable:!0,configurable:!0,get(){if(!this.hasAttribute("popover"))return null;let n=(this.getAttribute("popover")||"").toLowerCase();return n===""||n=="auto"?"auto":"manual"},set(n){this.setAttribute("popover",n);}},showPopover:{enumerable:!0,configurable:!0,value(){S(this);}},hidePopover:{enumerable:!0,configurable:!0,value(){m(this,!0,!0);}},togglePopover:{enumerable:!0,configurable:!0,value(n){h.get(this)==="showing"&&n===void 0||n===!1?m(this,!0,!0):(n===void 0||n===!0)&&S(this);}}});let t=Element.prototype.attachShadow;t&&Object.defineProperties(Element.prototype,{attachShadow:{enumerable:!0,configurable:!0,writable:!0,value(n){let s=t.call(this,n);return I(s),s}}});let o=HTMLElement.prototype.attachInternals;o&&Object.defineProperties(HTMLElement.prototype,{attachInternals:{enumerable:!0,configurable:!0,writable:!0,value(){let n=o.call(this);return n.shadowRoot&&I(n.shadowRoot),n}}});let r=new WeakMap;function i(n){Object.defineProperties(n.prototype,{popoverTargetElement:{enumerable:!0,configurable:!0,set(s){if(s===null)this.removeAttribute("popovertarget"),r.delete(this);else if(s instanceof Element)this.setAttribute("popovertarget",""),r.set(this,s);else throw new TypeError("popoverTargetElement must be an element or null")},get(){if(this.localName!=="button"&&this.localName!=="input"||this.localName==="input"&&this.type!=="reset"&&this.type!=="image"&&this.type!=="button"||this.disabled||this.form&&this.type==="submit")return null;let s=r.get(this);if(s&&s.isConnected)return s;if(s&&!s.isConnected)return r.delete(this),null;let u=v(this),w=this.getAttribute("popovertarget");return (u instanceof Document||u instanceof B)&&w&&u.getElementById(w)||null}},popoverTargetAction:{enumerable:!0,configurable:!0,get(){let s=(this.getAttribute("popovertargetaction")||"").toLowerCase();return s==="show"||s==="hide"?s:"toggle"},set(s){this.setAttribute("popovertargetaction",s);}}});}i(HTMLButtonElement),i(HTMLInputElement);let l=n=>{if(!n.isTrusted)return;let s=n.composedPath()[0];if(!(s instanceof Element)||s?.shadowRoot)return;let u=v(s);if(!(u instanceof B||u instanceof Document))return;let w=s.closest("[popovertargetaction],[popovertarget]");if(w){O(w),n.preventDefault();return}},a=n=>{let s=n.key,u=n.target;!n.defaultPrevented&&u&&(s==="Escape"||s==="Esc")&&T(u.ownerDocument,!0,!0);};(n=>{n.addEventListener("click",l),n.addEventListener("keydown",a),n.addEventListener("pointerdown",x),n.addEventListener("pointerup",x);})(document),I(document);}j()||K();})();
|
|
1836
2035
|
|
|
1837
|
-
const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}.popover{box-shadow:.5px 3px 4px rgba(0,0,0,.1),2px 4px 10px 4px rgba(0,0,0,.12);position:fixed;z-index:1060;width:max-content;margin:0;padding:0;box-sizing:border-box;color:var(--post-contrast-color);background-color:rgb(var(--post-bg-rgb));border:2px solid rgba(0,0,0,0);border-radius:4px;overflow:visible}.arrow{position:absolute;width:.
|
|
2036
|
+
const postPopovercontainerCss = "@layer polyfill{@supports not selector(:popover-open){[popover]:not(.\\:popover-open){display:none}}}.popover{box-shadow:.5px 3px 4px rgba(0,0,0,.1),2px 4px 10px 4px rgba(0,0,0,.12);position:fixed;z-index:1060;width:max-content;margin:0;padding:0;box-sizing:border-box;color:var(--post-contrast-color);background-color:rgb(var(--post-bg-rgb));border:2px solid rgba(0,0,0,0);border-radius:4px;overflow:visible}.arrow{position:absolute;width:.5825rem;height:.5825rem;background-color:inherit;rotate:45deg;pointer-events:none;z-index:-1}.arrow.top{border-left:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}.arrow.right{border-right:2px solid rgba(0,0,0,0);border-top:2px solid rgba(0,0,0,0)}.arrow.left{border-left:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}.arrow.bottom{border-right:2px solid rgba(0,0,0,0);border-bottom:2px solid rgba(0,0,0,0)}";
|
|
1838
2037
|
const PostPopovercontainerStyle0 = postPopovercontainerCss;
|
|
1839
2038
|
|
|
1840
2039
|
const SIDE_MAP = {
|
|
@@ -1846,7 +2045,7 @@ const SIDE_MAP = {
|
|
|
1846
2045
|
const PostPopovercontainer = class {
|
|
1847
2046
|
constructor(hostRef) {
|
|
1848
2047
|
index.registerInstance(this, hostRef);
|
|
1849
|
-
this.
|
|
2048
|
+
this.postToggle = index.createEvent(this, "postToggle", 7);
|
|
1850
2049
|
this.placement = 'top';
|
|
1851
2050
|
this.arrow = false;
|
|
1852
2051
|
}
|
|
@@ -1911,7 +2110,7 @@ const PostPopovercontainer = class {
|
|
|
1911
2110
|
if (typeof this.clearAutoUpdate === 'function')
|
|
1912
2111
|
this.clearAutoUpdate();
|
|
1913
2112
|
}
|
|
1914
|
-
this.
|
|
2113
|
+
this.postToggle.emit(isOpen);
|
|
1915
2114
|
}
|
|
1916
2115
|
/**
|
|
1917
2116
|
* Start listening for DOM updates, scroll events etc. that have
|
|
@@ -1970,9 +2169,9 @@ const PostPopovercontainer = class {
|
|
|
1970
2169
|
}
|
|
1971
2170
|
}
|
|
1972
2171
|
render() {
|
|
1973
|
-
return (index.h(index.Host, { key: '
|
|
2172
|
+
return (index.h(index.Host, { key: '1707db71258eef7c95c13d738561d9d55df540fc', "data-version": _package.version }, index.h("div", { key: 'd1d89bfc31529c803b04f2395509fe96b38d7d7a', class: "popover", part: "popover", ref: (el) => (this.popoverRef = el) }, this.arrow && (index.h("span", { key: 'd85fc5f68be0ff8060b3be823e22744873395775', class: "arrow", ref: el => {
|
|
1974
2173
|
this.arrowRef = el;
|
|
1975
|
-
} })), index.h("slot", { key: '
|
|
2174
|
+
} })), index.h("slot", { key: '7bd455d61d270b9d6cdc132ffb7a00f0259164e7' }))));
|
|
1976
2175
|
}
|
|
1977
2176
|
get host() { return index.getElement(this); }
|
|
1978
2177
|
};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postPopovercontainer = require('./post-popovercontainer-
|
|
6
|
-
require('./index-
|
|
7
|
-
require('./package-
|
|
5
|
+
const postPopovercontainer = require('./post-popovercontainer-5bb6a804.js');
|
|
6
|
+
require('./index-de783b23.js');
|
|
7
|
+
require('./package-dacf5ec2.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-de783b23.js');
|
|
4
|
+
const _package = require('./package-dacf5ec2.js');
|
|
5
|
+
|
|
6
|
+
const postRatingCss = "/*!\n * Bootstrap Utilities v5.1.3 (https://getbootstrap.com/)\n * Copyright 2011-2021 The Bootstrap Authors\n * Copyright 2011-2021 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n\n * The MIT License (MIT)\n\n * Copyright (c) 2011-2020 Twitter, Inc.\n * Copyright (c) 2011-2020 The Bootstrap Authors\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *//*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:inline-block}.rating{display:flex;flex-wrap:wrap;overflow:hidden;margin:0 -0.25rem;border-radius:4px}.rating .star{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:#fff;position:relative;width:2rem;height:2rem;cursor:pointer}.rating .star .stroke,.rating .star .fill{display:block;width:100%;height:100%;transition:all ease 100ms}.rating .star .stroke{position:absolute;inset:auto;z-index:1;color:var(--post-rating-star-stroke)}.rating .star .fill{margin:1px;width:calc(100% - 2px);height:calc(100% - 2px);color:var(--post-rating-star-fill)}.rating .star.before-hover{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:#fc0}.rating .star.active{--post-rating-star-stroke:hsl(0, 0%, 20%);--post-rating-star-fill:#fc0}.rating .star.hover{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:#fc0}.rating .star.after-active{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:hsl(0, 0%, 80%)}.rating :focus{outline:none}.rating:focus-visible{outline-offset:2px;outline:2px solid #1976c8}.rating[aria-readonly=true] .star,.rating[aria-disabled=true] .star{cursor:default}.rating[aria-disabled=true] .star{--post-rating-star-stroke:hsl(0, 0%, 60%);--post-rating-star-fill:#fff}.rating[aria-disabled=true] .star.active{cursor:default;--post-rating-star-stroke:hsl(0, 0%, 60%);--post-rating-star-fill:hsl(0, 0%, 90%)}";
|
|
7
|
+
const PostRatingStyle0 = postRatingCss;
|
|
8
|
+
|
|
9
|
+
const PostRating = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.postInput = index.createEvent(this, "postInput", 7);
|
|
13
|
+
this.postChange = index.createEvent(this, "postChange", 7);
|
|
14
|
+
this.hasChanged = false;
|
|
15
|
+
this.hoveredIndex = undefined;
|
|
16
|
+
this.label = 'Rating';
|
|
17
|
+
this.stars = 5;
|
|
18
|
+
this.currentRating = 0;
|
|
19
|
+
this.readonly = false;
|
|
20
|
+
this.keydownHandler = this.keydownHandler.bind(this);
|
|
21
|
+
this.blurHandler = this.blurHandler.bind(this);
|
|
22
|
+
this.hoverHandler = this.hoverHandler.bind(this);
|
|
23
|
+
}
|
|
24
|
+
update(value) {
|
|
25
|
+
if (this.readonly || value < 0 || value > this.stars)
|
|
26
|
+
return;
|
|
27
|
+
this.currentRating = this.currentRating !== value ? value : 0; // If a star is clicked the second time, the rating gets set to 0.
|
|
28
|
+
this.postInput.emit({ value: this.currentRating });
|
|
29
|
+
this.hasChanged = true;
|
|
30
|
+
}
|
|
31
|
+
keydownHandler(e) {
|
|
32
|
+
switch (e.key) {
|
|
33
|
+
case 'ArrowDown':
|
|
34
|
+
case 'ArrowLeft':
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
this.update(this.currentRating - 1);
|
|
37
|
+
break;
|
|
38
|
+
case 'ArrowUp':
|
|
39
|
+
case 'ArrowRight':
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
this.update(this.currentRating + 1);
|
|
42
|
+
break;
|
|
43
|
+
case 'Home':
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
this.update(0);
|
|
46
|
+
break;
|
|
47
|
+
case 'End':
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
this.update(this.stars);
|
|
50
|
+
break;
|
|
51
|
+
case 'Enter':
|
|
52
|
+
case ' ':
|
|
53
|
+
this.blurHandler();
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
blurHandler() {
|
|
60
|
+
if (this.hasChanged) {
|
|
61
|
+
this.postChange.emit({ value: this.currentRating });
|
|
62
|
+
this.hasChanged = false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
hoverHandler(index, e) {
|
|
66
|
+
if (this.readonly)
|
|
67
|
+
return;
|
|
68
|
+
if (e.type === 'mouseenter') {
|
|
69
|
+
this.hoveredIndex = index;
|
|
70
|
+
}
|
|
71
|
+
else if (e.type === 'mouseleave') {
|
|
72
|
+
this.hoveredIndex = undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
render() {
|
|
76
|
+
return (index.h(index.Host, { key: '64081561d0b0819ed5fbe31c0bc7974b996ec582', "data-version": _package.version }, index.h("div", { key: 'eaed95cef70f1dfa815a77e3d630ac933d2c1eff', role: "slider", class: "rating", tabindex: "0", "aria-label": this.label, "aria-valuemin": "0", "aria-valuemax": this.stars, "aria-valuenow": this.currentRating, "aria-valuetext": `${this.currentRating} out of ${this.stars}`, "aria-readonly": this.readonly ? 'true' : 'false', onKeyDown: this.keydownHandler, onBlur: this.blurHandler }, Array.from({ length: this.stars }).map((v, i) => (index.h("div", { key: `star-${v}`, "aria-hidden": "true", class: {
|
|
77
|
+
'star': true,
|
|
78
|
+
'before-hover': i < this.hoveredIndex,
|
|
79
|
+
'active': i < Math.round(this.currentRating),
|
|
80
|
+
'hover': i === this.hoveredIndex,
|
|
81
|
+
'after-active': i > this.hoveredIndex && i < this.currentRating,
|
|
82
|
+
}, onClick: () => this.update(i + 1), onMouseEnter: e => this.hoverHandler(i, e), onMouseLeave: e => this.hoverHandler(i, e) }, index.h("post-icon", { name: "2062", class: "stroke" }), index.h("post-icon", { name: "2574", class: "fill" })))))));
|
|
83
|
+
}
|
|
84
|
+
get host() { return index.getElement(this); }
|
|
85
|
+
};
|
|
86
|
+
PostRating.style = PostRatingStyle0;
|
|
87
|
+
|
|
88
|
+
exports.PostRating = PostRating;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postRating = require('./post-rating-
|
|
6
|
-
require('./index-
|
|
7
|
-
require('./package-
|
|
5
|
+
const postRating = require('./post-rating-d2845096.js');
|
|
6
|
+
require('./index-de783b23.js');
|
|
7
|
+
require('./package-dacf5ec2.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-de783b23.js');
|
|
4
|
+
const _package = require('./package-dacf5ec2.js');
|
|
5
|
+
const checkNonEmpty = require('./check-non-empty-eeaa8f77.js');
|
|
6
|
+
|
|
7
|
+
const postTabHeaderCss = ".tab-title[role=tab]{display:inline-block;cursor:pointer;position:relative;box-sizing:border-box;padding:1rem;transition:background-color 100ms;border-right:1px solid rgba(0,0,0,0);border-left:1px solid rgba(0,0,0,0);outline-color:currentColor;opacity:.7;color:var(--post-contrast-color);text-decoration:none;background-color:var(--post-contrast-color-inverted)}.tab-title[role=tab]:focus{background-color:unset;color:var(--post-contrast-color)}.tab-title[role=tab]:hover{opacity:1;background-color:rgba(var(--post-contrast-color-rgb), 0.6);color:var(--post-contrast-color-inverted)}.tab-title[role=tab]:focus-visible{outline:rgba(0,0,0,0);opacity:1;background-color:rgba(var(--post-contrast-color-rgb), 0.6);color:var(--post-contrast-color-inverted);box-shadow:none}.tab-title[role=tab]:focus-visible::after{content:\"\";display:block;position:absolute;top:2px;right:1px;bottom:0;left:1px;box-shadow:0 0 0 1px #fff,0 0 0 2px #333}.tab-title[role=tab].active{z-index:1;border-right-color:#ccc;border-left-color:#ccc;opacity:1;background-color:var(--post-contrast-color-inverted);color:var(--post-contrast-color);font-weight:700}.tab-title[role=tab].active::before{content:\"\";display:block;position:absolute;top:0;right:-1px;left:-1px;height:.25rem;background-color:#fc0}:is(.bg-dark,.bg-black,.bg-primary,.bg-secondary,.bg-success,.bg-error,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright,.alert-primary,post-alert[type=primary],.alert-success,post-alert[type=success],.alert-danger,post-alert[type=danger],.alert-notification,post-alert[type=notification],.alert-error,post-alert[type=error]) .tab-title[role=tab]:hover{background-color:rgba(255,255,255,.2)}:is(.bg-dark,.bg-black,.bg-primary,.bg-secondary,.bg-success,.bg-error,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright,.alert-primary,post-alert[type=primary],.alert-success,post-alert[type=success],.alert-danger,post-alert[type=danger],.alert-notification,post-alert[type=notification],.alert-error,post-alert[type=error]) .tab-title[role=tab]:focus-visible{background-color:rgba(255,255,255,.2)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.tab-title[role=tab]{opacity:1;border-left-color:Canvas;border-right-color:Canvas;color:LinkText}.tab-title[role=tab]:hover,.tab-title[role=tab]:focus,.tab-title[role=tab]:focus-within,.tab-title[role=tab]:focus-visible{outline:2px solid Highlight;outline-offset:-0.25rem}.tab-title[role=tab].active{border-left-color:ButtonText;border-right-color:ButtonText;color:Highlight}.tab-title[role=tab].active::before{background-color:Highlight}}.bg-yellow .tab-title{background-color:#fc0}.bg-yellow .tab-title.active{background-color:#fc0}.bg-yellow .nav-item{background-color:#fc0}.bg-white .tab-title{background-color:#fff}.bg-white .tab-title.active{background-color:#fff}.bg-white .nav-item{background-color:#fff}.bg-light .tab-title{background-color:#faf9f8}.bg-light .tab-title.active{background-color:#faf9f8}.bg-light .nav-item{background-color:#faf9f8}.bg-gray .tab-title{background-color:#f4f3f1}.bg-gray .tab-title.active{background-color:#f4f3f1}.bg-gray .nav-item{background-color:#f4f3f1}.bg-dark .tab-title{background-color:#333}.bg-dark .tab-title.active{background-color:#333}.bg-dark .nav-item{background-color:#333}.bg-black .tab-title{background-color:#000}.bg-black .tab-title.active{background-color:#000}.bg-black .nav-item{background-color:#000}.bg-primary .tab-title{background-color:#333}.bg-primary .tab-title.active{background-color:#333}.bg-primary .nav-item{background-color:#333}.bg-secondary .tab-title{background-color:#666}.bg-secondary .tab-title.active{background-color:#666}.bg-secondary .nav-item{background-color:#666}.bg-success .tab-title{background-color:#2c871d}.bg-success .tab-title.active{background-color:#2c871d}.bg-success .nav-item{background-color:#2c871d}.bg-warning .tab-title{background-color:#f49e00}.bg-warning .tab-title.active{background-color:#f49e00}.bg-warning .nav-item{background-color:#f49e00}.bg-error .tab-title{background-color:#a51728}.bg-error .tab-title.active{background-color:#a51728}.bg-error .nav-item{background-color:#a51728}.bg-info .tab-title{background-color:#cce4ee}.bg-info .tab-title.active{background-color:#cce4ee}.bg-info .nav-item{background-color:#cce4ee}.bg-success-background .tab-title{background-color:#c0debb}.bg-success-background .tab-title.active{background-color:#c0debb}.bg-success-background .nav-item{background-color:#c0debb}.bg-warning-background .tab-title{background-color:#fce2b2}.bg-warning-background .tab-title.active{background-color:#fce2b2}.bg-warning-background .nav-item{background-color:#fce2b2}.bg-error-background .tab-title{background-color:#ffdade}.bg-error-background .tab-title.active{background-color:#ffdade}.bg-error-background .nav-item{background-color:#ffdade}.bg-nightblue .tab-title{background-color:#004976}.bg-nightblue .tab-title.active{background-color:#004976}.bg-nightblue .nav-item{background-color:#004976}.bg-nightblue-bright .tab-title{background-color:#0076a8}.bg-nightblue-bright .tab-title.active{background-color:#0076a8}.bg-nightblue-bright .nav-item{background-color:#0076a8}.bg-petrol .tab-title{background-color:#006d68}.bg-petrol .tab-title.active{background-color:#006d68}.bg-petrol .nav-item{background-color:#006d68}.bg-petrol-bright .tab-title{background-color:#00968f}.bg-petrol-bright .tab-title.active{background-color:#00968f}.bg-petrol-bright .nav-item{background-color:#00968f}.bg-coral .tab-title{background-color:#9e2a2f}.bg-coral .tab-title.active{background-color:#9e2a2f}.bg-coral .nav-item{background-color:#9e2a2f}.bg-coral-bright .tab-title{background-color:#e03c31}.bg-coral-bright .tab-title.active{background-color:#e03c31}.bg-coral-bright .nav-item{background-color:#e03c31}.bg-olive .tab-title{background-color:#716135}.bg-olive .tab-title.active{background-color:#716135}.bg-olive .nav-item{background-color:#716135}.bg-olive-bright .tab-title{background-color:#aa9d2e}.bg-olive-bright .tab-title.active{background-color:#aa9d2e}.bg-olive-bright .nav-item{background-color:#aa9d2e}.bg-purple .tab-title{background-color:#80276c}.bg-purple .tab-title.active{background-color:#80276c}.bg-purple .nav-item{background-color:#80276c}.bg-purple-bright .tab-title{background-color:#c5299b}.bg-purple-bright .tab-title.active{background-color:#c5299b}.bg-purple-bright .nav-item{background-color:#c5299b}.bg-aubergine .tab-title{background-color:#523178}.bg-aubergine .tab-title.active{background-color:#523178}.bg-aubergine .nav-item{background-color:#523178}.bg-aubergine-bright .tab-title{background-color:#7566a0}.bg-aubergine-bright .tab-title.active{background-color:#7566a0}.bg-aubergine-bright .nav-item{background-color:#7566a0}[class*=bg-] .tab-title.active:focus::after{background-color:rgba(255,255,255,.2)}@supports selector(*:focus-visible){[class*=bg-] .tab-title.active:focus::after{background-color:unset}[class*=bg-] .tab-title.active:focus-visible::after{background-color:rgba(255,255,255,.2)}}/*!\n * Bootstrap Utilities v5.1.3 (https://getbootstrap.com/)\n * Copyright 2011-2021 The Bootstrap Authors\n * Copyright 2011-2021 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n\n * The MIT License (MIT)\n\n * Copyright (c) 2011-2020 Twitter, Inc.\n * Copyright (c) 2011-2020 The Bootstrap Authors\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *//*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}.tab-title{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button}";
|
|
8
|
+
const PostTabHeaderStyle0 = postTabHeaderCss;
|
|
9
|
+
|
|
10
|
+
const PostTabHeader = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.tabId = undefined;
|
|
14
|
+
this.panel = undefined;
|
|
15
|
+
}
|
|
16
|
+
validateFor(newValue) {
|
|
17
|
+
checkNonEmpty.checkNonEmpty(newValue, 'The "panel" prop is required for the post-tab-header.');
|
|
18
|
+
}
|
|
19
|
+
componentWillLoad() {
|
|
20
|
+
this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return (index.h(index.Host, { key: 'eb6ac6a67f4cbf571d38f1de1c8d428a9dea5a53', id: this.tabId, role: "tab", "data-version": _package.version, "aria-selected": "false", tabindex: "-1", class: "tab-title" }, index.h("slot", { key: 'd6559dbcc76ecc8d253fcd4a115b4bc4f78fd496' })));
|
|
24
|
+
}
|
|
25
|
+
get host() { return index.getElement(this); }
|
|
26
|
+
static get watchers() { return {
|
|
27
|
+
"panel": ["validateFor"]
|
|
28
|
+
}; }
|
|
29
|
+
};
|
|
30
|
+
PostTabHeader.style = PostTabHeaderStyle0;
|
|
31
|
+
|
|
32
|
+
exports.PostTabHeader = PostTabHeader;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postTabHeader = require('./post-tab-header-
|
|
6
|
-
require('./index-
|
|
7
|
-
require('./package-
|
|
5
|
+
const postTabHeader = require('./post-tab-header-6496a51b.js');
|
|
6
|
+
require('./index-de783b23.js');
|
|
7
|
+
require('./package-dacf5ec2.js');
|
|
8
8
|
require('./check-non-empty-eeaa8f77.js');
|
|
9
9
|
require('./constants-238701d3.js');
|
|
10
10
|
|