@eox/itemfilter 1.9.2 → 1.10.1

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.
Files changed (38) hide show
  1. package/dist/eox-itemfilter.js +3815 -3733
  2. package/dist/eox-itemfilter.umd.cjs +494 -446
  3. package/dist/material-symbols-outlined.woff2 +0 -0
  4. package/dist/material-symbols-rounded.woff2 +0 -0
  5. package/dist/material-symbols-sharp.woff2 +0 -0
  6. package/dist/material-symbols-subset.woff2 +0 -0
  7. package/package.json +3 -2
  8. package/src/components/chips.js +11 -6
  9. package/src/components/expand-container.js +21 -9
  10. package/src/components/filters/range.js +12 -10
  11. package/src/components/filters/selector.js +22 -12
  12. package/src/components/filters/spatial.js +31 -29
  13. package/src/components/filters/text.js +5 -2
  14. package/src/components/itemfilter-container.js +27 -6
  15. package/src/components/results.js +20 -22
  16. package/src/helpers/chip-items.js +1 -1
  17. package/src/main.js +91 -64
  18. package/src/methods/itemfilter/create-reset.js +15 -3
  19. package/src/methods/results/create.js +110 -56
  20. package/src/style.eox.js +123 -208
  21. package/src/style.js +2 -1
  22. package/types/components/chips.d.ts +6 -0
  23. package/types/components/chips.d.ts.map +1 -1
  24. package/types/components/expand-container.d.ts.map +1 -1
  25. package/types/components/filters/range.d.ts.map +1 -1
  26. package/types/components/filters/selector.d.ts +6 -0
  27. package/types/components/filters/selector.d.ts.map +1 -1
  28. package/types/components/filters/spatial.d.ts.map +1 -1
  29. package/types/components/filters/text.d.ts.map +1 -1
  30. package/types/components/itemfilter-container.d.ts.map +1 -1
  31. package/types/components/results.d.ts.map +1 -1
  32. package/types/main.d.ts.map +1 -1
  33. package/types/methods/itemfilter/create-reset.d.ts.map +1 -1
  34. package/types/methods/results/create.d.ts.map +1 -1
  35. package/types/style.d.ts +1 -1
  36. package/types/style.d.ts.map +1 -1
  37. package/types/style.eox.d.ts +1 -1
  38. package/types/style.eox.d.ts.map +1 -1
@@ -1,4 +1,4 @@
1
- import { html, nothing } from "lit";
1
+ import { html } from "lit";
2
2
  import { when } from "lit/directives/when.js";
3
3
 
