@proximus/lavender 1.4.5-alpha.9 → 1.4.5

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.
@@ -24,7 +24,7 @@ function getSupportedAttributeNames(htmlElementName) {
24
24
  }
25
25
  const commonStyleSheet$c = new CSSStyleSheet();
26
26
  commonStyleSheet$c.replaceSync(commonStyles);
27
- const PX_COMPONENT_DEBUG = typeof import.meta !== "undefined" && typeof __vite_import_meta_env__ !== "undefined" && true;
27
+ const PX_COMPONENT_DEBUG = typeof import.meta !== "undefined" && typeof __vite_import_meta_env__ !== "undefined" && false;
28
28
  if (typeof window !== "undefined") {
29
29
  window.isComponentDebug = isComponentDebug;
30
30
  }
@@ -32,9 +32,6 @@ function isComponentDebug() {
32
32
  return PX_COMPONENT_DEBUG;
33
33
  }
34
34
  function log(message) {
35
- if (isComponentDebug()) {
36
- console.error(message);
37
- }
38
35
  }
39
36
  if (typeof window !== "undefined") {
40
37
  window.isComponentDebug = isComponentDebug;
@@ -3012,7 +3009,6 @@ const _ActionLink = class _ActionLink extends PxElement {
3012
3009
  }
3013
3010
  attributeChangedCallback(name, oldValue, newValue) {
3014
3011
  if ((name === "icon-name" || name === "icon-from" || name === "label") && !newValue) {
3015
- log(`Action link needs a value from the attribute ${name}`);
3016
3012
  throw new Error(`Action link needs a value from the attribute ${name}`);
3017
3013
  }
3018
3014
  if (name === "icon-name") {
@@ -3183,7 +3179,6 @@ const _AgGridTableThButton = class _AgGridTableThButton extends PxElement {
3183
3179
  updateSorting(oldValue, newValue, attrValue) {
3184
3180
  var _a, _b;
3185
3181
  if (!checkName(attrValue, newValue)) {
3186
- log(`${newValue} is not an allowed sorting value.`);
3187
3182
  return;
3188
3183
  }
3189
3184
  if (oldValue !== null && oldValue !== "") {
@@ -3659,6 +3654,7 @@ const _Banner = class _Banner extends VerticallyExtendedElement {
3659
3654
  <slot name="title"></slot>
3660
3655
  <slot name="description"></slot>
3661
3656
  <slot name="content"></slot>
3657
+
3662
3658
  </div>
3663
3659
  </px-container>
3664
3660
  </px-grid>
@@ -3692,11 +3688,6 @@ const _Banner = class _Banner extends VerticallyExtendedElement {
3692
3688
  connectedCallback() {
3693
3689
  var _a;
3694
3690
  (_a = super.connectedCallback) == null ? void 0 : _a.call(this);
3695
- if (this.reduced) {
3696
- this.$container.setAttribute("padding", "m");
3697
- } else {
3698
- this.$container.setAttribute("padding", "l");
3699
- }
3700
3691
  this.createGridTemplateAreas();
3701
3692
  this.createGridding();
3702
3693
  }
@@ -3784,20 +3775,20 @@ const _Banner = class _Banner extends VerticallyExtendedElement {
3784
3775
  }
3785
3776
  createGridding(value) {
3786
3777
  const breakpoints = [
3787
- { prop: "hasGridding", gridAttr: "grid-cols", attr: "col-span" },
3778
+ { prop: "hasGridding", gridProp: "gridCols", attr: "col-span" },
3788
3779
  {
3789
3780
  prop: "hasGriddingMobile",
3790
- gridAttr: "grid-cols--mobile",
3781
+ gridProp: "gridColsMobile",
3791
3782
  attr: "col-span--mobile"
3792
3783
  },
3793
3784
  {
3794
3785
  prop: "hasGriddingTablet",
3795
- gridAttr: "grid-cols--tablet",
3786
+ gridProp: "gridColsTablet",
3796
3787
  attr: "col-span--tablet"
3797
3788
  },
3798
3789
  {
3799
3790
  prop: "hasGriddingLaptop",
3800
- gridAttr: "grid-cols--laptop",
3791
+ gridProp: "gridColsLaptop",
3801
3792
  attr: "col-span--laptop"
3802
3793
  }
3803
3794
  ];
@@ -3805,16 +3796,16 @@ const _Banner = class _Banner extends VerticallyExtendedElement {
3805
3796
  "px-grid > px-container"
3806
3797
  );
3807
3798
  if (value !== null) {
3808
- breakpoints.forEach(({ prop, gridAttr, attr }) => {
3799
+ breakpoints.forEach(({ prop, gridProp, attr }) => {
3809
3800
  if (this[prop]) {
3810
- this.$grid.setAttribute(gridAttr, "3");
3811
- spanElement == null ? void 0 : spanElement.setAttribute(attr, "2");
3801
+ this.$grid[gridProp] = "3";
3802
+ spanElement.setAttribute(attr, "2");
3812
3803
  }
3813
3804
  });
3814
3805
  } else {
3815
- breakpoints.forEach(({ gridAttr, attr }) => {
3816
- this.$grid.setAttribute(gridAttr, "1");
3817
- spanElement == null ? void 0 : spanElement.setAttribute(attr, "1");
3806
+ breakpoints.forEach(({ gridProp, attr }) => {
3807
+ this.$grid[gridProp] = "1";
3808
+ spanElement.removeAttribute(attr);
3818
3809
  });
3819
3810
  }
3820
3811
  }
@@ -5381,7 +5372,6 @@ function configureCellBackgroundColor(el) {
5381
5372
  }
5382
5373
  function updateVariant(element, oldValue, newValue) {
5383
5374
  if (!checkName(cellVariantValues, newValue)) {
5384
- log(`${newValue} is not an allowed variant value.`);
5385
5375
  return;
5386
5376
  }
5387
5377
  if (oldValue !== null && oldValue !== "" && oldValue !== "default") {
@@ -6838,7 +6828,7 @@ class CellSwitch extends WithExtraAttributes {
6838
6828
  return `
6839
6829
  <div class="cell-switch">
6840
6830
  <px-cell hoverable>
6841
- <px-switch slot="action-indicator" inert></px-switch>
6831
+ <px-switch slot="action-indicator" aria-hidden="true" tabindex="-1"></px-switch>
6842
6832
  <slot name="visual" slot="visual"></slot>
6843
6833
  <slot name="label" slot="label"></slot>
6844
6834
  <slot name="description" slot="description"></slot>
@@ -7638,11 +7628,7 @@ class Radiogroup extends WithExtraAttributes {
7638
7628
  setupErrorState() {
7639
7629
  var _a;
7640
7630
  const hasErrorText = ((_a = this.$slotError) == null ? void 0 : _a.assignedNodes().length) > 0;
7641
- if (this.state === "error" && !hasErrorText) {
7642
- log(
7643
- '<px-radiogroup> with state="error" requires a slot="error-text" containing the error description.'
7644
- );
7645
- }
7631
+ if (this.state === "error" && !hasErrorText) ;
7646
7632
  if (this.state === "error" && hasErrorText) {
7647
7633
  this.$el.setAttribute("state", "error");
7648
7634
  this.$radioList.forEach((child) => {
@@ -7732,7 +7718,7 @@ class CellRadio extends WithExtraAttributes {
7732
7718
  return `
7733
7719
  <div class="cell-radio">
7734
7720
  <px-cell hoverable>
7735
- <px-radio slot="prefix" inert></px-radio>
7721
+ <px-radio slot="prefix" aria-hidden="true" tabindex="-1"></px-radio>
7736
7722
  <slot name="visual" slot="visual"></slot>
7737
7723
  <slot name="label" slot="label"></slot>
7738
7724
  <slot name="description" slot="description"></slot>
@@ -9009,20 +8995,20 @@ const _ContentHeader = class _ContentHeader extends PxElement {
9009
8995
  }
9010
8996
  createGridding(value) {
9011
8997
  const breakpoints = [
9012
- { prop: "hasGridding", gridAttr: "grid-cols", attr: "col-span" },
8998
+ { prop: "hasGridding", gridProp: "gridCols", attr: "col-span" },
9013
8999
  {
9014
9000
  prop: "hasGriddingMobile",
9015
- gridAttr: "grid-cols--mobile",
9001
+ gridProp: "gridColsMobile",
9016
9002
  attr: "col-span--mobile"
9017
9003
  },
9018
9004
  {
9019
9005
  prop: "hasGriddingTablet",
9020
- gridAttr: "grid-cols--tablet",
9006
+ gridProp: "gridColsTablet",
9021
9007
  attr: "col-span--tablet"
9022
9008
  },
9023
9009
  {
9024
9010
  prop: "hasGriddingLaptop",
9025
- gridAttr: "grid-cols--laptop",
9011
+ gridProp: "gridColsLaptop",
9026
9012
  attr: "col-span--laptop"
9027
9013
  }
9028
9014
  ];
@@ -9030,16 +9016,16 @@ const _ContentHeader = class _ContentHeader extends PxElement {
9030
9016
  "px-grid > px-container"
9031
9017
  );
9032
9018
  if (value !== null) {
9033
- breakpoints.forEach(({ prop, gridAttr, attr }) => {
9019
+ breakpoints.forEach(({ prop, gridProp, attr }) => {
9034
9020
  if (this[prop]) {
9035
- this.$grid.setAttribute(gridAttr, "3");
9036
- spanElement == null ? void 0 : spanElement.setAttribute(attr, "2");
9021
+ this.$grid[gridProp] = "3";
9022
+ spanElement.setAttribute(attr, "2");
9037
9023
  }
9038
9024
  });
9039
9025
  } else {
9040
- breakpoints.forEach(({ gridAttr, attr }) => {
9041
- this.$grid.setAttribute(gridAttr, "1");
9042
- spanElement == null ? void 0 : spanElement.setAttribute(attr, "1");
9026
+ breakpoints.forEach(({ gridProp, attr }) => {
9027
+ this.$grid[gridProp] = "1";
9028
+ spanElement.removeAttribute(attr);
9043
9029
  });
9044
9030
  }
9045
9031
  }
@@ -9774,9 +9760,6 @@ class Dropdown extends WithExtraAttributes {
9774
9760
  if (anchorAlignmentValues.includes(value)) {
9775
9761
  this.setAttribute("anchoralignment", value);
9776
9762
  } else {
9777
- log(
9778
- `Invalid anchor alignment value: ${value}. Using default ${defaultAnchorAlignment}.`
9779
- );
9780
9763
  this.setAttribute("anchoralignment", defaultAnchorAlignment);
9781
9764
  }
9782
9765
  }
@@ -9880,11 +9863,7 @@ const _Fieldset = class _Fieldset extends PxElement {
9880
9863
  setupErrorState() {
9881
9864
  var _a;
9882
9865
  const hasErrorText = ((_a = this.$slotError) == null ? void 0 : _a.assignedNodes().length) > 0;
9883
- if (this.state === "error" && !hasErrorText) {
9884
- log(
9885
- '<px-fieldset> with state="error" requires a slot="error-text" containing the error description.'
9886
- );
9887
- }
9866
+ if (this.state === "error" && !hasErrorText) ;
9888
9867
  if (this.state === "error" && hasErrorText) {
9889
9868
  const id = Math.random().toString(36).substr(2, 9);
9890
9869
  this.$el.setAttribute("id", id);
@@ -12519,9 +12498,15 @@ const styles$j = '*{box-sizing:border-box}#container{display:flex;flex-wrap:nowr
12519
12498
  const styleSheet$j = new CSSStyleSheet();
12520
12499
  styleSheet$j.replaceSync(styles$j);
12521
12500
  const CLOSE_EVENT$1 = "px.lavender.modal.close";
12501
+ const statusValues = ["", "info", "success", "error", "warning"];
12522
12502
  class Modal extends HTMLElement {
12523
12503
  constructor() {
12524
12504
  super();
12505
+ this.onOpenClick = () => this.show();
12506
+ this.onCloseClick = () => this.close();
12507
+ this.commandButtonCleanups = [];
12508
+ this.openerElement = null;
12509
+ this.closerElement = null;
12525
12510
  this.template = `<dialog>
12526
12511
  <div id="container">
12527
12512
  <div id="content-container">
@@ -12537,6 +12522,7 @@ class Modal extends HTMLElement {
12537
12522
  </px-vstack>
12538
12523
  </px-hstack>
12539
12524
  <div id="content">
12525
+ <slot name="content"></slot>
12540
12526
  <slot></slot>
12541
12527
  </div>
12542
12528
  <px-separator size="m"></px-separator>
@@ -12563,18 +12549,14 @@ class Modal extends HTMLElement {
12563
12549
  }
12564
12550
  connectedCallback() {
12565
12551
  var _a, _b;
12552
+ this.addEventListenersToCommandButtons();
12566
12553
  this.toggleDescriptionVisibility = this.toggleDescriptionVisibility.bind(this);
12567
12554
  this.toggleCloseButtonSafeArea = this.toggleCloseButtonSafeArea.bind(this);
12568
12555
  if (this.hasAttribute("open")) {
12569
12556
  this.show();
12570
12557
  }
12571
12558
  if (this.hasAttribute("closedby")) {
12572
- const $closer = document.querySelector(
12573
- `#${this.getAttribute("closedby")}`
12574
- );
12575
- $closer == null ? void 0 : $closer.addEventListener("click", () => {
12576
- this.close();
12577
- });
12559
+ this.addCloseListener(this.getAttribute("closedby"));
12578
12560
  }
12579
12561
  if (this.hasAttribute("openedby")) {
12580
12562
  this.addOpenListener();
@@ -12594,7 +12576,7 @@ class Modal extends HTMLElement {
12594
12576
  );
12595
12577
  }
12596
12578
  static get observedAttributes() {
12597
- return ["open", "status", "media-src", "openedby"];
12579
+ return ["open", "status", "media-src", "openedby", "closedby", "id"];
12598
12580
  }
12599
12581
  attributeChangedCallback(attrName, oldValue, newValue) {
12600
12582
  switch (attrName) {
@@ -12610,14 +12592,49 @@ class Modal extends HTMLElement {
12610
12592
  case "openedby":
12611
12593
  this.addOpenListener();
12612
12594
  break;
12595
+ case "closedby":
12596
+ this.addCloseListener(newValue);
12597
+ break;
12598
+ case "id":
12599
+ this.addEventListenersToCommandButtons();
12600
+ break;
12613
12601
  }
12614
12602
  }
12615
12603
  disconnectedCallback() {
12616
- var _a;
12604
+ var _a, _b;
12617
12605
  (_a = this.$slotDescription) == null ? void 0 : _a.removeEventListener(
12618
12606
  "slotchange",
12619
12607
  this.toggleDescriptionVisibility
12620
12608
  );
12609
+ (_b = this.$slotCloseButton) == null ? void 0 : _b.removeEventListener(
12610
+ "slotchange",
12611
+ this.toggleCloseButtonSafeArea
12612
+ );
12613
+ this.removeCommandButtonListeners();
12614
+ this.removeOpenListener();
12615
+ this.removeCloseListener();
12616
+ }
12617
+ addEventListenersToCommandButtons() {
12618
+ this.removeCommandButtonListeners();
12619
+ if (this.id) {
12620
+ document.querySelectorAll(`[commandfor="${this.id}"]`).forEach(($clickable) => {
12621
+ if ($clickable.getAttribute("command") === "show-modal") {
12622
+ $clickable.addEventListener("click", this.onOpenClick);
12623
+ this.commandButtonCleanups.push(
12624
+ () => $clickable.removeEventListener("click", this.onOpenClick)
12625
+ );
12626
+ } else if ($clickable.getAttribute("command") === "close") {
12627
+ $clickable.addEventListener("click", this.onCloseClick);
12628
+ this.commandButtonCleanups.push(
12629
+ () => $clickable.removeEventListener("click", this.onCloseClick)
12630
+ );
12631
+ }
12632
+ });
12633
+ }
12634
+ }
12635
+ removeCommandButtonListeners() {
12636
+ this.commandButtonCleanups.forEach((cleanup) => cleanup());
12637
+ this.commandButtonCleanups = [];
12621
12638
  }
12622
12639
  handleOpenChange() {
12623
12640
  if (this.hasAttribute("open")) {
@@ -12628,6 +12645,13 @@ class Modal extends HTMLElement {
12628
12645
  }
12629
12646
  handleStatusChange(oldStatus, newStatus) {
12630
12647
  var _a, _b, _c;
12648
+ if (statusValues.includes(newStatus)) {
12649
+ this.$titleContainer.setAttribute("color", `neutral`);
12650
+ } else {
12651
+ if (this.$titleContainer.hasAttribute("color")) {
12652
+ this.$titleContainer.removeAttribute("color");
12653
+ }
12654
+ }
12631
12655
  if (newStatus === "info") {
12632
12656
  this.$container.classList.add("info");
12633
12657
  } else {
@@ -12683,12 +12707,32 @@ class Modal extends HTMLElement {
12683
12707
  this.$mediaContainer.style.backgroundImage = `url(${src})`;
12684
12708
  }
12685
12709
  addOpenListener() {
12686
- var _a, _b, _c;
12687
- if (((_a = this.$opener) == null ? void 0 : _a.getAttribute("data-has-opener")) !== "true") {
12688
- (_b = this.$opener) == null ? void 0 : _b.setAttribute("data-has-opener", "true");
12689
- (_c = this.$opener) == null ? void 0 : _c.addEventListener("click", () => this.show());
12710
+ var _a;
12711
+ this.removeOpenListener();
12712
+ this.openerElement = this.$opener;
12713
+ (_a = this.openerElement) == null ? void 0 : _a.addEventListener("click", this.onOpenClick);
12714
+ }
12715
+ removeOpenListener() {
12716
+ var _a;
12717
+ (_a = this.openerElement) == null ? void 0 : _a.removeEventListener("click", this.onOpenClick);
12718
+ this.openerElement = null;
12719
+ }
12720
+ addCloseListener(value) {
12721
+ var _a, _b;
12722
+ if (value === "none") {
12723
+ (_a = this.$dialog) == null ? void 0 : _a.setAttribute("closedby", "none");
12724
+ }
12725
+ this.removeCloseListener();
12726
+ if (value && value !== "none") {
12727
+ this.closerElement = document.querySelector(`#${value}`);
12728
+ (_b = this.closerElement) == null ? void 0 : _b.addEventListener("click", this.onCloseClick);
12690
12729
  }
12691
12730
  }
12731
+ removeCloseListener() {
12732
+ var _a;
12733
+ (_a = this.closerElement) == null ? void 0 : _a.removeEventListener("click", this.onCloseClick);
12734
+ this.closerElement = null;
12735
+ }
12692
12736
  toggleDescriptionVisibility() {
12693
12737
  if (!this.$slottedDescription) {
12694
12738
  this.$descriptionContainer.style.display = "none";
@@ -12727,6 +12771,9 @@ class Modal extends HTMLElement {
12727
12771
  'px-p[font-weight="title"]'
12728
12772
  );
12729
12773
  }
12774
+ get $titleContainer() {
12775
+ return this.shadowRoot.querySelector("px-h1");
12776
+ }
12730
12777
  get $opener() {
12731
12778
  return document.querySelector(
12732
12779
  `px-button#${this.getAttribute("openedby")}`
@@ -12744,6 +12791,12 @@ class Modal extends HTMLElement {
12744
12791
  set openedby(value) {
12745
12792
  this.setAttribute("openedby", value);
12746
12793
  }
12794
+ get closedby() {
12795
+ return this.getAttribute("closedby");
12796
+ }
12797
+ set closedby(value) {
12798
+ this.setAttribute("closedby", value);
12799
+ }
12747
12800
  get $closeButton() {
12748
12801
  return this.shadowRoot.querySelector("px-button-icon");
12749
12802
  }
@@ -15557,7 +15610,7 @@ class TileCheckbox extends WithExtraAttributes {
15557
15610
  <div class="tile-checkbox">
15558
15611
  <px-tile hoverable>
15559
15612
  <slot name="prefix" slot="prefix"></slot>
15560
- <px-checkbox slot="suffix" inert></px-checkbox>
15613
+ <px-checkbox slot="suffix" aria-hidden="true" tabindex="-1"></px-checkbox>
15561
15614
  <slot name="label" slot="label"></slot>
15562
15615
  <slot name="description" slot="description"></slot>
15563
15616
  </px-tile>
@@ -15837,7 +15890,7 @@ class TileRadio extends WithExtraAttributes {
15837
15890
  <div class="tile-radio">
15838
15891
  <px-tile hoverable>
15839
15892
  <slot name="prefix" slot="prefix"></slot>
15840
- <px-radio slot="suffix" inert></px-radio>
15893
+ <px-radio slot="suffix" aria-hidden="true" tabindex="-1"></px-radio>
15841
15894
  <slot name="label" slot="label"></slot>
15842
15895
  <slot name="description" slot="description"></slot>
15843
15896
  </px-tile>
@@ -16279,7 +16332,7 @@ class TileSwitch extends WithExtraAttributes {
16279
16332
  <div class="tile-switch">
16280
16333
  <px-tile hoverable>
16281
16334
  <slot name="prefix" slot="prefix"></slot>
16282
- <px-switch slot="suffix" inert></px-switch>
16335
+ <px-switch slot="suffix" aria-hidden="true" tabindex="-1"></px-switch>
16283
16336
  <slot name="label" slot="label"></slot>
16284
16337
  <slot name="description" slot="description"></slot>
16285
16338
  </px-tile>
@@ -16894,6 +16947,7 @@ export {
16894
16947
  stateValues,
16895
16948
  statusCardStateValues,
16896
16949
  statusStateValues,
16950
+ statusValues,
16897
16951
  styleSheet$A as styleSheet,
16898
16952
  suffixButtonIconVariantValues,
16899
16953
  textalignValues,