@vaadin/details 24.0.0-alpha6 → 24.0.0-alpha7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/src/vaadin-details-mixin.d.ts +2 -2
- package/src/vaadin-details-mixin.js +9 -7
- package/src/vaadin-details.js +55 -12
- package/web-types.json +39 -1
- package/web-types.lit.json +29 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/details",
|
|
3
|
-
"version": "24.0.0-
|
|
3
|
+
"version": "24.0.0-alpha7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
39
|
"@polymer/polymer": "^3.0.0",
|
|
40
|
-
"@vaadin/button": "24.0.0-
|
|
41
|
-
"@vaadin/component-base": "24.0.0-
|
|
42
|
-
"@vaadin/field-base": "24.0.0-
|
|
43
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
44
|
-
"@vaadin/vaadin-material-styles": "24.0.0-
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
40
|
+
"@vaadin/button": "24.0.0-alpha7",
|
|
41
|
+
"@vaadin/component-base": "24.0.0-alpha7",
|
|
42
|
+
"@vaadin/field-base": "24.0.0-alpha7",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha7",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha7",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha7"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"web-types.json",
|
|
54
54
|
"web-types.lit.json"
|
|
55
55
|
],
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "aeb4535336813636736759e0a5de148b26bfc3b6"
|
|
57
57
|
}
|
|
@@ -17,9 +17,9 @@ export declare class DetailsMixinClass {
|
|
|
17
17
|
opened: boolean;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* List of elements passed to the details default slot.
|
|
21
21
|
*/
|
|
22
|
-
protected
|
|
22
|
+
protected _contentElements: HTMLElement[];
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* An element used to toggle the content visibility.
|
|
@@ -25,12 +25,12 @@ export const DetailsMixin = (superClass) =>
|
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* List of elements passed to the details default slot.
|
|
29
29
|
*
|
|
30
30
|
* @protected
|
|
31
31
|
*/
|
|
32
|
-
|
|
33
|
-
type:
|
|
32
|
+
_contentElements: {
|
|
33
|
+
type: Array,
|
|
34
34
|
},
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -47,13 +47,15 @@ export const DetailsMixin = (superClass) =>
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
static get observers() {
|
|
50
|
-
return ['_openedOrToggleChanged(opened, _toggleElement)', '
|
|
50
|
+
return ['_openedOrToggleChanged(opened, _toggleElement)', '_openedOrContentChanged(opened, _contentElements)'];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/** @private */
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
|
|
54
|
+
_openedOrContentChanged(opened, elements) {
|
|
55
|
+
if (elements) {
|
|
56
|
+
elements.forEach((el) => {
|
|
57
|
+
el.setAttribute('aria-hidden', opened ? 'false' : 'true');
|
|
58
|
+
});
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
|
package/src/vaadin-details.js
CHANGED
|
@@ -8,6 +8,7 @@ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
|
8
8
|
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
9
9
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
10
|
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
11
|
+
import { SlotObserveController } from '@vaadin/component-base/src/slot-observe-controller.js';
|
|
11
12
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
12
13
|
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
13
14
|
import { DelegateStateMixin } from '@vaadin/field-base/src/delegate-state-mixin.js';
|
|
@@ -27,6 +28,25 @@ class SummaryController extends SlotController {
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
class ContentController extends SlotObserveController {
|
|
32
|
+
/**
|
|
33
|
+
* Override method from `SlotController` to change
|
|
34
|
+
* the ID prefix for the default slot content.
|
|
35
|
+
*
|
|
36
|
+
* @param {HTMLElement} host
|
|
37
|
+
* @return {string}
|
|
38
|
+
* @protected
|
|
39
|
+
* @override
|
|
40
|
+
*/
|
|
41
|
+
static generateId(host) {
|
|
42
|
+
return super.generateId(host, 'content');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
constructor(host) {
|
|
46
|
+
super(host, '', null, { multiple: true });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
30
50
|
/**
|
|
31
51
|
* `<vaadin-details>` is a Web Component which the creates an
|
|
32
52
|
* expandable panel similar to `<details>` HTML element.
|
|
@@ -120,18 +140,9 @@ class Details extends DetailsMixin(
|
|
|
120
140
|
ready() {
|
|
121
141
|
super.ready();
|
|
122
142
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
this._collapsible = this.shadowRoot.querySelector('[part="content"]');
|
|
127
|
-
|
|
128
|
-
this.addController(new SummaryController(this));
|
|
129
|
-
|
|
130
|
-
this._tooltipController = new TooltipController(this);
|
|
131
|
-
this.addController(this._tooltipController);
|
|
132
|
-
|
|
133
|
-
this._tooltipController.setTarget(this._toggleElement);
|
|
134
|
-
this._tooltipController.setPosition('bottom-start');
|
|
143
|
+
this._initSummary();
|
|
144
|
+
this._initContent();
|
|
145
|
+
this._initTooltip();
|
|
135
146
|
}
|
|
136
147
|
|
|
137
148
|
/**
|
|
@@ -144,6 +155,38 @@ class Details extends DetailsMixin(
|
|
|
144
155
|
_setAriaDisabled() {
|
|
145
156
|
// The `aria-disabled` is set on the details summary.
|
|
146
157
|
}
|
|
158
|
+
|
|
159
|
+
/** @private */
|
|
160
|
+
_initSummary() {
|
|
161
|
+
this._summaryController = new SummaryController(this);
|
|
162
|
+
this.addController(this._summaryController);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** @private */
|
|
166
|
+
_initContent() {
|
|
167
|
+
this._contentController = new ContentController(this);
|
|
168
|
+
this._contentController.addEventListener('slot-content-changed', (event) => {
|
|
169
|
+
// Store nodes to toggle `aria-hidden` attribute
|
|
170
|
+
const { nodes } = event.target;
|
|
171
|
+
this._contentElements = nodes;
|
|
172
|
+
|
|
173
|
+
if (nodes[0] && nodes[0].id) {
|
|
174
|
+
this._toggleElement.setAttribute('aria-controls', nodes[0].id);
|
|
175
|
+
} else {
|
|
176
|
+
this._toggleElement.removeAttribute('aria-controls');
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
this.addController(this._contentController);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** @private */
|
|
183
|
+
_initTooltip() {
|
|
184
|
+
this._tooltipController = new TooltipController(this);
|
|
185
|
+
this.addController(this._tooltipController);
|
|
186
|
+
|
|
187
|
+
this._tooltipController.setTarget(this._toggleElement);
|
|
188
|
+
this._tooltipController.setPosition('bottom-start');
|
|
189
|
+
}
|
|
147
190
|
}
|
|
148
191
|
|
|
149
192
|
customElements.define(Details.is, Details);
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/details",
|
|
4
|
-
"version": "24.0.0-
|
|
4
|
+
"version": "24.0.0-alpha7",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -133,6 +133,44 @@
|
|
|
133
133
|
"undefined"
|
|
134
134
|
]
|
|
135
135
|
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "rootPath",
|
|
139
|
+
"description": "",
|
|
140
|
+
"value": {
|
|
141
|
+
"type": [
|
|
142
|
+
"string"
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "importPath",
|
|
148
|
+
"description": "",
|
|
149
|
+
"value": {
|
|
150
|
+
"type": [
|
|
151
|
+
"string"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "root",
|
|
157
|
+
"description": "",
|
|
158
|
+
"value": {
|
|
159
|
+
"type": [
|
|
160
|
+
"StampedTemplate",
|
|
161
|
+
"HTMLElement",
|
|
162
|
+
"ShadowRoot"
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "$",
|
|
168
|
+
"description": "",
|
|
169
|
+
"value": {
|
|
170
|
+
"type": [
|
|
171
|
+
"Object.<string, Element>"
|
|
172
|
+
]
|
|
173
|
+
}
|
|
136
174
|
}
|
|
137
175
|
],
|
|
138
176
|
"events": []
|
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/details",
|
|
4
|
-
"version": "24.0.0-
|
|
4
|
+
"version": "24.0.0-alpha7",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -53,6 +53,34 @@
|
|
|
53
53
|
"value": {
|
|
54
54
|
"kind": "expression"
|
|
55
55
|
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": ".rootPath",
|
|
59
|
+
"description": "",
|
|
60
|
+
"value": {
|
|
61
|
+
"kind": "expression"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": ".importPath",
|
|
66
|
+
"description": "",
|
|
67
|
+
"value": {
|
|
68
|
+
"kind": "expression"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": ".root",
|
|
73
|
+
"description": "",
|
|
74
|
+
"value": {
|
|
75
|
+
"kind": "expression"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": ".$",
|
|
80
|
+
"description": "",
|
|
81
|
+
"value": {
|
|
82
|
+
"kind": "expression"
|
|
83
|
+
}
|
|
56
84
|
}
|
|
57
85
|
]
|
|
58
86
|
}
|