@juspay/svelte-ui-components 2.28.3 → 2.29.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.
@@ -14,6 +14,7 @@
14
14
  bottomContent,
15
15
  optionIndicator,
16
16
  testId,
17
+ itemTestId,
17
18
  onchange,
18
19
  classes,
19
20
  open = $bindable(false)
@@ -307,7 +308,6 @@
307
308
  <div class="select-empty">No results</div>
308
309
  {:else}
309
310
  {#each filteredItems as item, index (item.id)}
310
- <!-- svelte-ignore a11y_click_events_have_key_events -->
311
311
  <div
312
312
  class="select-option"
313
313
  class:multi={multiple}
@@ -317,6 +317,13 @@
317
317
  id={`${listboxId}-option-${index}`}
318
318
  aria-selected={value.includes(item.id)}
319
319
  tabindex="-1"
320
+ {...item.testId
321
+ ? { 'data-pw': item.testId }
322
+ : typeof itemTestId === 'string'
323
+ ? { 'data-pw': `${itemTestId}-${item.id}` }
324
+ : typeof testId === 'string'
325
+ ? { 'data-pw': `${testId}-${item.id}` }
326
+ : {}}
320
327
  onclick={() => selectItem(item.id)}
321
328
  onmouseenter={() => (highlightedIndex = index)}
322
329
  >
@@ -3,6 +3,8 @@ export type SelectProperties = MandatorySelectProperties & OptionalSelectPropert
3
3
  export type SelectItem = {
4
4
  id: string;
5
5
  label: string;
6
+ /** Optional per-option test id, emitted as `data-pw` on the option element. */
7
+ testId?: string;
6
8
  };
7
9
  export type MandatorySelectProperties = {
8
10
  items: SelectItem[] | string[];
@@ -18,6 +20,8 @@ export type OptionalSelectProperties = {
18
20
  checked: boolean;
19
21
  }]>;
20
22
  testId?: string;
23
+ /** Fallback per-option test id prefix. Each option emits `data-pw="{itemTestId}-{id}"` when its own `item.testId` is not set. */
24
+ itemTestId?: string;
21
25
  classes?: string;
22
26
  /** Bindable. Controls whether the dropdown is open; the component writes back on open/close so parents can `bind:open` to observe or drive it. Unbound, the component manages its own state. */
23
27
  open?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "2.28.3",
3
+ "version": "2.29.0",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",