@vaadin/side-nav 24.9.0-alpha1 → 24.9.0-alpha2
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 +9 -9
- package/src/vaadin-side-nav-item.js +31 -2
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/side-nav",
|
|
3
|
-
"version": "24.9.0-
|
|
3
|
+
"version": "24.9.0-alpha2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,16 +35,16 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "24.9.0-
|
|
39
|
-
"@vaadin/component-base": "24.9.0-
|
|
40
|
-
"@vaadin/vaadin-lumo-styles": "24.9.0-
|
|
41
|
-
"@vaadin/vaadin-material-styles": "24.9.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "24.9.0-
|
|
38
|
+
"@vaadin/a11y-base": "24.9.0-alpha2",
|
|
39
|
+
"@vaadin/component-base": "24.9.0-alpha2",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "24.9.0-alpha2",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "24.9.0-alpha2",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "24.9.0-alpha2",
|
|
43
43
|
"lit": "^3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@vaadin/chai-plugins": "24.9.0-
|
|
47
|
-
"@vaadin/test-runner-commands": "24.9.0-
|
|
46
|
+
"@vaadin/chai-plugins": "24.9.0-alpha2",
|
|
47
|
+
"@vaadin/test-runner-commands": "24.9.0-alpha2",
|
|
48
48
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
49
49
|
"lit": "^3.0.0",
|
|
50
50
|
"sinon": "^18.0.0"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"web-types.json",
|
|
54
54
|
"web-types.lit.json"
|
|
55
55
|
],
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "dd99dece1b54942ab0e421892b089e506822c5f5"
|
|
57
57
|
}
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
import { html, LitElement } from 'lit';
|
|
7
7
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
8
8
|
import { DisabledMixin } from '@vaadin/a11y-base/src/disabled-mixin.js';
|
|
9
|
+
import { screenReaderOnly } from '@vaadin/a11y-base/src/styles/sr-only-styles.js';
|
|
9
10
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
10
11
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
11
12
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
13
|
+
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
12
14
|
import { matchPaths } from '@vaadin/component-base/src/url-utils.js';
|
|
13
15
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
16
|
import { location } from './location.js';
|
|
@@ -171,11 +173,16 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
171
173
|
type: Boolean,
|
|
172
174
|
value: false,
|
|
173
175
|
},
|
|
176
|
+
|
|
177
|
+
/** @private */
|
|
178
|
+
__tooltipText: {
|
|
179
|
+
type: String,
|
|
180
|
+
},
|
|
174
181
|
};
|
|
175
182
|
}
|
|
176
183
|
|
|
177
184
|
static get styles() {
|
|
178
|
-
return [sideNavItemBaseStyles];
|
|
185
|
+
return [sideNavItemBaseStyles, screenReaderOnly];
|
|
179
186
|
}
|
|
180
187
|
|
|
181
188
|
constructor() {
|
|
@@ -243,7 +250,7 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
243
250
|
/** @protected */
|
|
244
251
|
render() {
|
|
245
252
|
return html`
|
|
246
|
-
<div part="content" @click="${this._onContentClick}">
|
|
253
|
+
<div id="content" part="content" @click="${this._onContentClick}">
|
|
247
254
|
<a
|
|
248
255
|
id="link"
|
|
249
256
|
?disabled="${this.disabled}"
|
|
@@ -256,6 +263,7 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
256
263
|
>
|
|
257
264
|
<slot name="prefix"></slot>
|
|
258
265
|
<slot></slot>
|
|
266
|
+
<div class="sr-only">${this.__tooltipText}</div>
|
|
259
267
|
<slot name="suffix"></slot>
|
|
260
268
|
</a>
|
|
261
269
|
<button
|
|
@@ -271,9 +279,30 @@ class SideNavItem extends SideNavChildrenMixin(DisabledMixin(ElementMixin(Themab
|
|
|
271
279
|
<slot name="children"></slot>
|
|
272
280
|
</ul>
|
|
273
281
|
<div hidden id="i18n">${this.__effectiveI18n.toggle}</div>
|
|
282
|
+
<slot name="tooltip"></slot>
|
|
274
283
|
`;
|
|
275
284
|
}
|
|
276
285
|
|
|
286
|
+
/** @protected */
|
|
287
|
+
ready() {
|
|
288
|
+
super.ready();
|
|
289
|
+
|
|
290
|
+
this._tooltipController = new TooltipController(this);
|
|
291
|
+
this._tooltipController.setTarget(this.$.content);
|
|
292
|
+
this._tooltipController.setAriaTarget(null);
|
|
293
|
+
this._tooltipController.addEventListener('tooltip-changed', (event) => {
|
|
294
|
+
const { node } = event.detail;
|
|
295
|
+
if (node) {
|
|
296
|
+
const overlay = node._overlayElement;
|
|
297
|
+
this.__tooltipText = overlay ? overlay.textContent.trim() : '';
|
|
298
|
+
node.setAttribute('aria-hidden', 'true');
|
|
299
|
+
} else {
|
|
300
|
+
this.__tooltipText = '';
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
this.addController(this._tooltipController);
|
|
304
|
+
}
|
|
305
|
+
|
|
277
306
|
/** @private */
|
|
278
307
|
_onButtonClick(event) {
|
|
279
308
|
// Prevent the event from being handled
|
package/web-types.json
CHANGED