Skip to content

Instantly share code, notes, and snippets.

@oliverlj
Last active September 13, 2021 12:14
Show Gist options
  • Save oliverlj/9226905063270324c12e9f07225180a0 to your computer and use it in GitHub Desktop.
Save oliverlj/9226905063270324c12e9f07225180a0 to your computer and use it in GitHub Desktop.
New Twiddle
import Controller from '@ember/controller';
import { action } from '@ember/object';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
cities = ['Barcelonaaaa', 'London', 'New York', 'Porto']
destination = 'Barcelonaaaa'
@action
chooseDestination(city) {
this.set('destination', city);
}
}
body {
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
text-align: left;
}
.container {
align-items: baseline!important;
display: flex!important;
overflow-wrap:break-word;
word-wrap: break-word;
}
.font-weight-bold {
font-weight: 700!important;
}
.form-group {
margin-bottom: 1rem;
}
.mb-1{
margin-bottom: .25rem!important;
}
.ember-basic-dropdown,.ember-basic-dropdown-content,.ember-basic-dropdown-content *,.ember-power-select-dropdown * {
box-sizing: border-box
}
.ember-power-select-trigger[dir=rtl] .ember-power-select-multiple-option,.ember-power-select-trigger[dir=rtl] .ember-power-select-trigger-multiple-input,.fa-pull-right {
float: right
}
.ember-power-select-trigger,.ember-power-select-trigger--active,.ember-power-select-trigger:focus {
border-top: 1px solid #aaa;
border-bottom: 1px solid #aaa;
border-right: 1px solid #aaa;
border-left: 1px solid #aaa
}
.ember-power-select-trigger {
position: relative;
border-radius: 4px;
background-color: #fff;
line-height: 1.75;
overflow-x: hidden;
text-overflow: ellipsis;
min-height: 1.75em;
user-select: none;
-webkit-user-select: none;
color: inherit
}
.ember-power-select-trigger:after {
content: "";
display: table;
clear: both
}
.ember-power-select-trigger--active,.ember-power-select-trigger:focus {
box-shadow: none
}
.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: 0;
border-bottom-right-radius: 0
}
.ember-basic-dropdown-trigger--above.ember-power-select-trigger[aria-expanded=true] {
border-top-left-radius: 0;
border-top-right-radius: 0
}
.ember-power-select-placeholder {
color: #999;
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;
border-style: solid;
border-width: 7px 4px 0;
border-color: #aaa transparent transparent;
right: 5px
}
.ember-basic-dropdown-trigger[aria-expanded=true] .ember-power-select-status-icon {
transform: rotate(180deg)
}
.ember-power-select-clear-btn {
position: absolute;
cursor: pointer;
right: 25px
}
.ember-power-select-trigger-multiple-input {
font-family: inherit;
font-size: inherit;
border: none;
display: inline-block;
line-height: inherit;
-webkit-appearance: none;
outline: 0;
padding: 0;
float: left;
background-color: transparent;
text-indent: 2px
}
.ember-power-select-trigger-multiple-input:disabled {
background-color: #eee
}
.ember-power-select-trigger-multiple-input::placeholder {
opacity: 1;
color: #999
}
.ember-power-select-trigger-multiple-input::-webkit-input-placeholder {
opacity: 1;
color: #999
}
.ember-power-select-trigger-multiple-input::-moz-placeholder {
opacity: 1;
color: #999
}
.ember-power-select-trigger-multiple-input::-ms-input-placeholder {
opacity: 1;
color: #999
}
.ember-power-select-multiple-options {
padding: 0;
margin: 0
}
.ember-power-select-multiple-option {
border: 1px solid gray;
border-radius: 4px;
color: #333;
background-color: #e4e4e4;
padding: 0 4px;
display: inline-block;
line-height: 1.45;
float: left;
margin: 2px 0 2px 3px
}
.ember-power-select-multiple-remove-btn {
cursor: pointer
}
.ember-power-select-multiple-remove-btn:not(:hover) {
opacity: .5
}
.ember-power-select-search {
padding: 4px
}
.ember-power-select-search-input {
border: 1px solid #aaa;
border-radius: 0;
width: 100%;
font-size: inherit;
line-height: inherit;
padding: 0 5px
}
.ember-power-select-search-input:focus {
border: 1px solid #aaa;
box-shadow: none
}
.ember-power-select-dropdown {
border-left: 1px solid #aaa;
border-right: 1px solid #aaa;
line-height: 1.75;
border-radius: 4px;
box-shadow: none;
overflow: hidden;
color: inherit
}
.ember-power-select-dropdown.ember-basic-dropdown-content--above {
border-top: 1px solid #aaa;
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0
}
.ember-power-select-dropdown.ember-basic-dropdown-content--below,.ember-power-select-dropdown.ember-basic-dropdown-content--in-place {
border-top: none;
border-bottom: 1px solid #aaa;
border-top-left-radius: 0;
border-top-right-radius: 0
}
.ember-power-select-dropdown.ember-basic-dropdown-content--in-place {
width: 100%
}
.ember-power-select-options {
list-style: none;
margin: 0;
padding: 0;
user-select: none;
-webkit-user-select: none
}
.ember-power-select-options[role=listbox] {
overflow-y: auto;
-webkit-overflow-scrolling: touch;
max-height: 12.25em
}
.ember-power-select-option {
cursor: pointer;
padding: 0 8px
}
.ember-power-select-group[aria-disabled=true] {
color: #999;
cursor: not-allowed
}
.ember-power-select-group[aria-disabled=true] .ember-power-select-option,.ember-power-select-option[aria-disabled=true] {
color: #999;
pointer-events: none;
cursor: not-allowed
}
.ember-power-select-option[aria-selected=true] {
background-color: #ddd
}
.ember-power-select-option[aria-current=true] {
background-color: #5897fb;
color: #fff
}
.ember-power-select-group-name {
cursor: default;
font-weight: 700
}
.ember-power-select-trigger[aria-disabled=true] {
background-color: #eee
}
.ember-power-select-trigger {
padding: 0 16px 0 0
}
.ember-power-select-placeholder,.ember-power-select-selected-item {
margin-left: 8px
}
.ember-power-select-group .ember-power-select-group .ember-power-select-group-name {
padding-left: 24px
}
.ember-power-select-group .ember-power-select-group .ember-power-select-option {
padding-left: 40px
}
.ember-power-select-group .ember-power-select-option {
padding-left: 24px
}
.ember-power-select-group .ember-power-select-group-name {
padding-left: 8px
}
.ember-power-select-trigger[dir=rtl] {
padding: 0 0 0 16px
}
.ember-power-select-trigger[dir=rtl] .ember-power-select-placeholder,.ember-power-select-trigger[dir=rtl] .ember-power-select-selected-item {
margin-right: 8px
}
.ember-power-select-trigger[dir=rtl] .ember-power-select-status-icon {
left: 5px;
right: initial
}
.ember-power-select-trigger[dir=rtl] .ember-power-select-clear-btn {
left: 25px;
right: initial
}
.ember-power-select-dropdown[dir=rtl] .ember-power-select-group .ember-power-select-group .ember-power-select-group-name {
padding-right: 24px
}
.ember-power-select-dropdown[dir=rtl] .ember-power-select-group .ember-power-select-group .ember-power-select-option {
padding-right: 40px
}
.ember-power-select-dropdown[dir=rtl] .ember-power-select-group .ember-power-select-option {
padding-right: 24px
}
.ember-power-select-dropdown[dir=rtl] .ember-power-select-group .ember-power-select-group-name {
padding-right: 8px
}
<h1>Welcome to {{this.appName}}</h1>
<br>
<br>
<div class="container">
<div class="form-group font-weight-bold mb-1" data-test-transfer-type="">
<PowerSelect @matchTriggerWidth={{false}} @renderInPlace={{true}} @selected={{this.destination}} @options={{this.cities}} @onChange={{this.chooseDestination}} as |name|>
{{name}}
</PowerSelect>
</div>
</div>
<br>
<br>
import Application from '../app';
import config from '../config/environment';
import { setApplication } from '@ember/test-helpers';
import { assign } from '@ember/polyfills';
import { start } from 'ember-qunit';
let attributes = {
rootElement: '#test-root',
autoboot: false
};
attributes = assign(attributes, config.APP);
let application = Application.create(attributes);
setApplication(application);
start();
{
"version": "0.17.1",
"EmberENV": {
"FEATURES": {},
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false,
"_APPLICATION_TEMPLATE_WRAPPER": true,
"_JQUERY_INTEGRATION": true
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js",
"ember": "3.18.1",
"ember-template-compiler": "3.18.1",
"ember-testing": "3.18.1"
},
"addons": {
"@glimmer/component": "1.0.0",
"ember-power-select" : "4.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment