@vaadin/overlay 24.0.0-alpha3 → 24.0.0-alpha5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/overlay",
3
- "version": "24.0.0-alpha3",
3
+ "version": "24.0.0-alpha5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,21 +34,22 @@
34
34
  "polymer"
35
35
  ],
36
36
  "dependencies": {
37
+ "@open-wc/dedupe-mixin": "^1.3.0",
37
38
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/component-base": "24.0.0-alpha3",
39
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha3",
40
- "@vaadin/vaadin-material-styles": "24.0.0-alpha3",
41
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha3"
39
+ "@vaadin/component-base": "24.0.0-alpha5",
40
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha5",
41
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha5",
42
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha5"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@esm-bundle/chai": "^4.3.4",
45
- "@vaadin/button": "24.0.0-alpha3",
46
- "@vaadin/polymer-legacy-adapter": "24.0.0-alpha3",
47
- "@vaadin/radio-group": "24.0.0-alpha3",
46
+ "@vaadin/button": "24.0.0-alpha5",
47
+ "@vaadin/polymer-legacy-adapter": "24.0.0-alpha5",
48
+ "@vaadin/radio-group": "24.0.0-alpha5",
48
49
  "@vaadin/testing-helpers": "^0.3.2",
49
- "@vaadin/text-field": "24.0.0-alpha3",
50
+ "@vaadin/text-field": "24.0.0-alpha5",
50
51
  "lit": "^2.0.0",
51
52
  "sinon": "^13.0.2"
52
53
  },
53
- "gitHead": "7a013a3c5a56abd61dd4f7773c6ec77c3541bdf2"
54
+ "gitHead": "fc0b1721eda9e39cb289b239e440fc9e29573a31"
54
55
  }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 - 2022 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { Constructor } from '@open-wc/dedupe-mixin';
7
+
8
+ export declare function PositionMixin<T extends Constructor<HTMLElement>>(base: T): Constructor<PositionMixinClass> & T;
9
+
10
+ export declare class PositionMixinClass {
11
+ /**
12
+ * The element next to which this overlay should be aligned.
13
+ * The position of the overlay relative to the positionTarget can be adjusted
14
+ * with properties `horizontalAlign`, `verticalAlign`, `noHorizontalOverlap`
15
+ * and `noVerticalOverlap`.
16
+ */
17
+ positionTarget: HTMLElement;
18
+
19
+ /**
20
+ * When `positionTarget` is set, this property defines whether to align the overlay's
21
+ * left or right side to the target element by default.
22
+ * Possible values are `start` and `end`.
23
+ * RTL is taken into account when interpreting the value.
24
+ * The overlay is automatically flipped to the opposite side when it doesn't fit into
25
+ * the default side defined by this property.
26
+ *
27
+ * @attr {start|end} horizontal-align
28
+ */
29
+ horizontalAlign: 'end' | 'start';
30
+
31
+ /**
32
+ * When `positionTarget` is set, this property defines whether to align the overlay's
33
+ * top or bottom side to the target element by default.
34
+ * Possible values are `top` and `bottom`.
35
+ * The overlay is automatically flipped to the opposite side when it doesn't fit into
36
+ * the default side defined by this property.
37
+ *
38
+ * @attr {top|bottom} vertical-align
39
+ */
40
+ verticalAlign: 'bottom' | 'top';
41
+
42
+ /**
43
+ * When `positionTarget` is set, this property defines whether the overlay should overlap
44
+ * the target element in the x-axis, or be positioned right next to it.
45
+ *
46
+ * @attr {boolean} no-horizontal-overlap
47
+ */
48
+ noHorizontalOverlap: boolean;
49
+
50
+ /**
51
+ * When `positionTarget` is set, this property defines whether the overlay should overlap
52
+ * the target element in the y-axis, or be positioned right above/below it.
53
+ *
54
+ * @attr {boolean} no-vertical-overlap
55
+ */
56
+ noVerticalOverlap: boolean;
57
+ }
@@ -50,6 +50,8 @@ export const PositionMixin = (superClass) =>
50
50
  * RTL is taken into account when interpreting the value.
51
51
  * The overlay is automatically flipped to the opposite side when it doesn't fit into
52
52
  * the default side defined by this property.
53
+ *
54
+ * @attr {start|end} horizontal-align
53
55
  */
54
56
  horizontalAlign: {
55
57
  type: String,
@@ -62,6 +64,8 @@ export const PositionMixin = (superClass) =>
62
64
  * Possible values are `top` and `bottom`.
63
65
  * The overlay is automatically flipped to the opposite side when it doesn't fit into
64
66
  * the default side defined by this property.
67
+ *
68
+ * @attr {top|bottom} vertical-align
65
69
  */
66
70
  verticalAlign: {
67
71
  type: String,
@@ -71,6 +75,8 @@ export const PositionMixin = (superClass) =>
71
75
  /**
72
76
  * When `positionTarget` is set, this property defines whether the overlay should overlap
73
77
  * the target element in the x-axis, or be positioned right next to it.
78
+ *
79
+ * @attr {boolean} no-horizontal-overlap
74
80
  */
75
81
  noHorizontalOverlap: {
76
82
  type: Boolean,
@@ -80,6 +86,8 @@ export const PositionMixin = (superClass) =>
80
86
  /**
81
87
  * When `positionTarget` is set, this property defines whether the overlay should overlap
82
88
  * the target element in the y-axis, or be positioned right above/below it.
89
+ *
90
+ * @attr {boolean} no-vertical-overlap
83
91
  */
84
92
  noVerticalOverlap: {
85
93
  type: Boolean,
@@ -170,10 +178,6 @@ export const PositionMixin = (superClass) =>
170
178
  }
171
179
  }
172
180
 
173
- get __isRTL() {
174
- return this.getAttribute('dir') === 'rtl';
175
- }
176
-
177
181
  __positionSettingsChanged() {
178
182
  this._updatePosition();
179
183
  }
@@ -197,9 +201,9 @@ export const PositionMixin = (superClass) =>
197
201
  const shouldAlignStartVertically = this.__shouldAlignStartVertically(targetRect);
198
202
  this.style.justifyContent = shouldAlignStartVertically ? 'flex-start' : 'flex-end';
199
203
 
200
- const shouldAlignStartHorizontally = this.__shouldAlignStartHorizontally(targetRect, this.__isRTL);
201
- const flexStart =
202
- (!this.__isRTL && shouldAlignStartHorizontally) || (this.__isRTL && !shouldAlignStartHorizontally);
204
+ const isRTL = this.__isRTL;
205
+ const shouldAlignStartHorizontally = this.__shouldAlignStartHorizontally(targetRect, isRTL);
206
+ const flexStart = (!isRTL && shouldAlignStartHorizontally) || (isRTL && !shouldAlignStartHorizontally);
203
207
  this.style.alignItems = flexStart ? 'flex-start' : 'flex-end';
204
208
 
205
209
  // Get the overlay rect after possible overlay alignment changes