label.ios.scss 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. @import "../../themes/ionic.globals.ios";
  2. // iOS Label
  3. // --------------------------------------------------
  4. /// @prop - Text color of the label by an input, select, or datetime
  5. $label-ios-text-color: null !default;
  6. /// @prop - Text color of the stacked/floating label when it is focused
  7. $label-ios-text-color-focused: null !default;
  8. // deprecated
  9. $label-ios-margin: null !default;
  10. /// @prop - Margin top of the label
  11. $label-ios-margin-top: $item-ios-padding-top !default;
  12. /// @prop - Margin end of the label
  13. $label-ios-margin-end: ($item-ios-padding-end / 2) !default;
  14. /// @prop - Margin bottom of the label
  15. $label-ios-margin-bottom: $item-ios-padding-bottom !default;
  16. /// @prop - Margin start of the label
  17. $label-ios-margin-start: 0 !default;
  18. // iOS Default Label
  19. // --------------------------------------------------
  20. .label-ios {
  21. @include deprecated-variable(margin, $label-ios-margin) {
  22. @include margin($label-ios-margin-top, $label-ios-margin-end, $label-ios-margin-bottom, $label-ios-margin-start);
  23. }
  24. }
  25. // iOS Default Label Inside An Input/Select Item
  26. // --------------------------------------------------
  27. .item-input .label-ios,
  28. .item-select .label-ios,
  29. .item-datetime .label-ios {
  30. color: $label-ios-text-color;
  31. }
  32. // iOS Input By Label
  33. // --------------------------------------------------
  34. .label-ios + ion-input .text-input,
  35. .label-ios + ion-textarea .text-input,
  36. .label-ios + .input + .cloned-input {
  37. @include margin-horizontal($item-ios-padding-start, null);
  38. width: calc(100% - (#{$item-ios-padding-end} / 2) - #{$item-ios-padding-start});
  39. }
  40. // iOS Stacked & Floating Labels
  41. // --------------------------------------------------
  42. .label-ios[stacked] {
  43. @include margin(null, null, 4px, null);
  44. font-size: 1.2rem;
  45. }
  46. .label-ios[floating] {
  47. @include margin(null, null, 0, null);
  48. @include transform(translate3d(0, 27px, 0));
  49. @include transform-origin(start, top);
  50. transition: transform 150ms ease-in-out;
  51. }
  52. // TODO remove all uses of input-has-focus in v4
  53. // TODO remove all uses of input-has-value in v4
  54. .item-input-has-focus .label-ios[floating],
  55. .input-has-focus .label-ios[floating],
  56. .item-input-has-value .label-ios[floating],
  57. .input-has-value .label-ios[floating] {
  58. @include transform(translate3d(0, 0, 0), scale(.8));
  59. }
  60. .item-ios.item-label-stacked [item-right], // deprecated
  61. .item-ios.item-label-floating [item-right], // deprecated
  62. .item-ios.item-label-stacked [item-end],
  63. .item-ios.item-label-floating [item-end] {
  64. @include margin($item-ios-padding-media-top - 2, null, $item-ios-padding-media-bottom - 2, null);
  65. }
  66. .item-input-has-focus .label-ios[stacked],
  67. .input-has-focus .label-ios[stacked],
  68. .item-input-has-focus .label-ios[floating],
  69. .input-has-focus .label-ios[floating] {
  70. color: $label-ios-text-color-focused;
  71. }
  72. // Generate iOS Label colors
  73. // --------------------------------------------------
  74. @each $color-name, $color-base, $color-contrast in get-colors($colors-ios) {
  75. .label-ios-#{$color-name},
  76. .item-input .label-ios-#{$color-name},
  77. .item-select .label-ios-#{$color-name},
  78. .item-datetime .label-ios-#{$color-name} {
  79. color: $color-base;
  80. }
  81. }