5050 >
5151 {{ hintValue || labelValue }}
5252 </label >
53+
54+ <button
55+ v-if =" clearable && inputValue && !textarea"
56+ class =" field-clear"
57+ title =" clear"
58+ type =" button"
59+ @click =" clear"
60+ >
61+ <span class =" field-clear__effect" />
62+ <span >
63+ ✕
64+ </span >
65+ </button >
66+
5367 <div
5468 v-if =" loader"
5569 class =" loader"
70+ :class =" { textarea }"
5671 />
5772 </div >
5873</template >
7792 required: { type: Boolean , default: false },
7893 textarea: { type: Boolean , default: false },
7994 loader: { type: Boolean , default: false },
95+ clearable: { type: Boolean , default: true }
8096 },
8197 data : function () {
8298 return {
130146 onBlur : function () {
131147 this .$emit (' blur' )
132148 this .isFocus = false
149+ },
150+ clear () {
151+ this .$emit (' input' , null )
152+ this .$emit (' clear' )
133153 }
134154 }
135155 }
143163 position : relative ;
144164 & .is-dark {
145165 .field-label {
146- color : rgba (255 , 255 , 255 , 0.70 );
166+ color : rgba (white , 0.70 );
147167 }
148168 .field-input {
149169 background-color : #424242 ;
150- border-color : rgba (255 , 255 , 255 , 0.70 );
151- color : rgba (255 , 255 , 255 , 0.70 );
170+ border-color : rgba (white , 0.70 );
171+ color : rgba (white , 0.70 );
152172 }
153173 & .is-disabled {
154174 .field-label , .field-input {
155175 color : #000 ;
156176 }
157177 }
178+ .field-clear {
179+ color : rgba (white , 0.70 );
180+
181+ & __effect {
182+ background-color : rgba (white , 0.54 );
183+ }
184+ }
158185 }
159186 .field-label {
160187 position : absolute ;
195222 resize : vertical ;
196223 }
197224 }
225+
226+ .field-clear {
227+ $clear-size : 24px ;
228+
229+ position : absolute ;
230+ top : 0 ;
231+ bottom : 0 ;
232+ right : 8px ;
233+ margin : auto 0 ;
234+ width : $clear-size ;
235+ height : $clear-size ;
236+ appearance : none ;
237+ border : none ;
238+ background : transparent ;
239+ color : rgba (0 , 0 , 0 , 0.54 );
240+ border-radius : $clear-size ;
241+ cursor : pointer ;
242+
243+ & :focus {
244+ outline : none ;
245+ }
246+
247+ & > span :not (.field-clear__effect ) {
248+ position : relative ;
249+ top : 1px ;
250+ }
251+
252+ & __effect {
253+ position : absolute ;
254+ top : 0 ;
255+ left : 0 ;
256+ right : 0 ;
257+ bottom : 0 ;
258+ width : $clear-size ;
259+ height : $clear-size ;
260+ background-color : rgba (black , 0.54 );
261+ border-radius : $clear-size ;
262+ transform : scale (0 );
263+ transition : transform 200ms ;
264+ }
265+
266+ & :hover {
267+ color : white ;
268+
269+ .field-clear__effect {
270+ transform : scale (1 );
271+ opacity : 0.6 ;
272+ }
273+ }
274+ }
275+
198276 & .has-value {
199277 .field-label {
200278 opacity : 1 ;
249327 }
250328 & .is-dark {
251329 ::-webkit-input-placeholder { /* WebKit, Blink, Edge */
252- color : rgba (255 , 255 , 255 , 0.70 );
330+ color : rgba (white , 0.70 );
253331 }
254332 :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
255- color : rgba (255 , 255 , 255 , 0.70 );
333+ color : rgba (white , 0.70 );
256334 opacity : 1 ;
257335 }
258336 ::-moz-placeholder { /* Mozilla Firefox 19+ */
259- color : rgba (255 , 255 , 255 , 0.70 );
337+ color : rgba (white , 0.70 );
260338 opacity : 1 ;
261339 }
262340 :-ms-input-placeholder { /* Internet Explorer 10-11 */
263- color : rgba (255 , 255 , 255 , 0.70 );
341+ color : rgba (white , 0.70 );
264342 }
265343 ::-ms-input-placeholder { /* Microsoft Edge */
266- color : rgba (255 , 255 , 255 , 0.70 );
344+ color : rgba (white , 0.70 );
267345 }
268346 ::placeholder { /* Most modern browsers support this now. */
269- color : rgba (255 , 255 , 255 , 0.70 );
347+ color : rgba (white , 0.70 );
270348 }
271349 & .is-disabled {
272350 ::-webkit-input-placeholder { /* WebKit, Blink, Edge */
341419 overflow : hidden ;
342420 border-radius : 2px ;
343421
422+ & .textarea {
423+ top : -7px ;
424+ }
425+
344426 & ::before {
345427 display : block ;
346428 position : absolute ;
379461 left : 100% ;
380462 }
381463 }
464+ input :-webkit-autofill ,
465+ input :-webkit-autofill :hover ,
466+ input :-webkit-autofill :focus ,
467+ input :-webkit-autofill :active {
468+ box-shadow : 0 0 0 30px white inset ;
469+ -webkit-box-shadow : 0 0 0 30px white inset ;
470+ }
471+ & .is-dark {
472+ input :-webkit-autofill ,
473+ input :-webkit-autofill :hover ,
474+ input :-webkit-autofill :focus ,
475+ input :-webkit-autofill :active {
476+ box-shadow : 0 0 0 30px #424242 inset ;
477+ -webkit-box-shadow : 0 0 0 30px #424242 inset ;
478+ }
479+ input :-webkit-autofill {
480+ -webkit-text-fill-color : rgba (white , 0.70 ) !important ;
481+ }
482+ }
382483 }
383484 </style >
0 commit comments