@proximus/lavender 1.4.9-alpha.7 → 1.4.9-alpha.9

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.
@@ -14195,6 +14195,7 @@ class SelectableBoxCheckbox extends WithExtraAttributes {
14195
14195
  this.internals.role = "checkbox";
14196
14196
  }
14197
14197
  this.tabIndex = 0;
14198
+ this.ariaChecked = "false";
14198
14199
  this.toggleFooterVisibility();
14199
14200
  this.$slotFooter.addEventListener(
14200
14201
  "slotchange",
@@ -14465,6 +14466,7 @@ class SelectableBoxRadio extends WithExtraAttributes {
14465
14466
  this.internals.role = "radio";
14466
14467
  }
14467
14468
  this.tabIndex = ((_a = this.parentElement) == null ? void 0 : _a.querySelector("px-selectable-box-radio")) === this ? 0 : -1;
14469
+ this.ariaChecked = "false";
14468
14470
  this.toggleFooterVisibility();
14469
14471
  this.$slotFooter.addEventListener(
14470
14472
  "slotchange",
@@ -15323,7 +15325,7 @@ class StickyContainer extends HTMLElement {
15323
15325
  if (!customElements.get("px-sticky-container")) {
15324
15326
  customElements.define("px-sticky-container", StickyContainer);
15325
15327
  }
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)}.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)}}';
15328
+ 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
15329
  const switchStyles = new CSSStyleSheet();
15328
15330
  switchStyles.replaceSync(switchCss);
15329
15331
  var InputState = /* @__PURE__ */ ((InputState2) => {
@@ -15335,50 +15337,51 @@ const _Switch = class _Switch extends PxElement {
15335
15337
  constructor() {
15336
15338
  var _a;
15337
15339
  super(switchStyles);
15338
- this.template = () => `<div class="switch" tabindex="0" role="switch">
15339
- <input type="checkbox" tabindex="-1"/>
15340
+ this.template = () => `<div class="switch">
15341
+ <input type="checkbox" tabindex="-1" inert/>
15340
15342
  <label></label>
15341
15343
  </div>`;
15342
15344
  this.shadowRoot.innerHTML = this.template();
15343
15345
  this.internals = (_a = this.attachInternals) == null ? void 0 : _a.call(this);
15346
+ this.role = "switch";
15344
15347
  }
15345
15348
  static get observedAttributes() {
15346
15349
  return [...super.observedAttributes, "inverted", "hover"];
15347
15350
  }
15348
15351
  connectedCallback() {
15349
- this.$el.addEventListener("change", () => {
15352
+ const toggle = () => {
15350
15353
  var _a;
15351
- this.checked = this.$el.checked;
15352
- const customEvent = new Event("change", {
15353
- bubbles: true,
15354
- composed: true
15355
- // Allow the event to pass through shadow DOM boundaries
15356
- });
15357
- this.dispatchEvent(customEvent);
15358
- (_a = this.internals) == null ? void 0 : _a.setFormValue(this.formData());
15359
- });
15354
+ if (!this.disabled) {
15355
+ this.checked = !this.checked;
15356
+ this.dispatchEvent(
15357
+ new Event("change", { bubbles: true, composed: true })
15358
+ );
15359
+ (_a = this.internals) == null ? void 0 : _a.setFormValue(this.formData());
15360
+ }
15361
+ };
15362
+ this.addEventListener("click", toggle);
15360
15363
  this.addEventListener("keypress", (e) => {
15361
15364
  if (e.code === "Space" || e.code === "Enter") {
15362
- this.$el.click();
15365
+ toggle();
15363
15366
  }
15364
15367
  });
15365
- this.setupForId();
15368
+ this.tabIndex = 0;
15366
15369
  if (this.hasAttribute("checked")) {
15367
15370
  this.checked = true;
15368
15371
  }
15369
- this.$switch.ariaChecked = `${this.checked}`;
15372
+ this.ariaChecked = `${this.checked}`;
15370
15373
  }
15371
15374
  attributeChangedCallback(attrName, oldValue, newValue) {
15372
15375
  if (oldValue !== newValue) {
15373
15376
  switch (attrName) {
15374
15377
  case "checked":
15375
15378
  this.$el.checked = newValue !== null;
15376
- this.$switch.ariaChecked = `${this.$el.checked}`;
15379
+ this.ariaChecked = `${this.$el.checked}`;
15377
15380
  break;
15378
15381
  case "disabled":
15379
15382
  this.$el.disabled = newValue !== null;
15380
- this.$switch.ariaDisabled = `${this.$el.disabled}`;
15381
- this.$switch.tabIndex = this.$el.disabled ? -1 : 0;
15383
+ this.ariaDisabled = `${this.$el.disabled}`;
15384
+ this.tabIndex = this.$el.disabled ? -1 : 0;
15382
15385
  break;
15383
15386
  case "hover":
15384
15387
  this.$el.classList.toggle("hover");
@@ -15410,12 +15413,6 @@ const _Switch = class _Switch extends PxElement {
15410
15413
  setupForId() {
15411
15414
  const id = Math.random().toString(36).substr(2, 9);
15412
15415
  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
15416
  }
15420
15417
  get $switch() {
15421
15418
  return this.shadowRoot.querySelector(".switch");
@@ -15436,7 +15433,7 @@ const _Switch = class _Switch extends PxElement {
15436
15433
  } else {
15437
15434
  this.removeAttribute("checked");
15438
15435
  }
15439
- this.$switch.ariaChecked = `${value}`;
15436
+ this.ariaChecked = `${value}`;
15440
15437
  }
15441
15438
  set disabled(value) {
15442
15439
  this.$el.disabled = value;
@@ -15445,7 +15442,8 @@ const _Switch = class _Switch extends PxElement {
15445
15442
  } else {
15446
15443
  this.removeAttribute("disabled");
15447
15444
  }
15448
- this.$switch.ariaDisabled = `${value}`;
15445
+ this.ariaDisabled = `${value}`;
15446
+ this.tabIndex = value ? -1 : 0;
15449
15447
  }
15450
15448
  get disabled() {
15451
15449
  return this.$el.disabled;