summaryrefslogtreecommitdiffstats
path: root/asset/css/search-bar.less
blob: 6ad1aec83a241a2fba107d6df3ffdfd31e823e3b (plain)
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
// Style
.search-bar {
  .rounded-corners(.25em);
  background: var(--searchbar-bg, @searchbar-bg);

  // Reset all input styles
  input, [type="button"] {
    .appearance(none);
    border: none;
    background: none;
  }

  // Submit button styles
  input[type=submit],
  button[type=submit],
  button:not([type]) {
    background: var(--primary-button-bg, @primary-button-bg);
    color: var(--primary-button-color, @primary-button-color);
    border-top-right-radius: .25em;
    border-bottom-right-radius: .25em;
  }

  // General input styles
  input:focus {
    outline-offset: -1px;
  }

  // Hide the submit button, it must exist, but shouldn't be shown to the user
  input[type=submit][value="hidden"] {
    display: none;
  }

  // Left-most search dropdown style
  button.search-options {
    i.icon:before {
      font-size: 1.2em;
      margin-right: 0;
      color: var(--control-color, @control-color);
    }

    &:disabled {
      i.icon:before {
        color: var(--control-disabled-color, @control-disabled-color);
      }
    }
  }

  // Term styles
  .filter-condition {
    button {
      border-radius: .4em 0 0 .4em;
      background-color: var(--search-condition-remove-bg, @search-condition-remove-bg);
      color: var(--search-condition-remove-color, @search-condition-remove-color);

      &:after {
        content: "";
        position: absolute;
        width: .4em;
        height: 100%;
        right: 0;
        top: 0;

        background-color: var(--searchbar-bg, @searchbar-bg);
        border: .2em solid var(--search-condition-remove-bg, @search-condition-remove-bg);
        border-width: 0 0 0 .2em;
        border-top-left-radius: .4em;
        border-bottom-left-radius: .4em;
      }
    }

    input {
      background-color: var(--search-term-bg, @search-term-bg);
      color: var(--search-term-color, @search-term-color);
    }
  }

  .terms > .filter-condition:first-child button {
    border-radius: 0 .4em .4em 0;

    &:before {
      content: "";
      position: absolute;
      width: .4em;
      height: 100%;
      left: 0;
      top: 0;

      background-color: var(--searchbar-bg, @searchbar-bg);
      border: .2em solid var(--search-condition-remove-bg, @search-condition-remove-bg);
      border-width: 0 .2em 0 0;
      border-top-right-radius: .4em;
      border-bottom-right-radius: .4em;
    }

    &:after {
      content: none;
    }
  }

  .logical_operator,
  .grouping_operator_open,
  .grouping_operator_close {
    input {
      .rounded-corners();
      background-color: var(--search-logical-operator-bg, @search-logical-operator-bg);
      color: var(--search-logical-operator-color, @search-logical-operator-color);
    }
  }

  .operator,
  .logical_operator,
  .grouping_operator_open,
  .grouping_operator_close {
    input {
      text-align: center;
    }
  }

  .column input {
    .rounded-corners(.4em);
  }
  .column:not(:last-of-type),
  .column.last-term {
    input {
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
    }
  }

  .operator:last-of-type:not(.last-term) input {
    .rounded-corners(.4em);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .value input {
    .rounded-corners(.4em);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .highlighted input {
    background-color: var(--search-term-highlighted-bg, @search-term-highlighted-bg);
    color: var(--search-term-highlighted-color, @search-term-highlighted-color);
  }

  ul.comma-separated {
    display: inline;
    padding: 0;

    list-style-type: none;

    li {
      display: inline;

      &:not(:first-of-type):before {
        display: inline;
        content: ', ';
      }
    }
  }
}

// Layout
.search-bar {
  height: 2em;
  display: flex;
  position: relative; // Required for the suggestions

  button.search-options {
    line-height: 1em;
  }

  .filter-input-area {
    padding: 2/12em; // 2 (px) desired / default font size (px)
  }

  .terms {
    .filter-chain,
    .filter-condition {
      display: inline;
    }

    .filter-condition {
      position: relative;

      button {
        display: none;
        z-index: 1;
        width: ~"calc(2em + 2px)";
        padding: .15em .6em .15em .4em;
        position: absolute;
        left: ~"calc(-2em - 2px)"; // That's min-width + margin-right of an operator
        line-height: 16/12; // 16 (px) desired / default font size (px)

        i:before {
          margin-right: 0;
        }
      }

      &:not(._hover_delay):hover button {
        display: inline;
      }
    }

    > .filter-condition:first-child button {
      padding: .15em .4em .15em .6em;
      left: auto;
      right: ~"calc(-2em - 1px)"; // That's min-width + margin-left of an operator
    }

    label {
      &.logical_operator,
      &.grouping_operator_open,
      &.grouping_operator_close {
        margin-left: 1px; // adds up to 2px with the previous term
        margin-right: 2px;
      }
    }
  }

  &.disabled {
    .terms .filter-condition:hover button {
      display: none;
    }
  }

  .search-suggestions {
    // 2 (px) desired / default font-size to match .filter-input outline-offset (-1px) + outline-width (3px)
    margin-top: 2/12em;
  }
}