@fluid-topics/ft-filter 1.0.1 → 1.0.4
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 +1 -1
- package/build/ft-filter-level.js +4 -4
- package/build/ft-filter.css.js +1 -1
- package/build/ft-filter.d.ts +3 -1
- package/build/ft-filter.js +21 -10
- package/build/ft-filter.light.js +35 -33
- package/build/ft-filter.min.js +21 -19
- package/package.json +10 -10
|
@@ -3,7 +3,7 @@ import { FtFilterOptionProperties } from "./ft-filter-option.properties";
|
|
|
3
3
|
export declare class FtFilterLevel extends FtLitElement {
|
|
4
4
|
static elementDefinitions: ElementDefinitionsMap;
|
|
5
5
|
static styles: import("lit").CSSResult;
|
|
6
|
-
|
|
6
|
+
filterId: string;
|
|
7
7
|
parent?: FtFilterOptionProperties;
|
|
8
8
|
options: Array<FtFilterOptionProperties>;
|
|
9
9
|
multivalued: boolean;
|
package/build/ft-filter-level.js
CHANGED
|
@@ -19,7 +19,7 @@ import { levelStyles } from "./ft-filter-level.css";
|
|
|
19
19
|
class FtFilterLevel extends FtLitElement {
|
|
20
20
|
constructor() {
|
|
21
21
|
super(...arguments);
|
|
22
|
-
this.
|
|
22
|
+
this.filterId = "";
|
|
23
23
|
this.options = [];
|
|
24
24
|
this.multivalued = false;
|
|
25
25
|
this.disabled = false;
|
|
@@ -114,7 +114,7 @@ class FtFilterLevel extends FtLitElement {
|
|
|
114
114
|
buildMultiValuedOption(option) {
|
|
115
115
|
var _a;
|
|
116
116
|
return html `
|
|
117
|
-
<ft-checkbox name="${this.
|
|
117
|
+
<ft-checkbox name="${this.filterId}"
|
|
118
118
|
part="multivalued-option"
|
|
119
119
|
data-value="${option.value}"
|
|
120
120
|
.checked=${option.selected}
|
|
@@ -127,7 +127,7 @@ class FtFilterLevel extends FtLitElement {
|
|
|
127
127
|
}
|
|
128
128
|
buildMonoValuedOption(option) {
|
|
129
129
|
return html `
|
|
130
|
-
<ft-radio name="${this.
|
|
130
|
+
<ft-radio name="${this.filterId + Math.round(Math.random() * 1000000)}"
|
|
131
131
|
part="monovalued-option"
|
|
132
132
|
data-value="${option.value}"
|
|
133
133
|
.checked=${option.selected}
|
|
@@ -164,7 +164,7 @@ FtFilterLevel.elementDefinitions = {
|
|
|
164
164
|
FtFilterLevel.styles = levelStyles;
|
|
165
165
|
__decorate([
|
|
166
166
|
property({ type: String })
|
|
167
|
-
], FtFilterLevel.prototype, "
|
|
167
|
+
], FtFilterLevel.prototype, "filterId", void 0);
|
|
168
168
|
__decorate([
|
|
169
169
|
property({ type: Object })
|
|
170
170
|
], FtFilterLevel.prototype, "parent", void 0);
|
package/build/ft-filter.css.js
CHANGED
package/build/ft-filter.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare class FtFilter extends FtLitElement implements FtFilterProperties
|
|
|
24
24
|
private container?;
|
|
25
25
|
private valuesContainer?;
|
|
26
26
|
private levelsContainer?;
|
|
27
|
-
private
|
|
27
|
+
private lastLevelHasHiddenvalues;
|
|
28
28
|
private filterInput?;
|
|
29
29
|
private levels?;
|
|
30
30
|
private withScroll;
|
|
@@ -47,6 +47,8 @@ export declare class FtFilter extends FtLitElement implements FtFilterProperties
|
|
|
47
47
|
private onChange;
|
|
48
48
|
private changeDebouncer;
|
|
49
49
|
private optionsChanged;
|
|
50
|
+
private lastDispatchedValues;
|
|
51
|
+
private sendEventIfValuesChanged;
|
|
50
52
|
private updateOptionsFromSlot;
|
|
51
53
|
private onFilterChange;
|
|
52
54
|
private updateScroll;
|
package/build/ft-filter.js
CHANGED
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html } from "lit";
|
|
8
8
|
import { property, query, queryAll, state } from "lit/decorators.js";
|
|
9
|
-
import { Debouncer, FtLitElement, jsonProperty } from "@fluid-topics/ft-wc-utils";
|
|
9
|
+
import { Debouncer, deepEqual, FtLitElement, jsonProperty } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
11
11
|
import { flatDeep } from "./utils";
|
|
12
12
|
import { FtFilterLevel } from "./ft-filter-level";
|
|
@@ -33,12 +33,14 @@ class FtFilter extends FtLitElement {
|
|
|
33
33
|
this.raiseSelectedOptions = false;
|
|
34
34
|
this.displayedValuesLimit = 0;
|
|
35
35
|
this.hideClearButton = false;
|
|
36
|
+
this.lastLevelHasHiddenvalues = false;
|
|
36
37
|
this.withScroll = false;
|
|
37
38
|
this.filter = "";
|
|
38
39
|
this.displayedLevels = [];
|
|
39
40
|
this.scrollResizeObserver = new ResizeObserver(() => this.updateScroll());
|
|
40
41
|
this.levelsScrollDebouncer = new Debouncer(300);
|
|
41
42
|
this.changeDebouncer = new Debouncer(10);
|
|
43
|
+
this.lastDispatchedValues = [];
|
|
42
44
|
}
|
|
43
45
|
get flatOptions() {
|
|
44
46
|
return flatDeep(this.options, o => { var _a; return (_a = o.subOptions) !== null && _a !== void 0 ? _a : []; });
|
|
@@ -47,17 +49,18 @@ class FtFilter extends FtLitElement {
|
|
|
47
49
|
return this.flatOptions.filter(o => o.selected).map(o => o.value);
|
|
48
50
|
}
|
|
49
51
|
render() {
|
|
50
|
-
var _a, _b;
|
|
51
52
|
const valuesSelected = this.flatOptions.some(o => o.selected);
|
|
52
|
-
const showFilter = this.withScroll || this.filter ||
|
|
53
|
+
const showFilter = this.withScroll || this.filter || this.lastLevelHasHiddenvalues;
|
|
53
54
|
const placeholder = this.filterPlaceHolder.replace("{0}", this.label);
|
|
54
55
|
return html `
|
|
55
56
|
<div class="ft-filter--container ${this.disabled ? "ft-filter--disabled" : ""}"
|
|
56
57
|
part="container">
|
|
57
58
|
${!this.label && !valuesSelected ? null : html `
|
|
58
59
|
<div class="ft-filter--header" part="header">
|
|
59
|
-
<ft-typography class="ft-filter--label" variant="overline" part="label"
|
|
60
|
+
<ft-typography class="ft-filter--label" variant="overline" part="label">
|
|
61
|
+
${this.label}
|
|
60
62
|
</ft-typography>
|
|
63
|
+
<slot name="label"></slot>
|
|
61
64
|
${valuesSelected && !this.hideClearButton ? html `
|
|
62
65
|
<ft-button icon="close" dense @click=${this.clear} part="clear-button">
|
|
63
66
|
${this.clearButtonLabel}
|
|
@@ -92,7 +95,7 @@ class FtFilter extends FtLitElement {
|
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
contentAvailableCallback(props) {
|
|
95
|
-
var _a, _b;
|
|
98
|
+
var _a, _b, _c, _d, _e;
|
|
96
99
|
super.contentAvailableCallback(props);
|
|
97
100
|
if (this.valuesContainer) {
|
|
98
101
|
this.scrollResizeObserver.observe(this.valuesContainer);
|
|
@@ -118,6 +121,7 @@ class FtFilter extends FtLitElement {
|
|
|
118
121
|
this.slideOut = undefined;
|
|
119
122
|
}, 300);
|
|
120
123
|
}
|
|
124
|
+
this.lastLevelHasHiddenvalues = (_e = (_d = (_c = this.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector(".ft-filter--levels ft-filter-level:last-child")) === null || _d === void 0 ? void 0 : _d.hasHiddenValues) !== null && _e !== void 0 ? _e : false;
|
|
121
125
|
}
|
|
122
126
|
renderLevels() {
|
|
123
127
|
const allOptions = this.flatOptions;
|
|
@@ -127,7 +131,7 @@ class FtFilter extends FtLitElement {
|
|
|
127
131
|
return html `
|
|
128
132
|
${this.raiseSelectedOptions && selectedOptions.length > 0 ? html `
|
|
129
133
|
<ft-filter-level
|
|
130
|
-
|
|
134
|
+
filterId="${this.id}"
|
|
131
135
|
?multivalued=${this.multivalued}
|
|
132
136
|
?disabled=${this.disabled}
|
|
133
137
|
preventNavigation
|
|
@@ -165,7 +169,7 @@ class FtFilter extends FtLitElement {
|
|
|
165
169
|
return html `
|
|
166
170
|
<ft-filter-level
|
|
167
171
|
class="${className}"
|
|
168
|
-
|
|
172
|
+
filterId="${this.id}"
|
|
169
173
|
.filter="${this.filter}"
|
|
170
174
|
moreValuesButtonLabel="${this.moreValuesButtonLabel}"
|
|
171
175
|
?multivalued=${this.multivalued}
|
|
@@ -222,11 +226,18 @@ class FtFilter extends FtLitElement {
|
|
|
222
226
|
optionsChanged() {
|
|
223
227
|
this.changeDebouncer.run(() => {
|
|
224
228
|
var _a;
|
|
225
|
-
this.
|
|
229
|
+
this.sendEventIfValuesChanged();
|
|
226
230
|
this.requestUpdate();
|
|
227
231
|
(_a = this.levels) === null || _a === void 0 ? void 0 : _a.forEach(l => l.requestUpdate());
|
|
228
232
|
});
|
|
229
233
|
}
|
|
234
|
+
sendEventIfValuesChanged() {
|
|
235
|
+
const newValues = this.selectedValues;
|
|
236
|
+
if (!deepEqual(this.lastDispatchedValues, newValues)) {
|
|
237
|
+
this.dispatchEvent(new FtFilterChangeEvent(newValues));
|
|
238
|
+
this.lastDispatchedValues = newValues;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
230
241
|
updateOptionsFromSlot(e) {
|
|
231
242
|
e.stopPropagation();
|
|
232
243
|
this.options = this.slotElement.assignedElements().map(n => n);
|
|
@@ -299,8 +310,8 @@ __decorate([
|
|
|
299
310
|
query(".ft-filter--levels")
|
|
300
311
|
], FtFilter.prototype, "levelsContainer", void 0);
|
|
301
312
|
__decorate([
|
|
302
|
-
|
|
303
|
-
], FtFilter.prototype, "
|
|
313
|
+
state()
|
|
314
|
+
], FtFilter.prototype, "lastLevelHasHiddenvalues", void 0);
|
|
304
315
|
__decorate([
|
|
305
316
|
query(".ft-filter--filter input")
|
|
306
317
|
], FtFilter.prototype, "filterInput", void 0);
|
package/build/ft-filter.light.js
CHANGED
|
@@ -10,7 +10,7 @@ var l;const a=window,h=a.trustedTypes,p=h?h.createPolicy("lit-html",{createHTML:
|
|
|
10
10
|
* Copyright 2020 Google LLC
|
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
12
|
*/
|
|
13
|
-
const
|
|
13
|
+
const V=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===V)return null==t?void 0:t._$litStatic$},P=t=>({_$litStatic$:t,r:V}),K=new Map,G=(t=>(i,...e)=>{const o=e.length;let s,r;const n=[],l=[];let a,h=0,p=!1;for(;h<o;){for(a=i[h];h<o&&void 0!==(r=e[h],s=W(r));)a+=s+i[++h],p=!0;h!==o&&l.push(r),n.push(a),h++}if(h===o&&n.push(i[o]),p){const t=n.join("$$lit$$");void 0===(i=K.get(t))&&(n.raw=n,K.set(t,i=n)),e=l}return t(i,...e)})(C);var q;!function(t){t.title="title",t.title_dense="title-dense",t.subtitle1="subtitle1",t.subtitle2="subtitle2",t.body1="body1",t.body2="body2",t.caption="caption",t.breadcrumb="breadcrumb",t.overline="overline",t.button="button"}(q||(q={}));const X=i.FtCssVariableFactory.extend("--ft-typography-font-family",i.designSystemVariables.titleFont),Y=i.FtCssVariableFactory.extend("--ft-typography-font-family",i.designSystemVariables.contentFont),J={fontFamily:Y,fontSize:i.FtCssVariableFactory.create("--ft-typography-font-size","SIZE","16px"),fontWeight:i.FtCssVariableFactory.create("--ft-typography-font-weight","UNKNOWN","normal"),letterSpacing:i.FtCssVariableFactory.create("--ft-typography-letter-spacing","SIZE","0.496px"),lineHeight:i.FtCssVariableFactory.create("--ft-typography-line-height","NUMBER","1.5"),textTransform:i.FtCssVariableFactory.create("--ft-typography-text-transform","UNKNOWN","inherit")},Q=i.FtCssVariableFactory.extend("--ft-typography-title-font-family",X),tt=i.FtCssVariableFactory.extend("--ft-typography-title-font-size",J.fontSize,"20px"),it=i.FtCssVariableFactory.extend("--ft-typography-title-font-weight",J.fontWeight,"normal"),et=i.FtCssVariableFactory.extend("--ft-typography-title-letter-spacing",J.letterSpacing,"0.15px"),ot=i.FtCssVariableFactory.extend("--ft-typography-title-line-height",J.lineHeight,"1.2"),st=i.FtCssVariableFactory.extend("--ft-typography-title-text-transform",J.textTransform,"inherit"),rt=i.FtCssVariableFactory.extend("--ft-typography-title-dense-font-family",X),nt=i.FtCssVariableFactory.extend("--ft-typography-title-dense-font-size",J.fontSize,"14px"),lt=i.FtCssVariableFactory.extend("--ft-typography-title-dense-font-weight",J.fontWeight,"normal"),at=i.FtCssVariableFactory.extend("--ft-typography-title-dense-letter-spacing",J.letterSpacing,"0.105px"),ht=i.FtCssVariableFactory.extend("--ft-typography-title-dense-line-height",J.lineHeight,"1.7"),pt=i.FtCssVariableFactory.extend("--ft-typography-title-dense-text-transform",J.textTransform,"inherit"),ft=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-font-family",Y),ct=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-font-size",J.fontSize,"16px"),dt=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-font-weight",J.fontWeight,"600"),ut=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-letter-spacing",J.letterSpacing,"0.144px"),vt=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-line-height",J.lineHeight,"1.5"),bt=i.FtCssVariableFactory.extend("--ft-typography-subtitle1-text-transform",J.textTransform,"inherit"),xt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-font-family",Y),gt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-font-size",J.fontSize,"14px"),yt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-font-weight",J.fontWeight,"normal"),mt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-letter-spacing",J.letterSpacing,"0.098px"),$t=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-line-height",J.lineHeight,"1.7"),kt=i.FtCssVariableFactory.extend("--ft-typography-subtitle2-text-transform",J.textTransform,"inherit"),wt=i.FtCssVariableFactory.extend("--ft-typography-body1-font-family",Y),zt=i.FtCssVariableFactory.extend("--ft-typography-body1-font-size",J.fontSize,"16px"),St=i.FtCssVariableFactory.extend("--ft-typography-body1-font-weight",J.fontWeight,"normal"),Ot=i.FtCssVariableFactory.extend("--ft-typography-body1-letter-spacing",J.letterSpacing,"0.496px"),Ct=i.FtCssVariableFactory.extend("--ft-typography-body1-line-height",J.lineHeight,"1.5"),Bt=i.FtCssVariableFactory.extend("--ft-typography-body1-text-transform",J.textTransform,"inherit"),jt={fontFamily:i.FtCssVariableFactory.extend("--ft-typography-body2-font-family",Y),fontSize:i.FtCssVariableFactory.extend("--ft-typography-body2-font-size",J.fontSize,"14px"),fontWeight:i.FtCssVariableFactory.extend("--ft-typography-body2-font-weight",J.fontWeight,"normal"),letterSpacing:i.FtCssVariableFactory.extend("--ft-typography-body2-letter-spacing",J.letterSpacing,"0.252px"),lineHeight:i.FtCssVariableFactory.extend("--ft-typography-body2-line-height",J.lineHeight,"1.4"),textTransform:i.FtCssVariableFactory.extend("--ft-typography-body2-text-transform",J.textTransform,"inherit")},Et=i.FtCssVariableFactory.extend("--ft-typography-caption-font-family",Y),It=i.FtCssVariableFactory.extend("--ft-typography-caption-font-size",J.fontSize,"12px"),Nt=i.FtCssVariableFactory.extend("--ft-typography-caption-font-weight",J.fontWeight,"normal"),Tt=i.FtCssVariableFactory.extend("--ft-typography-caption-letter-spacing",J.letterSpacing,"0.396px"),Dt=i.FtCssVariableFactory.extend("--ft-typography-caption-line-height",J.lineHeight,"1.33"),At=i.FtCssVariableFactory.extend("--ft-typography-caption-text-transform",J.textTransform,"inherit"),Rt=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-font-family",Y),Ft=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-font-size",J.fontSize,"10px"),Mt=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-font-weight",J.fontWeight,"normal"),_t=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-letter-spacing",J.letterSpacing,"0.33px"),Lt=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-line-height",J.lineHeight,"1.6"),Ht=i.FtCssVariableFactory.extend("--ft-typography-breadcrumb-text-transform",J.textTransform,"inherit"),Ut=i.FtCssVariableFactory.extend("--ft-typography-overline-font-family",Y),Zt=i.FtCssVariableFactory.extend("--ft-typography-overline-font-size",J.fontSize,"10px"),Vt=i.FtCssVariableFactory.extend("--ft-typography-overline-font-weight",J.fontWeight,"normal"),Wt=i.FtCssVariableFactory.extend("--ft-typography-overline-letter-spacing",J.letterSpacing,"1.5px"),Pt=i.FtCssVariableFactory.extend("--ft-typography-overline-line-height",J.lineHeight,"1.6"),Kt=i.FtCssVariableFactory.extend("--ft-typography-overline-text-transform",J.textTransform,"uppercase"),Gt={fontFamily:i.FtCssVariableFactory.extend("--ft-typography-button-font-family",Y),fontSize:i.FtCssVariableFactory.extend("--ft-typography-button-font-size",J.fontSize,"14px"),fontWeight:i.FtCssVariableFactory.extend("--ft-typography-button-font-weight",J.fontWeight,"600"),letterSpacing:i.FtCssVariableFactory.extend("--ft-typography-button-letter-spacing",J.letterSpacing,"1.246px"),lineHeight:i.FtCssVariableFactory.extend("--ft-typography-button-line-height",J.lineHeight,"1.15"),textTransform:i.FtCssVariableFactory.extend("--ft-typography-button-text-transform",J.textTransform,"uppercase")},qt=e.css`
|
|
14
14
|
.ft-typography--title {
|
|
15
15
|
font-family: ${Q};
|
|
16
16
|
font-size: ${tt};
|
|
@@ -87,9 +87,9 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
87
87
|
.ft-typography--overline {
|
|
88
88
|
font-family: ${Ut};
|
|
89
89
|
font-size: ${Zt};
|
|
90
|
-
font-weight: ${
|
|
91
|
-
letter-spacing: ${
|
|
92
|
-
line-height: ${
|
|
90
|
+
font-weight: ${Vt};
|
|
91
|
+
letter-spacing: ${Wt};
|
|
92
|
+
line-height: ${Pt};
|
|
93
93
|
text-transform: ${Kt};
|
|
94
94
|
}
|
|
95
95
|
`,si=e.css`
|
|
@@ -106,10 +106,10 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
106
106
|
vertical-align: inherit;
|
|
107
107
|
}
|
|
108
108
|
`;var ni=function(t,i,e,o){for(var s,r=arguments.length,n=r<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(i,e,n):s(i,e))||n);return r>3&&n&&Object.defineProperty(i,e,n),n};class li extends i.FtLitElement{constructor(){super(...arguments),this.variant=q.body1}render(){return this.element?G`
|
|
109
|
-
<${
|
|
109
|
+
<${P(this.element)}
|
|
110
110
|
class="ft-typography ft-typography--${this.variant}">
|
|
111
111
|
<slot></slot>
|
|
112
|
-
</${
|
|
112
|
+
</${P(this.element)}>
|
|
113
113
|
`:G`
|
|
114
114
|
<slot class="ft-typography ft-typography--${this.variant}"></slot>
|
|
115
115
|
`}}function ai(t,i){return t.flatMap((t=>[t,...ai(i(t),i)]))}li.styles=[qt,Xt,Yt,Jt,Qt,ti,ii,ei,oi,si,ri],ni([o.property()],li.prototype,"element",void 0),ni([o.property()],li.prototype,"variant",void 0),i.customElement("ft-typography")(li);const hi=i.FtCssVariableFactory.extend("--ft-ripple-color",i.designSystemVariables.colorContent),pi={color:hi,backgroundColor:i.FtCssVariableFactory.extend("--ft-ripple-background-color",hi),opacityContentOnSurfacePressed:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfacePressed,"Design system"),opacityContentOnSurfaceHover:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfaceHover,"Design system"),opacityContentOnSurfaceFocused:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfaceFocused,"Design system"),opacityContentOnSurfaceSelected:i.FtCssVariableFactory.external(i.designSystemVariables.opacityContentOnSurfaceSelected,"Design system"),borderRadius:i.FtCssVariableFactory.create("--ft-ripple-border-radius","SIZE","0px")},fi=i.FtCssVariableFactory.extend("--ft-ripple-color",i.designSystemVariables.colorPrimary),ci=fi,di=i.FtCssVariableFactory.extend("--ft-ripple-background-color",fi),ui=i.FtCssVariableFactory.extend("--ft-ripple-color",i.designSystemVariables.colorSecondary),vi=ui,bi=i.FtCssVariableFactory.extend("--ft-ripple-background-color",ui),xi=e.css`
|
|
@@ -219,7 +219,7 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
219
219
|
<div class="ft-ripple--background"></div>
|
|
220
220
|
<div class="ft-ripple--effect"></div>
|
|
221
221
|
</div>
|
|
222
|
-
`}contentAvailableCallback(t){super.contentAvailableCallback(t),this.ripple&&this.resizeObserver.observe(this.ripple),this.rippleEffect&&this.rippleEffect.ontransitionstart!==this.onTransitionStart&&(this.rippleEffect.ontransitionstart=this.onTransitionStart,this.rippleEffect.ontransitionend=this.onTransitionEnd)}updated(t){var i,e;super.updated(t),t.has("disabled")&&(this.disabled?(this.endRipple(),null===(i=this.target)||void 0===i||i.removeAttribute("data-is-ft-ripple-target")):null===(e=this.target)||void 0===e||e.setAttribute("data-is-ft-ripple-target","true")),t.has("unbounded")&&this.setRippleSize()}endRipple(){this.endHover(),this.endFocus(),this.endPress(),this.rippling=!1}setRippleSize(){if(this.ripple){const t=this.ripple.getBoundingClientRect();this.rippleSize=(this.unbounded?1:1.7)*Math.max(t.width,t.height)}}connectedCallback(){super.connectedCallback(),this.setupDebouncer.run((()=>{var t;const
|
|
222
|
+
`}contentAvailableCallback(t){super.contentAvailableCallback(t),this.ripple&&this.resizeObserver.observe(this.ripple),this.rippleEffect&&this.rippleEffect.ontransitionstart!==this.onTransitionStart&&(this.rippleEffect.ontransitionstart=this.onTransitionStart,this.rippleEffect.ontransitionend=this.onTransitionEnd)}updated(t){var i,e;super.updated(t),t.has("disabled")&&(this.disabled?(this.endRipple(),null===(i=this.target)||void 0===i||i.removeAttribute("data-is-ft-ripple-target")):null===(e=this.target)||void 0===e||e.setAttribute("data-is-ft-ripple-target","true")),t.has("unbounded")&&this.setRippleSize()}endRipple(){this.endHover(),this.endFocus(),this.endPress(),this.rippling=!1}setRippleSize(){if(this.ripple){const t=this.ripple.getBoundingClientRect();this.rippleSize=(this.unbounded?1:1.7)*Math.max(t.width,t.height)}}connectedCallback(){super.connectedCallback(),this.setupDebouncer.run((()=>this.defaultSetup()))}defaultSetup(){var t,i;const e=null===(t=this.shadowRoot)||void 0===t?void 0:t.host.parentElement;e&&this.setupFor(null!==(i=this.target)&&void 0!==i?i:e),this.setRippleSize()}setupFor(t){if(this.setupDebouncer.cancel(),this.target===t)return;this.onDisconnect&&this.onDisconnect(),this.target=t,t.setAttribute("data-is-ft-ripple-target","true");const i=(...t)=>i=>{t.forEach((t=>window.addEventListener(t,this.endPress,{once:!0}))),this.startPress(i)},e=i("mouseup","contextmenu"),o=i("touchend","touchcancel"),s=t=>{["Enter"," "].includes(t.key)&&i("keyup")(t)};t.addEventListener("mouseover",this.startHover),t.addEventListener("mousemove",this.moveRipple),t.addEventListener("mouseleave",this.endHover),t.addEventListener("mousedown",e),t.addEventListener("touchstart",o),t.addEventListener("touchmove",this.moveRipple),t.addEventListener("keydown",s),t.addEventListener("focus",this.startFocus),t.addEventListener("blur",this.endFocus),t.addEventListener("focusin",this.startFocus),t.addEventListener("focusout",this.endFocus),this.onDisconnect=()=>{t.removeAttribute("data-is-ft-ripple-target"),t.removeEventListener("mouseover",this.startHover),t.removeEventListener("mousemove",this.moveRipple),t.removeEventListener("mouseleave",this.endHover),t.removeEventListener("mousedown",e),t.removeEventListener("touchstart",o),t.removeEventListener("touchmove",this.moveRipple),t.removeEventListener("keydown",s),t.removeEventListener("focus",this.startFocus),t.removeEventListener("blur",this.endFocus),t.removeEventListener("focusin",this.startFocus),t.removeEventListener("focusout",this.endFocus),this.onDisconnect=void 0,this.target=void 0}}getCoordinates(t){const i=t,e=t;let o,s;return null!=i.x?({x:o,y:s}=i):null!=e.touches&&(o=e.touches[0].clientX,s=e.touches[0].clientY),{x:o,y:s}}isIgnored(t){if(this.disabled)return!0;if(null!=t)for(let i of t.composedPath()){if(i===this.target)break;if("hasAttribute"in i&&i.hasAttribute("data-is-ft-ripple-target"))return!0}return!1}disconnectedCallback(){super.disconnectedCallback(),this.onDisconnect&&this.onDisconnect(),this.resizeObserver.disconnect(),this.endRipple()}}yi.elementDefinitions={},yi.styles=xi,gi([o.property({type:Boolean})],yi.prototype,"primary",void 0),gi([o.property({type:Boolean})],yi.prototype,"secondary",void 0),gi([o.property({type:Boolean})],yi.prototype,"unbounded",void 0),gi([o.property({type:Boolean})],yi.prototype,"activated",void 0),gi([o.property({type:Boolean})],yi.prototype,"selected",void 0),gi([o.property({type:Boolean})],yi.prototype,"disabled",void 0),gi([o.state()],yi.prototype,"hovered",void 0),gi([o.state()],yi.prototype,"focused",void 0),gi([o.state()],yi.prototype,"pressed",void 0),gi([o.state()],yi.prototype,"rippling",void 0),gi([o.state()],yi.prototype,"rippleSize",void 0),gi([o.state()],yi.prototype,"originX",void 0),gi([o.state()],yi.prototype,"originY",void 0),gi([o.query(".ft-ripple")],yi.prototype,"ripple",void 0),gi([o.query(".ft-ripple--effect")],yi.prototype,"rippleEffect",void 0),i.customElement("ft-ripple")(yi);const mi=i.FtCssVariableFactory.create("--ft-tooltip-distance","SIZE","4px"),$i=i.FtCssVariableFactory.create("--ft-tooltip-color","COLOR","#FFFFFF"),ki=i.FtCssVariableFactory.create("--ft-tooltip-background-color","COLOR","#666666"),wi=i.FtCssVariableFactory.create("--ft-tooltip-z-index","NUMBER","1"),zi=i.FtCssVariableFactory.external(i.designSystemVariables.borderRadiusS,"Design system"),Si=i.FtCssVariableFactory.create("--ft-tooltip-max-width","SIZE","150px"),Oi=e.css`
|
|
223
223
|
.ft-tooltip--container {
|
|
224
224
|
display: block;
|
|
225
225
|
position: relative;
|
|
@@ -269,7 +269,7 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
269
269
|
</div>
|
|
270
270
|
</div>
|
|
271
271
|
</div>
|
|
272
|
-
`}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){["visible","text"].some((i=>t.has(i)))&&this.visible&&this.positionTooltip()}show(t){this.visible=!0,null!=t&&this.hideDebounce.run((()=>this.hide()),t)}hide(){this.visible=!1}toggle(){this.visible=!this.visible}get slottedElement(){var t;return(null!==(t=this.slotNodes)&&void 0!==t?t:[]).filter((t=>t.nodeType==Node.ELEMENT_NODE))[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){const t=this.tooltipContent.style;switch(t.transition="none",this.validPosition){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px"}}}positionTooltip(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const i=t.getBoundingClientRect(),e=(i.height-this.tooltip.clientHeight)/2,o=(i.width-this.tooltip.clientWidth)/2;let s=0,r=0;switch(this.validPosition){case"top":r=-this.tooltip.clientHeight,s=o;break;case"bottom":r=i.height,s=o;break;case"left":r=e,s=-this.tooltip.clientWidth;break;case"right":r=e,s=i.width}i.left+s+this.tooltip.clientWidth>window.innerWidth&&(s=window.innerWidth-this.tooltip.clientWidth-i.left),i.left+s<0&&(s=0);const n=this.tooltip.style;n.left=s+"px",n.top=r+"px",n.maxWidth=`max(${i.width}px, ${Si})`}this.revealDebouncer.run((()=>{this.tooltipContent&&(this.tooltipContent.style.transition="top var(--ft-transition-duration, 250ms), left var(--ft-transition-duration, 250ms)",this.tooltipContent.style.top="0",this.tooltipContent.style.left="0")}),this.manual?0:this.delay)}onTouch(){this.manual||(this.show(),setTimeout((()=>window.addEventListener("touchstart",(t=>{t.composedPath().includes(this.container)||this.onOut()}),{once:!0})),100))}onHover(){this.manual||this.show()}onOut(){this.manual||(this.revealDebouncer.cancel(),this.hide())}}Bi.elementDefinitions={"ft-typography":li},Bi.styles=Oi,Ci([o.property()],Bi.prototype,"text",void 0),Ci([o.property({type:Boolean})],Bi.prototype,"manual",void 0),Ci([o.property({type:Boolean})],Bi.prototype,"inline",void 0),Ci([o.property({type:Number})],Bi.prototype,"delay",void 0),Ci([o.property()],Bi.prototype,"position",void 0),Ci([o.queryAssignedNodes("",!0)],Bi.prototype,"slotNodes",void 0),Ci([o.query(".ft-tooltip--container")],Bi.prototype,"container",void 0),Ci([o.query("slot")],Bi.prototype,"target",void 0),Ci([o.query(".ft-tooltip")],Bi.prototype,"tooltip",void 0),Ci([o.query(".ft-tooltip--content")],Bi.prototype,"tooltipContent",void 0),Ci([o.state()],Bi.prototype,"visible",void 0),i.customElement("ft-tooltip")(Bi);const ji={color:i.FtCssVariableFactory.extend("--ft-loader-color",i.designSystemVariables.colorPrimary),size:i.FtCssVariableFactory.create("--ft-loader-size","SIZE","80px")},Ei=e.css`
|
|
272
|
+
`}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){super.contentAvailableCallback(t),["visible","text"].some((i=>t.has(i)))&&this.visible&&this.positionTooltip()}show(t){this.visible=!0,null!=t&&this.hideDebounce.run((()=>this.hide()),t)}hide(){this.visible=!1}toggle(){this.visible=!this.visible}get slottedElement(){var t;return(null!==(t=this.slotNodes)&&void 0!==t?t:[]).filter((t=>t.nodeType==Node.ELEMENT_NODE))[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){const t=this.tooltipContent.style;switch(t.transition="none",this.validPosition){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px"}}}positionTooltip(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const i=t.getBoundingClientRect(),e=(i.height-this.tooltip.clientHeight)/2,o=(i.width-this.tooltip.clientWidth)/2;let s=0,r=0;switch(this.validPosition){case"top":r=-this.tooltip.clientHeight,s=o;break;case"bottom":r=i.height,s=o;break;case"left":r=e,s=-this.tooltip.clientWidth;break;case"right":r=e,s=i.width}i.left+s+this.tooltip.clientWidth>window.innerWidth&&(s=window.innerWidth-this.tooltip.clientWidth-i.left),i.left+s<0&&(s=0);const n=this.tooltip.style;n.left=s+"px",n.top=r+"px",n.maxWidth=`max(${i.width}px, ${Si})`}this.revealDebouncer.run((()=>{this.tooltipContent&&(this.tooltipContent.style.transition="top var(--ft-transition-duration, 250ms), left var(--ft-transition-duration, 250ms)",this.tooltipContent.style.top="0",this.tooltipContent.style.left="0")}),this.manual?0:this.delay)}onTouch(){this.manual||(this.show(),setTimeout((()=>window.addEventListener("touchstart",(t=>{t.composedPath().includes(this.container)||this.onOut()}),{once:!0})),100))}onHover(){this.manual||this.show()}onOut(){this.manual||(this.revealDebouncer.cancel(),this.hide())}}Bi.elementDefinitions={"ft-typography":li},Bi.styles=Oi,Ci([o.property()],Bi.prototype,"text",void 0),Ci([o.property({type:Boolean})],Bi.prototype,"manual",void 0),Ci([o.property({type:Boolean})],Bi.prototype,"inline",void 0),Ci([o.property({type:Number})],Bi.prototype,"delay",void 0),Ci([o.property()],Bi.prototype,"position",void 0),Ci([o.queryAssignedNodes("",!0)],Bi.prototype,"slotNodes",void 0),Ci([o.query(".ft-tooltip--container")],Bi.prototype,"container",void 0),Ci([o.query("slot")],Bi.prototype,"target",void 0),Ci([o.query(".ft-tooltip")],Bi.prototype,"tooltip",void 0),Ci([o.query(".ft-tooltip--content")],Bi.prototype,"tooltipContent",void 0),Ci([o.state()],Bi.prototype,"visible",void 0),i.customElement("ft-tooltip")(Bi);const ji={color:i.FtCssVariableFactory.extend("--ft-loader-color",i.designSystemVariables.colorPrimary),size:i.FtCssVariableFactory.create("--ft-loader-size","SIZE","80px")},Ei=e.css`
|
|
273
273
|
:host {
|
|
274
274
|
line-height: 0;
|
|
275
275
|
}
|
|
@@ -398,7 +398,7 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
398
398
|
${n.unsafeHTML(this.resolvedIcon)}
|
|
399
399
|
<slot ?hidden=${i}></slot>
|
|
400
400
|
</i>
|
|
401
|
-
`}get textContent(){var t,i;return null!==(i=null===(t=this.slottedContent)||void 0===t?void 0:t.assignedNodes().map((t=>t.textContent)).join("").trim())&&void 0!==i?i:""}update(t){super.update(t),["value","variant"].some((i=>t.has(i)))&&this.resolveIcon()}resolveIcon(){var t,i;let o=this.value||this.textContent;switch(this.variant){case Ri.file_format:this.resolvedIcon=null!==(t=Ti[o.replace("-","_").toUpperCase()])&&void 0!==t?t:o;break;case Ri.material:this.resolvedIcon=this.value||e.nothing;break;default:this.resolvedIcon=null!==(i=Ni[o.replace("-","_").toUpperCase()])&&void 0!==i?i:o}}firstUpdated(t){super.firstUpdated(t),setTimeout((()=>this.resolveIcon()))}}Mi.elementDefinitions={},Mi.styles=Ai,Fi([o.property()],Mi.prototype,"variant",void 0),Fi([o.property()],Mi.prototype,"value",void 0),Fi([o.state()],Mi.prototype,"resolvedIcon",void 0),Fi([o.query("slot")],Mi.prototype,"slottedContent",void 0),i.customElement("ft-icon")(Mi);const _i=i.FtCssVariableFactory.extend("--ft-button-color",i.designSystemVariables.colorPrimary),Li={backgroundColor:i.FtCssVariableFactory.extend("--ft-button-background-color",i.designSystemVariables.colorSurface),borderRadius:i.FtCssVariableFactory.extend("--ft-button-border-radius",i.designSystemVariables.borderRadiusL),color:_i,fontSize:i.FtCssVariableFactory.extend("--ft-button-font-size",Gt.fontSize),iconSize:i.FtCssVariableFactory.create("--ft-button-icon-size","SIZE","24px"),rippleColor:i.FtCssVariableFactory.extend("--ft-button-ripple-color",_i),verticalPadding:i.FtCssVariableFactory.create("--ft-button-vertical-padding","SIZE","6px"),horizontalPadding:i.FtCssVariableFactory.create("--ft-button-horizontal-padding","SIZE","8px"),iconPadding:i.FtCssVariableFactory.create("--ft-button-icon-padding","SIZE","8px"),opacityDisabled:i.FtCssVariableFactory.external(i.designSystemVariables.colorOpacityDisabled,"Design system")},Hi=i.FtCssVariableFactory.extend("--ft-button-primary-color",i.FtCssVariableFactory.extend("--ft-button-color",i.designSystemVariables.colorOnPrimary)),Ui={backgroundColor:i.FtCssVariableFactory.extend("--ft-button-primary-background-color",i.FtCssVariableFactory.extend("--ft-button-background-color",i.designSystemVariables.colorPrimary)),color:Hi,rippleColor:i.FtCssVariableFactory.extend("--ft-button-primary-ripple-color",Hi)},Zi=i.FtCssVariableFactory.extend("--ft-button-dense-border-radius",i.FtCssVariableFactory.extend("--ft-button-border-radius",i.designSystemVariables.borderRadiusM)),
|
|
401
|
+
`}get textContent(){var t,i;return null!==(i=null===(t=this.slottedContent)||void 0===t?void 0:t.assignedNodes().map((t=>t.textContent)).join("").trim())&&void 0!==i?i:""}update(t){super.update(t),["value","variant"].some((i=>t.has(i)))&&this.resolveIcon()}resolveIcon(){var t,i;let o=this.value||this.textContent;switch(this.variant){case Ri.file_format:this.resolvedIcon=null!==(t=Ti[o.replace("-","_").toUpperCase()])&&void 0!==t?t:o;break;case Ri.material:this.resolvedIcon=this.value||e.nothing;break;default:this.resolvedIcon=null!==(i=Ni[o.replace("-","_").toUpperCase()])&&void 0!==i?i:o}}firstUpdated(t){super.firstUpdated(t),setTimeout((()=>this.resolveIcon()))}}Mi.elementDefinitions={},Mi.styles=Ai,Fi([o.property()],Mi.prototype,"variant",void 0),Fi([o.property()],Mi.prototype,"value",void 0),Fi([o.state()],Mi.prototype,"resolvedIcon",void 0),Fi([o.query("slot")],Mi.prototype,"slottedContent",void 0),i.customElement("ft-icon")(Mi);const _i=i.FtCssVariableFactory.extend("--ft-button-color",i.designSystemVariables.colorPrimary),Li={backgroundColor:i.FtCssVariableFactory.extend("--ft-button-background-color",i.designSystemVariables.colorSurface),borderRadius:i.FtCssVariableFactory.extend("--ft-button-border-radius",i.designSystemVariables.borderRadiusL),color:_i,fontSize:i.FtCssVariableFactory.extend("--ft-button-font-size",Gt.fontSize),iconSize:i.FtCssVariableFactory.create("--ft-button-icon-size","SIZE","24px"),rippleColor:i.FtCssVariableFactory.extend("--ft-button-ripple-color",_i),verticalPadding:i.FtCssVariableFactory.create("--ft-button-vertical-padding","SIZE","6px"),horizontalPadding:i.FtCssVariableFactory.create("--ft-button-horizontal-padding","SIZE","8px"),iconPadding:i.FtCssVariableFactory.create("--ft-button-icon-padding","SIZE","8px"),opacityDisabled:i.FtCssVariableFactory.external(i.designSystemVariables.colorOpacityDisabled,"Design system")},Hi=i.FtCssVariableFactory.extend("--ft-button-primary-color",i.FtCssVariableFactory.extend("--ft-button-color",i.designSystemVariables.colorOnPrimary)),Ui={backgroundColor:i.FtCssVariableFactory.extend("--ft-button-primary-background-color",i.FtCssVariableFactory.extend("--ft-button-background-color",i.designSystemVariables.colorPrimary)),color:Hi,rippleColor:i.FtCssVariableFactory.extend("--ft-button-primary-ripple-color",Hi)},Zi=i.FtCssVariableFactory.extend("--ft-button-dense-border-radius",i.FtCssVariableFactory.extend("--ft-button-border-radius",i.designSystemVariables.borderRadiusM)),Vi=i.FtCssVariableFactory.create("--ft-button-dense-vertical-padding","SIZE","2px"),Wi=i.FtCssVariableFactory.create("--ft-button-dense-horizontal-padding","SIZE","4px"),Pi=i.FtCssVariableFactory.create("--ft-button-dense-icon-padding","SIZE","4px"),Ki=[e.css`
|
|
402
402
|
:host {
|
|
403
403
|
display: inline-block;
|
|
404
404
|
max-width: 100%;
|
|
@@ -456,13 +456,13 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
.ft-button.ft-button--dense {
|
|
459
|
-
padding: ${
|
|
459
|
+
padding: ${Vi} ${Wi};
|
|
460
460
|
border-radius: ${Zi};
|
|
461
|
-
gap: ${
|
|
461
|
+
gap: ${Pi};
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
.ft-button.ft-button--dense.ft-button--outlined {
|
|
465
|
-
padding: calc(${
|
|
465
|
+
padding: calc(${Vi} - 1px) calc(${Wi} - 1px);
|
|
466
466
|
}
|
|
467
467
|
|
|
468
468
|
.ft-button:not([disabled]):hover {
|
|
@@ -474,7 +474,7 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
474
474
|
}
|
|
475
475
|
|
|
476
476
|
.ft-button--round.ft-button--dense {
|
|
477
|
-
border-radius: calc(var(--ft-button-internal-line-height) / 2 + ${
|
|
477
|
+
border-radius: calc(var(--ft-button-internal-line-height) / 2 + ${Vi});
|
|
478
478
|
}
|
|
479
479
|
|
|
480
480
|
.ft-button[disabled] {
|
|
@@ -504,7 +504,7 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
504
504
|
}
|
|
505
505
|
|
|
506
506
|
.ft-button--dense .ft-button--label {
|
|
507
|
-
margin: 0 ${
|
|
507
|
+
margin: 0 ${Pi};
|
|
508
508
|
}
|
|
509
509
|
|
|
510
510
|
.ft-button--label[hidden] {
|
|
@@ -522,8 +522,8 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
522
522
|
}
|
|
523
523
|
|
|
524
524
|
.ft-button--dense .ft-button--label[hidden] + ft-icon {
|
|
525
|
-
margin: 0 calc(${
|
|
526
|
-
padding: 0 ${
|
|
525
|
+
margin: 0 calc(${Wi} * -1);
|
|
526
|
+
padding: 0 ${Vi};
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
.ft-button:not(.ft-button--trailing-icon) ft-icon,
|
|
@@ -841,7 +841,7 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
841
841
|
margin: 10px 0;
|
|
842
842
|
color: ${ve.colorOnSurfaceMedium};
|
|
843
843
|
}
|
|
844
|
-
`;var xe=function(t,i,e,o){for(var s,r=arguments.length,n=r<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(i,e,n):s(i,e))||n);return r>3&&n&&Object.defineProperty(i,e,n),n};class ge extends i.FtLitElement{constructor(){super(...arguments),this.
|
|
844
|
+
`;var xe=function(t,i,e,o){for(var s,r=arguments.length,n=r<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(i,e,n):s(i,e))||n);return r>3&&n&&Object.defineProperty(i,e,n),n};class ge extends i.FtLitElement{constructor(){super(...arguments),this.filterId="",this.options=[],this.multivalued=!1,this.disabled=!1,this.hideSelectedOptions=!1,this.preventNavigation=!1,this.filter="",this.moreValuesButtonLabel="More",this.displayedValuesLimit=0,this.displayedPages=1}get hasHiddenValues(){let t=this.limit;return null!=t&&t<this.options.length}get limit(){return this.displayedValuesLimit>0?this.displayedPages*this.displayedValuesLimit:void 0}get height(){var t,i;return null!==(i=null===(t=this.container)||void 0===t?void 0:t.scrollHeight)&&void 0!==i?i:0}render(){let t=[...this.options];this.hideSelectedOptions&&(t=t.filter((t=>!t.selected))),this.filter&&(t=t.filter((t=>t.label.toLowerCase().includes(this.filter.toLowerCase()))));const i=t.slice(0,this.limit);return e.html`
|
|
845
845
|
<div class="ft-filter-level--container ${this.disabled?"ft-filter--disabled":""}">
|
|
846
846
|
${null==this.parent?null:e.html`
|
|
847
847
|
<div tabindex="0"
|
|
@@ -885,7 +885,7 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
885
885
|
`:e.nothing}
|
|
886
886
|
</div>
|
|
887
887
|
`}goBackOnKeyPress(t){"Enter"!==t.key&&" "!==t.key||this.dispatchEvent(new CustomEvent("go-back",{detail:this.parent}))}goBackOnClick(t){t.stopPropagation(),t.preventDefault(),this.dispatchEvent(new CustomEvent("go-back",{detail:this.parent}))}displayMore(){this.displayedPages++}buildMultiValuedOption(t){var i;return e.html`
|
|
888
|
-
<ft-checkbox name="${this.
|
|
888
|
+
<ft-checkbox name="${this.filterId}"
|
|
889
889
|
part="multivalued-option"
|
|
890
890
|
data-value="${t.value}"
|
|
891
891
|
.checked=${t.selected}
|
|
@@ -895,7 +895,7 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
895
895
|
${t.renderOption?t.renderOption:t.label}
|
|
896
896
|
</ft-checkbox>
|
|
897
897
|
`}buildMonoValuedOption(t){return e.html`
|
|
898
|
-
<ft-radio name="${this.
|
|
898
|
+
<ft-radio name="${this.filterId+Math.round(1e6*Math.random())}"
|
|
899
899
|
part="monovalued-option"
|
|
900
900
|
data-value="${t.value}"
|
|
901
901
|
.checked=${t.selected}
|
|
@@ -905,7 +905,7 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
905
905
|
@change=${t=>t.stopPropagation()}>
|
|
906
906
|
${t.renderOption?t.renderOption:t.label}
|
|
907
907
|
</ft-radio>
|
|
908
|
-
`}onRadioKeyUp(t,i){i.selected&&" "===t.key&&this.optionsChanged(t,i)}optionsChanged(t,i){t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{detail:i}))}displayLevel(t){this.dispatchEvent(new CustomEvent("display-level",{detail:t}))}}ge.elementDefinitions={"ft-button":qi,"ft-ripple":yi,"ft-typography":li,"ft-checkbox":oe,"ft-icon":Mi,"ft-radio":fe},ge.styles=be,xe([o.property({type:String})],ge.prototype,"
|
|
908
|
+
`}onRadioKeyUp(t,i){i.selected&&" "===t.key&&this.optionsChanged(t,i)}optionsChanged(t,i){t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{detail:i}))}displayLevel(t){this.dispatchEvent(new CustomEvent("display-level",{detail:t}))}}ge.elementDefinitions={"ft-button":qi,"ft-ripple":yi,"ft-typography":li,"ft-checkbox":oe,"ft-icon":Mi,"ft-radio":fe},ge.styles=be,xe([o.property({type:String})],ge.prototype,"filterId",void 0),xe([o.property({type:Object})],ge.prototype,"parent",void 0),xe([o.property({type:Array})],ge.prototype,"options",void 0),xe([o.property({type:Boolean})],ge.prototype,"multivalued",void 0),xe([o.property({type:Boolean})],ge.prototype,"disabled",void 0),xe([o.property({type:Boolean})],ge.prototype,"hideSelectedOptions",void 0),xe([o.property({type:Boolean})],ge.prototype,"preventNavigation",void 0),xe([o.property({type:String})],ge.prototype,"filter",void 0),xe([o.property({type:String})],ge.prototype,"moreValuesButtonLabel",void 0),xe([o.property({type:String})],ge.prototype,"noValuesLabel",void 0),xe([o.property({type:Number})],ge.prototype,"displayedValuesLimit",void 0),xe([o.query(".ft-filter-level--container")],ge.prototype,"container",void 0),xe([o.state()],ge.prototype,"displayedPages",void 0);const ye={buttonsColor:i.FtCssVariableFactory.extend("--ft-snap-scroll-buttons-color",i.designSystemVariables.colorPrimary),buttonsZIndex:i.FtCssVariableFactory.create("--ft-snap-scroll-buttons-z-index","COLOR","1"),gap:i.FtCssVariableFactory.create("--ft-snap-scroll-gap","SIZE","0"),colorSurface:i.FtCssVariableFactory.external(i.designSystemVariables.colorSurface,"Design system")},me=e.css`
|
|
909
909
|
.ft-snap-scroll {
|
|
910
910
|
box-sizing: border-box;
|
|
911
911
|
position: relative;
|
|
@@ -1163,30 +1163,32 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
1163
1163
|
height: 0;
|
|
1164
1164
|
}
|
|
1165
1165
|
|
|
1166
|
-
slot {
|
|
1166
|
+
slot:not([name]) {
|
|
1167
1167
|
display: none;
|
|
1168
1168
|
}
|
|
1169
|
-
`];var Oe=function(t,i,e,o){for(var s,r=arguments.length,n=r<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(i,e,n):s(i,e))||n);return r>3&&n&&Object.defineProperty(i,e,n),n};class Ce extends CustomEvent{constructor(t){super("change",{detail:t})}}class Be extends i.FtLitElement{constructor(){super(...arguments),this.id="",this.label="",this.filterPlaceHolder="Filter {0}",this.clearButtonLabel="Clear",this.moreValuesButtonLabel="More",this.noValuesLabel="No values available",this.options=[],this.multivalued=!1,this.disabled=!1,this.raiseSelectedOptions=!1,this.displayedValuesLimit=0,this.hideClearButton=!1,this.withScroll=!1,this.filter="",this.displayedLevels=[],this.scrollResizeObserver=new ResizeObserver((()=>this.updateScroll())),this.levelsScrollDebouncer=new i.Debouncer(300),this.changeDebouncer=new i.Debouncer(10)}get flatOptions(){return ai(this.options,(t=>{var i;return null!==(i=t.subOptions)&&void 0!==i?i:[]}))}get selectedValues(){return this.flatOptions.filter((t=>t.selected)).map((t=>t.value))}render(){
|
|
1169
|
+
`];var Oe=function(t,i,e,o){for(var s,r=arguments.length,n=r<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(i,e,n):s(i,e))||n);return r>3&&n&&Object.defineProperty(i,e,n),n};class Ce extends CustomEvent{constructor(t){super("change",{detail:t})}}class Be extends i.FtLitElement{constructor(){super(...arguments),this.id="",this.label="",this.filterPlaceHolder="Filter {0}",this.clearButtonLabel="Clear",this.moreValuesButtonLabel="More",this.noValuesLabel="No values available",this.options=[],this.multivalued=!1,this.disabled=!1,this.raiseSelectedOptions=!1,this.displayedValuesLimit=0,this.hideClearButton=!1,this.lastLevelHasHiddenvalues=!1,this.withScroll=!1,this.filter="",this.displayedLevels=[],this.scrollResizeObserver=new ResizeObserver((()=>this.updateScroll())),this.levelsScrollDebouncer=new i.Debouncer(300),this.changeDebouncer=new i.Debouncer(10),this.lastDispatchedValues=[]}get flatOptions(){return ai(this.options,(t=>{var i;return null!==(i=t.subOptions)&&void 0!==i?i:[]}))}get selectedValues(){return this.flatOptions.filter((t=>t.selected)).map((t=>t.value))}render(){const t=this.flatOptions.some((t=>t.selected)),i=this.withScroll||this.filter||this.lastLevelHasHiddenvalues,o=this.filterPlaceHolder.replace("{0}",this.label);return e.html`
|
|
1170
1170
|
<div class="ft-filter--container ${this.disabled?"ft-filter--disabled":""}"
|
|
1171
1171
|
part="container">
|
|
1172
|
-
${this.label||
|
|
1172
|
+
${this.label||t?e.html`
|
|
1173
1173
|
<div class="ft-filter--header" part="header">
|
|
1174
|
-
<ft-typography class="ft-filter--label" variant="overline" part="label"
|
|
1174
|
+
<ft-typography class="ft-filter--label" variant="overline" part="label">
|
|
1175
|
+
${this.label}
|
|
1175
1176
|
</ft-typography>
|
|
1176
|
-
|
|
1177
|
+
<slot name="label"></slot>
|
|
1178
|
+
${t&&!this.hideClearButton?e.html`
|
|
1177
1179
|
<ft-button icon="close" dense @click=${this.clear} part="clear-button">
|
|
1178
1180
|
${this.clearButtonLabel}
|
|
1179
1181
|
</ft-button>
|
|
1180
1182
|
`:null}
|
|
1181
1183
|
</div>
|
|
1182
1184
|
`:null}
|
|
1183
|
-
<div class="ft-filter--filter" ?hidden=${!
|
|
1185
|
+
<div class="ft-filter--filter" ?hidden=${!i}>
|
|
1184
1186
|
<input type="search"
|
|
1185
1187
|
part="input"
|
|
1186
1188
|
class="ft-typography--caption"
|
|
1187
|
-
?disabled=${!
|
|
1188
|
-
placeholder="${
|
|
1189
|
-
size="${
|
|
1189
|
+
?disabled=${!i}
|
|
1190
|
+
placeholder="${o}"
|
|
1191
|
+
size="${i?o.length:0}"
|
|
1190
1192
|
@search=${this.onFilterChange}
|
|
1191
1193
|
@keyup=${this.onFilterChange}>
|
|
1192
1194
|
</div>
|
|
@@ -1197,10 +1199,10 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
1197
1199
|
@slotchange=${this.updateOptionsFromSlot}
|
|
1198
1200
|
@option-change=${this.optionsChanged}></slot>
|
|
1199
1201
|
</div>
|
|
1200
|
-
`}update(t){if(super.update(t),t.has("options")){const t=new Set(this.flatOptions.map((t=>t.value)));this.displayedLevels=this.displayedLevels.filter((i=>t.has(i)))}}contentAvailableCallback(t){var i,e;super.contentAvailableCallback(t),this.valuesContainer&&this.scrollResizeObserver.observe(this.valuesContainer),this.container&&this.scrollResizeObserver.observe(this.container),t.has("options")&&(this.updateScroll(),null===(i=this.levelsContainer)||void 0===i||i.scrollToIndex(this.displayedLevels.length)),t.has("slideIn")&&this.slideIn&&setTimeout((()=>{var t;null===(t=this.levelsContainer)||void 0===t||t.next(),this.slideIn=void 0}),0),t.has("slideOut")&&this.slideOut&&(null===(e=this.levelsContainer)||void 0===e||e.previous(),setTimeout((()=>{this.displayedLevels.pop(),this.slideOut=void 0}),300))}renderLevels(){const t=this.flatOptions,i=t.filter((t=>t.selected)),o=this.slideIn||this.slideOut?this.displayedLevels.length-2:this.displayedLevels.length-1,s=o<0?"ft-filter--level-center":"ft-filter--level-left";return e.html`
|
|
1202
|
+
`}update(t){if(super.update(t),t.has("options")){const t=new Set(this.flatOptions.map((t=>t.value)));this.displayedLevels=this.displayedLevels.filter((i=>t.has(i)))}}contentAvailableCallback(t){var i,e,o,s,r;super.contentAvailableCallback(t),this.valuesContainer&&this.scrollResizeObserver.observe(this.valuesContainer),this.container&&this.scrollResizeObserver.observe(this.container),t.has("options")&&(this.updateScroll(),null===(i=this.levelsContainer)||void 0===i||i.scrollToIndex(this.displayedLevels.length)),t.has("slideIn")&&this.slideIn&&setTimeout((()=>{var t;null===(t=this.levelsContainer)||void 0===t||t.next(),this.slideIn=void 0}),0),t.has("slideOut")&&this.slideOut&&(null===(e=this.levelsContainer)||void 0===e||e.previous(),setTimeout((()=>{this.displayedLevels.pop(),this.slideOut=void 0}),300)),this.lastLevelHasHiddenvalues=null!==(r=null===(s=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector(".ft-filter--levels ft-filter-level:last-child"))||void 0===s?void 0:s.hasHiddenValues)&&void 0!==r&&r}renderLevels(){const t=this.flatOptions,i=t.filter((t=>t.selected)),o=this.slideIn||this.slideOut?this.displayedLevels.length-2:this.displayedLevels.length-1,s=o<0?"ft-filter--level-center":"ft-filter--level-left";return e.html`
|
|
1201
1203
|
${this.raiseSelectedOptions&&i.length>0?e.html`
|
|
1202
1204
|
<ft-filter-level
|
|
1203
|
-
|
|
1205
|
+
filterId="${this.id}"
|
|
1204
1206
|
?multivalued=${this.multivalued}
|
|
1205
1207
|
?disabled=${this.disabled}
|
|
1206
1208
|
preventNavigation
|
|
@@ -1220,7 +1222,7 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
1220
1222
|
`}renderLevel(t,i,o){return e.html`
|
|
1221
1223
|
<ft-filter-level
|
|
1222
1224
|
class="${t}"
|
|
1223
|
-
|
|
1225
|
+
filterId="${this.id}"
|
|
1224
1226
|
.filter="${this.filter}"
|
|
1225
1227
|
moreValuesButtonLabel="${this.moreValuesButtonLabel}"
|
|
1226
1228
|
?multivalued=${this.multivalued}
|
|
@@ -1236,6 +1238,6 @@ const W=Symbol.for(""),P=t=>{if((null==t?void 0:t.r)===W)return null==t?void 0:t
|
|
|
1236
1238
|
.exportpartsPrefixes=${["values","available-values"]}
|
|
1237
1239
|
noValuesLabel="${this.noValuesLabel}"
|
|
1238
1240
|
></ft-filter-level>
|
|
1239
|
-
`}goBack(t){this.slideOut=t.detail.value}onDisplayLevel(t){this.displayedLevels.push(t.detail.value),this.slideIn=t.detail.value}clear(){if(this.flatOptions.forEach((t=>t.selected=!1)),this.displayedLevels.length>0){let t=this.displayedLevels[this.displayedLevels.length-1];this.displayedLevels=[t],this.slideOut=t}this.optionsChanged()}onChange(t){var i;t.stopPropagation();const e=this.flatOptions.find((i=>i.value===t.detail.value));e.selected=!e.selected;const o=t=>{var i;t!==e&&(t.selected=!1),null===(i=t.subOptions)||void 0===i||i.forEach(o)};this.multivalued?null===(i=e.subOptions)||void 0===i||i.forEach(o):this.options.forEach(o),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;this.
|
|
1241
|
+
`}goBack(t){this.slideOut=t.detail.value}onDisplayLevel(t){this.displayedLevels.push(t.detail.value),this.slideIn=t.detail.value}clear(){if(this.flatOptions.forEach((t=>t.selected=!1)),this.displayedLevels.length>0){let t=this.displayedLevels[this.displayedLevels.length-1];this.displayedLevels=[t],this.slideOut=t}this.optionsChanged()}onChange(t){var i;t.stopPropagation();const e=this.flatOptions.find((i=>i.value===t.detail.value));e.selected=!e.selected;const o=t=>{var i;t!==e&&(t.selected=!1),null===(i=t.subOptions)||void 0===i||i.forEach(o)};this.multivalued?null===(i=e.subOptions)||void 0===i||i.forEach(o):this.options.forEach(o),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;this.sendEventIfValuesChanged(),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}sendEventIfValuesChanged(){const t=this.selectedValues;i.deepEqual(this.lastDispatchedValues,t)||(this.dispatchEvent(new Ce(t)),this.lastDispatchedValues=t)}updateOptionsFromSlot(t){t.stopPropagation(),this.options=this.slotElement.assignedElements().map((t=>t)),this.optionsChanged()}onFilterChange(){var t,i;this.filter=null!==(i=null===(t=this.filterInput)||void 0===t?void 0:t.value)&&void 0!==i?i:""}updateScroll(){this.valuesContainer&&(this.withScroll=this.valuesContainer.scrollHeight>this.valuesContainer.clientHeight)}}Be.elementDefinitions={"ft-button":qi,"ft-filter-level":ge,"ft-snap-scroll":we,"ft-typography":li},Be.styles=Se,Oe([o.property({type:String})],Be.prototype,"id",void 0),Oe([o.property({type:String})],Be.prototype,"label",void 0),Oe([o.property({type:String})],Be.prototype,"filterPlaceHolder",void 0),Oe([o.property({type:String})],Be.prototype,"clearButtonLabel",void 0),Oe([o.property({type:String})],Be.prototype,"moreValuesButtonLabel",void 0),Oe([o.property({type:String})],Be.prototype,"noValuesLabel",void 0),Oe([i.jsonProperty([])],Be.prototype,"options",void 0),Oe([o.property({type:Boolean})],Be.prototype,"multivalued",void 0),Oe([o.property({type:Boolean})],Be.prototype,"disabled",void 0),Oe([o.property({type:Boolean})],Be.prototype,"raiseSelectedOptions",void 0),Oe([o.property({type:Number})],Be.prototype,"displayedValuesLimit",void 0),Oe([o.property({type:Boolean})],Be.prototype,"hideClearButton",void 0),Oe([o.query(".ft-filter--slot")],Be.prototype,"slotElement",void 0),Oe([o.query(".ft-filter--container")],Be.prototype,"container",void 0),Oe([o.query(".ft-filter--values")],Be.prototype,"valuesContainer",void 0),Oe([o.query(".ft-filter--levels")],Be.prototype,"levelsContainer",void 0),Oe([o.state()],Be.prototype,"lastLevelHasHiddenvalues",void 0),Oe([o.query(".ft-filter--filter input")],Be.prototype,"filterInput",void 0),Oe([o.queryAll(".ft-filter--levels ft-filter-level")],Be.prototype,"levels",void 0),Oe([o.state()],Be.prototype,"withScroll",void 0),Oe([o.state()],Be.prototype,"filter",void 0),Oe([o.state()],Be.prototype,"slideIn",void 0),Oe([o.state()],Be.prototype,"slideOut",void 0);var je=function(t,i,e,o){for(var s,r=arguments.length,n=r<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(i,e,n):s(i,e))||n);return r>3&&n&&Object.defineProperty(i,e,n),n};class Ee extends i.FtLitElement{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return e.html`
|
|
1240
1242
|
<slot class="ft-filter-option--slot" @slotchange=${this.updateSubOptionsFromSlot}></slot>
|
|
1241
1243
|
`}updateSubOptionsFromSlot(t){t.stopPropagation(),this.subOptions=this.slotElement.assignedElements().map((t=>t))}updated(t){super.updated(t),this.dispatchEvent(new CustomEvent("option-change",{detail:this,bubbles:!0}))}}Ee.elementDefinitions={},je([o.property({type:String})],Ee.prototype,"label",void 0),je([o.property({type:Object,converter:t=>t})],Ee.prototype,"value",void 0),je([o.property({type:Boolean,reflect:!0})],Ee.prototype,"selected",void 0),je([o.property({type:Object})],Ee.prototype,"subOptions",void 0),je([i.jsonProperty({})],Ee.prototype,"renderOption",void 0),je([o.query(".ft-filter-option--slot")],Ee.prototype,"slotElement",void 0),i.customElement("ft-filter")(Be),i.customElement("ft-filter-option")(Ee),t.FtFilter=Be,t.FtFilterChangeEvent=Ce,t.FtFilterCssVariables=ze,t.FtFilterLevelCssVariables=ve,t.FtFilterOption=Ee,t.levelStyles=be,t.styles=Se}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litRepeat,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML);
|
package/build/ft-filter.min.js
CHANGED
|
@@ -333,7 +333,7 @@ var bt,xt;let yt=class extends z{constructor(){super(...arguments),this.renderOp
|
|
|
333
333
|
<div class="ft-ripple--background"></div>
|
|
334
334
|
<div class="ft-ripple--effect"></div>
|
|
335
335
|
</div>
|
|
336
|
-
`}contentAvailableCallback(t){super.contentAvailableCallback(t),this.ripple&&this.resizeObserver.observe(this.ripple),this.rippleEffect&&this.rippleEffect.ontransitionstart!==this.onTransitionStart&&(this.rippleEffect.ontransitionstart=this.onTransitionStart,this.rippleEffect.ontransitionend=this.onTransitionEnd)}updated(t){var e,i;super.updated(t),t.has("disabled")&&(this.disabled?(this.endRipple(),null===(e=this.target)||void 0===e||e.removeAttribute("data-is-ft-ripple-target")):null===(i=this.target)||void 0===i||i.setAttribute("data-is-ft-ripple-target","true")),t.has("unbounded")&&this.setRippleSize()}endRipple(){this.endHover(),this.endFocus(),this.endPress(),this.rippling=!1}setRippleSize(){if(this.ripple){const t=this.ripple.getBoundingClientRect();this.rippleSize=(this.unbounded?1:1.7)*Math.max(t.width,t.height)}}connectedCallback(){super.connectedCallback(),this.setupDebouncer.run((()=>{var t;const
|
|
336
|
+
`}contentAvailableCallback(t){super.contentAvailableCallback(t),this.ripple&&this.resizeObserver.observe(this.ripple),this.rippleEffect&&this.rippleEffect.ontransitionstart!==this.onTransitionStart&&(this.rippleEffect.ontransitionstart=this.onTransitionStart,this.rippleEffect.ontransitionend=this.onTransitionEnd)}updated(t){var e,i;super.updated(t),t.has("disabled")&&(this.disabled?(this.endRipple(),null===(e=this.target)||void 0===e||e.removeAttribute("data-is-ft-ripple-target")):null===(i=this.target)||void 0===i||i.setAttribute("data-is-ft-ripple-target","true")),t.has("unbounded")&&this.setRippleSize()}endRipple(){this.endHover(),this.endFocus(),this.endPress(),this.rippling=!1}setRippleSize(){if(this.ripple){const t=this.ripple.getBoundingClientRect();this.rippleSize=(this.unbounded?1:1.7)*Math.max(t.width,t.height)}}connectedCallback(){super.connectedCallback(),this.setupDebouncer.run((()=>this.defaultSetup()))}defaultSetup(){var t,e;const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.host.parentElement;i&&this.setupFor(null!==(e=this.target)&&void 0!==e?e:i),this.setRippleSize()}setupFor(t){if(this.setupDebouncer.cancel(),this.target===t)return;this.onDisconnect&&this.onDisconnect(),this.target=t,t.setAttribute("data-is-ft-ripple-target","true");const e=(...t)=>e=>{t.forEach((t=>window.addEventListener(t,this.endPress,{once:!0}))),this.startPress(e)},i=e("mouseup","contextmenu"),o=e("touchend","touchcancel"),s=t=>{["Enter"," "].includes(t.key)&&e("keyup")(t)};t.addEventListener("mouseover",this.startHover),t.addEventListener("mousemove",this.moveRipple),t.addEventListener("mouseleave",this.endHover),t.addEventListener("mousedown",i),t.addEventListener("touchstart",o),t.addEventListener("touchmove",this.moveRipple),t.addEventListener("keydown",s),t.addEventListener("focus",this.startFocus),t.addEventListener("blur",this.endFocus),t.addEventListener("focusin",this.startFocus),t.addEventListener("focusout",this.endFocus),this.onDisconnect=()=>{t.removeAttribute("data-is-ft-ripple-target"),t.removeEventListener("mouseover",this.startHover),t.removeEventListener("mousemove",this.moveRipple),t.removeEventListener("mouseleave",this.endHover),t.removeEventListener("mousedown",i),t.removeEventListener("touchstart",o),t.removeEventListener("touchmove",this.moveRipple),t.removeEventListener("keydown",s),t.removeEventListener("focus",this.startFocus),t.removeEventListener("blur",this.endFocus),t.removeEventListener("focusin",this.startFocus),t.removeEventListener("focusout",this.endFocus),this.onDisconnect=void 0,this.target=void 0}}getCoordinates(t){const e=t,i=t;let o,s;return null!=e.x?({x:o,y:s}=e):null!=i.touches&&(o=i.touches[0].clientX,s=i.touches[0].clientY),{x:o,y:s}}isIgnored(t){if(this.disabled)return!0;if(null!=t)for(let e of t.composedPath()){if(e===this.target)break;if("hasAttribute"in e&&e.hasAttribute("data-is-ft-ripple-target"))return!0}return!1}disconnectedCallback(){super.disconnectedCallback(),this.onDisconnect&&this.onDisconnect(),this.resizeObserver.disconnect(),this.endRipple()}}Oi.elementDefinitions={},Oi.styles=wi,ki([o({type:Boolean})],Oi.prototype,"primary",void 0),ki([o({type:Boolean})],Oi.prototype,"secondary",void 0),ki([o({type:Boolean})],Oi.prototype,"unbounded",void 0),ki([o({type:Boolean})],Oi.prototype,"activated",void 0),ki([o({type:Boolean})],Oi.prototype,"selected",void 0),ki([o({type:Boolean})],Oi.prototype,"disabled",void 0),ki([s()],Oi.prototype,"hovered",void 0),ki([s()],Oi.prototype,"focused",void 0),ki([s()],Oi.prototype,"pressed",void 0),ki([s()],Oi.prototype,"rippling",void 0),ki([s()],Oi.prototype,"rippleSize",void 0),ki([s()],Oi.prototype,"originX",void 0),ki([s()],Oi.prototype,"originY",void 0),ki([n(".ft-ripple")],Oi.prototype,"ripple",void 0),ki([n(".ft-ripple--effect")],Oi.prototype,"rippleEffect",void 0),p("ft-ripple")(Oi);const Si=mt.create("--ft-tooltip-distance","SIZE","4px"),Ci=mt.create("--ft-tooltip-color","COLOR","#FFFFFF"),Ei=mt.create("--ft-tooltip-background-color","COLOR","#666666"),Ni=mt.create("--ft-tooltip-z-index","NUMBER","1"),Ri=mt.external(wt.borderRadiusS,"Design system"),zi=mt.create("--ft-tooltip-max-width","SIZE","150px"),Mi=g`
|
|
337
337
|
.ft-tooltip--container {
|
|
338
338
|
display: block;
|
|
339
339
|
position: relative;
|
|
@@ -383,7 +383,7 @@ var bt,xt;let yt=class extends z{constructor(){super(...arguments),this.renderOp
|
|
|
383
383
|
</div>
|
|
384
384
|
</div>
|
|
385
385
|
</div>
|
|
386
|
-
`}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){["visible","text"].some((e=>t.has(e)))&&this.visible&&this.positionTooltip()}show(t){this.visible=!0,null!=t&&this.hideDebounce.run((()=>this.hide()),t)}hide(){this.visible=!1}toggle(){this.visible=!this.visible}get slottedElement(){var t;return(null!==(t=this.slotNodes)&&void 0!==t?t:[]).filter((t=>t.nodeType==Node.ELEMENT_NODE))[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){const t=this.tooltipContent.style;switch(t.transition="none",this.validPosition){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px"}}}positionTooltip(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const e=t.getBoundingClientRect(),i=(e.height-this.tooltip.clientHeight)/2,o=(e.width-this.tooltip.clientWidth)/2;let s=0,r=0;switch(this.validPosition){case"top":r=-this.tooltip.clientHeight,s=o;break;case"bottom":r=e.height,s=o;break;case"left":r=i,s=-this.tooltip.clientWidth;break;case"right":r=i,s=e.width}e.left+s+this.tooltip.clientWidth>window.innerWidth&&(s=window.innerWidth-this.tooltip.clientWidth-e.left),e.left+s<0&&(s=0);const n=this.tooltip.style;n.left=s+"px",n.top=r+"px",n.maxWidth=`max(${e.width}px, ${zi})`}this.revealDebouncer.run((()=>{this.tooltipContent&&(this.tooltipContent.style.transition="top var(--ft-transition-duration, 250ms), left var(--ft-transition-duration, 250ms)",this.tooltipContent.style.top="0",this.tooltipContent.style.left="0")}),this.manual?0:this.delay)}onTouch(){this.manual||(this.show(),setTimeout((()=>window.addEventListener("touchstart",(t=>{t.composedPath().includes(this.container)||this.onOut()}),{once:!0})),100))}onHover(){this.manual||this.show()}onOut(){this.manual||(this.revealDebouncer.cancel(),this.hide())}}Bi.elementDefinitions={"ft-typography":Qe},Bi.styles=Mi,ji([o()],Bi.prototype,"text",void 0),ji([o({type:Boolean})],Bi.prototype,"manual",void 0),ji([o({type:Boolean})],Bi.prototype,"inline",void 0),ji([o({type:Number})],Bi.prototype,"delay",void 0),ji([o()],Bi.prototype,"position",void 0),ji([function(t,e,i){let o,s=t;return"object"==typeof t?(s=t.slot,o=t):o={flatten:e},i?h({slot:s,flatten:e,selector:i}):r({descriptor:t=>({get(){var t,e;const i="slot"+(s?`[name=${s}]`:":not([name])"),r=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(i);return null!==(e=null==r?void 0:r.assignedNodes(o))&&void 0!==e?e:[]},enumerable:!0,configurable:!0})})}("",!0)],Bi.prototype,"slotNodes",void 0),ji([n(".ft-tooltip--container")],Bi.prototype,"container",void 0),ji([n("slot")],Bi.prototype,"target",void 0),ji([n(".ft-tooltip")],Bi.prototype,"tooltip",void 0),ji([n(".ft-tooltip--content")],Bi.prototype,"tooltipContent",void 0),ji([s()],Bi.prototype,"visible",void 0),p("ft-tooltip")(Bi);const Fi={color:mt.extend("--ft-loader-color",wt.colorPrimary),size:mt.create("--ft-loader-size","SIZE","80px")},Ui=g`
|
|
386
|
+
`}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){super.contentAvailableCallback(t),["visible","text"].some((e=>t.has(e)))&&this.visible&&this.positionTooltip()}show(t){this.visible=!0,null!=t&&this.hideDebounce.run((()=>this.hide()),t)}hide(){this.visible=!1}toggle(){this.visible=!this.visible}get slottedElement(){var t;return(null!==(t=this.slotNodes)&&void 0!==t?t:[]).filter((t=>t.nodeType==Node.ELEMENT_NODE))[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){const t=this.tooltipContent.style;switch(t.transition="none",this.validPosition){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px"}}}positionTooltip(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const e=t.getBoundingClientRect(),i=(e.height-this.tooltip.clientHeight)/2,o=(e.width-this.tooltip.clientWidth)/2;let s=0,r=0;switch(this.validPosition){case"top":r=-this.tooltip.clientHeight,s=o;break;case"bottom":r=e.height,s=o;break;case"left":r=i,s=-this.tooltip.clientWidth;break;case"right":r=i,s=e.width}e.left+s+this.tooltip.clientWidth>window.innerWidth&&(s=window.innerWidth-this.tooltip.clientWidth-e.left),e.left+s<0&&(s=0);const n=this.tooltip.style;n.left=s+"px",n.top=r+"px",n.maxWidth=`max(${e.width}px, ${zi})`}this.revealDebouncer.run((()=>{this.tooltipContent&&(this.tooltipContent.style.transition="top var(--ft-transition-duration, 250ms), left var(--ft-transition-duration, 250ms)",this.tooltipContent.style.top="0",this.tooltipContent.style.left="0")}),this.manual?0:this.delay)}onTouch(){this.manual||(this.show(),setTimeout((()=>window.addEventListener("touchstart",(t=>{t.composedPath().includes(this.container)||this.onOut()}),{once:!0})),100))}onHover(){this.manual||this.show()}onOut(){this.manual||(this.revealDebouncer.cancel(),this.hide())}}Bi.elementDefinitions={"ft-typography":Qe},Bi.styles=Mi,ji([o()],Bi.prototype,"text",void 0),ji([o({type:Boolean})],Bi.prototype,"manual",void 0),ji([o({type:Boolean})],Bi.prototype,"inline",void 0),ji([o({type:Number})],Bi.prototype,"delay",void 0),ji([o()],Bi.prototype,"position",void 0),ji([function(t,e,i){let o,s=t;return"object"==typeof t?(s=t.slot,o=t):o={flatten:e},i?h({slot:s,flatten:e,selector:i}):r({descriptor:t=>({get(){var t,e;const i="slot"+(s?`[name=${s}]`:":not([name])"),r=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(i);return null!==(e=null==r?void 0:r.assignedNodes(o))&&void 0!==e?e:[]},enumerable:!0,configurable:!0})})}("",!0)],Bi.prototype,"slotNodes",void 0),ji([n(".ft-tooltip--container")],Bi.prototype,"container",void 0),ji([n("slot")],Bi.prototype,"target",void 0),ji([n(".ft-tooltip")],Bi.prototype,"tooltip",void 0),ji([n(".ft-tooltip--content")],Bi.prototype,"tooltipContent",void 0),ji([s()],Bi.prototype,"visible",void 0),p("ft-tooltip")(Bi);const Fi={color:mt.extend("--ft-loader-color",wt.colorPrimary),size:mt.create("--ft-loader-size","SIZE","80px")},Ui=g`
|
|
387
387
|
:host {
|
|
388
388
|
line-height: 0;
|
|
389
389
|
}
|
|
@@ -961,7 +961,7 @@ class Di extends si{constructor(t){if(super(t),this.et=tt,t.type!==ii)throw Erro
|
|
|
961
961
|
margin: 10px 0;
|
|
962
962
|
color: ${ko.colorOnSurfaceMedium};
|
|
963
963
|
}
|
|
964
|
-
`;var So=function(t,e,i,o){for(var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};class Co extends Rt{constructor(){super(...arguments),this.
|
|
964
|
+
`;var So=function(t,e,i,o){for(var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};class Co extends Rt{constructor(){super(...arguments),this.filterId="",this.options=[],this.multivalued=!1,this.disabled=!1,this.hideSelectedOptions=!1,this.preventNavigation=!1,this.filter="",this.moreValuesButtonLabel="More",this.displayedValuesLimit=0,this.displayedPages=1}get hasHiddenValues(){let t=this.limit;return null!=t&&t<this.options.length}get limit(){return this.displayedValuesLimit>0?this.displayedPages*this.displayedValuesLimit:void 0}get height(){var t,e;return null!==(e=null===(t=this.container)||void 0===t?void 0:t.scrollHeight)&&void 0!==e?e:0}render(){let t=[...this.options];this.hideSelectedOptions&&(t=t.filter((t=>!t.selected))),this.filter&&(t=t.filter((t=>t.label.toLowerCase().includes(this.filter.toLowerCase()))));const e=t.slice(0,this.limit);return Y`
|
|
965
965
|
<div class="ft-filter-level--container ${this.disabled?"ft-filter--disabled":""}">
|
|
966
966
|
${null==this.parent?null:Y`
|
|
967
967
|
<div tabindex="0"
|
|
@@ -1005,7 +1005,7 @@ class Di extends si{constructor(t){if(super(t),this.et=tt,t.type!==ii)throw Erro
|
|
|
1005
1005
|
`:tt}
|
|
1006
1006
|
</div>
|
|
1007
1007
|
`}goBackOnKeyPress(t){"Enter"!==t.key&&" "!==t.key||this.dispatchEvent(new CustomEvent("go-back",{detail:this.parent}))}goBackOnClick(t){t.stopPropagation(),t.preventDefault(),this.dispatchEvent(new CustomEvent("go-back",{detail:this.parent}))}displayMore(){this.displayedPages++}buildMultiValuedOption(t){var e;return Y`
|
|
1008
|
-
<ft-checkbox name="${this.
|
|
1008
|
+
<ft-checkbox name="${this.filterId}"
|
|
1009
1009
|
part="multivalued-option"
|
|
1010
1010
|
data-value="${t.value}"
|
|
1011
1011
|
.checked=${t.selected}
|
|
@@ -1015,7 +1015,7 @@ class Di extends si{constructor(t){if(super(t),this.et=tt,t.type!==ii)throw Erro
|
|
|
1015
1015
|
${t.renderOption?t.renderOption:t.label}
|
|
1016
1016
|
</ft-checkbox>
|
|
1017
1017
|
`}buildMonoValuedOption(t){return Y`
|
|
1018
|
-
<ft-radio name="${this.
|
|
1018
|
+
<ft-radio name="${this.filterId+Math.round(1e6*Math.random())}"
|
|
1019
1019
|
part="monovalued-option"
|
|
1020
1020
|
data-value="${t.value}"
|
|
1021
1021
|
.checked=${t.selected}
|
|
@@ -1025,7 +1025,7 @@ class Di extends si{constructor(t){if(super(t),this.et=tt,t.type!==ii)throw Erro
|
|
|
1025
1025
|
@change=${t=>t.stopPropagation()}>
|
|
1026
1026
|
${t.renderOption?t.renderOption:t.label}
|
|
1027
1027
|
</ft-radio>
|
|
1028
|
-
`}onRadioKeyUp(t,e){e.selected&&" "===t.key&&this.optionsChanged(t,e)}optionsChanged(t,e){t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{detail:e}))}displayLevel(t){this.dispatchEvent(new CustomEvent("display-level",{detail:t}))}}Co.elementDefinitions={"ft-button":io,"ft-ripple":Oi,"ft-typography":Qe,"ft-checkbox":co,"ft-icon":Ki,"ft-radio":go},Co.styles=Oo,So([o({type:String})],Co.prototype,"
|
|
1028
|
+
`}onRadioKeyUp(t,e){e.selected&&" "===t.key&&this.optionsChanged(t,e)}optionsChanged(t,e){t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{detail:e}))}displayLevel(t){this.dispatchEvent(new CustomEvent("display-level",{detail:t}))}}Co.elementDefinitions={"ft-button":io,"ft-ripple":Oi,"ft-typography":Qe,"ft-checkbox":co,"ft-icon":Ki,"ft-radio":go},Co.styles=Oo,So([o({type:String})],Co.prototype,"filterId",void 0),So([o({type:Object})],Co.prototype,"parent",void 0),So([o({type:Array})],Co.prototype,"options",void 0),So([o({type:Boolean})],Co.prototype,"multivalued",void 0),So([o({type:Boolean})],Co.prototype,"disabled",void 0),So([o({type:Boolean})],Co.prototype,"hideSelectedOptions",void 0),So([o({type:Boolean})],Co.prototype,"preventNavigation",void 0),So([o({type:String})],Co.prototype,"filter",void 0),So([o({type:String})],Co.prototype,"moreValuesButtonLabel",void 0),So([o({type:String})],Co.prototype,"noValuesLabel",void 0),So([o({type:Number})],Co.prototype,"displayedValuesLimit",void 0),So([n(".ft-filter-level--container")],Co.prototype,"container",void 0),So([s()],Co.prototype,"displayedPages",void 0);const Eo={buttonsColor:mt.extend("--ft-snap-scroll-buttons-color",wt.colorPrimary),buttonsZIndex:mt.create("--ft-snap-scroll-buttons-z-index","COLOR","1"),gap:mt.create("--ft-snap-scroll-gap","SIZE","0"),colorSurface:mt.external(wt.colorSurface,"Design system")},No=g`
|
|
1029
1029
|
.ft-snap-scroll {
|
|
1030
1030
|
box-sizing: border-box;
|
|
1031
1031
|
position: relative;
|
|
@@ -1283,30 +1283,32 @@ class Di extends si{constructor(t){if(super(t),this.et=tt,t.type!==ii)throw Erro
|
|
|
1283
1283
|
height: 0;
|
|
1284
1284
|
}
|
|
1285
1285
|
|
|
1286
|
-
slot {
|
|
1286
|
+
slot:not([name]) {
|
|
1287
1287
|
display: none;
|
|
1288
1288
|
}
|
|
1289
|
-
`];var Fo=function(t,e,i,o){for(var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};class Uo extends CustomEvent{constructor(t){super("change",{detail:t})}}class Lo extends Rt{constructor(){super(...arguments),this.id="",this.label="",this.filterPlaceHolder="Filter {0}",this.clearButtonLabel="Clear",this.moreValuesButtonLabel="More",this.noValuesLabel="No values available",this.options=[],this.multivalued=!1,this.disabled=!1,this.raiseSelectedOptions=!1,this.displayedValuesLimit=0,this.hideClearButton=!1,this.withScroll=!1,this.filter="",this.displayedLevels=[],this.scrollResizeObserver=new ResizeObserver((()=>this.updateScroll())),this.levelsScrollDebouncer=new e(300),this.changeDebouncer=new e(10)}get flatOptions(){return ti(this.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]}))}get selectedValues(){return this.flatOptions.filter((t=>t.selected)).map((t=>t.value))}render(){
|
|
1289
|
+
`];var Fo=function(t,e,i,o){for(var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};class Uo extends CustomEvent{constructor(t){super("change",{detail:t})}}class Lo extends Rt{constructor(){super(...arguments),this.id="",this.label="",this.filterPlaceHolder="Filter {0}",this.clearButtonLabel="Clear",this.moreValuesButtonLabel="More",this.noValuesLabel="No values available",this.options=[],this.multivalued=!1,this.disabled=!1,this.raiseSelectedOptions=!1,this.displayedValuesLimit=0,this.hideClearButton=!1,this.lastLevelHasHiddenvalues=!1,this.withScroll=!1,this.filter="",this.displayedLevels=[],this.scrollResizeObserver=new ResizeObserver((()=>this.updateScroll())),this.levelsScrollDebouncer=new e(300),this.changeDebouncer=new e(10),this.lastDispatchedValues=[]}get flatOptions(){return ti(this.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]}))}get selectedValues(){return this.flatOptions.filter((t=>t.selected)).map((t=>t.value))}render(){const t=this.flatOptions.some((t=>t.selected)),e=this.withScroll||this.filter||this.lastLevelHasHiddenvalues,i=this.filterPlaceHolder.replace("{0}",this.label);return Y`
|
|
1290
1290
|
<div class="ft-filter--container ${this.disabled?"ft-filter--disabled":""}"
|
|
1291
1291
|
part="container">
|
|
1292
|
-
${this.label||
|
|
1292
|
+
${this.label||t?Y`
|
|
1293
1293
|
<div class="ft-filter--header" part="header">
|
|
1294
|
-
<ft-typography class="ft-filter--label" variant="overline" part="label"
|
|
1294
|
+
<ft-typography class="ft-filter--label" variant="overline" part="label">
|
|
1295
|
+
${this.label}
|
|
1295
1296
|
</ft-typography>
|
|
1296
|
-
|
|
1297
|
+
<slot name="label"></slot>
|
|
1298
|
+
${t&&!this.hideClearButton?Y`
|
|
1297
1299
|
<ft-button icon="close" dense @click=${this.clear} part="clear-button">
|
|
1298
1300
|
${this.clearButtonLabel}
|
|
1299
1301
|
</ft-button>
|
|
1300
1302
|
`:null}
|
|
1301
1303
|
</div>
|
|
1302
1304
|
`:null}
|
|
1303
|
-
<div class="ft-filter--filter" ?hidden=${!
|
|
1305
|
+
<div class="ft-filter--filter" ?hidden=${!e}>
|
|
1304
1306
|
<input type="search"
|
|
1305
1307
|
part="input"
|
|
1306
1308
|
class="ft-typography--caption"
|
|
1307
|
-
?disabled=${!
|
|
1308
|
-
placeholder="${
|
|
1309
|
-
size="${
|
|
1309
|
+
?disabled=${!e}
|
|
1310
|
+
placeholder="${i}"
|
|
1311
|
+
size="${e?i.length:0}"
|
|
1310
1312
|
@search=${this.onFilterChange}
|
|
1311
1313
|
@keyup=${this.onFilterChange}>
|
|
1312
1314
|
</div>
|
|
@@ -1317,10 +1319,10 @@ class Di extends si{constructor(t){if(super(t),this.et=tt,t.type!==ii)throw Erro
|
|
|
1317
1319
|
@slotchange=${this.updateOptionsFromSlot}
|
|
1318
1320
|
@option-change=${this.optionsChanged}></slot>
|
|
1319
1321
|
</div>
|
|
1320
|
-
`}update(t){if(super.update(t),t.has("options")){const t=new Set(this.flatOptions.map((t=>t.value)));this.displayedLevels=this.displayedLevels.filter((e=>t.has(e)))}}contentAvailableCallback(t){var e,i;super.contentAvailableCallback(t),this.valuesContainer&&this.scrollResizeObserver.observe(this.valuesContainer),this.container&&this.scrollResizeObserver.observe(this.container),t.has("options")&&(this.updateScroll(),null===(e=this.levelsContainer)||void 0===e||e.scrollToIndex(this.displayedLevels.length)),t.has("slideIn")&&this.slideIn&&setTimeout((()=>{var t;null===(t=this.levelsContainer)||void 0===t||t.next(),this.slideIn=void 0}),0),t.has("slideOut")&&this.slideOut&&(null===(i=this.levelsContainer)||void 0===i||i.previous(),setTimeout((()=>{this.displayedLevels.pop(),this.slideOut=void 0}),300))}renderLevels(){const t=this.flatOptions,e=t.filter((t=>t.selected)),i=this.slideIn||this.slideOut?this.displayedLevels.length-2:this.displayedLevels.length-1,o=i<0?"ft-filter--level-center":"ft-filter--level-left";return Y`
|
|
1322
|
+
`}update(t){if(super.update(t),t.has("options")){const t=new Set(this.flatOptions.map((t=>t.value)));this.displayedLevels=this.displayedLevels.filter((e=>t.has(e)))}}contentAvailableCallback(t){var e,i,o,s,r;super.contentAvailableCallback(t),this.valuesContainer&&this.scrollResizeObserver.observe(this.valuesContainer),this.container&&this.scrollResizeObserver.observe(this.container),t.has("options")&&(this.updateScroll(),null===(e=this.levelsContainer)||void 0===e||e.scrollToIndex(this.displayedLevels.length)),t.has("slideIn")&&this.slideIn&&setTimeout((()=>{var t;null===(t=this.levelsContainer)||void 0===t||t.next(),this.slideIn=void 0}),0),t.has("slideOut")&&this.slideOut&&(null===(i=this.levelsContainer)||void 0===i||i.previous(),setTimeout((()=>{this.displayedLevels.pop(),this.slideOut=void 0}),300)),this.lastLevelHasHiddenvalues=null!==(r=null===(s=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelector(".ft-filter--levels ft-filter-level:last-child"))||void 0===s?void 0:s.hasHiddenValues)&&void 0!==r&&r}renderLevels(){const t=this.flatOptions,e=t.filter((t=>t.selected)),i=this.slideIn||this.slideOut?this.displayedLevels.length-2:this.displayedLevels.length-1,o=i<0?"ft-filter--level-center":"ft-filter--level-left";return Y`
|
|
1321
1323
|
${this.raiseSelectedOptions&&e.length>0?Y`
|
|
1322
1324
|
<ft-filter-level
|
|
1323
|
-
|
|
1325
|
+
filterId="${this.id}"
|
|
1324
1326
|
?multivalued=${this.multivalued}
|
|
1325
1327
|
?disabled=${this.disabled}
|
|
1326
1328
|
preventNavigation
|
|
@@ -1340,7 +1342,7 @@ class Di extends si{constructor(t){if(super(t),this.et=tt,t.type!==ii)throw Erro
|
|
|
1340
1342
|
`}renderLevel(t,e,i){return Y`
|
|
1341
1343
|
<ft-filter-level
|
|
1342
1344
|
class="${t}"
|
|
1343
|
-
|
|
1345
|
+
filterId="${this.id}"
|
|
1344
1346
|
.filter="${this.filter}"
|
|
1345
1347
|
moreValuesButtonLabel="${this.moreValuesButtonLabel}"
|
|
1346
1348
|
?multivalued=${this.multivalued}
|
|
@@ -1356,6 +1358,6 @@ class Di extends si{constructor(t){if(super(t),this.et=tt,t.type!==ii)throw Erro
|
|
|
1356
1358
|
.exportpartsPrefixes=${["values","available-values"]}
|
|
1357
1359
|
noValuesLabel="${this.noValuesLabel}"
|
|
1358
1360
|
></ft-filter-level>
|
|
1359
|
-
`}goBack(t){this.slideOut=t.detail.value}onDisplayLevel(t){this.displayedLevels.push(t.detail.value),this.slideIn=t.detail.value}clear(){if(this.flatOptions.forEach((t=>t.selected=!1)),this.displayedLevels.length>0){let t=this.displayedLevels[this.displayedLevels.length-1];this.displayedLevels=[t],this.slideOut=t}this.optionsChanged()}onChange(t){var e;t.stopPropagation();const i=this.flatOptions.find((e=>e.value===t.detail.value));i.selected=!i.selected;const o=t=>{var e;t!==i&&(t.selected=!1),null===(e=t.subOptions)||void 0===e||e.forEach(o)};this.multivalued?null===(e=i.subOptions)||void 0===e||e.forEach(o):this.options.forEach(o),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;this.
|
|
1361
|
+
`}goBack(t){this.slideOut=t.detail.value}onDisplayLevel(t){this.displayedLevels.push(t.detail.value),this.slideIn=t.detail.value}clear(){if(this.flatOptions.forEach((t=>t.selected=!1)),this.displayedLevels.length>0){let t=this.displayedLevels[this.displayedLevels.length-1];this.displayedLevels=[t],this.slideOut=t}this.optionsChanged()}onChange(t){var e;t.stopPropagation();const i=this.flatOptions.find((e=>e.value===t.detail.value));i.selected=!i.selected;const o=t=>{var e;t!==i&&(t.selected=!1),null===(e=t.subOptions)||void 0===e||e.forEach(o)};this.multivalued?null===(e=i.subOptions)||void 0===e||e.forEach(o):this.options.forEach(o),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;this.sendEventIfValuesChanged(),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}sendEventIfValuesChanged(){const t=this.selectedValues;c(this.lastDispatchedValues,t)||(this.dispatchEvent(new Uo(t)),this.lastDispatchedValues=t)}updateOptionsFromSlot(t){t.stopPropagation(),this.options=this.slotElement.assignedElements().map((t=>t)),this.optionsChanged()}onFilterChange(){var t,e;this.filter=null!==(e=null===(t=this.filterInput)||void 0===t?void 0:t.value)&&void 0!==e?e:""}updateScroll(){this.valuesContainer&&(this.withScroll=this.valuesContainer.scrollHeight>this.valuesContainer.clientHeight)}}Lo.elementDefinitions={"ft-button":io,"ft-filter-level":Co,"ft-snap-scroll":Mo,"ft-typography":Qe},Lo.styles=Bo,Fo([o({type:String})],Lo.prototype,"id",void 0),Fo([o({type:String})],Lo.prototype,"label",void 0),Fo([o({type:String})],Lo.prototype,"filterPlaceHolder",void 0),Fo([o({type:String})],Lo.prototype,"clearButtonLabel",void 0),Fo([o({type:String})],Lo.prototype,"moreValuesButtonLabel",void 0),Fo([o({type:String})],Lo.prototype,"noValuesLabel",void 0),Fo([d([])],Lo.prototype,"options",void 0),Fo([o({type:Boolean})],Lo.prototype,"multivalued",void 0),Fo([o({type:Boolean})],Lo.prototype,"disabled",void 0),Fo([o({type:Boolean})],Lo.prototype,"raiseSelectedOptions",void 0),Fo([o({type:Number})],Lo.prototype,"displayedValuesLimit",void 0),Fo([o({type:Boolean})],Lo.prototype,"hideClearButton",void 0),Fo([n(".ft-filter--slot")],Lo.prototype,"slotElement",void 0),Fo([n(".ft-filter--container")],Lo.prototype,"container",void 0),Fo([n(".ft-filter--values")],Lo.prototype,"valuesContainer",void 0),Fo([n(".ft-filter--levels")],Lo.prototype,"levelsContainer",void 0),Fo([s()],Lo.prototype,"lastLevelHasHiddenvalues",void 0),Fo([n(".ft-filter--filter input")],Lo.prototype,"filterInput",void 0),Fo([function(t){return r({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}(".ft-filter--levels ft-filter-level")],Lo.prototype,"levels",void 0),Fo([s()],Lo.prototype,"withScroll",void 0),Fo([s()],Lo.prototype,"filter",void 0),Fo([s()],Lo.prototype,"slideIn",void 0),Fo([s()],Lo.prototype,"slideOut",void 0);var Do=function(t,e,i,o){for(var s,r=arguments.length,n=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n};class To extends Rt{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return Y`
|
|
1360
1362
|
<slot class="ft-filter-option--slot" @slotchange=${this.updateSubOptionsFromSlot}></slot>
|
|
1361
1363
|
`}updateSubOptionsFromSlot(t){t.stopPropagation(),this.subOptions=this.slotElement.assignedElements().map((t=>t))}updated(t){super.updated(t),this.dispatchEvent(new CustomEvent("option-change",{detail:this,bubbles:!0}))}}To.elementDefinitions={},Do([o({type:String})],To.prototype,"label",void 0),Do([o({type:Object,converter:t=>t})],To.prototype,"value",void 0),Do([o({type:Boolean,reflect:!0})],To.prototype,"selected",void 0),Do([o({type:Object})],To.prototype,"subOptions",void 0),Do([d({})],To.prototype,"renderOption",void 0),Do([n(".ft-filter-option--slot")],To.prototype,"slotElement",void 0),p("ft-filter")(Lo),p("ft-filter-option")(To),t.FtFilter=Lo,t.FtFilterChangeEvent=Uo,t.FtFilterCssVariables=jo,t.FtFilterLevelCssVariables=ko,t.FtFilterOption=To,t.levelStyles=Oo,t.styles=Bo}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-filter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Flat selector for multivalued or monovalued filters",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-button": "1.0.
|
|
23
|
-
"@fluid-topics/ft-checkbox": "1.0.
|
|
24
|
-
"@fluid-topics/ft-icon": "1.0.
|
|
25
|
-
"@fluid-topics/ft-radio": "1.0.
|
|
26
|
-
"@fluid-topics/ft-ripple": "1.0.
|
|
27
|
-
"@fluid-topics/ft-snap-scroll": "1.0.
|
|
28
|
-
"@fluid-topics/ft-typography": "1.0.
|
|
29
|
-
"@fluid-topics/ft-wc-utils": "1.0.
|
|
22
|
+
"@fluid-topics/ft-button": "1.0.4",
|
|
23
|
+
"@fluid-topics/ft-checkbox": "1.0.4",
|
|
24
|
+
"@fluid-topics/ft-icon": "1.0.4",
|
|
25
|
+
"@fluid-topics/ft-radio": "1.0.4",
|
|
26
|
+
"@fluid-topics/ft-ripple": "1.0.4",
|
|
27
|
+
"@fluid-topics/ft-snap-scroll": "1.0.4",
|
|
28
|
+
"@fluid-topics/ft-typography": "1.0.4",
|
|
29
|
+
"@fluid-topics/ft-wc-utils": "1.0.4",
|
|
30
30
|
"lit": "2.7.2"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "73efa63448237c9b05c59823cd70ee3bc019995e"
|
|
33
33
|
}
|