@juspay/svelte-ui-components 2.30.0 → 2.31.0
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/dist/Select/Select.svelte +43 -24
- package/dist/Select/properties.d.ts +5 -0
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
disabled = false,
|
|
14
14
|
bottomContent,
|
|
15
15
|
optionIndicator,
|
|
16
|
+
triggerSummary,
|
|
16
17
|
testId,
|
|
17
18
|
itemTestId,
|
|
18
19
|
onchange,
|
|
@@ -256,30 +257,48 @@
|
|
|
256
257
|
tabindex={disabled ? -1 : searchable ? -1 : 0}
|
|
257
258
|
>
|
|
258
259
|
{#if multiple}
|
|
259
|
-
{#
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
260
|
+
{#if typeof triggerSummary === 'function'}
|
|
261
|
+
{@render triggerSummary({ value, items })}
|
|
262
|
+
{#if searchable}
|
|
263
|
+
<input
|
|
264
|
+
class="select-search"
|
|
265
|
+
type="text"
|
|
266
|
+
value={query}
|
|
267
|
+
oninput={handleSearchInput}
|
|
268
|
+
onfocus={handleSearchFocus}
|
|
269
|
+
bind:this={searchInputEl}
|
|
270
|
+
placeholder={value.length === 0 ? placeholder : ''}
|
|
271
|
+
{disabled}
|
|
272
|
+
autocomplete="off"
|
|
273
|
+
tabindex={disabled ? -1 : 0}
|
|
274
|
+
/>
|
|
275
|
+
{/if}
|
|
276
|
+
{:else}
|
|
277
|
+
{#each value as id (id)}
|
|
278
|
+
<Pill
|
|
279
|
+
text={getLabel(id)}
|
|
280
|
+
dismissible
|
|
281
|
+
{disabled}
|
|
282
|
+
ondismiss={() => removeItem(id)}
|
|
283
|
+
{...typeof testId === 'string' ? { testId: `${testId}-pill-${id}` } : {}}
|
|
284
|
+
/>
|
|
285
|
+
{/each}
|
|
286
|
+
{#if searchable}
|
|
287
|
+
<input
|
|
288
|
+
class="select-search"
|
|
289
|
+
type="text"
|
|
290
|
+
value={query}
|
|
291
|
+
oninput={handleSearchInput}
|
|
292
|
+
onfocus={handleSearchFocus}
|
|
293
|
+
bind:this={searchInputEl}
|
|
294
|
+
placeholder={value.length === 0 ? placeholder : ''}
|
|
295
|
+
{disabled}
|
|
296
|
+
autocomplete="off"
|
|
297
|
+
tabindex={disabled ? -1 : 0}
|
|
298
|
+
/>
|
|
299
|
+
{:else if value.length === 0}
|
|
300
|
+
<span class="select-placeholder">{placeholder}</span>
|
|
301
|
+
{/if}
|
|
283
302
|
{/if}
|
|
284
303
|
{:else if searchable}
|
|
285
304
|
<input
|
|
@@ -27,6 +27,11 @@ export type OptionalSelectProperties = {
|
|
|
27
27
|
open?: boolean;
|
|
28
28
|
/** Horizontal anchor of the dropdown panel. `'left'` (default) anchors to the trigger's left edge; `'right'` anchors to the right edge so a content-wider panel hangs leftward instead of overflowing. */
|
|
29
29
|
dropdownAlign?: 'left' | 'right';
|
|
30
|
+
/** Snippet for rendering a compact trigger summary in multiple mode instead of one Pill per selected value. Receives `{ value, items }` so the consumer can compute e.g. "All" / "3 selected". When not provided the default Pill-per-value behaviour is used. */
|
|
31
|
+
triggerSummary?: import('svelte').Snippet<[{
|
|
32
|
+
value: string[];
|
|
33
|
+
items: SelectItem[];
|
|
34
|
+
}]>;
|
|
30
35
|
};
|
|
31
36
|
export type SelectEventProperties = {
|
|
32
37
|
onchange?: (value: string[]) => void;
|