@@ -3,178 +3,178 @@ import '@vaadin/vaadin-material-styles/color.js';
33import '@vaadin/vaadin-material-styles/shadow.js' ;
44import '@vaadin/vaadin-material-styles/typography.js' ;
55
6- registerStyles (
7- 'vaadin-button' ,
8- css `
6+ const button = css `
7+ : host {
8+ padding : 8px ;
9+ min-width : 64px ;
10+ box-sizing : border-box;
11+ display : inline-flex;
12+ align-items : baseline;
13+ justify-content : center;
14+ border-radius : 4px ;
15+ color : var ( --material-primary-text-color ) ;
16+ font-family : var ( --material-font-family ) ;
17+ text-transform : uppercase;
18+ font-size : var ( --material-button-font-size ) ;
19+ line-height : 20px ;
20+ font-weight : 500 ;
21+ letter-spacing : 0.05em ;
22+ white-space : nowrap;
23+ overflow : hidden;
24+ transition : box-shadow 0.2s ;
25+ -webkit-tap-highlight-color : transparent;
26+ -webkit-font-smoothing : antialiased;
27+ -moz-osx-font-smoothing : grayscale;
28+ }
29+
30+ @-moz-document url-prefix( ) {
931 : host {
10- padding : 8px ;
11- min-width : 64px ;
12- box-sizing : border-box;
13- display : inline-flex;
14- align-items : baseline;
15- justify-content : center;
16- border-radius : 4px ;
17- color : var ( --material-primary-text-color ) ;
18- font-family : var ( --material-font-family ) ;
19- text-transform : uppercase;
20- font-size : var ( --material-button-font-size ) ;
21- line-height : 20px ;
22- font-weight : 500 ;
23- letter-spacing : 0.05em ;
24- white-space : nowrap;
25- overflow : hidden;
26- transition : box-shadow 0.2s ;
27- -webkit-tap-highlight-color : transparent;
28- -webkit-font-smoothing : antialiased;
29- -moz-osx-font-smoothing : grayscale;
30- }
31-
32- @-moz-document url-prefix( ) {
33- : host {
34- vertical-align : -13px ;
35- }
36- }
37-
38- : host :: before ,
39- : host :: after {
40- content : '' ;
41- pointer-events : none;
42- position : absolute;
43- border-radius : inherit;
44- opacity : 0 ;
45- background-color : currentColor;
46- }
47-
48- : host :: before {
49- width : 100% ;
50- height : 100% ;
51- top : 0 ;
52- left : 0 ;
53- transition : opacity 0.5s ;
54- }
55-
56- : host :: after {
57- border-radius : 50% ;
58- width : 320px ;
59- height : 320px ;
60- top : 50% ;
61- left : 50% ;
62- transform : translate ( -50% , -50% ) ;
63- transition : all 0.9s ;
64- }
65-
66- [part = 'label' ] :: slotted ( * ) {
67- vertical-align : middle;
68- }
69-
70- : host ( : hover ) :: before ,
71- : host ( [focus-ring ]) :: before {
72- opacity : 0.08 ;
73- transition-duration : 0.2s ;
74- }
75-
76- : host ( [active ]) :: before {
77- opacity : 0.16 ;
78- transition : opacity 0.4s ;
79- }
80-
81- : host ( [active ]) :: after {
82- transform : translate ( -50% , -50% ) scale ( 0.0000001 ) ; /* animation works weirdly with scale(0) */
83- opacity : 0.1 ;
84- transition : 0s ;
85- }
86-
87- : host ( : hover : not ( [active ]) ) :: after {
88- transform : translate ( -50% , -50% ) scale ( 1 ) ;
89- opacity : 0 ;
90- }
91-
92- : host ( [disabled ]) {
93- pointer-events : none;
94- color : var ( --material-disabled-text-color ) ;
95- }
96-
97- /* Contained and outline variants */
98- : host ( [theme ~= 'contained' ]) ,
99- : host ( [theme ~= 'outlined' ]) {
100- padding : 8px 16px ;
101- }
102-
103- : host ( [theme ~= 'outlined' ]) {
104- box-shadow : inset 0 0 0 1px var ( --_material-button-outline-color , rgba ( 0 , 0 , 0 , 0.2 ) ) ;
105- }
106-
107- : host ( [theme ~= 'contained' ]: not ( [disabled ]) ) {
108- background-color : var ( --material-primary-color ) ;
109- color : var ( --material-primary-contrast-color ) ;
110- box-shadow : var ( --material-shadow-elevation-2dp ) ;
111- }
112-
113- : host ( [theme ~= 'contained' ][disabled ]) {
114- background-color : var ( --material-secondary-background-color ) ;
115- }
116-
117- : host ( [theme ~= 'contained' ]: hover ) {
118- box-shadow : var ( --material-shadow-elevation-4dp ) ;
119- }
120-
121- : host ( [theme ~= 'contained' ][active ]) {
122- box-shadow : var ( --material-shadow-elevation-8dp ) ;
123- }
124-
125- /* Icon alignment */
126-
127- [part ] :: slotted ( vaadin-icon ) ,
128- [part ] :: slotted ( iron-icon ) {
129- display : block;
130- width : 18px ;
131- height : 18px ;
132- }
133-
134- [part = 'prefix' ] :: slotted ( vaadin-icon ) ,
135- [part = 'prefix' ] :: slotted ( iron-icon ) {
136- margin-right : 8px ;
137- margin-left : -4px ;
138- }
139-
140- [part = 'suffix' ] :: slotted ( vaadin-icon ) ,
141- [part = 'suffix' ] :: slotted ( iron-icon ) {
142- margin-left : 8px ;
143- margin-right : -4px ;
144- }
145-
146- /* RTL specific styles */
147-
148- : host ( [dir = 'rtl' ]) :: before {
149- left : auto;
150- right : 0 ;
151- }
152-
153- : host ( [dir = 'rtl' ]) :: after {
154- left : auto;
155- right : 50% ;
156- transform : translate ( 50% , -50% ) ;
157- }
158-
159- : host ( [active ][dir = 'rtl' ]) :: after {
160- transform : translate ( 50% , -50% ) scale ( 0.0000001 ) ;
161- }
162-
163- : host ( : hover : not ( [active ]) [dir = 'rtl' ]) :: after {
164- transform : translate ( 50% , -50% ) scale ( 1 ) ;
165- }
166-
167- : host ( [dir = 'rtl' ]) [part = 'prefix' ] :: slotted ( vaadin-icon ) ,
168- : host ( [dir = 'rtl' ]) [part = 'prefix' ] :: slotted ( iron-icon ) {
169- margin-right : -4px ;
170- margin-left : 8px ;
171- }
172-
173- : host ( [dir = 'rtl' ]) [part = 'suffix' ] :: slotted ( vaadin-icon ) ,
174- : host ( [dir = 'rtl' ]) [part = 'suffix' ] :: slotted ( iron-icon ) {
175- margin-left : -4px ;
176- margin-right : 8px ;
177- }
178- ` ,
179- { moduleId : 'material-button' }
180- ) ;
32+ vertical-align : -13px ;
33+ }
34+ }
35+
36+ : host :: before ,
37+ : host :: after {
38+ content : '' ;
39+ pointer-events : none;
40+ position : absolute;
41+ border-radius : inherit;
42+ opacity : 0 ;
43+ background-color : currentColor;
44+ }
45+
46+ : host :: before {
47+ width : 100% ;
48+ height : 100% ;
49+ top : 0 ;
50+ left : 0 ;
51+ transition : opacity 0.5s ;
52+ }
53+
54+ : host :: after {
55+ border-radius : 50% ;
56+ width : 320px ;
57+ height : 320px ;
58+ top : 50% ;
59+ left : 50% ;
60+ transform : translate ( -50% , -50% ) ;
61+ transition : all 0.9s ;
62+ }
63+
64+ [part = 'label' ] :: slotted ( * ) {
65+ vertical-align : middle;
66+ }
67+
68+ : host ( : hover ) :: before ,
69+ : host ( [focus-ring ]) :: before {
70+ opacity : 0.08 ;
71+ transition-duration : 0.2s ;
72+ }
73+
74+ : host ( [active ]) :: before {
75+ opacity : 0.16 ;
76+ transition : opacity 0.4s ;
77+ }
78+
79+ : host ( [active ]) :: after {
80+ transform : translate ( -50% , -50% ) scale ( 0.0000001 ) ; /* animation works weirdly with scale(0) */
81+ opacity : 0.1 ;
82+ transition : 0s ;
83+ }
84+
85+ : host ( : hover : not ( [active ]) ) :: after {
86+ transform : translate ( -50% , -50% ) scale ( 1 ) ;
87+ opacity : 0 ;
88+ }
89+
90+ : host ( [disabled ]) {
91+ pointer-events : none;
92+ color : var ( --material-disabled-text-color ) ;
93+ }
94+
95+ /* Contained and outline variants */
96+ : host ( [theme ~= 'contained' ]) ,
97+ : host ( [theme ~= 'outlined' ]) {
98+ padding : 8px 16px ;
99+ }
100+
101+ : host ( [theme ~= 'outlined' ]) {
102+ box-shadow : inset 0 0 0 1px var ( --_material-button-outline-color , rgba ( 0 , 0 , 0 , 0.2 ) ) ;
103+ }
104+
105+ : host ( [theme ~= 'contained' ]: not ( [disabled ]) ) {
106+ background-color : var ( --material-primary-color ) ;
107+ color : var ( --material-primary-contrast-color ) ;
108+ box-shadow : var ( --material-shadow-elevation-2dp ) ;
109+ }
110+
111+ : host ( [theme ~= 'contained' ][disabled ]) {
112+ background-color : var ( --material-secondary-background-color ) ;
113+ }
114+
115+ : host ( [theme ~= 'contained' ]: hover ) {
116+ box-shadow : var ( --material-shadow-elevation-4dp ) ;
117+ }
118+
119+ : host ( [theme ~= 'contained' ][active ]) {
120+ box-shadow : var ( --material-shadow-elevation-8dp ) ;
121+ }
122+
123+ /* Icon alignment */
124+
125+ [part ] :: slotted ( vaadin-icon ) ,
126+ [part ] :: slotted ( iron-icon ) {
127+ display : block;
128+ width : 18px ;
129+ height : 18px ;
130+ }
131+
132+ [part = 'prefix' ] :: slotted ( vaadin-icon ) ,
133+ [part = 'prefix' ] :: slotted ( iron-icon ) {
134+ margin-right : 8px ;
135+ margin-left : -4px ;
136+ }
137+
138+ [part = 'suffix' ] :: slotted ( vaadin-icon ) ,
139+ [part = 'suffix' ] :: slotted ( iron-icon ) {
140+ margin-left : 8px ;
141+ margin-right : -4px ;
142+ }
143+
144+ /* RTL specific styles */
145+
146+ : host ( [dir = 'rtl' ]) :: before {
147+ left : auto;
148+ right : 0 ;
149+ }
150+
151+ : host ( [dir = 'rtl' ]) :: after {
152+ left : auto;
153+ right : 50% ;
154+ transform : translate ( 50% , -50% ) ;
155+ }
156+
157+ : host ( [active ][dir = 'rtl' ]) :: after {
158+ transform : translate ( 50% , -50% ) scale ( 0.0000001 ) ;
159+ }
160+
161+ : host ( : hover : not ( [active ]) [dir = 'rtl' ]) :: after {
162+ transform : translate ( 50% , -50% ) scale ( 1 ) ;
163+ }
164+
165+ : host ( [dir = 'rtl' ]) [part = 'prefix' ] :: slotted ( vaadin-icon ) ,
166+ : host ( [dir = 'rtl' ]) [part = 'prefix' ] :: slotted ( iron-icon ) {
167+ margin-right : -4px ;
168+ margin-left : 8px ;
169+ }
170+
171+ : host ( [dir = 'rtl' ]) [part = 'suffix' ] :: slotted ( vaadin-icon ) ,
172+ : host ( [dir = 'rtl' ]) [part = 'suffix' ] :: slotted ( iron-icon ) {
173+ margin-left : -4px ;
174+ margin-right : 8px ;
175+ }
176+ ` ;
177+
178+ registerStyles ( 'vaadin-button' , button , { moduleId : 'material-button' } ) ;
179+
180+ export { button } ;
0 commit comments