UNPKG

@hbsis.uikit/react

Version:
405 lines (345 loc) 8.39 kB
import styled from 'styled-components' const selectDefaultColor = "#f4f5f8"; const selectFocusColor = "#e5edf4"; const InputGroupStyled = styled.div` .Select { position: relative; width: ${p => p.selectWidthInPx}px; height: 37px; } .Select, .Select div, .Select input, .Select span { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .Select.is-disabled > .Select-control, .Select.is-disabled > .Select-control:hover { box-shadow: inset -1px 0 0 0 #c5d0e1, inset 0 -1px 0 0 #c5d0e1, inset 1px 0 0 0 #c5d0e1, inset 0 2px 0 0 #cdd6e1; } .Select.is-disabled > .Select-control { background-color: #e5edf4; } .Select-control { border-radius: 2px; color: #333; display: table; border-spacing: 0; border-collapse: separate; height: 37px; outline: none; overflow: hidden; position: relative; width: ${p => p.selectWidthInPx}px; cursor: pointer; background-color:${selectDefaultColor}; } .Select-control .Select-input:focus { outline: none; } .is-open > .Select-control { border-bottom-right-radius: 0; border-bottom-left-radius: 0; background-color:${selectFocusColor}; border-color: #b3b3b3 #ccc #d9d9d9; } .is-open > .Select-control .Select-arrow { top: -2px; border-color: transparent transparent #999; border-width: 0 5px 5px; } .Select-placeholder, .Select--single > .Select-control .Select-value { bottom: 0; color: #aaa; left: 0; line-height: 37px; padding-left: 18px; padding-right: 10px; position: absolute; right: 0; top: 0; width: calc(100% - 10px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; color: #3b495e; } .Select--single > .Select-control .Select-value { width: calc(100% - 10px); } .Select-input { height: 37px; padding-left: 10px; padding-right: 10px; vertical-align: middle; } .Select-input > input { width: 100%; background: none transparent; border: 0 none; box-shadow: none; cursor: default; display: inline-block; font-family: inherit; font-size: inherit; margin: 0; outline: none; line-height: 16px; } .is-focused .Select-input > input { cursor: text; } .Select-control:not(.is-searchable) > .Select-input { outline: none; } .Select-loading-zone { cursor: pointer; display: table-cell; position: relative; text-align: center; vertical-align: middle; width: 16px; } .Select-loading { -webkit-animation: Select-animation-spin 400ms infinite linear; -o-animation: Select-animation-spin 400ms infinite linear; animation: Select-animation-spin 400ms infinite linear; width: 16px; height: 16px; box-sizing: border-box; border-radius: 50%; border: 2px solid #ccc; border-right-color: #333; display: inline-block; position: relative; vertical-align: middle; } .Select-clear-zone { -webkit-animation: Select-animation-fadeIn 200ms; -o-animation: Select-animation-fadeIn 200ms; animation: Select-animation-fadeIn 200ms; color: #999; cursor: pointer; display: table-cell; position: relative; text-align: center; vertical-align: middle; width: 10px; top: 2px; } .Select-clear-zone:hover { color: #D0021B; } .Select-clear { display: inline-block; font-size: 18px; } .Select-menu-outer { ${p => p.position === 'prefix' ? 'left:0;' : 'right:0;'} border-radius: 2px; box-shadow: 0 1px 2px 0 rgba(51, 60, 72, 0.3); border: solid 1px #c5d0e1; background-color: #ffffff; box-sizing: border-box; margin-top: 10px; padding-top: 10px; padding-bottom: 10px; max-height: 160px; min-width: 175px; position: absolute; top: 100%; z-index: 1; overflow: auto; font-family: ProximaNova; font-size: 14px; font-weight: normal; font-style: normal; font-stretch: normal; line-height: normal; letter-spacing: normal; text-align: left; color: #444d57; } .Select-menu { max-height: 198px; } .Select-option { box-sizing: border-box; background-color: #fff; color: #666666; cursor: pointer; display: block; white-space: normal; &.is-focused { background-color: #ebf5ff; /* Fallback color for IE 8 */ background-color: rgba(0, 126, 255, 0.08); color: #333; } } .Select-noresults { box-sizing: border-box; color: #999999; cursor: default; display: block; padding: 8px 10px; } .message { display: block; margin-top: 2px; text-align: right; font-size: 12px; font-weight: 600; &.error { color: #ec393d; } &.alert { color: #e8b007; } } .label { font-size: 12px; font-weight: 600; margin-bottom: 7px; text-transform: uppercase; color: #3b495e; margin-top: 5px; } .elementContainer{ display: flex; flex-flow: ${p => p.position === 'prefix' ? 'row' : 'row-reverse'}; transition: .25s box-shadow; >.select-component{ position:relative; background-color: #f4f5f8; ${p=>{ return (p.position=='prefix')?'border-right: solid 1px #c5d0e1;':'border-left: solid 1px #c5d0e1;' }}; &:focus{ background-color: #e5edf4; } } >.input-component{ position: relative; width: 100%; height: 37px; box-shadow: inset 0 1px 1px 0 rgba(149, 163, 183, 0.8); >input{ background-color: #ffffff; padding-left: 10px; padding-right: 10px; box-sizing: border-box; font-size: 14px; color: #3b495e; height: 100%; width: 100%; outline: 0; border: 1px; border-radius: 2px; &:disabled { background-color: #e5edf4; } } } } .option-item { height: 44px; display: flex; align-items: center; padding: 10px; width:100%; &:hover { background-color: #e5edf4; cursor: pointer; } span { font-weight: 600; font-size: 14px; color: #3b495e; } } .text-hightlight { background-color: #2870b2; color: white; } .has-value.Select--single > .Select-control .Select-value .Select-value-label, .has-value.is-pseudo-focused.Select--single > .Select-control .Select-value .Select-value-label { color: #333; } .has-value.Select--single > .Select-control .Select-value a.Select-value-label, .has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label { cursor: pointer; text-decoration: none; } .has-value.Select--single > .Select-control .Select-value a.Select-value-label:hover, .has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label:hover, .has-value.Select--single > .Select-control .Select-value a.Select-value-label:focus, .has-value.is-pseudo-focused.Select--single > .Select-control .Select-value a.Select-value-label:focus { color: #007eff; outline: none; text-decoration: underline; } .Select-arrow-zone svg { position: absolute; right: 11px; margin-top: auto; margin-bottom: auto; top: 0; bottom: 0; } .Select.is-disabled .Select-arrow-zone { cursor: default; pointer-events: none; opacity: 0.35; box-shadow: inset -1px 0 0 0 #c5d0e1, inset 0 -1px 0 0 #c5d0e1, inset 1px 0 0 0 #c5d0e1, inset 0 2px 0 0 #cdd6e1; } .Select-arrow-zone { cursor: pointer; display: table-cell; position: relative; text-align: center; vertical-align: middle; } .Select-arrow { border-color: #999 transparent transparent; border-style: solid; border-width: 5px 5px 2.5px; display: inline-block; height: 0; width: 0; position: relative; } .is-open .Select-arrow, .Select-arrow-zone:hover > .Select-arrow { border-top-color: #666; } .Select--multi .Select-multi-value-wrapper { display: inline-flex; flex-wrap: wrap; } .Select .Select-aria-only { display: inline-block; height: 1px; width: 1px; margin: -1px; clip: rect(0, 0, 0, 0); overflow: hidden; float: left; } .Select-control:hover { #carret { fill: #2870b2; } } .is-focused > .Select-control { #carret { fill: #2870b2; } } `; export default InputGroupStyled