// Toggle 2 // ============================================= // Variables; // -------------------- @toggle-border-width: 2px; @toggle-icon-size-sm: 16px; @toggle-icon-size-md: 22px; @toggle-icon-size-lg: 28px; @toggle-font-size-base: 1em; @toggle-content-top-margin: 1em; // Base Styles; // -------------------- .vc_toggle { display: block; margin: 0 0 @vc_margin_bottom_gold 0; padding: 0; font-size: @toggle-font-size-base; &:last-of-type { margin-bottom: @vc_element_margin_bottom; } } .vc_toggle_title { cursor: pointer; display: block; margin: 0; padding: 0; position: relative; .user-select(none); font-weight: normal; > h4 { display: inline; } } .vc_toggle_icon { display: none; position: relative; vertical-align: middle; } .vc_toggle_content { display: none; margin-bottom: @vc_margin_bottom_gold; margin-top: @toggle-content-top-margin; overflow: hidden; padding: 0; } // States // ------------------ .vc_toggle { &.vc_toggle_active { > .vc_toggle_content { display: block; } } } // Themes // -------------------- // Simple .vc_toggle_simple { .vc-make-toggle-shape(); .vc-make-toggle-shape-color(@color: @black; @hover-color: @black-hover); .vc_toggle_icon { margin-left: 2px; } } // Round .vc_toggle_round { .vc-make-toggle-shape(@border-width: @toggle-border-width, @border-radius: 50%); } // Rounded .vc_toggle_rounded { .vc-make-toggle-shape(@border-width: @toggle-border-width, @border-radius: 20%); } // Square .vc_toggle_square { .vc-make-toggle-shape(@border-width: @toggle-border-width); } // Text Only .vc_toggle_text_only { .vc_toggle_icon { display: none; } } // Arrow .vc_toggle_arrow { .vc_toggle_icon { display: inline-block; &::before, &::after { content: ''; border-style: solid; display: block; left: 50%; position: absolute; top: 50%; .box-sizing(border-box); .wpb_transform(rotate(45deg)); } &::before { border-left: none; border-top: none; } &::after { border-right: none; border-bottom: none; .vc-toggle-hidden(); } } &.vc_toggle_active { .vc_toggle_icon { &::before { .vc-toggle-hidden(); } &::after { .vc-toggle-visible(); } } } } // add arrow style color .vc_toggle { .vc-make-toggle-arrow-style-size(@toggle-icon-size-md); .vc-make-toggle-arrow-style-color(@black; @black-hover); } // Default .vc_toggle_default { // back compatibility related to toggle FAQ @border: 1px solid #acacac; @background: #bababa; .vc_toggle_icon { background: @background; border: @border; .box-sizing(border-box); .translate(0, -50%); &::before, &::after { content: ''; display: block; left: 50%; position: absolute; top: 50%; .box-sizing(border-box); .translate(-50%, -50%); background: #bababa; } &::before { border: @border; } } &.vc_toggle_active { .vc_toggle_icon { &::before, &::after { .vc-toggle-hidden(); } } } } .vc_toggle { .vc-make-toggle-default-style-size(@toggle-icon-size-md); } // Colors // -------------------- // Blue color .vc-make-toggle-colors-set(~'blue', @blue, @white, @blue-hover); // Turquoise color .vc-make-toggle-colors-set(~'turquoise', @turquoise, @white, @turquoise-hover); // Pink color .vc-make-toggle-colors-set(~'pink', @pink, @white, @pink-hover); // Violet color .vc-make-toggle-colors-set(~'violet', @violet, @white, @violet-hover); // Peacoc color .vc-make-toggle-colors-set(~'peacoc', @peacoc, @white, @peacoc-hover); // Chino color .vc-make-toggle-colors-set(~'chino', @chino, @white, @chino-hover); // Mulled Wine color .vc-make-toggle-colors-set(~'mulled_wine', @mulled_wine, @white, @mulled_wine-hover); // Vista Blue color .vc-make-toggle-colors-set(~'vista_blue', @vista_blue, @white, @vista_blue-hover); // Black color .vc-make-toggle-colors-set(~'black', @black, @white, @black-hover); // Grey color .vc-make-toggle-colors-set(~'grey', @grey, @white, @grey-hover); // Orange color .vc-make-toggle-colors-set(~'orange', @orange, @white, @orange-hover); // Sky color .vc-make-toggle-colors-set(~'sky', @sky, @white, @sky-hover); // Green color .vc-make-toggle-colors-set(~'green', @green, @white, @green-hover); // Juicy Pink color .vc-make-toggle-colors-set(~'juicy_pink', @juicy_pink, @white, @juicy_pink-hover); // Sandy Brown color .vc-make-toggle-colors-set(~'sandy_brown', @sandy_brown, @white, @sandy_brown-hover); // Purple color .vc-make-toggle-colors-set(~'purple', @purple, @white, @purple-hover); // White color .vc-make-toggle-colors-set(~'white', @white, @black, @white-hover); // Sizes // --------------- // Smail size .vc-make-toggle-sizes-set(~'sm', @toggle-icon-size-sm); // Normal size .vc-make-toggle-sizes-set(~'md', @toggle-icon-size-md); // Large size .vc-make-toggle-sizes-set(~'lg', @toggle-icon-size-lg); // Indents // --------------- .vc-make-toggle-indents(@toggle-icon-size-md); // Make shape // =================================== .vc-make-toggle-shape(@border-width: 0; @border-radius: 0) { // Icon .vc_toggle_icon { border: @border-width solid transparent; border-radius: @border-radius; display: inline-block; &::before, &::after { content: ''; display: block; left: 50%; position: absolute; top: 50%; .box-sizing(border-box); .translate(-50%, -50%); } } &.vc_toggle_active { .vc_toggle_icon { &::after { .vc-toggle-hidden(); } } } // make default size and color .vc-make-toggle-shape-size(@toggle-icon-size-md); .vc-make-toggle-shape-color(@white; @white; @black; @black-hover); } // Make colors set // ------------------------------------- .vc-make-toggle-colors-set(@selector; @background; @color; @hover-color) { .vc_toggle_color_@{selector} { .vc-make-toggle-simple-style-color(@background; @hover-color); .vc-make-toggle-shape-color(@color, @color, @background, @hover-color); .vc-make-toggle-default-style-color(@background; @hover-color); .vc-make-toggle-arrow-style-color(@background; @hover-color); } } // Make sizes set // ------------------------------------- .vc-make-toggle-sizes-set(@selector; @size) { .vc_toggle_size_@{selector} { .vc-make-toggle-shape-size(@size); .vc-make-toggle-default-style-size(@size); .vc-make-toggle-arrow-style-size(@size); .vc-make-toggle-indents(@size); } } // Make indents // ------------------------------------- .vc-make-toggle-indents(@indent) { &.vc_toggle_simple, &.vc_toggle_round, &.vc_toggle_rounded, &.vc_toggle_square, &.vc_toggle_default { .vc_toggle_title, .vc_toggle_content { padding-left: @indent * 1.5; .vc_toggle_icon { position: absolute; left: 0; top: 50%; .translate(0, -50%); } } } &.vc_toggle_default { .vc_toggle_title, .vc_toggle_content { padding-left: @indent * 1.1; } } &.vc_toggle_arrow { .vc_toggle_icon { margin-left: @indent / 2; } } } // Make color // ------------------------------------- .vc-make-toggle-shape-color(@color: @black; @hover-color: false; @background: transparent; @hover-background: transparent;) { // normal .vc_toggle_icon { background-color: @background; border-color: transparent; &::before, &::after { background-color: @color; } } // inverted color &.vc_toggle_color_inverted { .vc_toggle_icon { background-color: transparent; border-color: @background; &::before, &::after { background-color: @background; } } } // hover & when not (@hover-color = false) { // hover normal .vc_toggle_title { &:hover { .vc_toggle_icon { background-color: @hover-background; &::before, &::after { background-color: @hover-color; } } } } // hover inverted &.vc_toggle_color_inverted { .vc_toggle_title { &:hover { .vc_toggle_icon { background-color: transparent; border-color: @hover-background; &::before, &::after { background-color: @hover-background; } } } } } } } // Make Default style color // ------------------------------------- .vc-make-toggle-default-style-color(@background: @grey; @hover-color: false) { &.vc_toggle_default { .vc_toggle_icon { background: @background; border-color: darken(@background, 10%); &::before { border-color: darken(@background, 10%); background: @background; } &::after { background: @background; } } // hover & when not (@hover-color = false) { .vc_toggle_title { &:hover { .vc_toggle_icon { background: @hover-color; border-color: darken(@hover-color, 10%); &::before { border-color: darken(@hover-color, 10%); background: @hover-color; } &::after { background: @hover-color; } } } } } } } // Make Arrow style color // ------------------------------------- .vc-make-toggle-arrow-style-color(@background: @black, @hover-color: false) { &.vc_toggle_arrow { .vc_toggle_icon { background: transparent; &::before, &::after { border-color: @background; background: transparent; } } // hover & when not (@hover-color = false) { .vc_toggle_title { &:hover { .vc_toggle_icon { background: transparent; &::before, &::after { border-color: @hover-color; background: transparent; } } } } } } } // Make simple style color // ------------------------------------- .vc-make-toggle-simple-style-color(@plus-color; @plus-hover) { &.vc_toggle_simple { .vc-make-toggle-shape-color(@color: @plus-color; @hover-color: @plus-hover); } } // Make sizes // =================================== .vc-make-toggle-shape-size(@icon-size; @plus-size: floor(@icon-size * 0.5)) { @mod: mod(@plus-size, 2); .vc_toggle_icon { height: @icon-size; width: @icon-size; &::before { height: 2px; width: @plus-size - @mod; } &::after { height: @plus-size - @mod; width: 2px; } } } // Default style sizes .vc-make-toggle-default-style-size(@icon-size; @plus-size: floor(@icon-size * 0.5)) { @plus-computed-size: max(@plus-size - mod(@plus-size, 2), 8px); @plus-width-max: 4px; @plus-width-min: 2px; &.vc_toggle_default { .vc_toggle_icon { display: inline-block; width: @plus-computed-size; margin-left: @plus-computed-size / 2; & when (@plus-size >= 10) { height: @plus-width-max; } & when (@plus-size < 10) { height: @plus-width-min; } &::before { height: @plus-computed-size; & when (@plus-size >= 10) { width: @plus-width-max; } & when (@plus-size < 10) { width: @plus-width-min; } } &::after { width: @plus-computed-size - 2px; & when (@plus-size >= 10) { height: @plus-width-max - 2px; } & when (@plus-size < 10) { height: @plus-width-min - 2px; } } } } } // Arrow style sizes .vc-make-toggle-arrow-style-size(@icon-size; @plus-size: floor(@icon-size * 0.5)) { @mod: mod(@plus-size, 2); &.vc_toggle_arrow { .vc_toggle_icon { height: @icon-size; width: @icon-size; &::before, &::after { border-width: 2px; height: @plus-size - @mod; margin-left: -(@plus-size - @mod) / 2; width: @plus-size - @mod; } &::before { margin-top: -(@plus-size - @mod); } &::after { margin-top: -(@plus-size - @mod) / 2; } } } } // Mixins // ================================== // Hide element .vc-toggle-hidden() { visibility: hidden; } // Show element .vc-toggle-visible() { visibility: visible; } // // Forms // -------------------------------------------------- // Normalize non-controls // // Restyle and baseline non-control form elements. fieldset { padding: 0; margin: 0; border: 0; // Chrome and Firefox set a `min-width: -webkit-min-content;` on fieldsets, // so we reset that to ensure it behaves more like a standard block element. // See https://github.com/twbs/bootstrap/issues/12359. min-width: 0; } legend { display: block; width: 100%; padding: 0; margin-bottom: @line-height-computed; font-size: (@font-size-base * 1.5); line-height: inherit; color: @legend-color; border: 0; border-bottom: 1px solid @legend-border-color; } label { display: inline-block; max-width: 100%; // Force IE8 to wrap long content (see https://github.com/twbs/bootstrap/issues/13141) margin-bottom: 5px; font-weight: bold; } // Normalize form controls // // While most of our form styles require extra classes, some basic normalization // is required to ensure optimum display with or without those classes to better // address browser inconsistencies. // Override content-box in Normalize (* isn't specific enough) input[type="search"] { .box-sizing(border-box); } // Position radios and checkboxes better input[type="radio"], input[type="checkbox"] { margin: 4px 0 0; margin-top: 1px \9; // IE8-9 line-height: normal; } // Set the height of file controls to match text inputs input[type="file"] { display: block; } // Make range inputs behave like textual form controls input[type="range"] { display: block; width: 100%; } // Make multiple select elements height not fixed select[multiple], select[size] { height: auto; } // Focus for file, radio, and checkbox input[type="file"]:focus, input[type="radio"]:focus, input[type="checkbox"]:focus { .tab-focus(); } // Adjust output element output { display: block; padding-top: (@padding-base-vertical + 1); font-size: @font-size-base; line-height: @line-height-base; color: @input-color; } // Common form controls // // Shared size and type resets for form controls. Apply `.form-control` to any // of the following form controls: // // select // textarea // input[type="text"] // input[type="password"] // input[type="datetime"] // input[type="datetime-local"] // input[type="date"] // input[type="month"] // input[type="time"] // input[type="week"] // input[type="number"] // input[type="email"] // input[type="url"] // input[type="search"] // input[type="tel"] // input[type="color"] .form-control { display: block; width: 100%; height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border) padding: @padding-base-vertical @padding-base-horizontal; font-size: @font-size-base; line-height: @line-height-base; color: @input-color; background-color: @input-bg; background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214 border: 1px solid @input-border; border-radius: @input-border-radius; .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); .transition(~"border-color ease-in-out .15s, box-shadow ease-in-out .15s"); // Customize the `:focus` state to imitate native WebKit styles. .form-control-focus(); // Placeholder .placeholder(); // Disabled and read-only inputs // // HTML5 says that controls under a fieldset > legend:first-child won't be // disabled if the fieldset is disabled. Due to implementation difficulty, we // don't honor that edge case; we style them as disabled anyway. &[disabled], &[readonly], fieldset[disabled] & { cursor: not-allowed; background-color: @input-bg-disabled; opacity: 1; // iOS fix for unreadable disabled content } // Reset height for `textarea`s textarea& { height: auto; } } // Search inputs in iOS // // This overrides the extra rounded corners on search inputs in iOS so that our // `.form-control` class can properly style them. Note that this cannot simply // be added to `.form-control` as it's not specific enough. For details, see // https://github.com/twbs/bootstrap/issues/11586. input[type="search"] { -webkit-appearance: none; } // Special styles for iOS date input // // In Mobile Safari, date inputs require a pixel line-height that matches the // given height of the input. Since this fucks up everything else, we have to // appropriately reset it for Internet Explorer and the size variations. input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] { line-height: @input-height-base; // IE8+ misaligns the text within date inputs, so we reset line-height: @line-height-base ~"\0"; &.input-sm { line-height: @input-height-small; } &.input-lg { line-height: @input-height-large; } } // Form groups // // Designed to help with the organization and spacing of vertical forms. For // horizontal forms, use the predefined grid classes. .form-group { margin-bottom: 15px; } // Checkboxes and radios // // Indent the labels to position radios/checkboxes as hanging controls. .radio, .checkbox { display: block; min-height: @line-height-computed; // clear the floating input if there is no label text margin-top: 10px; margin-bottom: 10px; label { padding-left: 20px; margin-bottom: 0; font-weight: normal; cursor: pointer; } } .radio input[type="radio"], .radio-inline input[type="radio"], .checkbox input[type="checkbox"], .checkbox-inline input[type="checkbox"] { float: left; margin-left: -20px; } .radio + .radio, .checkbox + .checkbox { margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing } // Radios and checkboxes on same line .radio-inline, .checkbox-inline { display: inline-block; padding-left: 20px; margin-bottom: 0; vertical-align: middle; font-weight: normal; cursor: pointer; } .radio-inline + .radio-inline, .checkbox-inline + .checkbox-inline { margin-top: 0; margin-left: 10px; // space out consecutive inline controls } // Apply same disabled cursor tweak as for inputs // // Note: Neither radios nor checkboxes can be readonly. input[type="radio"], input[type="checkbox"], .radio, .radio-inline, .checkbox, .checkbox-inline { &[disabled], fieldset[disabled] & { cursor: not-allowed; } } // Form control sizing // // Build on `.form-control` with modifier classes to decrease or increase the // height and font-size of form controls. .input-sm { .input-size(@input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small); } .input-lg { .input-size(@input-height-large; @padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large); } // Form control feedback states // // Apply contextual and semantic states to individual form controls. .has-feedback { // Enable absolute positioning position: relative; // Ensure icons don't overlap text .form-control { padding-right: (@input-height-base * 1.25); } } // Feedback icon (requires .glyphicon classes) .form-control-feedback { position: absolute; top: (@line-height-computed + 5); // Height of the `label` and its margin right: 0; z-index: 2; // Ensure icon is above input groups display: block; width: @input-height-base; height: @input-height-base; line-height: @input-height-base; text-align: center; } .input-lg + .form-control-feedback { width: @input-height-large; height: @input-height-large; line-height: @input-height-large; } .input-sm + .form-control-feedback { width: @input-height-small; height: @input-height-small; line-height: @input-height-small; } // Feedback states .has-success { .form-control-validation(@state-success-text; @state-success-text; @state-success-bg); } .has-warning { .form-control-validation(@state-warning-text; @state-warning-text; @state-warning-bg); } .has-error { .form-control-validation(@state-danger-text; @state-danger-text; @state-danger-bg); } // Reposition feedback icon if label is hidden with "screenreader only" state .has-feedback label.sr-only ~ .form-control-feedback { top: 0; } // Static form control text // // Apply class to a `p` element to make any string of text align with labels in // a horizontal form layout. .form-control-static { margin-bottom: 0; // Remove default margin from `p` } // Help text // // Apply to any element you wish to create light text for placement immediately // below a form control. Use for general help, formatting, or instructional text. .help-block { display: block; // account for any element using help-block margin-top: 5px; margin-bottom: 10px; color: lighten(@text-color, 25%); // lighten the text some for contrast } // Inline forms // // Make forms appear inline(-block) by adding the `.form-inline` class. Inline // forms begin stacked on extra small (mobile) devices and then go inline when // viewports reach <768px. // // Requires wrapping inputs and labels with `.form-group` for proper display of // default HTML form controls and our custom form controls (e.g., input groups). // // Heads up! This is mixin-ed into `.navbar-form` in navbars.less. .form-inline { // Kick in the inline @media (min-width: @screen-sm-min) { // Inline-block all the things for "inline" .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle; } // In navbar-form, allow folks to *not* use `.form-group` .form-control { display: inline-block; width: auto; // Prevent labels from stacking above inputs in `.form-group` vertical-align: middle; } .input-group { display: inline-table; vertical-align: middle; .input-group-addon, .input-group-btn, .form-control { width: auto; } } // Input groups need that 100% width though .input-group > .form-control { width: 100%; } .control-label { margin-bottom: 0; vertical-align: middle; } // Remove default margin on radios/checkboxes that were used for stacking, and // then undo the floating of radios and checkboxes to match (which also avoids // a bug in WebKit: https://github.com/twbs/bootstrap/issues/1969). .radio, .checkbox { display: inline-block; margin-top: 0; margin-bottom: 0; padding-left: 0; vertical-align: middle; } .radio input[type="radio"], .checkbox input[type="checkbox"] { float: none; margin-left: 0; } // Validation states // // Reposition the icon because it's now within a grid column and columns have // `position: relative;` on them. Also accounts for the grid gutter padding. .has-feedback .form-control-feedback { top: 0; } } } // Horizontal forms // // Horizontal forms are built on grid classes and allow you to create forms with // labels on the left and inputs on the right. .form-horizontal { // Consistent vertical alignment of radios and checkboxes // // Labels also get some reset styles, but that is scoped to a media query below. .radio, .checkbox, .radio-inline, .checkbox-inline { margin-top: 0; margin-bottom: 0; padding-top: (@padding-base-vertical + 1); // Default padding plus a border } // Account for padding we're adding to ensure the alignment and of help text // and other content below items .radio, .checkbox { min-height: (@line-height-computed + (@padding-base-vertical + 1)); } // Make form groups behave like rows .form-group { .make-row(); } .form-control-static { padding-top: (@padding-base-vertical + 1); padding-bottom: (@padding-base-vertical + 1); } // Reset spacing and right align labels, but scope to media queries so that // labels on narrow viewports stack the same as a default form example. @media (min-width: @screen-sm-min) { .control-label { text-align: right; margin-bottom: 0; padding-top: (@padding-base-vertical + 1); // Default padding plus a border } } // Validation states // // Reposition the icon because it's now within a grid column and columns have // `position: relative;` on them. Also accounts for the grid gutter padding. .has-feedback .form-control-feedback { top: 0; right: (@grid-gutter-width / 2); } }