forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace gh-selectize with power-select in gh-search-input
refs TryGhost#6458
- Loading branch information
1 parent
da73579
commit ea65747
Showing
10 changed files
with
291 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Ember from 'ember'; | ||
|
||
const {run, isBlank, Component} = Ember; | ||
|
||
export default Component.extend({ | ||
open() { | ||
this.get('select.actions').open(); | ||
}, | ||
|
||
close() { | ||
this.get('select.actions').close(); | ||
}, | ||
|
||
actions: { | ||
captureMouseDown(e) { | ||
e.stopPropagation(); | ||
}, | ||
|
||
search(term) { | ||
if (isBlank(term) === this.get('select.isOpen')) { | ||
run.scheduleOnce('afterRender', this, isBlank(term) ? this.close : this.open); | ||
} | ||
|
||
this.get('select.actions.search')(term); | ||
}, | ||
|
||
focusInput() { | ||
this.$('input')[0].focus(); | ||
}, | ||
|
||
resetInput() { | ||
this.$('input').val(''); | ||
}, | ||
|
||
handleKeydown(e) { | ||
let select = this.get('select'); | ||
if (!select.isOpen) { | ||
e.stopPropagation(); | ||
} | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Ember from 'ember'; | ||
|
||
export function highlightedText([text, termToHighlight]) { | ||
return Ember.String.htmlSafe(text.replace(new RegExp(termToHighlight, 'ig'), '<span class="highlight">$&</span>')); | ||
} | ||
|
||
export default Ember.Helper.helper(highlightedText); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
.ember-power-select-trigger { | ||
border: 1px solid #dfe1e3; | ||
border-radius: var(--border-radius); | ||
color: #666; | ||
} | ||
|
||
.ember-basic-dropdown--opened > .ember-power-select-trigger, | ||
.ember-power-select-trigger[aria-expanded="true"], | ||
.ember-power-select-search input { | ||
outline: 0; | ||
border-color: #b1b1b1; | ||
} | ||
|
||
.ember-power-select-dropdown { | ||
position: absolute; | ||
z-index: 1000; | ||
box-sizing: border-box; | ||
margin: -1px 0 0 0; | ||
border: 1px solid #b1b1b1; | ||
border-top: 0 none; | ||
background: #fff; | ||
border-radius: 0 0 var(--border-radius) var(--border-radius); | ||
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.ember-power-select-options:not([role="group"]) { | ||
max-height: 200px; | ||
} | ||
|
||
.ember-power-select-search input { | ||
display: inline-block !important; | ||
margin: 0 1px !important; | ||
padding: 0 !important; | ||
min-height: 0 !important; | ||
max-width: 100% !important; | ||
max-height: none !important; | ||
border: 0 none !important; | ||
background: none !important; | ||
box-shadow: none !important; | ||
text-indent: 0 !important; | ||
font-size: 1.3rem; | ||
line-height: inherit !important; | ||
} | ||
|
||
.ember-power-select-group { | ||
float: left; | ||
box-sizing: border-box; | ||
width: 100%; | ||
border-top: 0 none; | ||
border-right: 1px solid #f2f2f2; | ||
} | ||
|
||
.ember-power-select-group .ember-power-select-group-name { | ||
position: relative; | ||
display: inline-block; | ||
padding: 7px 8px; | ||
background: #fff; | ||
color: var(--midgrey); | ||
font-size: 0.85em; | ||
font-weight: normal; | ||
cursor: default; | ||
} | ||
|
||
.ember-power-select-group .ember-power-select-group-name:after { | ||
content: ""; | ||
position: absolute; | ||
top: 52%; | ||
left: calc(100% + 3px); | ||
display: block; | ||
width: calc(189px - 100%); | ||
height: 1px; | ||
border-bottom: #dfe1e3 1px solid; | ||
} | ||
|
||
@media (max-width: 800px) { | ||
.ember-power-select-group .ember-power-select-group-name:after { | ||
width: calc(224px - 100%); | ||
} | ||
} | ||
|
||
@media (max-width: 500px) { | ||
.ember-power-select-group .ember-power-select-group-name:after { | ||
width: calc(80vw - 45px - 100%); | ||
} | ||
} | ||
|
||
.ember-power-select-group:first-of-type .ember-power-select-group-name { | ||
margin-bottom: 7px; | ||
padding-top: 0; | ||
padding-bottom: 0; | ||
} | ||
|
||
.ember-power-select-group .ember-power-select-option { | ||
overflow: hidden; | ||
padding: 7px 8px; | ||
line-height: 1.35em; | ||
cursor: pointer; | ||
} | ||
|
||
.ember-power-select-group .ember-power-select-option .highlight { | ||
background: #fff3b8; | ||
border-radius: 1px; | ||
} | ||
|
||
.ember-power-select-group .ember-power-select-option[aria-current="true"] { | ||
background: color(var(--blue) alpha(-85%)); | ||
color: var(--darkgrey); | ||
} |
Oops, something went wrong.