// Forms .form-group { &:not(:last-child) { margin-bottom: @layout-spacing; } } // Form element: Label .form-label { display: block; padding: 6px 0; &.label-sm { padding: 2px 0; } &.label-lg { padding: @layout-spacing 0; } } // Form element: Input .form-input { appearance: none; background: @bg-color-light; background-image: none; border: @border-width solid @border-color-dark; border-radius: @border-radius; color: @body-font-color; .control-transition(); display: block; font-size: @font-size; height: @unit-8; line-height: @line-height; max-width: 100%; outline: none; padding: 5px 8px; position: relative; width: 100%; &:focus { border-color: @primary-color; .control-shadow(); } &::placeholder { color: @gray-color; } // Input sizes &.input-sm { font-size: @font-size-sm; height: 24px; padding: 1px 8px; } &.input-lg { font-size: @font-size-lg; height: 40px; padding: 9px 8px; } &.input-inline { display: inline-block; vertical-align: middle; width: auto; } // Textarea textarea& { height: auto; } // Input types &[type="file"] { height: auto; } } // Form element: Input hint .form-input-hint { color: @gray-color; margin-top: @unit-1; .has-success &, .is-success + & { color: @control-color-success; } .has-error &, .is-error + & { color: @control-color-error; } } // Form element: Select .form-select { appearance: none; border: @border-width solid @border-color-dark; border-radius: @border-radius; color: inherit; font-size: @font-size; line-height: @line-height; outline: none; padding: 5px 8px; vertical-align: middle; width: 100%; &[multiple] { option { padding: 2px 4px; } } &:not([multiple]) { background: @bg-color-light url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23667189' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right 7.5px center / 8px 10px; height: 32px; padding-right: 24px; } &:focus { border-color: @primary-color; .control-shadow(); } &::-ms-expand { display: none; } // Select sizes &.select-sm { font-size: @font-size-sm; height: 24px; padding: 1px 20px 1px 6px; } &.select-lg { font-size: @font-size-lg; height: 40px; padding: 9px 24px 9px 8px; } } // Form validation states .form-input, .form-select { .has-success &, &.is-success { border-color: @control-color-success; &:focus { .control-shadow(@control-color-success); } } .has-error &, &.is-error { border-color: @control-color-error; &:focus { .control-shadow(@control-color-error); } } } // validation based on :placeholder-shown (Edge doesn't support it yet) .form-input { &:not(:placeholder-shown) { &:invalid { border-color: @control-color-error; &:focus { .control-shadow(@control-color-error); } & + .form-input-hint { color: @control-color-error; } } } } // Form Icons .has-icon-left, .has-icon-right { position: relative; .form-icon { margin: 0 8px; min-width: 14px; position: absolute; top: 50%; transform: translateY(-50%); } } .has-icon-left { .form-icon { left: 0; } .form-input { padding-left: 30px; } } .has-icon-right { .form-icon { right: 0; } .form-input { padding-right: 30px; } } // Form element: Checkbox and Radio .form-checkbox, .form-radio, .form-switch { display: inline-block; line-height: @line-height; position: relative; input { clip: rect(0, 0, 0, 0); height: 1px; margin: -1px; overflow: hidden; position: absolute; width: 1px; &:focus + .form-icon { border-color: @primary-color; .control-shadow(); } &:checked + .form-icon { background: @primary-color; border-color: @primary-color; } } .form-icon { border: @border-width solid @border-color-dark; .control-transition(); cursor: pointer; display: inline-block; position: absolute; } } .form-checkbox, .form-radio { padding: 2px 20px; .form-icon { background: @bg-color-light; height: 14px; left: 0; top: 5px; width: 14px; } 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: 10px; left: 50%; margin-left: -3px; margin-top: -6px; position: absolute; top: 50%; transform: rotate(45deg); width: 6px; } } &: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: 7px; } input { &:checked + .form-icon { &::before { background: @bg-color-light; border-radius: @border-radius; content: ""; height: 4px; left: 50%; margin-left: -2px; margin-top: -2px; position: absolute; top: 50%; width: 4px; } } } } // Form element: Switch .form-switch { padding: 2px 20px 2px 36px; .form-icon { background: @gray-color-light; background-clip: padding-box; border-radius: 9px; height: 18px; left: 0; top: 3px; width: 30px; &::before { background: @bg-color-light; border-radius: 8px; content: ""; display: block; height: 16px; left: 0; position: absolute; top: 0; .control-transition(); width: 16px; } } input { &:checked + .form-icon { &::before { left: 12px; } } &: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: 5px 8px; &.addon-sm { font-size: @font-size-sm; padding: 1px 8px; } &.addon-lg { font-size: @font-size-lg; padding: 9px 8px; } } .input-group-addon, .input-group-btn { flex: 1 0 auto; } .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: -1px; } &:last-child:not(:first-child) { border-bottom-left-radius: 0; border-top-left-radius: 0; margin-left: -1px; } &:focus { z-index: @zindex-0; } } .form-select { width: auto; } &.input-inline { display: inline-flex; } } // 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; .form-group { display: flex; } .form-checkbox, .form-radio, .form-switch { margin: @unit-4 0; } }