@proximus/lavender-tile 2.0.0-alpha.1 → 2.0.0-alpha.10

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.
@@ -2,7 +2,7 @@ import { WithExtraAttributes } from '@proximus/lavender-common';
2
2
  import '@proximus/lavender-layout';
3
3
  import { Tile } from './Tile';
4
4
  import { type IRadio } from '@proximus/lavender-radio-group';
5
- import { type RadioBase } from '@proximus/lavender-radio-group';
5
+ import { type Radio } from '@proximus/lavender-radio-group';
6
6
  export declare class TileRadio extends WithExtraAttributes implements IRadio {
7
7
  protected internals: ElementInternals;
8
8
  protected template(): string;
@@ -18,7 +18,7 @@ export declare class TileRadio extends WithExtraAttributes implements IRadio {
18
18
  formData(): FormData;
19
19
  get $tile(): Tile;
20
20
  get $el(): HTMLElement;
21
- get $radio(): RadioBase;
21
+ get $radio(): Radio;
22
22
  get $slotPrefix(): Element;
23
23
  get $children(): NodeListOf<Element>;
24
24
  get centerContent(): boolean;
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PxElement as b, checkName as E, WithExtraAttributes as u } from "@proximus/lavender-common";
2
2
  import "@proximus/lavender-layout";
3
- import { checkboxStateValues as q } from "@proximus/lavender-checkbox";
4
- import { stateValues as D } from "@proximus/lavender-radio-group";
3
+ import { checkboxStateValues as D } from "@proximus/lavender-checkbox";
4
+ import { stateValues as q } from "@proximus/lavender-radio-group";
5
5
  function l(o) {
6
6
  o.hasAttribute("width") || o.setAttribute("width", "s"), o.setAttribute("border-radius", "pill");
7
7
  }
@@ -276,7 +276,7 @@ class R extends u {
276
276
  }
277
277
  constructor() {
278
278
  var t;
279
- super($), 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}`);
279
+ super($), this.shadowRoot.innerHTML = this.template(), this.internals = (t = this.attachInternals) == null ? void 0 : t.call(this), this.tabIndex = 0, this.role = "checkbox", this.internals && (this.internals.role = "checkbox", this.internals.ariaChecked = `${this.checked}`), this.ariaChecked = `${this.checked}`;
280
280
  }
281
281
  connectedCallback() {
282
282
  if (this.$slotPrefix) {
@@ -328,7 +328,7 @@ class R extends u {
328
328
  break;
329
329
  case "state":
330
330
  if (this.$checkbox)
331
- if (this.checkName(q, i))
331
+ if (this.checkName(D, i))
332
332
  this.$checkbox.setAttribute("state", i);
333
333
  else {
334
334
  console.error(`${i} is not a valid state value`);
@@ -344,11 +344,11 @@ class R extends u {
344
344
  }
345
345
  }
346
346
  handleDisabledAttributeChange(t) {
347
- t ? (this.disabled = !0, this.internals && (this.internals.ariaDisabled = "true"), this.$tile.disabled = !0, this.$checkbox.setAttribute("disabled", "")) : (this.disabled = !1, this.internals && (this.internals.ariaDisabled = "false"), this.$tile.disabled = !1, this.$checkbox.removeAttribute("disabled"));
347
+ t ? (this.disabled = !0, this.internals && (this.internals.ariaDisabled = "true"), this.ariaDisabled = "true", this.$tile.disabled = !0, this.$checkbox.setAttribute("disabled", "")) : (this.disabled = !1, this.internals && (this.internals.ariaDisabled = "false"), this.ariaDisabled = "false", this.$tile.disabled = !1, this.$checkbox.removeAttribute("disabled"));
348
348
  }
349
349
  handleCheckedAttributeChange(t) {
350
350
  var e;
351
- (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(
351
+ (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(
352
352
  new Event("change", {
353
353
  bubbles: !0,
354
354
  composed: !0
@@ -446,7 +446,7 @@ class L extends u {
446
446
  <div class="tile-radio">
447
447
  <px-tile hoverable>
448
448
  <slot name="prefix" slot="prefix"></slot>
449
- <px-radio-base slot="suffix" aria-hidden="true" tabindex="-1"></px-radio-base>
449
+ <px-radio slot="suffix" aria-hidden="true" tabindex="-1"></px-radio>
450
450
  <slot name="label" slot="label"></slot>
451
451
  <slot name="description" slot="description"></slot>
452
452
  </px-tile>
@@ -454,26 +454,27 @@ class L extends u {
454
454
  `;
455
455
  }
