@proximus/lavender 2.0.0-alpha.80 → 2.0.0-alpha.81

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.
@@ -15365,7 +15365,7 @@ class StickyContainer extends HTMLElement {
15365
15365
  if (!customElements.get("px-sticky-container")) {
15366
15366
  customElements.define("px-sticky-container", StickyContainer);
15367
15367
  }
15368
- const switchCss = ':host{display:inline-flex}.switch *{box-sizing:border-box}.switch{display:inline-flex;align-items:center;border-radius:var(--px-radius-pill)}.switch:focus-visible{outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default);outline-offset:var(--px-focus-offset-mobile)}.switch:has(input[inverted]):focus-visible{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)}}';
15368
+ 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)}}';
15369
15369
  const switchStyles = new CSSStyleSheet();
15370
15370
  switchStyles.replaceSync(switchCss);
15371
15371
  var InputState = /* @__PURE__ */ ((InputState2) => {
@@ -15377,50 +15377,51 @@ const _Switch = class _Switch extends PxElement {
15377
15377
  constructor() {
15378
15378
  var _a;
15379
15379
  super(switchStyles);
15380
- this.template = () => `<div class="switch" tabindex="0" role="switch">
15381
- <input type="checkbox" tabindex="-1"/>
15380
+ this.template = () => `<div class="switch">
15381
+ <input type="checkbox" tabindex="-1" inert/>
15382
15382
  <label></label>
15383
15383
  </div>`;
15384
15384
  this.shadowRoot.innerHTML = this.template();
15385
15385
  this.internals = (_a = this.attachInternals) == null ? void 0 : _a.call(this);
15386
+ this.role = "switch";
15386
15387
  }
15387
15388
  static get observedAttributes() {
15388
15389
  return [...super.observedAttributes, "inverted", "hover"];
15389
15390
  }
15390
15391
  connectedCallback() {
15391
- this.$el.addEventListener("change", () => {
15392
+ const toggle = () => {
15392
15393
  var _a;
15393
- this.checked = this.$el.checked;
15394
- const customEvent = new Event("change", {
15395
- bubbles: true,
15396
- composed: true
15397
- // Allow the event to pass through shadow DOM boundaries
15398
- });
15399
- this.dispatchEvent(customEvent);
15400
- (_a = this.internals) == null ? void 0 : _a.setFormValue(this.formData());
15401
- });
15394
+ if (!this.disabled) {
15395
+ this.checked = !this.checked;
15396
+ this.dispatchEvent(
15397
+ new Event("change", { bubbles: true, composed: true })
15398
+ );
15399
+ (_a = this.internals) == null ? void 0 : _a.setFormValue(this.formData());
15400
+ }
15401
+ };
15402
+ this.addEventListener("click", toggle);
15402
15403
  this.addEventListener("keypress", (e) => {
15403
15404
  if (e.code === "Space" || e.code === "Enter") {
15404
- this.$el.click();
15405
+ toggle();
15405
15406
  }
15406
15407
  });
15407
- this.setupForId();
15408
+ this.tabIndex = 0;
15408
15409
  if (this.hasAttribute("checked")) {
15409
15410
  this.checked = true;
15410
15411
  }
15411
- this.$switch.ariaChecked = `${this.checked}`;
15412
+ this.ariaChecked = `${this.checked}`;
15412
15413
  }
15413
15414
  attributeChangedCallback(attrName, oldValue, newValue) {
15414
15415
  if (oldValue !== newValue) {
15415
15416
  switch (attrName) {
15416
15417
  case "checked":
15417
15418
  this.$el.checked = newValue !== null;
15418
- this.$switch.ariaChecked = `${this.$el.checked}`;
15419
+ this.ariaChecked = `${this.$el.checked}`;
15419
15420
  break;
15420
15421
  case "disabled":
15421
15422
  this.$el.disabled = newValue !== null;
15422
- this.$switch.ariaDisabled = `${this.$el.disabled}`;
15423
- this.$switch.tabIndex = this.$el.disabled ? -1 : 0;
15423
+ this.ariaDisabled = `${this.$el.disabled}`;
15424
+ this.tabIndex = this.$el.disabled ? -1 : 0;
15424
15425
  break;
15425
15426
  case "hover":
15426
15427
  this.$el.classList.toggle("hover");
@@ -15452,12 +15453,6 @@ const _Switch = class _Switch extends PxElement {
15452
15453
  setupForId() {
15453
15454
  const id = Math.random().toString(36).substr(2, 9);
15454
15455
  this.$el.setAttribute("id", id);
15455
- if (this.$label) {
15456
- this.$label.setAttribute("for", id);
15457
- }
15458
- }
15459
- get $label() {
15460
- return this.shadowRoot.querySelector("label");
15461
15456
  }
15462
15457
  get $switch() {
15463
15458
  return this.shadowRoot.querySelector(".switch");
@@ -15478,7 +15473,7 @@ const _Switch = class _Switch extends PxElement {
15478
15473
  } else {
15479
15474
  this.removeAttribute("checked");
15480
15475
  }
15481
- this.$switch.ariaChecked = `${value}`;
15476
+ this.ariaChecked = `${value}`;
15482
15477
  }
15483
15478
  set disabled(value) {
15484
15479
  this.$el.disabled = value;
@@ -15487,7 +15482,8 @@ const _Switch = class _Switch extends PxElement {
15487
15482
  } else {
15488
15483
  this.removeAttribute("disabled");
15489
15484
  }
15490
- this.$switch.ariaDisabled = `${value}`;
15485
+ this.ariaDisabled = `${value}`;
15486
+ this.tabIndex = value ? -1 : 0;
15491
15487
  }
15492
15488
  get disabled() {
15493
15489
  return this.$el.disabled;