@proximus/lavender-light 1.4.13-beta.1 → 1.4.13-beta.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.
|
@@ -6344,13 +6344,168 @@ let ContentHeader = _ContentHeader;
|
|
|
6344
6344
|
if (!customElements.get("px-content-header")) {
|
|
6345
6345
|
customElements.define("px-content-header", ContentHeader);
|
|
6346
6346
|
}
|
|
6347
|
+
const buttonIconCss = ".btn-icon{font-size:var(--px-font-size-base);display:inline-flex;width:var(--px-size-l);height:var(--px-size-l);vertical-align:middle;align-items:center;justify-content:center;cursor:pointer;--btn-transition: all .2s ease-in-out 0s;transition:var(--btn-transition);background:var(--px-color-background-container-primary-default);color:var(--px-color-icon-brand-inverted);border-radius:var(--px-radius-pill);padding:var(--px-padding-xs-mobile);border:var(--px-size-border-m) solid transparent}.btn-icon,.btn-icon *{box-sizing:border-box}.btn-icon ::slotted(px-icon){line-height:0}.btn-icon:hover:not([disabled],[aria-disabled=true],.btn-icon--state-loading){background:var(--px-color-background-state-hover-bordered-default);color:var(--px-color-icon-brand-default);border-color:var(--px-color-border-state-hover-default)}.btn-icon:active:not([disabled],[aria-disabled=true],.btn-icon--state-loading){background:var(--px-color-background-state-active-inverted);color:var(--px-color-icon-state-active-default);border-color:var(--px-color-border-state-active-default)}.btn-icon:focus-visible:not([disabled],[aria-disabled=true]){outline-offset:var(--px-focus-offset-mobile);outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default)}.btn-icon[disabled],.btn-icon[aria-disabled=true]{background:var(--px-color-background-state-disabled-default);color:var(--px-color-icon-state-disabled-default);cursor:default;pointer-events:none}.btn-icon.btn-icon--state-loading{background:var(--px-color-background-state-disabled-default);color:var(--px-color-icon-brand-default);cursor:inherit}.btn-icon--size-small{padding:var(--px-padding-2xs-mobile);width:var(--px-size-m);height:var(--px-size-m)}.btn-icon--variant-secondary{background-color:var(--px-color-background-container-secondary-default);color:var(--px-color-icon-brand-default)}.btn-icon--variant-naked{background-color:transparent;color:var(--px-color-icon-brand-default);width:auto;height:auto}:host([inverted]) .btn-icon{background:var(--px-color-background-container-primary-inverted);color:var(--px-color-icon-brand-default)}:host([inverted]) .btn-icon:hover:not([disabled],[aria-disabled=true],.btn-icon--state-loading){background:var(--px-color-background-state-hover-bordered-inverted);color:var(--px-color-icon-brand-inverted);border-color:var(--px-color-border-state-hover-inverted)}:host([inverted]) .btn-icon:active:not([disabled],[aria-disabled=true],.btn-icon--state-loading){background:var(--px-color-background-state-hover-default);color:var(--px-color-icon-state-active-inverted);border-color:var(--px-color-border-state-active-inverted)}:host([inverted]) .btn-icon:focus-visible:not([disabled],[aria-disabled=true]){outline-color:var(--px-color-border-focus-outline-inverted)}:host([inverted]) .btn-icon[disabled],:host([inverted]) .btn-icon[aria-disabled=true]{background:var(--px-color-background-state-disabled-inverted);color:var(--px-color-icon-state-disabled-inverted)}:host([inverted]) .btn-icon.btn-icon--state-loading{background:var(--px-color-background-state-disabled-inverted);color:var(--px-color-icon-brand-inverted);border-color:transparent}:host([inverted]) .btn-icon.btn-icon--variant-naked{background-color:transparent;color:var(--px-color-icon-brand-inverted)}:host([inverted]) .btn-icon--variant-secondary{background-color:var(--px-color-background-container-secondary-inverted);color:var(--px-color-icon-brand-inverted)}@media screen and (min-width: 48rem){.btn-icon{padding:var(--px-padding-xs-desktop)}.btn-icon:focus-visible:not([disabled],[aria-disabled=true]){outline-offset:var(--px-focus-offset-desktop);outline-width:var(--px-focus-outline-desktop)}.btn-icon--size-small{padding:var(--px-padding-2xs-desktop)}}@media screen and (min-width: 64.0625rem){.btn-icon{padding:var(--px-padding-xs-desktop)}.btn-icon:focus-visible:not([disabled],[aria-disabled=true]){outline-offset:var(--px-focus-offset-desktop);outline-width:var(--px-focus-outline-desktop)}.btn-icon--size-small{padding:var(--px-padding-2xs-desktop)}}";
|
|
6348
|
+
const buttonIconStyles = new CSSStyleSheet();
|
|
6349
|
+
buttonIconStyles.replaceSync(buttonIconCss);
|
|
6350
|
+
const buttonIconSizeValues = ["", "default", "small"];
|
|
6351
|
+
const buttonIconVariantValues = [
|
|
6352
|
+
"",
|
|
6353
|
+
"default",
|
|
6354
|
+
"secondary",
|
|
6355
|
+
"naked"
|
|
6356
|
+
];
|
|
6357
|
+
const _ButtonIcon = class _ButtonIcon extends PxElement {
|
|
6358
|
+
constructor() {
|
|
6359
|
+
super(buttonIconStyles);
|
|
6360
|
+
this.template = () => `<slot></slot>`;
|
|
6361
|
+
const $root = document.createElement(_ButtonIcon.nativeName);
|
|
6362
|
+
$root.classList.add("btn-icon");
|
|
6363
|
+
$root.innerHTML = this.template();
|
|
6364
|
+
this.shadowRoot.appendChild($root);
|
|
6365
|
+
}
|
|
6366
|
+
static get observedAttributes() {
|
|
6367
|
+
return [
|
|
6368
|
+
...super.observedAttributes,
|
|
6369
|
+
...accessibilityAttributes,
|
|
6370
|
+
"inverted",
|
|
6371
|
+
"loading",
|
|
6372
|
+
"size",
|
|
6373
|
+
"variant",
|
|
6374
|
+
"aria-expanded"
|
|
6375
|
+
];
|
|
6376
|
+
}
|
|
6377
|
+
connectedCallback() {
|
|
6378
|
+
const icon = this.querySelector("px-icon");
|
|
6379
|
+
if (icon) {
|
|
6380
|
+
const iconSize = icon.getAttribute("size");
|
|
6381
|
+
const iconColor = icon.getAttribute("color");
|
|
6382
|
+
icon.addEventListener("click", () => {
|
|
6383
|
+
this.$el.focus();
|
|
6384
|
+
});
|
|
6385
|
+
if (!iconSize) {
|
|
6386
|
+
icon.setAttribute("size", "s");
|
|
6387
|
+
}
|
|
6388
|
+
if (this.size === "small") {
|
|
6389
|
+
icon.setAttribute("size", "xs");
|
|
6390
|
+
}
|
|
6391
|
+
if (!iconColor) {
|
|
6392
|
+
icon.setAttribute("color", "inherit");
|
|
6393
|
+
}
|
|
6394
|
+
}
|
|
6395
|
+
}
|
|
6396
|
+
attributeChangedCallback(attrName, oldValue, newValue) {
|
|
6397
|
+
if (oldValue !== newValue) {
|
|
6398
|
+
switch (attrName) {
|
|
6399
|
+
case "loading":
|
|
6400
|
+
this.updateLoading();
|
|
6401
|
+
break;
|
|
6402
|
+
case "size":
|
|
6403
|
+
this.updateSize(oldValue, newValue);
|
|
6404
|
+
break;
|
|
6405
|
+
case "variant":
|
|
6406
|
+
this.updateVariant(oldValue, newValue);
|
|
6407
|
+
break;
|
|
6408
|
+
case "aria-expanded":
|
|
6409
|
+
if (newValue) {
|
|
6410
|
+
this.$el.setAttribute("aria-expanded", newValue);
|
|
6411
|
+
this.removeAttribute("aria-expanded");
|
|
6412
|
+
}
|
|
6413
|
+
break;
|
|
6414
|
+
default:
|
|
6415
|
+
super.attributeChangedCallback(attrName, oldValue, newValue);
|
|
6416
|
+
break;
|
|
6417
|
+
}
|
|
6418
|
+
}
|
|
6419
|
+
}
|
|
6420
|
+
_toggleClass(oldValue, newValue) {
|
|
6421
|
+
if (oldValue !== null && oldValue !== "" && oldValue !== "default") {
|
|
6422
|
+
this.$el.classList.toggle(oldValue);
|
|
6423
|
+
}
|
|
6424
|
+
if (newValue !== null && newValue !== "" && newValue !== "default") {
|
|
6425
|
+
this.$el.classList.toggle(newValue);
|
|
6426
|
+
}
|
|
6427
|
+
}
|
|
6428
|
+
updateLoading() {
|
|
6429
|
+
this.$el.classList.toggle(`btn-icon--state-loading`);
|
|
6430
|
+
}
|
|
6431
|
+
updateSize(oldValue, newValue) {
|
|
6432
|
+
if (!this.checkName(buttonIconSizeValues, newValue)) {
|
|
6433
|
+
log(
|
|
6434
|
+
`"${newValue}" is not a valid size value for ${this.tagName.toLowerCase()}. Allowed values are: "${buttonIconSizeValues.join('", "')}".`
|
|
6435
|
+
);
|
|
6436
|
+
} else {
|
|
6437
|
+
if (oldValue !== null && oldValue !== "" && oldValue !== "default") {
|
|
6438
|
+
this.$el.classList.toggle(`btn-icon--size-${oldValue}`);
|
|
6439
|
+
}
|
|
6440
|
+
if (newValue !== null && newValue !== "" && newValue !== "default") {
|
|
6441
|
+
this.$el.classList.toggle(`btn-icon--size-${newValue}`);
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
}
|
|
6445
|
+
updateVariant(oldValue, newValue) {
|
|
6446
|
+
if (!this.checkName(buttonIconVariantValues, newValue)) {
|
|
6447
|
+
log(
|
|
6448
|
+
`"${newValue}" is not a valid variant value for ${this.tagName.toLowerCase()}. Allowed values are: "${buttonIconVariantValues.join('", "')}".`
|
|
6449
|
+
);
|
|
6450
|
+
} else {
|
|
6451
|
+
if (oldValue !== null && oldValue !== "" && oldValue !== "default") {
|
|
6452
|
+
this.$el.classList.toggle(`btn-icon--variant-${oldValue}`);
|
|
6453
|
+
}
|
|
6454
|
+
if (newValue !== null && newValue !== "" && newValue !== "default") {
|
|
6455
|
+
this.$el.classList.toggle(`btn-icon--variant-${newValue}`);
|
|
6456
|
+
}
|
|
6457
|
+
}
|
|
6458
|
+
}
|
|
6459
|
+
get inverted() {
|
|
6460
|
+
return this.getAttribute("inverted");
|
|
6461
|
+
}
|
|
6462
|
+
set inverted(value) {
|
|
6463
|
+
this.setAttribute("inverted", value);
|
|
6464
|
+
}
|
|
6465
|
+
get loading() {
|
|
6466
|
+
return this.getAttribute("loading");
|
|
6467
|
+
}
|
|
6468
|
+
set loading(value) {
|
|
6469
|
+
this.setAttribute("loading", value);
|
|
6470
|
+
}
|
|
6471
|
+
get size() {
|
|
6472
|
+
return this.getAttribute("size");
|
|
6473
|
+
}
|
|
6474
|
+
set size(value) {
|
|
6475
|
+
this.setAttribute("size", value);
|
|
6476
|
+
}
|
|
6477
|
+
get variant() {
|
|
6478
|
+
return this.getAttribute("variant");
|
|
6479
|
+
}
|
|
6480
|
+
set variant(value) {
|
|
6481
|
+
this.setAttribute("variant", value);
|
|
6482
|
+
}
|
|
6483
|
+
get ariaExpanded() {
|
|
6484
|
+
return this.getAttribute("aria-expanded");
|
|
6485
|
+
}
|
|
6486
|
+
set ariaExpanded(value) {
|
|
6487
|
+
if (value) {
|
|
6488
|
+
this.setAttribute("aria-expanded", value);
|
|
6489
|
+
} else {
|
|
6490
|
+
this.removeAttribute("aria-expanded");
|
|
6491
|
+
}
|
|
6492
|
+
}
|
|
6493
|
+
};
|
|
6494
|
+
_ButtonIcon.nativeName = "button";
|
|
6495
|
+
let ButtonIcon = _ButtonIcon;
|
|
6496
|
+
if (!customElements.get("px-button-icon")) {
|
|
6497
|
+
customElements.define("px-button-icon", ButtonIcon);
|
|
6498
|
+
}
|
|
6347
6499
|
export {
|
|
6500
|
+
ButtonIcon,
|
|
6348
6501
|
ContentHeader,
|
|
6349
6502
|
Grid,
|
|
6350
6503
|
Header,
|
|
6351
6504
|
HeaderItem,
|
|
6352
6505
|
Modal,
|
|
6353
6506
|
Typography,
|
|
6507
|
+
buttonIconSizeValues,
|
|
6508
|
+
buttonIconVariantValues,
|
|
6354
6509
|
contentAlignmentValues,
|
|
6355
6510
|
gridColsValues,
|
|
6356
6511
|
itemsAlignmentValues,
|