_gf-form.scss 6.8 KB

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