|
1 | | -@import "./input.vars"; |
| 1 | +@import "../../themes/mixins"; |
2 | 2 |
|
3 | | -// Input |
| 3 | +// Input: Common |
4 | 4 | // -------------------------------------------------- |
5 | 5 |
|
6 | 6 | :host { |
|
19 | 19 | * @prop --placeholder-font-weight: Font weight of the input placeholder text |
20 | 20 | * @prop --placeholder-opacity: Opacity of the input placeholder text |
21 | 21 | * |
22 | | - * @prop --highlight-height: The height of the highlight on the input. Only applies to md mode. |
23 | | - * @prop --highlight-color-focused: The color of the highlight on the input when focused |
24 | 22 | * @prop --highlight-color-valid: The color of the highlight on the input when valid |
25 | 23 | * @prop --highlight-color-invalid: The color of the highlight on the input when invalid |
26 | 24 | * |
|
32 | 30 | --placeholder-color: initial; |
33 | 31 | --placeholder-font-style: initial; |
34 | 32 | --placeholder-font-weight: initial; |
35 | | - --placeholder-opacity: #{$placeholder-opacity}; |
36 | 33 | --padding-top: 0px; |
37 | 34 | --padding-end: 0px; |
38 | 35 | --padding-bottom: 0px; |
39 | 36 | --padding-start: 0px; |
40 | | - --background: transparent; |
41 | | - --color: initial; |
42 | 37 | --border-style: solid; |
43 | | - --highlight-color-focused: #{ion-color(primary, base)}; |
44 | | - --highlight-color-valid: #{ion-color(success, base)}; |
45 | | - --highlight-color-invalid: #{ion-color(danger, base)}; |
46 | 38 |
|
47 | 39 | /** |
48 | 40 | * This is a private API that is used to switch |
|
58 | 50 |
|
59 | 51 | width: 100%; |
60 | 52 |
|
61 | | - min-height: 44px; |
62 | | - |
63 | 53 | /* stylelint-disable-next-line all */ |
64 | 54 | padding: 0 !important; |
65 | 55 |
|
66 | 56 | color: var(--color); |
67 | | - |
68 | | - font-family: $font-family-base; |
69 | | - |
70 | | - z-index: $z-index-item-input; |
71 | 57 | } |
72 | 58 |
|
73 | 59 | :host-context(ion-item)[slot="start"], |
|
79 | 65 | --highlight-color-focused: #{current-color(base)}; |
80 | 66 | } |
81 | 67 |
|
82 | | -// Input Wrapper |
83 | | -// ---------------------------------------------------------------- |
84 | | - |
85 | | -/** |
86 | | - * Since the label sits on top of the element, |
87 | | - * the component needs to be taller otherwise the |
88 | | - * label will appear too close to the input text. |
89 | | - */ |
90 | | -:host(.input-label-placement-floating), |
91 | | -:host(.input-label-placement-stacked) { |
92 | | - min-height: 56px; |
93 | | -} |
94 | | - |
95 | 68 | // Native Text Input |
96 | 69 | // -------------------------------------------------- |
97 | 70 |
|
|
190 | 163 | align-items: center; |
191 | 164 | justify-content: center; |
192 | 165 |
|
193 | | - width: 30px; |
194 | | - height: 30px; |
195 | | - |
196 | 166 | border: 0; |
197 | 167 |
|
198 | 168 | outline: none; |
199 | 169 |
|
200 | 170 | background-color: transparent; |
201 | 171 | background-repeat: no-repeat; |
202 | 172 |
|
203 | | - color: $text-color-step-400; |
204 | | - |
205 | 173 | visibility: hidden; |
206 | 174 | appearance: none; |
207 | 175 | } |
|
210 | 178 | color: inherit; |
211 | 179 | } |
212 | 180 |
|
213 | | -/** |
214 | | - * Normally, we would not want to use :focus |
215 | | - * here because that would mean tapping the button |
216 | | - * on mobile would focus it (and keep it focused). |
217 | | - * However, the clear button always disappears after |
218 | | - * being activated, so we never get to that state. |
219 | | - */ |
220 | | -.input-clear-icon:focus { |
221 | | - opacity: 0.5; |
222 | | -} |
223 | | - |
224 | 181 | :host(.has-value) .input-clear-icon { |
225 | 182 | visibility: visible; |
226 | 183 | } |
|
292 | 249 | // ---------------------------------------------------------------- |
293 | 250 |
|
294 | 251 | .input-bottom { |
295 | | - /** |
296 | | - * The bottom content should take on the start and end |
297 | | - * padding so it is always aligned with either the label |
298 | | - * or the start of the text input. |
299 | | - */ |
300 | | - @include padding(5px, var(--padding-end), 0, var(--padding-start)); |
301 | | - |
302 | 252 | display: flex; |
303 | 253 |
|
304 | 254 | justify-content: space-between; |
305 | 255 |
|
306 | 256 | border-top: var(--border-width) var(--border-style) var(--border-color); |
307 | 257 |
|
308 | | - font-size: dynamic-font(12px); |
309 | | - |
310 | 258 | white-space: normal; |
311 | 259 | } |
312 | 260 |
|
|
341 | 289 |
|
342 | 290 | .input-bottom .helper-text { |
343 | 291 | display: block; |
344 | | - |
345 | | - color: $text-color-step-300; |
346 | 292 | } |
347 | 293 |
|
348 | 294 | :host(.ion-touched.ion-invalid) .input-bottom .error-text { |
|
364 | 310 | */ |
365 | 311 | @include margin-horizontal(auto, null); |
366 | 312 |
|
367 | | - color: $text-color-step-300; |
368 | | - |
369 | 313 | white-space: nowrap; |
370 | | - |
371 | | - padding-inline-start: 16px; |
372 | 314 | } |
373 | 315 |
|
374 | 316 | // Input Native |
|
463 | 405 | flex-direction: row; |
464 | 406 | } |
465 | 407 |
|
466 | | -:host(.input-label-placement-start) .label-text-wrapper { |
467 | | - /** |
468 | | - * The margin between the label and |
469 | | - * the input should be on the end |
470 | | - * when the label sits at the start. |
471 | | - */ |
472 | | - @include margin(0, $form-control-label-margin, 0, 0); |
473 | | -} |
474 | | - |
475 | 408 | // Input Label Placement - End |
476 | 409 | // ---------------------------------------------------------------- |
477 | 410 |
|
|
483 | 416 | flex-direction: row-reverse; |
484 | 417 | } |
485 | 418 |
|
486 | | -/** |
487 | | - * The margin between the label and |
488 | | - * the input should be on the start |
489 | | - * when the label sits at the end. |
490 | | - */ |
491 | | -:host(.input-label-placement-end) .label-text-wrapper { |
492 | | - @include margin(0, 0, 0, $form-control-label-margin); |
493 | | -} |
494 | | - |
495 | 419 | // Input Label Placement - Fixed |
496 | 420 | // ---------------------------------------------------------------- |
497 | 421 |
|
498 | | -:host(.input-label-placement-fixed) .label-text-wrapper { |
499 | | - /** |
500 | | - * The margin between the label and |
501 | | - * the input should be on the end |
502 | | - * when the label sits at the start. |
503 | | - */ |
504 | | - @include margin(0, $form-control-label-margin, 0, 0); |
505 | | -} |
506 | | - |
507 | 422 | /** |
508 | 423 | * Label is on the left of the input in LTR and |
509 | 424 | * on the right in RTL. Label also has a fixed width. |
|
551 | 466 | z-index: 2; |
552 | 467 | } |
553 | 468 |
|
554 | | -/** |
555 | | - * Ensures the input does not |
556 | | - * overlap the label. |
557 | | - */ |
558 | | -:host(.input-label-placement-stacked) input, |
559 | | -:host(.input-label-placement-floating) input { |
560 | | - @include margin(1px, 0, 0, 0); |
561 | | -} |
562 | | - |
563 | 469 | /** |
564 | 470 | * This makes the label sit over the input |
565 | 471 | * when the input is blurred and has no value. |
|
568 | 474 | @include transform(translateY(100%), scale(1)); |
569 | 475 | } |
570 | 476 |
|
| 477 | +/** |
| 478 | + * Ensures the input does not |
| 479 | + * overlap the label. |
| 480 | + */ |
| 481 | + :host(.input-label-placement-stacked) input, |
| 482 | + :host(.input-label-placement-floating) input { |
| 483 | + @include margin(1px, 0, 0, 0); |
| 484 | + } |
| 485 | + |
571 | 486 | /** |
572 | 487 | * The input should be hidden when the label |
573 | 488 | * is on top of the input. This prevents the label |
|
582 | 497 | opacity: 1; |
583 | 498 | } |
584 | 499 |
|
585 | | -/** |
586 | | - * This makes the label sit above the input. |
587 | | - */ |
588 | | -:host(.label-floating) .label-text-wrapper { |
589 | | - @include transform(translateY(50%), scale(#{$form-control-label-stacked-scale})); |
590 | | - |
591 | | - /** |
592 | | - * Label text should not extend |
593 | | - * beyond the bounds of the input. |
594 | | - */ |
595 | | - max-width: calc(100% / #{$form-control-label-stacked-scale}); |
596 | | -} |
597 | | - |
598 | | -// Start/End Slots |
| 500 | +// Input Password Toggle |
599 | 501 | // ---------------------------------------------------------------- |
600 | 502 |
|
601 | | -::slotted([slot="start"]:last-of-type) { |
602 | | - margin-inline-end: $form-control-label-margin; |
603 | | - margin-inline-start: 0; |
604 | | -} |
605 | | - |
606 | | -::slotted([slot="end"]:first-of-type) { |
607 | | - margin-inline-start: $form-control-label-margin; |
608 | | - margin-inline-end: 0; |
609 | | -} |
610 | | - |
611 | 503 | /** |
612 | 504 | * The input password toggle component should be hidden when the input is readonly/disabled |
613 | 505 | * because it is not possible to edit a password. |
|
0 commit comments