@vaadin/popover 24.5.0-alpha1 → 24.5.0-alpha11

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.
@@ -1,17 +1,108 @@
1
+ import '@vaadin/vaadin-material-styles/color.js';
1
2
  import { overlay } from '@vaadin/vaadin-material-styles/mixins/overlay.js';
2
3
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
4
 
4
5
  const popoverOverlay = css`
5
6
  :host {
6
- --vaadin-popover-offset-top: 0.25rem;
7
- --vaadin-popover-offset-bottom: 0.25rem;
8
- --vaadin-popover-offset-start: 0.25rem;
9
- --vaadin-popover-offset-end: 0.25rem;
7
+ --vaadin-popover-offset-top: var(--_vaadin-popover-default-offset);
8
+ --vaadin-popover-offset-bottom: var(--_vaadin-popover-default-offset);
9
+ --vaadin-popover-offset-start: var(--_vaadin-popover-default-offset);
10
+ --vaadin-popover-offset-end: var(--_vaadin-popover-default-offset);
11
+ --vaadin-popover-arrow-size: 0.5rem;
12
+ --_vaadin-popover-default-offset: 0.25rem;
13
+ }
14
+
15
+ [part='overlay'] {
16
+ outline: none;
10
17
  }
11
18
 
12
19
  [part='content'] {
13
20
  padding: 0.25rem 0.5rem;
14
21
  }
22
+
23
+ :host([theme~='no-padding']) [part='content'] {
24
+ padding: 0;
25
+ }
26
+
27
+ :host([theme~='arrow']) {
28
+ --_vaadin-popover-default-offset: calc(0.25rem + var(--vaadin-popover-arrow-size) / 1.25);
29
+ }
30
+
31
+ /* top / bottom position */
32
+ :host([theme~='arrow'][position^='top']) [part='arrow'],
33
+ :host([theme~='arrow'][position^='bottom']) [part='arrow'] {
34
+ border-left: var(--vaadin-popover-arrow-size) solid transparent;
35
+ border-right: var(--vaadin-popover-arrow-size) solid transparent;
36
+ }
37
+
38
+ :host([theme~='arrow'][position^='bottom'][bottom-aligned]) [part='arrow'],
39
+ :host([theme~='arrow'][position^='top'][bottom-aligned]) [part='arrow'] {
40
+ bottom: calc(var(--vaadin-popover-arrow-size) * -1);
41
+ border-top: var(--vaadin-popover-arrow-size) solid var(--material-background-color);
42
+ filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.14));
43
+ }
44
+
45
+ :host([theme~='arrow'][position^='bottom'][top-aligned]) [part='arrow'],
46
+ :host([theme~='arrow'][position^='top'][top-aligned]) [part='arrow'] {
47
+ top: calc(var(--vaadin-popover-arrow-size) * -1);
48
+ border-bottom: var(--vaadin-popover-arrow-size) solid var(--material-background-color);
49
+ filter: drop-shadow(0 -2px 1px rgba(0, 0, 0, 0.14));
50
+ }
51
+
52
+ :host([theme~='arrow'][position^='bottom'][start-aligned]) [part='arrow'],
53
+ :host([theme~='arrow'][position^='top'][start-aligned]) [part='arrow'] {
54
+ transform: translateX(-50%);
55
+ inset-inline-start: 1.5rem;
56
+ }
57
+
58
+ :host([theme~='arrow'][position^='bottom'][end-aligned]) [part='arrow'],
59
+ :host([theme~='arrow'][position^='top'][end-aligned]) [part='arrow'] {
60
+ transform: translateX(50%);
61
+ inset-inline-end: 1.5rem;
62
+ }
63
+
64
+ :host([theme~='arrow'][position^='bottom'][arrow-centered]) [part='arrow'],
65
+ :host([theme~='arrow'][position^='top'][arrow-centered]) [part='arrow'] {
66
+ transform: translateX(-50%);
67
+ inset-inline-start: 50%;
68
+ }
69
+
70
+ /* start / end position */
71
+ :host([theme~='arrow'][position^='start']) [part='arrow'],
72
+ :host([theme~='arrow'][position^='end']) [part='arrow'] {
73
+ border-top: var(--vaadin-popover-arrow-size) solid transparent;
74
+ border-bottom: var(--vaadin-popover-arrow-size) solid transparent;
75
+ }
76
+
77
+ :host([theme~='arrow'][position^='start'][start-aligned]) [part='arrow'],
78
+ :host([theme~='arrow'][position^='end'][start-aligned]) [part='arrow'] {
79
+ inset-inline-start: calc(var(--vaadin-popover-arrow-size) * -1);
80
+ border-right: var(--vaadin-popover-arrow-size) solid var(--material-background-color);
81
+ filter: drop-shadow(-2px 0 1px rgba(0, 0, 0, 0.14));
82
+ }
83
+
84
+ :host([theme~='arrow'][position^='start'][end-aligned]) [part='arrow'],
85
+ :host([theme~='arrow'][position^='end'][end-aligned]) [part='arrow'] {
86
+ inset-inline-end: calc(var(--vaadin-popover-arrow-size) * -1);
87
+ border-left: var(--vaadin-popover-arrow-size) solid var(--material-background-color);
88
+ filter: drop-shadow(2px 0 1px rgba(0, 0, 0, 0.14));
89
+ }
90
+
91
+ :host([theme~='arrow'][position^='start'][top-aligned]) [part='arrow'],
92
+ :host([theme~='arrow'][position^='end'][top-aligned]) [part='arrow'] {
93
+ top: 0.5rem;
94
+ }
95
+
96
+ :host([theme~='arrow'][position='start'][top-aligned]) [part='arrow'],
97
+ :host([theme~='arrow'][position='end'][top-aligned]) [part='arrow'] {
98
+ top: 50%;
99
+ transform: translateY(-50%);
100
+ }
101
+
102
+ :host([theme~='arrow'][position^='start'][bottom-aligned]) [part='arrow'],
103
+ :host([theme~='arrow'][position^='end'][bottom-aligned]) [part='arrow'] {
104
+ bottom: 0.5rem;
105
+ }
15
106
  `;
