@use "sass:list"; @use "sass:color"; @use "styles/library" as library; $dropdown_bg: oklch(1 0 0); // FFFFFF $dropdown_border_color: oklch(0 0 0 / 20%); $dropdown_hover: oklch(0.9702 0 0); // F5F5F5 $dropdown_selected: oklch(0.9738 0.0151 54.93); // FFF4ED $dropdown_accent: oklch(0.7086 0.1896 39.86); // #FF6E37 $dropdown_height: 40px; $dropdown_border_radius: 8px; $dropdown_animation_timing: cubic-bezier(0.4, 0, 0.2, 1); $dropdown_animation_duration: 0.2s; :host { display: inline-block; position: relative; padding: 0; margin: 0; background-color: $dropdown_bg; border-radius: $dropdown_border_radius; box-shadow: 0 0 0 1px $dropdown_border_color inset; outline: none; cursor: pointer; max-width: 100%; --dropdown-duration: #{$dropdown_animation_duration}; &.reduce-motion { --dropdown-duration: 0s; } &:focus-visible { box-shadow: 0 0 0 1px $dropdown_border_color inset, 0 0 0 2px white, 0 0 0 4px $dropdown_accent; } } .dropdown-box { display: flex; align-items: center; padding: 0 10px; height: $dropdown_height; box-sizing: border-box; gap: 8px; .prefix-icon { width: 24px; height: 24px; flex-shrink: 0; user-select: none; } .placeholder { flex-grow: 1; font-size: 18px; line-height: 1.2; // descender(g, y 등)가 잘리지 않도록 행간 확보 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; } .chevron { width: 24px; height: 24px; flex-shrink: 0; transition: transform var(--dropdown-duration) $dropdown_animation_timing; user-select: none; &.open { transform: rotate(180deg); } } } .dropdown-list { position: absolute; top: calc(100% + 4px); left: 0; width: 100%; padding: 0; // 아이템이 꽉 차도록 패딩 제거 margin: 0; list-style: none; background-color: $dropdown_bg; border-radius: $dropdown_border_radius; z-index: 1000; max-height: 240px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); animation: slideIn var(--dropdown-duration) $dropdown_animation_timing; // 자식 요소의 배경색이 테두리를 침범하지 못하도록 하는 사용자님의 핵심 설계 복구 &::after { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: $dropdown_border_radius; box-shadow: 0 0 0 1px $dropdown_border_color inset; pointer-events: none; z-index: 1001; // 테두리를 최상단으로! } @keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } } } .dropdown-item { display: flex; align-items: center; height: 40px; padding: 0 16px; position: relative; line-height: 1.2; // descender 보호를 위해 1에서 1.2로 수정 transition: background-color $dropdown_animation_duration $dropdown_animation_timing; &:hover, &.focused { background-color: $dropdown_hover; } &.selected { background-color: $dropdown_selected; color: $dropdown_accent; font-weight: 600; } }