|
1 | 1 | @use "../../themes/ionic/ionic.globals.scss" as globals; |
2 | 2 | @use "./input.common"; |
3 | | -@forward "./input.ionic.outline.scss"; |
4 | | - |
| 3 | +@forward "./input.ionic.solid.scss"; |
5 | 4 | // Ionic Input |
6 | 5 | // -------------------------------------------------- |
7 | 6 |
|
8 | 7 | :host { |
9 | 8 | --color: #{globals.$ion-primitives-neutral-1200}; |
10 | 9 | --border-width: #{globals.$ion-border-size-025}; |
11 | 10 | --border-color: #{globals.$ion-primitives-neutral-500}; |
| 11 | + --border-radius: #{globals.$ion-border-radius-100}; |
12 | 12 | --highlight-color-valid: #{globals.$ion-semantics-success-900}; |
13 | | - --highlight-color-invalid: #{globals.$ion-semantics-danger-800}; |
| 13 | + --highlight-color-invalid: #{globals.$ion-border-danger-default}; |
| 14 | + --padding-start: #{globals.$ion-space-300}; |
| 15 | + --padding-end: #{globals.$ion-space-300}; |
14 | 16 | --placeholder-color: #{globals.$ion-primitives-neutral-800}; |
15 | 17 | --placeholder-opacity: 1; |
16 | 18 | --background: #{globals.$ion-primitives-base-white}; |
17 | 19 |
|
18 | 20 | @include globals.typography(globals.$ion-body-md-regular); |
19 | 21 | } |
20 | 22 |
|
| 23 | +// Input Outline Container |
| 24 | +// ---------------------------------------------------------------- |
| 25 | + |
| 26 | +.input-outline { |
| 27 | + @include globals.position(0, 0, 0, 0); |
| 28 | + @include globals.border-radius(var(--border-radius)); |
| 29 | + |
| 30 | + position: absolute; |
| 31 | + |
| 32 | + width: 100%; |
| 33 | + height: 100%; |
| 34 | + |
| 35 | + pointer-events: none; |
| 36 | + |
| 37 | + border: var(--border-width) var(--border-style) var(--border-color); |
| 38 | +} |
| 39 | + |
| 40 | +// Input Label Placement: Stacked |
| 41 | +// ---------------------------------------------------------------- |
| 42 | + |
| 43 | +// This makes the label sit above the input. |
| 44 | +:host(.label-floating.input-label-placement-stacked) .label-text-wrapper { |
| 45 | + @include globals.margin(0); |
| 46 | + @include globals.padding(globals.$ion-space-100, null); |
| 47 | +} |
| 48 | + |
| 49 | +.input-wrapper { |
| 50 | + /** |
| 51 | + * For the ionic theme, the padding needs to sit on the |
| 52 | + * native wrapper instead, so that it sits within the |
| 53 | + * outline container but does not always affect the |
| 54 | + * label text. |
| 55 | + */ |
| 56 | + @include globals.padding(0); |
| 57 | + |
| 58 | + /** |
| 59 | + * Outline inputs do not have a bottom border. |
| 60 | + * Instead, they have a border that wraps the |
| 61 | + * input + label. |
| 62 | + */ |
| 63 | + border-bottom: none; |
| 64 | + |
| 65 | + /** |
| 66 | + * Do not show a background on the input wrapper as |
| 67 | + * this includes the label, instead we apply the |
| 68 | + * background to the native wrapper. |
| 69 | + */ |
| 70 | + background: transparent; |
| 71 | +} |
| 72 | + |
| 73 | +.label-text-wrapper { |
| 74 | + /** |
| 75 | + * The label should appear on top of an outline |
| 76 | + * container that overlaps it so it is always clickable. |
| 77 | + */ |
| 78 | + position: relative; |
| 79 | +} |
| 80 | + |
| 81 | +:host(.input-label-placement-stacked) .label-text-wrapper { |
| 82 | + @include globals.transform-origin(start, top); |
| 83 | + |
| 84 | + /** |
| 85 | + * Label text should not extend |
| 86 | + * beyond the bounds of the input. |
| 87 | + */ |
| 88 | + max-width: calc(100% - var(--padding-start) - var(--padding-end)); |
| 89 | +} |
| 90 | + |
| 91 | +/** |
| 92 | + * The bottom content should never have |
| 93 | + * a border with the outline style. |
| 94 | + */ |
| 95 | +.input-bottom { |
| 96 | + border-top: none; |
| 97 | +} |
| 98 | + |
| 99 | +.native-wrapper { |
| 100 | + @include globals.border-radius(inherit); |
| 101 | + @include globals.padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start)); |
| 102 | + |
| 103 | + min-height: globals.$ion-scale-1000; |
| 104 | + |
| 105 | + /** |
| 106 | + * Apply the background to the native input |
| 107 | + * wrapper to only style the input. |
| 108 | + */ |
| 109 | + background: var(--background); |
| 110 | +} |
| 111 | + |
| 112 | + |
21 | 113 | // Ionic Input Sizes |
22 | 114 | // -------------------------------------------------- |
23 | 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-border-radius-200}; |
| 143 | +} |
| 144 | + |
| 145 | +:host(.input-shape-round) { |
| 146 | + --border-radius: #{globals.$ion-border-radius-400}; |
| 147 | +} |
| 148 | + |
| 149 | +:host(.input-shape-rectangular) { |
| 150 | + --border-radius: #{globals.$ion-border-radius-0}; |
| 151 | +} |
| 152 | + |
36 | 153 | // Ionic Input Password Toggle Sizes |
37 | 154 | // -------------------------------------------------- |
38 | 155 |
|
|
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 |
|
|
225 | 354 |
|
226 | 355 | :host(.has-focus) { |
227 | 356 | --border-color: #{globals.$ion-border-focus-default}; |
| 357 | + --border-width: #{globals.$ion-border-size-050}; |
228 | 358 | } |
229 | 359 |
|
230 | 360 | :host(.has-focus) .input-highlight { |
|
0 commit comments