@vaadin/accordion 23.3.3 → 24.0.0-alpha10
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 +2 -2
- package/package.json +7 -7
- package/src/vaadin-accordion-heading.d.ts +58 -0
- package/src/vaadin-accordion-heading.js +133 -0
- package/src/vaadin-accordion-panel.d.ts +12 -6
- package/src/vaadin-accordion-panel.js +136 -6
- package/src/vaadin-accordion.d.ts +5 -5
- package/src/vaadin-accordion.js +19 -7
- package/theme/lumo/vaadin-accordion-heading-styles.js +14 -0
- package/theme/lumo/vaadin-accordion-panel.js +1 -0
- package/theme/material/vaadin-accordion-heading-styles.js +44 -0
- package/theme/material/vaadin-accordion-panel-styles.js +0 -37
- package/theme/material/vaadin-accordion-panel.js +1 -0
- package/web-types.json +75 -9
- package/web-types.lit.json +26 -5
package/README.md
CHANGED
|
@@ -10,11 +10,11 @@ A web component for displaying a vertically stacked set of expandable panels.
|
|
|
10
10
|
```html
|
|
11
11
|
<vaadin-accordion>
|
|
12
12
|
<vaadin-accordion-panel theme="filled">
|
|
13
|
-
<
|
|
13
|
+
<vaadin-accordion-heading slot="summary">Accordion Panel 1</vaadin-accordion-heading>
|
|
14
14
|
<div>Accordion is a set of expandable sections.</div>
|
|
15
15
|
</vaadin-accordion-panel>
|
|
16
16
|
<vaadin-accordion-panel theme="filled">
|
|
17
|
-
<
|
|
17
|
+
<vaadin-accordion-heading slot="summary">Accordion Panel 2</vaadin-accordion-heading>
|
|
18
18
|
<div>Only one accordion panel can be opened.</div>
|
|
19
19
|
</vaadin-accordion-panel>
|
|
20
20
|
</vaadin-accordion>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/accordion",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.0.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/component-base": "
|
|
40
|
-
"@vaadin/details": "
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
42
|
-
"@vaadin/vaadin-material-styles": "
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
39
|
+
"@vaadin/component-base": "24.0.0-alpha10",
|
|
40
|
+
"@vaadin/details": "24.0.0-alpha10",
|
|
41
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha10",
|
|
42
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha10",
|
|
43
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha10"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"web-types.json",
|
|
52
52
|
"web-types.lit.json"
|
|
53
53
|
],
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "2e04534d8b47bcd216f89b5f849bafef1a73b174"
|
|
55
55
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { ActiveMixin } from '@vaadin/component-base/src/active-mixin.js';
|
|
7
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
8
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The accordion heading element.
|
|
12
|
+
*
|
|
13
|
+
* `vaadin-accordion-heading` is the element for the headings in the accordion.
|
|
14
|
+
* As recommended by the WAI ARIA Best Practices, each heading needs to wrap a
|
|
15
|
+
* `<button>`. This element puts that button in the Shadow DOM, as it is more
|
|
16
|
+
* convenient to use and doesn’t make styling of the heading more problematic.
|
|
17
|
+
*
|
|
18
|
+
* The WAI ARIA Best Practices also recommend setting `aria-level` depending
|
|
19
|
+
* on what level the headings are. It is hard to determine the level of a heading
|
|
20
|
+
* algorithmically, and setting it is not strictly required to have an accessible
|
|
21
|
+
* accordion. To keep things easier to use, this element does not set `aria-level`
|
|
22
|
+
* attribute but leaves that to the developer creating an accordion.
|
|
23
|
+
*
|
|
24
|
+
* ### Styling
|
|
25
|
+
*
|
|
26
|
+
* The following shadow DOM parts are exposed for styling:
|
|
27
|
+
*
|
|
28
|
+
* Part name | Description
|
|
29
|
+
* -----------|-------------------
|
|
30
|
+
* `toggle` | The icon element
|
|
31
|
+
* `content` | The content wrapper
|
|
32
|
+
*
|
|
33
|
+
* The following state attributes are available for styling:
|
|
34
|
+
*
|
|
35
|
+
* Attribute | Description
|
|
36
|
+
* -------------| -----------
|
|
37
|
+
* `active` | Set when the element is pressed down, either with mouse, touch or the keyboard.
|
|
38
|
+
* `opened` | Set when the collapsible content is expanded and visible.
|
|
39
|
+
* `disabled` | Set when the element is disabled.
|
|
40
|
+
*
|
|
41
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
42
|
+
*
|
|
43
|
+
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
44
|
+
*/
|
|
45
|
+
declare class AccordionHeading extends ActiveMixin(DirMixin(ThemableMixin(HTMLElement))) {
|
|
46
|
+
/**
|
|
47
|
+
* When true, the element is opened.
|
|
48
|
+
*/
|
|
49
|
+
opened: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare global {
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
'vaadin-accordion-heading': AccordionHeading;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { AccordionHeading };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { ActiveMixin } from '@vaadin/component-base/src/active-mixin.js';
|
|
8
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The accordion heading element.
|
|
13
|
+
*
|
|
14
|
+
* `vaadin-accordion-heading` is the element for the headings in the accordion.
|
|
15
|
+
* As recommended by the WAI ARIA Best Practices, each heading needs to wrap a
|
|
16
|
+
* `<button>`. This element puts that button in the Shadow DOM, as it is more
|
|
17
|
+
* convenient to use and doesn’t make styling of the heading more problematic.
|
|
18
|
+
*
|
|
19
|
+
* The WAI ARIA Best Practices also recommend setting `aria-level` depending
|
|
20
|
+
* on what level the headings are. It is hard to determine the level of a heading
|
|
21
|
+
* algorithmically, and setting it is not strictly required to have an accessible
|
|
22
|
+
* accordion. To keep things easier to use, this element does not set `aria-level`
|
|
23
|
+
* attribute but leaves that to the developer creating an accordion.
|
|
24
|
+
*
|
|
25
|
+
* ### Styling
|
|
26
|
+
*
|
|
27
|
+
* The following shadow DOM parts are exposed for styling:
|
|
28
|
+
*
|
|
29
|
+
* Part name | Description
|
|
30
|
+
* -----------|-------------------
|
|
31
|
+
* `toggle` | The icon element
|
|
32
|
+
* `content` | The content wrapper
|
|
33
|
+
*
|
|
34
|
+
* The following state attributes are available for styling:
|
|
35
|
+
*
|
|
36
|
+
* Attribute | Description
|
|
37
|
+
* -------------| -----------
|
|
38
|
+
* `active` | Set when the element is pressed down, either with mouse, touch or the keyboard.
|
|
39
|
+
* `opened` | Set when the collapsible content is expanded and visible.
|
|
40
|
+
* `disabled` | Set when the element is disabled.
|
|
41
|
+
*
|
|
42
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
43
|
+
*
|
|
44
|
+
* @extends HTMLElement
|
|
45
|
+
* @mixes ActiveMixin
|
|
46
|
+
* @mixes DirMixin
|
|
47
|
+
* @mixes ThemableMixin
|
|
48
|
+
*/
|
|
49
|
+
class AccordionHeading extends ActiveMixin(DirMixin(ThemableMixin(PolymerElement))) {
|
|
50
|
+
static get is() {
|
|
51
|
+
return 'vaadin-accordion-heading';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static get template() {
|
|
55
|
+
return html`
|
|
56
|
+
<style>
|
|
57
|
+
:host {
|
|
58
|
+
display: block;
|
|
59
|
+
outline: none;
|
|
60
|
+
-webkit-user-select: none;
|
|
61
|
+
-moz-user-select: none;
|
|
62
|
+
user-select: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:host([hidden]) {
|
|
66
|
+
display: none !important;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
button {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
width: 100%;
|
|
73
|
+
margin: 0;
|
|
74
|
+
padding: 0;
|
|
75
|
+
background-color: initial;
|
|
76
|
+
color: inherit;
|
|
77
|
+
border: initial;
|
|
78
|
+
outline: none;
|
|
79
|
+
font: inherit;
|
|
80
|
+
text-align: inherit;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
83
|
+
<button id="button" part="content" disabled$="[[disabled]]" aria-expanded$="[[__updateAriaExpanded(opened)]]">
|
|
84
|
+
<span part="toggle" aria-hidden="true"></span>
|
|
85
|
+
<slot></slot>
|
|
86
|
+
</button>
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static get properties() {
|
|
91
|
+
return {
|
|
92
|
+
/**
|
|
93
|
+
* When true, the element is opened.
|
|
94
|
+
*/
|
|
95
|
+
opened: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
reflectToAttribute: true,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @param {DocumentFragment} dom
|
|
104
|
+
* @return {null}
|
|
105
|
+
* @protected
|
|
106
|
+
* @override
|
|
107
|
+
*/
|
|
108
|
+
_attachDom(dom) {
|
|
109
|
+
const root = this.attachShadow({ mode: 'open', delegatesFocus: true });
|
|
110
|
+
root.appendChild(dom);
|
|
111
|
+
return root;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** @protected */
|
|
115
|
+
ready() {
|
|
116
|
+
super.ready();
|
|
117
|
+
|
|
118
|
+
// By default, if the user hasn't provided a custom role,
|
|
119
|
+
// the role attribute is set to "heading".
|
|
120
|
+
if (!this.hasAttribute('role')) {
|
|
121
|
+
this.setAttribute('role', 'heading');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** @private */
|
|
126
|
+
__updateAriaExpanded(opened) {
|
|
127
|
+
return opened ? 'true' : 'false';
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
customElements.define(AccordionHeading.is, AccordionHeading);
|
|
132
|
+
|
|
133
|
+
export { AccordionHeading };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { DelegateFocusMixin } from '@vaadin/component-base/src/delegate-focus-mixin.js';
|
|
7
|
+
import { DelegateStateMixin } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
8
|
+
import { DetailsMixin } from '@vaadin/details/src/vaadin-details-mixin.js';
|
|
9
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* Fired when the `opened` property changes.
|
|
@@ -25,9 +28,6 @@ export type AccordionPanelEventMap = AccordionPanelCustomEventMap & HTMLElementE
|
|
|
25
28
|
*
|
|
26
29
|
* Part name | Description
|
|
27
30
|
* -----------------|----------------
|
|
28
|
-
* `summary` | The element used to open and close collapsible content.
|
|
29
|
-
* `toggle` | The element used as indicator, can represent an icon.
|
|
30
|
-
* `summary-content`| The wrapper for the slotted summary content.
|
|
31
31
|
* `content` | The wrapper for the collapsible panel content.
|
|
32
32
|
*
|
|
33
33
|
* The following attributes are exposed for styling:
|
|
@@ -43,7 +43,13 @@ export type AccordionPanelEventMap = AccordionPanelCustomEventMap & HTMLElementE
|
|
|
43
43
|
*
|
|
44
44
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
45
45
|
*/
|
|
46
|
-
declare class AccordionPanel extends
|
|
46
|
+
declare class AccordionPanel extends DetailsMixin(DelegateFocusMixin(DelegateStateMixin(ThemableMixin(HTMLElement)))) {
|
|
47
|
+
/**
|
|
48
|
+
* A text that is displayed in the heading, if no
|
|
49
|
+
* element is assigned to the `summary` slot.
|
|
50
|
+
*/
|
|
51
|
+
summary: string | null | undefined;
|
|
52
|
+
|
|
47
53
|
addEventListener<K extends keyof AccordionPanelEventMap>(
|
|
48
54
|
type: K,
|
|
49
55
|
listener: (this: AccordionPanel, ev: AccordionPanelEventMap[K]) => void,
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import './vaadin-accordion-heading.js';
|
|
7
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
8
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
9
|
+
import { DelegateFocusMixin } from '@vaadin/component-base/src/delegate-focus-mixin.js';
|
|
10
|
+
import { DelegateStateMixin } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
11
|
+
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
12
|
+
import { SummaryController } from '@vaadin/details/src/summary-controller.js';
|
|
13
|
+
import { DetailsMixin } from '@vaadin/details/src/vaadin-details-mixin.js';
|
|
14
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
15
|
|
|
8
16
|
/**
|
|
9
17
|
* The accordion panel element.
|
|
@@ -14,9 +22,6 @@ import { Details } from '@vaadin/details/src/vaadin-details.js';
|
|
|
14
22
|
*
|
|
15
23
|
* Part name | Description
|
|
16
24
|
* -----------------|----------------
|
|
17
|
-
* `summary` | The element used to open and close collapsible content.
|
|
18
|
-
* `toggle` | The element used as indicator, can represent an icon.
|
|
19
|
-
* `summary-content`| The wrapper for the slotted summary content.
|
|
20
25
|
* `content` | The wrapper for the collapsible panel content.
|
|
21
26
|
*
|
|
22
27
|
* The following attributes are exposed for styling:
|
|
@@ -31,11 +36,136 @@ import { Details } from '@vaadin/details/src/vaadin-details.js';
|
|
|
31
36
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
32
37
|
*
|
|
33
38
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
39
|
+
*
|
|
40
|
+
* @extends HTMLElement
|
|
41
|
+
* @mixes ControllerMixin
|
|
42
|
+
* @mixes DetailsMixin
|
|
43
|
+
* @mixes DelegateFocusMixin
|
|
44
|
+
* @mixes DelegateStateMixin
|
|
45
|
+
* @mixes ThemableMixin
|
|
34
46
|
*/
|
|
35
|
-
class AccordionPanel extends
|
|
47
|
+
class AccordionPanel extends DetailsMixin(
|
|
48
|
+
DelegateFocusMixin(DelegateStateMixin(ThemableMixin(ControllerMixin(PolymerElement)))),
|
|
49
|
+
) {
|
|
36
50
|
static get is() {
|
|
37
51
|
return 'vaadin-accordion-panel';
|
|
38
52
|
}
|
|
53
|
+
|
|
54
|
+
static get template() {
|
|
55
|
+
return html`
|
|
56
|
+
<style>
|
|
57
|
+
:host {
|
|
58
|
+
display: block;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host([hidden]) {
|
|
62
|
+
display: none !important;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[part='content'] {
|
|
66
|
+
display: none;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:host([opened]) [part='content'] {
|
|
71
|
+
display: block;
|
|
72
|
+
overflow: visible;
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
75
|
+
|
|
76
|
+
<slot name="summary"></slot>
|
|
77
|
+
|
|
78
|
+
<div part="content">
|
|
79
|
+
<slot></slot>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<slot name="tooltip"></slot>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static get properties() {
|
|
87
|
+
return {
|
|
88
|
+
/**
|
|
89
|
+
* A text that is displayed in the heading, if no
|
|
90
|
+
* element is assigned to the `summary` slot.
|
|
91
|
+
*/
|
|
92
|
+
summary: {
|
|
93
|
+
type: String,
|
|
94
|
+
observer: '_summaryChanged',
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static get observers() {
|
|
100
|
+
return ['__updateAriaAttributes(focusElement, _contentElements)'];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static get delegateAttrs() {
|
|
104
|
+
return ['theme'];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static get delegateProps() {
|
|
108
|
+
return ['disabled', 'opened'];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
constructor() {
|
|
112
|
+
super();
|
|
113
|
+
|
|
114
|
+
this._summaryController = new SummaryController(this, 'vaadin-accordion-heading');
|
|
115
|
+
this._summaryController.addEventListener('slot-content-changed', (event) => {
|
|
116
|
+
const { node } = event.target;
|
|
117
|
+
|
|
118
|
+
this._setFocusElement(node);
|
|
119
|
+
this.stateTarget = node;
|
|
120
|
+
|
|
121
|
+
this._tooltipController.setTarget(node);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
this._tooltipController = new TooltipController(this);
|
|
125
|
+
this._tooltipController.setPosition('bottom-start');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** @protected */
|
|
129
|
+
ready() {
|
|
130
|
+
super.ready();
|
|
131
|
+
|
|
132
|
+
this.addController(this._summaryController);
|
|
133
|
+
this.addController(this._tooltipController);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Override method inherited from `DisabledMixin`
|
|
138
|
+
* to not set `aria-disabled` on the host element.
|
|
139
|
+
*
|
|
140
|
+
* @protected
|
|
141
|
+
* @override
|
|
142
|
+
*/
|
|
143
|
+
_setAriaDisabled() {
|
|
144
|
+
// The `aria-disabled` is set on the details summary.
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** @private */
|
|
148
|
+
_summaryChanged(summary) {
|
|
149
|
+
this._summaryController.setSummary(summary);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** @private */
|
|
153
|
+
__updateAriaAttributes(focusElement, contentElements) {
|
|
154
|
+
if (focusElement && contentElements) {
|
|
155
|
+
const node = contentElements[0];
|
|
156
|
+
|
|
157
|
+
if (node) {
|
|
158
|
+
node.setAttribute('role', 'region');
|
|
159
|
+
node.setAttribute('aria-labelledby', focusElement.id);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (node && node.id) {
|
|
163
|
+
focusElement.setAttribute('aria-controls', node.id);
|
|
164
|
+
} else {
|
|
165
|
+
focusElement.removeAttribute('aria-controls');
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
39
169
|
}
|
|
40
170
|
|
|
41
171
|
customElements.define(AccordionPanel.is, AccordionPanel);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
@@ -41,12 +41,12 @@ export type AccordionEventMap = AccordionCustomEventMap & HTMLElementEventMap;
|
|
|
41
41
|
* ```
|
|
42
42
|
* <vaadin-accordion>
|
|
43
43
|
* <vaadin-accordion-panel>
|
|
44
|
-
* <
|
|
45
|
-
* This panel is opened, so the text is visible by default
|
|
44
|
+
* <vaadin-accordion-heading slot="summary">Panel 1</vaadin-accordion-heading>
|
|
45
|
+
* <div>This panel is opened, so the text is visible by default.</div>
|
|
46
46
|
* </vaadin-accordion-panel>
|
|
47
47
|
* <vaadin-accordion-panel>
|
|
48
|
-
* <
|
|
49
|
-
* After opening this panel, the first one becomes closed
|
|
48
|
+
* <vaadin-accordion-heading slot="summary">Panel 2</vaadin-accordion-heading>
|
|
49
|
+
* <div>After opening this panel, the first one becomes closed.</div>
|
|
50
50
|
* </vaadin-accordion-panel>
|
|
51
51
|
* </vaadin-accordion>
|
|
52
52
|
* ```
|
package/src/vaadin-accordion.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2019 -
|
|
3
|
+
* Copyright (c) 2019 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
7
7
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
8
8
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
|
+
import { isElementFocused } from '@vaadin/component-base/src/focus-utils.js';
|
|
9
10
|
import { KeyboardDirectionMixin } from '@vaadin/component-base/src/keyboard-direction-mixin.js';
|
|
10
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
12
|
import { AccordionPanel } from './vaadin-accordion-panel.js';
|
|
@@ -25,12 +26,12 @@ import { AccordionPanel } from './vaadin-accordion-panel.js';
|
|
|
25
26
|
* ```
|
|
26
27
|
* <vaadin-accordion>
|
|
27
28
|
* <vaadin-accordion-panel>
|
|
28
|
-
* <
|
|
29
|
-
* This panel is opened, so the text is visible by default
|
|
29
|
+
* <vaadin-accordion-heading slot="summary">Panel 1</vaadin-accordion-heading>
|
|
30
|
+
* <div>This panel is opened, so the text is visible by default.</div>
|
|
30
31
|
* </vaadin-accordion-panel>
|
|
31
32
|
* <vaadin-accordion-panel>
|
|
32
|
-
* <
|
|
33
|
-
* After opening this panel, the first one becomes closed
|
|
33
|
+
* <vaadin-accordion-heading slot="summary">Panel 2</vaadin-accordion-heading>
|
|
34
|
+
* <div>After opening this panel, the first one becomes closed.</div>
|
|
34
35
|
* </vaadin-accordion-panel>
|
|
35
36
|
* </vaadin-accordion>
|
|
36
37
|
* ```
|
|
@@ -117,6 +118,18 @@ class Accordion extends KeyboardDirectionMixin(ThemableMixin(ElementMixin(Polyme
|
|
|
117
118
|
this._boundUpdateOpened = this._updateOpened.bind(this);
|
|
118
119
|
}
|
|
119
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Override getter from `KeyboardDirectionMixin`
|
|
123
|
+
* to check if the heading element has focus.
|
|
124
|
+
*
|
|
125
|
+
* @return {Element | null}
|
|
126
|
+
* @protected
|
|
127
|
+
* @override
|
|
128
|
+
*/
|
|
129
|
+
get focused() {
|
|
130
|
+
return (this._getItems() || []).find((item) => isElementFocused(item.focusElement));
|
|
131
|
+
}
|
|
132
|
+
|
|
120
133
|
/**
|
|
121
134
|
* @protected
|
|
122
135
|
* @override
|
|
@@ -182,8 +195,7 @@ class Accordion extends KeyboardDirectionMixin(ThemableMixin(ElementMixin(Polyme
|
|
|
182
195
|
*/
|
|
183
196
|
_onKeyDown(event) {
|
|
184
197
|
// Only check keyboard events on details toggle buttons
|
|
185
|
-
|
|
186
|
-
if (!this.items.some((el) => el.focusElement === item)) {
|
|
198
|
+
if (!this.items.some((item) => item.focusElement === event.target)) {
|
|
187
199
|
return;
|
|
188
200
|
}
|
|
189
201
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { detailsSummary } from '@vaadin/details/theme/lumo/vaadin-details-summary-styles.js';
|
|
2
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
3
|
+
|
|
4
|
+
const accordionHeading = css`
|
|
5
|
+
:host {
|
|
6
|
+
padding: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
[part='content'] {
|
|
10
|
+
padding: var(--lumo-space-s) 0;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
registerStyles('vaadin-accordion-heading', [detailsSummary, accordionHeading], { moduleId: 'lumo-accordion-heading' });
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import '@vaadin/vaadin-material-styles/color.js';
|
|
2
|
+
import { detailsSummary } from '@vaadin/details/theme/material/vaadin-details-summary-styles.js';
|
|
3
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
|
+
|
|
5
|
+
const accordionHeading = css`
|
|
6
|
+
:host(:not([opened]))::after {
|
|
7
|
+
content: '';
|
|
8
|
+
position: absolute;
|
|
9
|
+
bottom: -1px;
|
|
10
|
+
left: 0;
|
|
11
|
+
right: 0;
|
|
12
|
+
height: 1px;
|
|
13
|
+
opacity: 1;
|
|
14
|
+
z-index: 1;
|
|
15
|
+
background-color: var(--material-divider-color);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([opened])::before {
|
|
19
|
+
opacity: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[part='content'] {
|
|
23
|
+
font-weight: normal;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[part='content'] ::slotted(*) {
|
|
27
|
+
display: flex;
|
|
28
|
+
margin-right: 16px;
|
|
29
|
+
color: var(--material-body-text-color);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[part='content'] ::slotted([theme='primary']) {
|
|
33
|
+
flex-basis: 33.33%;
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[part='content'] ::slotted([theme='secondary']) {
|
|
38
|
+
color: var(--material-secondary-text-color);
|
|
39
|
+
}
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
registerStyles('vaadin-accordion-heading', [detailsSummary, accordionHeading], {
|
|
43
|
+
moduleId: 'material-accordion-heading',
|
|
44
|
+
});
|
|
@@ -3,22 +3,6 @@ import { details } from '@vaadin/details/theme/material/vaadin-details-styles.js
|
|
|
3
3
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
4
|
|
|
5
5
|
const accordionPanel = css`
|
|
6
|
-
:host(:not([opened])) [part='summary']::after {
|
|
7
|
-
content: '';
|
|
8
|
-
position: absolute;
|
|
9
|
-
bottom: -1px;
|
|
10
|
-
left: 0;
|
|
11
|
-
right: 0;
|
|
12
|
-
height: 1px;
|
|
13
|
-
opacity: 1;
|
|
14
|
-
z-index: 1;
|
|
15
|
-
background-color: var(--material-divider-color);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
:host([opened]) [part='summary']::before {
|
|
19
|
-
opacity: 0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
6
|
:host([opened]:not(:first-child)) {
|
|
23
7
|
margin-top: 16px;
|
|
24
8
|
}
|
|
@@ -26,27 +10,6 @@ const accordionPanel = css`
|
|
|
26
10
|
:host([opened]:not(:last-child)) {
|
|
27
11
|
margin-bottom: 16px;
|
|
28
12
|
}
|
|
29
|
-
|
|
30
|
-
[part='summary-content'] {
|
|
31
|
-
display: flex;
|
|
32
|
-
width: 100%;
|
|
33
|
-
font-weight: normal;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
[part='summary-content'] ::slotted(*) {
|
|
37
|
-
display: flex;
|
|
38
|
-
margin-right: 16px;
|
|
39
|
-
color: var(--material-body-text-color);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
[part='summary-content'] ::slotted([theme='primary']) {
|
|
43
|
-
flex-basis: 33.33%;
|
|
44
|
-
flex-shrink: 0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
[part='summary-content'] ::slotted([theme='secondary']) {
|
|
48
|
-
color: var(--material-secondary-text-color);
|
|
49
|
-
}
|
|
50
13
|
`;
|
|
51
14
|
|
|
52
15
|
registerStyles('vaadin-accordion-panel', [details, accordionPanel], {
|
package/web-types.json
CHANGED
|
@@ -1,15 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/accordion",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "24.0.0-alpha10",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"name": "vaadin-accordion-heading",
|
|
11
|
+
"description": "The accordion heading element.\n\n`vaadin-accordion-heading` is the element for the headings in the accordion.\nAs recommended by the WAI ARIA Best Practices, each heading needs to wrap a\n`<button>`. This element puts that button in the Shadow DOM, as it is more\nconvenient to use and doesn’t make styling of the heading more problematic.\n\nThe WAI ARIA Best Practices also recommend setting `aria-level` depending\non what level the headings are. It is hard to determine the level of a heading\nalgorithmically, and setting it is not strictly required to have an accessible\naccordion. To keep things easier to use, this element does not set `aria-level`\nattribute but leaves that to the developer creating an accordion.\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n-----------|-------------------\n`toggle` | The icon element\n`content` | The content wrapper\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------| -----------\n`active` | Set when the element is pressed down, either with mouse, touch or the keyboard.\n`opened` | Set when the collapsible content is expanded and visible.\n`disabled` | Set when the element is disabled.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
12
|
+
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "opened",
|
|
15
|
+
"description": "When true, the element is opened.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"boolean",
|
|
19
|
+
"null",
|
|
20
|
+
"undefined"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "theme",
|
|
26
|
+
"description": "The theme variants to apply to the component.",
|
|
27
|
+
"value": {
|
|
28
|
+
"type": [
|
|
29
|
+
"string",
|
|
30
|
+
"null",
|
|
31
|
+
"undefined"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"js": {
|
|
37
|
+
"properties": [
|
|
38
|
+
{
|
|
39
|
+
"name": "opened",
|
|
40
|
+
"description": "When true, the element is opened.",
|
|
41
|
+
"value": {
|
|
42
|
+
"type": [
|
|
43
|
+
"boolean",
|
|
44
|
+
"null",
|
|
45
|
+
"undefined"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"events": []
|
|
51
|
+
}
|
|
52
|
+
},
|
|
9
53
|
{
|
|
10
54
|
"name": "vaadin-accordion-panel",
|
|
11
|
-
"description": "The accordion panel element.\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n-----------------|----------------\n`
|
|
55
|
+
"description": "The accordion panel element.\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n-----------------|----------------\n`content` | The wrapper for the collapsible panel 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
56
|
"attributes": [
|
|
57
|
+
{
|
|
58
|
+
"name": "opened",
|
|
59
|
+
"description": "If true, the collapsible content is visible.",
|
|
60
|
+
"value": {
|
|
61
|
+
"type": [
|
|
62
|
+
"boolean"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
13
66
|
{
|
|
14
67
|
"name": "disabled",
|
|
15
68
|
"description": "If true, the user cannot interact with this element.",
|
|
@@ -33,11 +86,13 @@
|
|
|
33
86
|
}
|
|
34
87
|
},
|
|
35
88
|
{
|
|
36
|
-
"name": "
|
|
37
|
-
"description": "
|
|
89
|
+
"name": "summary",
|
|
90
|
+
"description": "A text that is displayed in the heading, if no\nelement is assigned to the `summary` slot.",
|
|
38
91
|
"value": {
|
|
39
92
|
"type": [
|
|
40
|
-
"
|
|
93
|
+
"string",
|
|
94
|
+
"null",
|
|
95
|
+
"undefined"
|
|
41
96
|
]
|
|
42
97
|
}
|
|
43
98
|
},
|
|
@@ -55,6 +110,15 @@
|
|
|
55
110
|
],
|
|
56
111
|
"js": {
|
|
57
112
|
"properties": [
|
|
113
|
+
{
|
|
114
|
+
"name": "opened",
|
|
115
|
+
"description": "If true, the collapsible content is visible.",
|
|
116
|
+
"value": {
|
|
117
|
+
"type": [
|
|
118
|
+
"boolean"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
58
122
|
{
|
|
59
123
|
"name": "disabled",
|
|
60
124
|
"description": "If true, the user cannot interact with this element.",
|
|
@@ -78,11 +142,13 @@
|
|
|
78
142
|
}
|
|
79
143
|
},
|
|
80
144
|
{
|
|
81
|
-
"name": "
|
|
82
|
-
"description": "
|
|
145
|
+
"name": "summary",
|
|
146
|
+
"description": "A text that is displayed in the heading, if no\nelement is assigned to the `summary` slot.",
|
|
83
147
|
"value": {
|
|
84
148
|
"type": [
|
|
85
|
-
"
|
|
149
|
+
"string",
|
|
150
|
+
"null",
|
|
151
|
+
"undefined"
|
|
86
152
|
]
|
|
87
153
|
}
|
|
88
154
|
}
|
|
@@ -97,7 +163,7 @@
|
|
|
97
163
|
},
|
|
98
164
|
{
|
|
99
165
|
"name": "vaadin-accordion",
|
|
100
|
-
"description": "`<vaadin-accordion>` is a Web Component implementing accordion widget —\na vertically stacked set of expandable panels. The component should be\nused as a wrapper for two or more `<vaadin-accordion-panel>` components.\n\nPanel headings function as controls that enable users to open (expand)\nor hide (collapse) their associated sections of content. The user can\ntoggle panels by mouse click, Enter and Space keys.\n\nOnly one panel can be opened at a time, opening a new one forces\nprevious panel to close and hide its content.\n\n```\n<vaadin-accordion>\n <vaadin-accordion-panel>\n <
|
|
166
|
+
"description": "`<vaadin-accordion>` is a Web Component implementing accordion widget —\na vertically stacked set of expandable panels. The component should be\nused as a wrapper for two or more `<vaadin-accordion-panel>` components.\n\nPanel headings function as controls that enable users to open (expand)\nor hide (collapse) their associated sections of content. The user can\ntoggle panels by mouse click, Enter and Space keys.\n\nOnly one panel can be opened at a time, opening a new one forces\nprevious panel to close and hide its content.\n\n```\n<vaadin-accordion>\n <vaadin-accordion-panel>\n <vaadin-accordion-heading slot=\"summary\">Panel 1</vaadin-accordion-heading>\n <div>This panel is opened, so the text is visible by default.</div>\n </vaadin-accordion-panel>\n <vaadin-accordion-panel>\n <vaadin-accordion-heading slot=\"summary\">Panel 2</vaadin-accordion-heading>\n <div>After opening this panel, the first one becomes closed.</div>\n </vaadin-accordion-panel>\n</vaadin-accordion>\n```\n\n### Styling\n\nSee the [`<vaadin-accordion-panel>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha10/#/elements/vaadin-accordion-panel)\ndocumentation for the available state attributes and stylable shadow parts.\n\n**Note:** You can apply the theme to `<vaadin-accordion>` component itself,\nespecially by using the following CSS selector:\n\n```\n:host ::slotted(vaadin-accordion-panel) {\n margin-bottom: 5px;\n}\n```\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
101
167
|
"attributes": [
|
|
102
168
|
{
|
|
103
169
|
"name": "opened",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/accordion",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "24.0.0-alpha10",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -14,11 +14,32 @@
|
|
|
14
14
|
"contributions": {
|
|
15
15
|
"html": {
|
|
16
16
|
"elements": [
|
|
17
|
+
{
|
|
18
|
+
"name": "vaadin-accordion-heading",
|
|
19
|
+
"description": "The accordion heading element.\n\n`vaadin-accordion-heading` is the element for the headings in the accordion.\nAs recommended by the WAI ARIA Best Practices, each heading needs to wrap a\n`<button>`. This element puts that button in the Shadow DOM, as it is more\nconvenient to use and doesn’t make styling of the heading more problematic.\n\nThe WAI ARIA Best Practices also recommend setting `aria-level` depending\non what level the headings are. It is hard to determine the level of a heading\nalgorithmically, and setting it is not strictly required to have an accessible\naccordion. To keep things easier to use, this element does not set `aria-level`\nattribute but leaves that to the developer creating an accordion.\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n-----------|-------------------\n`toggle` | The icon element\n`content` | The content wrapper\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------| -----------\n`active` | Set when the element is pressed down, either with mouse, touch or the keyboard.\n`opened` | Set when the collapsible content is expanded and visible.\n`disabled` | Set when the element is disabled.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
20
|
+
"extension": true,
|
|
21
|
+
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": "?opened",
|
|
24
|
+
"description": "When true, the element is opened.",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
17
31
|
{
|
|
18
32
|
"name": "vaadin-accordion-panel",
|
|
19
|
-
"description": "The accordion panel element.\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n-----------------|----------------\n`
|
|
33
|
+
"description": "The accordion panel element.\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n-----------------|----------------\n`content` | The wrapper for the collapsible panel 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
34
|
"extension": true,
|
|
21
35
|
"attributes": [
|
|
36
|
+
{
|
|
37
|
+
"name": "?opened",
|
|
38
|
+
"description": "If true, the collapsible content is visible.",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
22
43
|
{
|
|
23
44
|
"name": "?disabled",
|
|
24
45
|
"description": "If true, the user cannot interact with this element.",
|
|
@@ -34,8 +55,8 @@
|
|
|
34
55
|
}
|
|
35
56
|
},
|
|
36
57
|
{
|
|
37
|
-
"name": "
|
|
38
|
-
"description": "
|
|
58
|
+
"name": ".summary",
|
|
59
|
+
"description": "A text that is displayed in the heading, if no\nelement is assigned to the `summary` slot.",
|
|
39
60
|
"value": {
|
|
40
61
|
"kind": "expression"
|
|
41
62
|
}
|
|
@@ -51,7 +72,7 @@
|
|
|
51
72
|
},
|
|
52
73
|
{
|
|
53
74
|
"name": "vaadin-accordion",
|
|
54
|
-
"description": "`<vaadin-accordion>` is a Web Component implementing accordion widget —\na vertically stacked set of expandable panels. The component should be\nused as a wrapper for two or more `<vaadin-accordion-panel>` components.\n\nPanel headings function as controls that enable users to open (expand)\nor hide (collapse) their associated sections of content. The user can\ntoggle panels by mouse click, Enter and Space keys.\n\nOnly one panel can be opened at a time, opening a new one forces\nprevious panel to close and hide its content.\n\n```\n<vaadin-accordion>\n <vaadin-accordion-panel>\n <
|
|
75
|
+
"description": "`<vaadin-accordion>` is a Web Component implementing accordion widget —\na vertically stacked set of expandable panels. The component should be\nused as a wrapper for two or more `<vaadin-accordion-panel>` components.\n\nPanel headings function as controls that enable users to open (expand)\nor hide (collapse) their associated sections of content. The user can\ntoggle panels by mouse click, Enter and Space keys.\n\nOnly one panel can be opened at a time, opening a new one forces\nprevious panel to close and hide its content.\n\n```\n<vaadin-accordion>\n <vaadin-accordion-panel>\n <vaadin-accordion-heading slot=\"summary\">Panel 1</vaadin-accordion-heading>\n <div>This panel is opened, so the text is visible by default.</div>\n </vaadin-accordion-panel>\n <vaadin-accordion-panel>\n <vaadin-accordion-heading slot=\"summary\">Panel 2</vaadin-accordion-heading>\n <div>After opening this panel, the first one becomes closed.</div>\n </vaadin-accordion-panel>\n</vaadin-accordion>\n```\n\n### Styling\n\nSee the [`<vaadin-accordion-panel>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha10/#/elements/vaadin-accordion-panel)\ndocumentation for the available state attributes and stylable shadow parts.\n\n**Note:** You can apply the theme to `<vaadin-accordion>` component itself,\nespecially by using the following CSS selector:\n\n```\n:host ::slotted(vaadin-accordion-panel) {\n margin-bottom: 5px;\n}\n```\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
55
76
|
"extension": true,
|
|
56
77
|
"attributes": [
|
|
57
78
|
{
|