@proximus/lavender 1.4.9-alpha.7 → 1.4.9-alpha.8
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/dist/lavender.cjs.js +1 -1
- package/dist/lavender.es.js +23 -27
- package/dist/lavender.umd.js +1 -1
- package/package.json +1 -1
package/dist/lavender.es.js
CHANGED
|
@@ -15323,7 +15323,7 @@ class StickyContainer extends HTMLElement {
|
|
|
15323
15323
|
if (!customElements.get("px-sticky-container")) {
|
|
15324
15324
|
customElements.define("px-sticky-container", StickyContainer);
|
|
15325
15325
|
}
|
|
15326
|
-
const switchCss = ':host{display:inline-flex}.switch *{box-sizing:border-box}.switch{display:inline-flex;align-items:center;border-radius:var(--px-radius-pill)}
|
|
15326
|
+
const switchCss = ':host{display:inline-flex}.switch *{box-sizing:border-box}.switch{display:inline-flex;align-items:center;border-radius:var(--px-radius-pill)}:host(:focus-visible){outline:none}:host(:focus-visible) .switch{outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default);outline-offset:var(--px-focus-offset-mobile)}:host([inverted]:focus-visible) .switch{outline-color:var(--px-color-border-focus-outline-inverted)}label{display:flex;flex-shrink:0;padding:var(--px-padding-3xs-mobile);border-radius:var(--px-radius-pill);background-color:var(--px-color-background-container-strong-default);outline:var(--px-size-border-m) solid var(--px-color-border-none-default);width:var(--px-size-action-input-switch-width);height:calc(var(--px-size-icon-m) + (var(--px-padding-3xs-mobile) * 2));position:relative}label:after{content:"";position:absolute;top:50%;left:var(--px-padding-3xs-mobile);width:var(--px-size-icon-m);max-width:var(--px-size-icon-m);height:var(--px-size-icon-m);border-radius:var(--px-radius-pill);background-color:var(--px-color-background-container-light-default);transform:translateY(-50%);transition:transform .2s ease-in-out}:host input{-webkit-appearance:none;-moz-appearance:none;appearance:none;margin:0}:host(:not([disabled])):host(:hover) label,:host(:not([disabled])):host([hover]) label{outline-color:var(--px-color-border-neutral-default);cursor:pointer}:host([checked]) label{background-color:var(--px-color-background-purpose-success-default);transition:background-color .2s ease-in-out}:host([checked]) label:after{transform:translateY(-50%) translate(calc(var(--px-size-icon-m) - var(--px-padding-3xs-mobile)));transition:transform .2s ease-in-out}:host(:hover) :is(:host(:not([disabled])) :is(:host([checked]) label)),:host([hover]) :is(:host(:not([disabled])) :is(:host([checked]) label)){outline-color:var(--px-color-border-purpose-success-default)}:host([disabled]) label{background-color:var(--px-color-background-state-disabled-default)}:host([disabled]) label:after{background-color:var(--px-color-background-state-disabled-default)}:host([inverted]) label{background-color:var(--px-color-background-container-strong-inverted)}:host(:hover) :is(:host(:not([disabled])) :is(:host([inverted]) label)),:host([hover]) :is(:host(:not([disabled])) :is(:host([inverted]) label)){outline-color:var(--px-color-border-neutral-inverted)}:host([checked]:not([disabled])) :is(:host([inverted]) label){background-color:var(--px-color-background-purpose-success-inverted)}:host(:hover) :is(:host([checked]:not([disabled])) :is(:host([inverted]) label)),:host([hover]) :is(:host([checked]:not([disabled])) :is(:host([inverted]) label)){outline-color:var(--px-color-border-purpose-success-inverted)}:host([disabled]) :is(:host([inverted]) label){background-color:var(--px-color-background-state-disabled-inverted)}:host([disabled]) :is(:host([inverted]) label):after{background-color:var(--px-color-background-state-disabled-inverted)}@media only screen and (min-width: 48em){label{padding:var(--px-padding-3xs-desktop)}}@media only screen and (min-width: 64.0625em){label{padding:var(--px-padding-3xs-desktop)}}';
|
|
15327
15327
|
const switchStyles = new CSSStyleSheet();
|
|
15328
15328
|
switchStyles.replaceSync(switchCss);
|
|
15329
15329
|
var InputState = /* @__PURE__ */ ((InputState2) => {
|
|
@@ -15335,50 +15335,51 @@ const _Switch = class _Switch extends PxElement {
|
|
|
15335
15335
|
constructor() {
|
|
15336
15336
|
var _a;
|
|
15337
15337
|
super(switchStyles);
|
|
15338
|
-
this.template = () => `<div class="switch"
|
|
15339
|
-
<input type="checkbox" tabindex="-1"/>
|
|
15338
|
+
this.template = () => `<div class="switch">
|
|
15339
|
+
<input type="checkbox" tabindex="-1" inert/>
|
|
15340
15340
|
<label></label>
|
|
15341
15341
|
</div>`;
|
|
15342
15342
|
this.shadowRoot.innerHTML = this.template();
|
|
15343
15343
|
this.internals = (_a = this.attachInternals) == null ? void 0 : _a.call(this);
|
|
15344
|
+
this.role = "switch";
|
|
15344
15345
|
}
|
|
15345
15346
|
static get observedAttributes() {
|
|
15346
15347
|
return [...super.observedAttributes, "inverted", "hover"];
|
|
15347
15348
|
}
|
|
15348
15349
|
connectedCallback() {
|
|
15349
|
-
|
|
15350
|
+
const toggle = () => {
|
|
15350
15351
|
var _a;
|
|
15351
|
-
this.
|
|
15352
|
-
|
|
15353
|
-
|
|
15354
|
-
|
|
15355
|
-
|
|
15356
|
-
|
|
15357
|
-
|
|
15358
|
-
|
|
15359
|
-
|
|
15352
|
+
if (!this.disabled) {
|
|
15353
|
+
this.checked = !this.checked;
|
|
15354
|
+
this.dispatchEvent(
|
|
15355
|
+
new Event("change", { bubbles: true, composed: true })
|
|
15356
|
+
);
|
|
15357
|
+
(_a = this.internals) == null ? void 0 : _a.setFormValue(this.formData());
|
|
15358
|
+
}
|
|
15359
|
+
};
|
|
15360
|
+
this.addEventListener("click", toggle);
|
|
15360
15361
|
this.addEventListener("keypress", (e) => {
|
|
15361
15362
|
if (e.code === "Space" || e.code === "Enter") {
|
|
15362
|
-
|
|
15363
|
+
toggle();
|
|
15363
15364
|
}
|
|
15364
15365
|
});
|
|
15365
|
-
this.
|
|
15366
|
+
this.tabIndex = 0;
|
|
15366
15367
|
if (this.hasAttribute("checked")) {
|
|
15367
15368
|
this.checked = true;
|
|
15368
15369
|
}
|
|
15369
|
-
this
|
|
15370
|
+
this.ariaChecked = `${this.checked}`;
|
|
15370
15371
|
}
|
|
15371
15372
|
attributeChangedCallback(attrName, oldValue, newValue) {
|
|
15372
15373
|
if (oldValue !== newValue) {
|
|
15373
15374
|
switch (attrName) {
|
|
15374
15375
|
case "checked":
|
|
15375
15376
|
this.$el.checked = newValue !== null;
|
|
15376
|
-
this
|
|
15377
|
+
this.ariaChecked = `${this.$el.checked}`;
|
|
15377
15378
|
break;
|
|
15378
15379
|
case "disabled":
|
|
15379
15380
|
this.$el.disabled = newValue !== null;
|
|
15380
|
-
this
|
|
15381
|
-
this
|
|
15381
|
+
this.ariaDisabled = `${this.$el.disabled}`;
|
|
15382
|
+
this.tabIndex = this.$el.disabled ? -1 : 0;
|
|
15382
15383
|
break;
|
|
15383
15384
|
case "hover":
|
|
15384
15385
|
this.$el.classList.toggle("hover");
|
|
@@ -15410,12 +15411,6 @@ const _Switch = class _Switch extends PxElement {
|
|
|
15410
15411
|
setupForId() {
|
|
15411
15412
|
const id = Math.random().toString(36).substr(2, 9);
|
|
15412
15413
|
this.$el.setAttribute("id", id);
|
|
15413
|
-
if (this.$label) {
|
|
15414
|
-
this.$label.setAttribute("for", id);
|
|
15415
|
-
}
|
|
15416
|
-
}
|
|
15417
|
-
get $label() {
|
|
15418
|
-
return this.shadowRoot.querySelector("label");
|
|
15419
15414
|
}
|
|
15420
15415
|
get $switch() {
|
|
15421
15416
|
return this.shadowRoot.querySelector(".switch");
|
|
@@ -15436,7 +15431,7 @@ const _Switch = class _Switch extends PxElement {
|
|
|
15436
15431
|
} else {
|
|
15437
15432
|
this.removeAttribute("checked");
|
|
15438
15433
|
}
|
|
15439
|
-
this
|
|
15434
|
+
this.ariaChecked = `${value}`;
|
|
15440
15435
|
}
|
|
15441
15436
|
set disabled(value) {
|
|
15442
15437
|
this.$el.disabled = value;
|
|
@@ -15445,7 +15440,8 @@ const _Switch = class _Switch extends PxElement {
|
|
|
15445
15440
|
} else {
|
|
15446
15441
|
this.removeAttribute("disabled");
|
|
15447
15442
|
}
|
|
15448
|
-
this
|
|
15443
|
+
this.ariaDisabled = `${value}`;
|
|
15444
|
+
this.tabIndex = value ? -1 : 0;
|
|
15449
15445
|
}
|
|
15450
15446
|
get disabled() {
|
|
15451
15447
|
return this.$el.disabled;
|