@fluid-topics/ft-filter 0.1.15 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ft-filter-level.d.ts +2 -2
- package/build/ft-filter-level.js +92 -98
- package/build/ft-filter-option.d.ts +1 -1
- package/build/ft-filter-option.js +4 -8
- package/build/ft-filter.d.ts +2 -3
- package/build/ft-filter.inline-styles.js +1421 -0
- package/build/ft-filter.js +114 -121
- package/build/ft-filter.light.js +512 -444
- package/build/ft-filter.min.js +547 -464
- package/build/index.d.ts +3 -0
- package/build/index.js +10 -0
- package/build/inline-styles.d.ts +2 -0
- package/build/inline-styles.js +6 -0
- package/package.json +9 -9
package/build/ft-filter.js
CHANGED
|
@@ -6,13 +6,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { css, html } from "lit";
|
|
8
8
|
import { property, query, queryAll, state } from "lit/decorators.js";
|
|
9
|
-
import {
|
|
9
|
+
import { Debouncer, designSystemVariables, FtCssVariable, FtLitElement, jsonProperty, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { FtTypography, FtTypographyCaption, FtTypographyCssVariables } from "@fluid-topics/ft-typography";
|
|
11
11
|
import { flatDeep } from "./utils";
|
|
12
12
|
import { FtFilterLevel } from "./ft-filter-level";
|
|
13
13
|
import { FtButton, FtButtonCssVariables } from "@fluid-topics/ft-button";
|
|
14
14
|
import { FtSnapScroll } from "@fluid-topics/ft-snap-scroll";
|
|
15
|
-
export * from "./ft-filter-option";
|
|
16
15
|
export const FtFilterCssVariables = {
|
|
17
16
|
colorOutline: FtCssVariable.external(designSystemVariables.colorOutline, "Design system"),
|
|
18
17
|
colorOnSurface: FtCssVariable.external(designSystemVariables.colorOnSurface, "Design system"),
|
|
@@ -27,7 +26,7 @@ export class FtFilterChangeEvent extends CustomEvent {
|
|
|
27
26
|
super("change", { detail: selectedValues });
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
|
|
29
|
+
export class FtFilter extends FtLitElement {
|
|
31
30
|
constructor() {
|
|
32
31
|
super(...arguments);
|
|
33
32
|
this.id = "";
|
|
@@ -47,122 +46,10 @@ let FtFilter = class FtFilter extends FtLitElement {
|
|
|
47
46
|
this.levelsScrollDebouncer = new Debouncer(300);
|
|
48
47
|
this.changeDebouncer = new Debouncer(10);
|
|
49
48
|
}
|
|
50
|
-
// language=CSS
|
|
51
|
-
getStyles() {
|
|
52
|
-
return [
|
|
53
|
-
FtTypographyCaption,
|
|
54
|
-
css `
|
|
55
|
-
:host {
|
|
56
|
-
display: flex;
|
|
57
|
-
max-height: 100%;
|
|
58
|
-
max-width: 100%;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.ft-filter--container {
|
|
62
|
-
flex-grow: 1;
|
|
63
|
-
display: flex;
|
|
64
|
-
flex-direction: column;
|
|
65
|
-
max-height: 100%;
|
|
66
|
-
max-width: 100%;
|
|
67
|
-
color: ${FtFilterCssVariables.colorOnSurface};
|
|
68
|
-
background: ${FtFilterCssVariables.colorSurface};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.ft-filter--header {
|
|
72
|
-
display: flex;
|
|
73
|
-
flex-wrap: wrap;
|
|
74
|
-
gap: 4px;
|
|
75
|
-
flex-shrink: 0;
|
|
76
|
-
padding: 0 10px;
|
|
77
|
-
margin-bottom: 8px;
|
|
78
|
-
${setVariable(FtTypographyCssVariables.fontSize, "14px")};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.ft-filter--header ft-button {
|
|
82
|
-
flex-shrink: 0;
|
|
83
|
-
margin-left: auto;
|
|
84
|
-
${setVariable(FtButtonCssVariables.iconSize, "18px")};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.ft-filter--label {
|
|
88
|
-
display: block;
|
|
89
|
-
flex-shrink: 1;
|
|
90
|
-
flex-grow: 1;
|
|
91
|
-
word-break: break-word;
|
|
92
|
-
${setVariable(FtTypographyCssVariables.lineHeight, "22px")};
|
|
93
|
-
${setVariable(FtTypographyCssVariables.fontWeight, "bold")};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.ft-filter--filter {
|
|
97
|
-
flex-shrink: 0;
|
|
98
|
-
display: flex;
|
|
99
|
-
margin: 0;
|
|
100
|
-
margin-bottom: 8px;
|
|
101
|
-
padding: 0 10px;
|
|
102
|
-
overflow: hidden;
|
|
103
|
-
height: 32px;
|
|
104
|
-
transition: height ${FtFilterCssVariables.transitionDuration} ${FtFilterCssVariables.transitionTimingFunction},
|
|
105
|
-
margin ${FtFilterCssVariables.transitionDuration} ${FtFilterCssVariables.transitionTimingFunction};
|
|
106
|
-
transition-delay: 500ms;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.ft-filter--filter[hidden] {
|
|
110
|
-
height: 0;
|
|
111
|
-
margin-bottom: 0;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
input {
|
|
115
|
-
display: block;
|
|
116
|
-
width: 100%;
|
|
117
|
-
border-radius: 4px;
|
|
118
|
-
border: 1px solid ${FtFilterCssVariables.colorOutline};
|
|
119
|
-
padding: 4px;
|
|
120
|
-
background-color: ${FtFilterCssVariables.colorSurface};
|
|
121
|
-
color: ${FtFilterCssVariables.colorOnSurfaceMedium};
|
|
122
|
-
outline-color: ${FtFilterCssVariables.colorPrimary};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.ft-filter--values {
|
|
126
|
-
flex-grow: 1;
|
|
127
|
-
flex-shrink: 1;
|
|
128
|
-
max-width: 100%;
|
|
129
|
-
overflow-x: hidden;
|
|
130
|
-
overflow-y: auto;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.ft-filter--separator {
|
|
134
|
-
border-top: 1px solid ${FtFilterCssVariables.colorOutline};
|
|
135
|
-
margin: 4px 10px;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.ft-filter--levels-container {
|
|
139
|
-
position: relative;
|
|
140
|
-
overflow: hidden;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.ft-filter--levels {
|
|
144
|
-
position: relative;
|
|
145
|
-
overflow: hidden;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
ft-filter-level {
|
|
149
|
-
width: 100%;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.ft-filter--level-left {
|
|
153
|
-
height: 0;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
slot {
|
|
157
|
-
display: none;
|
|
158
|
-
}
|
|
159
|
-
`
|
|
160
|
-
];
|
|
161
|
-
}
|
|
162
49
|
get flatOptions() {
|
|
163
50
|
return flatDeep(this.options, o => { var _a; return (_a = o.subOptions) !== null && _a !== void 0 ? _a : []; });
|
|
164
51
|
}
|
|
165
|
-
|
|
52
|
+
render() {
|
|
166
53
|
var _a, _b;
|
|
167
54
|
const valuesSelected = this.flatOptions.some(o => o.selected);
|
|
168
55
|
let showFilter = this.withScroll || this.filter || ((_b = (_a = this.lastLevel) === null || _a === void 0 ? void 0 : _a.hasHiddenValues) !== null && _b !== void 0 ? _b : false);
|
|
@@ -352,13 +239,123 @@ let FtFilter = class FtFilter extends FtLitElement {
|
|
|
352
239
|
this.withScroll = this.valuesContainer.scrollHeight > this.valuesContainer.clientHeight;
|
|
353
240
|
}
|
|
354
241
|
}
|
|
355
|
-
}
|
|
242
|
+
}
|
|
356
243
|
FtFilter.elementDefinitions = {
|
|
357
244
|
"ft-button": FtButton,
|
|
358
245
|
"ft-filter-level": FtFilterLevel,
|
|
359
246
|
"ft-snap-scroll": FtSnapScroll,
|
|
360
247
|
"ft-typography": FtTypography,
|
|
361
248
|
};
|
|
249
|
+
// language=CSS
|
|
250
|
+
FtFilter.styles = [
|
|
251
|
+
FtTypographyCaption,
|
|
252
|
+
css `
|
|
253
|
+
:host {
|
|
254
|
+
display: flex;
|
|
255
|
+
max-height: 100%;
|
|
256
|
+
max-width: 100%;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.ft-filter--container {
|
|
260
|
+
flex-grow: 1;
|
|
261
|
+
display: flex;
|
|
262
|
+
flex-direction: column;
|
|
263
|
+
max-height: 100%;
|
|
264
|
+
max-width: 100%;
|
|
265
|
+
color: ${FtFilterCssVariables.colorOnSurface};
|
|
266
|
+
background: ${FtFilterCssVariables.colorSurface};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.ft-filter--header {
|
|
270
|
+
display: flex;
|
|
271
|
+
flex-wrap: wrap;
|
|
272
|
+
gap: 4px;
|
|
273
|
+
flex-shrink: 0;
|
|
274
|
+
padding: 0 10px;
|
|
275
|
+
margin-bottom: 8px;
|
|
276
|
+
${setVariable(FtTypographyCssVariables.fontSize, "14px")};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.ft-filter--header ft-button {
|
|
280
|
+
flex-shrink: 0;
|
|
281
|
+
margin-left: auto;
|
|
282
|
+
${setVariable(FtButtonCssVariables.iconSize, "18px")};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.ft-filter--label {
|
|
286
|
+
display: block;
|
|
287
|
+
flex-shrink: 1;
|
|
288
|
+
flex-grow: 1;
|
|
289
|
+
word-break: break-word;
|
|
290
|
+
${setVariable(FtTypographyCssVariables.lineHeight, "22px")};
|
|
291
|
+
${setVariable(FtTypographyCssVariables.fontWeight, "bold")};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.ft-filter--filter {
|
|
295
|
+
flex-shrink: 0;
|
|
296
|
+
display: flex;
|
|
297
|
+
margin: 0;
|
|
298
|
+
margin-bottom: 8px;
|
|
299
|
+
padding: 0 10px;
|
|
300
|
+
overflow: hidden;
|
|
301
|
+
height: 32px;
|
|
302
|
+
transition: height ${FtFilterCssVariables.transitionDuration} ${FtFilterCssVariables.transitionTimingFunction},
|
|
303
|
+
margin ${FtFilterCssVariables.transitionDuration} ${FtFilterCssVariables.transitionTimingFunction};
|
|
304
|
+
transition-delay: 500ms;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.ft-filter--filter[hidden] {
|
|
308
|
+
height: 0;
|
|
309
|
+
margin-bottom: 0;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
input {
|
|
313
|
+
display: block;
|
|
314
|
+
width: 100%;
|
|
315
|
+
border-radius: 4px;
|
|
316
|
+
border: 1px solid ${FtFilterCssVariables.colorOutline};
|
|
317
|
+
padding: 4px;
|
|
318
|
+
background-color: ${FtFilterCssVariables.colorSurface};
|
|
319
|
+
color: ${FtFilterCssVariables.colorOnSurfaceMedium};
|
|
320
|
+
outline-color: ${FtFilterCssVariables.colorPrimary};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.ft-filter--values {
|
|
324
|
+
flex-grow: 1;
|
|
325
|
+
flex-shrink: 1;
|
|
326
|
+
max-width: 100%;
|
|
327
|
+
overflow-x: hidden;
|
|
328
|
+
overflow-y: auto;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.ft-filter--separator {
|
|
332
|
+
border-top: 1px solid ${FtFilterCssVariables.colorOutline};
|
|
333
|
+
margin: 4px 10px;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.ft-filter--levels-container {
|
|
337
|
+
position: relative;
|
|
338
|
+
overflow: hidden;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.ft-filter--levels {
|
|
342
|
+
position: relative;
|
|
343
|
+
overflow: hidden;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
ft-filter-level {
|
|
347
|
+
width: 100%;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.ft-filter--level-left {
|
|
351
|
+
height: 0;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
slot {
|
|
355
|
+
display: none;
|
|
356
|
+
}
|
|
357
|
+
`
|
|
358
|
+
];
|
|
362
359
|
__decorate([
|
|
363
360
|
property({ type: String })
|
|
364
361
|
], FtFilter.prototype, "id", void 0);
|
|
@@ -419,8 +416,4 @@ __decorate([
|
|
|
419
416
|
__decorate([
|
|
420
417
|
state()
|
|
421
418
|
], FtFilter.prototype, "slideOut", void 0);
|
|
422
|
-
FtFilter = __decorate([
|
|
423
|
-
customElement("ft-filter")
|
|
424
|
-
], FtFilter);
|
|
425
|
-
export { FtFilter };
|
|
426
419
|
//# sourceMappingURL=ft-filter.js.map
|