
- Create a shared style module that is included in every custom element - Add the shared style module to each existing element Change-Id: I1ee382955afe4ff630548a6640e7c4d03688849d
74 lines
2.3 KiB
HTML
74 lines
2.3 KiB
HTML
<!--
|
|
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">
|
|
<link rel="import" href="../../../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html">
|
|
<link rel="import" href="../../shared/gr-cursor-manager/gr-cursor-manager.html">
|
|
<script src="../../../scripts/rootElement.js"></script>
|
|
<link rel="import" href="../../../styles/shared-styles.html">
|
|
|
|
<dom-module id="gr-autocomplete-dropdown">
|
|
<template>
|
|
<style include="shared-styles">
|
|
:host {
|
|
background: #fff;
|
|
box-shadow: rgba(0, 0, 0, 0.3) 0 1px 3px;
|
|
position: absolute;
|
|
z-index: 104;
|
|
}
|
|
/* This must be set here vs. the container component because in some cases
|
|
the element is moved in the DOM to a base element and is no longer a
|
|
child of its original parent. */
|
|
:host(.fixed){
|
|
position: fixed;
|
|
}
|
|
ul {
|
|
list-style: none;
|
|
}
|
|
li {
|
|
cursor: pointer;
|
|
padding: .5em .75em;
|
|
}
|
|
li:focus {
|
|
outline: none;
|
|
}
|
|
li.selected {
|
|
background-color: #eee;
|
|
}
|
|
</style>
|
|
<div 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>
|
|
<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>
|