16
107
 
17
108
  registerStyles('vaadin-popover-overlay', [overlay, popoverOverlay], { moduleId: 'material-popover-overlay' });
package/web-types.json CHANGED
@@ -1,15 +1,26 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/popover",
4
- "version": "24.5.0-alpha1",
4
+ "version": "24.5.0-alpha11",
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-alpha11/#/elements/vaadin-overlay) documentation\nfor `<vaadin-popover-overlay>` parts.\n\nIn addition to `<vaadin-overlay>` parts, the following parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\n`arrow` | Optional arrow pointing to the target when using `theme=\"arrow\"`\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
+ {
14
+ "name": "overlay-class",
15
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
16
+ "value": {
17
+ "type": [
18
+ "string",
19
+ "null",
20
+ "undefined"
21
+ ]
22
+ }
23
+ },
13
24
  {
14
25
  "name": "position",
15
26
  "description": "Position of the overlay with respect to the target.\nSupported values: `top-start`, `top`, `top-end`,\n`bottom-start`, `bottom`, `bottom-end`, `start-top`,\n`start`, `start-bottom`, `end-top`, `end`, `end-bottom`.",
@@ -54,6 +65,17 @@
54
65
  ]
55
66
  }
56
67
  },
68
+ {
69
+ "name": "autofocus",
70
+ "description": "When true, the popover content automatically receives focus after\nit is opened. Modal popovers use this behavior by default.",
71
+ "value": {
72
+ "type": [
73
+ "boolean",
74
+ "null",
75
+ "undefined"
76
+ ]
77
+ }
78
+ },
57
79
  {
58
80
  "name": "content-height",
59
81
  "description": "Height to be set on the overlay content.",
@@ -78,7 +100,7 @@
78
100
  },
