@juspay/svelte-ui-components 2.121.0 → 2.122.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.
@@ -5,6 +5,8 @@
5
5
  children,
6
6
  title,
7
7
  description,
8
+ titleSnippet,
9
+ descriptionSnippet,
8
10
  classes,
9
11
  testId,
10
12
  onclick,
@@ -64,13 +66,17 @@
64
66
  onclick={onclick ?? null}
65
67
  onkeydown={!isAnchor && isInteractive ? handleKeydown : null}
66
68
  >
67
- {#if (typeof title === 'string' && title.length > 0) || typeof headerRight === 'function'}
69
+ {#if (typeof title === 'string' && title.length > 0) || typeof titleSnippet === 'function' || typeof headerRight === 'function'}
68
70
  <div class="card-header" class:card-header-split={typeof headerRight === 'function'}>
69
71
  <div class="card-header-main">
70
- {#if typeof title === 'string' && title.length > 0}
72
+ {#if typeof titleSnippet === 'function'}
73
+ <div class="card-title">{@render titleSnippet()}</div>
74
+ {:else if typeof title === 'string' && title.length > 0}
71
75
  <div class="card-title">{title}</div>
72
76
  {/if}
73
- {#if typeof description === 'string' && description.length > 0}
77
+ {#if typeof descriptionSnippet === 'function'}
78
+ <div class="card-description">{@render descriptionSnippet()}</div>
79
+ {:else if typeof description === 'string' && description.length > 0}
74
80
  <div class="card-description">{description}</div>
75
81
  {/if}
76
82
  </div>
@@ -8,6 +8,22 @@ export type OptionalCardProperties = {
8
8
  children?: Snippet;
9
9
  title?: string;
10
10
  description?: string;
11
+ /**
12
+ * Optional snippet rendered in place of the `title` string, inside the same
13
+ * `.card-title` container. When provided, `title` is not rendered — the snippet
14
+ * takes priority — and the header row is shown even if `title` is omitted
15
+ * entirely. Use this when the title needs markup a string prop cannot carry:
16
+ * rich text, an inline icon, or a test hook such as `data-pw` /
17
+ * `use:testAttributes` that must sit on the title element itself.
18
+ */
19
+ titleSnippet?: Snippet;
20
+ /**
21
+ * Optional snippet rendered in place of the `description` string, inside the
22
+ * same `.card-description` container. When provided, `description` is not
23
+ * rendered. Like `titleSnippet`, this exists for descriptions that need markup
24
+ * or a test hook on the element itself.
25
+ */
26
+ descriptionSnippet?: Snippet;
11
27
  classes?: string;
12
28
  /** Renders as `data-pw` on the root element for Playwright test selection. */
13
29
  testId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "2.121.0",
3
+ "version": "2.122.0",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",