@vaadin/icon 24.9.22 → 24.9.23

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/icon",
3
- "version": "24.9.22",
3
+ "version": "24.9.23",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,14 +36,14 @@
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
38
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/component-base": "~24.9.22",
40
- "@vaadin/vaadin-lumo-styles": "~24.9.22",
41
- "@vaadin/vaadin-themable-mixin": "~24.9.22",
39
+ "@vaadin/component-base": "~24.9.23",
40
+ "@vaadin/vaadin-lumo-styles": "~24.9.23",
41
+ "@vaadin/vaadin-themable-mixin": "~24.9.23",
42
42
  "lit": "^3.0.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@vaadin/chai-plugins": "~24.9.22",
46
- "@vaadin/test-runner-commands": "~24.9.22",
45
+ "@vaadin/chai-plugins": "~24.9.23",
46
+ "@vaadin/test-runner-commands": "~24.9.23",
47
47
  "@vaadin/testing-helpers": "^1.1.0",
48
48
  "sinon": "^18.0.0"
49
49
  },
@@ -51,5 +51,5 @@
51
51
  "web-types.json",
52
52
  "web-types.lit.json"
53
53
  ],
54
- "gitHead": "f3140502d1c3ce7e3db9d14388f42458571ed4bb"
54
+ "gitHead": "e26bb568f63d978d7f2269248d3db52b243f53f4"
55
55
  }
@@ -3,9 +3,114 @@
3
3
  * Copyright (c) 2016 - 2025 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 { svg } from 'lit';
7
+ import { templateContent } from 'lit/directives/template-content.js';
7
8
  import { isSafari } from '@vaadin/component-base/src/browser-utils.js';
8
9
 
