2017-05-11 14:05:49 -07:00
|
|
|
<!--
|
2018-03-26 10:04:27 -04:00
|
|
|
@license
|
2017-05-11 14:05:49 -07:00
|
|
|
Copyright (C) 2017 The Android Open Source Project
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<link rel="import" href="../../../bower_components/polymer/polymer.html">
|
2017-09-30 16:44:46 +01:00
|
|
|
|
2017-05-11 14:05:49 -07:00
|
|
|
<link rel="import" href="../../../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html">
|
2017-09-30 16:44:46 +01:00
|
|
|
<link rel="import" href="../../../bower_components/iron-dropdown/iron-dropdown.html">
|
2017-05-11 14:05:49 -07:00
|
|
|
<link rel="import" href="../../shared/gr-cursor-manager/gr-cursor-manager.html">
|
|
|
|
<script src="../../../scripts/rootElement.js"></script>
|
2017-06-01 15:31:55 -07:00
|
|
|
<link rel="import" href="../../../styles/shared-styles.html">
|
2017-05-11 14:05:49 -07:00
|
|
|
|
|
|
|
<dom-module id="gr-autocomplete-dropdown">
|
|
|
|
<template>
|
2017-06-01 15:31:55 -07:00
|
|
|
<style include="shared-styles">
|
2017-10-03 14:24:53 +01:00
|
|
|
:host {
|
|
|
|
z-index: 100;
|
|
|
|
}
|
|
|
|
:host([is-hidden]) {
|
|
|
|
display: none;
|
2017-05-16 17:23:07 -07:00
|
|
|
}
|
2017-05-11 14:05:49 -07:00
|
|
|
ul {
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
li {
|
2018-04-16 14:53:14 +02:00
|
|
|
border-bottom: 1px solid var(--border-color);
|
2017-05-11 14:05:49 -07:00
|
|
|
cursor: pointer;
|
|
|
|
padding: .5em .75em;
|
|
|
|
}
|
2018-04-16 14:53:14 +02:00
|
|
|
li:last-of-type {
|
|
|
|
border: none;
|
|
|
|
}
|
2017-05-11 14:05:49 -07:00
|
|
|
li:focus {
|
|
|
|
outline: none;
|
|
|
|
}
|
2018-04-16 14:53:14 +02:00
|
|
|
li:hover {
|
|
|
|
background-color: var(--hover-background-color);
|
|
|
|
}
|
2017-05-11 14:05:49 -07:00
|
|
|
li.selected {
|
2018-04-16 14:53:14 +02:00
|
|
|
background-color: var(--selection-background-color);
|
2017-05-11 14:05:49 -07:00
|
|
|
}
|
2017-09-30 16:44:46 +01:00
|
|
|
.dropdown-content {
|
2018-04-16 14:53:14 +02:00
|
|
|
background: var(--dropdown-background-color);
|
2017-09-30 16:44:46 +01:00
|
|
|
box-shadow: rgba(0, 0, 0, 0.3) 0 1px 3px;
|
|
|
|
}
|
2017-05-11 14:05:49 -07:00
|
|
|
</style>
|
2017-10-03 14:24:53 +01:00
|
|
|
<div
|
|
|
|
class="dropdown-content"
|
|
|
|
slot="dropdown-content"
|
|
|
|
id="suggestions"
|
|
|
|
role="listbox">
|
|
|
|
<ul>
|
|
|
|
<template is="dom-repeat" items="[[suggestions]]">
|
|
|
|
<li data-index$="[[index]]"
|
|
|
|
data-value$="[[item.dataValue]]"
|
|
|
|
tabindex="-1"
|
|
|
|
aria-label$="[[item.name]]"
|
|
|
|
role="option"
|
|
|
|
on-tap="_handleTapItem">[[item.text]]</li>
|
|
|
|
</template>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2017-05-11 14:05:49 -07:00
|
|
|
<gr-cursor-manager
|
|
|
|
id="cursor"
|
|
|
|
index="{{index}}"
|
|
|
|
cursor-target-class="selected"
|
|
|
|
scroll-behavior="never"
|
|
|
|
focus-on-move
|
|
|
|
stops="[[_suggestionEls]]"></gr-cursor-manager>
|
|
|
|
</template>
|
|
|
|
<script src="gr-autocomplete-dropdown.js"></script>
|
|
|
|
</dom-module>
|