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