@fluid-topics/ft-search-bar 0.3.40 → 0.3.43

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.
@@ -5,6 +5,7 @@ import { FtInputLabelCssVariables } from "@fluid-topics/ft-input-label/build/ft-
5
5
  import { FtSelectCssVariables } from "@fluid-topics/ft-select/build/ft-select.css";
6
6
  import { FtSkeletonCssVariables } from "@fluid-topics/ft-skeleton/build/ft-skeleton.css";
7
7
  import { FtTooltipCssVariables } from "@fluid-topics/ft-tooltip/build/ft-tooltip.css";
8
+ import { FtSnapScrollCssVariables } from "@fluid-topics/ft-snap-scroll/build/ft-snap-scroll.css";
8
9
  export const FtSearchBarCssVariables = {
9
10
  height: FtCssVariableFactory.create("--ft-search-bar-height", "SIZE", "38px"),
10
11
  borderRadius: FtCssVariableFactory.extend("--ft-search-bar-border-radius", designSystemVariables.borderRadiusS),
@@ -245,7 +246,7 @@ export const facetsCss = css `
245
246
  .ft-search-bar--desktop-menu .ft-search-bar--filters-container {
246
247
  display: block;
247
248
  height: ${FtSearchBarCssVariables.desktopFiltersHeight};
248
- --ft-snap-scroll-gap: 16px;
249
+ ${setVariable(FtSnapScrollCssVariables.gap, "16px")};
249
250
  }
250
251
 
251
252
  .ft-search-bar--desktop-menu ft-filter {
@@ -255,8 +256,32 @@ export const facetsCss = css `
255
256
  max-width: 250px;
256
257
  }
257
258
 
259
+ .ft-search-bar--desktop-menu [data-filters-count="1"] ft-filter {
260
+ max-width: 100%;
261
+ }
262
+
263
+ .ft-search-bar--desktop-menu [data-filters-count="2"] ft-filter {
264
+ max-width: calc(50% - ${FtSnapScrollCssVariables.gap} / 2);
265
+ }
266
+
267
+ .ft-search-bar--desktop-menu [data-filters-count="3"] ft-filter {
268
+ max-width: max(250px, calc(33% - 2 * ${FtSnapScrollCssVariables.gap} / 3));
269
+ }
270
+
271
+ .ft-search-bar--desktop-menu [data-filters-count="4"] ft-filter {
272
+ max-width: max(250px, calc(25% - 3 * ${FtSnapScrollCssVariables.gap} / 4));
273
+ }
274
+
258
275
  .ft-search-bar--hierarchical-filter {
259
- width: 250px;
276
+ min-width: 250px;
277
+ width: 33%;
278
+ }
279
+
280
+ .ft-search-bar--desktop-menu ft-filter::part(label) {
281
+ display: -webkit-box;
282
+ overflow: hidden;
283
+ -webkit-line-clamp: 4;
284
+ -webkit-box-orient: vertical;
260
285
  }
261
286
 