10
+ const SVG_NS = 'http://www.w3.org/2000/svg';
11
+
12
+ const SUPPORTED_ELEMENTS = new Set([
13
+ 'svg',
14
+ 'g',
15
+ 'defs',
16
+ 'symbol',
17
+ 'use',
18
+ 'switch',
19
+ 'title',
20
+ 'desc',
21
+ 'path',
22
+ 'rect',
23
+ 'circle',
24
+ 'ellipse',
25
+ 'line',
26
+ 'polyline',
27
+ 'polygon',
28
+ 'text',
29
+ 'tspan',
30
+ 'textPath',
31
+ 'linearGradient',
32
+ 'radialGradient',
33
+ 'stop',
34
+ 'clipPath',
35
+ 'mask',
36
+ 'pattern',
37
+ 'marker',
38
+ 'filter',
39
+ 'feBlend',
40
+ 'feColorMatrix',
41
+ 'feComponentTransfer',
42
+ 'feComposite',
43
+ 'feConvolveMatrix',
44
+ 'feDiffuseLighting',
45
+ 'feDisplacementMap',
46
+ 'feDistantLight',
47
+ 'feDropShadow',
48
+ 'feFlood',
49
+ 'feFuncA',
50
+ 'feFuncB',
51
+ 'feFuncG',
52
+ 'feFuncR',
53
+ 'feGaussianBlur',
54
+ 'feMerge',
55
+ 'feMergeNode',
56
+ 'feMorphology',
57
+ 'feOffset',
58
+ 'fePointLight',
59
+ 'feSpecularLighting',
60
+ 'feSpotLight',
61
+ 'feTile',
62
+ 'feTurbulence',
63
+ 'animate',
64
+ 'animateTransform',
65
+ ]);
66
+
67
+ const ANIMATED_ATTRIBUTES = new Set([
68
+ 'd',
69
+ 'fill',
70
+ 'opacity',
71
+ 'r',
72
+ 'stroke',
73
+ 'stroke-dasharray',
74
+ 'stroke-dashoffset',
75
+ 'transform',
76
+ ]);
77
+
78
+ const CSS_REFERENCE = /(?:url|src)\s*\((?!\s*['"]?#)|image-set|cross-fade|\bimage\s*\(|element\s*\(/iu;
79
+
80
+ function isSupportedElement(el) {
81
+ if (el.namespaceURI !== SVG_NS || !SUPPORTED_ELEMENTS.has(el.localName)) {
82
+ return false;
83
+ }
84
+ return !el.localName.startsWith('animate') || ANIMATED_ATTRIBUTES.has(el.getAttribute('attributeName'));
85
+ }
86
+
87
+ function isSupportedAttribute({ name, value }) {
88
+ // Keep presentation attributes and xlink:href
89
+ if (name.startsWith('on') || (name.includes(':') && name !== 'xlink:href')) {
90
+ return false;
91
+ }
92
+ // Local references only
93
+ if (name === 'href' || name === 'xlink:href') {
94
+ return value.startsWith('#');
95
+ }
96
+ // Keep url(#id) references only
97
+ return !value.includes('\\') && !CSS_REFERENCE.test(value);
98
+ }
99
+
100
+ function prepareSvg(svgElement) {
101
+ svgElement.querySelectorAll('*').forEach((el) => {
102
+ if (!isSupportedElement(el)) {
103
+ el.remove();
104
+ return;
105
+ }
106
+ [...el.attributes].forEach((attr) => {
107
+ if (!isSupportedAttribute(attr)) {
108
+ el.removeAttribute(attr.name);
109
+ }
110
+ });
111
+ });
112
+ }
113
+
9
114
  /**
10
115
  * Checks if the current browser supports CSS Container Query units for pseudo elements.
11
116
  * i.e. if the fix for https://bugs.webkit.org/show_bug.cgi?id=253939 is available.
@@ -60,3 +165,22 @@ export function needsFontIconSizingFallback() {
60
165
  // Check if the browser does not support CSS Container Query units for pseudo elements.
61
166
  return !supportsCQUnitsForPseudoElements();
62
167
  }
168
+
169
+ /**
170
+ * Parse the first `<svg>` element in the source string. Returns its static
171
+ * content as SVG literal, and the element without children for its attributes.
172
+ * Returns `null` if there is no `<svg>`.
173
+ *
174
+ * @param {string} source
175
+ */
176
+ export function parseSvg(source) {
177
+ const template = document.createElement('template');
178
+ template.innerHTML = source;
179
+ const svgElement = template.content.querySelector('svg');
180
+ if (!svgElement) {
181
+ return null;
182
+ }
183
+ prepareSvg(svgElement);
184
+ template.content.replaceChildren(...svgElement.childNodes);
185
+ return { svg: svg`${templateContent(template)}`, svgElement };
186
+ }
@@ -42,6 +42,9 @@ export declare class IconMixinClass {
42
42
  * inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.
43
43
  * - a string in the format "data:image/svg+xml,<svg>...</svg>". You may need to use the "encodeURIComponent"
44
44
  * function for the SVG content passed
45
+ *
46
+ * An SVG loaded without an ID only renders static SVG content, so use presentation attributes such as `fill`
47
+ * instead of a `<style>` element.
45
48
  */
46
49
  src: string | null;
47
50
 
@@ -6,7 +6,8 @@
6
6
  import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
7
7
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
8
8
  import { IconFontSizeMixin } from './vaadin-icon-font-size-mixin.js';
9
- import { ensureSvgLiteral, renderSvg, unsafeSvgLiteral } from './vaadin-icon-svg.js';
9
+ import { parseSvg } from './vaadin-icon-helpers.js';
10
+ import { ensureSvgLiteral, renderSvg } from './vaadin-icon-svg.js';
10
11
 
11
12
  const srcCache = new Map();
12
13
 
@@ -57,6 +58,9 @@ export const IconMixin = (superClass) =>
57
58
  * - a string in the format "data:image/svg+xml,<svg>...</svg>". You may need to use the "encodeURIComponent"
58
59
  * function for the SVG content passed
59
60
  *
61
+ * An SVG loaded without an ID only renders static SVG content, so use presentation attributes such as `fill`
62
+ * instead of a `<style>` element.
63
+ *
60
64
  * @type {string}
61
65
  */
62
66
  src: {
@@ -251,6 +255,7 @@ export const IconMixin = (superClass) =>
251
255
 
252
256
  /** @private */
253
257
  async __srcChanged(src, symbol) {
258
+ this.__useRef = undefined;
254
259
  if (!src) {
255
260
  this.svg = null;
256
261
  return;
@@ -259,47 +264,50 @@ export const IconMixin = (superClass) =>
259
264
  // Need to add the "icon" attribute to avoid issues as described in
260
265
  // https://github.com/vaadin/web-components/issues/6301
261
266
  this.icon = '';
262
- if (!src.startsWith('data:') && (symbol || src.includes('#'))) {
267
+ if (!/^\s*data:/iu.test(src) && (symbol || src.includes('#'))) {
263
268
  const [path, iconId] = src.split('#');
264
269
  this.__useRef = `${path}#${symbol || iconId}`;
265
- } else {
266
- try {
267
- if (!srcCache.has(src)) {
268
- srcCache.set(
269
- src,
270
- this.__fetch(src, {
271
- mode: 'cors',
272
- }).then((data) => {
270
+ return;
271
+ }
272
+ try {
273
+ if (!srcCache.has(src)) {
274
+ srcCache.set(
275
+ src,
276
+ this.__fetch(src, {
277
+ mode: 'cors',
278
+ })
279
+ .then((data) => {
273
280
  if (!data.ok) {
274
281
  throw new Error('Error loading icon');
275
282
  }
276
283
  return data.text();
284
+ })
285
+ .then((text) => {
286
+ const parsed = parseSvg(text);
287
+ if (!parsed) {
288
+ throw new Error(`SVG element not found on path: ${src}`);
289
+ }
290
+ return parsed;
277
291
  }),
278
- );
279
- }
280
- const svgData = await srcCache.get(src);
281
- if (!superClass.__domParser) {
282
- superClass.__domParser = new DOMParser();
283
- }
284
- const parsedResponse = superClass.__domParser.parseFromString(svgData, 'text/html');
285
- const svgElement = parsedResponse.querySelector('svg');
286
- if (!svgElement) {
287
- throw new Error(`SVG element not found on path: ${src}`);
288
- }
289
- this.svg = unsafeSvgLiteral(svgElement.innerHTML);
290
- if (symbol) {
291
- this.__useRef = `#${symbol}`;
292
- }
293
- this.__viewBox = svgElement.getAttribute('viewBox');
294
- this.__fill = svgElement.getAttribute('fill');
295
- this.__stroke = svgElement.getAttribute('stroke');
296
- this.__strokeWidth = svgElement.getAttribute('stroke-width');
297
- this.__strokeLinecap = svgElement.getAttribute('stroke-linecap');
298
- this.__strokeLinejoin = svgElement.getAttribute('stroke-linejoin');
299
- } catch (e) {
300
- console.error(e);
301
- this.svg = null;
292
+ );
293
+ }
294
+ const { svg, svgElement } = await srcCache.get(src);
295
+ if (src !== this.src || symbol !== this.symbol) {
296
+ return;
302
297
  }
298
+ this.svg = svg;
299
+ if (symbol) {
300
+ this.__useRef = `#${symbol}`;
301
+ }
302
+ this.__viewBox = svgElement.getAttribute('viewBox');
303
+ this.__fill = svgElement.getAttribute('fill');
304
+ this.__stroke = svgElement.getAttribute('stroke');
305
+ this.__strokeWidth = svgElement.getAttribute('stroke-width');
306
+ this.__strokeLinecap = svgElement.getAttribute('stroke-linecap');
307
+ this.__strokeLinejoin = svgElement.getAttribute('stroke-linejoin');
308
+ } catch (e) {
309
+ console.error(e);
310
+ this.svg = null;
303
311
  }
304
312
  }
305
313
 
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/icon",
4
- "version": "24.9.22",
4
+ "version": "24.9.23",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -26,7 +26,7 @@
26
26
  "properties": [
27
27
  {
28
28
  "name": "name",
29
- "description": "The name of the iconset. Every iconset is required to have its own unique name.\nAll the SVG icons in the iconset must have IDs conforming to its name.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.9.22/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
29
+ "description": "The name of the iconset. Every iconset is required to have its own unique name.\nAll the SVG icons in the iconset must have IDs conforming to its name.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.9.23/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
30
30
  "value": {
31
31
  "type": [
32
32
  "string"
@@ -48,11 +48,11 @@
48
48
  },
49
49
  {
50
50
  "name": "vaadin-icon",
51
- "description": "`<vaadin-icon>` is a Web Component for displaying SVG icons.\n\n### Icon property\n\nThe `<vaadin-icon>` component is designed to be used as a drop-in replacement for `<iron-icon>`.\nFor example, you can use it with `vaadin-icons` like this:\n\n```html\n<vaadin-icon icon=\"vaadin:angle-down\"></vaadin-icon>\n```\n\nAlternatively, you can also pick one of the Lumo icons:\n\n```html\n<vaadin-icon icon=\"lumo:user\"></vaadin-icon>\n```\n\n### Custom SVG icon\n\nAlternatively, instead of selecting an icon from an iconset by name, you can pass any custom `svg`\nliteral using the [`svg`](https://cdn.vaadin.com/vaadin-web-components/24.9.22/#/elements/vaadin-icon#property-svg) property. In this case you can also\ndefine the size of the SVG `viewBox` using the [`size`](https://cdn.vaadin.com/vaadin-web-components/24.9.22/#/elements/vaadin-icon#property-size) property:\n\n```js\nimport { html, svg } from 'lit';\n\n// in your component\nrender() {\n const svgIcon = svg`<path d=\"M13 4v2l-5 5-5-5v-2l5 5z\"></path>`;\n return html`\n <vaadin-icon\n .svg=\"${svgIcon}\"\n size=\"16\"\n ></vaadin-icon>\n `;\n}\n```\n\n### Styling\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`has-tooltip` | Set when the icon has a slotted tooltip\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
51
+ "description": "`<vaadin-icon>` is a Web Component for displaying SVG icons.\n\n### Icon property\n\nThe `<vaadin-icon>` component is designed to be used as a drop-in replacement for `<iron-icon>`.\nFor example, you can use it with `vaadin-icons` like this:\n\n```html\n<vaadin-icon icon=\"vaadin:angle-down\"></vaadin-icon>\n```\n\nAlternatively, you can also pick one of the Lumo icons:\n\n```html\n<vaadin-icon icon=\"lumo:user\"></vaadin-icon>\n```\n\n### Custom SVG icon\n\nAlternatively, instead of selecting an icon from an iconset by name, you can pass any custom `svg`\nliteral using the [`svg`](https://cdn.vaadin.com/vaadin-web-components/24.9.23/#/elements/vaadin-icon#property-svg) property. In this case you can also\ndefine the size of the SVG `viewBox` using the [`size`](https://cdn.vaadin.com/vaadin-web-components/24.9.23/#/elements/vaadin-icon#property-size) property:\n\n```js\nimport { html, svg } from 'lit';\n\n// in your component\nrender() {\n const svgIcon = svg`<path d=\"M13 4v2l-5 5-5-5v-2l5 5z\"></path>`;\n return html`\n <vaadin-icon\n .svg=\"${svgIcon}\"\n size=\"16\"\n ></vaadin-icon>\n `;\n}\n```\n\n### Styling\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`has-tooltip` | Set when the icon has a slotted tooltip\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
52
52
  "attributes": [
53
53
  {
54
54
  "name": "icon",
55
- "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.9.22/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
55
+ "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.9.23/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
56
56
  "value": {
57
57
  "type": [
58
58
  "string"
@@ -61,7 +61,7 @@
61
61
  },
62
62
  {
63
63
  "name": "src",
64
- "description": "The SVG source to be loaded as the icon. It can be:\n- an URL to a file containing the icon\n- an URL in the format \"/path/to/file.svg#objectID\", where the \"objectID\" refers to an ID attribute contained\n inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.\n- a string in the format \"data:image/svg+xml,<svg>...</svg>\". You may need to use the \"encodeURIComponent\"\n function for the SVG content passed",
64
+ "description": "The SVG source to be loaded as the icon. It can be:\n- an URL to a file containing the icon\n- an URL in the format \"/path/to/file.svg#objectID\", where the \"objectID\" refers to an ID attribute contained\n inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.\n- a string in the format \"data:image/svg+xml,<svg>...</svg>\". You may need to use the \"encodeURIComponent\"\n function for the SVG content passed\n\nAn SVG loaded without an ID only renders static SVG content, so use presentation attributes such as `fill`\ninstead of a `<style>` element.",
65
65
  "value": {
66
66
  "type": [
67
67
  "string"
@@ -140,7 +140,7 @@
140
140
  "properties": [
141
141
  {
142
142
  "name": "icon",
143
- "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.9.22/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
143
+ "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.9.23/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
144
144
  "value": {
145
145
  "type": [
146
146
  "string"
@@ -160,7 +160,7 @@
160
160
  },
161
161
  {
162
162
  "name": "src",
163
- "description": "The SVG source to be loaded as the icon. It can be:\n- an URL to a file containing the icon\n- an URL in the format \"/path/to/file.svg#objectID\", where the \"objectID\" refers to an ID attribute contained\n inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.\n- a string in the format \"data:image/svg+xml,<svg>...</svg>\". You may need to use the \"encodeURIComponent\"\n function for the SVG content passed",
163
+ "description": "The SVG source to be loaded as the icon. It can be:\n- an URL to a file containing the icon\n- an URL in the format \"/path/to/file.svg#objectID\", where the \"objectID\" refers to an ID attribute contained\n inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.\n- a string in the format \"data:image/svg+xml,<svg>...</svg>\". You may need to use the \"encodeURIComponent\"\n function for the SVG content passed\n\nAn SVG loaded without an ID only renders static SVG content, so use presentation attributes such as `fill`\ninstead of a `<style>` element.",
164
164
  "value": {
165
165
  "type": [
166
166
  "string"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/icon",
4
- "version": "24.9.22",
4
+ "version": "24.9.23",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -21,7 +21,7 @@
21
21
  "attributes": [
22
22
  {
23
23
  "name": ".name",
24
- "description": "The name of the iconset. Every iconset is required to have its own unique name.\nAll the SVG icons in the iconset must have IDs conforming to its name.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.9.22/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
24
+ "description": "The name of the iconset. Every iconset is required to have its own unique name.\nAll the SVG icons in the iconset must have IDs conforming to its name.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.9.23/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
25
25
  "value": {
26
26
  "kind": "expression"
27
27
  }
@@ -37,12 +37,12 @@
37
37
  },
38
38
  {
39
39
  "name": "vaadin-icon",
40
- "description": "`<vaadin-icon>` is a Web Component for displaying SVG icons.\n\n### Icon property\n\nThe `<vaadin-icon>` component is designed to be used as a drop-in replacement for `<iron-icon>`.\nFor example, you can use it with `vaadin-icons` like this:\n\n```html\n<vaadin-icon icon=\"vaadin:angle-down\"></vaadin-icon>\n```\n\nAlternatively, you can also pick one of the Lumo icons:\n\n```html\n<vaadin-icon icon=\"lumo:user\"></vaadin-icon>\n```\n\n### Custom SVG icon\n\nAlternatively, instead of selecting an icon from an iconset by name, you can pass any custom `svg`\nliteral using the [`svg`](https://cdn.vaadin.com/vaadin-web-components/24.9.22/#/elements/vaadin-icon#property-svg) property. In this case you can also\ndefine the size of the SVG `viewBox` using the [`size`](https://cdn.vaadin.com/vaadin-web-components/24.9.22/#/elements/vaadin-icon#property-size) property:\n\n```js\nimport { html, svg } from 'lit';\n\n// in your component\nrender() {\n const svgIcon = svg`<path d=\"M13 4v2l-5 5-5-5v-2l5 5z\"></path>`;\n return html`\n <vaadin-icon\n .svg=\"${svgIcon}\"\n size=\"16\"\n ></vaadin-icon>\n `;\n}\n```\n\n### Styling\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`has-tooltip` | Set when the icon has a slotted tooltip\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
40
+ "description": "`<vaadin-icon>` is a Web Component for displaying SVG icons.\n\n### Icon property\n\nThe `<vaadin-icon>` component is designed to be used as a drop-in replacement for `<iron-icon>`.\nFor example, you can use it with `vaadin-icons` like this:\n\n```html\n<vaadin-icon icon=\"vaadin:angle-down\"></vaadin-icon>\n```\n\nAlternatively, you can also pick one of the Lumo icons:\n\n```html\n<vaadin-icon icon=\"lumo:user\"></vaadin-icon>\n```\n\n### Custom SVG icon\n\nAlternatively, instead of selecting an icon from an iconset by name, you can pass any custom `svg`\nliteral using the [`svg`](https://cdn.vaadin.com/vaadin-web-components/24.9.23/#/elements/vaadin-icon#property-svg) property. In this case you can also\ndefine the size of the SVG `viewBox` using the [`size`](https://cdn.vaadin.com/vaadin-web-components/24.9.23/#/elements/vaadin-icon#property-size) property:\n\n```js\nimport { html, svg } from 'lit';\n\n// in your component\nrender() {\n const svgIcon = svg`<path d=\"M13 4v2l-5 5-5-5v-2l5 5z\"></path>`;\n return html`\n <vaadin-icon\n .svg=\"${svgIcon}\"\n size=\"16\"\n ></vaadin-icon>\n `;\n}\n```\n\n### Styling\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|-------------\n`has-tooltip` | Set when the icon has a slotted tooltip\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
41
41
  "extension": true,
42
42
  "attributes": [
43
43
  {
44
44
  "name": ".icon",
45
- "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.9.22/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
45
+ "description": "The name of the icon to use. The name should be of the form:\n`iconset_name:icon_name`. When using `vaadin-icons` it is possible\nto omit the first part and only use `icon_name` as a value.\n\nSetting the `icon` property updates the `svg` and `size` based on the\nvalues provided by the corresponding `vaadin-iconset` element.\n\nSee also [`name`](https://cdn.vaadin.com/vaadin-web-components/24.9.23/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
46
46
  "value": {
47
47
  "kind": "expression"
48
48
  }
@@ -56,7 +56,7 @@
56
56
  },
57
57
  {
58
58
  "name": ".src",
59
- "description": "The SVG source to be loaded as the icon. It can be:\n- an URL to a file containing the icon\n- an URL in the format \"/path/to/file.svg#objectID\", where the \"objectID\" refers to an ID attribute contained\n inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.\n- a string in the format \"data:image/svg+xml,<svg>...</svg>\". You may need to use the \"encodeURIComponent\"\n function for the SVG content passed",
59
+ "description": "The SVG source to be loaded as the icon. It can be:\n- an URL to a file containing the icon\n- an URL in the format \"/path/to/file.svg#objectID\", where the \"objectID\" refers to an ID attribute contained\n inside the SVG referenced by the path. Note that the file needs to follow the same-origin policy.\n- a string in the format \"data:image/svg+xml,<svg>...</svg>\". You may need to use the \"encodeURIComponent\"\n function for the SVG content passed\n\nAn SVG loaded without an ID only renders static SVG content, so use presentation attributes such as `fill`\ninstead of a `<style>` element.",
60
60
  "value": {
61
61
  "kind": "expression"
62
62
  }