@import "/imports/ui/stylesheets/variables/breakpoints"; @import "/imports/ui/stylesheets/mixins/_scrollable"; @import "/imports/ui/stylesheets/mixins/_indicators"; @import "/imports/ui/stylesheets/variables/placeholders"; :root { --dropdown-bg: var(--color-white); --dropdown-color: var(--color-text); --caret-shadow-color: var(--color-gray); --dropdown-caret-width: 12px; --dropdown-caret-height: 8px; --rtl-caret-offset: -0.4375rem; --rtl-content-offset: 10.75rem; } .dropdown { position: relative; &:focus { outline: none; } } .content { @extend %highContrastOutline; outline-style: solid; z-index: 9999; position: absolute; background: var(--dropdown-bg); border-radius: var(--border-radius); box-shadow: 0 6px 12px rgba(0, 0, 0, .175); border: 0; padding: calc(var(--line-height-computed) / 2); [dir="rtl"] & { right: var(--rtl-content-offset); } &:after, &:before { content: ''; position: absolute; width: 0; height: 0; } &[aria-expanded="false"] { display: none; } &[aria-expanded="true"] { display: block; } @include mq($small-only) { z-index: 1015; border-radius: 0; background-color: #fff; box-shadow: none; position: fixed; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important; border: 0 !important; padding: 0 !important; margin: 0 0 calc(var(--line-height-computed) * 5.25) 0 !important; transform: translateX(0) translateY(0) !important; &:after, &:before { display: none !important; } } } .scrollable { @include mq($small-only) { @include scrollbox-vertical(); position: absolute; top: 0; left: 0; right: 0; bottom: 0; } } .trigger { } .close { display: none; position: fixed; bottom: 0.8rem; border-radius: 0; z-index: 1011; font-size: calc(var(--font-size-large) * 1.1); width: calc(100% - (var(--line-height-computed) * 2)); left: var(--line-height-computed); box-shadow: 0 0 0 2rem var(--color-white) !important; border: var(--color-white) !important; @include mq($small-only) { display: block; } } /* Placements * ========== */ %down-caret { bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: calc(var(--dropdown-caret-height) * 1.25); &:before, &:after { border-left: var(--dropdown-caret-width) solid transparent; border-right: var(--dropdown-caret-width) solid transparent; border-top: var(--dropdown-caret-height) solid var(--dropdown-bg); bottom: 0; margin-bottom: calc(var(--dropdown-caret-height) * -1); } &:before { border-top: var(--dropdown-caret-height) solid var(--caret-shadow-color); } } %up-caret { top: 100%; left: 50%; transform: translateX(-50%); margin-top: calc(var(--dropdown-caret-height) * 1.25); &:before, &:after { border-left: var(--dropdown-caret-width) solid transparent; border-right: var(--dropdown-caret-width) solid transparent; border-bottom: var(--dropdown-caret-height) solid var(--dropdown-bg); margin-top: calc(var(--dropdown-caret-height) * -1); top: 0; [dir="rtl"] & { right: 50%; transform: translateX(-150%); } } &:before { border-bottom: var(--dropdown-caret-height) solid var(--caret-shadow-color); } } %right-caret { top: 50%; transform: translateX(-100%) translateY(-50%); left: calc(var(--dropdown-caret-height) * -1.25); &:before, &:after { border-top: var(--dropdown-caret-width) solid transparent; border-bottom: var(--dropdown-caret-width) solid transparent; border-left: var(--dropdown-caret-height) solid var(--dropdown-bg); margin-right: calc(var(--dropdown-caret-height) * -1); top: 50%; right: 0; [dir="rtl"] & { left: 0; border-left: 0; border-right: var(--dropdown-caret-height) solid var(--dropdown-bg); margin-left: calc(var(--dropdown-caret-height) * -1); } } &:before { border-left: var(--dropdown-caret-height) solid var(--caret-shadow-color); border-right: 0; [dir="rtl"] & { transform: rotate(180deg); border-left: 0; border-right: var(--dropdown-caret-height) solid var(--caret-shadow-color); } } } %left-caret { top: 50%; transform: translateX(100%) translateY(-50%); right: calc(var(--dropdown-caret-height) * -1.25); &:before, &:after { border-top: var(--dropdown-caret-width) solid transparent; border-bottom: var(--dropdown-caret-width) solid transparent; border-right: var(--dropdown-caret-height) solid var(--dropdown-bg); margin-left: calc(var(--dropdown-caret-height) * -1); top: 50%; left: 0; [dir="rtl"] & { transform: rotate(180deg); margin-right: calc(var(--dropdown-caret-height) * -1); right: 1px; } } &:before { border-right: var(--dropdown-caret-height) solid var(--caret-shadow-color); border-left: 0; [dir="rtl"] & { right: var(--rtl-caret-offset); border: none; margin: 0; } } } %horz-center-caret { &:after, &:before { left: 50%; margin-left: calc(var(--dropdown-caret-width) * -1); [dir="rtl"] & { margin-right: calc(var(--dropdown-caret-width) * -1); } } } %horz-left-caret { transform: translateX(-100%); left: 100%; [dir="rtl"] & { right: 100%; } &:after, &:before { right: calc(var(--dropdown-caret-width) / 2); } } %horz-right-caret { transform: translateX(100%); right: 100%; left: auto; &:after, &:before { left: var(--dropdown-caret-width); } } %vert-center-caret { &:after, &:before { margin-top: calc(var(--dropdown-caret-width) * -1); } } %vert-top-caret { top: 0; &:after, &:before { top: 0; margin-top: calc(var(--dropdown-caret-width) / 2); } } %vert-bottom-caret { top: auto; bottom: 0; &:after, &:before { top: auto; bottom: calc(var(--dropdown-caret-width) / 2); [dir="rtl"] & { top: calc(var(--dropdown-caret-width) / 2); bottom: auto; } } } .top { @extend %down-caret; @extend %horz-center-caret; } .top-left, [dir="rtl"] .top-right { @extend %down-caret; @extend %horz-right-caret; min-width: 11.5rem; @include mq($small-only) { width: auto; } } .top-right { @extend %down-caret; @extend %horz-left-caret; } [dir="rtl"] .top-left { @extend %down-caret; @extend %horz-left-caret; transform: translateX(25%); } .bottom { @extend %up-caret; @extend %horz-center-caret; } .bottom-left, [dir="rtl"] .bottom-right { @extend %up-caret; @extend %horz-right-caret; } .bottom-right, [dir="rtl"] .bottom-left { @extend %up-caret; @extend %horz-left-caret; min-width: 10rem; @include mq($small-only) { width: auto; } } .left, [dir="rtl"] .right { @extend %right-caret; @extend %vert-center-caret; } .left-top, [dir="rtl"] .right-top { @extend %right-caret; @extend %vert-top-caret; transform: translateX(-100%) translateY(0); } .left-bottom { @extend %right-caret; @extend %vert-bottom-caret; transform: translateX(-100%) translateY(0); } [dir="rtl"] .right-bottom { @extend %right-caret; @extend %vert-bottom-caret; transform: translateX(-110%) translateY(0); } .right, [dir="rtl"] .left { @extend %left-caret; @extend %vert-center-caret; } .right-top { @extend %left-caret; @extend %vert-top-caret; transform: translateX(100%) translateY(0); } [dir="rtl"] .right-top { transform: translateX(-25%) translateY(0%); } [dir="rtl"] .left-top { @extend %left-caret; @extend %vert-top-caret; transform: translateX(125%) translateY(-25%); } .right-bottom, [dir="rtl"] .left-bottom { @extend %left-caret; @extend %vert-bottom-caret; transform: translateX(100%) translateY(0); }