123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- @use 'sass:map';
- @use 'mixins/mixins' as *;
- @use 'mixins/utils' as *;
- @use 'mixins/var' as *;
- @use 'common/var' as *;
- @use './select-dropdown.scss';
- @use './option.scss';
- @use './option-group.scss';
- @mixin mixed-input-border($color) {
- box-shadow: 0 0 0 1px $color inset;
- }
- @include b(select) {
- @include set-component-css-var('select', $select);
- }
- @include b(select) {
- display: inline-block;
- position: relative;
- vertical-align: middle;
- width: getCssVar('select-width');
- @include e(wrapper) {
- display: flex;
- align-items: center;
- position: relative;
- box-sizing: border-box;
- cursor: pointer;
- text-align: left;
- font-size: map.get($input-font-size, 'default');
- padding: map.get($select-wrapper-padding, 'default');
- gap: map.get($select-item-gap, 'default');
- min-height: map.get($input-height, 'default');
- line-height: map.get($select-item-height, 'default');
- border-radius: getCssVar('border-radius-base');
- background-color: getCssVar('fill-color', 'blank');
- transition: getCssVar('transition', 'duration');
- @include mixed-input-border(#{getCssVar('border-color')});
- &:hover {
- @include mixed-input-border(#{getCssVar('text-color')});
- }
- @include when(filterable) {
- cursor: text;
- }
- @include when(focused) {
- @include mixed-input-border(#{getCssVar('color-primary')});
- }
- @include when(hovering) {
- &:not(.is-focused) {
- @include mixed-input-border(#{getCssVar('border-color-hover')});
- }
- }
- @include when(disabled) {
- cursor: not-allowed;
- background-color: getCssVar('fill-color', 'light');
- color: getCssVar('text-color', 'placeholder');
- @include mixed-input-border(#{getCssVar('select-disabled-border')});
- &:hover {
- @include mixed-input-border(#{getCssVar('select-disabled-border')});
- }
- &.is-focus {
- @include mixed-input-border(#{getCssVar('input-focus-border-color')});
- }
- @include e(caret) {
- cursor: not-allowed;
- }
- .#{$namespace}-tag {
- cursor: not-allowed;
- }
- }
- }
- @include e(prefix) {
- display: flex;
- align-items: center;
- flex-shrink: 0;
- gap: map.get($select-item-gap, 'default');
- color: var(
- #{getCssVarName('input-icon-color')},
- map.get($input, 'icon-color')
- );
- }
- @include e(suffix) {
- display: flex;
- align-items: center;
- flex-shrink: 0;
- gap: map.get($select-item-gap, 'default');
- color: var(
- #{getCssVarName('input-icon-color')},
- map.get($input, 'icon-color')
- );
- }
- @include e(caret) {
- color: getCssVar('select-input-color');
- font-size: getCssVar('select-input-font-size');
- transition: getCssVar('transition', 'duration');
- transform: rotateZ(0deg);
- cursor: pointer;
- @include when(reverse) {
- transform: rotateZ(180deg);
- }
- }
- @include e(selection) {
- position: relative;
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- flex: 1;
- min-width: 0;
- gap: map.get($select-item-gap, 'default');
- @include when(near) {
- margin-left: map.get($select-near-margin-left, 'default');
- }
- .#{$namespace}-tag {
- cursor: pointer;
- border-color: transparent;
- .#{$namespace}-tag__content {
- min-width: 0;
- }
- }
- }
- @include e(selected-item) {
- display: flex;
- flex-wrap: wrap;
- user-select: none;
- }
- @include e(tags-text) {
- display: block;
- line-height: normal;
- @include utils-ellipsis;
- }
- @include e(placeholder) {
- position: absolute;
- display: block;
- top: 50%;
- transform: translateY(-50%);
- width: 100%;
- @include utils-ellipsis;
- color: var(
- #{getCssVarName('input-text-color')},
- map.get($input, 'text-color')
- );
- @include when(transparent) {
- user-select: none;
- color: getCssVar('text-color', 'placeholder');
- }
- }
- @include e(popper) {
- @include picker-popper(
- map.get($select-dropdown, 'bg-color'),
- map.get($select-dropdown, 'border'),
- map.get($select-dropdown, 'shadow')
- );
- }
- @include e(input-wrapper) {
- max-width: 100%;
- @include when(hidden) {
- // Out of the document flow
- position: absolute;
- opacity: 0;
- }
- }
- @include e(input) {
- border: none;
- outline: none;
- padding: 0;
- color: getCssVar('select-multiple-input-color');
- font-size: inherit;
- appearance: none;
- height: map.get($select-item-height, 'default');
- max-width: 100%;
- background-color: transparent;
- @include when(disabled) {
- cursor: not-allowed;
- }
- }
- @include e(input-calculator) {
- position: absolute;
- left: 0;
- top: 0;
- max-width: 100%;
- visibility: hidden;
- white-space: nowrap;
- overflow: hidden;
- }
- @each $size in (large, small) {
- @include m($size) {
- @include e(wrapper) {
- gap: map.get($select-item-gap, $size);
- padding: map.get($select-wrapper-padding, $size);
- min-height: map.get($input-height, $size);
- line-height: map.get($select-item-height, $size);
- font-size: map.get($input-font-size, $size);
- }
- @include e(selection) {
- gap: map.get($select-item-gap, $size);
- @include when(near) {
- margin-left: map.get($select-near-margin-left, $size);
- }
- }
- @include e(prefix) {
- gap: map.get($select-item-gap, $size);
- }
- @include e(suffix) {
- gap: map.get($select-item-gap, $size);
- }
- @include e(input) {
- height: map.get($select-item-height, $size);
- }
- }
- }
- }
|