4
4
  /**
@@ -18,7 +18,7 @@ function createResetMethod(filterObject, tabIndex, EOxItemFilter) {
18
18
  type="button"
19
19
  tabindex=${tabIndex}
20
20
  slot="reset-button"
21
- class="reset-icon icon"
21
+ class="reset-icon icon square primary-text transparent small no-margin"
22
22
  @click=${(e) => {
23
23
  const filterElement =
24
24
  e.target.parentElement.querySelector("[slot=filter]");
@@ -29,7 +29,19 @@ function createResetMethod(filterObject, tabIndex, EOxItemFilter) {
29
29
  EOxItemFilter.requestUpdate();
30
30
  }}
31
31
  >
32
- ${EOxItemFilter.unstyled ? "Reset" : nothing}
32
+ ${EOxItemFilter.unstyled
33
+ ? "Reset"
34
+ : html`
35
+ <i class="small">
36
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
37
+ <title>close</title>
38
+ <path
39
+ d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"
40
+ />
41
+ </svg>
42
+ </i>
43
+ <div class="tooltip left">Reset filter</div>
44
+ `}
33
45
  </button>
34
46
  `,
35
47
  )}
@@ -22,16 +22,27 @@ export function createItemDetailsMethod(
22
22
  @toggle=${EOxItemFilterResults.handleAccordion}
23
23
  ?open=${EOxItemFilterResults.config.expandResults || nothing}
24
24
  >
25
- <summary>
26
- <span class="title">
27
- ${aggregationProperty}
28
- <span class="count"
29
- >${EOxItemFilterResults.aggregateResults(
25
+ <summary class="square">
26
+ <nav class="responsive tiny-space">
27
+ <i class="small">
28
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
29
+ <title>chevron-right</title>
30
+ <path
31
+ d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"
32
+ />
33
+ </svg>
34
+ </i>
35
+ <span class="title"> ${aggregationProperty} </span>
36
+ <button
37
+ class="chip"
38
+ style="--_size: 1rem; padding: 0.7rem; font-size: small"
39
+ >
40
+ ${EOxItemFilterResults.aggregateResults(
30
41
  EOxItemFilterResults.results,
31
42
  aggregationProperty,
32
- ).length}</span
33
- >
34
- </span>
43
+ ).length}
44
+ </button>
45
+ </nav>
35
46
  </summary>
36
47
  <div>
37
48
  ${createItemListMethod(EOxItemFilterResults, aggregationProperty)}
@@ -65,13 +76,13 @@ export function createItemListMethod(
65
76
  : nothing;
66
77
 
67
78
  return staticHtml`
68
- ${EOxItemFilterResults.resultType === "cards" ? unsafeStatic(`<eox-layout fill-grid>`) : unsafeStatic(`<ul>`)}
79
+ ${EOxItemFilterResults.resultType === "cards" ? unsafeStatic(`<eox-layout fill-grid>`) : unsafeStatic(`<ul id="results" class="list no-space" part="results">`)}
69
80
  ${repeat(
70
81
  items,
71
82
  (item) => item.id,
72
83
  (item) => staticHtml`
73
84
  ${EOxItemFilterResults.resultType === "cards" ? unsafeStatic(`<eox-layout-item`) : unsafeStatic(`<li`)}
74
- class=${className(item)}
85
+ class="${className(item)}"
75
86
  @click=${() => {
76
87
  if (EOxItemFilterResults.selectedResult === item) {
77
88
  EOxItemFilterResults.selectedResult = null;
@@ -85,64 +96,107 @@ export function createItemListMethod(
85
96
  );
86
97
  }}
87
98
  >
88
- <span id="${item.id}">
99
+ <nav id="${item.id}" class="responsive tiny-space">
89
100
  ${when(
90
101
  config.subTitleProperty || config.imageProperty,
91
102
  () => html`
92
- ${getValue(config.imageProperty, item)
93
- ? html`
94
- <img
95
- class="image"
96
- src="${getValue(config.imageProperty, item)}"
97
- />
98
- `
99
- : html`
100
- <svg
101
- class="image"
102
- width="100%"
103
- height="100%"
104
- xmlns="http://www.w3.org/2000/svg"
105
- >
106
- <rect
107
- width="100%"
108
- height="100%"
109
- fill="var(--primary-color)"
110
- />
111
- </svg>
112
- `}
113
- <div class="title-container">
114
- <span class="title"
103
+ ${when(
104
+ EOxItemFilterResults.resultType === "cards",
105
+ () =>
106
+ getValue(config.imageProperty, item)
107
+ ? html`
108
+ <img
109
+ class="image"
110
+ src="${getValue(config.imageProperty, item)}"
111
+ />
112
+ `
113
+ : html`
114
+ <svg
115
+ class="image"
116
+ width="100%"
117
+ height="100%"
118
+ xmlns="http://www.w3.org/2000/svg"
119
+ >
120
+ <rect
121
+ width="100%"
122
+ height="100%"
123
+ fill="var(--primary-color)"
124
+ />
125
+ </svg>
126
+ `,
127
+ () => html`
128
+ <i class="small">
129
+ ${getValue(config.imageProperty, item)
130
+ ? html`
131
+ <img
132
+ class="image"
133
+ src="${getValue(config.imageProperty, item)}"
134
+ />
135
+ `
136
+ : html`
137
+ <svg
138
+ class="image"
139
+ width="100%"
140
+ height="100%"
141
+ xmlns="http://www.w3.org/2000/svg"
142
+ >
143
+ <rect
144
+ width="100%"
145
+ height="100%"
146
+ fill="var(--primary-color)"
147
+ />
148
+ </svg>
149
+ `}
150
+ </i>
151
+ `,
152
+ )}
153
+ <div class="title-container small-line max truncate">
154
+ <span class="title truncate"
115
155
  >${unsafeHTML(item[config.titleProperty])}</span
116
156
  >
117
- <span class="subtitle"
118
- >${unsafeHTML(item[config.subTitleProperty])}</span
157
+ ${when(
158
+ !!item[config.subTitleProperty],
159
+ () => html`
160
+ <small class="subtitle no-line truncate"
161
+ >${unsafeHTML(
162
+ item[config.subTitleProperty].toString(),
163
+ )}</small
164
+ >
165
+ `,
166
+ )}
167
+ </div>
168
+ `,
169
+ () => html`
170
+ <div class="small-line max truncate">
171
+ <span class="title truncate"
172
+ >${unsafeHTML(item[config.titleProperty])}</span
119
173
  >
120
174
  </div>
121
175
  `,
176
+ )}
177
+ ${when(
178
+ EOxItemFilterResults.enableResultAction,
122
179
  () => html`
123
- <span class="title"
124
- >${unsafeHTML(item[config.titleProperty])}</span
180
+ <button
181
+ class="result-action square transparent primary-text small"
182
+ @click=${(event) => {
183
+ event.stopPropagation(); // prevents emitting the `li` event above
184
+ EOxItemFilterResults.dispatchEvent(
185
+ new CustomEvent("click:result-action", {
186
+ detail: item,
187
+ }),
188
+ );
189
+ }}
125
190
  >
191
+ <icon class="small"
192
+ >${unsafeHTML(
193
+ EOxItemFilterResults.resultActionIcon,
194
+ )}</icon
195
+ >
196
+ </button>
126
197
  `,
127
198
  )}
128
- </span>
129
- ${when(
130
- EOxItemFilterResults.enableResultAction,
131
- () => html`
132
- <span
133
- class="result-action"
134
- @click=${(event) => {
135
- event.stopPropagation(); // prevents emitting the `li` event above
136
- EOxItemFilterResults.dispatchEvent(
137
- new CustomEvent("click:result-action", {
138
- detail: item,
139
- }),
140
- );
141
- }}
142
- >${unsafeHTML(EOxItemFilterResults.resultActionIcon)}</span
143
- >
144
- `,
145
- )}
199
+ </nav>
146
200
  </li>
147
201
  `,
148
202
  )}