@import "../../styles/less-css-var.less"; @import "../../styles/motion.less"; .k-select { display: inline-flex; min-width: 160px; vertical-align: middle; color: var(--kui-control-text, var(--kui-color-text)); font-size: var(--kui-font-size); position: relative; outline: none; box-sizing: border-box; align-items: center; border-radius: var(--kui-popup-radius, var(--kui-border-radius)); border: 1px solid var(--kui-control-border, var(--kui-color-border)); padding: 0 8px; transition: border var(--kui-motion-duration-slow) var(--kui-motion-easing); line-height: var(--kui-line-height); position: relative; &:not(.k-select-disabled, .k-select-borderless, .k-select-plain, .k-select-underlined):focus { outline: var(--kui-focus-ring-width) solid var(--kui-color-outline, @main-8); outline-offset: 1px; } &:not( .k-select-disabled, .k-select-fill, .k-select-borderless, .k-select-plain, .k-select-solid, .k-select-underlined ):hover { border-color: var(--kui-color-primary); box-shadow: var(--kui-component-shadow, @component-shadow); } &-selection { box-sizing: border-box; outline: 0; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: pointer; min-height: 30px; position: relative; display: inline-flex; align-items: center; width: 100%; min-width: 0; max-width: 100%; overflow: hidden; height: 100%; box-sizing: border-box; contain: layout; } .k-select-icon { font-size: var(--kui-font-size-lg); color: var(--kui-color-icon); margin-right: 5px; } &-search-wrap { position: absolute; z-index: 1; background: none; overflow: hidden; max-width: 100%; .k-select-search { border: none; width: 7px; min-width: 7px; max-width: 100%; height: 22px; padding: 0; background: none; outline: none; font-size: var(--kui-font-size); color: var(--kui-control-text, var(--kui-color-text)); } } &-labels { transition: font-size 0.25s ease-in-out; overflow: hidden; display: flex; flex-wrap: wrap; gap: 3px; margin: 3px 0; .k-select-search-wrap { display: inline-block; flex: 0 1 auto; position: relative; transform: none; left: 0; top: 0; margin: 0; vertical-align: middle; } } &-search-mirror { opacity: 0; white-space: pre; pointer-events: none; position: absolute; left: 0; top: 0; z-index: 1; font-size: var(--kui-font-size-sm); } &-placeholder { font-size: var(--kui-font-size); z-index: 0; line-height: var(--kui-line-height); overflow: hidden; text-overflow: ellipsis; color: var(--kui-color-text-placeholder); white-space: nowrap; max-width: 100%; box-sizing: border-box; transition: font-size 0.25s ease-in-out; line-height: 1; } &-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: none; background: transparent; box-sizing: border-box; width: 100%; line-height: var(--kui-line-height); cursor: pointer; font-size: var(--kui-font-size); transition: font-size 0.25s ease-in-out; } &-arrow { display: inline-flex; flex: none; align-items: center; line-height: 1; font-size: var(--kui-font-size); box-sizing: border-box; transform: rotate(0deg); transform-origin: center; transition: transform var(--kui-motion-duration-slow) var(--kui-motion-easing); transition: font-size 0.25s ease-in-out; color: var(--kui-color-icon); margin-left: 8px; #chevron-up { transform: rotate(180deg); } } .k-select-suffix { position: relative; display: flex; flex: 0 0 auto; align-items: center; line-height: 1; } &-clearable { position: absolute; top: 50%; right: 0; display: inline-flex; align-items: center; line-height: 1; transform: translateY(-50%); font-size: var(--kui-font-size); color: var(--kui-color-icon); opacity: 0; pointer-events: none; cursor: pointer; &:hover { color: var(--kui-color-icon-hover); } &:active { color: var(--kui-color-icon-active); } } .k-select-search-mirror, .k-select-search { font-size: var(--kui-font-size); color: var(--kui-control-text, var(--kui-color-text)); } &.k-select-circle { border-radius: var(--kui-shape-circle); } &.k-select-square { border-radius: var(--kui-shape-square); } } .k-select-show-tags { padding-inline: var(--kui-padding-tag-box-inline); .k-select-icon { margin-left: var(--kui-padding-tag-box-inline); } } .k-select-show-search { .k-select-placeholder { position: absolute; } } .k-select-multiple { .k-select-placeholder { position: absolute; } } // `fill` has no border to light up: the base `:hover` names this tier inside its `:not()`, so no rule // reaches the box with a border under the pointer and a `fill:hover` arm would suppress nothing - it // would only eat the edge an app set through `--kui-theme-fill-border`. Focus is the interaction this // tier keeps: the base focus ring does not name `fill`. Neither state is restated here as a descendant // of the tier either - the tier class sits on the same element as `k-select`, and the panel a focused // box opens is `k-select-dropdown`, a sibling in the popup host. .k-select-fill { .kui-theme-value(fill); transition: none; } // `plain` says it once, on the tier. Restating it in a `:hover` / `:focus` / `.k-select-opened` arm is // forbidden across this family: the base border repaint and the base focus ring both name `plain` inside // their `:not()`, so a restatement presses on nothing, and it ties at `(0,3,0)` with the error edge // `form` draws on `.k-select` - which this file wins on source order because `components.less` imports // `select` after `form`, putting a flat tier above the indication that a field is invalid. The inner box // is different - `base.less` gives every element `border: 0 solid`, whose colour is `currentColor`, so // flattening it is a live suppression even while the width is `0`. .k-select-plain:not(.k-select-disabled) { .kui-theme-value(plain); .k-select-selection { border-color: transparent; background-color: transparent; } } // `outline` and `dashed` are the same box with a token-driven border, so they take the shared // declarations and keep the base interaction rules - their border is meant to light up to primary // on hover and the focus ring stays. .k-select-outline { .kui-theme-value(outline); } .k-select-dashed { .kui-theme-value(dashed); } // A dashed box must not hand its dashes to the chips inside it: a multiple select renders its values // as `Tag`s that inherit the box's tier (`components/utils/selection-tags`), and `theme="dashed"` // would put a dashed edge around every selected value — a chip is not a drop zone. Written as // `.k-select.k-select-dashed .k-tag` (0,3,0) on purpose: `tag/styles/index.less` is imported after // this file, so a bare descendant rule ties with `.k-tag.k-tag-dashed` (0,2,0) and loses on order. .k-select.k-select-dashed .k-tag { border-style: solid; } // `solid` is the emphasis surface: primary fill and inverted text. It // repaints its own surface on hover the way Button does instead of borrowing the base border // repaint, which is why both it and `underlined` are excluded from the base `:hover` rule. .k-select-solid:not(.k-select-disabled) { .kui-theme-value(solid); &:hover, &.k-select-opened { border-color: var(--kui-color-primary-hover, @main-1); background-color: var(--kui-color-primary-hover, @main-1); } // The base focus ring is primary-on-primary here, i.e. invisible. Keep the same ring and draw it // in the inverted text colour instead of dropping the affordance. &:focus, &.k-select-opened { outline-color: var(--kui-theme-solid-outline); } .k-select-placeholder { color: var(--kui-theme-solid-placeholder); } .k-select-arrow, .k-select-icon, .k-select-clearable { color: var(--kui-theme-solid-muted); } // Same reason as the dashed pin above: the chips inside a solid box are `Tag`s that carry // `k-tag-solid`, and primary chips on a primary box read as nothing at all. They take the surface // `input-tag` already gives its chips on a solid box — translucent inverted white, no border of the // tier's own, close icon included. (0,3,0) here, so it outranks `.k-tag.k-tag-solid` in both files. .k-tag { color: var(--kui-color-text-on-solid); border-color: transparent; background-color: var(--kui-theme-solid-chip); .k-tag-close { color: inherit; } } } // `underlined`: the bottom edge is the whole affordance - flat, no ring, no glow. Same contract as // `.k-input-otp-underlined`, so hover and focus both light that one edge and nothing else. .k-select-underlined:not(.k-select-disabled) { .kui-theme-value(underlined); outline: none; &:hover, &.k-select-opened { border-color: transparent transparent var(--kui-color-primary); outline: none; } } .k-select-block { width: 100%; } .k-select-dropdown { -webkit-user-select: none; user-select: none; border-radius: var(--kui-control-radius, var(--kui-shape-round, var(--kui-border-radius))); width: auto; max-height: 200px; overflow: auto; background-color: var(--kui-popup-bg, var(--kui-color-bg-pop)); border: 1px solid var(--kui-popup-border, var(--kui-color-pop-border)); box-sizing: border-box; box-shadow: var(--kui-popup-shadow, var(--kui-pop-shadow)); position: absolute; z-index: 1003; padding: 5px; box-sizing: border-box; ul { padding: 0; margin: 0; list-style: none; left: 0; } .k-select-loading { padding: 10px; font-size: var(--kui-font-size); color: var(--kui-control-text, var(--kui-color-text)); display: flex; align-items: center; .k-icon { font-size: var(--kui-font-size); } span { margin-left: 8px; } } .k-select-item { margin: 0; line-height: 1; padding: 8px 8px; clear: both; color: var(--kui-control-text, var(--kui-color-text)); font-size: var(--kui-font-size); white-space: nowrap; list-style: none; width: 100%; box-sizing: border-box; overflow: hidden; text-overflow: ellipsis; cursor: pointer; position: relative; border-radius: var(--kui-control-radius, var(--kui-shape-round, var(--kui-border-radius))); margin-bottom: 1px; &:not(.k-select-item-disabled, .k-select-item-selected):hover { background: var(--kui-color-item-hover); } &:not(.k-select-item-disabled, .k-select-item-selected):active { background: var(--kui-color-item-active); } .k-icon { position: absolute; right: 9px; font-size: 15px; top: 50%; transform: translateY(-50%); display: none; color: var(--kui-color-icon); } &:hover .k-icon, .k-icon { display: block; } } .k-select-item-active { background: var(--kui-color-item-hover); } .k-select-item-selected { background: var(--kui-color-item-selected, @main-8); font-weight: 500; .k-icon { color: var(--kui-color-primary); display: block; } } .k-select-item-disabled { background: var(--kui-color-item-disabled); color: var(--kui-color-text-disabled); cursor: not-allowed; } } .k-select-dropdown-virtual { overflow: hidden; .k-virtual-list-item > .k-select-item { height: calc(100% - 1px); } } .k-select-dropdown-multiple { .k-select-item { padding-right: 31px; } } .k-select-dropdown-sm { .k-select-item { font-size: var(--kui-font-size-sm); } } .k-select-dropdown-lg { .k-select-item { font-size: var(--kui-font-size-lg); } } .k-select-sm { padding: 0 var(--kui-padding-inline-sm); .k-select-icon { font-size: var(--kui-font-size); margin-right: 3px; } .k-select-selection { min-height: calc(var(--kui-control-height-sm) - 2px); } &.k-select-show-tags { padding-inline: var(--kui-padding-tag-box-inline-sm); .k-select-icon { margin-left: var(--kui-padding-tag-box-inline-sm); } } .k-select-arrow { font-size: var(--kui-font-size-sm); margin-left: 4px; } .k-select-clearable { right: 0; font-size: var(--kui-font-size-sm); } .k-select-label { line-height: calc(var(--kui-control-height-sm) - 2px); height: calc(var(--kui-control-height-sm) - 2px); font-size: var(--kui-font-size-sm); } .k-select-placeholder { font-size: var(--kui-font-size-sm); } .k-select-search-wrap { .k-select-search { height: 12px; font-size: var(--kui-font-size-sm); } } .k-select-labels { gap: 2px; margin: 2px 0; .k-select-search-wrap { padding: 2px 0; .k-select-search { font-size: var(--kui-font-size-sm); height: 12px; line-height: 12px; left: 0; float: left; } } } .k-select-search-mirror, .k-select-search { font-size: var(--kui-font-size-sm); color: var(--kui-control-text, var(--kui-color-text)); } } .k-select-lg { .k-select-placeholder { font-size: var(--kui-font-size-lg); } .k-select-selection { font-size: var(--kui-font-size-lg); min-height: calc(var(--kui-control-height-lg) - 2px); } &.k-select-show-tags { padding-inline: var(--kui-padding-tag-box-inline-lg); .k-select-icon { margin-left: var(--kui-padding-tag-box-inline-lg); } } .k-select-icon { font-size: 18px; } .k-select-arrow { font-size: 18px; } .k-select-clearable { font-size: 18px; } .k-select-label { line-height: calc(var(--kui-control-height-lg) - 2px); height: calc(var(--kui-control-height-lg) - 2px); font-size: var(--kui-font-size-lg); } .k-select-search-wrap { .k-select-search { height: 28px; } } .k-select-labels { margin-block: 5px; gap: 5px; .k-select-search-wrap { .k-select-search { height: 28px; line-height: 28px; left: 0; float: left; font-size: var(--kui-font-size-lg); } } } } .k-select-opened { // border-color: var(--kui-color-primary); outline: var(--kui-focus-ring-width) solid var(--kui-color-outline, @main-8); outline-offset: 1px; .k-select-label { opacity: 0.5; } &.k-select-fill .k-select-selection { border-color: transparent; } } .k-select-show-search:focus-within .k-select-label { opacity: 0.5; } .k-select-disabled { cursor: not-allowed; color: var(--kui-color-text-disabled); background: var(--kui-control-bg-disabled, var(--kui-color-bg-component-disabled)); .k-select-label { cursor: not-allowed; } * { cursor: not-allowed; } .k-select-arrow { color: var(--kui-color-border-disabled); } .k-tag { color: var(--kui-color-text-disabled); } } .k-select-has-clear { &:hover { .k-select-clearable { opacity: 1; pointer-events: auto; } .k-select-arrow { opacity: 0; } } } .k-select-clearable:focus-visible { opacity: 1; pointer-events: auto; } @media (hover: none) { .k-select-has-clear { .k-select-clearable { opacity: 1; pointer-events: auto; } .k-select-arrow { opacity: 0; } } } .k-select-borderless { border-color: transparent; background-color: transparent; &:hover, &:focus { border-color: transparent; } .k-select-selection { border-color: transparent; background-color: transparent; } } .k-select-enter-active { transform-origin: 0 0; animation: k-motion-scale-y-in 0.3s; } .k-select-leave-active { transform-origin: 0 0; animation: k-motion-scale-y-in 0.3s reverse; }