@juspay/svelte-ui-components 2.108.1 → 2.110.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.
@@ -204,11 +204,25 @@
204
204
  series.map((s, si) => {
205
205
  const color = s.color ?? getColor(si);
206
206
  const points: Point[] = s.data.map((d) => ({ x: xScale(d.x), y: yScale(d.y) }));
207
+ const finitePoints = points.filter(
208
+ (point) => Number.isFinite(point.x) && Number.isFinite(point.y)
209
+ );
210
+ // Design-system contract: a series with a single data point renders as a
211
+ // flat line at that y across the full plot width (a lone dot reads as a
212
+ // glitch), while the point marker itself still renders at its true x.
213
+ const isSinglePoint = finitePoints.length === 1;
214
+ const pathPoints: Point[] = isSinglePoint
215
+ ? [
216
+ { x: 0, y: finitePoints[0].y },
217
+ { x: dims.innerWidth, y: finitePoints[0].y }
218
+ ]
219
+ : points;
207
220
  return {
208
221
  color,
209
222
  points,
210
- path: linePath(points, curve),
211
- areaD: areaPath(points, dims.innerHeight, curve),
223
+ dash: s.dash === true ? '6 4' : typeof s.dash === 'string' ? s.dash : null,
224
+ path: linePath(pathPoints, isSinglePoint ? 'linear' : curve),
225
+ areaD: areaPath(pathPoints, dims.innerHeight, isSinglePoint ? 'linear' : curve),
212
226
  hidden: hiddenSeries.has(si)
213
227
  };
214
228
  })
@@ -639,6 +653,7 @@
639
653
  d={line.path}
640
654
  stroke={line.color}
641
655
  stroke-width={strokeWidth}
656
+ stroke-dasharray={line.dash}
642
657
  fill="none"
643
658
  />
644
659
  {#if line.points.length === 1 && !showDots && Number.isFinite(line.points[0].x) && Number.isFinite(line.points[0].y)}
@@ -10,6 +10,12 @@ export type LineChartSeries = {
10
10
  name: string;
11
11
  data: LineChartDataPoint[];
12
12
  color?: string;
13
+ /**
14
+ * Dashed stroke for this series (e.g. a comparison/previous-period line).
15
+ * `true` uses the default `'6 4'` pattern; a string is passed through as a
16
+ * custom SVG `stroke-dasharray`. Omit for a solid line.
17
+ */
18
+ dash?: boolean | string;
13
19
  };
14
20
  export type LineChartTooltipContext = {
15
21
  x: number;
@@ -49,6 +49,7 @@
49
49
  toolbarSlot,
50
50
  rowNumberColumn = false,
51
51
  rowNumberLabel = '#',
52
+ summaryRowIndex = null,
52
53
  headerTooltipIcon,
53
54
  headerTooltipPosition,
54
55
  usePortal = false
@@ -796,6 +797,8 @@
796
797
  class="table-row"
797
798
  class:table-row-clickable={isRowClickable}
798
799
  class:table-row-selected={rowSelected}
800
+ class:table-summary-row={summaryRowIndex !== null &&
801
+ originalIndex === summaryRowIndex}
799
802
  data-pw={typeof getRowTestId === 'function' ? getRowTestId(row, rowIndex) : null}
800
803
  onclick={isRowClickable
801
804
  ? () => handleRowClick(rowIndex, row, originalIndex)
@@ -1253,6 +1256,17 @@
1253
1256
  background-color: var(--table-row-selected-background, #eff6ff);
1254
1257
  }
1255
1258
 
1259
+ /* Summary/period-total row (summaryRowIndex): both the row and its cells,
1260
+ since a themed --table-content-background would otherwise paint over a
1261
+ row-level background. Falls back to the regular cell background. */
1262
+ .table-summary-row {
1263
+ background-color: var(--table-summary-row-background, var(--table-content-background));
1264
+ }
1265
+
1266
+ .table-summary-row > .table-content {
1267
+ background-color: var(--table-summary-row-background, var(--table-content-background));
1268
+ }
1269
+
1256
1270
  /* ── C2-1 Checkbox column ───────────────────────────────────────────────── */
1257
1271
  .table-checkbox-col {
1258
1272
  width: var(--table-checkbox-col-width, 44px);
@@ -396,6 +396,15 @@ export type OptionalTableProperties = {
396
396
  }]>;
397
397
  /** Prepends a sequential row-number column (1-based, pagination-aware). */
398
398
  rowNumberColumn?: boolean;
399
+ /**
400
+ * Index (into the consumer-supplied `rows`, pre-sort/pre-filter) of a
401
+ * summary/period-total row that renders with a distinct background — the
402
+ * DataGrid-parity `summaryRowIndex`. The row is matched by its original
403
+ * position, so it keeps its highlight through sort, search, and pagination.
404
+ * Background comes from `--table-summary-row-background` (falls back to the
405
+ * regular cell background when unset). Pass `null`/omit for no summary row.
406
+ */
407
+ summaryRowIndex?: number | null;
399
408
  /** Header label for the row-number column. Defaults to `'#'`. */
400
409
  rowNumberLabel?: string;
401
410
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "2.108.1",
3
+ "version": "2.110.0",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",