_gf-form.scss 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. $gf-form-margin: 3px;
  2. $input-border: 1px solid $input-border-color;
  3. .gf-form {
  4. margin-bottom: $gf-form-margin;
  5. display: flex;
  6. flex-direction: row;
  7. align-items: center;
  8. text-align: left;
  9. position: relative;
  10. &--offset-1 {
  11. margin-left: $spacer;
  12. }
  13. &--grow {
  14. flex-grow: 1;
  15. }
  16. &--flex-end {
  17. justify-content: flex-end;
  18. }
  19. &--alt {
  20. flex-direction: column;
  21. align-items: flex-start;
  22. .gf-form-label {
  23. padding: 4px 0;
  24. }
  25. }
  26. }
  27. .gf-form--has-input-icon {
  28. position: relative;
  29. .gf-form-input-icon {
  30. position: absolute;
  31. top: 50%;
  32. margin-top: -9px;
  33. font-size: $font-size-lg;
  34. left: 10px;
  35. color: $input-color-placeholder;
  36. }
  37. > input {
  38. padding-left: 35px;
  39. &:focus + .gf-form-input-icon {
  40. color: $text-muted;
  41. }
  42. }
  43. }
  44. .gf-form-disabled {
  45. color: $text-color-weak;
  46. .gf-form-select-wrapper::after {
  47. color: $text-color-weak;
  48. }
  49. a,
  50. .gf-form-input {
  51. color: $text-color-weak;
  52. }
  53. }
  54. .gf-form-group {
  55. margin-bottom: $spacer * 2.5;
  56. }
  57. .gf-form-inline {
  58. display: flex;
  59. flex-direction: row;
  60. flex-wrap: wrap;
  61. align-content: flex-start;
  62. .gf-form + .gf-form {
  63. margin-right: $gf-form-margin;
  64. }
  65. }
  66. .gf-form-button-row {
  67. padding-top: $spacer * 1.5;
  68. a,
  69. button {
  70. margin-right: $spacer;
  71. }
  72. }
  73. .gf-form-label {
  74. padding: $input-padding-y $input-padding-x;
  75. flex-shrink: 0;
  76. font-weight: $font-weight-semi-bold;
  77. font-size: $font-size-sm;
  78. background-color: $input-label-bg;
  79. display: block;
  80. border: $input-btn-border-width solid $input-label-border-color;
  81. border-right: none;
  82. border-radius: $label-border-radius;
  83. &--grow {
  84. flex-grow: 1;
  85. min-height: 2.6rem;
  86. }
  87. &--error {
  88. color: $critical;
  89. }
  90. &:disabled {
  91. color: $text-color-weak;
  92. }
  93. }
  94. .gf-form-label + .gf-form-label {
  95. margin-right: $gf-form-margin;
  96. }
  97. .gf-form-pre {
  98. display: block;
  99. flex-grow: 1;
  100. margin: 0;
  101. margin-right: $gf-form-margin;
  102. border: $input-btn-border-width solid transparent;
  103. border-left: none;
  104. @include border-radius($label-border-radius-sm);
  105. }
  106. .gf-form-checkbox {
  107. flex-shrink: 0;
  108. padding: $input-padding-y $input-padding-x;
  109. line-height: $input-line-height;
  110. .checkbox-label {
  111. display: inline;
  112. cursor: pointer;
  113. padding: $input-padding-y 0.4rem;
  114. line-height: $input-line-height;
  115. }
  116. }
  117. .gf-form-textarea {
  118. max-width: 650px;
  119. }
  120. .gf-form-input {
  121. display: block;
  122. width: 100%;
  123. padding: $input-padding-y $input-padding-x;
  124. margin-right: $gf-form-margin;
  125. font-size: $font-size-md;
  126. line-height: $input-line-height;
  127. color: $input-color;
  128. background-color: $input-bg;
  129. background-image: none;
  130. background-clip: padding-box;
  131. border: $input-border;
  132. border-radius: $input-border-radius;
  133. @include box-shadow($input-box-shadow);
  134. white-space: nowrap;
  135. overflow: hidden;
  136. text-overflow: ellipsis;
  137. // text areas should be scrollable
  138. @at-root textarea#{&} {
  139. overflow: auto;
  140. white-space: pre-wrap;
  141. }
  142. // Unstyle the caret on `<select>`s in IE10+.
  143. &::-ms-expand {
  144. background-color: transparent;
  145. border: 0;
  146. display: none;
  147. }
  148. &.gf-input-small {
  149. padding: $input-padding-y/3 $input-padding-x/3;
  150. font-size: $font-size-xs;
  151. }
  152. // Customize the `:focus` state to imitate native WebKit styles.
  153. @include form-control-focus();
  154. // Placeholder
  155. &::placeholder {
  156. color: $input-color-placeholder;
  157. opacity: 1;
  158. }
  159. &:disabled,
  160. &[readonly] {
  161. background-color: $input-bg-disabled;
  162. // iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655.
  163. opacity: 1;
  164. }
  165. &:disabled {
  166. cursor: $cursor-disabled;
  167. }
  168. &.gf-size-auto {
  169. width: auto;
  170. }
  171. &--dropdown {
  172. padding-right: $input-padding-x*2;
  173. &::after {
  174. position: absolute;
  175. top: 36%;
  176. right: 11px;
  177. font-size: 11px;
  178. background-color: transparent;
  179. color: $text-color;
  180. font: normal normal normal $font-size-sm/1 FontAwesome;
  181. content: "\f0d7";
  182. pointer-events: none;
  183. }
  184. }
  185. &--small {
  186. padding-top: 4px;
  187. padding-bottom: 4px;
  188. font-size: $font-size-sm;
  189. }
  190. &--plaintext {
  191. white-space: unset;
  192. }
  193. }
  194. .gf-form-hint {
  195. width: 100%;
  196. }
  197. .gf-form-hint-text {
  198. display: block;
  199. text-align: right;
  200. padding-top: 0.5em;
  201. }
  202. .gf-form-select-wrapper {
  203. margin-right: $gf-form-margin;
  204. position: relative;
  205. background-color: $input-bg;
  206. .gf-form-select-icon {
  207. position: absolute;
  208. z-index: 1;
  209. left: $input-padding-x;
  210. top: 50%;
  211. margin-top: -7px;
  212. & + .gf-form-input {
  213. position: relative;
  214. z-index: 2;
  215. padding-left: $input-padding-x*3;
  216. background-color: transparent;
  217. option {
  218. // Firefox
  219. color: $black;
  220. }
  221. }
  222. }
  223. select.gf-form-input {
  224. text-indent: 0.01px;
  225. text-overflow: "";
  226. padding-right: $input-padding-x*3;
  227. appearance: none;
  228. &:-moz-focusring {
  229. outline: none;
  230. color: transparent;
  231. text-shadow: 0 0 0 $text-color;
  232. }
  233. &.ng-empty {
  234. color: $text-color-weak;
  235. }
  236. }
  237. &::after {
  238. position: absolute;
  239. top: 36%;
  240. right: 11px;
  241. background-color: transparent;
  242. color: $text-color;
  243. font: normal normal normal $font-size-sm/1 FontAwesome;
  244. content: "\f0d7";
  245. pointer-events: none;
  246. font-size: 11px;
  247. }
  248. &--has-help-icon {
  249. &::after {
  250. right: $input-padding-x*3;
  251. }
  252. }
  253. }
  254. .gf-form--v-stretch {
  255. align-items: stretch;
  256. }
  257. .gf-form-btn {
  258. padding: $input-padding-y $input-padding-x;
  259. margin-right: $gf-form-margin;
  260. line-height: $input-line-height;
  261. font-size: $font-size-sm;
  262. flex-shrink: 0;
  263. flex-grow: 0;
  264. }
  265. .natural-language-input {
  266. &input[type="number"] {
  267. font-size: $font-size-base;
  268. line-height: $input-line-height;
  269. margin: -6px -5px 0 5px;
  270. padding: $input-padding-y/2 $input-padding-x/2;
  271. }
  272. }
  273. .gf-form-dropdown-typeahead {
  274. margin-right: $gf-form-margin;
  275. position: relative;
  276. background-color: $input-bg;
  277. padding-right: $input-padding-x;
  278. border: $input-border;
  279. border-radius: $input-border-radius;
  280. &::after {
  281. position: absolute;
  282. top: 35%;
  283. right: $input-padding-x/2;
  284. background-color: transparent;
  285. color: $input-color;
  286. font: normal normal normal $font-size-sm/1 FontAwesome;
  287. content: "\f0d7";
  288. pointer-events: none;
  289. }
  290. .gf-form-input {
  291. border: none;
  292. }
  293. }
  294. .gf-form-help-icon {
  295. flex-grow: 0;
  296. padding-left: $spacer;
  297. color: $text-color-weak;
  298. &--bold {
  299. color: $text-color-emphasis;
  300. padding-left: 0;
  301. }
  302. &--right-absolute {
  303. position: absolute;
  304. right: $spacer;
  305. top: 10px;
  306. }
  307. &--right-normal {
  308. float: right;
  309. }
  310. &--header {
  311. margin-bottom: $gf-form-margin;
  312. }
  313. }
  314. select.gf-form-input ~ .gf-form-help-icon {
  315. right: 10px;
  316. }
  317. .gf-form-icon--right-absolute {
  318. position: absolute;
  319. right: $spacer;
  320. top: 10px;
  321. color: $text-muted;
  322. }