@juspay/svelte-ui-components 2.113.0 → 2.114.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/Modal/Modal.svelte +29 -16
- package/dist/Modal/properties.d.ts +4 -0
- package/package.json +1 -1
package/dist/Modal/Modal.svelte
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
footer,
|
|
22
22
|
debounceTime = 700,
|
|
23
23
|
leftImageTestId,
|
|
24
|
+
leftImageAriaLabel,
|
|
24
25
|
testId,
|
|
25
26
|
content,
|
|
26
27
|
footerSnippet,
|
|
@@ -157,24 +158,35 @@
|
|
|
157
158
|
{#if (typeof header?.leftImage === 'string' && header.leftImage.length > 0) || (typeof header?.text === 'string' && header.text.length > 0) || (typeof header?.rightImage === 'string' && header.rightImage.length > 0)}
|
|
158
159
|
<div class="header">
|
|
159
160
|
{#if typeof header.leftImage === 'string' && header.leftImage.length > 0}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
onkeydown={handleLeftImageKeyDown}
|
|
163
|
-
role="button"
|
|
164
|
-
tabindex="0"
|
|
165
|
-
data-pw={leftImageTestId}
|
|
166
|
-
testID={leftImageTestId}
|
|
167
|
-
>
|
|
161
|
+
{@const leftImageSrc = header.leftImage}
|
|
162
|
+
{#snippet leftImage()}
|
|
168
163
|
<!-- Inline SVGs so currentColor icons inherit the header text
|
|
169
164
|
colour; non-SVG URLs fall back to a plain <img>. -->
|
|
170
|
-
<Img
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
165
|
+
<Img inlineSvg src={leftImageSrc} alt="" fallback="" classes="header-left-img" />
|
|
166
|
+
{/snippet}
|
|
167
|
+
<!-- The left image is only a control when a click handler is actually supplied.
|
|
168
|
+
Consumers pass a decorative brand/source logo here far more often than a back
|
|
169
|
+
button, and announcing those as a focusable "button" that does nothing when
|
|
170
|
+
activated is worse for assistive tech than leaving them unannounced. The two
|
|
171
|
+
branches are written out rather than computed so the role/tabindex pairing
|
|
172
|
+
stays statically checkable. -->
|
|
173
|
+
{#if typeof onheaderLeftImageClick === 'function'}
|
|
174
|
+
<div
|
|
175
|
+
onclick={handleLeftImageClick}
|
|
176
|
+
onkeydown={handleLeftImageKeyDown}
|
|
177
|
+
role="button"
|
|
178
|
+
tabindex="0"
|
|
179
|
+
aria-label={leftImageAriaLabel ?? null}
|
|
180
|
+
data-pw={leftImageTestId}
|
|
181
|
+
testID={leftImageTestId}
|
|
182
|
+
>
|
|
183
|
+
{@render leftImage()}
|
|
184
|
+
</div>
|
|
185
|
+
{:else}
|
|
186
|
+
<div data-pw={leftImageTestId} testID={leftImageTestId}>
|
|
187
|
+
{@render leftImage()}
|
|
188
|
+
</div>
|
|
189
|
+
{/if}
|
|
178
190
|
{/if}
|
|
179
191
|
{#if typeof header.text === 'string' && header.text.length > 0}
|
|
180
192
|
<div class="header-text" data-pw={header.testId} testID={header.testId}>
|
|
@@ -187,6 +199,7 @@
|
|
|
187
199
|
tabindex="0"
|
|
188
200
|
onclick={handleRightImageClick}
|
|
189
201
|
onkeydown={handleRightImageKeyDown}
|
|
202
|
+
aria-label={header.buttonAriaLabel ?? null}
|
|
190
203
|
data-pw={header.buttonTestId}
|
|
191
204
|
testID={header.buttonTestId}
|
|
192
205
|
>
|
|
@@ -17,6 +17,8 @@ export type OptionalModalProperties = {
|
|
|
17
17
|
text?: string;
|
|
18
18
|
testId?: string;
|
|
19
19
|
buttonTestId?: string;
|
|
20
|
+
/** Accessible name for the right header image's role="button" wrapper (e.g. a close control). Rendered as aria-label. */
|
|
21
|
+
buttonAriaLabel?: string;
|
|
20
22
|
};
|
|
21
23
|
footer?: {
|
|
22
24
|
primaryButton?: ButtonProperties;
|
|
@@ -24,6 +26,8 @@ export type OptionalModalProperties = {
|
|
|
24
26
|
};
|
|
25
27
|
debounceTime?: number;
|
|
26
28
|
leftImageTestId?: string;
|
|
29
|
+
/** Accessible name for the left header image's role="button" wrapper (e.g. a back control). Rendered as aria-label. */
|
|
30
|
+
leftImageAriaLabel?: string;
|
|
27
31
|
testId?: string;
|
|
28
32
|
content?: Snippet;
|
|
29
33
|
footerSnippet?: Snippet;
|