@proximus/lavender-dropdown 1.4.18-alpha.9 → 1.4.18

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.
@@ -17,8 +17,7 @@ export declare class Dropdown extends WithExtraAttributes {
17
17
  showPopover: () => void;
18
18
  hidePopover: () => void;
19
19
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
20
- updatePopoverMaxHeight(newValue?: string): void;
21
- updatePopoverMaxWidth(newValue?: string): void;
20
+ updatePopoverHeight(newValue?: string): void;
22
21
  private initPopover;
23
22
  private get popoverId();
24
23
  private get anchorName();
@@ -33,10 +32,4 @@ export declare class Dropdown extends WithExtraAttributes {
33
32
  set manualToggle(value: boolean);
34
33
  get popoverHeight(): string | null;
35
34
  set popoverHeight(value: string | null);
36
- get popoverMaxHeight(): string | null;
37
- set popoverMaxHeight(value: string | null);
38
- get popoverMaxWidth(): string | null;
39
- set popoverMaxWidth(value: string | null);
40
- get inverted(): boolean;
41
- set inverted(value: boolean);
42
35
  }
@@ -67,20 +67,7 @@
67
67
  },
68
68
  {
69
69
  "kind": "method",
70
- "name": "updatePopoverMaxHeight",
71
- "parameters": [
72
- {
73
- "name": "newValue",
74
- "optional": true,
75
- "type": {
76
- "text": "string"
77
- }
78
- }
79
- ]
80
- },
81
- {
82
- "kind": "method",
83
- "name": "updatePopoverMaxWidth",
70
+ "name": "updatePopoverHeight",
84
71
  "parameters": [
85
72
  {
86
73
  "name": "newValue",
@@ -142,18 +129,6 @@
142
129
  {
143
130
  "kind": "field",
144
131
  "name": "popoverHeight"
145
- },
146
- {
147
- "kind": "field",
148
- "name": "popoverMaxHeight"
149
- },
150
- {
151
- "kind": "field",
152
- "name": "popoverMaxWidth"
153
- },
154
- {
155
- "kind": "field",
156
- "name": "inverted"
157
132
  }
158
133
  ],
159
134
  "attributes": [
@@ -171,15 +146,6 @@
171
146
  },
172
147
  {
173
148
  "name": "popover-height"
174
- },
175
- {
176
- "name": "popover-max-height"
177
- },
178
- {
179
- "name": "popover-max-width"
180
- },
181
- {
182
- "name": "inverted"
183
149
  }
184
150
  ],
185
151
  "superclass": {
package/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
- import { WithExtraAttributes as e, booleanPropertyToAttributeSetter as t, log as n, propertyToAttributeSetter as r, renderTemplate as i } from "@proximus/lavender-common";
1
+ import { WithExtraAttributes as e, log as t, propertyToAttributeSetter as n, renderTemplate as r } from "@proximus/lavender-common";
2
2
  //#region src/dropdown.css?inline
3
- var a = ":host{position:relative}::slotted([slot=popover]){border-radius:var(--px-radius-main,8px);background:var(--px-color-background-surface-light,#fff);margin:var(--px-spacing-xs-mobile) 0 0 0;width:auto;max-height:var(--px-popover-max-height);max-width:var(--px-popover-max-width);border:0;padding:0;position:fixed;right:0;box-shadow:0 20px 25px -5px #25252514}:host([grow]) ::slotted([slot=trigger]):after{padding-right:var(--px-padding-xs-mobile);right:0}:host([anchoralignment=top-left]) ::slotted([slot=popover]){margin:0 0 var(--px-spacing-xs-mobile) 0;top:auto}:host([anchoralignment=top-right]) ::slotted([slot=popover]){margin:0 0 var(--px-spacing-xs-mobile) 0;top:auto;left:auto}:host([anchoralignment=bottom-right]) ::slotted([slot=popover]){margin:var(--px-spacing-xs-mobile) 0 0 0;left:auto}@media screen and (width<=47.938rem){::slotted([slot=trigger]){width:100%;display:block}:host([anchoralignment=top-left]) ::slotted([slot=popover]){left:var(--px-padding-s-mobile)}:host([anchoralignment=top-right]) ::slotted([slot=popover]){left:var(--px-padding-s-mobile)}}@media screen and (width>=48rem){::slotted([slot=popover]){margin:var(--px-spacing-xs-tablet) 0 0 0;width:auto;padding:0;right:auto}:host([anchoralignment=top-left]) ::slotted([slot=popover]){margin:0 0 var(--px-spacing-xs-tablet) 0}:host([anchoralignment=top-right]) ::slotted([slot=popover]){margin:0 0 var(--px-spacing-xs-tablet) 0}:host([anchoralignment=bottom-right]) ::slotted([slot=popover]){margin:var(--px-spacing-xs-tablet) 0 0 0}}@media screen and (width>=64.0625rem){::slotted([slot=popover]){margin:var(--px-spacing-xs-desktop) 0 0 0;width:auto;padding:0;right:auto}}@media screen and (width>=90.0625rem){::slotted([slot=popover]){width:auto;padding:0;right:auto}:host([anchoralignment=bottom-right]) ::slotted([slot=popover]){margin:var(--px-spacing-xs-desktop) 0 0 0}:host([anchoralignment=top-left]) ::slotted([slot=popover]){margin:0 0 var(--px-spacing-xs-desktop) 0}:host([anchoralignment=top-right]) ::slotted([slot=popover]){margin:0 0 var(--px-spacing-xs-desktop) 0}}:host([inverted]) ::slotted([slot=popover]){background:var(--px-color-background-surface-dark,#333)}", o = [
3
+ var i = ":host{position:relative}::slotted([slot=popover]){border-radius:var(--px-radius-main,8px);background:var(--px-color-background-container-light-default,#fff);padding:var(--px-padding-xs-mobile) 0;width:auto;max-height:var(--px-popover-max-height);border:0;margin:0;position:fixed;right:0;box-shadow:0 20px 25px -5px #25252514}:host([grow]) ::slotted([slot=trigger]):after{padding-right:var(--px-padding-xs-mobile);right:0}:host([anchoralignment=top-left]) ::slotted([slot=popover]){top:auto}:host([anchoralignment=top-right]) ::slotted([slot=popover]){top:auto}:host([anchoralignment=bottom-right]) ::slotted([slot=popover]){left:auto}@media screen and (width<=47.938rem){::slotted([slot=trigger]){width:100%;display:block}:host([anchoralignment=top-left]) ::slotted([slot=popover]){left:var(--px-padding-s-mobile)}:host([anchoralignment=top-right]) ::slotted([slot=popover]){left:var(--px-padding-s-mobile)}}@media screen and (width>=48rem){::slotted([slot=popover]){padding-block:var(--px-padding-s-desktop);width:auto;right:auto}}", a = [
4
4
  "top-left",
5
5
  "top-right",
6
6
  "bottom-left",
@@ -8,7 +8,7 @@ var a = ":host{position:relative}::slotted([slot=popover]){border-radius:var(--p
8
8
  ];
9
9
  //#endregion
10
10
  //#region src/anchorPolyfill.ts
11
- function s(e, t, n = "bottom-left", r, i = !1) {
11
+ function o(e, t, n = "bottom-left", r, i = !1) {
12
12
  "anchorName" in document.documentElement.style && i === !1 || t.addEventListener("toggle", () => {
13
13
  if (!e || !t) return;
14
14
  let i = e.getBoundingClientRect(), a = window.visualViewport?.height ?? window.innerHeight, o = window.visualViewport?.width ?? window.innerWidth, s = r.getPropertyValue("--px-padding-s-mobile") || "16px", c = parseInt((r.getPropertyValue("--px-icon-size-xs-desktop") || "24").replace("px", ""));
@@ -18,9 +18,9 @@ function s(e, t, n = "bottom-left", r, i = !1) {
18
18
  /* v8 ignore end */
19
19
  //#endregion
20
20
  //#region src/Dropdown.ts
21
- var c = new CSSStyleSheet();
22
- c.replaceSync(a);
23
- var l = "bottom-left", u = class extends e {
21
+ var s = new CSSStyleSheet();
22
+ s.replaceSync(i);
23
+ var c = "bottom-left", l = class extends e {
24
24
  get css() {
25
25
  return `::slotted([slot='trigger']) {
26
26
  anchor-name: ${this.anchorName};
@@ -36,20 +36,20 @@ var l = "bottom-left", u = class extends e {
36
36
  ::slotted([slot="popover"]) {
37
37
  position-anchor: ${this.anchorName};
38
38
  top: anchor(${this.anchorName} bottom);
39
- right: anchor(${this.anchorName} right);
39
+ right: calc(anchor(${this.anchorName} right) - var(--px-size-icon-xs));
40
40
  }
41
41
  }
42
42
  :host([anchoralignment="top-left"]) {
43
43
  ::slotted([slot="popover"]) {
44
44
  position-anchor: ${this.anchorName};
45
- bottom: anchor(${this.anchorName} top);
45
+ bottom: calc( var(--px-padding-s-mobile) + anchor(${this.anchorName} top));
46
46
  left: anchor(${this.anchorName} left);
47
47
  }
48
48
  }
49
49
  :host([anchoralignment="top-right"]) {
50
50
  ::slotted([slot="popover"]) {
51
51
  position-anchor: ${this.anchorName};
52
- bottom: anchor(${this.anchorName} top);
52
+ bottom: calc( var(--px-padding-s-mobile) + anchor(${this.anchorName} top));
53
53
  right: anchor(${this.anchorName} right);
54
54
  }
55
55
  }`;
@@ -61,14 +61,11 @@ var l = "bottom-left", u = class extends e {
61
61
  "anchoralignment",
62
62
  "use-polyfill",
63
63
  "manual-toggle",
64
- "popover-height",
65
- "popover-max-height",
66
- "popover-max-width",
67
- "inverted"
64
+ "popover-height"
68
65
  ];
69
66
  }
70
67
  constructor() {
71
- super(c), this.template = () => `
68
+ super(s), this.template = () => `
72
69
  <style>${this.css}</style>
73
70
  <slot name="trigger"></slot>
74
71
  <slot name="popover"></slot>`, this.isAboutToClose = !1, this.triggerPopoverDisplay = () => {
@@ -83,10 +80,10 @@ var l = "bottom-left", u = class extends e {
83
80
  this.$popoverElement.matches(":popover-open") || setTimeout(() => {
84
81
  this.isAboutToClose = !1;
85
82
  });
86
- }, i(this.shadowRoot, this.template());
83
+ }, r(this.shadowRoot, this.template());
87
84
  }
88
85
  connectedCallback() {
89
- this.getAttribute("id") || this.setAttribute("id", `px-dropdown-${Math.random().toString(36).substring(2, 15)}`), this.getAttribute("anchoralignment") || this.setAttribute("anchoralignment", l), s(this.$trigger, this.$popoverElement, this.anchorAlignment, getComputedStyle(this), this.usePolyfill);
86
+ this.getAttribute("id") || this.setAttribute("id", `px-dropdown-${Math.random().toString(36).substring(2, 15)}`), this.getAttribute("anchoralignment") || this.setAttribute("anchoralignment", c), o(this.$trigger, this.$popoverElement, this.anchorAlignment, getComputedStyle(this), this.usePolyfill);
90
87
  }
91
88
  #e() {
92
89
  this.isAboutToClose = !1, this.manualToggle || this.$trigger.removeEventListener("click", this.triggerPopoverDisplay), this.$popoverElement.removeEventListener("beforetoggle", this.#t), this.$popoverElement.removeEventListener("toggle", this.#n);
@@ -102,27 +99,20 @@ var l = "bottom-left", u = class extends e {
102
99
  this.initPopover();
103
100
  break;
104
101
  case "use-polyfill":
105
- s(this.$trigger, this.$popoverElement, this.anchorAlignment, getComputedStyle(this), this.usePolyfill);
102
+ o(this.$trigger, this.$popoverElement, this.anchorAlignment, getComputedStyle(this), this.usePolyfill);
106
103
  break;
107
104
  case "manual-toggle":
108
105
  n != null && this.$trigger?.removeAttribute("aria-expanded");
109
106
  break;
110
107
  case "popover-height":
111
- case "popover-max-height":
112
- this.updatePopoverMaxHeight(n);
113
- break;
114
- case "popover-max-width":
115
- this.updatePopoverMaxWidth(n);
108
+ this.updatePopoverHeight(n);
116
109
  break;
117
110
  default: super.attributeChangedCallback(e, t, n);
118
111
  }
119
112
  }
120
- updatePopoverMaxHeight(e) {
113
+ updatePopoverHeight(e) {
121
114
  e ? this.$popoverElement.style.setProperty("--px-popover-max-height", e) : this.$popoverElement.style.removeProperty("--px-popover-max-height");
122
115
  }
123
- updatePopoverMaxWidth(e) {
124
- e ? this.$popoverElement.style.setProperty("--px-popover-max-width", e) : this.$popoverElement.style.removeProperty("--px-popover-max-width");
125
- }
126
116
  initPopover() {
127
117
  if (this.$trigger) {
128
118
  this.$trigger.setAttribute("popovertarget", this.popoverId);
@@ -146,10 +136,10 @@ var l = "bottom-left", u = class extends e {
146
136
  return this.querySelector("[slot=\"popover\"]");
147
137
  }
148
138
  get anchorAlignment() {
149
- return this.getAttribute("anchoralignment") || l;
139
+ return this.getAttribute("anchoralignment") || c;
150
140
  }
151
141
  set anchorAlignment(e) {
152
- o.includes(e) ? this.setAttribute("anchoralignment", e) : (n(`Invalid anchor alignment value: ${e}. Using default ${l}.`), this.setAttribute("anchoralignment", l));
142
+ a.includes(e) ? this.setAttribute("anchoralignment", e) : (t(`Invalid anchor alignment value: ${e}. Using default ${c}.`), this.setAttribute("anchoralignment", c));
153
143
  }
154
144
  get usePolyfill() {
155
145
  return this.hasAttribute("use-polyfill");
@@ -167,27 +157,9 @@ var l = "bottom-left", u = class extends e {
167
157
  return this.getAttribute("popover-height");
168
158
  }
169
159
  set popoverHeight(e) {
170
- r(this, "popover-height", e);
171
- }
172
- get popoverMaxHeight() {
173
- return this.getAttribute("popover-max-height");
174
- }
175
- set popoverMaxHeight(e) {
176
- r(this, "popover-max-height", e);
177
- }
178
- get popoverMaxWidth() {
179
- return this.getAttribute("popover-max-width");
180
- }
181
- set popoverMaxWidth(e) {
182
- r(this, "popover-max-width", e);
183
- }
184
- get inverted() {
185
- return this.hasAttribute("inverted");
186
- }
187
- set inverted(e) {
188
- t(this, "inverted", e);
160
+ n(this, "popover-height", e);
189
161
  }
190
162
  };
191
- customElements.get("px-dropdown") || customElements.define("px-dropdown", u);
163
+ customElements.get("px-dropdown") || customElements.define("px-dropdown", l);
192
164
  //#endregion
193
- export { u as Dropdown };
165
+ export { l as Dropdown };
@@ -10,10 +10,7 @@
10
10
  { "name": "anchoralignment", "values": [] },
11
11
  { "name": "use-polyfill", "values": [] },
12
12
  { "name": "manual-toggle", "values": [] },
13
- { "name": "popover-height", "values": [] },
14
- { "name": "popover-max-height", "values": [] },
15
- { "name": "popover-max-width", "values": [] },
16
- { "name": "inverted", "values": [] }
13
+ { "name": "popover-height", "values": [] }
17
14
  ],
18
15
  "references": []
19
16
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@proximus/lavender-dropdown",
4
- "version": "1.4.18-alpha.9",
4
+ "version": "1.4.18",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -15,10 +15,7 @@
15
15
  { "name": "anchoralignment", "value": { "type": "string" } },
16
16
  { "name": "use-polyfill", "value": { "type": "string" } },
17
17
  { "name": "manual-toggle", "value": { "type": "string" } },
18
- { "name": "popover-height", "value": { "type": "string" } },
19
- { "name": "popover-max-height", "value": { "type": "string" } },
20
- { "name": "popover-max-width", "value": { "type": "string" } },
21
- { "name": "inverted", "value": { "type": "string" } }
18
+ { "name": "popover-height", "value": { "type": "string" } }
22
19
  ],
23
20
  "events": [],
24
21
  "js": {
@@ -31,10 +28,7 @@
31
28
  { "name": "anchorAlignment", "type": "AnchorAlignment" },
32
29
  { "name": "usePolyfill" },
33
30
  { "name": "manualToggle" },
34
- { "name": "popoverHeight" },
35
- { "name": "popoverMaxHeight" },
36
- { "name": "popoverMaxWidth" },
37
- { "name": "inverted" }
31
+ { "name": "popoverHeight" }
38
32
  ],
39
33
  "events": []
40
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-dropdown",
3
- "version": "1.4.18-alpha.9",
3
+ "version": "1.4.18",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",