123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. @import "../../themes/ionic.globals.ios";
  2. // iOS Input
  3. // --------------------------------------------------
  4. /// @prop - Background color of the input
  5. $text-input-ios-background-color: $list-ios-background-color !default;
  6. /// @prop - Margin top of the input
  7. $text-input-ios-margin-top: $item-ios-padding-top !default;
  8. // deprecated
  9. $text-input-ios-margin-right: ($item-ios-padding-end / 2) !default;
  10. /// @prop - Margin end of the input
  11. $text-input-ios-margin-end: $text-input-ios-margin-right !default;
  12. /// @prop - Margin bottom of the input
  13. $text-input-ios-margin-bottom: $item-ios-padding-bottom !default;
  14. // deprecated
  15. $text-input-ios-margin-left: 0 !default;
  16. /// @prop - Margin start of the input
  17. $text-input-ios-margin-start: $text-input-ios-margin-left !default;
  18. /// @prop - Width of the icon used to clear the input
  19. $text-input-ios-input-clear-icon-width: 30px !default;
  20. /// @prop - Color of the icon used to clear the input
  21. $text-input-ios-input-clear-icon-color: rgba(0, 0, 0, .5) !default;
  22. /// @prop - Icon used to clear the input
  23. $text-input-ios-input-clear-icon-svg: "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path fill='" + $text-input-ios-input-clear-icon-color + "' d='M403.1,108.9c-81.2-81.2-212.9-81.2-294.2,0s-81.2,212.9,0,294.2c81.2,81.2,212.9,81.2,294.2,0S484.3,190.1,403.1,108.9z M352,340.2L340.2,352l-84.4-84.2l-84,83.8L160,339.8l84-83.8l-84-83.8l11.8-11.8l84,83.8l84.4-84.2l11.8,11.8L267.6,256L352,340.2z'/></svg>" !default;
  24. /// @prop - Size of the icon used to clear the input
  25. $text-input-ios-input-clear-icon-size: 18px !default;
  26. /// @prop - Show the focus highlight when the input has focus
  27. $text-input-ios-show-focus-highlight: false !default;
  28. /// @prop - Show the valid highlight when it is valid and has a value
  29. $text-input-ios-show-valid-highlight: $text-input-ios-show-focus-highlight !default;
  30. /// @prop - Show the invalid highlight when it is invalid and has value
  31. $text-input-ios-show-invalid-highlight: $text-input-ios-show-focus-highlight !default;
  32. /// @prop - Color of the input highlight
  33. $text-input-ios-highlight-color: color($colors-ios, primary) !default;
  34. /// @prop - Color of the input highlight when valid
  35. $text-input-ios-highlight-color-valid: $text-input-highlight-color-valid !default;
  36. /// @prop - Color of the input highlight when invalid
  37. $text-input-ios-highlight-color-invalid: $text-input-highlight-color-invalid !default;
  38. // iOS Default Input
  39. // --------------------------------------------------
  40. .text-input-ios {
  41. @include margin($text-input-ios-margin-top, $text-input-ios-margin-end, $text-input-ios-margin-bottom, $text-input-ios-margin-start);
  42. @include padding(0);
  43. width: calc(100% - #{($text-input-ios-margin-end + $text-input-ios-margin-start)});
  44. }
  45. // iOS Inset Input
  46. // --------------------------------------------------
  47. .input-ios .inset-input {
  48. @include padding(($item-ios-padding-top / 2), ($item-ios-padding-end / 2), ($item-ios-padding-bottom / 2), ($item-ios-padding-start / 2));
  49. @include margin(($item-ios-padding-top / 2), $item-ios-padding-end, ($item-ios-padding-bottom / 2), 0);
  50. }
  51. // iOS Highlighted Input
  52. // --------------------------------------------------
  53. // Input highlight mixin for focus, valid, and invalid states
  54. @mixin ios-input-highlight($highlight-color) {
  55. border-bottom-color: $highlight-color;
  56. }
  57. // Show the focus highlight when the input has focus
  58. @if ($text-input-ios-show-focus-highlight) {
  59. // In order to get a 2px border we need to add an inset
  60. // box-shadow 1px (this is to avoid the div resizing)
  61. // TODO remove all uses of input-has-focus in v4
  62. // TODO remove all uses of input-has-value in v4
  63. .item-ios.item-input.item-input-has-focus .item-inner,
  64. .item-ios.item-input.input-has-focus .item-inner {
  65. @include ios-input-highlight($text-input-ios-highlight-color);
  66. }
  67. // The last item in a list has a border on the item, not the
  68. // inner item, so add it to the item itself
  69. .list-ios .item-input.item-input-has-focus:last-child,
  70. .list-ios .item-input.input-has-focus:last-child {
  71. @include ios-input-highlight($text-input-ios-highlight-color);
  72. .item-inner {
  73. box-shadow: none;
  74. }
  75. }
  76. }
  77. // Show the valid highlight when it has the .ng-valid class and a value
  78. @if ($text-input-ios-show-valid-highlight) {
  79. .item-ios.item-input.ng-valid.item-input-has-value:not(.input-has-focus):not(.item-input-has-focus) .item-inner,
  80. .item-ios.item-input.ng-valid.input-has-value:not(.input-has-focus):not(.item-input-has-focus) .item-inner {
  81. @include ios-input-highlight($text-input-ios-highlight-color-valid);
  82. }
  83. .list-ios .item-input.ng-valid.item-input-has-value:not(.input-has-focus):not(.item-input-has-focus):last-child,
  84. .list-ios .item-input.ng-valid.input-has-value:not(.input-has-focus):not(.item-input-has-focus):last-child {
  85. @include ios-input-highlight($text-input-ios-highlight-color-valid);
  86. .item-inner {
  87. box-shadow: none;
  88. }
  89. }
  90. }
  91. // Show the invalid highlight when it has the invalid class and has been touched
  92. @if ($text-input-ios-show-invalid-highlight) {
  93. .item-ios.item-input.ng-invalid.ng-touched:not(.input-has-focus):not(.item-input-has-focus) .item-inner {
  94. @include ios-input-highlight($text-input-ios-highlight-color-invalid);
  95. }
  96. .list-ios .item-input.ng-invalid.ng-touched:not(.input-has-focus):not(.item-input-has-focus):last-child {
  97. @include ios-input-highlight($text-input-ios-highlight-color-invalid);
  98. .item-inner {
  99. box-shadow: none;
  100. }
  101. }
  102. }
  103. // iOS Stacked & Floating Inputs
  104. // --------------------------------------------------
  105. .item-ios.item-label-stacked .text-input,
  106. .item-ios.item-label-floating .text-input {
  107. @include margin(8px, null, 8px, 0);
  108. width: calc(100% - #{$text-input-ios-margin-end});
  109. }
  110. .item-ios.item-label-stacked .label-ios + .input + .cloned-input,
  111. .item-ios.item-label-floating .label-ios + .input + .cloned-input {
  112. @include margin-horizontal(0, null);
  113. }
  114. .item-label-stacked .select-ios,
  115. .item-label-floating .select-ios {
  116. @include padding(8px, null, 8px, 0);
  117. }
  118. // iOS Clear Input Icon
  119. // --------------------------------------------------
  120. .input-ios[clearInput] {
  121. position: relative;
  122. }
  123. .input-ios[clearInput] .text-input {
  124. @include padding-horizontal(null, $text-input-ios-input-clear-icon-width);
  125. }
  126. .input-ios .text-input-clear-icon {
  127. @include position-horizontal(null, ($item-ios-padding-end / 2));
  128. @include svg-background-image($text-input-ios-input-clear-icon-svg);
  129. width: $text-input-ios-input-clear-icon-width;
  130. background-size: $text-input-ios-input-clear-icon-size;
  131. }