|
1 | 1 | @use "../../themes/ionic/ionic.globals.scss" as globals; |
2 | 2 | @use "./input.common"; |
3 | 3 | @forward "./input.ionic.outline.scss"; |
4 | | - |
| 4 | +@forward "./input.ionic.solid.scss"; |
5 | 5 | // Ionic Input |
6 | 6 | // -------------------------------------------------- |
7 | 7 |
|
8 | 8 | :host { |
9 | 9 | --color: #{globals.$ion-primitives-neutral-1200}; |
10 | 10 | --border-width: #{globals.$ion-border-size-025}; |
11 | | - --border-color: #{globals.$ion-primitives-neutral-500}; |
12 | 11 | --highlight-color-valid: #{globals.$ion-semantics-success-900}; |
13 | | - --highlight-color-invalid: #{globals.$ion-semantics-danger-800}; |
| 12 | + --highlight-color-invalid: #{globals.$ion-border-danger-default}; |
14 | 13 | --placeholder-color: #{globals.$ion-primitives-neutral-800}; |
15 | 14 | --placeholder-opacity: 1; |
16 | | - --background: #{globals.$ion-primitives-base-white}; |
17 | 15 |
|
18 | 16 | @include globals.typography(globals.$ion-body-md-regular); |
19 | 17 | } |
20 | 18 |
|
| 19 | +// Input Outline Container |
| 20 | +// ---------------------------------------------------------------- |
| 21 | + |
| 22 | +.input-outline { |
| 23 | + @include globals.position(0, 0, 0, 0); |
| 24 | + @include globals.border-radius(var(--border-radius)); |
| 25 | + |
| 26 | + position: absolute; |
| 27 | + |
| 28 | + width: 100%; |
| 29 | + height: 100%; |
| 30 | + |
| 31 | + pointer-events: none; |
| 32 | + |
| 33 | + border: var(--border-width) var(--border-style) var(--border-color); |
| 34 | +} |
| 35 | + |
| 36 | +// Input Label Placement: Stacked |
| 37 | +// ---------------------------------------------------------------- |
| 38 | + |
| 39 | +// This makes the label sit above the input. |
| 40 | +:host(.label-floating.input-label-placement-stacked) .label-text-wrapper { |
| 41 | + @include globals.margin(0); |
| 42 | + @include globals.padding(globals.$ion-space-100, null); |
| 43 | +} |
| 44 | + |
| 45 | +.input-wrapper { |
| 46 | + /** |
| 47 | + * For the ionic theme, the padding needs to sit on the |
| 48 | + * native wrapper instead, so that it sits within the |
| 49 | + * outline container but does not always affect the |
| 50 | + * label text. |
| 51 | + */ |
| 52 | + @include globals.padding(0); |
| 53 | + |
| 54 | + /** |
| 55 | + * Outline inputs do not have a bottom border. |
| 56 | + * Instead, they have a border that wraps the |
| 57 | + * input + label. |
| 58 | + */ |
| 59 | + border-bottom: none; |
| 60 | + |
| 61 | + /** |
| 62 | + * Do not show a background on the input wrapper as |
| 63 | + * this includes the label, instead we apply the |
| 64 | + * background to the native wrapper. |
| 65 | + */ |
| 66 | + background: transparent; |
| 67 | +} |
| 68 | + |
| 69 | +.label-text-wrapper { |
| 70 | + /** |
| 71 | + * The label should appear on top of an outline |
| 72 | + * container that overlaps it so it is always clickable. |
| 73 | + */ |
| 74 | + position: relative; |
| 75 | +} |
| 76 | + |
| 77 | +:host(.input-label-placement-stacked) .label-text-wrapper { |
| 78 | + @include globals.transform-origin(start, top); |
| 79 | + |
| 80 | + /** |
| 81 | + * Label text should not extend |
| 82 | + * beyond the bounds of the input. |
| 83 | + */ |
| 84 | + max-width: calc(100% - var(--padding-start) - var(--padding-end)); |
| 85 | +} |
| 86 | + |
| 87 | +/** |
| 88 | + * The bottom content should never have |
| 89 | + * a border with the outline style. |
| 90 | + */ |
| 91 | +.input-bottom { |
| 92 | + border-top: none; |
| 93 | +} |
| 94 | + |
| 95 | +.native-wrapper { |
| 96 | + @include globals.border-radius(inherit); |
| 97 | + @include globals.padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start)); |
| 98 | + |
| 99 | + min-height: globals.$ion-scale-1000; |
| 100 | + |
| 101 | + /** |
| 102 | + * Apply the background to the native input |
| 103 | + * wrapper to only style the input. |
| 104 | + */ |
| 105 | + background: var(--background); |
| 106 | +} |
| 107 | + |
21 | 108 | // Ionic Input Sizes |
22 | 109 | // -------------------------------------------------- |
23 | 110 |
|
| 111 | +:host(.input-size-medium) { |
| 112 | + --padding-start: #{globals.$ion-space-300}; |
| 113 | + --padding-end: #{globals.$ion-space-300}; |
| 114 | +} |
| 115 | + |
| 116 | +:host(.input-size-large) { |
| 117 | + --padding-start: #{globals.$ion-space-400}; |
| 118 | + --padding-end: #{globals.$ion-space-400}; |
| 119 | +} |
| 120 | + |
| 121 | +:host(.input-size-xlarge) { |
| 122 | + --padding-start: #{globals.$ion-space-500}; |
| 123 | + --padding-end: #{globals.$ion-space-500}; |
| 124 | +} |
| 125 | + |
24 | 126 | :host(.input-size-medium) .native-wrapper { |
25 | 127 | min-height: globals.$ion-scale-1000; |
26 | 128 | } |
|
33 | 135 | min-height: globals.$ion-scale-1400; |
34 | 136 | } |
35 | 137 |
|
| 138 | +// Input Shapes |
| 139 | +// -------------------------------------------------- |
| 140 | + |
| 141 | +:host(.input-shape-soft) { |
| 142 | + --border-radius: #{globals.$ion-soft-xl}; |
| 143 | +} |
| 144 | + |
| 145 | +:host(.input-shape-round) { |
| 146 | + --border-radius: #{globals.$ion-round-xl}; |
| 147 | +} |
| 148 | + |
| 149 | +:host(.input-shape-rectangular) { |
| 150 | + --border-radius: #{globals.$ion-rectangular-xl}; |
| 151 | +} |
| 152 | + |
36 | 153 | // Ionic Input Password Toggle Sizes |
37 | 154 | // -------------------------------------------------- |
38 | 155 |
|
39 | | -:host ion-input-password-toggle { |
| 156 | +:host(.input-size-medium) ion-input-password-toggle { |
40 | 157 | --size: #{globals.$ion-scale-1000}; |
41 | 158 | } |
42 | 159 |
|
|
50 | 167 |
|
51 | 168 | // Target area |
52 | 169 | // -------------------------------------------------- |
53 | | -:host .native-wrapper::after { |
| 170 | + |
| 171 | +.native-wrapper::after { |
54 | 172 | @include globals.position(50%, 0, null, 0); |
55 | 173 |
|
56 | 174 | position: absolute; |
|
78 | 196 | z-index: 2; |
79 | 197 | } |
80 | 198 |
|
| 199 | +// Start/End Slots |
| 200 | +// ---------------------------------------------------------------- |
| 201 | + |
| 202 | +::slotted([slot="start"]) { |
| 203 | + margin-inline-end: globals.$ion-space-200; |
| 204 | +} |
| 205 | + |
| 206 | +::slotted([slot="end"]) { |
| 207 | + margin-inline-start: globals.$ion-space-200; |
| 208 | +} |
| 209 | + |
81 | 210 | // Input Clear Button |
82 | 211 | // ---------------------------------------------------------------- |
83 | 212 |
|
|
202 | 331 | --background: #{globals.$ion-primitives-neutral-100}; |
203 | 332 | } |
204 | 333 |
|
205 | | -// Input Highlight |
206 | | -// ---------------------------------------------------------------- |
207 | | - |
208 | | -.input-highlight { |
209 | | - @include globals.position(null, null, -1px, 0); |
210 | | - |
211 | | - position: absolute; |
212 | | - |
213 | | - width: 100%; |
214 | | - height: globals.$ion-border-size-050; |
215 | | - |
216 | | - transform: scale(0); |
217 | | - |
218 | | - transition: transform globals.$ion-transition-time-200; |
219 | | - |
220 | | - background: var(--border-color); |
221 | | -} |
222 | | - |
223 | 334 | // Input Focus |
224 | 335 | // ---------------------------------------------------------------- |
225 | 336 |
|
226 | 337 | :host(.has-focus) { |
227 | 338 | --border-color: #{globals.$ion-border-focus-default}; |
| 339 | + --border-width: #{globals.$ion-border-size-050}; |
228 | 340 | } |
229 | 341 |
|
230 | 342 | :host(.has-focus) .input-highlight { |
|
0 commit comments