@vaadin/icon 24.8.4 → 25.0.0-alpha10

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 CHANGED
@@ -24,29 +24,6 @@ Once installed, import the component in your application:
24
24
  import '@vaadin/icon';
25
25
  ```
26
26
 
27
- ## Themes
28
-
29
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
30
- The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/icon/vaadin-icon.js) of the package uses the Lumo theme.
31
-
32
- To use the Material theme, import the component from the `theme/material` folder:
33
-
34
- ```js
35
- import '@vaadin/icon/theme/material/vaadin-icon.js';
36
- ```
37
-
38
- You can also import the Lumo version of the component explicitly:
39
-
40
- ```js
41
- import '@vaadin/icon/theme/lumo/vaadin-icon.js';
42
- ```
43
-
44
- Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
45
-
46
- ```js
47
- import '@vaadin/icon/src/vaadin-icon.js';
48
- ```
49
-
50
27
  ## Contributing
51
28
 
52
29
  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/icon",
3
- "version": "24.8.4",
3
+ "version": "25.0.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,6 +21,8 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
+ "!src/styles/*-base-styles.d.ts",
25
+ "!src/styles/*-base-styles.js",
24
26
  "theme",
25
27
  "vaadin-*.d.ts",
26
28
  "vaadin-*.js",
@@ -35,21 +37,20 @@
35
37
  ],
36
38
  "dependencies": {
37
39
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@polymer/polymer": "^3.0.0",
39
- "@vaadin/component-base": "~24.8.4",
40
- "@vaadin/vaadin-lumo-styles": "~24.8.4",
41
- "@vaadin/vaadin-themable-mixin": "~24.8.4",
40
+ "@vaadin/component-base": "25.0.0-alpha10",
41
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
42
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
42
43
  "lit": "^3.0.0"
43
44
  },
44
45
  "devDependencies": {
45
- "@vaadin/chai-plugins": "~24.8.4",
46
- "@vaadin/test-runner-commands": "~24.8.4",
47
- "@vaadin/testing-helpers": "^1.1.0",
46
+ "@vaadin/chai-plugins": "25.0.0-alpha10",
47
+ "@vaadin/test-runner-commands": "25.0.0-alpha10",
48
+ "@vaadin/testing-helpers": "^2.0.0",
48
49
  "sinon": "^18.0.0"
49
50
  },
50
51
  "web-types": [
51
52
  "web-types.json",
52
53
  "web-types.lit.json"
53
54
  ],
54
- "gitHead": "849e54e967563080a685965e2dced02060b3ab23"
55
+ "gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
55
56
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const iconStyles: CSSResult;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { css } from 'lit';
7
+
8
+ export const iconStyles = css`
9
+ :host {
10
+ display: inline-flex;
11
+ justify-content: center;
12
+ align-items: center;
13
+ box-sizing: border-box;
14
+ vertical-align: middle;
15
+ width: var(--vaadin-icon-size, 1lh);
16
+ height: var(--vaadin-icon-size, 1lh);
17
+ flex: none;
18
+ fill: var(--vaadin-icon-color, currentColor);
19
+ container-type: size;
20
+ }
21
+
22
+ :host::after,
23
+ :host::before {
24
+ line-height: 1;
25
+ font-size: 100cqh;
26
+ -webkit-font-smoothing: antialiased;
27
+ text-rendering: optimizeLegibility;
28
+ -moz-osx-font-smoothing: grayscale;
29
+ }
30
+
31
+ :host([hidden]) {
32
+ display: none !important;
33
+ }
34
+
35
+ svg {
36
+ display: block;
37
+ width: 100%;
38
+ height: 100%;
39
+ /* prevent overflowing icon from clipping, see https://github.com/vaadin/flow-components/issues/5872 */
40
+ overflow: visible;
41
+ }
42
+
43
+ :host(:is([icon-class], [font-icon-content])) svg {
44
+ display: none;
45
+ }
46
+
47
+ :host([font-icon-content])::before {
48
+ content: attr(font-icon-content);
49
+ }
50
+
51
+ .baseline {
52
+ order: -1;
53
+ }
54
+
55
+ .baseline::before {
56
+ content: '\\2003' / '';
57
+ display: inline-block;
58
+ width: 0;
59
+ }
60
+ `;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const iconStyles: CSSResult;
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) 2017 - 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 { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
6
+ import { css } from 'lit';
7
7
 
8
8
  export const iconStyles = css`
