@proximus/lavender-dropdown 1.4.18-beta.1 → 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,13 +1,14 @@
1
- import { WithExtraAttributes as e, booleanPropertyToAttributeSetter as t, log as n, propertyToAttributeSetter as r, renderTemplate as i } from "@proximus/lavender-common";
2
- // 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 0 4px #2525251f,0 2px 8px #2525251a,0 4px 12px #25252524,0 16px 40px #2525252e}: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 = [
1
+ import { WithExtraAttributes as e, log as t, propertyToAttributeSetter as n, renderTemplate as r } from "@proximus/lavender-common";
2
+ //#region src/dropdown.css?inline
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",
7
7
  "bottom-right"
8
8
  ];
9
- // src/anchorPolyfill.ts
10
- function s(e, t, n = "bottom-left", r, i = !1) {
9
+ //#endregion
10
+ //#region src/anchorPolyfill.ts
11
+ function o(e, t, n = "bottom-left", r, i = !1) {
11
12
  "anchorName" in document.documentElement.style && i === !1 || t.addEventListener("toggle", () => {
12
13
  if (!e || !t) return;
13
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", ""));
@@ -15,10 +16,11 @@ function s(e, t, n = "bottom-left", r, i = !1) {
15
16
  });
16
17
  }
17
18
  /* v8 ignore end */
18
- // src/Dropdown.ts
19
- var c = new CSSStyleSheet();
20
- c.replaceSync(a);
21
- var l = "bottom-left", u = class extends e {
19
+ //#endregion
20
+ //#region src/Dropdown.ts
21
+ var s = new CSSStyleSheet();
22
+ s.replaceSync(i);
23
+ var c = "bottom-left", l = class extends e {
22
24
  get css() {
23
25
  return `::slotted([slot='trigger']) {
24
26
  anchor-name: ${this.anchorName};
@@ -34,20 +36,20 @@ var l = "bottom-left", u = class extends e {
34
36
  ::slotted([slot="popover"]) {
35
37
  position-anchor: ${this.anchorName};
36
38
  top: anchor(${this.anchorName} bottom);
37
- right: anchor(${this.anchorName} right);
39
+ right: calc(anchor(${this.anchorName} right) - var(--px-size-icon-xs));
38
40
  }
39
41
  }
40
42
  :host([anchoralignment="top-left"]) {
41
43
  ::slotted([slot="popover"]) {
42
44
  position-anchor: ${this.anchorName};
43
- bottom: anchor(${this.anchorName} top);
45
+ bottom: calc( var(--px-padding-s-mobile) + anchor(${this.anchorName} top));
44
46
  left: anchor(${this.anchorName} left);
45
47
  }
46
48
  }
47
49
  :host([anchoralignment="top-right"]) {
48
50
  ::slotted([slot="popover"]) {
49
51
  position-anchor: ${this.anchorName};
50
- bottom: anchor(${this.anchorName} top);
52
+ bottom: calc( var(--px-padding-s-mobile) + anchor(${this.anchorName} top));
51
53
  right: anchor(${this.anchorName} right);
52
54
  }
53
55
  }`;
@@ -59,14 +61,11 @@ var l = "bottom-left", u = class extends e {
59
61
  "anchoralignment",
60
62
  "use-polyfill",
61
63
  "manual-toggle",
62
- "popover-height",
63
- "popover-max-height",
64
- "popover-max-width",
65
- "inverted"
64
+ "popover-height"
66
65
  ];
67
66
  }
68
67
  constructor() {
69
- super(c), this.template = () => `
68
+ super(s), this.template = () => `
70
69
  <style>${this.css}</style>
71
70
  <slot name="trigger"></slot>
72
71
  <slot name="popover"></slot>`, this.isAboutToClose = !1, this.triggerPopoverDisplay = () => {
@@ -81,10 +80,10 @@ var l = "bottom-left", u = class extends e {
81
80
  this.$popoverElement.matches(":popover-open") || setTimeout(() => {
82
81
  this.isAboutToClose = !1;
83
82
  });
84
- }, i(this.shadowRoot, this.template());
83
+ }, r(this.shadowRoot, this.template());
85
84
  }
86
85
  connectedCallback() {
87
- 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);
88
87
  }
89
88
  #e() {
90
89
  this.isAboutToClose = !1, this.manualToggle || this.$trigger.removeEventListener("click", this.triggerPopoverDisplay), this.$popoverElement.removeEventListener("beforetoggle", this.#t), this.$popoverElement.removeEventListener("toggle", this.#n);
@@ -100,27 +99,20 @@ var l = "bottom-left", u = class extends e {
100
99
  this.initPopover();
101
100
  break;
102
101
  case "use-polyfill":
103
- s(this.$trigger, this.$popoverElement, this.anchorAlignment, getComputedStyle(this), this.usePolyfill);
102
+ o(this.$trigger, this.$popoverElement, this.anchorAlignment, getComputedStyle(this), this.usePolyfill);
104
103
  break;
105
104
  case "manual-toggle":
106
105
  n != null && this.$trigger?.removeAttribute("aria-expanded");
107
106
  break;
108
107
  case "popover-height":
109
- case "popover-max-height":
110
- this.updatePopoverMaxHeight(n);
111
- break;
112
- case "popover-max-width":
113
- this.updatePopoverMaxWidth(n);
108
+ this.updatePopoverHeight(n);
114
109
  break;
115
110
  default: super.attributeChangedCallback(e, t, n);
116
111
  }
117
112
  }
118
- updatePopoverMaxHeight(e) {
113
+ updatePopoverHeight(e) {
119
114
  e ? this.$popoverElement.style.setProperty("--px-popover-max-height", e) : this.$popoverElement.style.removeProperty("--px-popover-max-height");
120
115
  }
121
- updatePopoverMaxWidth(e) {
122
- e ? this.$popoverElement.style.setProperty("--px-popover-max-width", e) : this.$popoverElement.style.removeProperty("--px-popover-max-width");
123
- }
124
116
  initPopover() {
125
117
  if (this.$trigger) {
126
118
  this.$trigger.setAttribute("popovertarget", this.popoverId);
@@ -144,10 +136,10 @@ var l = "bottom-left", u = class extends e {
144
136
  return this.querySelector("[slot=\"popover\"]");
145
137
  }
146
138
  get anchorAlignment() {
147
- return this.getAttribute("anchoralignment") || l;
139
+ return this.getAttribute("anchoralignment") || c;
148
140
  }
149
141
  set anchorAlignment(e) {
150
- 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));
151
143
  }
152
144
  get usePolyfill() {
153
145
  return this.hasAttribute("use-polyfill");
@@ -165,26 +157,9 @@ var l = "bottom-left", u = class extends e {
165
157
  return this.getAttribute("popover-height");
166
158
  }
167
159
  set popoverHeight(e) {
168
- r(this, "popover-height", e);
169
- }
170
- get popoverMaxHeight() {
171
- return this.getAttribute("popover-max-height");
172
- }
173
- set popoverMaxHeight(e) {
174
- r(this, "popover-max-height", e);
175
- }
176
- get popoverMaxWidth() {
177
- return this.getAttribute("popover-max-width");
178
- }
179
- set popoverMaxWidth(e) {
180
- r(this, "popover-max-width", e);
181
- }
182
- get inverted() {
183
- return this.hasAttribute("inverted");
184
- }
185
- set inverted(e) {
186
- t(this, "inverted", e);
160
+ n(this, "popover-height", e);
187
161
  }
188
162
  };
189
- customElements.get("px-dropdown") || customElements.define("px-dropdown", u);
190
- export { u as Dropdown };
163
+ customElements.get("px-dropdown") || customElements.define("px-dropdown", l);
164
+ //#endregion
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,24 +1,21 @@
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-beta.1",
4
+ "version": "1.4.18",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "px-dropdown",
11
- "description": "\n---\n",
11
+ "description": "\n\n---\n",
12
12
  "doc-url": "",
13
13
  "attributes": [
14
14
  { "name": "id", "value": { "type": "string" } },
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-beta.1",
3
+ "version": "1.4.18",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",