262
287
  .ft-search-bar--mobile .ft-search-bar--filters-container {
@@ -314,7 +314,8 @@ export class FtSearchBar extends FtLitElement {
314
314
  <ft-snap-scroll horizontal limitSize controls
315
315
  class="ft-search-bar--filters-container"
316
316
  part="filters-container"
317
- exportpartsPrefix="filters-container">
317
+ exportpartsPrefix="filters-container"
318
+ data-filters-count="${this.facets.length + (this.hasLocaleSelector() ? 1 : 0)}">
318
319
  ${this.hasLocaleSelector() ? html `
319
320
  <ft-filter
320
321
  id="ft:locale"
@@ -1055,114 +1055,118 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
1055
1055
  ></ft-button>
1056
1056
  </div>
1057
1057
  `}updated(t){var e;super.updated(t),this.contentSlot&&(this.resizeObserver.observe(this.contentSlot),this.listenedContainer!==this.contentSlot&&(this.listenedContainer&&this.listenedContainer.removeEventListener("scroll",this.updateScrollCallback),this.listenedContainer=this.contentSlot,null===(e=this.listenedContainer)||void 0===e||e.addEventListener("scroll",this.updateScrollCallback))),t.has("horizontal")&&(this.horizontal?(this.offsetAttribute="offsetLeft",this.scrollAttribute="scrollLeft",this.sizeAttribute="clientWidth",this.scrollSizeAttribute="scrollWidth"):(this.offsetAttribute="offsetTop",this.scrollAttribute="scrollTop",this.sizeAttribute="clientHeight",this.scrollSizeAttribute="scrollHeight")),t.has("currentElement")&&this.dispatchEvent(new fi(this.currentElement,this.elements[this.currentElement]))}onScroll(){this.scrollDebouncer.run((()=>this.snap())),this.scheduleUpdateScroll()}snap(){let t=this.closestElementFromStart();if(null!=t){const e=this.getDistanceFromStart(t);Math.abs(this.contentSlot[this.scrollAttribute]+this.contentSlot[this.sizeAttribute]-this.contentSlot[this.scrollSizeAttribute])<e&&(t=this.lastElement),this.scrollToElement(t)}}scrollToElement(t){var e,i;t&&(this.horizontal?null===(e=this.contentSlot)||void 0===e||e.scrollTo({left:this.getOffset(t)-this.controlsSize,behavior:"smooth"}):null===(i=this.contentSlot)||void 0===i||i.scrollTo({top:this.getOffset(t)-this.controlsSize,behavior:"smooth"}),this.currentElement=this.elements.indexOf(t))}onSlotChange(){var t,e;this.elements=null!==(e=null===(t=this.contentSlot)||void 0===t?void 0:t.assignedElements().map((t=>t)))&&void 0!==e?e:[],this.scheduleUpdateScroll()}closestElementFromStart(){return this.elements[this.closestIndexFromStart()]}closestIndexFromStart(){let t=-1;for(let e=0;e<this.elements.length;e++)(t<0||this.getDistanceFromStart(this.elements[e])<this.getDistanceFromStart(this.elements[t]))&&(t=e);return t}scheduleUpdateScroll(){this.updateScrollDebouncer.run((()=>this.updateScroll()))}updateScroll(){null!=this.contentSlot?(this.withScroll=this.contentSlot[this.scrollSizeAttribute]>this.contentSlot[this.sizeAttribute],this.startReached=0===this.contentSlot[this.scrollAttribute],this.endReached=this.contentSlot[this.scrollAttribute]+this.contentSlot[this.sizeAttribute]+1>=this.contentSlot[this.scrollSizeAttribute]):(this.withScroll=!1,this.startReached=!0,this.endReached=!0)}get lastElement(){return this.elements[this.elements.length-1]}get firstElementOffset(){let t=this.elements[0];return t?t[this.offsetAttribute]:0}get controlsSize(){return this.controls?36:0}get nextSize(){return this.endReached?0:this.controlsSize}get prevSize(){return this.startReached?0:this.controlsSize}getOffset(t){return t[this.offsetAttribute]-this.firstElementOffset}getDistanceFromStart(t){const e=t===this.elements[0]?0:this.controlsSize;return Math.abs(this.getOffset(t)-this.contentSlot[this.scrollAttribute]-e)}}di.elementDefinitions={"ft-button":Te},di.styles=hi,pi([o.property({type:Boolean})],di.prototype,"horizontal",void 0),pi([o.property({type:Boolean})],di.prototype,"hideScrollbar",void 0),pi([o.property({type:Boolean})],di.prototype,"controls",void 0),pi([o.property({type:Boolean})],di.prototype,"limitSize",void 0),pi([o.state()],di.prototype,"elements",void 0),pi([o.state()],di.prototype,"currentElement",void 0),pi([o.state()],di.prototype,"withScroll",void 0),pi([o.state()],di.prototype,"startReached",void 0),pi([o.state()],di.prototype,"endReached",void 0),pi([o.query(".ft-snap-scroll--content")],di.prototype,"contentSlot",void 0),e.customElement("ft-snap-scroll")(di);const ui=e.FtCssVariableFactory.external(e.designSystemVariables.colorOutline,"Design system"),bi=e.FtCssVariableFactory.external(e.designSystemVariables.colorOnSurface,"Design system"),vi=e.FtCssVariableFactory.external(e.designSystemVariables.colorOnSurfaceMedium,"Design system"),gi=e.FtCssVariableFactory.external(e.designSystemVariables.colorPrimary,"Design system"),xi=e.FtCssVariableFactory.external(e.designSystemVariables.colorSurface,"Design system"),yi=e.FtCssVariableFactory.external(e.designSystemVariables.transitionDuration,"Design system"),mi=e.FtCssVariableFactory.external(e.designSystemVariables.transitionTimingFunction,"Design system"),$i=[Wt,i.css`
1058
- :host {
1059
- display: flex;
1060
- max-height: 100%;
1061
- max-width: 100%;
1062
- }
1058
+ :host {
1059
+ display: flex;
1060
+ max-height: 100%;
1061
+ max-width: 100%;
1062
+ }
1063
1063
 
1064
- .ft-filter--container {
1065
- flex-grow: 1;
1066
- display: flex;
1067
- flex-direction: column;
1068
- max-height: 100%;
1069
- max-width: 100%;
1070
- color: ${bi};
1071
- }
1064
+ .ft-filter--container {
1065
+ flex-grow: 1;
1066
+ display: flex;
1067
+ flex-direction: column;
1068
+ max-height: 100%;
1069
+ max-width: 100%;
1070
+ color: ${bi};
1071
+ }
1072
1072
 
1073
- .ft-filter--header {
1074
- display: flex;
1075
- flex-wrap: wrap;
1076
- gap: 4px;
1077
- flex-shrink: 0;
1078
- padding: 0 10px;
1079
- margin-bottom: 8px;
1080
- ${e.setVariable(et.fontSize,"14px")};
1081
- }
1073
+ .ft-filter--header {
1074
+ display: flex;
1075
+ flex-wrap: wrap;
1076
+ gap: 4px;
1077
+ flex-shrink: 0;
1078
+ padding: 0 10px;
1079
+ margin-bottom: 8px;
1080
+ ${e.setVariable(et.fontSize,"14px")};
1081
+ }
1082
1082
 
1083
- .ft-filter--header ft-button {
1084
- flex-shrink: 0;
1085
- margin-left: auto;
1086
- ${e.setVariable(Le.iconSize,"18px")};
1087
- }
1083
+ .ft-filter--header ft-button {
1084
+ flex-shrink: 0;
1085
+ margin-left: auto;
1086
+ ${e.setVariable(Le.iconSize,"18px")};
1087
+ }
1088
1088
 
1089
- .ft-filter--label {
1090
- display: block;
1091
- flex-shrink: 1;
1092
- flex-grow: 1;
1093
- word-break: break-word;
1094
- ${e.setVariable(et.lineHeight,"22px")};
1095
- ${e.setVariable(et.fontWeight,"bold")};
1096
- }
1089
+ .ft-filter--label {
1090
+ display: block;
1091
+ flex-shrink: 1;
1092
+ flex-grow: 1;
1093
+ word-break: break-word;
1094
+ ${e.setVariable(et.lineHeight,"22px")};
1095
+ ${e.setVariable(et.fontWeight,"bold")};
1096
+ }
1097
1097
 
1098
- .ft-filter--filter {
1099
- flex-shrink: 0;
1100
- display: flex;
1101
- margin: 0;
1102
- margin-bottom: 8px;
1103
- padding: 0 10px;
1104
- overflow: hidden;
1105
- height: 32px;
1106
- transition: height ${yi} ${mi},
1107
- margin ${yi} ${mi};
1108
- transition-delay: 500ms;
1109
- }
1098
+ .ft-filter--filter {
1099
+ flex-shrink: 0;
1100
+ display: flex;
1101
+ margin: 0;
1102
+ margin-bottom: 8px;
1103
+ padding: 0 10px;
1104
+ overflow: hidden;
1105
+ height: 32px;
1106
+ transition: height ${yi} ${mi},
1107
+ margin ${yi} ${mi};
1108
+ transition-delay: 500ms;
1109
+ }
1110
1110
 
1111
- .ft-filter--filter[hidden] {
1112
- height: 0;
1113
- margin-bottom: 0;
1114
- }
1111
+ .ft-filter--filter[hidden] {
1112
+ height: 0;
1113
+ margin-bottom: 0;
1114
+ }
1115
1115
 
1116
- input {
1117
- display: block;
1118
- width: 100%;
1119
- border-radius: 4px;
1120
- border: 1px solid ${ui};
1121
- padding: 4px;
1122
- background-color: ${xi};
1123
- color: ${bi};
1124
- outline-color: ${gi};
1125
- }
1116
+ input {
1117
+ display: block;
1118
+ width: 100%;
1119
+ border-radius: 4px;
1120
+ border: 1px solid ${ui};
1121
+ padding: 4px;
1122
+ background-color: ${xi};
1123
+ color: ${bi};
1124
+ outline-color: ${gi};
1125
+ }
1126
1126
 
1127
- input::placeholder {
1128
- color: ${vi};
1129
- }
1127
+ input::placeholder {
1128
+ color: ${vi};
1129
+ }
1130
1130
 
1131
- .ft-filter--values {
1132
- flex-grow: 1;
1133
- flex-shrink: 1;
1134
- max-width: 100%;
1135
- overflow-x: hidden;
1136
- overflow-y: auto;
1137
- }
1131
+ input:placeholder-shown {
1132
+ text-overflow: ellipsis;
1133
+ }
1138
1134
 
1139
- .ft-filter--separator {
1140
- border-top: 1px solid ${ui};
1141
- margin: 4px 10px;
1142
- }
1135
+ .ft-filter--values {
1136
+ flex-grow: 1;
1137
+ flex-shrink: 1;
1138
+ max-width: 100%;
1139
+ overflow-x: hidden;
1140
+ overflow-y: auto;
1141
+ }
1143
1142
 
1144
- .ft-filter--levels-container {
1145
- position: relative;
1146
- overflow: hidden;
1147
- }
1143
+ .ft-filter--separator {
1144
+ border-top: 1px solid ${ui};
1145
+ margin: 4px 10px;
1146
+ }
1148
1147
 
1149
- .ft-filter--levels {
1150
- position: relative;
1151
- overflow: hidden;
1152
- }
1148
+ .ft-filter--levels-container {
1149
+ position: relative;
1150
+ overflow: hidden;
1151
+ }
1153
1152
 
1154
- ft-filter-level {
1155
- width: 100%;
1156
- }
1153
+ .ft-filter--levels {
1154
+ position: relative;
1155
+ overflow: hidden;
1156
+ }
1157
1157
 
1158
- .ft-filter--level-left {
1159
- height: 0;
1160
- }
1158
+ ft-filter-level {
1159
+ width: 100%;
1160
+ }
1161
1161
 
1162
- slot {
1163
- display: none;
1164
- }
1165
- `];var wi=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 ki extends CustomEvent{constructor(t){super("change",{detail:t})}}class Si extends e.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 e.Debouncer(300),this.changeDebouncer=new e.Debouncer(10)}get flatOptions(){return ee(this.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]}))}render(){var t,e;const o=this.flatOptions.some((t=>t.selected));let s=this.withScroll||this.filter||null!==(e=null===(t=this.lastLevel)||void 0===t?void 0:t.hasHiddenValues)&&void 0!==e&&e;return i.html`
1162
+ .ft-filter--level-left {
1163
+ height: 0;
1164
+ }
1165
+
1166
+ slot {
1167
+ display: none;
1168
+ }
1169
+ `];var wi=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 ki extends CustomEvent{constructor(t){super("change",{detail:t})}}class Si extends e.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 e.Debouncer(300),this.changeDebouncer=new e.Debouncer(10)}get flatOptions(){return ee(this.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]}))}render(){var t,e;const o=this.flatOptions.some((t=>t.selected)),s=this.withScroll||this.filter||null!==(e=null===(t=this.lastLevel)||void 0===t?void 0:t.hasHiddenValues)&&void 0!==e&&e,r=this.filterPlaceHolder.replace("{0}",this.label);return i.html`
1166
1170
  <div class="ft-filter--container ${this.disabled?"ft-filter--disabled":""}"
1167
1171
  part="container">
1168
1172
  ${this.label||o?i.html`
@@ -1181,7 +1185,8 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
1181
1185
  part="input"
1182
1186
  class="ft-typography--caption"
1183
1187
  ?disabled=${!s}
1184
- placeholder="${this.filterPlaceHolder.replace("{0}",this.label)}"
1188
+ placeholder="${r}"
1189
+ size="${s?r.length:0}"
1185
1190
  @search=${this.onFilterChange}
1186
1191
  @keyup=${this.onFilterChange}>
1187
1192
  </div>
@@ -2024,7 +2029,7 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
2024
2029
  .ft-search-bar--desktop-menu .ft-search-bar--filters-container {
2025
2030
  display: block;
2026
2031
  height: ${oo.desktopFiltersHeight};
2027
- --ft-snap-scroll-gap: 16px;
2032
+ ${e.setVariable(ci.gap,"16px")};
2028
2033
  }
2029
2034
 
2030
2035
  .ft-search-bar--desktop-menu ft-filter {
@@ -2034,8 +2039,32 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
2034
2039
  max-width: 250px;
2035
2040
  }
2036
2041
 
2042
+ .ft-search-bar--desktop-menu [data-filters-count="1"] ft-filter {
2043
+ max-width: 100%;
2044
+ }
2045
+
2046
+ .ft-search-bar--desktop-menu [data-filters-count="2"] ft-filter {
2047
+ max-width: calc(50% - ${ci.gap} / 2);
2048
+ }
2049
+
2050
+ .ft-search-bar--desktop-menu [data-filters-count="3"] ft-filter {
2051
+ max-width: max(250px, calc(33% - 2 * ${ci.gap} / 3));
2052
+ }
2053
+
2054
+ .ft-search-bar--desktop-menu [data-filters-count="4"] ft-filter {
2055
+ max-width: max(250px, calc(25% - 3 * ${ci.gap} / 4));
2056
+ }
2057
+
2037
2058
  .ft-search-bar--hierarchical-filter {
2038
- width: 250px;
2059
+ min-width: 250px;
2060
+ width: 33%;
2061
+ }
2062
+
2063
+ .ft-search-bar--desktop-menu ft-filter::part(label) {
2064
+ display: -webkit-box;
2065
+ overflow: hidden;
2066
+ -webkit-line-clamp: 4;
2067
+ -webkit-box-orient: vertical;
2039
2068
  }
2040
2069
 
2041
2070
  .ft-search-bar--mobile .ft-search-bar--filters-container {
@@ -2499,7 +2528,8 @@ const q=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===q)return null==t?void 0:t
2499
2528
  <ft-snap-scroll horizontal limitSize controls
2500
2529
  class="ft-search-bar--filters-container"
2501
2530
  part="filters-container"
2502
- exportpartsPrefix="filters-container">
2531
+ exportpartsPrefix="filters-container"
2532
+ data-filters-count="${this.facets.length+(this.hasLocaleSelector()?1:0)}">
2503
2533
  ${this.hasLocaleSelector()?i.html`
2504
2534
  <ft-filter
2505
2535
  id="ft:locale"
@@ -1187,114 +1187,118 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
1187
1187
  ></ft-button>
1188
1188
  </div>
1189
1189
  `}updated(t){var e;super.updated(t),this.contentSlot&&(this.resizeObserver.observe(this.contentSlot),this.listenedContainer!==this.contentSlot&&(this.listenedContainer&&this.listenedContainer.removeEventListener("scroll",this.updateScrollCallback),this.listenedContainer=this.contentSlot,null===(e=this.listenedContainer)||void 0===e||e.addEventListener("scroll",this.updateScrollCallback))),t.has("horizontal")&&(this.horizontal?(this.offsetAttribute="offsetLeft",this.scrollAttribute="scrollLeft",this.sizeAttribute="clientWidth",this.scrollSizeAttribute="scrollWidth"):(this.offsetAttribute="offsetTop",this.scrollAttribute="scrollTop",this.sizeAttribute="clientHeight",this.scrollSizeAttribute="scrollHeight")),t.has("currentElement")&&this.dispatchEvent(new vo(this.currentElement,this.elements[this.currentElement]))}onScroll(){this.scrollDebouncer.run((()=>this.snap())),this.scheduleUpdateScroll()}snap(){let t=this.closestElementFromStart();if(null!=t){const e=this.getDistanceFromStart(t);Math.abs(this.contentSlot[this.scrollAttribute]+this.contentSlot[this.sizeAttribute]-this.contentSlot[this.scrollSizeAttribute])<e&&(t=this.lastElement),this.scrollToElement(t)}}scrollToElement(t){var e,i;t&&(this.horizontal?null===(e=this.contentSlot)||void 0===e||e.scrollTo({left:this.getOffset(t)-this.controlsSize,behavior:"smooth"}):null===(i=this.contentSlot)||void 0===i||i.scrollTo({top:this.getOffset(t)-this.controlsSize,behavior:"smooth"}),this.currentElement=this.elements.indexOf(t))}onSlotChange(){var t,e;this.elements=null!==(e=null===(t=this.contentSlot)||void 0===t?void 0:t.assignedElements().map((t=>t)))&&void 0!==e?e:[],this.scheduleUpdateScroll()}closestElementFromStart(){return this.elements[this.closestIndexFromStart()]}closestIndexFromStart(){let t=-1;for(let e=0;e<this.elements.length;e++)(t<0||this.getDistanceFromStart(this.elements[e])<this.getDistanceFromStart(this.elements[t]))&&(t=e);return t}scheduleUpdateScroll(){this.updateScrollDebouncer.run((()=>this.updateScroll()))}updateScroll(){null!=this.contentSlot?(this.withScroll=this.contentSlot[this.scrollSizeAttribute]>this.contentSlot[this.sizeAttribute],this.startReached=0===this.contentSlot[this.scrollAttribute],this.endReached=this.contentSlot[this.scrollAttribute]+this.contentSlot[this.sizeAttribute]+1>=this.contentSlot[this.scrollSizeAttribute]):(this.withScroll=!1,this.startReached=!0,this.endReached=!0)}get lastElement(){return this.elements[this.elements.length-1]}get firstElementOffset(){let t=this.elements[0];return t?t[this.offsetAttribute]:0}get controlsSize(){return this.controls?36:0}get nextSize(){return this.endReached?0:this.controlsSize}get prevSize(){return this.startReached?0:this.controlsSize}getOffset(t){return t[this.offsetAttribute]-this.firstElementOffset}getDistanceFromStart(t){const e=t===this.elements[0]?0:this.controlsSize;return Math.abs(this.getOffset(t)-this.contentSlot[this.scrollAttribute]-e)}}go.elementDefinitions={"ft-button":_i},go.styles=uo,bo([o({type:Boolean})],go.prototype,"horizontal",void 0),bo([o({type:Boolean})],go.prototype,"hideScrollbar",void 0),bo([o({type:Boolean})],go.prototype,"controls",void 0),bo([o({type:Boolean})],go.prototype,"limitSize",void 0),bo([s()],go.prototype,"elements",void 0),bo([s()],go.prototype,"currentElement",void 0),bo([s()],go.prototype,"withScroll",void 0),bo([s()],go.prototype,"startReached",void 0),bo([s()],go.prototype,"endReached",void 0),bo([n(".ft-snap-scroll--content")],go.prototype,"contentSlot",void 0),h("ft-snap-scroll")(go);const xo=xt.external(mt.colorOutline,"Design system"),yo=xt.external(mt.colorOnSurface,"Design system"),mo=xt.external(mt.colorOnSurfaceMedium,"Design system"),$o=xt.external(mt.colorPrimary,"Design system"),wo=xt.external(mt.colorSurface,"Design system"),ko=xt.external(mt.transitionDuration,"Design system"),So=xt.external(mt.transitionTimingFunction,"Design system"),Oo=[qe,y`
1190
- :host {
1191
- display: flex;
1192
- max-height: 100%;
1193
- max-width: 100%;
1194
- }
1190
+ :host {
1191
+ display: flex;
1192
+ max-height: 100%;
1193
+ max-width: 100%;
1194
+ }
1195
1195
 
1196
- .ft-filter--container {
1197
- flex-grow: 1;
1198
- display: flex;
1199
- flex-direction: column;
1200
- max-height: 100%;
1201
- max-width: 100%;
1202
- color: ${yo};
1203
- }
1196
+ .ft-filter--container {
1197
+ flex-grow: 1;
1198
+ display: flex;
1199
+ flex-direction: column;
1200
+ max-height: 100%;
1201
+ max-width: 100%;
1202
+ color: ${yo};
1203
+ }
1204
1204
 
1205
- .ft-filter--header {
1206
- display: flex;
1207
- flex-wrap: wrap;
1208
- gap: 4px;
1209
- flex-shrink: 0;
1210
- padding: 0 10px;
1211
- margin-bottom: 8px;
1212
- ${yt(ee.fontSize,"14px")};
1213
- }
1205
+ .ft-filter--header {
1206
+ display: flex;
1207
+ flex-wrap: wrap;
1208
+ gap: 4px;
1209
+ flex-shrink: 0;
1210
+ padding: 0 10px;
1211
+ margin-bottom: 8px;
1212
+ ${yt(ee.fontSize,"14px")};
1213
+ }
1214
1214
 
1215
- .ft-filter--header ft-button {
1216
- flex-shrink: 0;
1217
- margin-left: auto;
1218
- ${yt(ji.iconSize,"18px")};
1219
- }
1215
+ .ft-filter--header ft-button {
1216
+ flex-shrink: 0;
1217
+ margin-left: auto;
1218
+ ${yt(ji.iconSize,"18px")};
1219
+ }
1220
1220
 
1221
- .ft-filter--label {
1222
- display: block;
1223
- flex-shrink: 1;
1224
- flex-grow: 1;
1225
- word-break: break-word;
1226
- ${yt(ee.lineHeight,"22px")};
1227
- ${yt(ee.fontWeight,"bold")};
1228
- }
1221
+ .ft-filter--label {
1222
+ display: block;
1223
+ flex-shrink: 1;
1224
+ flex-grow: 1;
1225
+ word-break: break-word;
1226
+ ${yt(ee.lineHeight,"22px")};
1227
+ ${yt(ee.fontWeight,"bold")};
1228
+ }
1229
1229
 
1230
- .ft-filter--filter {
1231
- flex-shrink: 0;
1232
- display: flex;
1233
- margin: 0;
1234
- margin-bottom: 8px;
1235
- padding: 0 10px;
1236
- overflow: hidden;
1237
- height: 32px;
1238
- transition: height ${ko} ${So},
1239
- margin ${ko} ${So};
1240
- transition-delay: 500ms;
1241
- }
1230
+ .ft-filter--filter {
1231
+ flex-shrink: 0;
1232
+ display: flex;
1233
+ margin: 0;
1234
+ margin-bottom: 8px;
1235
+ padding: 0 10px;
1236
+ overflow: hidden;
1237
+ height: 32px;
1238
+ transition: height ${ko} ${So},
1239
+ margin ${ko} ${So};
1240
+ transition-delay: 500ms;
1241
+ }
1242
1242
 
1243
- .ft-filter--filter[hidden] {
1244
- height: 0;
1245
- margin-bottom: 0;
1246
- }
1243
+ .ft-filter--filter[hidden] {
1244
+ height: 0;
1245
+ margin-bottom: 0;
1246
+ }
1247
1247
 
1248
- input {
1249
- display: block;
1250
- width: 100%;
1251
- border-radius: 4px;
1252
- border: 1px solid ${xo};
1253
- padding: 4px;
1254
- background-color: ${wo};
1255
- color: ${yo};
1256
- outline-color: ${$o};
1257
- }
1248
+ input {
1249
+ display: block;
1250
+ width: 100%;
1251
+ border-radius: 4px;
1252
+ border: 1px solid ${xo};
1253
+ padding: 4px;
1254
+ background-color: ${wo};
1255
+ color: ${yo};
1256
+ outline-color: ${$o};
1257
+ }
1258
1258
 
1259
- input::placeholder {
1260
- color: ${mo};
1261
- }
1259
+ input::placeholder {
1260
+ color: ${mo};
1261
+ }
1262
1262
 
1263
- .ft-filter--values {
1264
- flex-grow: 1;
1265
- flex-shrink: 1;
1266
- max-width: 100%;
1267
- overflow-x: hidden;
1268
- overflow-y: auto;
1269
- }
1263
+ input:placeholder-shown {
1264
+ text-overflow: ellipsis;
1265
+ }
1270
1266
 
1271
- .ft-filter--separator {
1272
- border-top: 1px solid ${xo};
1273
- margin: 4px 10px;
1274
- }
1267
+ .ft-filter--values {
1268
+ flex-grow: 1;
1269
+ flex-shrink: 1;
1270
+ max-width: 100%;
1271
+ overflow-x: hidden;
1272
+ overflow-y: auto;
1273
+ }
1275
1274
 
1276
- .ft-filter--levels-container {
1277
- position: relative;
1278
- overflow: hidden;
1279
- }
1275
+ .ft-filter--separator {
1276
+ border-top: 1px solid ${xo};
1277
+ margin: 4px 10px;
1278
+ }
1280
1279
 
1281
- .ft-filter--levels {
1282
- position: relative;
1283
- overflow: hidden;
1284
- }
1280
+ .ft-filter--levels-container {
1281
+ position: relative;
1282
+ overflow: hidden;
1283
+ }
1285
1284
 
1286
- ft-filter-level {
1287
- width: 100%;
1288
- }
1285
+ .ft-filter--levels {
1286
+ position: relative;
1287
+ overflow: hidden;
1288
+ }
1289
1289
 
1290
- .ft-filter--level-left {
1291
- height: 0;
1292
- }
1290
+ ft-filter-level {
1291
+ width: 100%;
1292
+ }
1293
1293
 
1294
- slot {
1295
- display: none;
1296
- }
1297
- `];var Co=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 Eo extends CustomEvent{constructor(t){super("change",{detail:t})}}class zo extends wt{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 ei(this.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]}))}render(){var t,e;const i=this.flatOptions.some((t=>t.selected));let o=this.withScroll||this.filter||null!==(e=null===(t=this.lastLevel)||void 0===t?void 0:t.hasHiddenValues)&&void 0!==e&&e;return X`
1294
+ .ft-filter--level-left {
1295
+ height: 0;
1296
+ }
1297
+
1298
+ slot {
1299
+ display: none;
1300
+ }
1301
+ `];var Co=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 Eo extends CustomEvent{constructor(t){super("change",{detail:t})}}class zo extends wt{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 ei(this.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]}))}render(){var t,e;const i=this.flatOptions.some((t=>t.selected)),o=this.withScroll||this.filter||null!==(e=null===(t=this.lastLevel)||void 0===t?void 0:t.hasHiddenValues)&&void 0!==e&&e,s=this.filterPlaceHolder.replace("{0}",this.label);return X`
1298
1302
  <div class="ft-filter--container ${this.disabled?"ft-filter--disabled":""}"
1299
1303
  part="container">
1300
1304
  ${this.label||i?X`
@@ -1313,7 +1317,8 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
1313
1317
  part="input"
1314
1318
  class="ft-typography--caption"
1315
1319
  ?disabled=${!o}
1316
- placeholder="${this.filterPlaceHolder.replace("{0}",this.label)}"
1320
+ placeholder="${s}"
1321
+ size="${o?s.length:0}"
1317
1322
  @search=${this.onFilterChange}
1318
1323
  @keyup=${this.onFilterChange}>
1319
1324
  </div>
@@ -2156,7 +2161,7 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
2156
2161
  .ft-search-bar--desktop-menu .ft-search-bar--filters-container {
2157
2162
  display: block;
2158
2163
  height: ${ls.desktopFiltersHeight};
2159
- --ft-snap-scroll-gap: 16px;
2164
+ ${yt(fo.gap,"16px")};
2160
2165
  }
2161
2166
 
2162
2167
  .ft-search-bar--desktop-menu ft-filter {
@@ -2166,8 +2171,32 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
2166
2171
  max-width: 250px;
2167
2172
  }
2168
2173
 
2174
+ .ft-search-bar--desktop-menu [data-filters-count="1"] ft-filter {
2175
+ max-width: 100%;
2176
+ }
2177
+
2178
+ .ft-search-bar--desktop-menu [data-filters-count="2"] ft-filter {
2179
+ max-width: calc(50% - ${fo.gap} / 2);
2180
+ }
2181
+
2182
+ .ft-search-bar--desktop-menu [data-filters-count="3"] ft-filter {
2183
+ max-width: max(250px, calc(33% - 2 * ${fo.gap} / 3));
2184
+ }
2185
+
2186
+ .ft-search-bar--desktop-menu [data-filters-count="4"] ft-filter {
2187
+ max-width: max(250px, calc(25% - 3 * ${fo.gap} / 4));
2188
+ }
2189
+
2169
2190
  .ft-search-bar--hierarchical-filter {
2170
- width: 250px;
2191
+ min-width: 250px;
2192
+ width: 33%;
2193
+ }
2194
+
2195
+ .ft-search-bar--desktop-menu ft-filter::part(label) {
2196
+ display: -webkit-box;
2197
+ overflow: hidden;
2198
+ -webkit-line-clamp: 4;
2199
+ -webkit-box-orient: vertical;
2171
2200
  }
2172
2201
 
2173
2202
  .ft-search-bar--mobile .ft-search-bar--filters-container {
@@ -2631,7 +2660,8 @@ class Si extends Rt{constructor(t){if(super(t),this.it=Q,t.type!==Nt)throw Error
2631
2660
  <ft-snap-scroll horizontal limitSize controls
2632
2661
  class="ft-search-bar--filters-container"
2633
2662
  part="filters-container"
2634
- exportpartsPrefix="filters-container">
2663
+ exportpartsPrefix="filters-container"
2664
+ data-filters-count="${this.facets.length+(this.hasLocaleSelector()?1:0)}">
2635
2665
  ${this.hasLocaleSelector()?X`
2636
2666
  <ft-filter
2637
2667
  id="ft:locale"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-search-bar",
3
- "version": "0.3.40",
3
+ "version": "0.3.43",
4
4
  "description": "Search bar component using Fluid Topics public API",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,18 +19,18 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-accordion": "0.3.40",
23
- "@fluid-topics/ft-button": "0.3.40",
24
- "@fluid-topics/ft-chip": "0.3.40",
25
- "@fluid-topics/ft-filter": "0.3.40",
26
- "@fluid-topics/ft-icon": "0.3.40",
27
- "@fluid-topics/ft-select": "0.3.40",
28
- "@fluid-topics/ft-size-watcher": "0.3.40",
29
- "@fluid-topics/ft-skeleton": "0.3.40",
30
- "@fluid-topics/ft-snap-scroll": "0.3.40",
31
- "@fluid-topics/ft-tooltip": "0.3.40",
32
- "@fluid-topics/ft-typography": "0.3.40",
33
- "@fluid-topics/ft-wc-utils": "0.3.40",
22
+ "@fluid-topics/ft-accordion": "0.3.43",
23
+ "@fluid-topics/ft-button": "0.3.43",
24
+ "@fluid-topics/ft-chip": "0.3.43",
25
+ "@fluid-topics/ft-filter": "0.3.43",
26
+ "@fluid-topics/ft-icon": "0.3.43",
27
+ "@fluid-topics/ft-select": "0.3.43",
28
+ "@fluid-topics/ft-size-watcher": "0.3.43",
29
+ "@fluid-topics/ft-skeleton": "0.3.43",
30
+ "@fluid-topics/ft-snap-scroll": "0.3.43",
31
+ "@fluid-topics/ft-tooltip": "0.3.43",
32
+ "@fluid-topics/ft-typography": "0.3.43",
33
+ "@fluid-topics/ft-wc-utils": "0.3.43",
34
34
  "lit": "2.2.8"
35
35
  },
36
36
  "devDependencies": {
@@ -39,5 +39,5 @@
39
39
  "peerDependencies": {
40
40
  "@fluid-topics/public-api": "1.0.27"
41
41
  },
42
- "gitHead": "00f0bb16ca98f5ade4f3d9a1c3d1dce54eae97b7"
42
+ "gitHead": "42962910ff06ebfa42e961d1567ee771c517ccb7"
43
43
  }