@vaadin/icon 23.2.0-dev.8a7678b70 → 23.3.0-alpha1
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 +2 -2
- package/package.json +12 -6
- package/src/vaadin-icon-svg.d.ts +1 -1
- package/src/vaadin-icon-svg.js +1 -1
- package/src/vaadin-icon.d.ts +3 -2
- package/src/vaadin-icon.js +9 -1
- package/src/vaadin-iconset.d.ts +1 -1
- package/web-types.json +155 -0
- package/web-types.lit.json +69 -0
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ import '@vaadin/icon';
|
|
|
27
27
|
|
|
28
28
|
## Themes
|
|
29
29
|
|
|
30
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/
|
|
30
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
31
31
|
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/icon/vaadin-icon.js) of the package uses the Lumo theme.
|
|
32
32
|
|
|
33
33
|
To use the Material theme, import the component from the `theme/material` folder:
|
|
@@ -50,7 +50,7 @@ import '@vaadin/icon/src/vaadin-icon.js';
|
|
|
50
50
|
|
|
51
51
|
## Contributing
|
|
52
52
|
|
|
53
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/
|
|
53
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
54
54
|
|
|
55
55
|
## License
|
|
56
56
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/icon",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.3.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
"src",
|
|
24
24
|
"theme",
|
|
25
25
|
"vaadin-*.d.ts",
|
|
26
|
-
"vaadin-*.js"
|
|
26
|
+
"vaadin-*.js",
|
|
27
|
+
"web-types.json",
|
|
28
|
+
"web-types.lit.json"
|
|
27
29
|
],
|
|
28
30
|
"keywords": [
|
|
29
31
|
"Vaadin",
|
|
@@ -33,13 +35,17 @@
|
|
|
33
35
|
],
|
|
34
36
|
"dependencies": {
|
|
35
37
|
"@polymer/polymer": "^3.0.0",
|
|
36
|
-
"@vaadin/component-base": "23.
|
|
37
|
-
"@vaadin/vaadin-lumo-styles": "23.
|
|
38
|
-
"@vaadin/vaadin-themable-mixin": "23.
|
|
38
|
+
"@vaadin/component-base": "23.3.0-alpha1",
|
|
39
|
+
"@vaadin/vaadin-lumo-styles": "23.3.0-alpha1",
|
|
40
|
+
"@vaadin/vaadin-themable-mixin": "23.3.0-alpha1",
|
|
39
41
|
"lit": "^2.0.0"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
44
|
"@vaadin/testing-helpers": "^0.3.2"
|
|
43
45
|
},
|
|
44
|
-
"
|
|
46
|
+
"web-types": [
|
|
47
|
+
"web-types.json",
|
|
48
|
+
"web-types.lit.json"
|
|
49
|
+
],
|
|
50
|
+
"gitHead": "beabc527d4b1274eb798ff701d406fed45cfe638"
|
|
45
51
|
}
|
package/src/vaadin-icon-svg.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 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, SVGTemplateResult } from 'lit';
|
|
6
|
+
import type { nothing, SVGTemplateResult } from 'lit';
|
|
7
7
|
|
|
8
8
|
export type IconSvgLiteral = SVGTemplateResult | typeof nothing;
|
|
9
9
|
|
package/src/vaadin-icon-svg.js
CHANGED
package/src/vaadin-icon.d.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 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';
|
|
6
7
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
8
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
-
import { IconSvgLiteral } from './vaadin-icon-svg.js';
|
|
9
|
+
import type { IconSvgLiteral } from './vaadin-icon-svg.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* `<vaadin-icon>` is a Web Component for displaying SVG icons.
|
|
@@ -46,7 +47,7 @@ import { IconSvgLiteral } from './vaadin-icon-svg.js';
|
|
|
46
47
|
* }
|
|
47
48
|
* ```
|
|
48
49
|
*/
|
|
49
|
-
declare class Icon extends ThemableMixin(ElementMixin(HTMLElement)) {
|
|
50
|
+
declare class Icon extends ThemableMixin(ElementMixin(ControllerMixin(HTMLElement))) {
|
|
50
51
|
/**
|
|
51
52
|
* The name of the icon to use. The name should be of the form:
|
|
52
53
|
* `iconset_name:icon_name`. When using `vaadin-icons` it is possible
|
package/src/vaadin-icon.js
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
7
8
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
|
+
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
8
10
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
11
|
import { ensureSvgLiteral, renderSvg } from './vaadin-icon-svg.js';
|
|
10
12
|
import { Iconset } from './vaadin-iconset.js';
|
|
@@ -51,10 +53,11 @@ const DEFAULT_ICONSET = 'vaadin';
|
|
|
51
53
|
* ```
|
|
52
54
|
*
|
|
53
55
|
* @extends HTMLElement
|
|
56
|
+
* @mixes ControllerMixin
|
|
54
57
|
* @mixes ThemableMixin
|
|
55
58
|
* @mixes ElementMixin
|
|
56
59
|
*/
|
|
57
|
-
class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
|
|
60
|
+
class Icon extends ThemableMixin(ElementMixin(ControllerMixin(PolymerElement))) {
|
|
58
61
|
static get template() {
|
|
59
62
|
return html`
|
|
60
63
|
<style>
|
|
@@ -87,6 +90,8 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
|
|
|
87
90
|
preserveAspectRatio="xMidYMid meet"
|
|
88
91
|
aria-hidden="true"
|
|
89
92
|
></svg>
|
|
93
|
+
|
|
94
|
+
<slot name="tooltip"></slot>
|
|
90
95
|
`;
|
|
91
96
|
}
|
|
92
97
|
|
|
@@ -147,6 +152,9 @@ class Icon extends ThemableMixin(ElementMixin(PolymerElement)) {
|
|
|
147
152
|
ready() {
|
|
148
153
|
super.ready();
|
|
149
154
|
this.__svgElement = this.shadowRoot.querySelector('svg');
|
|
155
|
+
|
|
156
|
+
this._tooltipController = new TooltipController(this);
|
|
157
|
+
this.addController(this._tooltipController);
|
|
150
158
|
}
|
|
151
159
|
|
|
152
160
|
/** @private */
|
package/src/vaadin-iconset.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
|
-
import { IconSvgLiteral } from './vaadin-icon-svg.js';
|
|
7
|
+
import type { IconSvgLiteral } from './vaadin-icon-svg.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* `<vaadin-iconset>` is a Web Component for creating SVG icon collections.
|
package/web-types.json
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/icon",
|
|
4
|
+
"version": "23.3.0-alpha1",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"contributions": {
|
|
7
|
+
"html": {
|
|
8
|
+
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"name": "vaadin-iconset",
|
|
11
|
+
"description": "`<vaadin-iconset>` is a Web Component for creating SVG icon collections.",
|
|
12
|
+
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "name",
|
|
15
|
+
"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/23.3.0-alpha1/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"string",
|
|
19
|
+
"null",
|
|
20
|
+
"undefined"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "size",
|
|
26
|
+
"description": "The size of an individual icon. Note that icons must be square.\n\nWhen using `vaadin-icon`, the size of the iconset will take precedence\nover the size defined by the user to ensure correct appearance.",
|
|
27
|
+
"value": {
|
|
28
|
+
"type": [
|
|
29
|
+
"number",
|
|
30
|
+
"null",
|
|
31
|
+
"undefined"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "theme",
|
|
37
|
+
"description": "The theme variants to apply to the component.",
|
|
38
|
+
"value": {
|
|
39
|
+
"type": [
|
|
40
|
+
"string",
|
|
41
|
+
"null",
|
|
42
|
+
"undefined"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"js": {
|
|
48
|
+
"properties": [
|
|
49
|
+
{
|
|
50
|
+
"name": "name",
|
|
51
|
+
"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/23.3.0-alpha1/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
|
|
52
|
+
"value": {
|
|
53
|
+
"type": [
|
|
54
|
+
"string",
|
|
55
|
+
"null",
|
|
56
|
+
"undefined"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "size",
|
|
62
|
+
"description": "The size of an individual icon. Note that icons must be square.\n\nWhen using `vaadin-icon`, the size of the iconset will take precedence\nover the size defined by the user to ensure correct appearance.",
|
|
63
|
+
"value": {
|
|
64
|
+
"type": [
|
|
65
|
+
"number",
|
|
66
|
+
"null",
|
|
67
|
+
"undefined"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"events": []
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "vaadin-icon",
|
|
77
|
+
"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/23.3.0-alpha1/#/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/23.3.0-alpha1/#/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```",
|
|
78
|
+
"attributes": [
|
|
79
|
+
{
|
|
80
|
+
"name": "icon",
|
|
81
|
+
"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/23.3.0-alpha1/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
|
|
82
|
+
"value": {
|
|
83
|
+
"type": [
|
|
84
|
+
"string",
|
|
85
|
+
"null",
|
|
86
|
+
"undefined"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "size",
|
|
92
|
+
"description": "The size of an icon, used to set the `viewBox` attribute.",
|
|
93
|
+
"value": {
|
|
94
|
+
"type": [
|
|
95
|
+
"number",
|
|
96
|
+
"null",
|
|
97
|
+
"undefined"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "theme",
|
|
103
|
+
"description": "The theme variants to apply to the component.",
|
|
104
|
+
"value": {
|
|
105
|
+
"type": [
|
|
106
|
+
"string",
|
|
107
|
+
"null",
|
|
108
|
+
"undefined"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"js": {
|
|
114
|
+
"properties": [
|
|
115
|
+
{
|
|
116
|
+
"name": "icon",
|
|
117
|
+
"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/23.3.0-alpha1/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
|
|
118
|
+
"value": {
|
|
119
|
+
"type": [
|
|
120
|
+
"string",
|
|
121
|
+
"null",
|
|
122
|
+
"undefined"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "svg",
|
|
128
|
+
"description": "The SVG icon wrapped in a Lit template literal.",
|
|
129
|
+
"value": {
|
|
130
|
+
"type": [
|
|
131
|
+
"Object",
|
|
132
|
+
"null",
|
|
133
|
+
"undefined"
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "size",
|
|
139
|
+
"description": "The size of an icon, used to set the `viewBox` attribute.",
|
|
140
|
+
"value": {
|
|
141
|
+
"type": [
|
|
142
|
+
"number",
|
|
143
|
+
"null",
|
|
144
|
+
"undefined"
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"events": []
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/icon",
|
|
4
|
+
"version": "23.3.0-alpha1",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"framework": "lit",
|
|
7
|
+
"framework-config": {
|
|
8
|
+
"enable-when": {
|
|
9
|
+
"node-packages": [
|
|
10
|
+
"lit"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"contributions": {
|
|
15
|
+
"html": {
|
|
16
|
+
"elements": [
|
|
17
|
+
{
|
|
18
|
+
"name": "vaadin-iconset",
|
|
19
|
+
"description": "`<vaadin-iconset>` is a Web Component for creating SVG icon collections.",
|
|
20
|
+
"extension": true,
|
|
21
|
+
"attributes": [
|
|
22
|
+
{
|
|
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/23.3.0-alpha1/#/elements/vaadin-icon#property-name) property of `vaadin-icon`.",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": ".size",
|
|
31
|
+
"description": "The size of an individual icon. Note that icons must be square.\n\nWhen using `vaadin-icon`, the size of the iconset will take precedence\nover the size defined by the user to ensure correct appearance.",
|
|
32
|
+
"value": {
|
|
33
|
+
"kind": "expression"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
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/23.3.0-alpha1/#/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/23.3.0-alpha1/#/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
|
+
"extension": true,
|
|
42
|
+
"attributes": [
|
|
43
|
+
{
|
|
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/23.3.0-alpha1/#/elements/vaadin-iconset#property-name) property of `vaadin-iconset`.",
|
|
46
|
+
"value": {
|
|
47
|
+
"kind": "expression"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": ".svg",
|
|
52
|
+
"description": "The SVG icon wrapped in a Lit template literal.",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": ".size",
|
|
59
|
+
"description": "The size of an icon, used to set the `viewBox` attribute.",
|
|
60
|
+
"value": {
|
|
61
|
+
"kind": "expression"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|