@juspay/svelte-ui-components 2.62.0 → 2.62.1
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.
- package/dist/BarChart/BarChart.svelte +2 -5
- package/dist/Button/Button.svelte +5 -2
- package/dist/Button/properties.d.ts +7 -0
- package/dist/Card/Card.svelte +1 -1
- package/dist/DateRangePicker/DateRangePicker.svelte +32 -8
- package/dist/Gauge/Gauge.svelte +2 -1
- package/dist/Gauge/properties.d.ts +9 -0
- package/dist/SankeyChart/SankeyChart.svelte +1 -1
- package/dist/Select/Select.svelte +1 -1
- package/dist/Table/Table.svelte +10 -1
- package/package.json +1 -1
|
@@ -413,10 +413,7 @@
|
|
|
413
413
|
return null;
|
|
414
414
|
}
|
|
415
415
|
const title = isMulti ? `${bar.dataPoint.label} — ${bar.seriesName}` : bar.dataPoint.label;
|
|
416
|
-
const displayValue =
|
|
417
|
-
isNormalized && bar.normalizedValue != null
|
|
418
|
-
? normalizedFormat(bar.normalizedValue)
|
|
419
|
-
: format(bar.dataPoint.value);
|
|
416
|
+
const displayValue = getDisplayValue(bar);
|
|
420
417
|
return {
|
|
421
418
|
title,
|
|
422
419
|
items: [{ label: bar.dataPoint.label, value: displayValue, color: bar.color }]
|
|
@@ -574,7 +571,7 @@
|
|
|
574
571
|
y2={isHoriz ? entry.bar.y : entry.bar.y + entry.bar.height}
|
|
575
572
|
gradientUnits="userSpaceOnUse"
|
|
576
573
|
>
|
|
577
|
-
{#each grad.stops as stop (stop.offset)}
|
|
574
|
+
{#each grad.stops as stop, stopIndex (`${stopIndex}-${stop.offset}`)}
|
|
578
575
|
<stop
|
|
579
576
|
offset="{stop.offset * 100}%"
|
|
580
577
|
stop-color={stop.color}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
ariaSelected,
|
|
16
16
|
role,
|
|
17
17
|
onclick,
|
|
18
|
-
onkeydown,
|
|
18
|
+
onkeydown = () => {},
|
|
19
19
|
onkeyup = () => {},
|
|
20
20
|
onmousedown,
|
|
21
21
|
onmouseup,
|
|
@@ -117,7 +117,10 @@
|
|
|
117
117
|
font-weight: var(--disabled-font-weight);
|
|
118
118
|
border: var(--disabled-border);
|
|
119
119
|
background: var(--disabled-background-color, var(--button-color, #3a4550));
|
|
120
|
-
box-shadow: var(
|
|
120
|
+
box-shadow: var(
|
|
121
|
+
--button-disabled-box-shadow,
|
|
122
|
+
var(--disabled-box-shadow, var(--button-box-shadow, none))
|
|
123
|
+
);
|
|
121
124
|
}
|
|
122
125
|
|
|
123
126
|
.button-loader {
|
|
@@ -20,11 +20,18 @@ export type OptionalButtonProperties = {
|
|
|
20
20
|
};
|
|
21
21
|
export type ButtonEventProperties = {
|
|
22
22
|
onclick?: (event: MouseEvent) => void;
|
|
23
|
+
/** Fires when a key is pressed down while the button has focus. */
|
|
23
24
|
onkeydown?: (event: KeyboardEvent) => void;
|
|
25
|
+
/** Fires when a key is released while the button has focus. */
|
|
24
26
|
onkeyup?: (event: KeyboardEvent) => void;
|
|
27
|
+
/** Fires when a mouse button is pressed down on the button. */
|
|
25
28
|
onmousedown?: (event: MouseEvent) => void;
|
|
29
|
+
/** Fires when a mouse button is released over the button. */
|
|
26
30
|
onmouseup?: (event: MouseEvent) => void;
|
|
31
|
+
/** Fires when the pointer leaves the button area. */
|
|
27
32
|
onmouseleave?: (event: MouseEvent) => void;
|
|
33
|
+
/** Fires when a touch point is placed on the button. */
|
|
28
34
|
ontouchstart?: (event: TouchEvent) => void;
|
|
35
|
+
/** Fires when a touch point is removed from the button. */
|
|
29
36
|
ontouchend?: (event: TouchEvent) => void;
|
|
30
37
|
};
|
package/dist/Card/Card.svelte
CHANGED
|
@@ -110,6 +110,32 @@
|
|
|
110
110
|
|
|
111
111
|
let activePresetLabel: string | null = $state(resolvedInitialPresetLabel);
|
|
112
112
|
|
|
113
|
+
// Seed draft from initialPresetLabel whenever presets become available so
|
|
114
|
+
// the calendar shows the preset's date selection when the picker is first
|
|
115
|
+
// opened — even if presets arrive asynchronously after initial render.
|
|
116
|
+
// The draftStart/draftEnd/draftValue guards prevent re-seeding once the
|
|
117
|
+
// user has made a custom selection.
|
|
118
|
+
$effect.pre(() => {
|
|
119
|
+
if (
|
|
120
|
+
resolvedInitialPresetLabel !== null &&
|
|
121
|
+
presets !== null &&
|
|
122
|
+
draftStart === null &&
|
|
123
|
+
draftEnd === null &&
|
|
124
|
+
draftValue === null
|
|
125
|
+
) {
|
|
126
|
+
const matchedPreset = presets.find((p) => p.label === resolvedInitialPresetLabel) ?? null;
|
|
127
|
+
if (matchedPreset !== null) {
|
|
128
|
+
const { start, end } = matchedPreset.getValue();
|
|
129
|
+
if (mode === 'single') {
|
|
130
|
+
draftValue = start;
|
|
131
|
+
} else {
|
|
132
|
+
draftStart = start;
|
|
133
|
+
draftEnd = end;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
113
139
|
const now = new SvelteDate();
|
|
114
140
|
|
|
115
141
|
// Dual-month navigation: track the year+month of the left calendar
|
|
@@ -160,11 +186,11 @@
|
|
|
160
186
|
|
|
161
187
|
function openPicker(): void {
|
|
162
188
|
// Seed draft from current committed values
|
|
163
|
-
draftStart = rangeStart
|
|
164
|
-
draftEnd = rangeEnd
|
|
165
|
-
draftValue = value
|
|
166
|
-
draftCompareStart = compareStart
|
|
167
|
-
draftCompareEnd = compareEnd
|
|
189
|
+
draftStart = rangeStart;
|
|
190
|
+
draftEnd = rangeEnd;
|
|
191
|
+
draftValue = value;
|
|
192
|
+
draftCompareStart = compareStart;
|
|
193
|
+
draftCompareEnd = compareEnd;
|
|
168
194
|
|
|
169
195
|
// Reset preset tracking so each picker session starts clean.
|
|
170
196
|
selectedPresetLabel = null;
|
|
@@ -499,9 +525,7 @@
|
|
|
499
525
|
{#each presets as preset, presetIndex (preset.label)}
|
|
500
526
|
{@const previousPreset = presetIndex > 0 ? presets[presetIndex - 1] : null}
|
|
501
527
|
{@const groupChanged =
|
|
502
|
-
presetIndex > 0 &&
|
|
503
|
-
'group' in preset &&
|
|
504
|
-
(previousPreset === null || previousPreset.group !== preset.group)}
|
|
528
|
+
presetIndex > 0 && (previousPreset?.group ?? '') !== (preset.group ?? '')}
|
|
505
529
|
{#if groupChanged}
|
|
506
530
|
<div class="drp-preset-divider" role="separator" aria-hidden="true">
|
|
507
531
|
{#if preset.group !== ''}
|
package/dist/Gauge/Gauge.svelte
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
max = 100,
|
|
7
7
|
showLabel = true,
|
|
8
8
|
labelFormatter,
|
|
9
|
+
ariaLabel,
|
|
9
10
|
testId,
|
|
10
11
|
classes
|
|
11
12
|
}: GaugeProperties = $props();
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
aria-valuenow={clamped}
|
|
34
35
|
aria-valuemin={0}
|
|
35
36
|
aria-valuemax={100}
|
|
36
|
-
aria-label=
|
|
37
|
+
aria-label={ariaLabel ?? labelText}
|
|
37
38
|
>
|
|
38
39
|
<svg viewBox="0 0 {VIEW_BOX} {VIEW_BOX}">
|
|
39
40
|
<circle class="track" cx={CENTER} cy={CENTER} r={RADIUS} fill="none" />
|
|
@@ -11,6 +11,7 @@ export type OptionalGaugeProperties = {
|
|
|
11
11
|
* @default 100
|
|
12
12
|
*/
|
|
13
13
|
max?: number;
|
|
14
|
+
/** Whether to show the centered percentage label. @default true */
|
|
14
15
|
showLabel?: boolean;
|
|
15
16
|
/**
|
|
16
17
|
* Custom label renderer called with the raw `(value, max)` pair. Return any
|
|
@@ -18,6 +19,14 @@ export type OptionalGaugeProperties = {
|
|
|
18
19
|
* Example: `labelFormatter={(v, m) => \`${v} / ${m}\`}` shows "50 / 200".
|
|
19
20
|
*/
|
|
20
21
|
labelFormatter?: (value: number, max: number) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Accessible label for the gauge element (`role="progressbar"`). Falls back
|
|
24
|
+
* to the computed `labelText` (e.g. `"75%"`) when not provided, so assistive
|
|
25
|
+
* technology announces the current percentage by default.
|
|
26
|
+
*/
|
|
27
|
+
ariaLabel?: string;
|
|
28
|
+
/** Value for the `data-pw` attribute on the root element for E2E test selection. */
|
|
21
29
|
testId?: string;
|
|
30
|
+
/** Extra CSS classes applied to the root element for consumer theming. */
|
|
22
31
|
classes?: string;
|
|
23
32
|
};
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
<ChartContainer bind:width={chartWidth} bind:height={chartHeight} {aspectRatio}>
|
|
273
273
|
<g transform="translate({MARGIN}, {MARGIN})">
|
|
274
274
|
{#if columnLabels != null && columnLabels.length > 0}
|
|
275
|
-
{#each columnLabels as label, ci (ci)}
|
|
275
|
+
{#each columnLabels.slice(0, columnCount) as label, ci (ci)}
|
|
276
276
|
<text
|
|
277
277
|
class="sankey-col-label"
|
|
278
278
|
x={ci * colWidth + nodeWidth / 2}
|
|
@@ -364,7 +364,7 @@
|
|
|
364
364
|
id={`${listboxId}-option-${index}`}
|
|
365
365
|
aria-selected={value.includes(item.id)}
|
|
366
366
|
tabindex="-1"
|
|
367
|
-
{...item.testId
|
|
367
|
+
{...typeof item.testId === 'string'
|
|
368
368
|
? { 'data-pw': item.testId }
|
|
369
369
|
: typeof itemTestId === 'string'
|
|
370
370
|
? { 'data-pw': `${itemTestId}-${item.id}` }
|
package/dist/Table/Table.svelte
CHANGED
|
@@ -189,10 +189,16 @@
|
|
|
189
189
|
* stable even when the visible set shrinks or expands as the search term
|
|
190
190
|
* changes — so a row that was "row 2" in the full set keeps ID `"2"` even
|
|
191
191
|
* when it becomes the only visible result.
|
|
192
|
+
*
|
|
193
|
+
* The Map lookup uses object reference equality, so row objects in
|
|
194
|
+
* `filteredTableData` must be the same references as those in
|
|
195
|
+
* `sortedTableData`. When `originalIndex` cannot be found (reference mismatch
|
|
196
|
+
* after a transform), the fallback positional index is used instead.
|
|
192
197
|
*/
|
|
193
198
|
let filteredRowIds = $derived.by((): string[] => {
|
|
199
|
+
const indexMap = new Map(sortedTableData.map((row, index) => [row, index]));
|
|
194
200
|
return filteredTableData.map((row, fallbackIndex) => {
|
|
195
|
-
const originalIndex =
|
|
201
|
+
const originalIndex = indexMap.get(row) ?? -1;
|
|
196
202
|
const stableIndex = originalIndex === -1 ? fallbackIndex : originalIndex;
|
|
197
203
|
if (checkboxSelection && checkboxSelection.enabled !== false) {
|
|
198
204
|
return resolveRowId(checkboxSelection, row, stableIndex);
|
|
@@ -314,6 +320,7 @@
|
|
|
314
320
|
oninput={handleSearchInput}
|
|
315
321
|
data-pw={searchConfig?.testId ?? null}
|
|
316
322
|
aria-label={searchConfig?.placeholder ?? 'Search'}
|
|
323
|
+
autocomplete="off"
|
|
317
324
|
/>
|
|
318
325
|
{#if searchTerm.length > 0}
|
|
319
326
|
<button
|
|
@@ -353,6 +360,7 @@
|
|
|
353
360
|
? 'mixed'
|
|
354
361
|
: headerCheckboxState === 'all'}
|
|
355
362
|
aria-label="Select all rows"
|
|
363
|
+
aria-controls={selectableRowIds.map((rowId) => `row-checkbox-${rowId}`).join(' ')}
|
|
356
364
|
onclick={toggleAllSelection}
|
|
357
365
|
onkeydown={(keyboardEvent) =>
|
|
358
366
|
handleCheckboxKeydown(keyboardEvent, toggleAllSelection)}
|
|
@@ -445,6 +453,7 @@
|
|
|
445
453
|
class:checked={rowSelected}
|
|
446
454
|
class:disabled={rowDisabled}
|
|
447
455
|
role="checkbox"
|
|
456
|
+
id={`row-checkbox-${rowId}`}
|
|
448
457
|
tabindex={rowDisabled ? -1 : 0}
|
|
449
458
|
aria-checked={rowSelected}
|
|
450
459
|
aria-disabled={rowDisabled}
|