79
101
  {
80
102
  "name": "focus-delay",
81
- "description": "The delay in milliseconds before the popover is opened\non focus when the corresponding trigger is used.",
103
+ "description": "The delay in milliseconds before the popover is opened\non focus when the corresponding trigger is used.\n\nWhen not specified, the global default (500ms) is used.",
82
104
  "value": {
83
105
  "type": [
84
106
  "number",
@@ -89,7 +111,7 @@
89
111
  },
90
112
  {
91
113
  "name": "hide-delay",
92
- "description": "The delay in milliseconds before the popover is closed\non losing hover, when the corresponding trigger is used.\nOn blur, the popover is closed immediately.",
114
+ "description": "The delay in milliseconds before the popover is closed\non losing hover, when the corresponding trigger is used.\nOn blur, the popover is closed immediately.\n\nWhen not specified, the global default (500ms) is used.",
93
115
  "value": {
94
116
  "type": [
95
117
  "number",
@@ -100,7 +122,7 @@
100
122
  },
101
123
  {
102
124
  "name": "hover-delay",
103
- "description": "The delay in milliseconds before the popover is opened\non hover when the corresponding trigger is used.",
125
+ "description": "The delay in milliseconds before the popover is opened\non hover when the corresponding trigger is used.\n\nWhen not specified, the global default (500ms) is used.",
104
126
  "value": {
105
127
  "type": [
106
128
  "number",
@@ -189,6 +211,17 @@
189
211
  ],
190
212
  "js": {
191
213
  "properties": [
214
+ {
215
+ "name": "overlayClass",
216
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
217
+ "value": {
218
+ "type": [
219
+ "string",
220
+ "null",
221
+ "undefined"
222
+ ]
223
+ }
224
+ },
192
225
  {
193
226
  "name": "position",
194
227
  "description": "Position of the overlay with respect to the target.\nSupported values: `top-start`, `top`, `top-end`,\n`bottom-start`, `bottom`, `bottom-end`, `start-top`,\n`start`, `start-bottom`, `end-top`, `end`, `end-bottom`.",
@@ -244,6 +277,17 @@
244
277
  ]
245
278
  }
246
279
  },
280
+ {
281
+ "name": "autofocus",
282
+ "description": "When true, the popover content automatically receives focus after\nit is opened. Modal popovers use this behavior by default.",
283
+ "value": {
284
+ "type": [
285
+ "boolean",
286
+ "null",
287
+ "undefined"
288
+ ]
289
+ }
290
+ },
247
291
  {
248
292
  "name": "contentHeight",
249
293
  "description": "Height to be set on the overlay content.",
@@ -268,7 +312,7 @@
268
312
  },
269
313
  {
270
314
  "name": "focusDelay",
271
- "description": "The delay in milliseconds before the popover is opened\non focus when the corresponding trigger is used.",
315
+ "description": "The delay in milliseconds before the popover is opened\non focus when the corresponding trigger is used.\n\nWhen not specified, the global default (500ms) is used.",
272
316
  "value": {
273
317
  "type": [
274
318
  "number",
@@ -279,7 +323,7 @@
279
323
  },
280
324
  {
281
325
  "name": "hideDelay",
282
- "description": "The delay in milliseconds before the popover is closed\non losing hover, when the corresponding trigger is used.\nOn blur, the popover is closed immediately.",
326
+ "description": "The delay in milliseconds before the popover is closed\non losing hover, when the corresponding trigger is used.\nOn blur, the popover is closed immediately.\n\nWhen not specified, the global default (500ms) is used.",
283
327
  "value": {
284
328
  "type": [
285
329
  "number",
@@ -290,7 +334,7 @@
290
334
  },
291
335
  {
292
336
  "name": "hoverDelay",
293
- "description": "The delay in milliseconds before the popover is opened\non hover when the corresponding trigger is used.",
337
+ "description": "The delay in milliseconds before the popover is opened\non hover when the corresponding trigger is used.\n\nWhen not specified, the global default (500ms) is used.",
294
338
  "value": {
295
339
  "type": [
296
340
  "number",
@@ -389,6 +433,10 @@
389
433
  }
390
434
  ],
391
435
  "events": [
436
+ {
437
+ "name": "closed",
438
+ "description": "Fired when the popover is closed."
439
+ },
392
440
  {
393
441
  "name": "opened-changed",
394
442
  "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-alpha1",
4
+ "version": "24.5.0-alpha11",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,9 +16,16 @@
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-alpha11/#/elements/vaadin-overlay) documentation\nfor `<vaadin-popover-overlay>` parts.\n\nIn addition to `<vaadin-overlay>` parts, the following parts are available for styling:\n\nPart name | Description\n-----------------|-------------------------------------------\n`arrow` | Optional arrow pointing to the target when using `theme=\"arrow\"`\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
+ {
23
+ "name": "?autofocus",
24
+ "description": "When true, the popover content automatically receives focus after\nit is opened. Modal popovers use this behavior by default.",
25
+ "value": {
26
+ "kind": "expression"
27
+ }
28
+ },
22
29
  {
23
30
  "name": "?opened",
24
31
  "description": "True if the popover overlay is opened, false otherwise.",
@@ -54,6 +61,13 @@
54
61
  "kind": "expression"
55
62
  }
56
63
  },
64
+ {
65
+ "name": ".overlayClass",
66
+ "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
67
+ "value": {
68
+ "kind": "expression"
69
+ }
70
+ },
57
71
  {
58
72
  "name": ".position",
59
73
  "description": "Position of the overlay with respect to the target.\nSupported values: `top-start`, `top`, `top-end`,\n`bottom-start`, `bottom`, `bottom-end`, `start-top`,\n`start`, `start-bottom`, `end-top`, `end`, `end-bottom`.",
@@ -105,21 +119,21 @@
105
119
  },
106
120
  {
107
121
  "name": ".focusDelay",
108
- "description": "The delay in milliseconds before the popover is opened\non focus when the corresponding trigger is used.",
122
+ "description": "The delay in milliseconds before the popover is opened\non focus when the corresponding trigger is used.\n\nWhen not specified, the global default (500ms) is used.",
109
123
  "value": {
110
124
  "kind": "expression"
111
125
  }
112
126
  },
113
127
  {
114
128
  "name": ".hideDelay",
115
- "description": "The delay in milliseconds before the popover is closed\non losing hover, when the corresponding trigger is used.\nOn blur, the popover is closed immediately.",
129
+ "description": "The delay in milliseconds before the popover is closed\non losing hover, when the corresponding trigger is used.\nOn blur, the popover is closed immediately.\n\nWhen not specified, the global default (500ms) is used.",
116
130
  "value": {
117
131
  "kind": "expression"
118
132
  }
119
133
  },
120
134
  {
121
135
  "name": ".hoverDelay",
122
- "description": "The delay in milliseconds before the popover is opened\non hover when the corresponding trigger is used.",
136
+ "description": "The delay in milliseconds before the popover is opened\non hover when the corresponding trigger is used.\n\nWhen not specified, the global default (500ms) is used.",
123
137
  "value": {
124
138
  "kind": "expression"
125
139
  }
@@ -145,6 +159,13 @@
145
159
  "kind": "expression"
146
160
  }
147
161
  },
162
+ {
163
+ "name": "@closed",
164
+ "description": "Fired when the popover is closed.",
165
+ "value": {
166
+ "kind": "expression"
167
+ }
168
+ },
148
169
  {
149
170
  "name": "@opened-changed",
150
171
  "description": "Fired when the `opened` property changes.",