@vaadin/popover 24.5.0-alpha3 → 24.5.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/popover",
3
- "version": "24.5.0-alpha3",
3
+ "version": "24.5.0-alpha5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,12 +35,12 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@vaadin/a11y-base": "24.5.0-alpha3",
39
- "@vaadin/component-base": "24.5.0-alpha3",
40
- "@vaadin/overlay": "24.5.0-alpha3",
41
- "@vaadin/vaadin-lumo-styles": "24.5.0-alpha3",
42
- "@vaadin/vaadin-material-styles": "24.5.0-alpha3",
43
- "@vaadin/vaadin-themable-mixin": "24.5.0-alpha3",
38
+ "@vaadin/a11y-base": "24.5.0-alpha5",
39
+ "@vaadin/component-base": "24.5.0-alpha5",
40
+ "@vaadin/overlay": "24.5.0-alpha5",
41
+ "@vaadin/vaadin-lumo-styles": "24.5.0-alpha5",
42
+ "@vaadin/vaadin-material-styles": "24.5.0-alpha5",
43
+ "@vaadin/vaadin-themable-mixin": "24.5.0-alpha5",
44
44
  "lit": "^3.0.0"
45
45
  },
46
46
  "devDependencies": {
@@ -52,5 +52,5 @@
52
52
  "web-types.json",
53
53
  "web-types.lit.json"
54
54
  ],
55
- "gitHead": "9ccd96c77a1568e625fa44f6809e765c0ba91403"
55
+ "gitHead": "4e57d240ababf0c2db9d674891b90bdf3812e6ae"
56
56
  }
@@ -22,6 +22,8 @@ export type PopoverOpenedChangedEvent = CustomEvent<{ value: boolean }>;
22
22
 
23
23
  export interface PopoverCustomEventMap {
24
24
  'opened-changed': PopoverOpenedChangedEvent;
25
+
26
+ closed: Event;
25
27
  }
26
28
 
27
29
  export type PopoverEventMap = HTMLElementEventMap & PopoverCustomEventMap;
@@ -33,7 +35,38 @@ export type PopoverEventMap = HTMLElementEventMap & PopoverCustomEventMap;
33
35
  * Unlike `<vaadin-tooltip>`, the popover supports rich content
34
36
  * that can be provided by using `renderer` function.
35
37
  *
