@vaadin/vaadin-material-styles 21.0.1 → 22.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/mixins/helper.d.ts +8 -0
- package/mixins/helper.js +26 -0
- package/mixins/input-field-shared.d.ts +5 -0
- package/mixins/input-field-shared.js +195 -0
- package/mixins/menu-overlay.js +4 -3
- package/mixins/required-field.js +2 -3
- package/package.json +26 -22
- package/typography.d.ts +2 -0
- package/typography.js +6 -14
- package/version.js +1 -1
package/mixins/helper.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
7
|
+
import '../color.js';
|
|
8
|
+
|
|
9
|
+
export const helper = css`
|
|
10
|
+
[part='helper-text'] {
|
|
11
|
+
font-size: 0.75rem;
|
|
12
|
+
line-height: 1;
|
|
13
|
+
color: var(--material-secondary-text-color);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host([has-helper]) [part='helper-text']::before {
|
|
17
|
+
content: '';
|
|
18
|
+
display: block;
|
|
19
|
+
height: 6px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* According to Material guidelines, helper text should be hidden when error message is set and input is invalid */
|
|
23
|
+
:host([has-helper][invalid][has-error-message]) [part='helper-text'] {
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
7
|
+
import '../color.js';
|
|
8
|
+
import '../font-icons.js';
|
|
9
|
+
import '../typography.js';
|
|
10
|
+
import { fieldButton } from './field-button.js';
|
|
11
|
+
import { helper } from './helper.js';
|
|
12
|
+
import { requiredField } from './required-field.js';
|
|
13
|
+
|
|
14
|
+
const inputField = css`
|
|
15
|
+
:host {
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
position: relative;
|
|
18
|
+
padding-top: 8px;
|
|
19
|
+
margin-bottom: 8px;
|
|
20
|
+
outline: none;
|
|
21
|
+
color: var(--material-body-text-color);
|
|
22
|
+
font-size: var(--material-body-font-size);
|
|
23
|
+
line-height: 24px;
|
|
24
|
+
font-family: var(--material-font-family);
|
|
25
|
+
-webkit-font-smoothing: antialiased;
|
|
26
|
+
-moz-osx-font-smoothing: grayscale;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:host::before {
|
|
30
|
+
line-height: 32px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Strange gymnastics to make fields vertically align nicely in most cases
|
|
34
|
+
(no label, with label, without prefix, with prefix, etc.) */
|
|
35
|
+
|
|
36
|
+
:host([has-label]) {
|
|
37
|
+
padding-top: 24px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[part='input-field'] {
|
|
41
|
+
position: relative;
|
|
42
|
+
top: -0.2px; /* NOTE(platosha): Adjusts for wrong flex baseline in Chrome & Safari */
|
|
43
|
+
height: 32px;
|
|
44
|
+
padding-left: 0;
|
|
45
|
+
padding-right: 0;
|
|
46
|
+
background-color: transparent;
|
|
47
|
+
margin: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
[part='input-field']::before,
|
|
51
|
+
[part='input-field']::after {
|
|
52
|
+
content: '';
|
|
53
|
+
position: absolute;
|
|
54
|
+
bottom: 0;
|
|
55
|
+
left: 0;
|
|
56
|
+
right: 0;
|
|
57
|
+
height: 1px;
|
|
58
|
+
transform-origin: 50% 0%;
|
|
59
|
+
background-color: var(--_material-text-field-input-line-background-color, #000);
|
|
60
|
+
opacity: var(--_material-text-field-input-line-opacity, 0.42);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[part='input-field']::after {
|
|
64
|
+
background-color: var(--material-primary-color);
|
|
65
|
+
opacity: 0;
|
|
66
|
+
height: 2px;
|
|
67
|
+
bottom: 0;
|
|
68
|
+
transform: scaleX(0);
|
|
69
|
+
transition: opacity 0.175s;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([disabled]) [part='label'],
|
|
73
|
+
:host([disabled]) [part='input-field'] ::slotted(:is(input, textarea)) {
|
|
74
|
+
color: var(--material-disabled-text-color);
|
|
75
|
+
-webkit-text-fill-color: var(--material-disabled-text-color);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[part='input-field'] ::slotted(:is(input, textarea)) {
|
|
79
|
+
outline: none;
|
|
80
|
+
margin: 0;
|
|
81
|
+
border: 0;
|
|
82
|
+
border-radius: 0;
|
|
83
|
+
padding: 8px 0;
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 100%;
|
|
86
|
+
font-family: inherit;
|
|
87
|
+
font-size: 1em;
|
|
88
|
+
line-height: inherit;
|
|
89
|
+
color: inherit;
|
|
90
|
+
background-color: transparent;
|
|
91
|
+
/* Disable default invalid style in Firefox */
|
|
92
|
+
box-shadow: none;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* TODO: the text opacity should be 42%, but the disabled style is 38%.
|
|
96
|
+
Would need to introduce another property for it if we want to be 100% accurate. */
|
|
97
|
+
::slotted(:is(input, textarea):placeholder-shown) {
|
|
98
|
+
color: var(--material-disabled-text-color);
|
|
99
|
+
transition: opacity 0.175s 0.1s;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* prettier-ignore */
|
|
103
|
+
:host([has-label]:not([focused]):not([invalid]):not([theme='always-float-label'])) ::slotted(:is(input, textarea):placeholder-shown) {
|
|
104
|
+
opacity: 0;
|
|
105
|
+
transition-delay: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
[part='label'] {
|
|
109
|
+
width: 133%;
|
|
110
|
+
transition: transform 0.175s, color 0.175s, width 0.175s;
|
|
111
|
+
transition-timing-function: ease, ease, step-end;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:host(:hover:not([readonly]):not([invalid])) [part='input-field']::before {
|
|
115
|
+
opacity: var(--_material-text-field-input-line-hover-opacity, 0.87);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host([focused]:not([invalid])) [part='label'] {
|
|
119
|
+
color: var(--material-primary-text-color);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:host([focused]) [part='input-field']::after,
|
|
123
|
+
:host([invalid]) [part='input-field']::after {
|
|
124
|
+
opacity: 1;
|
|
125
|
+
transform: none;
|
|
126
|
+
transition: transform 0.175s, opacity 0.175s;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:host([invalid]) [part='input-field']::after {
|
|
130
|
+
background-color: var(--material-error-color);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:host([input-prevented]) [part='input-field'] {
|
|
134
|
+
color: var(--material-error-text-color);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
:host([disabled]) {
|
|
138
|
+
pointer-events: none;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
:host([disabled]) [part='input-field'] {
|
|
142
|
+
color: var(--material-disabled-text-color);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:host([disabled]) [part='input-field']::before {
|
|
146
|
+
background-color: transparent;
|
|
147
|
+
background-image: linear-gradient(
|
|
148
|
+
90deg,
|
|
149
|
+
var(--_material-text-field-input-line-background-color, #000) 0,
|
|
150
|
+
var(--_material-text-field-input-line-background-color, #000) 2px,
|
|
151
|
+
transparent 2px
|
|
152
|
+
);
|
|
153
|
+
background-size: 4px 1px;
|
|
154
|
+
background-repeat: repeat-x;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/* Only target the visible floating label */
|
|
158
|
+
:host([has-label]:not([has-value]):not([focused]):not([invalid]):not([theme~='always-float-label'])) [part='label'] {
|
|
159
|
+
width: 100%;
|
|
160
|
+
transform: scale(1) translateY(24px);
|
|
161
|
+
transition-timing-function: ease, ease, step-start;
|
|
162
|
+
pointer-events: none;
|
|
163
|
+
left: auto;
|
|
164
|
+
right: auto;
|
|
165
|
+
transition-delay: 0.1s;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Slotted content */
|
|
169
|
+
[part='input-field'] ::slotted(*:not([part$='-button']):not(input):not(textarea)) {
|
|
170
|
+
color: var(--material-secondary-text-color);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
[part='clear-button']::before {
|
|
174
|
+
content: var(--material-icons-clear);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* RTL specific styles */
|
|
178
|
+
|
|
179
|
+
:host([disabled][dir='rtl']) [part='input-field']::before {
|
|
180
|
+
background-image: linear-gradient(
|
|
181
|
+
-90deg,
|
|
182
|
+
var(--_material-text-field-input-line-background-color, #000) 0,
|
|
183
|
+
var(--_material-text-field-input-line-background-color, #000) 2px,
|
|
184
|
+
transparent 2px
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
`;
|
|
188
|
+
|
|
189
|
+
const inputFieldShared = [requiredField, fieldButton, helper, inputField];
|
|
190
|
+
|
|
191
|
+
registerStyles('', inputFieldShared, {
|
|
192
|
+
moduleId: 'material-input-field-shared-styles'
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
export { inputField, inputFieldShared };
|
package/mixins/menu-overlay.js
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
7
|
+
import { overlay } from '@vaadin/vaadin-material-styles/mixins/overlay.js';
|
|
7
8
|
import '../color.js';
|
|
8
9
|
import './overlay.js';
|
|
9
10
|
|
|
10
|
-
const menuOverlay =
|
|
11
|
+
const menuOverlay = overlay;
|
|
11
12
|
|
|
12
|
-
registerStyles('', menuOverlay, { moduleId: 'material-menu-overlay'
|
|
13
|
+
registerStyles('', menuOverlay, { moduleId: 'material-menu-overlay' });
|
|
13
14
|
|
|
14
15
|
export { menuOverlay };
|
package/mixins/required-field.js
CHANGED
|
@@ -23,7 +23,7 @@ const requiredField = css`
|
|
|
23
23
|
transform: scale(0.75);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
:host([required]) [part='
|
|
26
|
+
:host([required]) [part='required-indicator']::after {
|
|
27
27
|
content: ' *';
|
|
28
28
|
color: inherit;
|
|
29
29
|
}
|
|
@@ -38,8 +38,7 @@ const requiredField = css`
|
|
|
38
38
|
color: var(--material-error-text-color);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
[part='error-message']:not(:empty)::before {
|
|
41
|
+
:host([has-error-message]) [part='error-message']::before {
|
|
43
42
|
content: '';
|
|
44
43
|
display: block;
|
|
45
44
|
height: 6px;
|
package/package.json
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/vaadin-material-styles",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "22.0.0-alpha10",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"description": "Vaadin Material is a complete theme for Vaadin components, inspired by Google’s Material Design guidelines.",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/vaadin/web-components.git",
|
|
12
|
+
"directory": "packages/vaadin-material-styles"
|
|
13
|
+
},
|
|
14
|
+
"author": "Vaadin Ltd",
|
|
15
|
+
"homepage": "https://vaadin.com/themes",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/vaadin/vaadin-material-styles/issues"
|
|
18
|
+
},
|
|
5
19
|
"main": "all-imports.js",
|
|
6
20
|
"module": "all-imports.js",
|
|
7
|
-
"
|
|
21
|
+
"scripts": {
|
|
22
|
+
"icons": "gulp icons"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"*.d.ts",
|
|
26
|
+
"*.js",
|
|
27
|
+
"mixins/*.d.ts",
|
|
28
|
+
"mixins/*.js"
|
|
29
|
+
],
|
|
8
30
|
"keywords": [
|
|
9
31
|
"vaadin",
|
|
10
32
|
"material",
|
|
@@ -14,24 +36,9 @@
|
|
|
14
36
|
"web-component",
|
|
15
37
|
"polymer"
|
|
16
38
|
],
|
|
17
|
-
"author": "Vaadin Ltd",
|
|
18
|
-
"license": "Apache-2.0",
|
|
19
|
-
"bugs": {
|
|
20
|
-
"url": "https://github.com/vaadin/vaadin-material-styles/issues"
|
|
21
|
-
},
|
|
22
|
-
"homepage": "https://vaadin.com/themes",
|
|
23
|
-
"files": [
|
|
24
|
-
"*.js",
|
|
25
|
-
"*.d.ts",
|
|
26
|
-
"mixins/*.js",
|
|
27
|
-
"mixins/*.d.ts"
|
|
28
|
-
],
|
|
29
|
-
"scripts": {
|
|
30
|
-
"icons": "gulp icons"
|
|
31
|
-
},
|
|
32
39
|
"dependencies": {
|
|
33
40
|
"@polymer/polymer": "^3.0.0",
|
|
34
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "22.0.0-alpha10"
|
|
35
42
|
},
|
|
36
43
|
"devDependencies": {
|
|
37
44
|
"gulp": "^4.0.0",
|
|
@@ -40,8 +47,5 @@
|
|
|
40
47
|
"gulp-sort": "^2.0.0",
|
|
41
48
|
"gulp-svgmin": "^3.0.0"
|
|
42
49
|
},
|
|
43
|
-
"
|
|
44
|
-
"access": "public"
|
|
45
|
-
},
|
|
46
|
-
"gitHead": "91e44dcfa63dc5e30e1e8d18be499b3e1e17b1c4"
|
|
50
|
+
"gitHead": "6d3055383b9c3c8306ea34c6f2e2087e63c49348"
|
|
47
51
|
}
|
package/typography.d.ts
CHANGED
package/typography.js
CHANGED
|
@@ -28,21 +28,8 @@ const font = css`
|
|
|
28
28
|
}
|
|
29
29
|
`;
|
|
30
30
|
|
|
31
|
-
const $tpl = document.createElement('template');
|
|
32
|
-
$tpl.innerHTML = `<style>${font.toString().replace(':host', 'html')}</style>`;
|
|
33
|
-
document.head.appendChild($tpl.content);
|
|
34
|
-
|
|
35
31
|
const typography = css`
|
|
36
|
-
body
|
|
37
|
-
font-family: var(--material-font-family);
|
|
38
|
-
font-size: var(--material-body-font-size);
|
|
39
|
-
line-height: 1.4;
|
|
40
|
-
-webkit-text-size-adjust: 100%;
|
|
41
|
-
-webkit-font-smoothing: antialiased;
|
|
42
|
-
-moz-osx-font-smoothing: grayscale;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/* Can’t combine with the above selector because that doesn’t work in browsers without native shadow dom */
|
|
32
|
+
body,
|
|
46
33
|
:host {
|
|
47
34
|
font-family: var(--material-font-family);
|
|
48
35
|
font-size: var(--material-body-font-size);
|
|
@@ -115,8 +102,13 @@ const typography = css`
|
|
|
115
102
|
font-weight: 500;
|
|
116
103
|
}
|
|
117
104
|
`;
|
|
105
|
+
|
|
118
106
|
registerStyles('', typography, { moduleId: 'material-typography' });
|
|
119
107
|
|
|
108
|
+
const $tpl = document.createElement('template');
|
|
109
|
+
$tpl.innerHTML = `<style>${font.toString().replace(':host', 'html')}</style>`;
|
|
110
|
+
document.head.appendChild($tpl.content);
|
|
111
|
+
|
|
120
112
|
export { font, typography };
|
|
121
113
|
|
|
122
114
|
/* Import Roboto from Google Fonts */
|