@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.
@@ -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
- {#each value as id (id)}
260
- <Pill
261
- text={getLabel(id)}
262
- dismissible
263
- {disabled}
264
- ondismiss={() => removeItem(id)}
265
- {...typeof testId === 'string' ? { testId: `${testId}-pill-${id}` } : {}}
266
- />
267
- {/each}
268
- {#if searchable}
269
- <input
270
- class="select-search"
271
- type="text"
272
- value={query}
273
- oninput={handleSearchInput}
274
- onfocus={handleSearchFocus}
275
- bind:this={searchInputEl}
276
- placeholder={value.length === 0 ? placeholder : ''}
277
- {disabled}
278
- autocomplete="off"
279
- tabindex={disabled ? -1 : 0}
280
- />
281
- {:else if value.length === 0}
282
- <span class="select-placeholder">{placeholder}</span>
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "2.30.0",
3
+ "version": "2.31.0",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",