@vaadin/accordion 24.8.0-alpha8 → 25.0.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 +0 -23
- package/package.json +14 -13
- package/src/vaadin-accordion-heading.js +20 -28
- package/src/vaadin-accordion-mixin.js +7 -0
- package/src/vaadin-accordion-panel-mixin.js +15 -0
- package/src/vaadin-accordion-panel.js +11 -9
- package/src/vaadin-accordion.js +18 -15
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
- package/src/vaadin-lit-accordion-heading.d.ts +0 -1
- package/src/vaadin-lit-accordion-heading.js +0 -73
- package/src/vaadin-lit-accordion-panel.d.ts +0 -1
- package/src/vaadin-lit-accordion-panel.js +0 -48
- package/src/vaadin-lit-accordion.d.ts +0 -1
- package/src/vaadin-lit-accordion.js +0 -48
- package/theme/lumo/vaadin-lit-accordion-heading.d.ts +0 -2
- package/theme/lumo/vaadin-lit-accordion-heading.js +0 -2
- package/theme/lumo/vaadin-lit-accordion-panel.d.ts +0 -3
- package/theme/lumo/vaadin-lit-accordion-panel.js +0 -3
- package/theme/lumo/vaadin-lit-accordion.d.ts +0 -2
- package/theme/lumo/vaadin-lit-accordion.js +0 -2
- package/theme/material/vaadin-accordion-heading-styles.d.ts +0 -1
- package/theme/material/vaadin-accordion-heading-styles.js +0 -44
- package/theme/material/vaadin-accordion-heading.d.ts +0 -2
- package/theme/material/vaadin-accordion-heading.js +0 -2
- package/theme/material/vaadin-accordion-panel-styles.d.ts +0 -1
- package/theme/material/vaadin-accordion-panel-styles.js +0 -17
- package/theme/material/vaadin-accordion-panel.d.ts +0 -3
- package/theme/material/vaadin-accordion-panel.js +0 -3
- package/theme/material/vaadin-accordion.d.ts +0 -2
- package/theme/material/vaadin-accordion.js +0 -2
- package/theme/material/vaadin-lit-accordion-heading.d.ts +0 -2
- package/theme/material/vaadin-lit-accordion-heading.js +0 -2
- package/theme/material/vaadin-lit-accordion-panel.d.ts +0 -3
- package/theme/material/vaadin-lit-accordion-panel.js +0 -3
- package/theme/material/vaadin-lit-accordion.d.ts +0 -2
- package/theme/material/vaadin-lit-accordion.js +0 -2
- package/vaadin-lit-accordion-heading.d.ts +0 -1
- package/vaadin-lit-accordion-heading.js +0 -2
- package/vaadin-lit-accordion-panel.d.ts +0 -1
- package/vaadin-lit-accordion-panel.js +0 -2
- package/vaadin-lit-accordion.d.ts +0 -1
- package/vaadin-lit-accordion.js +0 -2
- /package/src/{vaadin-accordion-heading-styles.d.ts → vaadin-accordion-heading-core-styles.d.ts} +0 -0
- /package/src/{vaadin-accordion-heading-styles.js → vaadin-accordion-heading-core-styles.js} +0 -0
- /package/src/{vaadin-accordion-panel-styles.d.ts → vaadin-accordion-panel-core-styles.d.ts} +0 -0
- /package/src/{vaadin-accordion-panel-styles.js → vaadin-accordion-panel-core-styles.js} +0 -0
package/README.md
CHANGED
|
@@ -35,29 +35,6 @@ Once installed, import the component in your application:
|
|
|
35
35
|
import '@vaadin/accordion';
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
## Themes
|
|
39
|
-
|
|
40
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
41
|
-
The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/accordion/vaadin-accordion.js) of the package uses the Lumo theme.
|
|
42
|
-
|
|
43
|
-
To use the Material theme, import the component from the `theme/material` folder:
|
|
44
|
-
|
|
45
|
-
```js
|
|
46
|
-
import '@vaadin/accordion/theme/material/vaadin-accordion.js';
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
You can also import the Lumo version of the component explicitly:
|
|
50
|
-
|
|
51
|
-
```js
|
|
52
|
-
import '@vaadin/accordion/theme/lumo/vaadin-accordion.js';
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
|
|
56
|
-
|
|
57
|
-
```js
|
|
58
|
-
import '@vaadin/accordion/src/vaadin-accordion.js';
|
|
59
|
-
```
|
|
60
|
-
|
|
61
38
|
## Contributing
|
|
62
39
|
|
|
63
40
|
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/accordion",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
+
"!src/vaadin-accordion-heading-base-styles.d.ts",
|
|
25
|
+
"!src/vaadin-accordion-heading-base-styles.js",
|
|
26
|
+
"!src/vaadin-accordion-panel-base-styles.d.ts",
|
|
27
|
+
"!src/vaadin-accordion-panel-base-styles.js",
|
|
24
28
|
"theme",
|
|
25
29
|
"vaadin-*.d.ts",
|
|
26
30
|
"vaadin-*.js",
|
|
@@ -31,23 +35,20 @@
|
|
|
31
35
|
"Vaadin",
|
|
32
36
|
"vaadin-accordion",
|
|
33
37
|
"web-components",
|
|
34
|
-
"web-component"
|
|
35
|
-
"polymer"
|
|
38
|
+
"web-component"
|
|
36
39
|
],
|
|
37
40
|
"dependencies": {
|
|
38
41
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
|
-
"@
|
|
40
|
-
"@vaadin/
|
|
41
|
-
"@vaadin/
|
|
42
|
-
"@vaadin/
|
|
43
|
-
"@vaadin/vaadin-
|
|
44
|
-
"@vaadin/vaadin-material-styles": "24.8.0-alpha8",
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
|
|
42
|
+
"@vaadin/a11y-base": "25.0.0-alpha1",
|
|
43
|
+
"@vaadin/component-base": "25.0.0-alpha1",
|
|
44
|
+
"@vaadin/details": "25.0.0-alpha1",
|
|
45
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
|
|
46
47
|
"lit": "^3.0.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"@vaadin/chai-plugins": "
|
|
50
|
-
"@vaadin/test-runner-commands": "
|
|
50
|
+
"@vaadin/chai-plugins": "25.0.0-alpha1",
|
|
51
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha1",
|
|
51
52
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
52
53
|
"sinon": "^18.0.0"
|
|
53
54
|
},
|
|
@@ -55,5 +56,5 @@
|
|
|
55
56
|
"web-types.json",
|
|
56
57
|
"web-types.lit.json"
|
|
57
58
|
],
|
|
58
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
|
|
59
60
|
}
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
7
|
import { ActiveMixin } from '@vaadin/a11y-base/src/active-mixin.js';
|
|
8
8
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
9
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
registerStyles('vaadin-accordion-heading', accordionHeading, { moduleId: 'vaadin-accordion-heading-styles' });
|
|
10
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
+
import { accordionHeading } from './vaadin-accordion-heading-core-styles.js';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* The accordion heading element.
|
|
@@ -51,18 +50,17 @@ registerStyles('vaadin-accordion-heading', accordionHeading, { moduleId: 'vaadin
|
|
|
51
50
|
* @mixes DirMixin
|
|
52
51
|
* @mixes ThemableMixin
|
|
53
52
|
*/
|
|
54
|
-
class AccordionHeading extends ActiveMixin(DirMixin(ThemableMixin(
|
|
53
|
+
class AccordionHeading extends ActiveMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
55
54
|
static get is() {
|
|
56
55
|
return 'vaadin-accordion-heading';
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
static get
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
`;
|
|
58
|
+
static get shadowRootOptions() {
|
|
59
|
+
return { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static get styles() {
|
|
63
|
+
return accordionHeading;
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
static get properties() {
|
|
@@ -73,21 +71,20 @@ class AccordionHeading extends ActiveMixin(DirMixin(ThemableMixin(PolymerElement
|
|
|
73
71
|
opened: {
|
|
74
72
|
type: Boolean,
|
|
75
73
|
reflectToAttribute: true,
|
|
74
|
+
sync: true,
|
|
76
75
|
value: false,
|
|
77
76
|
},
|
|
78
77
|
};
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
root.appendChild(dom);
|
|
90
|
-
return root;
|
|
80
|
+
/** @protected */
|
|
81
|
+
render() {
|
|
82
|
+
return html`
|
|
83
|
+
<button id="button" part="content" ?disabled="${this.disabled}" aria-expanded="${this.opened ? 'true' : 'false'}">
|
|
84
|
+
<span part="toggle" aria-hidden="true"></span>
|
|
85
|
+
<slot></slot>
|
|
86
|
+
</button>
|
|
87
|
+
`;
|
|
91
88
|
}
|
|
92
89
|
|
|
93
90
|
/** @protected */
|
|
@@ -100,11 +97,6 @@ class AccordionHeading extends ActiveMixin(DirMixin(ThemableMixin(PolymerElement
|
|
|
100
97
|
this.setAttribute('role', 'heading');
|
|
101
98
|
}
|
|
102
99
|
}
|
|
103
|
-
|
|
104
|
-
/** @private */
|
|
105
|
-
__updateAriaExpanded(opened) {
|
|
106
|
-
return opened ? 'true' : 'false';
|
|
107
|
-
}
|
|
108
100
|
}
|
|
109
101
|
|
|
110
102
|
defineCustomElement(AccordionHeading);
|
|
@@ -114,10 +114,12 @@ export const AccordionMixin = (superClass) =>
|
|
|
114
114
|
/** @private */
|
|
115
115
|
_updateItems(items, opened) {
|
|
116
116
|
if (items) {
|
|
117
|
+
this.__itemsSync = true;
|
|
117
118
|
const itemToOpen = items[opened];
|
|
118
119
|
items.forEach((item) => {
|
|
119
120
|
item.opened = item === itemToOpen;
|
|
120
121
|
});
|
|
122
|
+
this.__itemsSync = false;
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
|
|
@@ -140,6 +142,11 @@ export const AccordionMixin = (superClass) =>
|
|
|
140
142
|
|
|
141
143
|
/** @private */
|
|
142
144
|
_updateOpened(e) {
|
|
145
|
+
// Item sync applies the current opened index to each item, in which
|
|
146
|
+
// case we don't need to update the opened index again.
|
|
147
|
+
if (this.__itemsSync) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
143
150
|
const target = this._filterItems(e.composedPath())[0];
|
|
144
151
|
const idx = this.items.indexOf(target);
|
|
145
152
|
if (e.detail.value) {
|
|
@@ -57,6 +57,21 @@ export const AccordionPanelMixin = (superClass) =>
|
|
|
57
57
|
this._tooltipController.setPosition('bottom-start');
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @protected
|
|
62
|
+
* @override
|
|
63
|
+
*/
|
|
64
|
+
__forwardTabIndex(tabindex) {
|
|
65
|
+
super.__forwardTabIndex(tabindex);
|
|
66
|
+
if (tabindex !== undefined && this.focusElement) {
|
|
67
|
+
// Forward the tabIndex to the button inside the heading
|
|
68
|
+
// instead of the heading itself
|
|
69
|
+
this.focusElement.$.button.tabIndex = tabindex;
|
|
70
|
+
// Revert the tabIndex value of the heading
|
|
71
|
+
this.focusElement.tabIndex = -1;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
60
75
|
/** @protected */
|
|
61
76
|
ready() {
|
|
62
77
|
super.ready();
|
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-accordion-heading.js';
|
|
7
|
-
import { html,
|
|
8
|
-
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
7
|
+
import { html, LitElement } from 'lit';
|
|
9
8
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
|
-
import {
|
|
9
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
+
import { accordionPanel } from './vaadin-accordion-panel-core-styles.js';
|
|
11
12
|
import { AccordionPanelMixin } from './vaadin-accordion-panel-mixin.js';
|
|
12
|
-
import { accordionPanel } from './vaadin-accordion-panel-styles.js';
|
|
13
|
-
|
|
14
|
-
registerStyles('vaadin-accordion-panel', accordionPanel, { moduleId: 'vaadin-accordion-panel-styles' });
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* The accordion panel element.
|
|
@@ -40,15 +38,19 @@ registerStyles('vaadin-accordion-panel', accordionPanel, { moduleId: 'vaadin-acc
|
|
|
40
38
|
* @customElement
|
|
41
39
|
* @extends HTMLElement
|
|
42
40
|
* @mixes AccordionPanelMixin
|
|
43
|
-
* @mixes ControllerMixin
|
|
44
41
|
* @mixes ThemableMixin
|
|
45
42
|
*/
|
|
46
|
-
class AccordionPanel extends AccordionPanelMixin(ThemableMixin(
|
|
43
|
+
class AccordionPanel extends AccordionPanelMixin(ThemableMixin(PolylitMixin(LitElement))) {
|
|
47
44
|
static get is() {
|
|
48
45
|
return 'vaadin-accordion-panel';
|
|
49
46
|
}
|
|
50
47
|
|
|
51
|
-
static get
|
|
48
|
+
static get styles() {
|
|
49
|
+
return accordionPanel;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** @protected */
|
|
53
|
+
render() {
|
|
52
54
|
return html`
|
|
53
55
|
<slot name="summary"></slot>
|
|
54
56
|
|
package/src/vaadin-accordion.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import './vaadin-accordion-panel.js';
|
|
7
|
-
import { html,
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
8
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
9
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
12
|
import { AccordionMixin } from './vaadin-accordion-mixin.js';
|
|
12
13
|
|
|
@@ -60,24 +61,26 @@ import { AccordionMixin } from './vaadin-accordion-mixin.js';
|
|
|
60
61
|
* @mixes ElementMixin
|
|
61
62
|
* @mixes ThemableMixin
|
|
62
63
|
*/
|
|
63
|
-
class Accordion extends AccordionMixin(ThemableMixin(ElementMixin(
|
|
64
|
-
static get
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
:host {
|
|
68
|
-
display: block;
|
|
69
|
-
}
|
|
64
|
+
class Accordion extends AccordionMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
|
|
65
|
+
static get is() {
|
|
66
|
+
return 'vaadin-accordion';
|
|
67
|
+
}
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
static get styles() {
|
|
70
|
+
return css`
|
|
71
|
+
:host {
|
|
72
|
+
display: block;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:host([hidden]) {
|
|
76
|
+
display: none !important;
|
|
77
|
+
}
|
|
76
78
|
`;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
/** @protected */
|
|
82
|
+
render() {
|
|
83
|
+
return html`<slot></slot>`;
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
package/web-types.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": "25.0.0-alpha1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
},
|
|
186
186
|
{
|
|
187
187
|
"name": "vaadin-accordion",
|
|
188
|
-
"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/
|
|
188
|
+
"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/25.0.0-alpha1/#/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/styling-components) documentation.",
|
|
189
189
|
"attributes": [
|
|
190
190
|
{
|
|
191
191
|
"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": "25.0.0-alpha1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
"name": "vaadin-accordion",
|
|
82
|
-
"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/
|
|
82
|
+
"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/25.0.0-alpha1/#/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/styling-components) documentation.",
|
|
83
83
|
"extension": true,
|
|
84
84
|
"attributes": [
|
|
85
85
|
{
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-accordion-heading.js';
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import { html, LitElement } from 'lit';
|
|
7
|
-
import { ActiveMixin } from '@vaadin/a11y-base/src/active-mixin.js';
|
|
8
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
10
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
-
import { accordionHeading } from './vaadin-accordion-heading-styles.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* LitElement based version of `<vaadin-accordion-heading>` web component.
|
|
16
|
-
*
|
|
17
|
-
* ## Disclaimer
|
|
18
|
-
*
|
|
19
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
20
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
21
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
22
|
-
*/
|
|
23
|
-
class AccordionHeading extends ActiveMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
24
|
-
static get is() {
|
|
25
|
-
return 'vaadin-accordion-heading';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static get shadowRootOptions() {
|
|
29
|
-
return { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static get styles() {
|
|
33
|
-
return accordionHeading;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
static get properties() {
|
|
37
|
-
return {
|
|
38
|
-
/**
|
|
39
|
-
* When true, the element is opened.
|
|
40
|
-
*/
|
|
41
|
-
opened: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
reflectToAttribute: true,
|
|
44
|
-
value: false,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** @protected */
|
|
50
|
-
render() {
|
|
51
|
-
return html`
|
|
52
|
-
<button id="button" part="content" ?disabled="${this.disabled}" aria-expanded="${this.opened ? 'true' : 'false'}">
|
|
53
|
-
<span part="toggle" aria-hidden="true"></span>
|
|
54
|
-
<slot></slot>
|
|
55
|
-
</button>
|
|
56
|
-
`;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** @protected */
|
|
60
|
-
ready() {
|
|
61
|
-
super.ready();
|
|
62
|
-
|
|
63
|
-
// By default, if the user hasn't provided a custom role,
|
|
64
|
-
// the role attribute is set to "heading".
|
|
65
|
-
if (!this.hasAttribute('role')) {
|
|
66
|
-
this.setAttribute('role', 'heading');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
defineCustomElement(AccordionHeading);
|
|
72
|
-
|
|
73
|
-
export { AccordionHeading };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-accordion-panel.js';
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import './vaadin-lit-accordion-heading.js';
|
|
7
|
-
import { html, LitElement } from 'lit';
|
|
8
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
-
import { AccordionPanelMixin } from './vaadin-accordion-panel-mixin.js';
|
|
12
|
-
import { accordionPanel } from './vaadin-accordion-panel-styles.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* LitElement based version of `<vaadin-accordion-panel>` web component.
|
|
16
|
-
*
|
|
17
|
-
* ## Disclaimer
|
|
18
|
-
*
|
|
19
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
20
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
21
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
22
|
-
*/
|
|
23
|
-
class AccordionPanel extends AccordionPanelMixin(ThemableMixin(PolylitMixin(LitElement))) {
|
|
24
|
-
static get is() {
|
|
25
|
-
return 'vaadin-accordion-panel';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static get styles() {
|
|
29
|
-
return accordionPanel;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** @protected */
|
|
33
|
-
render() {
|
|
34
|
-
return html`
|
|
35
|
-
<slot name="summary"></slot>
|
|
36
|
-
|
|
37
|
-
<div part="content">
|
|
38
|
-
<slot></slot>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<slot name="tooltip"></slot>
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
defineCustomElement(AccordionPanel);
|
|
47
|
-
|
|
48
|
-
export { AccordionPanel };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './vaadin-accordion.js';
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2019 - 2025 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import './vaadin-lit-accordion-panel.js';
|
|
7
|
-
import { css, html, LitElement } from 'lit';
|
|
8
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
9
|
-
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
11
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
-
import { AccordionMixin } from './vaadin-accordion-mixin.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* LitElement based version of `<vaadin-accordion>` web component.
|
|
16
|
-
*
|
|
17
|
-
* ## Disclaimer
|
|
18
|
-
*
|
|
19
|
-
* This component is an experiment and not yet a part of Vaadin platform.
|
|
20
|
-
* There is no ETA regarding specific Vaadin version where it'll land.
|
|
21
|
-
* Feel free to try this code in your apps as per Apache 2.0 license.
|
|
22
|
-
*/
|
|
23
|
-
class Accordion extends AccordionMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement)))) {
|
|
24
|
-
static get is() {
|
|
25
|
-
return 'vaadin-accordion';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static get styles() {
|
|
29
|
-
return css`
|
|
30
|
-
:host {
|
|
31
|
-
display: block;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
:host([hidden]) {
|
|
35
|
-
display: none !important;
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** @protected */
|
|
41
|
-
render() {
|
|
42
|
-
return html`<slot></slot>`;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
defineCustomElement(Accordion);
|
|
47
|
-
|
|
48
|
-
export { Accordion };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import '@vaadin/vaadin-material-styles/color.js';
|
|
2
|
-
import { details } from '@vaadin/details/theme/material/vaadin-details-styles.js';
|
|
3
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
|
-
|
|
5
|
-
const accordionPanel = css`
|
|
6
|
-
:host([opened]:not(:first-child)) {
|
|
7
|
-
margin-top: 16px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
:host([opened]:not(:last-child)) {
|
|
11
|
-
margin-bottom: 16px;
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
registerStyles('vaadin-accordion-panel', [details, accordionPanel], {
|
|
16
|
-
moduleId: 'material-accordion-panel',
|
|
17
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-accordion-heading.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-accordion-panel.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/vaadin-accordion.js';
|
package/vaadin-lit-accordion.js
DELETED
/package/src/{vaadin-accordion-heading-styles.d.ts → vaadin-accordion-heading-core-styles.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|