38
+ * ### Styling
39
+ *
40
+ * `<vaadin-popover>` uses `<vaadin-popover-overlay>` internal
41
+ * themable component as the actual visible overlay.
42
+ *
43
+ * See [`<vaadin-overlay>`](#/elements/vaadin-overlay) documentation
44
+ * for `<vaadin-popover-overlay>` parts.
45
+ *
46
+ * The following state attributes are available for styling:
47
+ *
48
+ * Attribute | Description
49
+ * -----------------|----------------------------------------
50
+ * `position` | Reflects the `position` property value.
51
+ *
52
+ * Note: the `theme` attribute value set on `<vaadin-popover>` is
53
+ * propagated to the internal `<vaadin-popover-overlay>` component.
54
+ *
55
+ * ### Custom CSS Properties
56
+ *
57
+ * The following custom CSS properties are available on the `<vaadin-popover>` element:
58
+ *
59
+ * Custom CSS property | Description
60
+ * ---------------------------------|-------------
61
+ * `--vaadin-popover-offset-top` | Used as an offset when the popover is aligned vertically below the target
62
+ * `--vaadin-popover-offset-bottom` | Used as an offset when the popover is aligned vertically above the target
63
+ * `--vaadin-popover-offset-start` | Used as an offset when the popover is aligned horizontally after the target
64
+ * `--vaadin-popover-offset-end` | Used as an offset when the popover is aligned horizontally before the target
65
+ *
66
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
67
+ *
36
68
  * @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
69
+ * @fires {CustomEvent} closed - Fired when the popover is closed.
37
70
  */
38
71
  declare class Popover extends PopoverPositionMixin(
39
72
  PopoverTargetMixin(OverlayClassMixin(ThemePropertyMixin(ElementMixin(HTMLElement)))),
@@ -12,6 +12,7 @@ import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
12
12
  import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
13
13
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
14
14
  import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
15
+ import { isLastOverlay } from '@vaadin/overlay/src/vaadin-overlay-stack-mixin.js';
15
16
  import { ThemePropertyMixin } from '@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js';
16
17
  import { PopoverPositionMixin } from './vaadin-popover-position-mixin.js';
17
18
  import { PopoverTargetMixin } from './vaadin-popover-target-mixin.js';
@@ -130,7 +131,38 @@ class PopoverOpenedStateController {
130
131
  * Unlike `<vaadin-tooltip>`, the popover supports rich content
131
132
  * that can be provided by using `renderer` function.
132
133
  *
134
+ * ### Styling
135
+ *
136
+ * `<vaadin-popover>` uses `<vaadin-popover-overlay>` internal
137
+ * themable component as the actual visible overlay.
138
+ *
139
+ * See [`<vaadin-overlay>`](#/elements/vaadin-overlay) documentation
140
+ * for `<vaadin-popover-overlay>` parts.
141
+ *
142
+ * The following state attributes are available for styling:
143
+ *
144
+ * Attribute | Description
145
+ * -----------------|----------------------------------------
146
+ * `position` | Reflects the `position` property value.
147
+ *
148
+ * Note: the `theme` attribute value set on `<vaadin-popover>` is
149
+ * propagated to the internal `<vaadin-popover-overlay>` component.
150
+ *
151
+ * ### Custom CSS Properties
152
+ *
153
+ * The following custom CSS properties are available on the `<vaadin-popover>` element:
154
+ *
155
+ * Custom CSS property | Description
156
+ * ---------------------------------|-------------
157
+ * `--vaadin-popover-offset-top` | Used as an offset when the popover is aligned vertically below the target
158
+ * `--vaadin-popover-offset-bottom` | Used as an offset when the popover is aligned vertically above the target
159
+ * `--vaadin-popover-offset-start` | Used as an offset when the popover is aligned horizontally after the target
160
+ * `--vaadin-popover-offset-end` | Used as an offset when the popover is aligned horizontally before the target
161
+ *
162
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
163
+ *
133
164
  * @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
165
+ * @fires {CustomEvent} closed - Fired when the popover is closed.
134
166
  *
135
167
  * @customElement
136
168
  * @extends HTMLElement
@@ -500,7 +532,8 @@ class Popover extends PopoverPositionMixin(
500
532
  !this.__isManual &&
501
533
  !this.modal &&
502
534
  !event.composedPath().some((el) => el === this._overlayElement || el === this.target) &&
503
- !this.noCloseOnOutsideClick
535
+ !this.noCloseOnOutsideClick &&
536
+ isLastOverlay(this._overlayElement)
504
537
  ) {
505
538
  this._openedStateController.close(true);
506
539
  }
@@ -526,7 +559,14 @@ class Popover extends PopoverPositionMixin(
526
559
  * @private
527
560
  */
528
561
  __onGlobalKeyDown(event) {
529
- if (event.key === 'Escape' && !this.modal && !this.noCloseOnEsc && this.opened && !this.__isManual) {
562
+ if (
563
+ event.key === 'Escape' &&
564
+ !this.modal &&
565
+ !this.noCloseOnEsc &&
566
+ this.opened &&
567
+ !this.__isManual &&
568
+ isLastOverlay(this._overlayElement)
569
+ ) {
530
570
  // Prevent closing parent overlay (e.g. dialog)
531
571
  event.stopPropagation();
532
572
  this._openedStateController.close(true);
@@ -676,6 +716,8 @@ class Popover extends PopoverPositionMixin(
676
716
  if (this.modal && this.target.style.pointerEvents) {
677
717
  this.target.style.pointerEvents = '';
678
718
  }
719
+
720
+ this.dispatchEvent(new CustomEvent('closed'));
679
721
  }
680
722
 
681
723
  /**
@@ -732,6 +774,12 @@ class Popover extends PopoverPositionMixin(
732
774
  this.__updateDimension(overlay, 'width', width);
733
775
  }
734
776
  }
777
+
778
+ /**
779
+ * Fired when the popover is closed.
780
+ *
781
+ * @event closed
782
+ */
735
783
  }
736
784
 
737
785
  defineCustomElement(Popover);
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/popover",
4
- "version": "24.5.0-alpha3",
4
+ "version": "24.5.0-alpha5",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-popover",
11
- "description": "`<vaadin-popover>` is a Web Component for creating overlays\nthat are positioned next to specified DOM element (target).\n\nUnlike `<vaadin-tooltip>`, the popover supports rich content\nthat can be provided by using `renderer` function.",
11
+ "description": "`<vaadin-popover>` is a Web Component for creating overlays\nthat are positioned next to specified DOM element (target).\n\nUnlike `<vaadin-tooltip>`, the popover supports rich content\nthat can be provided by using `renderer` function.\n\n### Styling\n\n`<vaadin-popover>` uses `<vaadin-popover-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha5/#/elements/vaadin-overlay) documentation\nfor `<vaadin-popover-overlay>` parts.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\nNote: the `theme` attribute value set on `<vaadin-popover>` is\npropagated to the internal `<vaadin-popover-overlay>` component.\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available on the `<vaadin-popover>` element:\n\nCustom CSS property | Description\n---------------------------------|-------------\n`--vaadin-popover-offset-top` | Used as an offset when the popover is aligned vertically below the target\n`--vaadin-popover-offset-bottom` | Used as an offset when the popover is aligned vertically above the target\n`--vaadin-popover-offset-start` | Used as an offset when the popover is aligned horizontally after the target\n`--vaadin-popover-offset-end` | Used as an offset when the popover is aligned horizontally before the target\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "position",
@@ -389,6 +389,10 @@
389
389
  }
390
390
  ],
391
391
  "events": [
392
+ {
393
+ "name": "closed",
394
+ "description": "Fired when the popover is closed."
395
+ },
392
396
  {
393
397
  "name": "opened-changed",
394
398
  "description": "Fired when the `opened` property changes."
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/popover",
4
- "version": "24.5.0-alpha3",
4
+ "version": "24.5.0-alpha5",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,7 +16,7 @@
16
16
  "elements": [
17
17
  {
18
18
  "name": "vaadin-popover",
19
- "description": "`<vaadin-popover>` is a Web Component for creating overlays\nthat are positioned next to specified DOM element (target).\n\nUnlike `<vaadin-tooltip>`, the popover supports rich content\nthat can be provided by using `renderer` function.",
19
+ "description": "`<vaadin-popover>` is a Web Component for creating overlays\nthat are positioned next to specified DOM element (target).\n\nUnlike `<vaadin-tooltip>`, the popover supports rich content\nthat can be provided by using `renderer` function.\n\n### Styling\n\n`<vaadin-popover>` uses `<vaadin-popover-overlay>` internal\nthemable component as the actual visible overlay.\n\nSee [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha5/#/elements/vaadin-overlay) documentation\nfor `<vaadin-popover-overlay>` parts.\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`position` | Reflects the `position` property value.\n\nNote: the `theme` attribute value set on `<vaadin-popover>` is\npropagated to the internal `<vaadin-popover-overlay>` component.\n\n### Custom CSS Properties\n\nThe following custom CSS properties are available on the `<vaadin-popover>` element:\n\nCustom CSS property | Description\n---------------------------------|-------------\n`--vaadin-popover-offset-top` | Used as an offset when the popover is aligned vertically below the target\n`--vaadin-popover-offset-bottom` | Used as an offset when the popover is aligned vertically above the target\n`--vaadin-popover-offset-start` | Used as an offset when the popover is aligned horizontally after the target\n`--vaadin-popover-offset-end` | Used as an offset when the popover is aligned horizontally before the target\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -145,6 +145,13 @@
145
145
  "kind": "expression"
146
146
  }
147
147
  },
148
+ {
149
+ "name": "@closed",
150
+ "description": "Fired when the popover is closed.",
151
+ "value": {
152
+ "kind": "expression"
153
+ }
154
+ },
148
155
  {
149
156
  "name": "@opened-changed",
150
157
  "description": "Fired when the `opened` property changes.",