_forms.scss 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. //
  2. // Labels
  3. //
  4. label {
  5. color: $headings-color;
  6. font-size: $small-font-size;
  7. }
  8. // placeholder specific scss
  9. .form-control {
  10. &::placeholder {
  11. transition: all 0.2s ease;
  12. }
  13. &:focus {
  14. &::placeholder {
  15. transform: translate(5px);
  16. transition: all 0.2s ease;
  17. }
  18. &:valid,
  19. &.is-valid {
  20. box-shadow: $input-focus-box-shadow;
  21. }
  22. }
  23. }
  24. .form-control-plaintext {
  25. &:focus {
  26. outline: none;
  27. }
  28. }
  29. .custom-file-label {
  30. line-height: 1.75;
  31. height: $custom-file-height !important;
  32. &:after {
  33. height: 2.56rem;
  34. line-height: 1.75;
  35. }
  36. }
  37. .valid-tooltip,
  38. .invalid-tooltip {
  39. top: 102%;
  40. left: 5px;
  41. }
  42. /***************
  43. * Form Group
  44. ***************/
  45. // input group !important for overriding the dark style
  46. .input-group {
  47. &:not(.bootstrap-touchspin):focus-within {
  48. box-shadow: $input-focus-box-shadow;
  49. border-radius: $input-border-radius;
  50. .form-control,
  51. .input-group-text {
  52. border-color: $primary;
  53. box-shadow: none;
  54. &.is-valid {
  55. border-color: $success;
  56. }
  57. &.is-invalid {
  58. border-color: $danger;
  59. }
  60. }
  61. }
  62. &.is-valid {
  63. .input-group-text {
  64. border-color: $success !important;
  65. }
  66. &:not(.bootstrap-touchspin):focus-within {
  67. .input-group-text {
  68. border-color: $success;
  69. }
  70. }
  71. }
  72. &.is-invalid {
  73. .input-group-text {
  74. border-color: $danger !important;
  75. }
  76. &:not(.bootstrap-touchspin):focus-within {
  77. .input-group-text {
  78. border-color: $danger;
  79. }
  80. }
  81. }
  82. &.disabled {
  83. .input-group-text {
  84. background-color: $input-disabled-bg;
  85. }
  86. }
  87. &.round {
  88. .form-control,
  89. .input-group-text,
  90. &:focus-within {
  91. @include border-radius(1.5rem);
  92. }
  93. }
  94. &.square {
  95. .form-control,
  96. .input-group-text,
  97. &:focus-within {
  98. @include border-radius(0);
  99. }
  100. }
  101. &.round,
  102. &.square {
  103. .input-group-prepend {
  104. .input-group-text {
  105. border-top-right-radius: 0;
  106. border-bottom-right-radius: 0;
  107. }
  108. }
  109. .input-group-append {
  110. .input-group-text {
  111. border-top-left-radius: 0;
  112. border-bottom-left-radius: 0;
  113. }
  114. }
  115. .form-control {
  116. &:not(:first-child) {
  117. border-top-left-radius: 0;
  118. border-bottom-left-radius: 0;
  119. }
  120. &:not(:last-child) {
  121. border-top-right-radius: 0;
  122. border-bottom-right-radius: 0;
  123. }
  124. }
  125. }
  126. &.square {
  127. .form-control,
  128. .input-group-text {
  129. @include border-radius(0);
  130. }
  131. }
  132. }
  133. .input-group-text {
  134. @include transition($input-transition);
  135. }
  136. .input-group-prepend {
  137. .input-group-text {
  138. border-right: 0;
  139. }
  140. }
  141. .input-group-append {
  142. .input-group-text {
  143. border-left: 0;
  144. }
  145. &:not(:last-child) .input-group-text {
  146. border-right: 0;
  147. }
  148. }
  149. // input group merge
  150. .input-group-merge {
  151. .form-control {
  152. &:not(:first-child) {
  153. padding-left: 0;
  154. border-left: 0;
  155. }
  156. &:not(:last-child) {
  157. padding-right: 0;
  158. border-right: 0;
  159. }
  160. &.is-valid {
  161. ~ .input-group-append {
  162. .input-group-text {
  163. border-color: $success;
  164. }
  165. }
  166. }
  167. }
  168. .input-group-prepend {
  169. ~ .form-control.is-valid {
  170. .input-group-text & {
  171. border-color: $success;
  172. }
  173. }
  174. }
  175. }
  176. // Text area line height
  177. textarea {
  178. &.form-control {
  179. line-height: 1.6rem;
  180. padding: 0.8rem 1rem !important;
  181. }
  182. &.form-control-sm {
  183. padding: 0.4rem 0.857rem !important;
  184. }
  185. &.form-control-lg {
  186. padding: 1rem 1.143rem !important;
  187. }
  188. }
  189. // Used for Card - Check it and remove if not used
  190. .form-actions {
  191. border-top: 1px solid darken($body-bg, 10%);
  192. padding: 20px 0;
  193. margin-top: 20px;
  194. &.filled {
  195. background-color: $body-bg;
  196. }
  197. &.center {
  198. text-align: center;
  199. }
  200. &.right {
  201. text-align: right;
  202. }
  203. &.top {
  204. border-top: 0;
  205. border-bottom: 1px solid darken($body-bg, 10%);
  206. margin-top: 0;
  207. margin-bottom: 20px;
  208. }
  209. @include media-breakpoint-down(sm) {
  210. .buttons-group {
  211. float: left !important;
  212. margin-bottom: 10px;
  213. }
  214. }
  215. }
  216. // Form-horizontal layout
  217. .form-horizontal {
  218. .form-group {
  219. @include media-breakpoint-up(sm) {
  220. .label-control {
  221. text-align: right;
  222. }
  223. }
  224. }
  225. }
  226. // Select Inputs Specific SCSS
  227. select.form-control {
  228. &:not([multiple='multiple']) {
  229. background-image: url(str-replace(str-replace($chevron-down, 'currentColor', $input-border-color), '#', '%23'));
  230. background-position: calc(100% - 12px) 13px, calc(100% - 20px) 13px, 100% 0;
  231. background-size: 18px 14px, 18px 14px;
  232. background-repeat: no-repeat;
  233. -webkit-appearance: none;
  234. -moz-appearance: none;
  235. padding-right: 1.5rem;
  236. }
  237. &.form-control-lg {
  238. background-position: calc(100% - 12px) 16px, calc(100% - 20px) 16px, 100% 0;
  239. }
  240. &.form-control-sm {
  241. background-position: calc(100% - 12px) 8px, calc(100% - 20px) 8px, 100% 0;
  242. }
  243. }
  244. // For customs-select remove double arrow
  245. .custom-select {
  246. -moz-appearance: none; // For firefox
  247. -webkit-appearance: none; // for chrome
  248. }
  249. // Custom Checkbox
  250. .custom-checkbox {
  251. .custom-control-label::before,
  252. .custom-control-label::after {
  253. top: 0.07rem;
  254. }
  255. .custom-control-label::after {
  256. background-size: 57%;
  257. }
  258. }
  259. // Custom Radio
  260. .custom-radio {
  261. .custom-control-label::before {
  262. top: 0.1rem;
  263. }
  264. }
  265. // Custom checkbox and radio in common
  266. .custom-checkbox,
  267. .custom-radio {
  268. &.custom-control {
  269. padding-left: 1.8rem;
  270. .input-group & {
  271. padding-left: 1.3rem;
  272. }
  273. }
  274. .custom-control-input {
  275. width: 1.285rem;
  276. height: 1.285rem;
  277. }
  278. .custom-control-label {
  279. font-size: $font-size-base;
  280. position: static;
  281. // vertical-align: middle;
  282. &::before,
  283. &::after {
  284. width: 18px;
  285. height: 18px;
  286. left: 0;
  287. }
  288. }
  289. .custom-control-input:checked ~ .custom-control-label::before {
  290. box-shadow: 0 2px 4px 0 rgba($custom-control-indicator-checked-bg, 0.4) !important;
  291. }
  292. .custom-control-input:disabled ~ .custom-control-label::before {
  293. border: none;
  294. box-shadow: none !important;
  295. }
  296. .custom-control-input:focus ~ .custom-control-label::before {
  297. border-color: none;
  298. box-shadow: 0 2px 4px 0 rgba($custom-control-indicator-checked-bg, 0.4) !important;
  299. }
  300. }
  301. // Custom-checkbox when not disabled and active
  302. .custom-control-input:not(:disabled) {
  303. &:active ~ .custom-control-label {
  304. &::before {
  305. background-color: $primary;
  306. border-color: $primary;
  307. }
  308. }
  309. }
  310. /* Floating label Group */
  311. .form-label-group {
  312. position: relative;
  313. margin-bottom: $form-group-margin-bottom;
  314. // Form-Control-Large in Floating Label Group
  315. .form-control-lg {
  316. ~ label {
  317. font-size: $input-font-size;
  318. padding: 1rem;
  319. }
  320. }
  321. // Form-label
  322. > label {
  323. position: absolute;
  324. top: 0;
  325. left: 0;
  326. display: block;
  327. transition: all 0.25s ease-in-out;
  328. padding: 0.6rem;
  329. pointer-events: none;
  330. cursor: text;
  331. color: rgba($black, 0.4);
  332. font-size: 0.7rem;
  333. opacity: 0;
  334. }
  335. // form-input
  336. > input,
  337. textarea {
  338. // from-input on focus change label color
  339. &:focus,
  340. &:not(:active) {
  341. &:not(:placeholder-shown) ~ label {
  342. color: rgba($primary, 1) !important;
  343. transition: all 0.25s ease-in-out;
  344. opacity: 1;
  345. }
  346. }
  347. &:not(:focus) {
  348. &:not(:placeholder-shown) ~ label {
  349. color: rgba($black, 0.4) !important;
  350. }
  351. }
  352. // form-label after entering text in input box
  353. &:not(:placeholder-shown) ~ label {
  354. padding: 0.25rem 0;
  355. top: -20px;
  356. left: 3px;
  357. }
  358. &.form-control-lg:not(:placeholder-shown) ~ label {
  359. top: -23px;
  360. }
  361. &.form-control-sm:not(:placeholder-shown) ~ label {
  362. top: -18px;
  363. }
  364. }
  365. }
  366. /* Switches */
  367. .custom-switch {
  368. padding-left: 0;
  369. line-height: 1.7rem;
  370. .custom-control-label {
  371. padding-left: 3.5rem;
  372. line-height: 1.7rem;
  373. /* For bg color of switch*/
  374. &::before {
  375. border: none;
  376. background-color: $switch-bg-color;
  377. height: 1.7rem;
  378. box-shadow: none !important;
  379. transition: opacity 0.25s ease, background-color 0.1s ease;
  380. cursor: pointer;
  381. user-select: none;
  382. top: 0;
  383. left: 0;
  384. }
  385. /*For Switch handle*/
  386. &:after {
  387. position: absolute;
  388. top: 4px;
  389. left: 4px;
  390. box-shadow: -1px 2px 3px 0 rgba($black, 0.2);
  391. background-color: $switch-indicator-color;
  392. transition: all 0.15s ease-out;
  393. cursor: pointer;
  394. user-select: none;
  395. }
  396. /*For Switch text*/
  397. .switch-text-left,
  398. .switch-text-right,
  399. .switch-icon-left,
  400. .switch-icon-right {
  401. position: absolute;
  402. cursor: pointer;
  403. user-select: none;
  404. line-height: 1.8;
  405. i,
  406. svg {
  407. height: 13px;
  408. width: 13px;
  409. font-size: 13px;
  410. }
  411. }
  412. .switch-text-left,
  413. .switch-icon-left {
  414. left: 6px;
  415. color: $white;
  416. opacity: 0;
  417. transform: translateX(8px);
  418. transition: opacity 0.1s ease, transform 0.15s ease;
  419. }
  420. .switch-text-right,
  421. .switch-icon-right {
  422. right: 13px;
  423. opacity: 1;
  424. transform: translateX(0px);
  425. transition: opacity 0.08s ease, transform 0.15s ease;
  426. }
  427. &:focus {
  428. outline: 0;
  429. }
  430. }
  431. /*For Switch label*/
  432. .switch-label {
  433. padding-left: 1rem;
  434. }
  435. // after its checked
  436. .custom-control-input:checked ~ .custom-control-label::before {
  437. box-shadow: none;
  438. }
  439. /*For Switch Handle Animation*/
  440. .custom-control-input:checked ~ .custom-control-label::after {
  441. transform: translateX(1.4rem);
  442. }
  443. .custom-control-input:checked ~ .custom-control-label {
  444. .switch-text-left,
  445. .switch-icon-left {
  446. transform: translateX(0);
  447. opacity: 1;
  448. }
  449. .switch-text-right,
  450. .switch-icon-right {
  451. transform: translateX(-8px);
  452. opacity: 0;
  453. }
  454. }
  455. .custom-control-input:not(:checked) ~ .custom-control-label {
  456. .switch-text-left {
  457. opacity: 0;
  458. }
  459. .switch-text-right {
  460. opacity: 1;
  461. }
  462. }
  463. .custom-control-input:checked ~ .custom-control-label {
  464. .switch-text-right {
  465. opacity: 0;
  466. }
  467. .switch-text-left {
  468. opacity: 1;
  469. }
  470. }
  471. }
  472. /* Textarea with Counter */
  473. .textarea-counter-value {
  474. background-color: $primary;
  475. color: $white;
  476. padding: 1px 6px;
  477. font-size: 0.6rem;
  478. border-radius: 0 0 5px 5px;
  479. margin-right: 1rem;
  480. }
  481. // Number Input style
  482. .btn.disabled-max-min,
  483. .btn.disabled-max-min:focus,
  484. .btn.disabled-max-min:active {
  485. background-color: rgba($black, 0.5) !important;
  486. cursor: default;
  487. }
  488. // disabled number input
  489. .bootstrap-touchspin,
  490. .bootstrap-touchspin {
  491. &.disabled-touchspin {
  492. .bootstrap-touchspin-down,
  493. .bootstrap-touchspin-up {
  494. border-color: transparent !important;
  495. }
  496. }
  497. }
  498. /* Number Type Input Box Scss for - Remove arrow on hover */
  499. input[type='number']::-webkit-inner-spin-button,
  500. input[type='number']::-webkit-outer-spin-button {
  501. -webkit-appearance: none;
  502. }
  503. // IE Specific CSS
  504. @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  505. // floating Label Group
  506. .form-label-group {
  507. label {
  508. display: none;
  509. }
  510. }
  511. // Bootstrap Select
  512. select.form-control {
  513. &:not([multiple='multiple']) {
  514. background: none;
  515. }
  516. }
  517. }
  518. // Date & Time Picker - Form Control Bg color
  519. .picker__input {
  520. &.form-control {
  521. background-color: $white;
  522. }
  523. }
  524. // Autofill style
  525. input:-webkit-autofill,
  526. textarea:-webkit-autofill,
  527. select:-webkit-autofill {
  528. -webkit-box-shadow: 0 0 0 1000px $white inset !important;
  529. -webkit-text-fill-color: $body-color !important;
  530. }