123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527 |
- // Forms
- .form-group {
- &:not(:last-child) {
- margin-bottom: $layout-spacing;
- }
- }
- fieldset {
- margin-bottom: $layout-spacing-lg;
- }
- legend {
- font-size: $font-size-lg;
- font-weight: 500;
- margin-bottom: $layout-spacing-lg;
- }
- // Form element: Label
- .form-label {
- display: block;
- line-height: $line-height;
- padding: $control-padding-y + $border-width 0;
- &.label-sm {
- font-size: $font-size-sm;
- padding: $control-padding-y-sm + $border-width 0;
- }
- &.label-lg {
- font-size: $font-size-lg;
- padding: $control-padding-y-lg + $border-width 0;
- }
- }
- // Form element: Input
- .form-input {
- @include control-transition();
- appearance: none;
- background: $bg-color-light;
- background-image: none;
- border: $border-width solid $border-color-dark;
- border-radius: $border-radius;
- color: $body-font-color;
- display: block;
- font-size: $font-size;
- height: $control-size;
- line-height: $line-height;
- max-width: 100%;
- outline: none;
- padding: $control-padding-y $control-padding-x;
- position: relative;
- width: 100%;
- &:focus {
- @include control-shadow();
- border-color: $primary-color;
- }
- &::placeholder {
- color: $gray-color;
- }
- // Input sizes
- &.input-sm {
- font-size: $font-size-sm;
- height: $control-size-sm;
- padding: $control-padding-y-sm $control-padding-x-sm;
- }
- &.input-lg {
- font-size: $font-size-lg;
- height: $control-size-lg;
- padding: $control-padding-y-lg $control-padding-x-lg;
- }
- &.input-inline {
- display: inline-block;
- vertical-align: middle;
- width: auto;
- }
- // Input types
- &[type="file"] {
- height: auto;
- }
- }
- // Form element: Textarea
- textarea.form-input {
- height: auto;
- }
- // Form element: Input hint
- .form-input-hint {
- color: $gray-color;
- font-size: $font-size-sm;
- margin-top: $unit-1;
- .has-success &,
- .is-success + & {
- color: $success-color;
- }
- .has-error &,
- .is-error + & {
- color: $error-color;
- }
- }
- // Form element: Select
- .form-select {
- appearance: none;
- border: $border-width solid $border-color-dark;
- border-radius: $border-radius;
- color: inherit;
- font-size: $font-size;
- height: $control-size;
- line-height: $line-height;
- outline: none;
- padding: $control-padding-y $control-padding-x;
- vertical-align: middle;
- width: 100%;
- &[size],
- &[multiple] {
- height: auto;
-
- option {
- padding: $unit-h $unit-1;
- }
- }
- &:not([multiple]):not([size]) {
- background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%204%205'%3E%3Cpath%20fill='%23667189'%20d='M2%200L0%202h4zm0%205L0%203h4z'/%3E%3C/svg%3E") no-repeat right .35rem center/.4rem .5rem;
- padding-right: $control-icon-size + $control-padding-x;
- }
- &:focus {
- @include control-shadow();
- border-color: $primary-color;
- }
- &::-ms-expand {
- display: none;
- }
- // Select sizes
- &.select-sm {
- font-size: $font-size-sm;
- height: $control-size-sm;
- padding: $control-padding-y-sm ($control-icon-size + $control-padding-x-sm) $control-padding-y-sm $control-padding-x-sm;
- }
- &.select-lg {
- font-size: $font-size-lg;
- height: $control-size-lg;
- padding: $control-padding-y-lg ($control-icon-size + $control-padding-x-lg) $control-padding-y-lg $control-padding-x-lg;
- }
- }
- // Form Icons
- .has-icon-left,
- .has-icon-right {
- position: relative;
- .form-icon {
- height: $control-icon-size;
- margin: 0 $control-padding-y;
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- width: $control-icon-size;
- z-index: $zindex-0 + 1;
- }
- }
- .has-icon-left {
- .form-icon {
- left: $border-width;
- }
- .form-input {
- padding-left: $control-icon-size + $control-padding-y * 2;
- }
- }
- .has-icon-right {
- .form-icon {
- right: $border-width;
- }
- .form-input {
- padding-right: $control-icon-size + $control-padding-y * 2;
- }
- }
- // Form element: Checkbox and Radio
- .form-checkbox,
- .form-radio,
- .form-switch {
- display: inline-block;
- line-height: $line-height;
- margin: ($control-size - $control-size-sm) / 2 0;
- min-height: 1.2rem;
- padding: (($control-size-sm - $line-height) / 2) $control-padding-x (($control-size-sm - $line-height) / 2) ($control-icon-size + $control-padding-x);
- position: relative;
- input {
- clip: rect(0, 0, 0, 0);
- height: 1px;
- margin: -1px;
- overflow: hidden;
- position: absolute;
- width: 1px;
- &:focus + .form-icon {
- @include control-shadow();
- border-color: $primary-color;
- }
- &:checked + .form-icon {
- background: $primary-color;
- border-color: $primary-color;
- }
- }
- .form-icon {
- @include control-transition();
- border: $border-width solid $border-color-dark;
- cursor: pointer;
- display: inline-block;
- position: absolute;
- }
- // Input checkbox, radio and switch sizes
- &.input-sm {
- font-size: $font-size-sm;
- margin: 0;
- }
- &.input-lg {
- font-size: $font-size-lg;
- margin: ($control-size-lg - $control-size-sm) / 2 0;
- }
- }
- .form-checkbox,
- .form-radio {
- .form-icon {
- background: $bg-color-light;
- height: $control-icon-size;
- left: 0;
- top: ($control-size-sm - $control-icon-size) / 2;
- width: $control-icon-size;
- }
- input {
- &:active + .form-icon {
- background: $bg-color-dark;
- }
- }
- }
- .form-checkbox {
- .form-icon {
- border-radius: $border-radius;
- }
- input {
- &:checked + .form-icon {
- &::before {
- background-clip: padding-box;
- border: $border-width-lg solid $light-color;
- border-left-width: 0;
- border-top-width: 0;
- content: "";
- height: 12px;
- left: 50%;
- margin-left: -4px;
- margin-top: -8px;
- position: absolute;
- top: 50%;
- transform: rotate(45deg);
- width: 8px;
- }
- }
- &:indeterminate + .form-icon {
- background: $primary-color;
- border-color: $primary-color;
- &::before {
- background: $bg-color-light;
- content: "";
- height: 2px;
- left: 50%;
- margin-left: -5px;
- margin-top: -1px;
- position: absolute;
- top: 50%;
- width: 10px;
- }
- }
- }
- }
- .form-radio {
- .form-icon {
- border-radius: 50%;
- }
- input {
- &:checked + .form-icon {
- &::before {
- background: $bg-color-light;
- border-radius: 50%;
- content: "";
- height: 4px;
- left: 50%;
- position: absolute;
- top: 50%;
- transform: translate(-50%, -50%);
- width: 4px;
- }
- }
- }
- }
- // Form element: Switch
- .form-switch {
- padding-left: ($unit-8 + $control-padding-x);
- .form-icon {
- background: $gray-color-light;
- background-clip: padding-box;
- border-radius: $unit-2 + $border-width;
- height: $unit-4 + $border-width * 2;
- left: 0;
- top: ($control-size-sm - $unit-4) / 2 - $border-width;
- width: $unit-8;
- &::before {
- @include control-transition();
- background: $bg-color-light;
- border-radius: 50%;
- content: "";
- display: block;
- height: $unit-4;
- left: 0;
- position: absolute;
- top: 0;
- width: $unit-4;
- }
- }
- input {
- &:checked + .form-icon {
- &::before {
- left: 14px;
- }
- }
- &:active + .form-icon {
- &::before {
- background: $bg-color;
- }
- }
- }
- }
- // Form element: Input groups
- .input-group {
- display: flex;
- .input-group-addon {
- background: $bg-color;
- border: $border-width solid $border-color-dark;
- border-radius: $border-radius;
- line-height: $line-height;
- padding: $control-padding-y $control-padding-x;
- white-space: nowrap;
- &.addon-sm {
- font-size: $font-size-sm;
- padding: $control-padding-y-sm $control-padding-x-sm;
- }
- &.addon-lg {
- font-size: $font-size-lg;
- padding: $control-padding-y-lg $control-padding-x-lg;
- }
- }
- .form-input,
- .form-select {
- flex: 1 1 auto;
- }
- .input-group-btn {
- z-index: $zindex-0;
- }
- .form-input,
- .form-select,
- .input-group-addon,
- .input-group-btn {
- &:first-child:not(:last-child) {
- border-bottom-right-radius: 0;
- border-top-right-radius: 0;
- }
- &:not(:first-child):not(:last-child) {
- border-radius: 0;
- margin-left: -$border-width;
- }
- &:last-child:not(:first-child) {
- border-bottom-left-radius: 0;
- border-top-left-radius: 0;
- margin-left: -$border-width;
- }
- &:focus {
- z-index: $zindex-0 + 1;
- }
- }
- .form-select {
- width: auto;
- }
- &.input-inline {
- display: inline-flex;
- }
- }
- // Form validation states
- .form-input,
- .form-select {
- .has-success &,
- &.is-success {
- border-color: $success-color;
- &:focus {
- @include control-shadow($success-color);
- }
- }
- .has-error &,
- &.is-error {
- border-color: $error-color;
- &:focus {
- @include control-shadow($error-color);
- }
- }
- }
- .form-checkbox,
- .form-radio,
- .form-switch {
- .has-error &,
- &.is-error {
- .form-icon {
- border-color: $error-color;
- }
-
- input {
- &:checked + .form-icon {
- background: $error-color;
- border-color: $error-color;
- }
- &:focus + .form-icon {
- @include control-shadow($error-color);
- border-color: $error-color;
- }
- }
- }
- }
- // validation based on :placeholder-shown (Edge doesn't support it yet)
- .form-input {
- &:not(:placeholder-shown) {
- &:invalid {
- border-color: $error-color;
- &:focus {
- @include control-shadow($error-color);
- }
- & + .form-input-hint {
- color: $error-color;
- }
- }
- }
- }
- // Form disabled and readonly
- .form-input,
- .form-select {
- &:disabled,
- &.disabled {
- background-color: $bg-color-dark;
- cursor: not-allowed;
- opacity: .5;
- }
- }
- .form-input {
- &[readonly] {
- background-color: $bg-color;
- }
- }
- input {
- &:disabled,
- &.disabled {
- & + .form-icon {
- background: $bg-color-dark;
- cursor: not-allowed;
- opacity: .5;
- }
- }
- }
- .form-switch {
- input {
- &:disabled,
- &.disabled {
- & + .form-icon::before {
- background: $bg-color-light;
- }
- }
- }
- }
- // Form Horizontal
- .form-horizontal {
- padding: $layout-spacing 0;
- .form-group {
- display: flex;
- flex-wrap: wrap;
- }
- }
|