456
456
  constructor() {
457
- var t, e;
458
- super(C), 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}`);
457
+ var t;
458
+ super(C), this.shadowRoot.innerHTML = this.template(), this.internals = (t = this.attachInternals) == null ? void 0 : t.call(this), this.role = "radio", this.internals && (this.internals.role = "radio", this.internals.ariaChecked = `${this.checked}`), this.ariaChecked = `${this.checked}`;
459
459
  }
460
460
  connectedCallback() {
461
- if (this.$slotPrefix) {
462
- const t = this.querySelector('px-img[slot="prefix"]');
463
- t && l(t);
461
+ var t;
462
+ if (this.tabIndex = ((t = this.parentElement) == null ? void 0 : t.firstElementChild) === this ? 0 : -1, this.$slotPrefix) {
463
+ const e = this.querySelector('px-img[slot="prefix"]');
464
+ e && l(e);
464
465
  }
465
466
  this.addEventListener("mouseover", () => {
466
467
  this.$radio.setAttribute("hover", "");
467
468
  }), this.addEventListener("mouseout", () => {
468
469
  this.$radio.removeAttribute("hover");
469
- }), this.addEventListener("keypress", (t) => {
470
- switch (t.stopPropagation(), t.preventDefault(), t.code) {
470
+ }), this.addEventListener("keypress", (e) => {
471
+ switch (e.stopPropagation(), e.preventDefault(), e.code) {
471
472
  case "Space":
472
473
  this.click();
473
474
  break;
474
475
  }
475
- }), this.addEventListener("click", (t) => {
476
- this.checked || (this.checked = !0), t.stopPropagation(), t.preventDefault();
476
+ }), this.addEventListener("click", (e) => {
477
+ this.checked || (this.checked = !0), e.stopPropagation(), e.preventDefault();
477
478
  }), this.hasAttribute("checked") && (this.checked = !0);
478
479
  }
479
480
  static get observedAttributes() {
@@ -507,7 +508,7 @@ class L extends u {
507
508
  break;
508
509
  case "state":
509
510
  if (this.$radio)
510
- if (this.checkName(D, i))
511
+ if (this.checkName(q, i))
511
512
  this.$radio.setAttribute("state", i);
512
513
  else {
513
514
  console.error(`${i} is not a valid state value`);
@@ -523,11 +524,11 @@ class L extends u {
523
524
  }
524
525
  }
525
526
  handleDisabledAttributeChange(t) {
526
- t ? (this.disabled = !0, this.internals && (this.internals.ariaDisabled = "true"), this.$tile.disabled = !0, this.$radio.setAttribute("disabled", "")) : (this.disabled = !1, this.internals && (this.internals.ariaDisabled = "false"), this.$tile.disabled = !1, this.$radio.removeAttribute("disabled"));
527
+ t ? (this.disabled = !0, this.internals && (this.internals.ariaDisabled = "true"), this.ariaDisabled = "true", this.$tile.disabled = !0, this.$radio.setAttribute("disabled", "")) : (this.disabled = !1, this.internals && (this.internals.ariaDisabled = "false"), this.ariaDisabled = "false", this.$tile.disabled = !1, this.$radio.removeAttribute("disabled"));
527
528
  }
528
529
  handleCheckedAttributeChange(t) {
529
530
  var e;
530
- (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(
531
+ (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(
531
532
  new Event("change", {
532
533
  bubbles: !0,
533
534
  composed: !0
@@ -559,7 +560,7 @@ class L extends u {
559
560
  return this.shadowRoot.querySelector(".tile-radio");
560
561
  }
561
562
  get $radio() {
562
- return this.shadowRoot.querySelector("px-radio-base");
563
+ return this.shadowRoot.querySelector("px-radio");
563
564
  }
564
565
  get $slotPrefix() {
565
566
  return this.querySelector('[slot="prefix"]');
@@ -758,7 +759,7 @@ class H extends u {
758
759
  }
759
760
  constructor() {
760
761
  var t;
761
- super(w), 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}`);
762
+ super(w), this.shadowRoot.innerHTML = this.template(), this.internals = (t = this.attachInternals) == null ? void 0 : t.call(this), this.tabIndex = 0, this.role = "checkbox", this.internals && (this.internals.role = "checkbox", this.internals.ariaChecked = `${this.checked}`), this.ariaChecked = `${this.checked}`;
762
763
  }
763
764
  connectedCallback() {
764
765
  if (this.$slotPrefix) {
@@ -816,11 +817,11 @@ class H extends u {
816
817
  }
817
818
  }
818
819
  handleDisabledAttributeChange(t) {
819
- t ? (this.disabled = !0, this.internals && (this.internals.ariaDisabled = "true"), this.$tile.disabled = !0, this.$switch.setAttribute("disabled", "")) : (this.disabled = !1, this.internals && (this.internals.ariaDisabled = "false"), this.$tile.disabled = !1, this.$switch.removeAttribute("disabled"));
820
+ t ? (this.disabled = !0, this.internals && (this.internals.ariaDisabled = "true"), this.ariaDisabled = "true", this.$tile.disabled = !0, this.$switch.setAttribute("disabled", "")) : (this.disabled = !1, this.internals && (this.internals.ariaDisabled = "false"), this.ariaDisabled = "false", this.$tile.disabled = !1, this.$switch.removeAttribute("disabled"));
820
821
  }
821
822
  handleCheckedAttributeChange(t) {
822
823
  var e;
823
- (e = this.internals) == null || e.setFormValue(this.formData()), t === null ? (this.internals && (this.internals.ariaChecked = "false"), this.checked = !1, this.$switch && this.$switch.removeAttribute("checked")) : (this.internals && (this.internals.ariaChecked = "true"), this.checked = !0, this.$switch && this.$switch.setAttribute("checked", ""), this.dispatchEvent(
824
+ (e = this.internals) == null || e.setFormValue(this.formData()), t === null ? (this.internals && (this.internals.ariaChecked = "false"), this.ariaChecked = "false", this.checked = !1, this.$switch && this.$switch.removeAttribute("checked")) : (this.internals && (this.internals.ariaChecked = "true"), this.ariaChecked = "true", this.checked = !0, this.$switch && this.$switch.setAttribute("checked", ""), this.dispatchEvent(
824
825
  new Event("change", {
825
826
  bubbles: !0,
826
827
  composed: !0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-tile",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.10",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",