|
32 | 32 | --placeholder-font-style: initial;
|
33 | 33 | --placeholder-font-weight: initial;
|
34 | 34 | --placeholder-opacity: .5;
|
35 |
| - --padding-top: 0; |
36 |
| - --padding-end: 0; |
37 |
| - --padding-bottom: 0; |
38 |
| - --padding-start: 0; |
| 35 | + --padding-top: 0px; |
| 36 | + --padding-end: 0px; |
| 37 | + --padding-bottom: 0px; |
| 38 | + --padding-start: 0px; |
39 | 39 | --background: transparent;
|
40 | 40 | --color: initial;
|
41 | 41 | --border-style: solid;
|
42 | 42 | --highlight-color-focused: #{ion-color(primary, base)};
|
43 | 43 | --highlight-color-valid: #{ion-color(success, base)};
|
44 | 44 | --highlight-color-invalid: #{ion-color(danger, base)};
|
45 | 45 |
|
| 46 | + display: block; |
| 47 | + |
46 | 48 | position: relative;
|
47 | 49 |
|
48 | 50 | width: 100%;
|
|
65 | 67 | align-items: center;
|
66 | 68 | }
|
67 | 69 |
|
| 70 | +:host(.legacy-input) .native-input { |
| 71 | + @include padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start)); |
| 72 | +} |
| 73 | + |
68 | 74 | :host-context(ion-item:not(.item-label)) {
|
69 | 75 | --padding-start: 0;
|
70 | 76 | }
|
|
78 | 84 |
|
79 | 85 | .native-input {
|
80 | 86 | @include border-radius(var(--border-radius));
|
81 |
| - @include padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start)); |
| 87 | + @include padding(0, 0, 0, 0); |
82 | 88 | @include text-inherit();
|
83 | 89 |
|
84 | 90 | display: inline-block;
|
|
211 | 217 | // Input Wrapper
|
212 | 218 | // ----------------------------------------------------------------
|
213 | 219 | .input-wrapper {
|
| 220 | + @include padding(var(--padding-top), var(--padding-end), var(--padding-bottom), var(--padding-start)); |
| 221 | + |
214 | 222 | display: flex;
|
215 | 223 |
|
216 | 224 | flex-grow: 1;
|
217 | 225 |
|
218 |
| - align-items: center; |
| 226 | + align-items: stretch; |
| 227 | + |
| 228 | + height: 100%; |
| 229 | + |
| 230 | + background: inherit; |
219 | 231 | }
|
220 | 232 |
|
221 | 233 | // Input Bottom Content
|
|
276 | 288 |
|
277 | 289 | padding-inline-start: 16px;
|
278 | 290 | }
|
| 291 | + |
| 292 | +// Input Label |
| 293 | +// ---------------------------------------------------------------- |
| 294 | + |
| 295 | +.input-wrapper label { |
| 296 | + /** |
| 297 | + * The margin between the label and |
| 298 | + * the input should be on the end |
| 299 | + * when the label sits at the start. |
| 300 | + */ |
| 301 | + @include margin(0, 8px, 0, 0); |
| 302 | + |
| 303 | + /** |
| 304 | + * This causes the label to take up |
| 305 | + * the entire height of its container |
| 306 | + * while still keeping the text centered. |
| 307 | + */ |
| 308 | + display: flex; |
| 309 | + |
| 310 | + align-items: center; |
| 311 | + |
| 312 | + transition: color 150ms cubic-bezier(.4, 0, .2, 1), transform 150ms cubic-bezier(.4, 0, .2, 1); |
| 313 | +} |
| 314 | + |
| 315 | +.input-wrapper input { |
| 316 | + /** |
| 317 | + * When the floating label appears on top of the |
| 318 | + * input, we need to fade the input out so that the |
| 319 | + * label does not overlap with the placeholder. |
| 320 | + */ |
| 321 | + transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1); |
| 322 | +} |
| 323 | + |
| 324 | +// Input Label Placement |
| 325 | +// ---------------------------------------------------------------- |
| 326 | + |
| 327 | +/** |
| 328 | + * Label is on the left of the input in LTR and |
| 329 | + * on the right in RTL. |
| 330 | + */ |
| 331 | +:host(.input-label-placement-start) .input-wrapper { |
| 332 | + flex-direction: row; |
| 333 | +} |
| 334 | + |
| 335 | +/** |
| 336 | + * Label is on the right of the input in LTR and |
| 337 | + * on the left in RTL. |
| 338 | + */ |
| 339 | +:host(.input-label-placement-end) .input-wrapper { |
| 340 | + flex-direction: row-reverse; |
| 341 | +} |
| 342 | + |
| 343 | +/** |
| 344 | + * The margin between the label and |
| 345 | + * the input should be on the start |
| 346 | + * when the label sits at the end. |
| 347 | + */ |
| 348 | +:host(.input-label-placement-end) label { |
| 349 | + @include margin(0, 0, 0, 8px); |
| 350 | +} |
| 351 | + |
| 352 | +/** |
| 353 | + * Label is on the left of the input in LTR and |
| 354 | + * on the right in RTL. Label also has a fixed width. |
| 355 | + */ |
| 356 | +:host(.input-label-placement-fixed) label { |
| 357 | + @include margin(0, 0, 0, 0); |
| 358 | + |
| 359 | + flex: 0 0 100px; |
| 360 | + |
| 361 | + width: 100px; |
| 362 | + min-width: 100px; |
| 363 | + max-width: 200px; |
| 364 | +} |
| 365 | + |
| 366 | +/** |
| 367 | + * Stacked: Label sits above the input and is scaled down. |
| 368 | + * Floating: Label sits over the input when the input has no |
| 369 | + * value and is blurred. Label sits above the input and is scaled |
| 370 | + * down when the input is focused or has a value. |
| 371 | + * |
| 372 | + */ |
| 373 | +:host(.input-label-placement-stacked) .input-wrapper, |
| 374 | +:host(.input-label-placement-floating) .input-wrapper { |
| 375 | + flex-direction: column; |
| 376 | + align-items: start; |
| 377 | +} |
| 378 | + |
| 379 | +/** |
| 380 | + * Ensures that the label animates |
| 381 | + * up and to the left in LTR or |
| 382 | + * up and to the right in RTL. |
| 383 | + */ |
| 384 | +:host(.input-label-placement-stacked) label, |
| 385 | +:host(.input-label-placement-floating) label { |
| 386 | + @include transform-origin(start, top); |
| 387 | +} |
| 388 | + |
| 389 | +/** |
| 390 | + * Ensures the input does not |
| 391 | + * overlap the label. |
| 392 | + */ |
| 393 | +:host(.input-label-placement-stacked) input, |
| 394 | +:host(.input-label-placement-floating) input { |
| 395 | + @include margin(1px, 0, 0, 0); |
| 396 | +} |
| 397 | + |
| 398 | +/** |
| 399 | + * This makes the label sit over the input |
| 400 | + * when the input is blurred and has no value. |
| 401 | + */ |
| 402 | +:host(.input-label-placement-floating) label { |
| 403 | + @include transform(translateY(100%), scale(1)); |
| 404 | +} |
| 405 | + |
| 406 | +/** |
| 407 | + * The input should be hidden when the label |
| 408 | + * is on top of the input. This prevents the label |
| 409 | + * from overlapping any placeholder value. |
| 410 | + */ |
| 411 | +:host(.input-label-placement-floating) input { |
| 412 | + opacity: 0; |
| 413 | +} |
| 414 | + |
| 415 | +:host(.has-focus.input-label-placement-floating) input, |
| 416 | +:host(.has-value.input-label-placement-floating) input { |
| 417 | + opacity: 1; |
| 418 | +} |
| 419 | + |
| 420 | +/** |
| 421 | + * This makes the label sit above the input. |
| 422 | + */ |
| 423 | +:host(.input-label-placement-stacked) label, |
| 424 | +:host(.has-focus.input-label-placement-floating) label, |
| 425 | +:host(.has-value.input-label-placement-floating) label { |
| 426 | + @include transform(translateY(50%), scale(.75)); |
| 427 | +} |
0 commit comments