input.scss 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. @import "../../themes/ionic.globals";
  2. // Input
  3. // --------------------------------------------------
  4. /// @prop - Color of the input highlight when valid
  5. $text-input-highlight-color-valid: #32db64 !default;
  6. /// @prop - Color of the input highlight when invalid
  7. $text-input-highlight-color-invalid: #f53d3d !default;
  8. /// @prop - Color of the input placeholder
  9. $text-input-placeholder-color: #999 !default;
  10. // Input/Textarea Wrapper
  11. // --------------------------------------------------
  12. ion-input,
  13. ion-textarea {
  14. position: relative;
  15. display: block;
  16. flex: 1;
  17. width: 100%;
  18. }
  19. .item-input ion-input,
  20. .item-input ion-textarea {
  21. position: static;
  22. }
  23. // Textarea Within An Item
  24. // --------------------------------------------------
  25. .item.item-textarea {
  26. align-items: stretch;
  27. }
  28. // Native Text Input
  29. // --------------------------------------------------
  30. .text-input {
  31. @include placeholder($text-input-placeholder-color);
  32. @include appearance(none);
  33. @include border-radius(0);
  34. display: inline-block;
  35. flex: 1;
  36. width: 92%;
  37. width: calc(100% - 10px);
  38. border: 0;
  39. background: transparent;
  40. }
  41. textarea.text-input {
  42. display: block;
  43. }
  44. .text-input[disabled] {
  45. opacity: .4;
  46. }
  47. input.text-input:-webkit-autofill {
  48. background-color: transparent;
  49. }
  50. .platform-mobile textarea.text-input {
  51. resize: none;
  52. }
  53. // Input Cover: Unfocused
  54. // --------------------------------------------------
  55. // The input cover is the div that actually receives the
  56. // tap/click event when scroll assist is configured to true.
  57. // This make it so the native input element is not clickable.
  58. // This will only show when the scroll assist is configured
  59. // otherwise the .input-cover will not be rendered at all
  60. // The input cover is not clickable when the input is disabled
  61. .input-cover {
  62. @include position(0, null, null, 0);
  63. position: absolute;
  64. width: 100%;
  65. height: 100%;
  66. touch-action: manipulation;
  67. }
  68. .input[disabled] .input-cover {
  69. pointer-events: none;
  70. }
  71. // Input Cover: Focused
  72. // --------------------------------------------------
  73. // When the input has focus, then the input cover should be hidden
  74. // TODO remove all uses of input-has-focus in v4
  75. .item-input-has-focus .input-cover,
  76. .input-has-focus .input-cover {
  77. display: none;
  78. }
  79. .item-input-has-focus,
  80. .input-has-focus {
  81. pointer-events: none;
  82. }
  83. .item-input-has-focus input,
  84. .input-has-focus input,
  85. .item-input-has-focus textarea,
  86. .input-has-focus textarea,
  87. .item-input-has-focus a,
  88. .input-has-focus a,
  89. .item-input-has-focus button,
  90. .input-has-focus button {
  91. pointer-events: auto;
  92. }
  93. // Clear Input Icon
  94. // --------------------------------------------------
  95. .text-input-clear-icon {
  96. @include margin(0);
  97. @include padding(0);
  98. @include background-position(center);
  99. position: absolute;
  100. top: 0;
  101. display: none;
  102. height: 100%;
  103. background-repeat: no-repeat;
  104. }
  105. // TODO remove all uses of input-has-focus in v4
  106. // TODO remove all uses of input-has-value in v4
  107. .item-input-has-focus.item-input-has-value .text-input-clear-icon,
  108. .input-has-focus.input-has-value .text-input-clear-icon {
  109. display: block;
  110. }