9
9
  :host {
@@ -5,7 +5,6 @@
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
7
7
  import type { SlotStylesMixinClass } from '@vaadin/component-base/src/slot-styles-mixin.js';
8
- import type { IconFontSizeMixinClass } from './vaadin-icon-font-size-mixin.js';
9
8
  import type { IconSvgLiteral } from './vaadin-icon-svg.js';
10
9
 
11
10
  /**
@@ -13,7 +12,7 @@ import type { IconSvgLiteral } from './vaadin-icon-svg.js';
13
12
  */
14
13
  export declare function IconMixin<T extends Constructor<HTMLElement>>(
15
14
  base: T,
16
- ): Constructor<IconFontSizeMixinClass> & Constructor<IconMixinClass> & Constructor<SlotStylesMixinClass> & T;
15
+ ): Constructor<IconMixinClass> & Constructor<SlotStylesMixinClass> & T;
17
16
 
18
17
  export declare class IconMixinClass {
19
18
  /**
@@ -5,8 +5,7 @@
5
5
  */
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
- import { IconFontSizeMixin } from './vaadin-icon-font-size-mixin.js';
9
- import { ensureSvgLiteral, renderSvg, unsafeSvgLiteral } from './vaadin-icon-svg.js';
8
+ import { unsafeSvgLiteral } from './vaadin-icon-svg.js';
10
9
 
11
10
  const srcCache = new Map();
12
11
 
@@ -15,10 +14,9 @@ const Iconset = customElements.get('vaadin-iconset');
15
14
  /**
16
15
  * @polymerMixin
17
16
  * @mixes SlotStylesMixin
18
- * @mixes IconFontSizeMixin
19
17
  */
20
18
  export const IconMixin = (superClass) =>
21
- class extends IconFontSizeMixin(SlotStylesMixin(superClass)) {
19
+ class extends SlotStylesMixin(superClass) {
22
20
  static get properties() {
23
21
  return {
24
22
  /**
@@ -134,20 +132,11 @@ export const IconMixin = (superClass) =>
134
132
  sync: true,
135
133
  },
136
134
 
137
- /** @private */
138
- __defaultPAR: {
139
- type: String,
140
- value: 'xMidYMid meet',
141
- },
142
-
143
135
  /** @private */
144
136
  __preserveAspectRatio: String,
145
137
 
146
138
  /** @private */
147
- __useRef: Object,
148
-
149
- /** @private */
150
- __svgElement: String,
139
+ __useRef: String,
151
140
 
152
141
  /** @private */
153
142
  __viewBox: String,
@@ -170,11 +159,7 @@ export const IconMixin = (superClass) =>
170
159
  }
171
160
 
172
161
  static get observers() {
173
- return [
174
- '__svgChanged(svg, __svgElement)',
175
- '__fontChanged(iconClass, char, ligature)',
176
- '__srcChanged(src, symbol)',
177
- ];
162
+ return ['__fontChanged(iconClass, char, ligature)', '__srcChanged(src, symbol)'];
178
163
  }
179
164
 
180
165
  static get observedAttributes() {
@@ -208,7 +193,6 @@ export const IconMixin = (superClass) =>
208
193
  /** @protected */
209
194
  ready() {
210
195
  super.ready();
211
- this.__svgElement = this.shadowRoot.querySelector('#svg-group');
212
196
  this._tooltipController = new TooltipController(this);
213
197
  this.addController(this._tooltipController);
214
198
  }
@@ -245,7 +229,7 @@ export const IconMixin = (superClass) =>
245
229
  if (icon) {
246
230
  this._applyIcon();
247
231
  } else {
248
- this.svg = ensureSvgLiteral(null);
232
+ this.svg = null;
249
233
  }
250
234
  }
251
235
 
@@ -303,29 +287,6 @@ export const IconMixin = (superClass) =>
303
287
  }
304
288
  }
305
289
 
306
- /** @private */
307
- __svgChanged(svg, svgElement) {
308
- if (!svgElement) {
309
- return;
310
- }
311
- renderSvg(svg, svgElement);
312
- }
313
-
314
- /** @private */
315
- __computePAR(defaultPAR, preserveAspectRatio) {
316
- return preserveAspectRatio || defaultPAR;
317
- }
318
-
319
- /** @private */
320
- __computeVisibility(__useRef) {
321
- return __useRef ? 'visible' : 'hidden';
322
- }
323
-
324
- /** @private */
325
- __computeViewBox(size, viewBox) {
326
- return viewBox || `0 0 ${size} ${size}`;
327
- }
328
-
329
290
  /** @private */
330
291
  __fontChanged(iconClass, char, ligature) {
331
292
  this.classList.remove(...(this.__addedIconClasses || []));
@@ -22,11 +22,6 @@ export function isValidSvg(source: unknown): source is IconSvgLiteral;
22
22
  */
23
23
  export function ensureSvgLiteral(source: unknown): IconSvgLiteral;
24
24
 
25
- /**
26
- * Render a given SVG literal to the container.
27
- */
28
- export function renderSvg(source: unknown, container: SVGElement): void;
29
-
30
25
  /**
31
26
  * Create an SVG literal from source string.
32
27
  */
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) 2021 - 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 { nothing, render, svg } from 'lit';
6
+ import { nothing, svg } from 'lit';
7
7
  import { isTemplateResult, TemplateResultType } from 'lit/directive-helpers.js';
8
8
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
9
9
 
@@ -48,17 +48,6 @@ export function ensureSvgLiteral(source) {
48
48
  return result;
49
49
  }
50
50
 
51
- /**
52
- * Render a given SVG literal to the container.
53
- *
54
- * @param {unknown} source
55
- * @param {SVGElement} container
56
- */
57
- export function renderSvg(source, container) {
58
- const result = ensureSvgLiteral(source);
59
- render(result, container);
60
- }
61
-
62
51
  /**
63
52
  * Create an SVG literal from source string.
64
53
  *
@@ -3,7 +3,6 @@
3
3
  * Copyright (c) 2021 - 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 { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
7
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
8
7
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
8
  import { IconMixin } from './vaadin-icon-mixin.js';
@@ -47,7 +46,7 @@ import { IconMixin } from './vaadin-icon-mixin.js';
47
46
  * }
48
47
  * ```
49
48
  */
50
- declare class Icon extends ThemableMixin(ElementMixin(ControllerMixin(IconMixin(HTMLElement)))) {}
49
+ declare class Icon extends ThemableMixin(ElementMixin(IconMixin(HTMLElement))) {}
51
50
 
52
51
  declare global {
53
52
  interface HTMLElementTagNameMap {
@@ -4,15 +4,16 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-iconset.js';
7
- import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
- import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
7
+ import { html, LitElement } from 'lit';
8
+ import { ifDefined } from 'lit/directives/if-defined.js';
9
9
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
10
10
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
11
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
12
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
13
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
+ import { iconStyles } from './styles/vaadin-icon-core-styles.js';
12
15
  import { IconMixin } from './vaadin-icon-mixin.js';
13
- import { iconStyles } from './vaadin-icon-styles.js';
14
-
15
- registerStyles('vaadin-icon', iconStyles, { moduleId: 'vaadin-icon-styles' });
16
+ import { ensureSvgLiteral } from './vaadin-icon-svg.js';
16
17
 
17
18
  /**
18
19
  * `<vaadin-icon>` is a Web Component for displaying SVG icons.
@@ -56,39 +57,50 @@ registerStyles('vaadin-icon', iconStyles, { moduleId: 'vaadin-icon-styles' });
56
57
  * @customElement
57
58
  * @extends HTMLElement
58
59
  * @mixes IconMixin
59
- * @mixes ControllerMixin
60
60
  * @mixes ThemableMixin
61
61
  * @mixes ElementMixin
62
62
  */
63
- class Icon extends IconMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerElement)))) {
64
- static get template() {
63
+ class Icon extends IconMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
64
+ static get is() {
65
+ return 'vaadin-icon';
66
+ }
67
+
68
+ static get styles() {
69
+ return iconStyles;
70
+ }
71
+
72
+ static get lumoInjector() {
73
+ return {
74
+ includeBaseStyles: true,
75
+ };
76
+ }
77
+
78
+ /** @protected */
79
+ render() {
65
80
  return html`
81
+ <span class="baseline"></span>
66
82
  <svg
67
83
  version="1.1"
68
84
  xmlns="http://www.w3.org/2000/svg"
69
85
  xmlns:xlink="http://www.w3.org/1999/xlink"
70
- viewBox="[[__computeViewBox(size, __viewBox)]]"
71
- preserveAspectRatio="[[__computePAR(__defaultPAR, __preserveAspectRatio)]]"
72
- fill$="[[__fill]]"
73
- stroke$="[[__stroke]]"
74
- stroke-width$="[[__strokeWidth]]"
75
- stroke-linecap$="[[__strokeLinecap]]"
76
- stroke-linejoin$="[[__strokeLinejoin]]"
86
+ viewBox="${this.__viewBox || `0 0 ${this.size} ${this.size}`}"
87
+ preserveAspectRatio="${this.__preserveAspectRatio || 'xMidYMid meet'}"
88
+ fill="${ifDefined(this.__fill)}"
89
+ stroke="${ifDefined(this.__stroke)}"
90
+ stroke-width="${ifDefined(this.__strokeWidth)}"
91
+ stroke-linecap="${ifDefined(this.__strokeLinecap)}"
92
+ stroke-linejoin="${ifDefined(this.__strokeLinejoin)}"
77
93
  aria-hidden="true"
78
94
  >
79
- <g id="svg-group"></g>
80
- <g id="use-group" visibility$="[[__computeVisibility(__useRef, svg)]]">
81
- <use href$="[[__useRef]]" />
95
+ <g id="svg-group">${ensureSvgLiteral(this.svg)}</g>
96
+ <g id="use-group" visibility="${this.__useRef ? 'visible' : 'hidden'}">
97
+ <use href="${ifDefined(this.__useRef)}" />
82
98
  </g>
83
99
  </svg>
84
100
 
85
101
  <slot name="tooltip"></slot>
86
102
  `;
87
103
  }
88
-
89
- static get is() {
90
- return 'vaadin-icon';
91
- }
92
104
  }
93
105
 
94
106
  defineCustomElement(Icon);
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.8.4",
4
+ "version": "25.0.0-alpha10",
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.8.4/#/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/25.0.0-alpha10/#/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.8.4/#/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.8.4/#/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```",
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/25.0.0-alpha10/#/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/25.0.0-alpha10/#/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```",
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.8.4/#/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/25.0.0-alpha10/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
56
56
  "value": {
57
57
  "type": [
58
58
  "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.8.4/#/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/25.0.0-alpha10/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
144
144
  "value": {
145
145
  "type": [
146
146
  "string"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/icon",
4
- "version": "24.8.4",
4
+ "version": "25.0.0-alpha10",
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.8.4/#/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/25.0.0-alpha10/#/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.8.4/#/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.8.4/#/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```",
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/25.0.0-alpha10/#/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/25.0.0-alpha10/#/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```",
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.8.4/#/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/25.0.0-alpha10/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
46
46
  "value": {
47
47
  "kind": "expression"
48
48
  }
@@ -1,16 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import type { Constructor } from '@open-wc/dedupe-mixin';
7
-
8
- /**
9
- * Mixin which enables the font icon sizing fallback for browsers that do not support CSS Container Queries.
10
- * The mixin does nothing if the browser supports CSS Container Query units for pseudo elements.
11
- */
12
- export declare function IconFontSizeMixin<T extends Constructor<HTMLElement>>(
13
- base: T,
14
- ): Constructor<IconFontSizeMixinClass> & T;
15
-
16
- export declare class IconFontSizeMixinClass {}
@@ -1,74 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
7
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
- import { needsFontIconSizingFallback } from './vaadin-icon-helpers.js';
9
-
10
- const usesFontIconSizingFallback = needsFontIconSizingFallback();
11
-
12
- if (usesFontIconSizingFallback) {
13
- registerStyles(
14
- 'vaadin-icon',
15
- css`
16
- :host::after,
17
- :host::before {
18
- font-size: var(--_vaadin-font-icon-size);
19
- }
20
- `,
21
- 'vaadin-icon-font-size-mixin-styles',
22
- );
23
- }
24
-
25
- /**
26
- * Mixin which enables the font icon sizing fallback for browsers that do not support CSS Container Queries.
27
- * The mixin does nothing if the browser supports CSS Container Query units for pseudo elements.
28
- *
29
- * @polymerMixin
30
- */
31
- export const IconFontSizeMixin = (superclass) =>
32
- !usesFontIconSizingFallback
33
- ? superclass
34
- : class extends ResizeMixin(superclass) {
35
- static get observers() {
36
- return ['__iconFontSizeMixinfontChanged(iconClass, char, ligature)'];
37
- }
38
-
39
- /** @protected */
40
- ready() {
41
- super.ready();
42
-
43
- // Update once initially to avoid a fouc
44
- this.__updateFontIconSize();
45
- }
46
-
47
- /** @private */
48
- __iconFontSizeMixinfontChanged(_iconClass, _char, _ligature) {
49
- // Update when iconClass, char or ligature changes
50
- this.__updateFontIconSize();
51
- }
52
-
53
- /**
54
- * @protected
55
- * @override
56
- */
57
- _onResize() {
58
- // Update when the element is resized
59
- this.__updateFontIconSize();
60
- }
61
-
62
- /**
63
- * Updates the --_vaadin-font-icon-size CSS variable value if font icons are used.
64
- *
65
- * @private
66
- */
67
- __updateFontIconSize() {
68
- if (this.char || this.iconClass || this.ligature) {
69
- const { paddingTop, paddingBottom, height } = getComputedStyle(this);
70
- const fontIconSize = parseFloat(height) - parseFloat(paddingTop) - parseFloat(paddingBottom);
71
- this.style.setProperty('--_vaadin-font-icon-size', `${fontIconSize}px`);
72
- }
73
- }
74
- };
@@ -1,52 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2016 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
-
7
- import { isSafari } from '@vaadin/component-base/src/browser-utils.js';
8
-
9
- /**
10
- * Checks if the current browser supports CSS Container Query units for pseudo elements.
11
- * i.e. if the fix for https://bugs.webkit.org/show_bug.cgi?id=253939 is available.
12
- */
13
- export function supportsCQUnitsForPseudoElements() {
14
- const testStyle = document.createElement('style');
15
- testStyle.textContent = `
16
- .vaadin-icon-test-element {
17
- container-type: size;
18
- height: 2px;
19
- visibility: hidden;
20
- position: fixed;
21
- }
22
-
23
- .vaadin-icon-test-element::before {
24
- content: '';
25
- display: block;
26
- height: 100cqh;
27
- `;
28
- const testElement = document.createElement('div');
29
- testElement.classList.add('vaadin-icon-test-element');
30
-
31
- document.body.append(testStyle, testElement);
32
- const { height } = getComputedStyle(testElement, '::before');
33
- testStyle.remove();
34
- testElement.remove();
35
- return height === '2px';
36
- }
37
-
38
- /**
39
- * Checks if the current browser needs a fallback for sizing font icons instead of relying on CSS Container Queries.
40
- */
41
- export function needsFontIconSizingFallback() {
42
- if (!CSS.supports('container-type: inline-size')) {
43
- // The browser does not support CSS Container Queries at all.
44
- return true;
45
- }
46
- if (!isSafari) {
47
- // Browsers other than Safari support CSS Container Queries as expected.
48
- return false;
49
- }
50
- // Check if the browser does not support CSS Container Query units for pseudo elements.
51
- return !supportsCQUnitsForPseudoElements();
52
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-iconset.js';
7
- import { html, LitElement } from 'lit';
8
- import { ifDefined } from 'lit/directives/if-defined.js';
9
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
10
- import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
11
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
12
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
- import { IconMixin } from './vaadin-icon-mixin.js';
14
- import { iconStyles } from './vaadin-icon-styles.js';
15
-
16
- /**
17
- * LitElement based version of `<vaadin-icon>` web component.
18
- *
19
- * ## Disclaimer
20
- *
21
- * This component is an experiment not intended for publishing to npm.
22
- * There is no ETA regarding specific Vaadin version where it'll land.
23
- * Feel free to try this code in your apps as per Apache 2.0 license.
24
- */
25
- class Icon extends IconMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
26
- static styles = iconStyles;
27
-
28
- /** @protected */
29
- render() {
30
- return html`
31
- <svg
32
- version="1.1"
33
- xmlns="http://www.w3.org/2000/svg"
34
- xmlns:xlink="http://www.w3.org/1999/xlink"
35
- viewBox="${this.__computeViewBox(this.size, this.__viewBox)}"
36
- preserveAspectRatio="${this.__computePAR(this.__defaultPAR, this.__preserveAspectRatio)}"
37
- fill="${ifDefined(this.__fill)}"
38
- stroke="${ifDefined(this.__stroke)}"
39
- stroke-width="${ifDefined(this.__strokeWidth)}"
40
- stroke-linecap="${ifDefined(this.__strokeLinecap)}"
41
- stroke-linejoin="${ifDefined(this.__strokeLinejoin)}"
42
- aria-hidden="true"
43
- >
44
- <g id="svg-group"></g>
45
- <g id="use-group" visibility="${this.__computeVisibility(this.__useRef, this.svg)}">
46
- <use href="${this.__useRef}" />
47
- </g>
48
- </svg>
49
-
50
- <slot name="tooltip"></slot>
51
- `;
52
- }
53
-
54
- static get is() {
55
- return 'vaadin-icon';
56
- }
57
- }
58
-
59
- defineCustomElement(Icon);
60
-
61
- export { Icon };
@@ -1,2 +0,0 @@
1
- import './vaadin-icon-styles.js';
2
- import '../../src/vaadin-lit-icon.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-icon-styles.js';
2
- import '../../src/vaadin-lit-icon.js';
@@ -1 +0,0 @@
1
- export {};
@@ -1,12 +0,0 @@
1
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
2
-
3
- registerStyles(
4
- 'vaadin-icon',
5
- css`
6
- :host {
7
- width: 24px;
8
- height: 24px;
9
- }
10
- `,
11
- { moduleId: 'material-icon' },
12
- );
@@ -1,2 +0,0 @@
1
- import './vaadin-icon-styles.js';
2
- import '../../src/vaadin-icon.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-icon-styles.js';
2
- import '../../src/vaadin-icon.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-icon-styles.js';
2
- import '../../src/vaadin-lit-icon.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-icon-styles.js';
2
- import '../../src/vaadin-lit-icon.js';
@@ -1 +0,0 @@
1
- export * from './vaadin-icon.js';
@@ -1,3 +0,0 @@
1
- import './theme/lumo/vaadin-lit-icon.js';
2
-
3
- export * from './src/vaadin-lit-icon.js';