@vaadin/tooltip 25.2.0-beta1 → 25.2.0-rc1

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.
@@ -26,6 +26,16 @@
26
26
  "description": "A mixin providing common tooltip functionality.",
27
27
  "name": "TooltipMixin",
28
28
  "members": [
29
+ {
30
+ "kind": "field",
31
+ "name": "ariaLinkMode",
32
+ "privacy": "public",
33
+ "type": {
34
+ "text": "string"
35
+ },
36
+ "description": "Controls which ARIA attribute is used to link the target element(s)\nwith the tooltip content. Supported values:\n\n- `aria-describedby` - links the tooltip as a description.\n- `aria-labelledby` - links the tooltip as an accessible name.\n- `none` - does not add any ARIA linking attribute.\n\nDefaults to `aria-describedby`.",
37
+ "attribute": "aria-link-mode"
38
+ },
29
39
  {
30
40
  "kind": "field",
31
41
  "name": "ariaTarget",
@@ -33,7 +43,7 @@
33
43
  "type": {
34
44
  "text": "object"
35
45
  },
36
- "description": "Element used to link with the `aria-describedby`\nattribute. Supports array of multiple elements.\nWhen not set, defaults to `target`.",
46
+ "description": "Element used to link with the ARIA attribute controlled by the\n`ariaLinkMode` property. Supports array of multiple elements.\nWhen not set, defaults to `target`.",
37
47
  "attribute": "aria-target"
38
48
  },
39
49
  {
@@ -230,6 +240,14 @@
230
240
  }
231
241
  ],
