@proximus/lavender-dropdown 1.4.17-beta.1 → 1.4.17-beta.3

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