@proximus/lavender-light 1.4.4-beta.1 → 1.4.5-alpha.2
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.
|
@@ -3356,19 +3356,19 @@ let Paragraph = _Paragraph;
|
|
|
3356
3356
|
if (!customElements.get("px-p")) {
|
|
3357
3357
|
customElements.define("px-p", Paragraph);
|
|
3358
3358
|
}
|
|
3359
|
-
const styles$3 =
|
|
3359
|
+
const styles$3 = '*{box-sizing:border-box}#container{display:flex;flex-wrap:nowrap;font-family:var(--px-font-family);font-size:var(--px-font-size-base);color:var(--px-color-text-neutral-default);width:inherit;border-radius:var(--px-radius-main);background-color:var(--px-color-background-surface-default);overflow:hidden}#container.info{border-left:5px var(--px-color-icon-brand-default) solid}#container.success{border-left:5px var(--px-color-icon-purpose-success-default) solid}#container.warning{border-left:5px var(--px-color-icon-purpose-warning-default) solid}#container.error{border-left:5px var(--px-color-icon-purpose-error-default) solid}#container.has-close-button #icon-container{max-width:calc(100% - (var(--px-size-m) + var(--px-spacing-s-mobile)))}#content-container{padding:var(--px-padding-m-mobile);flex-grow:1}#media-container{display:none}::slotted(px-button-icon[slot="close-button"]){position:absolute;top:var(--px-padding-m-mobile);right:var(--px-padding-m-mobile)}dialog{background:transparent;border-radius:0;box-shadow:none;padding:0;border:0;box-sizing:border-box;transform:scale(.95);animation:modalIn .3s ease-out forwards}::backdrop{background:#0000004d;-webkit-backdrop-filter:saturate(180%) blur(15px);backdrop-filter:saturate(180%) blur(15px)}#content{max-height:12.5em;overflow:auto}@media only screen and (min-width: 48em){#container.has-close-button #icon-container{max-width:calc(100% - (var(--px-size-m) + var(--px-spacing-s-tablet)))}::slotted(px-button-icon[slot="close-button"]){position:absolute;top:var(--px-padding-m-tablet);right:var(--px-padding-m-tablet)}#content{max-height:25em}}@media only screen and (min-width: 64.0625em){#container.has-close-button #icon-container{max-width:calc(100% - (var(--px-size-m) + var(--px-spacing-s-laptop)))}::slotted(px-button-icon[slot="close-button"]){top:var(--px-padding-m-laptop);right:var(--px-padding-m-laptop)}:host([media-src]) #container.has-close-button #icon-container{max-width:100%}:host([media-src]) #media-container{display:block;background-size:cover;background-position:center center;background-repeat:no-repeat;flex-basis:25em;flex-shrink:0}}@media screen and (min-width: 1118px){#container{width:1080px}}@media only screen and (min-width: 90.0625em){:host(:not([media-src])) #container.has-close-button #icon-container{max-width:calc(100% - (var(--px-size-m) + var(--px-spacing-s-desktop)))}::slotted(px-button-icon[slot="close-button"]){position:absolute;top:var(--px-padding-m-desktop);right:var(--px-padding-m-desktop)}}@keyframes modalIn{0%{transform:scale(.95);opacity:0}to{transform:scale(1);opacity:1}}';
|
|
3360
3360
|
const styleSheet$1 = new CSSStyleSheet();
|
|
3361
3361
|
styleSheet$1.replaceSync(styles$3);
|
|
3362
3362
|
const CLOSE_EVENT = "px.lavender.modal.close";
|
|
3363
3363
|
class Modal extends HTMLElement {
|
|
3364
3364
|
constructor() {
|
|
3365
3365
|
super();
|
|
3366
|
-
this.template =
|
|
3366
|
+
this.template = `<dialog>
|
|
3367
3367
|
<div id="container">
|
|
3368
3368
|
<div id="content-container">
|
|
3369
3369
|
<px-vstack gap="default" >
|
|
3370
3370
|
<px-hstack id="icon-container" gap="s" align-items="flex-start">
|
|
3371
|
-
<px-vstack gap="
|
|
3371
|
+
<px-vstack gap="xs">
|
|
3372
3372
|
<px-h1 variant="title-l">
|
|
3373
3373
|
<slot name="title"></slot>
|
|
3374
3374
|
</px-h1>
|
|
@@ -3403,6 +3403,9 @@ class Modal extends HTMLElement {
|
|
|
3403
3403
|
this.shadowRoot.adoptedStyleSheets = [styleSheet$1];
|
|
3404
3404
|
}
|
|
3405
3405
|
connectedCallback() {
|
|
3406
|
+
var _a, _b;
|
|
3407
|
+
this.toggleDescriptionVisibility = this.toggleDescriptionVisibility.bind(this);
|
|
3408
|
+
this.toggleCloseButtonSafeArea = this.toggleCloseButtonSafeArea.bind(this);
|
|
3406
3409
|
if (this.hasAttribute("open")) {
|
|
3407
3410
|
this.show();
|
|
3408
3411
|
}
|
|
@@ -3420,6 +3423,16 @@ class Modal extends HTMLElement {
|
|
|
3420
3423
|
if (this.hasAttribute("media-src")) {
|
|
3421
3424
|
this.updateMediaSrc(this.getAttribute("media-src"));
|
|
3422
3425
|
}
|
|
3426
|
+
this.toggleDescriptionVisibility();
|
|
3427
|
+
(_a = this.$slotDescription) == null ? void 0 : _a.addEventListener(
|
|
3428
|
+
"slotchange",
|
|
3429
|
+
this.toggleDescriptionVisibility
|
|
3430
|
+
);
|
|
3431
|
+
this.toggleCloseButtonSafeArea();
|
|
3432
|
+
(_b = this.$slotCloseButton) == null ? void 0 : _b.addEventListener(
|
|
3433
|
+
"slotchange",
|
|
3434
|
+
this.toggleCloseButtonSafeArea
|
|
3435
|
+
);
|
|
3423
3436
|
}
|
|
3424
3437
|
static get observedAttributes() {
|
|
3425
3438
|
return ["open", "status", "media-src", "openedby"];
|
|
@@ -3440,6 +3453,13 @@ class Modal extends HTMLElement {
|
|
|
3440
3453
|
break;
|
|
3441
3454
|
}
|
|
3442
3455
|
}
|
|
3456
|
+
disconnectedCallback() {
|
|
3457
|
+
var _a;
|
|
3458
|
+
(_a = this.$slotDescription) == null ? void 0 : _a.removeEventListener(
|
|
3459
|
+
"slotchange",
|
|
3460
|
+
this.toggleDescriptionVisibility
|
|
3461
|
+
);
|
|
3462
|
+
}
|
|
3443
3463
|
handleOpenChange() {
|
|
3444
3464
|
if (this.hasAttribute("open")) {
|
|
3445
3465
|
this.show();
|
|
@@ -3508,6 +3528,44 @@ class Modal extends HTMLElement {
|
|
|
3508
3528
|
(_c = this.$opener) == null ? void 0 : _c.addEventListener("click", () => this.show());
|
|
3509
3529
|
}
|
|
3510
3530
|
}
|
|
3531
|
+
toggleDescriptionVisibility() {
|
|
3532
|
+
if (!this.$slottedDescription) {
|
|
3533
|
+
this.$descriptionContainer.style.display = "none";
|
|
3534
|
+
} else {
|
|
3535
|
+
this.$descriptionContainer.style.display = "block";
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
toggleCloseButtonSafeArea() {
|
|
3539
|
+
var _a, _b, _c;
|
|
3540
|
+
if (this.$slottedCloseButton) {
|
|
3541
|
+
(_a = this.$container) == null ? void 0 : _a.classList.add("has-close-button");
|
|
3542
|
+
} else {
|
|
3543
|
+
if ((_b = this.$container) == null ? void 0 : _b.classList.contains("has-close-button")) {
|
|
3544
|
+
(_c = this.$container) == null ? void 0 : _c.classList.remove("has-close-button");
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
get $slottedCloseButton() {
|
|
3549
|
+
return this.querySelector('[slot="close-button"]');
|
|
3550
|
+
}
|
|
3551
|
+
get $slotCloseButton() {
|
|
3552
|
+
return this.shadowRoot.querySelector(
|
|
3553
|
+
'slot[name="close-button"]'
|
|
3554
|
+
);
|
|
3555
|
+
}
|
|
3556
|
+
get $slottedDescription() {
|
|
3557
|
+
return this.querySelector('[slot="description"]');
|
|
3558
|
+
}
|
|
3559
|
+
get $slotDescription() {
|
|
3560
|
+
return this.shadowRoot.querySelector(
|
|
3561
|
+
'slot[name="description"]'
|
|
3562
|
+
);
|
|
3563
|
+
}
|
|
3564
|
+
get $descriptionContainer() {
|
|
3565
|
+
return this.shadowRoot.querySelector(
|
|
3566
|
+
'px-p[font-weight="title"]'
|
|
3567
|
+
);
|
|
3568
|
+
}
|
|
3511
3569
|
get $opener() {
|
|
3512
3570
|
return document.querySelector(
|
|
3513
3571
|
`px-button#${this.getAttribute("openedby")}`
|
|
@@ -5531,20 +5589,20 @@ const _ContentHeader = class _ContentHeader extends PxElement {
|
|
|
5531
5589
|
}
|
|
5532
5590
|
createGridding(value) {
|
|
5533
5591
|
const breakpoints = [
|
|
5534
|
-
{ prop: "hasGridding",
|
|
5592
|
+
{ prop: "hasGridding", gridAttr: "grid-cols", attr: "col-span" },
|
|
5535
5593
|
{
|
|
5536
5594
|
prop: "hasGriddingMobile",
|
|
5537
|
-
|
|
5595
|
+
gridAttr: "grid-cols--mobile",
|
|
5538
5596
|
attr: "col-span--mobile"
|
|
5539
5597
|
},
|
|
5540
5598
|
{
|
|
5541
5599
|
prop: "hasGriddingTablet",
|
|
5542
|
-
|
|
5600
|
+
gridAttr: "grid-cols--tablet",
|
|
5543
5601
|
attr: "col-span--tablet"
|
|
5544
5602
|
},
|
|
5545
5603
|
{
|
|
5546
5604
|
prop: "hasGriddingLaptop",
|
|
5547
|
-
|
|
5605
|
+
gridAttr: "grid-cols--laptop",
|
|
5548
5606
|
attr: "col-span--laptop"
|
|
5549
5607
|
}
|
|
5550
5608
|
];
|
|
@@ -5552,16 +5610,16 @@ const _ContentHeader = class _ContentHeader extends PxElement {
|
|
|
5552
5610
|
"px-grid > px-container"
|
|
5553
5611
|
);
|
|
5554
5612
|
if (value !== null) {
|
|
5555
|
-
breakpoints.forEach(({ prop,
|
|
5613
|
+
breakpoints.forEach(({ prop, gridAttr, attr }) => {
|
|
5556
5614
|
if (this[prop]) {
|
|
5557
|
-
this.$grid
|
|
5558
|
-
spanElement.setAttribute(attr, "2");
|
|
5615
|
+
this.$grid.setAttribute(gridAttr, "3");
|
|
5616
|
+
spanElement == null ? void 0 : spanElement.setAttribute(attr, "2");
|
|
5559
5617
|
}
|
|
5560
5618
|
});
|
|
5561
5619
|
} else {
|
|
5562
|
-
breakpoints.forEach(({
|
|
5563
|
-
this.$grid
|
|
5564
|
-
spanElement.
|
|
5620
|
+
breakpoints.forEach(({ gridAttr, attr }) => {
|
|
5621
|
+
this.$grid.setAttribute(gridAttr, "1");
|
|
5622
|
+
spanElement == null ? void 0 : spanElement.setAttribute(attr, "1");
|
|
5565
5623
|
});
|
|
5566
5624
|
}
|
|
5567
5625
|
}
|