Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ember-power-select Boostrap4.beta1
// Variables
// Backgrounds
$ember-power-select-background-color: #ffffff !default;
$ember-power-select-disabled-background-color: #eeeeee !default;
$ember-power-select-multiple-selection-background-color: $gray-200 !default;
$ember-power-select-highlighted-background: $blue !default;
$ember-power-select-selected-background: $gray-200 !default;
// Texts
$ember-power-select-text-color: #212529 !default;
$ember-power-select-placeholder-color: #999999 !default;
$ember-power-select-highlighted-color: #fff !default;
$ember-power-select-disabled-option-color: #999999 !default;
$ember-power-select-multiple-selection-color: #333333 !default;
// Borders
$ember-power-select-multiple-option-border-color: $ember-power-select-multiple-selection-background-color !default;
$ember-power-select-border-color: rgba(0,0,0,.15) !default;
$ember-power-select-focus-border-color: #80bdff !default;
$ember-power-select-active-border-color: $ember-power-select-focus-border-color !default;
$ember-power-select-default-border: 1px solid $ember-power-select-border-color !default;
$ember-power-select-default-focus-border: 1px solid $ember-power-select-focus-border-color !default;
$ember-power-select-default-active-border: 1px solid $ember-power-select-active-border-color !default;
$ember-power-select-trigger-border: $ember-power-select-default-border !default;
$ember-power-select-trigger-border-top: $ember-power-select-trigger-border !default;
$ember-power-select-trigger-border-bottom: $ember-power-select-trigger-border !default;
$ember-power-select-trigger-border-right: $ember-power-select-trigger-border !default;
$ember-power-select-trigger-border-left: $ember-power-select-trigger-border !default;
$ember-power-select-active-trigger-border: $ember-power-select-default-active-border !default;
$ember-power-select-active-trigger-border-top: $ember-power-select-active-trigger-border !default;
$ember-power-select-active-trigger-border-bottom: $ember-power-select-active-trigger-border !default;
$ember-power-select-active-trigger-border-right: $ember-power-select-active-trigger-border !default;
$ember-power-select-active-trigger-border-left: $ember-power-select-active-trigger-border !default;
$ember-power-select-dropdown-border: 1px solid $ember-power-select-border-color !default;
$ember-power-select-search-field-border: $ember-power-select-default-border !default;
$ember-power-select-search-field-focus-border: $ember-power-select-default-focus-border !default;
$ember-power-select-dropdown-top-border: $ember-power-select-dropdown-border !default;
$ember-power-select-dropdown-right-border: $ember-power-select-dropdown-border !default;
$ember-power-select-dropdown-bottom-border: $ember-power-select-dropdown-border !default;
$ember-power-select-dropdown-left-border: $ember-power-select-dropdown-border !default;
$ember-power-select-dropdown-contiguous-border: $ember-power-select-dropdown-border !default;
$ember-power-select-multiple-option-border: 1px solid $ember-power-select-multiple-option-border-color !default;
// Borders radius
$ember-power-select-default-border-radius: 0.25rem !default; // General border radius
$ember-power-select-trigger-default-border-radius: $ember-power-select-default-border-radius !default;
$ember-power-select-dropdown-default-border-radius: $ember-power-select-default-border-radius !default;
$ember-power-select-opened-border-radius: 0.25rem !default; // Border radius of the side of the dropdown and the trigger where they touch
$ember-power-select-search-input-border-radius: $ember-power-select-opened-border-radius !default;
$ember-power-select-multiple-option-border-radius: $ember-power-select-default-border-radius !default;
// Other
$ember-power-select-focus-box-shadow: none !default;
$ember-power-select-active-box-shadow: none !default;
$ember-power-select-dropdown-margin: 0 !default; // Margin between the dropdown and the trigger
$ember-power-select-dropdown-box-shadow: none !default;
$ember-power-select-line-height: 1.25rem !default;
$ember-power-select-trigger-icon-color: #999 !default;
$ember-power-select-clear-btn-margin: 25px !default;
$ember-power-select-option-padding: 0.25rem 1.5rem !default;
$ember-power-select-number-of-visible-options: 7 !default;
$ember-power-select-focus-outline: 0 !default;
$ember-power-select-active-outline: $ember-power-select-focus-outline !default;
$ember-power-select-trigger-ltr-padding: .375rem 1rem .375rem .75rem !default;
$ember-power-select-trigger-rtl-padding: 0 0 0 16px !default;
$ember-power-select-multiple-option-padding: 0 4px !default;
$ember-power-select-multiple-option-line-height: 1.45 !default;
// Configure ember-basic-dropdown
$ember-basic-dropdown-content-background-color: $ember-power-select-background-color;
$ember-basic-dropdown-content-z-index: 1004 !default;
$ember-basic-dropdown-overlay-background: rgba(0,0,0, 0.5) !default;
$ember-basic-dropdown-overlay-pointer-events: none !default;
//custom vars
$ember-power-select-trigger-font-size: 1rem !default;
$ember-power-select-trigger-min-height: calc(2.25rem + 2px) !default;
.ember-power-select-search-input{
border: $ember-power-select-search-field-border;
border-radius: $ember-power-select-search-input-border-radius;
width: 100%;
font-size: inherit;
line-height: inherit;
padding: 0 5px;
&:focus {
border: $ember-power-select-search-field-focus-border;
box-shadow: $ember-power-select-focus-box-shadow;
@if $ember-power-select-focus-outline {
outline: $ember-power-select-focus-outline;
}
}
}
.ember-power-select-option--no-matches-message{
margin-bottom: .5rem;
font-size: 1rem;
}
.ember-basic-dropdown {
position: relative;
}
.ember-basic-dropdown, .ember-basic-dropdown-content, .ember-basic-dropdown-content * {
box-sizing: border-box;
}
.ember-basic-dropdown-content {
position: absolute;
width: auto;
z-index: $ember-basic-dropdown-content-z-index;
background-color: $ember-basic-dropdown-content-background-color;
}
.ember-basic-dropdown-content--left { left: 0; }
.ember-basic-dropdown-content--right { right: 0; }
.ember-basic-dropdown-overlay {
position: fixed;
background: $ember-basic-dropdown-overlay-background;
width: 100%;
height: 100%;
z-index: 10;
top: 0;
left: 0;
pointer-events: $ember-basic-dropdown-overlay-pointer-events;
}
.ember-basic-dropdown-content-wormhole-origin {
display: inline;
}
.ember-power-select {
position: relative;
}
.ember-power-select *, .ember-power-select-dropdown * {
box-sizing: border-box;
}
// Trigger
.ember-power-select-trigger {
position: relative;
font-size: $ember-power-select-trigger-font-size;
border-top: $ember-power-select-trigger-border-top;
border-bottom: $ember-power-select-trigger-border-bottom;
border-right: $ember-power-select-trigger-border-right;
border-left: $ember-power-select-trigger-border-left;
border-radius: $ember-power-select-trigger-default-border-radius;
line-height: $ember-power-select-line-height;
min-height: $ember-power-select-trigger-min-height;
overflow-x: hidden;
text-overflow: ellipsis;
user-select: none;
-webkit-user-select: none;
color: $ember-power-select-text-color;
/* Minimum clearfix for modern browsers */
&:after {
content:"";
display:table;
clear:both;
}
display: block;
width: 100%;
background-color: $ember-power-select-background-color;
background-image: none;
background-clip: padding-box;
transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}
.ember-power-select-trigger:focus,
.ember-power-select-trigger--active {
border-top: $ember-power-select-active-trigger-border-top;
border-bottom: $ember-power-select-active-trigger-border-bottom;
border-right: $ember-power-select-active-trigger-border-right;
border-left: $ember-power-select-active-trigger-border-left;
}
.ember-power-select-trigger:focus{
@if $ember-power-select-focus-outline {
outline: $ember-power-select-focus-outline;
}
box-shadow: $ember-power-select-focus-box-shadow;
}
.ember-power-select-trigger--active {
@if $ember-power-select-active-outline {
outline: $ember-power-select-active-outline;
}
box-shadow: $ember-power-select-active-box-shadow;
}
.ember-basic-dropdown-trigger--below.ember-power-select-trigger[aria-expanded="true"],
.ember-basic-dropdown-trigger--in-place.ember-power-select-trigger[aria-expanded="true"] {
border-bottom-left-radius: $ember-power-select-opened-border-radius;
border-bottom-right-radius: $ember-power-select-opened-border-radius;
}
.ember-basic-dropdown-trigger--above.ember-power-select-trigger[aria-expanded="true"] {
border-top-left-radius: $ember-power-select-opened-border-radius;
border-top-right-radius: $ember-power-select-opened-border-radius;
}
.ember-power-select-placeholder {
color: $ember-power-select-placeholder-color;
display: block;
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.ember-power-select-status-icon {
position: absolute;
display: inline-block;
width: 0; height: 0; top: 0; bottom: 0; margin: auto; // Vertical center trick!
border-style: solid;
border-width: 7px 4px 0 4px;
border-color: $ember-power-select-trigger-icon-color transparent transparent transparent;
.ember-basic-dropdown-trigger[aria-expanded="true"] & {
transform: rotate(180deg);
}
}
.ember-power-select-clear-btn {
position: absolute;
cursor: pointer;
}
// Multiple select
.ember-power-select-trigger-multiple-input {
@extend .form-control;
font-family: inherit;
font-size: inherit;
border: none;
display: inline-block;
line-height: inherit;
-webkit-appearance: none;
outline: none;
padding: 0;
float: left;
background-color: transparent;
text-indent: 2px;
&:disabled {
background-color: $ember-power-select-disabled-background-color;
}
/* There's a browser bug where this selectos cannot be chained with commas */
&::placeholder {
opacity: 1;
color: $ember-power-select-placeholder-color;
}
&::-webkit-input-placeholder {
opacity: 1;
color: $ember-power-select-placeholder-color;
}
&::-moz-placeholder {
opacity: 1;
color: $ember-power-select-placeholder-color;
}
&::-ms-input-placeholder {
opacity: 1;
color: $ember-power-select-placeholder-color;
}
}
.ember-power-select-multiple-options {
padding: 0; margin: 0;
}
.ember-power-select-multiple-option {
border: $ember-power-select-multiple-option-border;
border-radius: $ember-power-select-multiple-option-border-radius;
color: $ember-power-select-multiple-selection-color;
background-color: $ember-power-select-multiple-selection-background-color;
padding: $ember-power-select-multiple-option-padding;
display: inline-block;
line-height: $ember-power-select-multiple-option-line-height;
float: left;
margin: 0 3px 3px 0;
}
.ember-power-select-multiple-remove-btn {
cursor: pointer;
position: relative;
right: -.25rem;
padding: .25rem;
color: inherit;
background: 0 0;
border: 0;
float: right;
font-size: 1.25rem;
font-weight: 700;
line-height: 1;
text-shadow: 0 1px 0 #fff;
color: #000;
text-decoration: none;
opacity: .75;
&:not(:hover) { opacity: 0.5; }
}
// Search bar
.ember-power-select-search {
padding: 4px;
}
.ember-power-select-search-input {
border: $ember-power-select-search-field-border;
border-radius: $ember-power-select-search-input-border-radius;
width: 100%;
font-size: inherit;
line-height: inherit;
padding: 0 5px;
&:focus {
border: $ember-power-select-search-field-focus-border;
box-shadow: $ember-power-select-focus-box-shadow;
@if $ember-power-select-focus-outline {
outline: $ember-power-select-focus-outline;
}
}
}
// Dropdown
.ember-power-select-dropdown {
border-left: $ember-power-select-dropdown-left-border;
border-right: $ember-power-select-dropdown-right-border;
line-height: $ember-power-select-line-height;
border-radius: $ember-power-select-dropdown-default-border-radius;
box-shadow: $ember-power-select-dropdown-box-shadow;
overflow: hidden;
color: $ember-power-select-text-color;
}
.ember-power-select-dropdown.ember-basic-dropdown-content--above {
@if ($ember-power-select-dropdown-margin > 0) {
transform: translateY(-#{$ember-power-select-dropdown-margin});
}
border-top: $ember-power-select-dropdown-top-border;
border-bottom: $ember-power-select-dropdown-contiguous-border;
border-bottom-left-radius: $ember-power-select-opened-border-radius;
border-bottom-right-radius: $ember-power-select-opened-border-radius;
}
.ember-power-select-dropdown.ember-basic-dropdown-content--below, .ember-power-select-dropdown.ember-basic-dropdown-content--in-place {
@if ($ember-power-select-dropdown-margin > 0) {
transform: translateY(#{$ember-power-select-dropdown-margin});
}
border-top: $ember-power-select-dropdown-contiguous-border;
border-bottom: $ember-power-select-dropdown-bottom-border;
border-top-left-radius: $ember-power-select-opened-border-radius;
border-top-right-radius: $ember-power-select-opened-border-radius;
}
.ember-power-select-dropdown.ember-basic-dropdown-content--in-place { // Dropdown when rendered in place
width: 100%;
}
// Options
.ember-power-select-options {
list-style: none;
margin: 0;
padding: 0;
user-select: none;
-webkit-user-select: none;
&[role="listbox"] {
overflow-y: auto; /* in firefox in windows this can cause a word-break issue. Try `overflow-y: scroll` if that happens */
-webkit-overflow-scrolling: touch;
@if unitless($ember-power-select-line-height) {
max-height: #{$ember-power-select-number-of-visible-options * $ember-power-select-line-height}em;
} @else {
max-height: $ember-power-select-number-of-visible-options * $ember-power-select-line-height;
}
}
}
.ember-power-select-option {
cursor: pointer;
padding: $ember-power-select-option-padding;
}
.ember-power-select-group[aria-disabled="true"] {
color: $ember-power-select-disabled-option-color;
cursor: not-allowed;
}
.ember-power-select-group[aria-disabled="true"] .ember-power-select-option,
.ember-power-select-option[aria-disabled="true"] {
color: $ember-power-select-disabled-option-color;
pointer-events: none;
cursor: not-allowed;
}
.ember-power-select-option[aria-selected="true"] { background-color: $ember-power-select-selected-background; }
.ember-power-select-option[aria-current="true"] {
background-color: $ember-power-select-highlighted-background;
color: $ember-power-select-highlighted-color;
}
// Groups
.ember-power-select-group-name {
cursor: default;
font-weight: bold;
}
// Disabled styles
.ember-power-select-trigger[aria-disabled=true] {
background-color: $ember-power-select-disabled-background-color;
}
// LTR styles
.ember-power-select-trigger {
padding: $ember-power-select-trigger-ltr-padding;
}
.ember-power-select-selected-item, .ember-power-select-placeholder {
margin-left: 8px;
}
.ember-power-select-status-icon {
right: 5px;
}
.ember-power-select-clear-btn {
right: $ember-power-select-clear-btn-margin;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment