@juspay/svelte-ui-components 2.19.2 → 2.22.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.
- package/dist/Banner/Banner.svelte +3 -3
- package/dist/Button/Button.svelte +2 -2
- package/dist/Card/Card.svelte +34 -2
- package/dist/Card/properties.d.ts +9 -0
- package/dist/EmptyState/EmptyState.svelte +2 -2
- package/dist/EmptyState/properties.d.ts +1 -0
- package/dist/Input/Input.svelte +8 -11
- package/package.json +1 -1
|
@@ -122,9 +122,9 @@
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
.banner-text {
|
|
125
|
-
overflow: hidden;
|
|
126
|
-
text-overflow: ellipsis;
|
|
127
|
-
white-space: nowrap;
|
|
125
|
+
overflow: var(--banner-text-overflow, hidden);
|
|
126
|
+
text-overflow: var(--banner-text-ellipsis, ellipsis);
|
|
127
|
+
white-space: var(--banner-white-space, nowrap);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
.banner-link-text {
|
|
@@ -100,11 +100,11 @@
|
|
|
100
100
|
.disabled {
|
|
101
101
|
cursor: var(--disabled-cursor, not-allowed);
|
|
102
102
|
opacity: var(--disabled-opacity, 0.4);
|
|
103
|
-
color: var(--disabled-text-color);
|
|
103
|
+
color: var(--disabled-text-color, var(--button-text-color, white));
|
|
104
104
|
font-size: var(--disabled-font-size);
|
|
105
105
|
font-weight: var(--disabled-font-weight);
|
|
106
106
|
border: var(--disabled-border);
|
|
107
|
-
background: var(--disabled-background-color);
|
|
107
|
+
background: var(--disabled-background-color, var(--button-color, #3a4550));
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
.button-loader {
|
package/dist/Card/Card.svelte
CHANGED
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { CardProperties } from './properties';
|
|
3
3
|
|
|
4
|
-
let { children, title, description, classes }: CardProperties = $props();
|
|
4
|
+
let { children, title, description, classes, testId, onclick }: CardProperties = $props();
|
|
5
|
+
|
|
6
|
+
const isInteractive = $derived(typeof onclick === 'function');
|
|
7
|
+
|
|
8
|
+
function handleKeydown(event: KeyboardEvent): void {
|
|
9
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
10
|
+
if (event.key === ' ') {
|
|
11
|
+
event.preventDefault();
|
|
12
|
+
}
|
|
13
|
+
if (event.currentTarget instanceof HTMLElement) {
|
|
14
|
+
event.currentTarget.click();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
5
18
|
</script>
|
|
6
19
|
|
|
7
|
-
|
|
20
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
21
|
+
<div
|
|
22
|
+
class="card {classes ?? ''}"
|
|
23
|
+
class:card-interactive={isInteractive}
|
|
24
|
+
data-pw={typeof testId === 'string' ? testId : null}
|
|
25
|
+
role={isInteractive ? 'button' : null}
|
|
26
|
+
tabindex={isInteractive ? 0 : null}
|
|
27
|
+
onclick={isInteractive ? onclick : null}
|
|
28
|
+
onkeydown={isInteractive ? handleKeydown : null}
|
|
29
|
+
>
|
|
8
30
|
{#if typeof title === 'string' && title.length > 0}
|
|
9
31
|
<div class="card-header">
|
|
10
32
|
<div class="card-title">{title}</div>
|
|
@@ -25,6 +47,16 @@
|
|
|
25
47
|
border-radius: var(--card-border-radius, 8px);
|
|
26
48
|
overflow: var(--card-overflow, hidden);
|
|
27
49
|
color: inherit;
|
|
50
|
+
cursor: var(--card-cursor, inherit);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.card-interactive {
|
|
54
|
+
cursor: var(--card-cursor, pointer);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.card-interactive:focus-visible {
|
|
58
|
+
outline: var(--card-focus-outline, 2px solid currentColor);
|
|
59
|
+
outline-offset: var(--card-focus-outline-offset, 2px);
|
|
28
60
|
}
|
|
29
61
|
|
|
30
62
|
.card-header {
|
|
@@ -7,4 +7,13 @@ export type OptionalCardProperties = {
|
|
|
7
7
|
title?: string;
|
|
8
8
|
description?: string;
|
|
9
9
|
classes?: string;
|
|
10
|
+
/** Renders as `data-pw` on the root element for Playwright test selection. */
|
|
11
|
+
testId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* When provided the root element becomes interactive:
|
|
14
|
+
* `role="button"`, `tabindex=0`, and keydown (Enter/Space) triggers the handler.
|
|
15
|
+
* When omitted the root is a plain `<div>` with no interactive attributes,
|
|
16
|
+
* so existing consumers see zero behaviour change.
|
|
17
|
+
*/
|
|
18
|
+
onclick?: (event: MouseEvent) => void;
|
|
10
19
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { EmptyStateProperties } from './properties';
|
|
3
3
|
|
|
4
|
-
let { title, description, icon, children, classes }: EmptyStateProperties = $props();
|
|
4
|
+
let { title, description, icon, children, classes, testId }: EmptyStateProperties = $props();
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<div class="empty-state {classes ?? ''}">
|
|
7
|
+
<div class="empty-state {classes ?? ''}" data-pw={typeof testId === 'string' ? testId : null}>
|
|
8
8
|
{#if typeof icon === 'function'}
|
|
9
9
|
<div class="empty-state-icon">
|
|
10
10
|
{@render icon()}
|
package/dist/Input/Input.svelte
CHANGED
|
@@ -84,7 +84,13 @@
|
|
|
84
84
|
return valueValidation;
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
const
|
|
87
|
+
const validationStateForCallback = $derived.by(() => {
|
|
88
|
+
const state = validationState;
|
|
89
|
+
onStateChange(state);
|
|
90
|
+
return state;
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const showErrorMessage = $derived(validationStateForCallback === 'Invalid');
|
|
88
94
|
|
|
89
95
|
function handleOnInput(event: Event) {
|
|
90
96
|
if (inputElement === null) {
|
|
@@ -185,18 +191,9 @@
|
|
|
185
191
|
onFocusout(event);
|
|
186
192
|
onBlur(event);
|
|
187
193
|
}
|
|
188
|
-
|
|
189
|
-
let _validationStateForCallback = $derived.by(() => {
|
|
190
|
-
const state = validationState;
|
|
191
|
-
onStateChange(state);
|
|
192
|
-
return state;
|
|
193
|
-
});
|
|
194
194
|
</script>
|
|
195
195
|
|
|
196
|
-
<div
|
|
197
|
-
class="input-container {classes ?? ''}"
|
|
198
|
-
class:input-error={validationState === 'Invalid' && !actionInput}
|
|
199
|
-
>
|
|
196
|
+
<div class="input-container {classes ?? ''}" class:input-error={showErrorMessage && !actionInput}>
|
|
200
197
|
{#if typeof label === 'string' && label !== '' && !actionInput}
|
|
201
198
|
<label class="label" for={name}>
|
|
202
199
|
{label}
|