File: searchable_drop_down_cros.html

package info (click to toggle)
chromium 139.0.7258.138-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,120,676 kB
  • sloc: cpp: 35,100,869; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (167 lines) | stat: -rw-r--r-- 4,961 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
    <style include="cr-shared-style cr-hidden-style">
      :host(:not([error-message-allowed])) cr-input {
        --cr-input-error-display: none;
      }

      :host([opened_]) cr-input {
        --cr-input-border-radius: 4px 4px 0 0;
      }

      iron-dropdown,
      cr-input {
        /* 472px is the max width of the input field for a dialog. */
        width: var(--cr-searchable-drop-down-width, 472px);
      }

      cr-input {
        --cr-input-padding-start: 8px;

        /* cr-inputs are by default isolated into their own stacking contexts
         * but cr-searchable-drop-down requires a fixed overlay that floats over
         * and covers other content outside their parent cr-input's stacking
         * contexts.
         */
        isolation: auto;
      }

      iron-dropdown {
        max-height: 270px;
      }

      iron-dropdown [slot='dropdown-content'] {
        background-color: var(--cr-searchable-drop-down-bg-color, white);
        border-radius: 0 0 4px 4px;
        box-shadow: var(--cr-searchable-drop-down-shadow,
          0 2px 6px #9e9e9e);  /* --paper-grey-500 */
        min-width: 128px;
        padding: 8px 0;
      }

      #input-overlay {
        border-radius: 4px;
        height: 100%;
        left: 0;
        overflow: hidden;
        pointer-events: none;
        position: absolute;
        top: 0;
        width: 100%;
      }

      #dropdown-icon {
        --iron-icon-height: 20px;
        --iron-icon-width: 20px;
        margin-top: -10px;
        padding-inline-end: 6px;
        position: absolute;
        right: 0;
        top: 50%;
      }

      :host-context([dir='rtl']) #dropdown-icon {
        left: 0;
        right: unset;
      }

      cr-input:focus-within #dropdown-icon {
        --iron-icon-fill-color: var(--cr-searchable-drop-down-icon-color-focus,
          var(--google-blue-600));
      }

      #input-box {
        height: 100%;
        left: 0;
        pointer-events: none;
        top: 0;
        width: 100%;
      }

      #dropdown-box {
        pointer-events: initial;
        width: 100%;
      }

      #loading-box {
        align-items: center;
        box-sizing: border-box;
        display: flex;
        height: 32px;
        padding: 0 8px;
        text-align: start;
        width: 100%;
      }

      #loading-box div {
        font-size: 12px;
        padding: 0 16px;
      }

      #loading-box paper-spinner-lite {
        --paper-spinner-color: var(--cr-searchable-drop-down-spinner-color,
          var(--google-blue-600));
        --paper-spinner-stroke-width: 2px;
        height: 16px;
        width: 16px;
      }

      .list-item {
        background: none;
        border: none;
        box-sizing: border-box;
        color: var(--cr-searchable-drop-down-list-item-color,
          #212121);  /* --paper-grey-900 */;
        font: inherit;
        min-height: 32px;
        padding: 0 8px;
        text-align: start;
        width: 100%;
      }

      .list-item[selected_] {
        background-color:
          var(--cr-searchable-drop-down-list-bg-color-selected,
            rgba(0, 0, 0, .04));
        outline: none;
      }

      .list-item:active {
        background-color:
          var(--cr-searchable-drop-down-list-bg-color-active,
            rgba(0, 0, 0, .12));
        outline: none;
      }
    </style>
    <!-- |value| is one-way binding on purpose so that it doesn't change
      immediately as the user types unless the update-value-on-input flag is
      explicitly used. -->
    <cr-input part="input" label="[[label]]" on-focus="onFocus_" on-keydown="onKeyDown_"
        value="[[value]]"
        on-input="onInput_" id="search" autofocus="[[autofocus]]"
        placeholder="[[placeholder]]" readonly="[[readonly]]"
        error-message="[[getErrorMessage_(errorMessage, errorMessageAllowed)]]"
        invalid="[[shouldShowErrorMessage_(errorMessage, errorMessageAllowed)]]"
        on-blur="onBlur_">
      <div id="input-overlay" slot="suffix">
        <div id="input-box">
          <cr-icon id="dropdown-icon" icon="cr:arrow-drop-down"></cr-icon>
        </div>
        <div id="dropdown-box">
          <iron-dropdown id="dropdown" horizontal-align="left"
              vertical-align="top" vertical-offset="0"
              no-cancel-on-outside-click no-cancel-on-esc-key>
            <div slot="dropdown-content">
              <div id="loading-box" hidden="[[!showLoading]]">
                <paper-spinner-lite active></paper-spinner-lite>
                <div class="cr-secondary-text">[[loadingMessage]]</div>
              </div>
              <template is="dom-repeat" items="[[items]]"
                  filter="[[filterItems_(searchTerm_)]]">
                <button class="list-item" on-click="onSelect_" tabindex="-1">
                  [[item]]
                </button>
              </template>
            </div>
          </iron-dropdown>
        </div>
      </div>
    </cr-input>