@vaadin/icon 22.0.14 → 22.0.17

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": "22.0.14",
3
+ "version": "22.0.17",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,13 +32,13 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@polymer/polymer": "^3.0.0",
35
- "@vaadin/component-base": "^22.0.14",
36
- "@vaadin/vaadin-lumo-styles": "^22.0.14",
37
- "@vaadin/vaadin-themable-mixin": "^22.0.14",
35
+ "@vaadin/component-base": "^22.0.17",
36
+ "@vaadin/vaadin-lumo-styles": "^22.0.17",
37
+ "@vaadin/vaadin-themable-mixin": "^22.0.17",
38
38
  "lit": "^2.0.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@vaadin/testing-helpers": "^0.3.2"
42
42
  },
43
- "gitHead": "62419e3f8f41fe9dc4f0bce5e1717b16828459b6"
43
+ "gitHead": "4ba77c19889036fb954052cf1f32bc96089fcc25"
44
44
  }
@@ -83,7 +83,7 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
83
83
  version="1.1"
84
84
  xmlns="http://www.w3.org/2000/svg"
85
85
  xmlns:xlink="http://www.w3.org/1999/xlink"
86
- viewBox="[[__computeViewBox(size)]]"
86
+ viewBox="[[__computeViewBox(size, __viewBox)]]"
87
87
  preserveAspectRatio="xMidYMid meet"
88
88
  aria-hidden="true"
89
89
  ></svg>
@@ -108,14 +108,14 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
108
108
  */
109
109
  icon: {
110
110
  type: String,
111
- observer: '__iconChanged'
111
+ observer: '__iconChanged',
112
112
  },
113
113
 
114
114
  /**
115
115
  * The SVG icon wrapped in a Lit template literal.
116
116
  */
117
117
  svg: {
118
- type: Object
118
+ type: Object,
119
119
  },
120
120
 
121
121
  /**
@@ -123,11 +123,14 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
123
123
  */
124
124
  size: {
125
125
  type: Number,
126
- value: 24
126
+ value: 24,
127
127
  },
128
128
 
129
129
  /** @private */
130
- __svgElement: Object
130
+ __svgElement: Object,
131
+
132
+ /** @private */
133
+ __viewBox: String,
131
134
  };
132
135
  }
133
136
 
@@ -179,7 +182,10 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
179
182
  this.__checkDeprecatedIcon(icon);
180
183
  const iconsetName = this.__getIconsetName(icon);
181
184
  const iconset = Iconset.getIconset(iconsetName);
182
- const { svg, size } = iconset.applyIcon(icon);
185
+ const { svg, size, viewBox } = iconset.applyIcon(icon);
186
+ if (viewBox) {
187
+ this.__viewBox = viewBox;
188
+ }
183
189
  if (size !== this.size) {
184
190
  this.size = size;
185
191
  }
@@ -196,7 +202,7 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
196
202
  'vaadin:funcion': 'vaadin:function',
197
203
  'vaadin:megafone': 'vaadin:megaphone',
198
204
  'vaadin:palete': 'vaadin:palette',
199
- 'vaadin:trendind-down': 'vaadin:trending-down'
205
+ 'vaadin:trendind-down': 'vaadin:trending-down',
200
206
  };
201
207
  if (icon in deprecatedIcons) {
202
208
  console.warn(`WARNING: The icon "${icon}" is deprecated. Use "${deprecatedIcons[icon]}" instead`);
@@ -213,8 +219,8 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
213
219
  }
214
220
 
215
221
  /** @private */
216
- __computeViewBox(size) {
217
- return `0 0 ${size} ${size}`;
222
+ __computeViewBox(size, viewBox) {
223
+ return viewBox || `0 0 ${size} ${size}`;
218
224
  }
219
225
  }
220
226
 
@@ -35,7 +35,7 @@ declare class Iconset extends ElementMixin(HTMLElement) {
35
35
  * Produce SVGTemplateResult for the element matching `name` in this
36
36
  * iconset, or `undefined` if there is no matching element.
37
37
  */
38
- applyIcon(name: string): { svg: IconSvgLiteral; size: number };
38
+ applyIcon(name: string): { svg: IconSvgLiteral; size: number; viewBox: string | null };
39
39
  }
40
40
 
41
41
  declare global {
@@ -34,7 +34,7 @@ class Iconset extends ElementMixin(PolymerElement) {
34
34
  */
35
35
  name: {
36
36
  type: String,
37
- observer: '__nameChanged'
37
+ observer: '__nameChanged',
38
38
  },
39
39
 
40
40
  /**
@@ -45,8 +45,8 @@ class Iconset extends ElementMixin(PolymerElement) {
45
45
  */
46
46
  size: {
47
47
  type: Number,
48
- value: 24
49
- }
48
+ value: 24,
49
+ },
50
50
  };
51
51
  }
52
52
 
@@ -82,7 +82,12 @@ class Iconset extends ElementMixin(PolymerElement) {
82
82
  // create the icon map on-demand, since the iconset itself has no discrete
83
83
  // signal to know when it's children are fully parsed
84
84
  this._icons = this._icons || this.__createIconMap();
85
- return { svg: cloneSvgNode(this._icons[this.__getIconId(name)]), size: this.size };
85
+ const icon = this._icons[this.__getIconId(name)];
86
+ return {
87
+ svg: cloneSvgNode(icon),
88
+ size: this.size,
89
+ viewBox: icon ? icon.getAttribute('viewBox') : null,
90
+ };
86
91
  }
87
92
 
88
93
  /**
@@ -9,5 +9,5 @@ registerStyles(
9
9
  height: var(--lumo-icon-size-m);
10
10
  }
11
11
  `,
12
- { moduleId: 'lumo-icon' }
12
+ { moduleId: 'lumo-icon' },
13
13
  );
@@ -8,5 +8,5 @@ registerStyles(
8
8
  height: 24px;
9
9
  }
10
10
  `,
11
- { moduleId: 'material-icon' }
11
+ { moduleId: 'material-icon' },
12
12
  );