@vaadin/vaadin-material-styles 22.0.0-alpha1 → 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/README.md CHANGED
@@ -1,45 +1,11 @@
1
- [![npm version](https://badgen.net/npm/v/@vaadin/vaadin-material-styles)](https://www.npmjs.com/package/@vaadin/vaadin-material-styles)
2
- [![Bower version](https://badgen.net/github/release/vaadin/vaadin-material-styles)](https://github.com/vaadin/vaadin-material-styles/releases)
3
- [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/vaadin/web-components?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
4
-
5
1
  # Material Theme for Vaadin components
6
2
 
7
- `vaadin-material-styles` is customizable theme for the [Vaadin components](https://vaadin.com/components).
8
-
9
-
10
- ## Running demos and tests in browser
11
-
12
- 1. Fork the `vaadin-material-styles` repository and clone it locally.
13
-
14
- 1. Make sure you have [npm](https://www.npmjs.com/) installed.
15
-
16
- 1. When in the `vaadin-material-styles` directory, run `npm install` and then `bower install` to install dependencies.
17
-
18
- 1. Run `polymer serve --open`, browser will automatically open the component API documentation.
19
-
20
- 1. You can also open demo or in-browser tests by adding **demo** or **test** to the URL, for example:
21
-
22
- - http://127.0.0.1:8080/components/vaadin-material-styles/demo
23
- - http://127.0.0.1:8080/components/vaadin-material-styles/test
24
-
25
-
26
- ## Running tests from the command line
27
-
28
- 1. When in the `vaadin-material-styles` directory, run `polymer test`
29
-
30
-
31
- ## Following the coding style
32
-
33
- We are using [ESLint](http://eslint.org/) for linting JavaScript code. You can check if your code is following our standards by running `gulp lint`, which will automatically lint all `.js` files as well as JavaScript snippets inside `.html` files.
34
-
35
-
36
- ## Creating a pull request
3
+ [![npm version](https://badgen.net/npm/v/@vaadin/vaadin-material-styles)](https://www.npmjs.com/package/@vaadin/vaadin-material-styles)
4
+ [![Discord](https://img.shields.io/discord/732335336448852018?label=discord)](https://discord.gg/PHmkCKC)
37
5
 
38
- - Make sure your code is compliant with our code linters: `gulp lint`
39
- - Check that tests are passing: `polymer test`
40
- - [Submit a pull request](https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github) with detailed title and description
41
- - Wait for response from one of Vaadin components team members
6
+ `vaadin-material-styles` is customizable theme for the [Vaadin components](https://vaadin.com/components).
42
7
 
8
+ [Documentation ↗](https://cdn.vaadin.com/vaadin-material-styles/1.3.2/demo/)
43
9
 
44
10
  ## License
45
11
 
@@ -0,0 +1,8 @@
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 { CSSResult } from 'lit';
7
+
8
+ export const helper: CSSResult;
@@ -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,5 @@
1
+ import { CSSResult } from 'lit';
2
+
3
+ export const inputField: CSSResult;
4
+
5
+ export const inputFieldShared: CSSResult;
@@ -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 };
@@ -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 { css, registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles.js';
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 = css``;
11
+ const menuOverlay = overlay;
11
12
 
12
- registerStyles('', menuOverlay, { moduleId: 'material-menu-overlay', include: ['material-overlay'] });
13
+ registerStyles('', menuOverlay, { moduleId: 'material-menu-overlay' });
13
14
 
14
15
  export { menuOverlay };
@@ -23,7 +23,7 @@ const requiredField = css`
23
23
  transform: scale(0.75);
24
24
  }
25
25
 
26
- :host([required]) [part='label']::after {
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
- /* Margin that doesn’t reserve space when there’s no error message */
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": "22.0.0-alpha1",
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
- "repository": "vaadin/vaadin-material-styles",
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": "^22.0.0-alpha1"
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
- "publishConfig": {
44
- "access": "public"
45
- },
46
- "gitHead": "c9694d6549bff1f7fffb9ece26178e57fc228a51"
50
+ "gitHead": "6d3055383b9c3c8306ea34c6f2e2087e63c49348"
47
51
  }
package/typography.js CHANGED
@@ -29,16 +29,7 @@ const font = css`
29
29
  `;
30
30
 
31
31
  const typography = css`
32
- body {
33
- font-family: var(--material-font-family);
34
- font-size: var(--material-body-font-size);
35
- line-height: 1.4;
36
- -webkit-text-size-adjust: 100%;
37
- -webkit-font-smoothing: antialiased;
38
- -moz-osx-font-smoothing: grayscale;
39
- }
40
-
41
- /* Can’t combine with the above selector because that doesn’t work in browsers without native shadow dom */
32
+ body,
42
33
  :host {
43
34
  font-family: var(--material-font-family);
44
35
  font-size: var(--material-body-font-size);
@@ -114,34 +105,11 @@ const typography = css`
114
105
 
115
106
  registerStyles('', typography, { moduleId: 'material-typography' });
116
107
 
117
- const inputs = css`
118
- /* Slotted input styles */
119
- input[slot='input']::placeholder,
120
- textarea[slot='textarea']::placeholder {
121
- color: var(--material-disabled-text-color);
122
- transition: opacity 0.175s 0.1s;
123
- opacity: 1;
124
- }
125
-
126
- [has-label]:not([focused]):not([invalid]):not([theme~='always-float-label']) > input[slot='input']::placeholder,
127
- [has-label]:not([focused]):not([invalid]):not([theme~='always-float-label']) > input[slot='textarea']::placeholder {
128
- opacity: 0;
129
- transition-delay: 0;
130
- }
131
-
132
- /* Hide the native arrow icons */
133
- input[slot='input']::-webkit-outer-spin-button,
134
- input[slot='input']::-webkit-inner-spin-button {
135
- -webkit-appearance: none;
136
- margin: 0;
137
- }
138
- `;
139
-
140
108
  const $tpl = document.createElement('template');
141
- $tpl.innerHTML = `<style>${font.toString().replace(':host', 'html')}${inputs.toString()}</style>`;
109
+ $tpl.innerHTML = `<style>${font.toString().replace(':host', 'html')}</style>`;
142
110
  document.head.appendChild($tpl.content);
143
111
 
144
- export { font, inputs, typography };
112
+ export { font, typography };
145
113
 
146
114
  /* Import Roboto from Google Fonts */
147
115
  if (!window.polymerSkipLoadingFontRoboto) {
package/version.js CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  class Material extends HTMLElement {
7
7
  static get version() {
8
- return '22.0.0-alpha1';
8
+ return '22.0.0-alpha10';
9
9
  }
10
10
  }
11
11