@vaadin/details 23.2.0-dev.8a7678b70 → 23.3.0-alpha1
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/README.md +4 -4
- package/package.json +14 -8
- package/src/vaadin-details.d.ts +6 -5
- package/src/vaadin-details.js +12 -2
- package/web-types.json +101 -0
- package/web-types.lit.json +55 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A web component that provides an expandable panel for showing and hiding content.
|
|
4
4
|
|
|
5
|
-
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/
|
|
5
|
+
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/details)
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@vaadin/details)
|
|
8
8
|
[](https://discord.gg/PHmkCKC)
|
|
@@ -14,7 +14,7 @@ A web component that provides an expandable panel for showing and hiding content
|
|
|
14
14
|
</vaadin-details>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/details/screenshot.png" alt="Screenshot of vaadin-details" width="320">](https://vaadin.com/docs/latest/
|
|
17
|
+
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/details/screenshot.png" alt="Screenshot of vaadin-details" width="320">](https://vaadin.com/docs/latest/components/details)
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
20
|
|
|
@@ -32,7 +32,7 @@ import '@vaadin/details';
|
|
|
32
32
|
|
|
33
33
|
## Themes
|
|
34
34
|
|
|
35
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/
|
|
35
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
36
36
|
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/details/vaadin-details.js) of the package uses the Lumo theme.
|
|
37
37
|
|
|
38
38
|
To use the Material theme, import the component from the `theme/material` folder:
|
|
@@ -55,7 +55,7 @@ import '@vaadin/details/src/vaadin-details.js';
|
|
|
55
55
|
|
|
56
56
|
## Contributing
|
|
57
57
|
|
|
58
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/
|
|
58
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
59
59
|
|
|
60
60
|
## License
|
|
61
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/details",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.3.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
"src",
|
|
24
24
|
"theme",
|
|
25
25
|
"vaadin-*.d.ts",
|
|
26
|
-
"vaadin-*.js"
|
|
26
|
+
"vaadin-*.js",
|
|
27
|
+
"web-types.json",
|
|
28
|
+
"web-types.lit.json"
|
|
27
29
|
],
|
|
28
30
|
"keywords": [
|
|
29
31
|
"Vaadin",
|
|
@@ -34,16 +36,20 @@
|
|
|
34
36
|
],
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"@polymer/polymer": "^3.0.0",
|
|
37
|
-
"@vaadin/component-base": "23.
|
|
38
|
-
"@vaadin/field-base": "23.
|
|
39
|
-
"@vaadin/vaadin-lumo-styles": "23.
|
|
40
|
-
"@vaadin/vaadin-material-styles": "23.
|
|
41
|
-
"@vaadin/vaadin-themable-mixin": "23.
|
|
39
|
+
"@vaadin/component-base": "23.3.0-alpha1",
|
|
40
|
+
"@vaadin/field-base": "23.3.0-alpha1",
|
|
41
|
+
"@vaadin/vaadin-lumo-styles": "23.3.0-alpha1",
|
|
42
|
+
"@vaadin/vaadin-material-styles": "23.3.0-alpha1",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "23.3.0-alpha1"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@esm-bundle/chai": "^4.3.4",
|
|
45
47
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
46
48
|
"sinon": "^13.0.2"
|
|
47
49
|
},
|
|
48
|
-
"
|
|
50
|
+
"web-types": [
|
|
51
|
+
"web-types.json",
|
|
52
|
+
"web-types.lit.json"
|
|
53
|
+
],
|
|
54
|
+
"gitHead": "beabc527d4b1274eb798ff701d406fed45cfe638"
|
|
49
55
|
}
|
package/src/vaadin-details.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2019 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
6
7
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
8
|
import { ShadowFocusMixin } from '@vaadin/field-base/src/shadow-focus-mixin.js';
|
|
8
9
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -16,7 +17,7 @@ export interface DetailsCustomEventMap {
|
|
|
16
17
|
'opened-changed': DetailsOpenedChangedEvent;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export type DetailsEventMap =
|
|
20
|
+
export type DetailsEventMap = DetailsCustomEventMap & HTMLElementEventMap;
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* `<vaadin-details>` is a Web Component which the creates an
|
|
@@ -49,11 +50,11 @@ export type DetailsEventMap = HTMLElementEventMap & DetailsCustomEventMap;
|
|
|
49
50
|
* `focus-ring` | Set when the element is focused using the keyboard.
|
|
50
51
|
* `focused` | Set when the element is focused.
|
|
51
52
|
*
|
|
52
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
53
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
53
54
|
*
|
|
54
55
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
55
56
|
*/
|
|
56
|
-
declare class Details extends ShadowFocusMixin(ElementMixin(ThemableMixin(HTMLElement))) {
|
|
57
|
+
declare class Details extends ShadowFocusMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement)))) {
|
|
57
58
|
/**
|
|
58
59
|
* If true, the details content is visible.
|
|
59
60
|
*/
|
|
@@ -62,13 +63,13 @@ declare class Details extends ShadowFocusMixin(ElementMixin(ThemableMixin(HTMLEl
|
|
|
62
63
|
addEventListener<K extends keyof DetailsEventMap>(
|
|
63
64
|
type: K,
|
|
64
65
|
listener: (this: Details, ev: DetailsEventMap[K]) => void,
|
|
65
|
-
options?:
|
|
66
|
+
options?: AddEventListenerOptions | boolean,
|
|
66
67
|
): void;
|
|
67
68
|
|
|
68
69
|
removeEventListener<K extends keyof DetailsEventMap>(
|
|
69
70
|
type: K,
|
|
70
71
|
listener: (this: Details, ev: DetailsEventMap[K]) => void,
|
|
71
|
-
options?:
|
|
72
|
+
options?: EventListenerOptions | boolean,
|
|
72
73
|
): void;
|
|
73
74
|
}
|
|
74
75
|
|
package/src/vaadin-details.js
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
7
8
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
|
+
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
8
10
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
9
11
|
import { ShadowFocusMixin } from '@vaadin/field-base/src/shadow-focus-mixin.js';
|
|
10
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
@@ -40,16 +42,17 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
40
42
|
* `focus-ring` | Set when the element is focused using the keyboard.
|
|
41
43
|
* `focused` | Set when the element is focused.
|
|
42
44
|
*
|
|
43
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
45
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
44
46
|
*
|
|
45
47
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
46
48
|
*
|
|
47
49
|
* @extends HTMLElement
|
|
50
|
+
* @mixes ControllerMixin
|
|
48
51
|
* @mixes ShadowFocusMixin
|
|
49
52
|
* @mixes ElementMixin
|
|
50
53
|
* @mixes ThemableMixin
|
|
51
54
|
*/
|
|
52
|
-
class Details extends ShadowFocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
55
|
+
class Details extends ShadowFocusMixin(ElementMixin(ThemableMixin(ControllerMixin(PolymerElement)))) {
|
|
53
56
|
static get template() {
|
|
54
57
|
return html`
|
|
55
58
|
<style>
|
|
@@ -88,6 +91,7 @@ class Details extends ShadowFocusMixin(ElementMixin(ThemableMixin(PolymerElement
|
|
|
88
91
|
<span part="toggle" aria-hidden="true"></span>
|
|
89
92
|
<span part="summary-content"><slot name="summary"></slot></span>
|
|
90
93
|
</div>
|
|
94
|
+
<slot name="tooltip"></slot>
|
|
91
95
|
</div>
|
|
92
96
|
<section id$="[[_contentId]]" part="content" aria-hidden$="[[_getAriaHidden(opened)]]">
|
|
93
97
|
<slot></slot>
|
|
@@ -142,6 +146,12 @@ class Details extends ShadowFocusMixin(ElementMixin(ThemableMixin(PolymerElement
|
|
|
142
146
|
e.stopPropagation();
|
|
143
147
|
}
|
|
144
148
|
});
|
|
149
|
+
|
|
150
|
+
this._tooltipController = new TooltipController(this);
|
|
151
|
+
this.addController(this._tooltipController);
|
|
152
|
+
|
|
153
|
+
this._tooltipController.setTarget(this.focusElement);
|
|
154
|
+
this._tooltipController.setPosition('bottom-start');
|
|
145
155
|
}
|
|
146
156
|
|
|
147
157
|
/** @private */
|
package/web-types.json
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/details",
|
|
4
|
+
"version": "23.3.0-alpha1",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"contributions": {
|
|
7
|
+
"html": {
|
|
8
|
+
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"name": "vaadin-details",
|
|
11
|
+
"description": "`<vaadin-details>` is a Web Component which the creates an\nexpandable panel similar to `<details>` HTML element.\n\n```\n<vaadin-details>\n <div slot=\"summary\">Expandable Details</div>\n Toggle using mouse, Enter and Space keys.\n</vaadin-details>\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n-----------------|----------------\n`summary` | The element used to open and close collapsible content.\n`toggle` | The element used as indicator, can represent an icon.\n`summary-content`| The wrapper for the slotted summary content.\n`content` | The wrapper for the collapsible details content.\n\nThe following attributes are exposed for styling:\n\nAttribute | Description\n-------------| -----------\n`opened` | Set when the collapsible content is expanded and visible.\n`disabled` | Set when the element is disabled.\n`focus-ring` | Set when the element is focused using the keyboard.\n`focused` | Set when the element is focused.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
12
|
+
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "disabled",
|
|
15
|
+
"description": "If true, the user cannot interact with this element.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"boolean",
|
|
19
|
+
"null",
|
|
20
|
+
"undefined"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "autofocus",
|
|
26
|
+
"description": "Specify that this control should have input focus when the page loads.",
|
|
27
|
+
"value": {
|
|
28
|
+
"type": [
|
|
29
|
+
"boolean",
|
|
30
|
+
"null",
|
|
31
|
+
"undefined"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "opened",
|
|
37
|
+
"description": "If true, the details content is visible.",
|
|
38
|
+
"value": {
|
|
39
|
+
"type": [
|
|
40
|
+
"boolean"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "theme",
|
|
46
|
+
"description": "The theme variants to apply to the component.",
|
|
47
|
+
"value": {
|
|
48
|
+
"type": [
|
|
49
|
+
"string",
|
|
50
|
+
"null",
|
|
51
|
+
"undefined"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"js": {
|
|
57
|
+
"properties": [
|
|
58
|
+
{
|
|
59
|
+
"name": "disabled",
|
|
60
|
+
"description": "If true, the user cannot interact with this element.",
|
|
61
|
+
"value": {
|
|
62
|
+
"type": [
|
|
63
|
+
"boolean",
|
|
64
|
+
"null",
|
|
65
|
+
"undefined"
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "autofocus",
|
|
71
|
+
"description": "Specify that this control should have input focus when the page loads.",
|
|
72
|
+
"value": {
|
|
73
|
+
"type": [
|
|
74
|
+
"boolean",
|
|
75
|
+
"null",
|
|
76
|
+
"undefined"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "opened",
|
|
82
|
+
"description": "If true, the details content is visible.",
|
|
83
|
+
"value": {
|
|
84
|
+
"type": [
|
|
85
|
+
"boolean"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"events": [
|
|
91
|
+
{
|
|
92
|
+
"name": "opened-changed",
|
|
93
|
+
"description": "Fired when the `opened` property changes."
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/details",
|
|
4
|
+
"version": "23.3.0-alpha1",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"framework": "lit",
|
|
7
|
+
"framework-config": {
|
|
8
|
+
"enable-when": {
|
|
9
|
+
"node-packages": [
|
|
10
|
+
"lit"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"contributions": {
|
|
15
|
+
"html": {
|
|
16
|
+
"elements": [
|
|
17
|
+
{
|
|
18
|
+
"name": "vaadin-details",
|
|
19
|
+
"description": "`<vaadin-details>` is a Web Component which the creates an\nexpandable panel similar to `<details>` HTML element.\n\n```\n<vaadin-details>\n <div slot=\"summary\">Expandable Details</div>\n Toggle using mouse, Enter and Space keys.\n</vaadin-details>\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n-----------------|----------------\n`summary` | The element used to open and close collapsible content.\n`toggle` | The element used as indicator, can represent an icon.\n`summary-content`| The wrapper for the slotted summary content.\n`content` | The wrapper for the collapsible details content.\n\nThe following attributes are exposed for styling:\n\nAttribute | Description\n-------------| -----------\n`opened` | Set when the collapsible content is expanded and visible.\n`disabled` | Set when the element is disabled.\n`focus-ring` | Set when the element is focused using the keyboard.\n`focused` | Set when the element is focused.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
20
|
+
"extension": true,
|
|
21
|
+
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": "?disabled",
|
|
24
|
+
"description": "If true, the user cannot interact with this element.",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "?autofocus",
|
|
31
|
+
"description": "Specify that this control should have input focus when the page loads.",
|
|
32
|
+
"value": {
|
|
33
|
+
"kind": "expression"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "?opened",
|
|
38
|
+
"description": "If true, the details content is visible.",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "@opened-changed",
|
|
45
|
+
"description": "Fired when the `opened` property changes.",
|
|
46
|
+
"value": {
|
|
47
|
+
"kind": "expression"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|