@juspay/svelte-ui-components 2.84.0 → 2.85.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.
@@ -37,7 +37,19 @@
37
37
 
38
38
  <!-- svelte-ignore a11y_click_events_have_key_events -->
39
39
  <!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
40
- <label class="container {classes ?? ''}" class:disabled onclick={handleClick} data-pw={testId}>
40
+ <!-- preventDefault stops the label's default activation from firing a synthesized
41
+ click that re-toggles the native input AFTER handleClick has flipped the state,
42
+ which left input.checked out of sync with the rendered box (and with
43
+ :checked-based selectors/testing probes). State has one owner: handleClick. -->
44
+ <label
45
+ class="container {classes ?? ''}"
46
+ class:disabled
47
+ onclick={(e: MouseEvent) => {
48
+ e.preventDefault();
49
+ handleClick();
50
+ }}
51
+ data-pw={testId}
52
+ >
41
53
  <input
42
54
  type="checkbox"
43
55
  class="native-checkbox"
@@ -9,13 +9,20 @@
9
9
  statusDescription = '',
10
10
  buttonProperties,
11
11
  classes,
12
- onbuttonClick
12
+ onbuttonClick,
13
+ icon
13
14
  }: StatusProperties = $props();
14
15
  </script>
15
16
 
16
17
  <div class="background {classes ?? ''}">
17
18
  <div class="order-status">
18
- <div class="status-image"><Img src={statusIcon} alt="status" /></div>
19
+ <div class="status-image">
20
+ {#if icon}
21
+ {@render icon()}
22
+ {:else}
23
+ <Img src={statusIcon} alt="status" />
24
+ {/if}
25
+ </div>
19
26
  <div class="status-text">{statusText}</div>
20
27
  <div class="status-description">
21
28
  <!-- eslint-disable-next-line -->
@@ -1,10 +1,17 @@
1
+ import type { Snippet } from 'svelte';
1
2
  import type { ButtonProperties } from '../Button/properties';
2
3
  export type StatusProperties = StatusEventProperties & {
3
- statusIcon: string;
4
+ statusIcon?: string;
4
5
  statusText: string;
5
6
  statusDescription: string;
6
7
  buttonProperties?: ButtonProperties;
7
8
  classes?: string;
9
+ /**
10
+ * Custom media rendered instead of the default `statusIcon` image — e.g. a
11
+ * `LottiePlayer` for animated success/failure/in-progress states. Takes
12
+ * priority over `statusIcon` when provided.
13
+ */
14
+ icon?: Snippet;
8
15
  };
9
16
  export type StatusEventProperties = {
10
17
  onbuttonClick?: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "2.84.0",
3
+ "version": "2.85.0",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",