@proximus/lavender-selectablebox 2.0.0-alpha.2 → 2.0.0-alpha.21

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.
@@ -3,7 +3,6 @@ import '@proximus/lavender-layout';
3
3
  export declare class SelectableBox extends WithExtraAttributes {
4
4
  protected template(): string;
5
5
  constructor();
6
- connectedCallback(): void;
7
6
  static get observedAttributes(): string[];
8
7
  attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
9
8
  get $el(): HTMLElement;
@@ -1,7 +1,7 @@
1
1
  import { WithExtraAttributes } from '@proximus/lavender-common';
2
2
  import '@proximus/lavender-layout';
3
3
  import { SelectableBox } from './SelectableBox';
4
- import { type RadioBase } from '@proximus/lavender-radio-group';
4
+ import { type Radio } from '@proximus/lavender-radio-group';
5
5
  export declare class SelectableBoxRadio extends WithExtraAttributes {
6
6
  protected internals: ElementInternals;
7
7
  protected template(): string;
@@ -23,7 +23,7 @@ export declare class SelectableBoxRadio extends WithExtraAttributes {
23
23
  formData(): FormData;
24
24
  get $el(): HTMLElement;
25
25
  get $selectableBox(): SelectableBox;
26
- get $radio(): RadioBase;
26
+ get $radio(): Radio;
27
27
  get $slotFooter(): HTMLSlotElement;
28
28
  get $slottedFooter(): HTMLElement;
29
29
  get inverted(): boolean;
package/dist/index.es.js CHANGED
@@ -1,14 +1,14 @@
1
- import { WithExtraAttributes as n, AttributeBreakpointHandlerDelegate as f, gapValues as v, checkName as m, backgroundColorValues as k } from "@proximus/lavender-common";
1
+ import { WithExtraAttributes as n, AttributeBreakpointHandlerDelegate as v, gapValues as m, checkName as k, log as h, backgroundColorValues as y } from "@proximus/lavender-common";
2
2
  const A = ':host{display:block}:host([overflow-x="auto"]){margin:calc(calc(var(--px-focus-outline-mobile) + var(--px-focus-offset-mobile)) * -1)}:host([overflow-x="auto"]) .flex-container{padding:calc(var(--px-focus-outline-mobile) + var(--px-focus-offset-mobile))}.flex-container{display:flex;height:100%;width:100%;box-sizing:border-box;flex-direction:var(--flex-direction--mobile-value);gap:var(--flex-gap--mobile-value);flex-wrap:var(--flex-wrap--mobile-value);justify-content:var(--flex-justify-content--mobile-value);align-items:var(--flex-align-items--mobile-value);overflow-x:var(--overflow-x-all)}@media only screen and (max-width: 47.9375em){.flex-container{overflow-x:var(--overflow-x-all-mobile, var(--overflow-x-all));scrollbar-width:none}.flex-container::-webkit-scrollbar{display:none}}@media only screen and (min-width: 48em){.flex-container{flex-direction:var(--flex-direction--tablet-value);gap:var(--flex-gap--tablet-value);flex-wrap:var(--flex-wrap--tablet-value);justify-content:var(--flex-justify-content--tablet-value);align-items:var(--flex-align-items--tablet-value)}:host([overflow-x="auto"]){margin:calc(calc(var(--px-focus-outline-tablet) + var(--px-focus-offset-tablet)) * -1)}:host([overflow-x="auto"]) .flex-container{padding:calc(var(--px-focus-outline-tablet) + var(--px-focus-offset-tablet))}}@media only screen and (min-width: 48em) and (max-width: 64em){.flex-container{overflow-x:var(--overflow-x-all-tablet, var(--overflow-x-all));scrollbar-width:none}.flex-container::-webkit-scrollbar{display:none}}@media only screen and (min-width: 64.0625em){.flex-container{flex-direction:var(--flex-direction--laptop-value);gap:var(--flex-gap--laptop-value);flex-wrap:var(--flex-wrap--laptop-value);justify-content:var(--flex-justify-content--laptop-value);align-items:var(--flex-align-items--laptop-value)}:host([overflow-x="auto"]){margin:calc(calc(var(--px-focus-outline-laptop) + var(--px-focus-offset-laptop)) * -1)}:host([overflow-x="auto"]) .flex-container{padding:calc(var(--px-focus-outline-laptop) + var(--px-focus-offset-laptop))}}@media only screen and (min-width: 64.0625em) and (max-width: 90em){.flex-container{overflow-x:var(--overflow-x-all-laptop, var(--overflow-x-all))}}@media only screen and (min-width: 90.0625em){.flex-container{flex-direction:var(--flex-direction--desktop-value);gap:var(--flex-gap--desktop-value);flex-wrap:var(--flex-wrap--desktop-value);justify-content:var(--flex-justify-content--desktop-value);align-items:var(--flex-align-items--desktop-value);overflow-x:var(--overflow-x-all-desktop, var(--overflow-x-all))}:host([overflow-x="auto"]){margin:calc(calc(var(--px-focus-outline-desktop) + var(--px-focus-offset-desktop)) * -1)}:host([overflow-x="auto"]) .flex-container{padding:calc(var(--px-focus-outline-desktop) + var(--px-focus-offset-desktop))}}', b = new CSSStyleSheet();
3
3
  b.replaceSync(A);
4
- const y = [
4
+ const w = [
5
5
  "",
6
6
  "default",
7
7
  "row",
8
8
  "row-reverse",
9
9
  "column",
10
10
  "column-reverse"
11
- ], w = [
11
+ ], C = [
12
12
  "",
13
13
  "default",
14
14
  "stretch",
@@ -25,10 +25,10 @@ const y = [
25
25
  "space-between",
26
26
  "space-around",
27
27
  "space-evenly"
28
- ], C = ["", "default", "nowrap", "wrap", "wrap-reverse"], S = ["", "visible", "hidden", "scroll", "auto"];
28
+ ], S = ["", "default", "nowrap", "wrap", "wrap-reverse"], _ = ["", "visible", "hidden", "scroll", "auto"];
29
29
  class c extends n {
30
30
  constructor() {
31
- super(b), this.overflowXAttributeDelegate = new f(
31
+ super(b), this.overflowXAttributeDelegate = new v(
32
32
  this,
33
33
  "overflow-x",
34
34
  (t) => t,
@@ -82,7 +82,7 @@ class c extends n {
82
82
  case "gap--tablet":
83
83
  case "gap--laptop":
84
84
  case "gap--desktop":
85
- this.updateFlexProperties(t, e, i, v);
85
+ this.updateFlexProperties(t, e, i, m);
86
86
  break;
87
87
  case "justify-content":
88
88
  case "justify-content--mobile":
@@ -101,28 +101,28 @@ class c extends n {
101
101
  case "align-items--tablet":
102
102
  case "align-items--laptop":
103
103
  case "align-items--desktop":
104
- this.updateFlexProperties(t, e, i, w);
104
+ this.updateFlexProperties(t, e, i, C);
105
105
  break;
106
106
  case "wrap":
107
107
  case "wrap--mobile":
108
108
  case "wrap--tablet":
109
109
  case "wrap--laptop":
110
110
  case "wrap--desktop":
111
- this.updateFlexProperties(t, e, i, C);
111
+ this.updateFlexProperties(t, e, i, S);
112
112
  break;
113
113
  case "direction":
114
114
  case "direction--mobile":
115
115
  case "direction--tablet":
116
116
  case "direction--laptop":
117
117
  case "direction--desktop":
118
- this.updateFlexProperties(t, e, i, y);
118
+ this.updateFlexProperties(t, e, i, w);
119
119
  break;
120
120
  case "overflow-x":
121
121
  case "overflow-x--mobile":
122
122
  case "overflow-x--tablet":
123
123
  case "overflow-x--laptop":
124
124
  case "overflow-x--desktop":
125
- this.updateOverflowX(t, e, i, S);
125
+ this.updateOverflowX(t, e, i, _);
126
126
  break;
127
127
  default:
128
128
  super.attributeChangedCallback(t, e, i);
@@ -130,8 +130,10 @@ class c extends n {
130
130
  }
131
131
  }
132
132
  updateOverflowX(t, e, i, o) {
133
- if (!m(o, i)) {
134
- console.error(`${i} is not an allowed ${t} value`);
133
+ if (!k(o, i)) {
134
+ h(
135
+ `${i} is not an allowed ${t} value for ${this.tagName.toLowerCase()}`
136
+ );
135
137
  return;
136
138
  }
137
139
  this.overflowXAttributeDelegate.attributeChangedCallback(
@@ -141,7 +143,9 @@ class c extends n {
141
143
  );
142
144
  }
143
145
  updateFlexProperties(t, e, i, o) {
144
- this.checkName(o, i) || console.error(`${i} is not a valid value for ${o}`);
146
+ this.checkName(o, i) || h(
147
+ `${i} is not an allowed ${t} value for ${this.tagName.toLowerCase()}`
148
+ );
145
149
  const d = t.indexOf("--") > -1, s = d ? t.split("--")[0] : t, a = [];
146
150
  if (!d)
147
151
  this.getAttribute(s + "--mobile") || a.push("mobile"), this.getAttribute(s + "--tablet") || a.push("tablet"), this.getAttribute(s + "--laptop") || a.push("laptop"), this.getAttribute(s + "--desktop") || a.push("desktop"), a.forEach((l) => {
@@ -346,7 +350,7 @@ class c extends n {
346
350
  }
347
351
  }
348
352
  customElements.get("px-stack") || customElements.define("px-stack", c);
349
- class _ extends c {
353
+ class E extends c {
350
354
  constructor() {
351
355
  super();
352
356
  }
@@ -354,8 +358,8 @@ class _ extends c {
354
358
  super.connectedCallback(), this.direction = "column", this.directionMobile = "column", this.directionTablet = "column", this.directionLaptop = "column", this.directionDesktop = "column";
355
359
  }
356
360
  }
357
- customElements.get("px-vstack") || customElements.define("px-vstack", _);
358
- class E extends c {
361
+ customElements.get("px-vstack") || customElements.define("px-vstack", E);
362
+ class z extends c {
359
363
  constructor() {
360
364
  super();
361
365
  }
@@ -363,19 +367,25 @@ class E extends c {
363
367
  super.connectedCallback(), this.direction = "row", this.directionMobile = "row", this.directionTablet = "row", this.directionLaptop = "row", this.directionDesktop = "row";
364
368
  }
365
369
  }
366
- customElements.get("px-hstack") || customElements.define("px-hstack", E);
370
+ customElements.get("px-hstack") || customElements.define("px-hstack", z);
367
371
  class L extends HTMLElement {
368
372
  constructor() {
369
- super();
373
+ super(), this.isZeroSized = !1, this.growValue = "1", this.isVertical = !1;
370
374
  }
371
375
  static get observedAttributes() {
372
- return ["grow"];
376
+ return ["grow", "nogap"];
373
377
  }
374
378
  attributeChangedCallback(t, e, i) {
375
- t === "grow" && (this.style.flexGrow = i);
379
+ t === "grow" && (this.growValue = i || "1", this.isZeroSized || (this.style.flexGrow = this.growValue), this.scheduleRecheck());
376
380
  }
377
381
  connectedCallback() {
378
- this.style.flexGrow = this.getAttribute("grow") || "1";
382
+ this.growValue = this.getAttribute("grow") || "1", this.style.flexGrow = this.growValue, this.nogap && (this.resizeObserver = new ResizeObserver(() => {
383
+ this.handleSizeChange();
384
+ }), this.isVertical = this.parentElement.localName === "px-vstack" || this.parentElement.style.flexDirection === "column", this.resizeObserver.observe(this), this.scheduleRecheck());
385
+ }
386
+ disconnectedCallback() {
387
+ var t;
388
+ (t = this.resizeObserver) == null || t.disconnect(), this.recheckHandle && (cancelAnimationFrame(this.recheckHandle), this.recheckHandle = void 0);
379
389
  }
380
390
  get grow() {
381
391
  return this.getAttribute("grow");
@@ -383,13 +393,34 @@ class L extends HTMLElement {
383
393
  set grow(t) {
384
394
  this.setAttribute("grow", t);
385
395
  }
396
+ scheduleRecheck() {
397
+ this.recheckHandle && cancelAnimationFrame(this.recheckHandle), this.recheckHandle = requestAnimationFrame(() => {
398
+ this.recheckHandle = void 0, this.recalculateVisibility();
399
+ });
400
+ }
401
+ recalculateVisibility() {
402
+ this.isConnected && (this.style.display = "", this.style.flexGrow = this.growValue, this.handleSizeChange());
403
+ }
404
+ handleSizeChange() {
405
+ const t = this.getBoundingClientRect(), e = t.width === 0 && !this.isVertical || t.height === 0 && this.isVertical;
406
+ this.isZeroSized !== e && (this.isZeroSized = e, this.updateParticipation());
407
+ }
408
+ updateParticipation() {
409
+ this.isZeroSized ? (this.style.display = "none", this.style.flexGrow = "0") : (this.style.display = "", this.style.flexGrow = this.growValue);
410
+ }
411
+ get nogap() {
412
+ return this.hasAttribute("nogap");
413
+ }
414
+ set nogap(t) {
415
+ t ? this.setAttribute("nogap", "") : this.removeAttribute("nogap");
416
+ }
386
417
  }
387
418
  customElements.get("px-spacer") || customElements.define("px-spacer", L);
388
- const j = ":host{display:block;box-sizing:border-box}slot[name=body-container]{min-height:100vh}#image-sticky-box{margin-top:-2.5em}", h = new CSSStyleSheet();
389
- h.replaceSync(j);
390
- class D extends n {
419
+ const D = ":host{display:block;box-sizing:border-box}slot[name=body-container]{min-height:100vh}#image-sticky-box{margin-top:-2.5em}", p = new CSSStyleSheet();
420
+ p.replaceSync(D);
421
+ class j extends n {
391
422
  constructor() {
392
- super(h), this.template = (t) => `
423
+ super(p), this.template = (t) => `
393
424
  <px-container border-radius="none" padding="none">
394
425
  <px-vstack>
395
426
  <px-container id="header-container" border-radius="none">
@@ -566,7 +597,7 @@ class D extends n {
566
597
  case "background-color":
567
598
  this.$bodyContainer.setAttribute(
568
599
  "background-color",
569
- k.indexOf(i) > 0 ? i : "none"
600
+ y.indexOf(i) > 0 ? i : "none"
570
601
  );
571
602
  break;
572
603
  case "padding-vertical":
@@ -586,10 +617,10 @@ class D extends n {
586
617
  this.$headerContainer.paddingLeft = t, this.$headerContainer.paddingRight = t, this.$bodyContainer.paddingLeft = t, this.$bodyContainer.paddingRight = t, this.$contactContainer.paddingLeft = t, this.$contactContainer.paddingRight = t, this.$footerContainer.paddingLeft = t, this.$footerContainer.paddingRight = t, this.$imageContainer.paddingLeft = t, this.$imageContainer.paddingRight = t;
587
618
  }
588
619
  }
589
- customElements.get("px-page") === void 0 && customElements.define("px-page", D);
590
- const z = ':host{display:block;font-family:var(--px-font-family);font-size:var(--px-font-size-base)}:host *{box-sizing:border-box}.selectable-box{display:flex;flex-direction:column;height:100%}::slotted([slot="media"]){width:100%;height:auto}.info{display:flex;flex-grow:1}.info .info__body{display:flex;flex-direction:column;flex-basis:80%;gap:var(--px-spacing-default-mobile);padding:var(--px-padding-m-mobile);flex-grow:1}.info .info__body .header{display:flex;align-items:center;gap:var(--px-spacing-s-mobile);flex-grow:1}.info .info__body .header .titles{display:flex;flex-direction:column;gap:var(--px-spacing-xs-mobile)}.info .info__body .header .titles ::slotted([slot="title"]){font-size:var(--px-text-size-label-m-mobile);font-weight:var(--px-font-weight-title);line-height:var(--px-line-height-ratio-l);color:var(--px-color-text-neutral-default);flex-grow:1}.info .info__body .header .titles ::slotted([slot="description"]){font-size:var(--px-text-size-label-m-mobile);font-weight:var(--px-font-weight-body);line-height:var(--px-line-height-ratio-l);color:var(--px-color-text-dimmed-default);flex-grow:1}.info .info__body ::slotted([slot="content"]){color:var(--px-color-text-neutral-default)}.info .info__footer{display:flex;align-items:center;padding:var(--px-padding-s-mobile);background:var(--px-color-background-container-default-default);text-align:center}:host([hide-footer]) .info .info__body{flex-basis:auto}:host([hide-footer]) .info__footer{display:none}@media only screen and (min-width: 48em){.info{flex-direction:column}.info .info__body{flex-basis:auto;gap:var(--px-spacing-default-tablet);padding:var(--px-padding-m-tablet)}.info .info__body .header{gap:var(--px-spacing-s-tablet)}.info .info__body .header .titles{gap:var(--px-spacing-xs-tablet)}.info .info__body .header .titles ::slotted([slot="title"]){font-size:var(--px-text-size-label-m-tablet)}.info .info__body .header .titles ::slotted([slot="description"]){font-size:var(--px-text-size-label-m-tablet)}.info .info__footer{justify-content:center;padding:var(--px-padding-s-tablet)}}@media only screen and (min-width: 64.0625em){.info .info__body{gap:var(--px-spacing-default-laptop);padding:var(--px-padding-m-laptop)}.info .info__body .header{gap:var(--px-spacing-s-laptop)}.info .info__body .header .titles{gap:var(--px-spacing-xs-laptop)}.info .info__body .header .titles ::slotted([slot="title"]){font-size:var(--px-text-size-label-m-laptop)}.info .info__body .header .titles ::slotted([slot="description"]){font-size:var(--px-text-size-label-m-laptop)}.info .info__footer{padding:var(--px-padding-s-laptop)}}@media only screen and (min-width: 90.0625em){.info .info__body{gap:var(--px-spacing-default-desktop);padding:var(--px-padding-m-desktop)}.info .info__body .header{gap:var(--px-spacing-s-desktop)}.info .info__body .header .titles{gap:var(--px-spacing-xs-desktop)}.info .info__body .header .titles ::slotted([slot="title"]){font-size:var(--px-text-size-label-m-desktop)}.info .info__body .header .titles ::slotted([slot="description"]){font-size:var(--px-text-size-label-m-desktop)}.info .info__footer{padding:var(--px-padding-s-desktop)}}:host([inverted]) .info .info__body .header .titles ::slotted([slot="title"]){color:var(--px-color-text-neutral-inverted)}:host([inverted]) .info .info__body .header .titles ::slotted([slot="description"]){color:var(--px-color-text-dimmed-inverted)}:host([inverted]) .info .info__body ::slotted([slot="content"]){color:var(--px-color-text-neutral-inverted)}:host([inverted]) .info .info__footer{background:var(--px-color-background-container-default-inverted)}', p = new CSSStyleSheet();
591
- p.replaceSync(z);
592
- class R extends n {
620
+ customElements.get("px-page") === void 0 && customElements.define("px-page", j);
621
+ const R = ':host{display:block;font-family:var(--px-font-family);font-size:var(--px-font-size-base)}:host *{box-sizing:border-box}.selectable-box{display:flex;flex-direction:column;height:100%}::slotted([slot="media"]){width:100%;height:auto}.info{display:flex;flex-grow:1}.info .info__body{display:flex;flex-direction:column;flex-basis:80%;gap:var(--px-spacing-default-mobile);padding:var(--px-padding-m-mobile);flex-grow:1}.info .info__body .header{display:flex;align-items:center;gap:var(--px-spacing-s-mobile)}.info .info__body .header .titles{display:flex;flex-direction:column;gap:var(--px-spacing-xs-mobile)}.info .info__body .header .titles ::slotted([slot="title"]){font-size:var(--px-text-size-label-m-mobile);font-weight:var(--px-font-weight-title);line-height:var(--px-line-height-ratio-l);color:var(--px-color-text-neutral-default);flex-grow:1}.info .info__body .header .titles ::slotted([slot="description"]){font-size:var(--px-text-size-label-m-mobile);font-weight:var(--px-font-weight-body);line-height:var(--px-line-height-ratio-l);color:var(--px-color-text-dimmed-default);flex-grow:1}.info .info__body ::slotted([slot="content"]){color:var(--px-color-text-neutral-default)}.info .info__footer{display:flex;align-items:center;padding:var(--px-padding-s-mobile);background:var(--px-color-background-container-default-default);text-align:center}:host([hide-footer]) .info .info__body{flex-basis:auto}:host([hide-footer]) .info__footer{display:none}@media only screen and (min-width: 48em){.info{flex-direction:column}.info .info__body{flex-basis:auto;gap:var(--px-spacing-default-tablet);padding:var(--px-padding-m-tablet)}.info .info__body .header{gap:var(--px-spacing-s-tablet)}.info .info__body .header .titles{gap:var(--px-spacing-xs-tablet)}.info .info__body .header .titles ::slotted([slot="title"]){font-size:var(--px-text-size-label-m-tablet)}.info .info__body .header .titles ::slotted([slot="description"]){font-size:var(--px-text-size-label-m-tablet)}.info .info__footer{justify-content:center;padding:var(--px-padding-s-tablet)}}@media only screen and (min-width: 64.0625em){.info .info__body{gap:var(--px-spacing-default-laptop);padding:var(--px-padding-m-laptop)}.info .info__body .header{gap:var(--px-spacing-s-laptop)}.info .info__body .header .titles{gap:var(--px-spacing-xs-laptop)}.info .info__body .header .titles ::slotted([slot="title"]){font-size:var(--px-text-size-label-m-laptop)}.info .info__body .header .titles ::slotted([slot="description"]){font-size:var(--px-text-size-label-m-laptop)}.info .info__footer{padding:var(--px-padding-s-laptop)}}@media only screen and (min-width: 90.0625em){.info .info__body{gap:var(--px-spacing-default-desktop);padding:var(--px-padding-m-desktop)}.info .info__body .header{gap:var(--px-spacing-s-desktop)}.info .info__body .header .titles{gap:var(--px-spacing-xs-desktop)}.info .info__body .header .titles ::slotted([slot="title"]){font-size:var(--px-text-size-label-m-desktop)}.info .info__body .header .titles ::slotted([slot="description"]){font-size:var(--px-text-size-label-m-desktop)}.info .info__footer{padding:var(--px-padding-s-desktop)}}:host([inverted]) .info .info__body .header .titles ::slotted([slot="title"]){color:var(--px-color-text-neutral-inverted)}:host([inverted]) .info .info__body .header .titles ::slotted([slot="description"]){color:var(--px-color-text-dimmed-inverted)}:host([inverted]) .info .info__body ::slotted([slot="content"]){color:var(--px-color-text-neutral-inverted)}:host([inverted]) .info .info__footer{background:var(--px-color-background-container-default-inverted)}', u = new CSSStyleSheet();
622
+ u.replaceSync(R);
623
+ class F extends n {
593
624
  template() {
594
625
  return `
595
626
  <div class="selectable-box">
@@ -615,9 +646,7 @@ class R extends n {
615
646
  `;
616
647
  }
617
648
  constructor() {
618
- super(p), this.shadowRoot.innerHTML = this.template();
619
- }
620
- connectedCallback() {
649
+ super(u), this.shadowRoot.innerHTML = this.template();
621
650
  }
622
651
  static get observedAttributes() {
623
652
  return [...super.observedAttributes, "inverted", "hide-footer"];
@@ -646,19 +675,17 @@ class R extends n {
646
675
  t ? this.setAttribute("hide-footer", "") : this.removeAttribute("hide-footer");
647
676
  }
648
677
  }
649
- customElements.get("px-selectable-box") || customElements.define("px-selectable-box", R);
650
- const u = ':host{display:block;outline:none}:host *{box-sizing:border-box}.selectable-box-checkbox,.selectable-box-radio{box-sizing:border-box;height:100%;cursor:default;border-radius:var(--px-radius-main);overflow:hidden;--btn-transition: all .2s ease-in-out 0s;transition:var(--btn-transition);border:var(--px-size-border-m) solid transparent;outline-color:var(--px-color-border-focus-outline-default);outline-width:var(--px-focus-outline-mobile)}.selectable-box-checkbox px-selectable-box,.selectable-box-radio px-selectable-box{height:100%;background-color:var(--px-color-background-container-light-default)}:host(:not([disabled])):host(:hover) .selectable-box-checkbox,:host(:not([disabled])):host(:hover) .selectable-box-radio{border-color:var(--px-color-border-state-hover-default)}:host(:not([disabled])):host(:hover) .selectable-box-checkbox px-selectable-box,:host(:not([disabled])):host(:hover) .selectable-box-radio px-selectable-box{background-color:var( --px-color-background-state-hover-bordered-default )}:host(:not([disabled])):host(:focus-visible) .selectable-box-checkbox,:host(:not([disabled])):host(:focus-visible) .selectable-box-radio{outline-offset:var(--px-focus-offset-mobile);outline-style:solid}:host([checked]) .selectable-box-checkbox,:host([checked]) .selectable-box-radio{border-color:var(--px-color-border-state-active-default)}:host([disabled]) .selectable-box-checkbox,:host([disabled]) .selectable-box-radio{cursor:default;pointer-events:none}:host([disabled]) .selectable-box-checkbox px-selectable-box,:host([disabled]) .selectable-box-radio px-selectable-box{background-color:var(--px-color-background-state-disabled-default)}:host([disabled]) ::slotted([slot="title"]),:host([disabled]) ::slotted([slot="description"]),:host([disabled]) ::slotted([slot="content"]){color:var(--px-color-text-state-disabled-default)}@media only screen and (min-width: 48em){.selectable-box-checkbox,.selectable-box-radio{outline-width:var(--px-focus-outline-tablet)}}@media only screen and (min-width: 64.0625em){.selectable-box-checkbox,.selectable-box-radio{outline-width:var(--px-focus-outline-laptop)}}@media only screen and (min-width: 90.0625em){.selectable-box-checkbox,.selectable-box-radio{outline-width:var(--px-focus-outline-desktop)}}:host([inverted]) .selectable-box-checkbox,:host([inverted]) .selectable-box-radio{outline-color:var(--px-color-border-focus-outline-inverted)}:host([inverted]) .selectable-box-checkbox px-selectable-box,:host([inverted]) .selectable-box-radio px-selectable-box{background-color:var(--px-color-background-container-light-inverted)}:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-checkbox,:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-radio{border-color:var(--px-color-border-state-hover-inverted)}:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-checkbox px-selectable-box,:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-radio px-selectable-box{background-color:var( --px-color-background-state-hover-bordered-inverted )}:host([inverted]):host([checked]) .selectable-box-checkbox,:host([inverted]):host([checked]) .selectable-box-radio{border-color:var(--px-color-border-state-active-inverted)}:host([inverted]):host([disabled]) .selectable-box-checkbox px-selectable-box,:host([inverted]):host([disabled]) .selectable-box-radio px-selectable-box{background-color:var(--px-color-background-state-disabled-inverted)}:host([inverted]):host([disabled]) ::slotted([slot="title"]),:host([inverted]):host([disabled]) ::slotted([slot="description"]),:host([inverted]):host([disabled]) ::slotted([slot="content"]){color:var(--px-color-text-state-disabled-inverted)}', g = new CSSStyleSheet();
651
- g.replaceSync(u);
652
- class F extends n {
678
+ customElements.get("px-selectable-box") || customElements.define("px-selectable-box", F);
679
+ const g = ':host{display:block;outline:none}:host *{box-sizing:border-box}.selectable-box-checkbox,.selectable-box-radio{box-sizing:border-box;height:100%;cursor:pointer;border-radius:var(--px-radius-main);overflow:hidden;--btn-transition: all .2s ease-in-out 0s;transition:var(--btn-transition);border:var(--px-size-border-m) solid var(--px-color-border-main-default);outline-color:var(--px-color-border-focus-outline-default);outline-width:var(--px-focus-outline-mobile)}.selectable-box-checkbox px-selectable-box,.selectable-box-radio px-selectable-box{height:100%;background-color:var(--px-color-background-container-light-default)}:host(:not([disabled])):host(:hover) .selectable-box-checkbox,:host(:not([disabled])):host(:hover) .selectable-box-radio{border-color:var(--px-color-border-state-hover-default)}:host(:not([disabled])):host(:hover) .selectable-box-checkbox px-selectable-box,:host(:not([disabled])):host(:hover) .selectable-box-radio px-selectable-box{background-color:var( --px-color-background-state-hover-bordered-default )}:host(:not([disabled])):host(:focus-visible) .selectable-box-checkbox,:host(:not([disabled])):host(:focus-visible) .selectable-box-radio{outline-offset:var(--px-focus-offset-mobile);outline-style:solid}:host([checked]) .selectable-box-checkbox,:host([checked]) .selectable-box-radio{border-color:var(--px-color-border-state-active-default)}:host([disabled]) .selectable-box-checkbox,:host([disabled]) .selectable-box-radio{cursor:default;pointer-events:none;border-color:transparent}:host([disabled]) .selectable-box-checkbox px-selectable-box,:host([disabled]) .selectable-box-radio px-selectable-box{background-color:var(--px-color-background-state-disabled-default)}:host([disabled]) ::slotted([slot="title"]),:host([disabled]) ::slotted([slot="description"]),:host([disabled]) ::slotted([slot="content"]){color:var(--px-color-text-state-disabled-default)}@media only screen and (min-width: 48em){.selectable-box-checkbox,.selectable-box-radio{outline-width:var(--px-focus-outline-tablet)}}@media only screen and (min-width: 64.0625em){.selectable-box-checkbox,.selectable-box-radio{outline-width:var(--px-focus-outline-laptop)}}@media only screen and (min-width: 90.0625em){.selectable-box-checkbox,.selectable-box-radio{outline-width:var(--px-focus-outline-desktop)}}:host([inverted]) .selectable-box-checkbox,:host([inverted]) .selectable-box-radio{border-color:var(--px-color-border-main-inverted);outline-color:var(--px-color-border-focus-outline-inverted)}:host([inverted]) .selectable-box-checkbox px-selectable-box,:host([inverted]) .selectable-box-radio px-selectable-box{background-color:var(--px-color-background-container-light-inverted)}:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-checkbox,:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-radio{border-color:var(--px-color-border-state-hover-inverted)}:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-checkbox px-selectable-box,:host([inverted]):host(:not([disabled])):host(:hover) .selectable-box-radio px-selectable-box{background-color:var( --px-color-background-state-hover-bordered-inverted )}:host([inverted]):host([checked]) .selectable-box-checkbox,:host([inverted]):host([checked]) .selectable-box-radio{border-color:var(--px-color-border-state-active-inverted)}:host([inverted]):host([disabled]) .selectable-box-checkbox,:host([inverted]):host([disabled]) .selectable-box-radio{border-color:transparent}:host([inverted]):host([disabled]) .selectable-box-checkbox px-selectable-box,:host([inverted]):host([disabled]) .selectable-box-radio px-selectable-box{background-color:var(--px-color-background-state-disabled-inverted)}:host([inverted]):host([disabled]) ::slotted([slot="title"]),:host([inverted]):host([disabled]) ::slotted([slot="description"]),:host([inverted]):host([disabled]) ::slotted([slot="content"]){color:var(--px-color-text-state-disabled-inverted)}', f = new CSSStyleSheet();
680
+ f.replaceSync(g);
681
+ class H extends n {
653
682
  template() {
654
683
  return `
655
684
  <div class="selectable-box-checkbox">
656
685
  <px-selectable-box>
657
686
  <slot name="media" slot="media"></slot>
658
687
  <px-checkbox
659
- slot="action" aria-hidden="true" tabindex="-1"
660
- name="${this.name}"
661
- value="${this.value}"
688
+ slot="action" inert
662
689
  ></px-checkbox>
663
690
  <slot name="icon" slot="icon"></slot>
664
691
  <slot name="logo" slot="logo"></slot>
@@ -672,20 +699,13 @@ class F extends n {
672
699
  }
673
700
  constructor() {
674
701
  var t;
675
- super(g), this.shadowRoot.innerHTML = this.template(), this.internals = (t = this.attachInternals) == null ? void 0 : t.call(this), this.tabIndex = 0, this.internals && (this.internals.role = "checkbox", this.internals.ariaChecked = `${this.checked}`);
702
+ super(f), this.shadowRoot.innerHTML = this.template(), this.internals = (t = this.attachInternals) == null ? void 0 : t.call(this), this.toggleFooterVisibility = this.toggleFooterVisibility.bind(this);
676
703
  }
677
704
  connectedCallback() {
678
- this.toggleFooterVisibility(), this.$slotFooter.addEventListener("slotchange", () => {
679
- this.toggleFooterVisibility();
680
- }), this.addEventListener("mouseover", () => {
681
- this.setHoverAttribute();
682
- }), this.addEventListener("mouseout", () => {
683
- this.removeHoverAttribute();
684
- }), this.addEventListener("keypress", (t) => {
685
- this.setKeypressEvent(t);
686
- }), this.addEventListener("click", (t) => {
687
- this.setClickEvent(t);
688
- }), this.hasAttribute("checked") && (this.checked = !0);
705
+ this.name && this.$checkbox.setAttribute("name", this.name), this.value && this.$checkbox.setAttribute("value", this.value), this.role = "checkbox", this.internals && (this.internals.role = "checkbox", this.internals.ariaChecked = `${this.checked}`), this.ariaChecked = `${this.checked}`, this.tabIndex = 0, this.toggleFooterVisibility(), this.$slotFooter.addEventListener(
706
+ "slotchange",
707
+ this.toggleFooterVisibility
708
+ ), this.addEventListener("mouseover", this.setHoverAttribute), this.addEventListener("mouseout", this.removeHoverAttribute), this.addEventListener("keypress", this.setKeypressEvent), this.addEventListener("click", this.setClickEvent), this.hasAttribute("checked") && (this.checked = !0);
689
709
  }
690
710
  static get observedAttributes() {
691
711
  return [
@@ -722,15 +742,7 @@ class F extends n {
722
742
  this.$slotFooter.removeEventListener(
723
743
  "slotchange",
724
744
  this.toggleFooterVisibility
725
- ), this.removeEventListener("mouseover", () => {
726
- this.setHoverAttribute();
727
- }), this.removeEventListener("mouseout", () => {
728
- this.removeHoverAttribute();
729
- }), this.removeEventListener("keypress", (t) => {
730
- this.setKeypressEvent(t);
731
- }), this.removeEventListener("click", (t) => {
732
- this.setClickEvent(t);
733
- });
745
+ ), this.removeEventListener("mouseover", this.setHoverAttribute), this.removeEventListener("mouseout", this.removeHoverAttribute), this.removeEventListener("keypress", this.setKeypressEvent), this.removeEventListener("click", this.setClickEvent);
734
746
  }
735
747
  removeHoverAttribute() {
736
748
  this.$checkbox.removeAttribute("hover");
@@ -752,11 +764,11 @@ class F extends n {
752
764
  this.$slottedFooter ? this.$selectableBox.removeAttribute("hide-footer") : this.$selectableBox.setAttribute("hide-footer", "");
753
765
  }
754
766
  handleDisabledAttributeChange(t) {
755
- t ? (this.disabled = !0, this.internals && (this.internals.ariaDisabled = "true"), this.$checkbox.setAttribute("disabled", "")) : (this.disabled = !1, this.internals && (this.internals.ariaDisabled = "false"), this.$checkbox.removeAttribute("disabled"));
767
+ t ? (this.disabled = !0, this.internals && (this.internals.ariaDisabled = "true"), this.ariaDisabled = "true", this.$checkbox.setAttribute("disabled", "")) : (this.disabled = !1, this.internals && (this.internals.ariaDisabled = "false"), this.ariaDisabled = "false", this.$checkbox.removeAttribute("disabled"));
756
768
  }
757
769
  handleCheckedAttributeChange(t) {
758
770
  var e;
759
- (e = this.internals) == null || e.setFormValue(this.formData()), t === null ? (this.internals && (this.internals.ariaChecked = "false"), this.checked = !1, this.$checkbox && this.$checkbox.removeAttribute("checked")) : (this.internals && (this.internals.ariaChecked = "true"), this.checked = !0, this.$checkbox && this.$checkbox.setAttribute("checked", ""), this.dispatchEvent(
771
+ (e = this.internals) == null || e.setFormValue(this.formData()), t === null ? (this.internals && (this.internals.ariaChecked = "false"), this.ariaChecked = "false", this.checked = !1, this.$checkbox && this.$checkbox.removeAttribute("checked")) : (this.internals && (this.internals.ariaChecked = "true"), this.ariaChecked = "true", this.checked = !0, this.$checkbox && this.$checkbox.setAttribute("checked", ""), this.dispatchEvent(
760
772
  new Event("change", {
761
773
  bubbles: !0,
762
774
  composed: !0
@@ -831,20 +843,18 @@ class F extends n {
831
843
  t ? this.setAttribute("value", t) : this.removeAttribute("value");
832
844
  }
833
845
  }
834
- customElements.get("px-selectable-box-checkbox") || customElements.define("px-selectable-box-checkbox", F);
846
+ customElements.get("px-selectable-box-checkbox") || customElements.define("px-selectable-box-checkbox", H);
835
847
  const x = new CSSStyleSheet();
836
- x.replaceSync(u);
837
- class H extends n {
848
+ x.replaceSync(g);
849
+ class q extends n {
838
850
  template() {
839
851
  return `
840
852
  <div class="selectable-box-radio">
841
853
  <px-selectable-box>
842
854
  <slot name="media" slot="media"></slot>
843
- <px-radio-base
844
- slot="action" aria-hidden="true" tabindex="-1"
845
- name="${this.name}"
846
- value="${this.value}"
847
- ></px-radio-base>
855
+ <px-radio
856
+ slot="action" inert
857
+ ></px-radio>
848
858
  <slot name="icon" slot="icon"></slot>
849
859
  <slot name="logo" slot="logo"></slot>
850
860
  <slot name="title" slot="title"></slot>
@@ -856,21 +866,15 @@ class H extends n {
856
866
  `;
857
867
  }
858
868
  constructor() {
859
- var t, e;
860
- super(x), this.shadowRoot.innerHTML = this.template(), this.internals = (t = this.attachInternals) == null ? void 0 : t.call(this), this.tabIndex = ((e = this.parentElement) == null ? void 0 : e.firstElementChild) === this ? 0 : -1, this.internals && (this.internals.role = "radio", this.internals.ariaChecked = `${this.checked}`);
869
+ var t;
870
+ super(x), this.shadowRoot.innerHTML = this.template(), this.internals = (t = this.attachInternals) == null ? void 0 : t.call(this), this.toggleFooterVisibility = this.toggleFooterVisibility.bind(this);
861
871
  }
862
872
  connectedCallback() {
863
- this.toggleFooterVisibility(), this.$slotFooter.addEventListener("slotchange", () => {
864
- this.toggleFooterVisibility();
865
- }), this.addEventListener("mouseover", () => {
866
- this.setHoverAttribute();
867
- }), this.addEventListener("mouseout", () => {
868
- this.removeHoverAttribute();
869
- }), this.addEventListener("keypress", (t) => {
870
- this.setKeypressEvent(t);
871
- }), this.addEventListener("click", (t) => {
872
- this.setClickEvent(t);
873
- }), this.hasAttribute("checked") && (this.checked = !0);
873
+ var t;
874
+ this.name && this.$radio.setAttribute("name", this.name), this.value && this.$radio.setAttribute("value", this.value), this.role = "radio", this.internals && (this.internals.role = "radio", this.internals.ariaChecked = `${this.checked}`), this.ariaChecked = `${this.checked}`, this.tabIndex = ((t = this.parentElement) == null ? void 0 : t.firstElementChild) === this ? 0 : -1, this.toggleFooterVisibility(), this.$slotFooter.addEventListener(
875
+ "slotchange",
876
+ this.toggleFooterVisibility
877
+ ), this.addEventListener("mouseover", this.setHoverAttribute), this.addEventListener("mouseout", this.removeHoverAttribute), this.addEventListener("keypress", this.setKeypressEvent), this.addEventListener("click", this.setClickEvent), this.hasAttribute("checked") && (this.checked = !0);
874
878
  }
875
879
  static get observedAttributes() {
876
880
  return [
@@ -907,15 +911,7 @@ class H extends n {
907
911
  this.$slotFooter.removeEventListener(
908
912
  "slotchange",
909
913
  this.toggleFooterVisibility
910
- ), this.removeEventListener("mouseover", () => {
911
- this.setHoverAttribute();
912
- }), this.removeEventListener("mouseout", () => {
913
- this.removeHoverAttribute();
914
- }), this.removeEventListener("keypress", (t) => {
915
- this.setKeypressEvent(t);
916
- }), this.removeEventListener("click", (t) => {
917
- this.setClickEvent(t);
918
- });
914
+ ), this.removeEventListener("mouseover", this.setHoverAttribute), this.removeEventListener("mouseout", this.removeHoverAttribute), this.removeEventListener("keypress", this.setKeypressEvent), this.removeEventListener("click", this.setClickEvent);
919
915
  }
920
916
  removeHoverAttribute() {
921
917
  this.$radio.removeAttribute("hover");
@@ -937,11 +933,11 @@ class H extends n {
937
933
  this.$slottedFooter ? this.$selectableBox.removeAttribute("hide-footer") : this.$selectableBox.setAttribute("hide-footer", "");
938
934
  }
939
935
  handleDisabledAttributeChange(t) {
940
- t ? (this.disabled = !0, this.internals && (this.internals.ariaDisabled = "true"), this.$radio.setAttribute("disabled", "")) : (this.disabled = !1, this.internals && (this.internals.ariaDisabled = "false"), this.$radio.removeAttribute("disabled"));
936
+ t ? (this.disabled = !0, this.internals && (this.internals.ariaDisabled = "true"), this.ariaDisabled = "true", this.$radio.setAttribute("disabled", "")) : (this.disabled = !1, this.internals && (this.internals.ariaDisabled = "false"), this.ariaDisabled = "false", this.$radio.removeAttribute("disabled"));
941
937
  }
942
938
  handleCheckedAttributeChange(t) {
943
939
  var e;
944
- (e = this.internals) == null || e.setFormValue(this.formData()), t === null ? (this.internals && (this.internals.ariaChecked = "false"), this.setAttribute("tabIndex", "-1"), this.checked = !1, this.$radio && this.$radio.removeAttribute("checked")) : (this.internals && (this.internals.ariaChecked = "true"), this.setAttribute("tabIndex", "0"), this.checked = !0, this.$radio && this.$radio.setAttribute("checked", ""), this.dispatchEvent(
940
+ (e = this.internals) == null || e.setFormValue(this.formData()), t === null ? (this.internals && (this.internals.ariaChecked = "false"), this.ariaChecked = "false", this.tabIndex = -1, this.checked = !1, this.$radio && this.$radio.removeAttribute("checked")) : (this.internals && (this.internals.ariaChecked = "true"), this.ariaChecked = "true", this.tabIndex = 0, this.checked = !0, this.$radio && this.$radio.setAttribute("checked", ""), this.dispatchEvent(
945
941
  new Event("change", {
946
942
  bubbles: !0,
947
943
  composed: !0
@@ -975,7 +971,7 @@ class H extends n {
975
971
  return this.shadowRoot.querySelector("px-selectable-box");
976
972
  }
977
973
  get $radio() {
978
- return this.shadowRoot.querySelector("px-radio-base");
974
+ return this.shadowRoot.querySelector("px-radio");
979
975
  }
980
976
  get $slotFooter() {
981
977
  return this.shadowRoot.querySelector(
@@ -1016,9 +1012,9 @@ class H extends n {
1016
1012
  t ? this.setAttribute("value", t) : this.removeAttribute("value");
1017
1013
  }
1018
1014
  }
1019
- customElements.get("px-selectable-box-radio") || customElements.define("px-selectable-box-radio", H);
1015
+ customElements.get("px-selectable-box-radio") || customElements.define("px-selectable-box-radio", q);
1020
1016
  export {
1021
- R as SelectableBox,
1022
- F as SelectableBoxCheckbox,
1023
- H as SelectableBoxRadio
1017
+ F as SelectableBox,
1018
+ H as SelectableBoxCheckbox,
1019
+ q as SelectableBoxRadio
1024
1020
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-selectablebox",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.21",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",