@reuters-graphics/graphics-components 0.0.5 → 0.0.8

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.
@@ -62,9 +62,6 @@ export default class Index extends SvelteComponentTyped<{
62
62
  index: any;
63
63
  value: string;
64
64
  };
65
- 'no-results': {
66
- value: string;
67
- };
68
65
  }> {
69
66
  }
70
67
  export type IndexProps = typeof __propDef.props;
@@ -135,9 +132,6 @@ declare const __propDef: {
135
132
  index: any;
136
133
  value: string;
137
134
  };
138
- 'no-results': {
139
- value: string;
140
- };
141
135
  };
142
136
  };
143
137
  export {};
@@ -147,7 +147,7 @@
147
147
  .slice(0, limit)
148
148
  .filter((result) => !filter(result.original))
149
149
  .map((result) => ({ ...result, disabled: disable(result.original) }))
150
- : data.slice(0, 10).map((d) => ({ string: extract(d), original: d }));
150
+ : data.map((d) => ({ string: extract(d), original: d }));
151
151
 
152
152
  $: resultsId = results.map((result) => extract(result.original)).join('');
153
153
  $: showResults = !hideDropdown && results.length > 0 && isFocused;
@@ -171,7 +171,8 @@
171
171
  aria-haspopup="listbox"
172
172
  aria-owns="{id}-listbox"
173
173
  class:dropdown="{results.length > 0}"
174
- aria-expanded="{showResults}"
174
+ aria-expanded="{showResults ||
175
+ (isFocused && value.length > 0 && results.length === 0)}"
175
176
  id="{id}-typeahead"
176
177
  >
177
178
  <Search
@@ -257,37 +258,45 @@
257
258
  </li>
258
259
  {/each}
259
260
  {/if}
260
- {#if $$slots['no-results'] && !hideDropdown && value.length > 0 && results.length === 0}
261
- <div class:no-results="{true}">
262
- <slot name="no-results" value="{value}" />
263
- </div>
261
+ {#if value.length > 0 && results.length === 0}
262
+ <li class="no-results disabled">No embeds found...</li>
264
263
  {/if}
265
264
  </ul>
266
265
  </div>
267
266
 
268
267
  <style>[data-svelte-typeahead] {
269
268
  position: relative;
270
- background-color: #fff;
271
269
  }
272
270
 
273
271
  ul {
274
272
  position: absolute;
275
273
  top: 100%;
276
274
  left: 0;
277
- width: 100%;
275
+ width: calc(100% - 2px);
278
276
  padding: 0;
277
+ margin: 0;
279
278
  list-style: none;
280
- background-color: inherit;
279
+ background-color: #fff;
281
280
  }
282
281
 
283
282
  [aria-expanded=true] ul {
284
283
  z-index: 1;
285
284
  border: 1px solid #ddd;
285
+ max-height: 50vh;
286
+ overflow-y: scroll;
286
287
  }
287
288
 
288
289
  li,
289
- .no-results {
290
+ li.no-results {
290
291
  padding: 0.25rem 1rem;
292
+ font-family: "Knowledge", "Source Sans Pro", Arial, sans-serif;
293
+ color: #333;
294
+ }
295
+
296
+ li.no-results {
297
+ color: #333;
298
+ font-size: 0.85rem;
299
+ font-style: italic;
291
300
  }
292
301
 
293
302
  li {
@@ -334,6 +343,7 @@ li:hover {
334
343
  font-size: 1rem;
335
344
  border: 0;
336
345
  border-radius: 0 !important;
346
+ background-color: #fff;
337
347
  border: 1px solid #ddd;
338
348
  font-family: var(--theme-font-family-sans-serif, "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif);
339
349
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reuters-graphics/graphics-components",
3
- "version": "0.0.5",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://reuters-graphics.github.io/graphics-components",