@juspay/svelte-ui-components 2.110.0 → 2.111.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.
@@ -44,6 +44,10 @@
44
44
  ><path d="M22 7L13.5 15.5L8.5 10.5L2 17" /><path d="M16 7H22V13" /></svg
45
45
  >
46
46
  </span>
47
+ {:else if !hideArrow}
48
+ <!-- Neutral/no-change glyph (design-system "— 0%" treatment): an em dash in
49
+ place of the trend arrow, so a flat delta still reads as a stated state. -->
50
+ <span class="delta-indicator-dash" aria-hidden="true">—</span>
47
51
  {/if}
48
52
  <span class="delta-indicator-text">{text}</span>
49
53
  </span>
@@ -85,6 +89,11 @@
85
89
  flex-shrink: 0;
86
90
  }
87
91
 
92
+ .delta-indicator-dash {
93
+ color: inherit;
94
+ flex-shrink: 0;
95
+ }
96
+
88
97
  .delta-indicator-arrow svg {
89
98
  width: 100%;
90
99
  height: 100%;
@@ -177,12 +177,29 @@
177
177
  >
178
178
  {row.value}
179
179
  </div>
180
+ {#if typeof row.comparisonValue === 'string' && row.comparisonValue.length > 0}
181
+ <div
182
+ class="statcard-comparison-value"
183
+ data-pw={typeof testId === 'string' ? `${testId}-comparison-${rowIndex}` : null}
184
+ >
185
+ / {row.comparisonValue}
186
+ </div>
187
+ {/if}
180
188
  {#if typeof row.change === 'number'}
181
189
  <DeltaIndicator
182
190
  value={row.change}
183
191
  invertColors={row.invertChangeColors ?? false}
184
192
  testId={testId ? `${testId}-delta-${rowIndex}` : null}
185
193
  />
194
+ {:else if row.change === null}
195
+ <!-- Comparison expected but not computable — a stated "N/A" beats
196
+ silently rendering nothing (design-system trend states). -->
197
+ <div
198
+ class="statcard-delta statcard-delta-na"
199
+ data-pw={typeof testId === 'string' ? `${testId}-delta-na-${rowIndex}` : null}
200
+ >
201
+ N/A
202
+ </div>
186
203
  {/if}
187
204
  {#if typeof row.additionalContent === 'string' && row.additionalContent.length > 0}
188
205
  <div class="statcard-row-additional">{row.additionalContent}</div>
@@ -392,6 +409,20 @@
392
409
  color: var(--statcard-delta-negative-color, #dc2626);
393
410
  }
394
411
 
412
+ .statcard-delta-na {
413
+ color: var(--statcard-delta-na-color, var(--statcard-delta-color, #6b7280));
414
+ }
415
+
416
+ /* Inline comparison denominator ("₹60k / ₹10L") — a muted, slightly smaller
417
+ companion to the metric value, baseline-aligned by the value row. */
418
+ .statcard-comparison-value {
419
+ font-size: var(--statcard-comparison-font-size, 16px);
420
+ font-weight: var(--statcard-comparison-font-weight, 700);
421
+ color: var(--statcard-comparison-color, #c7c7c7);
422
+ line-height: var(--statcard-comparison-line-height, 1.4);
423
+ white-space: nowrap;
424
+ }
425
+
395
426
  .statcard-subtitle {
396
427
  order: var(--statcard-subtitle-order, 0);
397
428
  font-size: var(--statcard-subtitle-font-size, 12px);
@@ -30,8 +30,17 @@ export type StatCardRow = {
30
30
  value: string;
31
31
  /** Optional row-level heading label. */
32
32
  heading?: string;
33
- /** Numeric change for the delta indicator. */
34
- change?: number;
33
+ /**
34
+ * Comparison-period value rendered inline after the metric as "/ <value>"
35
+ * (e.g. "₹60k / ₹10L") in a muted denominator style. Omit to hide.
36
+ */
37
+ comparisonValue?: string;
38
+ /**
39
+ * Numeric change for the delta indicator. A number renders the delta
40
+ * (0 renders the neutral "— 0%" treatment); `null` means a comparison was
41
+ * expected but not computable and renders "N/A"; `undefined` renders nothing.
42
+ */
43
+ change?: number | null;
35
44
  /** Invert delta colors for lower-is-better metrics on this row. */
36
45
  invertChangeColors?: boolean;
37
46
  /** Additional descriptive text rendered after the delta. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "2.110.0",
3
+ "version": "2.111.0",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",