232
242
  "attributes": [
243
+ {
244
+ "name": "aria-link-mode",
245
+ "type": {
246
+ "text": "string"
247
+ },
248
+ "description": "Controls which ARIA attribute is used to link the target element(s)\nwith the tooltip content. Supported values:\n\n- `aria-describedby` - links the tooltip as a description.\n- `aria-labelledby` - links the tooltip as an accessible name.\n- `none` - does not add any ARIA linking attribute.\n\nDefaults to `aria-describedby`.",
249
+ "fieldName": "ariaLinkMode"
250
+ },
233
251
  {
234
252
  "name": "focus-delay",
235
253
  "type": {
@@ -348,6 +366,20 @@
348
366
  "description": "`<vaadin-tooltip>` is a Web Component for creating tooltips.\n\n```html\n<button id=\"confirm\">Confirm</button>\n<vaadin-tooltip text=\"Click to save changes\" for=\"confirm\"></vaadin-tooltip>\n```\n\n### Markdown Support\n\nThe tooltip supports rendering Markdown content by setting the `markdown` property:\n\n```html\n<button id=\"info\">Info</button>\n<vaadin-tooltip\n text=\"**Important:** Click to view *detailed* information\"\n markdown\n for=\"info\">\n</vaadin-tooltip>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------- | ---------------\n`overlay` | The overlay element\n`content` | The overlay content element\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`markdown` | Reflects the `markdown` property value.\n`position` | Reflects the `position` property value.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------|\n| `--vaadin-tooltip-background` |\n| `--vaadin-tooltip-border-color` |\n| `--vaadin-tooltip-border-radius` |\n| `--vaadin-tooltip-border-width` |\n| `--vaadin-tooltip-font-size` |\n| `--vaadin-tooltip-font-weight` |\n| `--vaadin-tooltip-line-height` |\n| `--vaadin-tooltip-max-width` |\n| `--vaadin-tooltip-offset-bottom` |\n| `--vaadin-tooltip-offset-end` |\n| `--vaadin-tooltip-offset-start` |\n| `--vaadin-tooltip-offset-top` |\n| `--vaadin-tooltip-padding` |\n| `--vaadin-tooltip-shadow` |\n| `--vaadin-tooltip-text-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
349
367
  "name": "Tooltip",
350
368
  "members": [
369
+ {
370
+ "kind": "field",
371
+ "name": "ariaLinkMode",
372
+ "privacy": "public",
373
+ "type": {
374
+ "text": "string"
375
+ },
376
+ "description": "Controls which ARIA attribute is used to link the target element(s)\nwith the tooltip content. Supported values:\n\n- `aria-describedby` - links the tooltip as a description.\n- `aria-labelledby` - links the tooltip as an accessible name.\n- `none` - does not add any ARIA linking attribute.\n\nDefaults to `aria-describedby`.",
377
+ "attribute": "aria-link-mode",
378
+ "inheritedFrom": {
379
+ "name": "TooltipMixin",
380
+ "module": "src/vaadin-tooltip-mixin.js"
381
+ }
382
+ },
351
383
  {
352
384
  "kind": "field",
353
385
  "name": "ariaTarget",
@@ -355,7 +387,7 @@
355
387
  "type": {
356
388
  "text": "object"
357
389
  },
358
- "description": "Element used to link with the `aria-describedby`\nattribute. Supports array of multiple elements.\nWhen not set, defaults to `target`.",
390
+ "description": "Element used to link with the ARIA attribute controlled by the\n`ariaLinkMode` property. Supports array of multiple elements.\nWhen not set, defaults to `target`.",
359
391
  "attribute": "aria-target",
360
392
  "inheritedFrom": {
361
393
  "name": "TooltipMixin",
@@ -637,6 +669,18 @@
637
669
  "tagName": "vaadin-tooltip",
638
670
  "customElement": true,
639
671
  "attributes": [
672
+ {
673
+ "name": "aria-link-mode",
674
+ "type": {
675
+ "text": "string"
676
+ },
677
+ "description": "Controls which ARIA attribute is used to link the target element(s)\nwith the tooltip content. Supported values:\n\n- `aria-describedby` - links the tooltip as a description.\n- `aria-labelledby` - links the tooltip as an accessible name.\n- `none` - does not add any ARIA linking attribute.\n\nDefaults to `aria-describedby`.",
678
+ "fieldName": "ariaLinkMode",
679
+ "inheritedFrom": {
680
+ "name": "TooltipMixin",
681
+ "module": "src/vaadin-tooltip-mixin.js"
682
+ }
683
+ },
640
684
  {
641
685
  "name": "focus-delay",
642
686
  "type": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/tooltip",
3
- "version": "25.2.0-beta1",
3
+ "version": "25.2.0-rc1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,26 +35,26 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@vaadin/a11y-base": "25.2.0-beta1",
39
- "@vaadin/component-base": "25.2.0-beta1",
40
- "@vaadin/markdown": "25.2.0-beta1",
41
- "@vaadin/overlay": "25.2.0-beta1",
42
- "@vaadin/popover": "25.2.0-beta1",
43
- "@vaadin/vaadin-themable-mixin": "25.2.0-beta1",
38
+ "@vaadin/a11y-base": "25.2.0-rc1",
39
+ "@vaadin/component-base": "25.2.0-rc1",
40
+ "@vaadin/markdown": "25.2.0-rc1",
41
+ "@vaadin/overlay": "25.2.0-rc1",
42
+ "@vaadin/popover": "25.2.0-rc1",
43
+ "@vaadin/vaadin-themable-mixin": "25.2.0-rc1",
44
44
  "lit": "^3.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@vaadin/aura": "25.2.0-beta1",
48
- "@vaadin/chai-plugins": "25.2.0-beta1",
49
- "@vaadin/test-runner-commands": "25.2.0-beta1",
47
+ "@vaadin/aura": "25.2.0-rc1",
48
+ "@vaadin/chai-plugins": "25.2.0-rc1",
49
+ "@vaadin/test-runner-commands": "25.2.0-rc1",
50
50
  "@vaadin/testing-helpers": "^2.0.0",
51
- "@vaadin/vaadin-lumo-styles": "25.2.0-beta1",
52
- "sinon": "^21.0.2"
51
+ "@vaadin/vaadin-lumo-styles": "25.2.0-rc1",
52
+ "sinon": "^22.0.0"
53
53
  },
54
54
  "customElements": "custom-elements.json",
55
55
  "web-types": [
56
56
  "web-types.json",
57
57
  "web-types.lit.json"
58
58
  ],
59
- "gitHead": "471a23f60d1eb725f98a33f62cb9664d9c0a4163"
59
+ "gitHead": "7c581b396dbb889f75c8073d6b4d25537a65b873"
60
60
  }
@@ -18,12 +18,26 @@ export declare function TooltipMixin<T extends Constructor<HTMLElement>>(
18
18
 
19
19
  export declare class TooltipMixinClass {
20
20
  /**
21
- * Element used to link with the `aria-describedby`
22
- * attribute. Supports array of multiple elements.
21
+ * Element used to link with the ARIA attribute controlled by the
22
+ * `ariaLinkMode` property. Supports array of multiple elements.
23
23
  * When not set, defaults to `target`.
24
24
  */
25
25
  ariaTarget: HTMLElement | HTMLElement[] | null | undefined;
26
26
 
27
+ /**
28
+ * Controls which ARIA attribute is used to link the target element(s)
29
+ * with the tooltip content. Supported values:
30
+ *
31
+ * - `aria-describedby` - links the tooltip as a description.
32
+ * - `aria-labelledby` - links the tooltip as an accessible name.
33
+ * - `none` - does not add any ARIA linking attribute.
34
+ *
35
+ * Defaults to `aria-describedby`.
36
+ *
37
+ * @attr {string} aria-link-mode
38
+ */
39
+ ariaLinkMode: 'aria-describedby' | 'aria-labelledby' | 'none';
40
+
27
41
  /**
28
42
  * Object with properties passed to `generator` and
29
43
  * `shouldShow` functions for generating tooltip text
@@ -222,14 +222,31 @@ export const TooltipMixin = (superClass) =>
222
222
  static get properties() {
223
223
  return {
224
224
  /**
225
- * Element used to link with the `aria-describedby`
226
- * attribute. Supports array of multiple elements.
225
+ * Element used to link with the ARIA attribute controlled by the
226
+ * `ariaLinkMode` property. Supports array of multiple elements.
227
227
  * When not set, defaults to `target`.
228
228
  */
229
229
  ariaTarget: {
230
230
  type: Object,
231
231
  },
232
232
 
233
+ /**
234
+ * Controls which ARIA attribute is used to link the target element(s)
235
+ * with the tooltip content. Supported values:
236
+ *
237
+ * - `aria-describedby` - links the tooltip as a description.
238
+ * - `aria-labelledby` - links the tooltip as an accessible name.
239
+ * - `none` - does not add any ARIA linking attribute.
240
+ *
241
+ * Defaults to `aria-describedby`.
242
+ *
243
+ * @attr {string} aria-link-mode
244
+ */
245
+ ariaLinkMode: {
246
+ type: String,
247
+ value: 'aria-describedby',
248
+ },
249
+
233
250
  /**
234
251
  * Object with properties passed to `generator` and
235
252
  * `shouldShow` functions for generating tooltip text
@@ -346,7 +363,6 @@ export const TooltipMixin = (superClass) =>
346
363
  _effectiveAriaTarget: {
347
364
  type: Object,
348
365
  computed: '__computeAriaTarget(ariaTarget, target)',
349
- observer: '__effectiveAriaTargetChanged',
350
366
  },
351
367
 
352
368
  /** @private */
@@ -460,6 +476,16 @@ export const TooltipMixin = (superClass) =>
460
476
  if (props.has('text') || props.has('generator') || props.has('context') || props.has('markdown')) {
461
477
  this.__updateContent();
462
478
  }
479
+
480
+ const ariaTargetChanged = props.has('_effectiveAriaTarget');
481
+ const ariaLinkChanged = props.has('ariaLinkMode');
482
+
483
+ if (ariaTargetChanged || ariaLinkChanged) {
484
+ const oldTarget = ariaTargetChanged ? props.get('_effectiveAriaTarget') : this._effectiveAriaTarget;
485
+ const oldMode = ariaLinkChanged ? props.get('ariaLinkMode') : this.ariaLinkMode;
486
+
487
+ this.__updateAriaAttributes(oldTarget, oldMode);
488
+ }
463
489
  }
464
490
 
465
491
  /** @private */
@@ -728,16 +754,20 @@ export const TooltipMixin = (superClass) =>
728
754
  }
729
755
 
730
756
  /** @private */
731
- __effectiveAriaTargetChanged(ariaTarget, oldAriaTarget) {
732
- if (oldAriaTarget) {
733
- [oldAriaTarget].flat().forEach((target) => {
734
- removeValueFromAttribute(target, 'aria-describedby', this._uniqueId);
757
+ __updateAriaAttributes(oldTarget, oldMode) {
758
+ // Remove the previously applied attribute from the previous target(s).
759
+ if (oldTarget && oldMode && oldMode !== 'none') {
760
+ [oldTarget].flat().forEach((target) => {
761
+ removeValueFromAttribute(target, oldMode, this._uniqueId);
735
762
  });
736
763
  }
737
764
 
738
- if (ariaTarget) {
739
- [ariaTarget].flat().forEach((target) => {
740
- addValueToAttribute(target, 'aria-describedby', this._uniqueId);
765
+ // Apply the current attribute to the current target(s).
766
+ const target = this._effectiveAriaTarget;
767
+ const mode = this.ariaLinkMode;
768
+ if (target && mode && mode !== 'none') {
769
+ [target].flat().forEach((el) => {
770
+ addValueToAttribute(el, mode, this._uniqueId);
741
771
  });
742
772
  }
743
773
  }
@@ -31,6 +31,10 @@ class TooltipOverlay extends PopoverOverlayMixin(
31
31
  return [overlayStyles, tooltipOverlayStyles];
32
32
  }
33
33
 
34
+ static get lumoInjector() {
35
+ return { ...super.lumoInjector, includeBaseStyles: true };
36
+ }
37
+
34
38
  /** @protected */
35
39
  render() {
36
40
  return html`
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/tooltip",
4
- "version": "25.2.0-beta1",
4
+ "version": "25.2.0-rc1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -10,6 +10,15 @@
10
10
  "name": "vaadin-tooltip",
11
11
  "description": "`<vaadin-tooltip>` is a Web Component for creating tooltips.\n\n```html\n<button id=\"confirm\">Confirm</button>\n<vaadin-tooltip text=\"Click to save changes\" for=\"confirm\"></vaadin-tooltip>\n```\n\n### Markdown Support\n\nThe tooltip supports rendering Markdown content by setting the `markdown` property:\n\n```html\n<button id=\"info\">Info</button>\n<vaadin-tooltip\n text=\"**Important:** Click to view *detailed* information\"\n markdown\n for=\"info\">\n</vaadin-tooltip>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------- | ---------------\n`overlay` | The overlay element\n`content` | The overlay content element\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`markdown` | Reflects the `markdown` property value.\n`position` | Reflects the `position` property value.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------|\n| `--vaadin-tooltip-background` |\n| `--vaadin-tooltip-border-color` |\n| `--vaadin-tooltip-border-radius` |\n| `--vaadin-tooltip-border-width` |\n| `--vaadin-tooltip-font-size` |\n| `--vaadin-tooltip-font-weight` |\n| `--vaadin-tooltip-line-height` |\n| `--vaadin-tooltip-max-width` |\n| `--vaadin-tooltip-offset-bottom` |\n| `--vaadin-tooltip-offset-end` |\n| `--vaadin-tooltip-offset-start` |\n| `--vaadin-tooltip-offset-top` |\n| `--vaadin-tooltip-padding` |\n| `--vaadin-tooltip-shadow` |\n| `--vaadin-tooltip-text-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
+ {
14
+ "name": "aria-link-mode",
15
+ "description": "Controls which ARIA attribute is used to link the target element(s)\nwith the tooltip content. Supported values:\n\n- `aria-describedby` - links the tooltip as a description.\n- `aria-labelledby` - links the tooltip as an accessible name.\n- `none` - does not add any ARIA linking attribute.\n\nDefaults to `aria-describedby`.",
16
+ "value": {
17
+ "type": [
18
+ "string"
19
+ ]
20
+ }
21
+ },
13
22
  {
14
23
  "name": "focus-delay",
15
24
  "description": "The delay in milliseconds before the tooltip\nis opened on keyboard focus, when not in manual mode.",
@@ -105,9 +114,18 @@
105
114
  ],
106
115
  "js": {
107
116
  "properties": [
117
+ {
118
+ "name": "ariaLinkMode",
119
+ "description": "Controls which ARIA attribute is used to link the target element(s)\nwith the tooltip content. Supported values:\n\n- `aria-describedby` - links the tooltip as a description.\n- `aria-labelledby` - links the tooltip as an accessible name.\n- `none` - does not add any ARIA linking attribute.\n\nDefaults to `aria-describedby`.",
120
+ "value": {
121
+ "type": [
122
+ "string"
123
+ ]
124
+ }
125
+ },
108
126
  {
109
127
  "name": "ariaTarget",
110
- "description": "Element used to link with the `aria-describedby`\nattribute. Supports array of multiple elements.\nWhen not set, defaults to `target`.",
128
+ "description": "Element used to link with the ARIA attribute controlled by the\n`ariaLinkMode` property. Supports array of multiple elements.\nWhen not set, defaults to `target`.",
111
129
  "value": {
112
130
  "type": [
113
131
  "object"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/tooltip",
4
- "version": "25.2.0-beta1",
4
+ "version": "25.2.0-rc1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -19,9 +19,16 @@
19
19
  "description": "`<vaadin-tooltip>` is a Web Component for creating tooltips.\n\n```html\n<button id=\"confirm\">Confirm</button>\n<vaadin-tooltip text=\"Click to save changes\" for=\"confirm\"></vaadin-tooltip>\n```\n\n### Markdown Support\n\nThe tooltip supports rendering Markdown content by setting the `markdown` property:\n\n```html\n<button id=\"info\">Info</button>\n<vaadin-tooltip\n text=\"**Important:** Click to view *detailed* information\"\n markdown\n for=\"info\">\n</vaadin-tooltip>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------- | ---------------\n`overlay` | The overlay element\n`content` | The overlay content element\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-----------------|----------------------------------------\n`markdown` | Reflects the `markdown` property value.\n`position` | Reflects the `position` property value.\n\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:----------------------------------|\n| `--vaadin-tooltip-background` |\n| `--vaadin-tooltip-border-color` |\n| `--vaadin-tooltip-border-radius` |\n| `--vaadin-tooltip-border-width` |\n| `--vaadin-tooltip-font-size` |\n| `--vaadin-tooltip-font-weight` |\n| `--vaadin-tooltip-line-height` |\n| `--vaadin-tooltip-max-width` |\n| `--vaadin-tooltip-offset-bottom` |\n| `--vaadin-tooltip-offset-end` |\n| `--vaadin-tooltip-offset-start` |\n| `--vaadin-tooltip-offset-top` |\n| `--vaadin-tooltip-padding` |\n| `--vaadin-tooltip-shadow` |\n| `--vaadin-tooltip-text-color` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
+ {
23
+ "name": ".ariaLinkMode",
24
+ "description": "Controls which ARIA attribute is used to link the target element(s)\nwith the tooltip content. Supported values:\n\n- `aria-describedby` - links the tooltip as a description.\n- `aria-labelledby` - links the tooltip as an accessible name.\n- `none` - does not add any ARIA linking attribute.\n\nDefaults to `aria-describedby`.",
25
+ "value": {
26
+ "kind": "expression"
27
+ }
28
+ },
22
29
  {
23
30
  "name": ".ariaTarget",
24
- "description": "Element used to link with the `aria-describedby`\nattribute. Supports array of multiple elements.\nWhen not set, defaults to `target`.",
31
+ "description": "Element used to link with the ARIA attribute controlled by the\n`ariaLinkMode` property. Supports array of multiple elements.\nWhen not set, defaults to `target`.",
25
32
  "value": {
26
33
  "kind": "expression"
27
34
  }