@juspay/svelte-ui-components 2.54.0 → 2.55.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/Card/Card.svelte +11 -1
- package/dist/Card/properties.d.ts +9 -0
- package/package.json +1 -1
package/dist/Card/Card.svelte
CHANGED
|
@@ -11,11 +11,20 @@
|
|
|
11
11
|
headerRight,
|
|
12
12
|
footer,
|
|
13
13
|
stretch = false,
|
|
14
|
-
scrollable = false
|
|
14
|
+
scrollable = false,
|
|
15
|
+
cssVars
|
|
15
16
|
}: CardProperties = $props();
|
|
16
17
|
|
|
17
18
|
const isInteractive = $derived(typeof onclick === 'function');
|
|
18
19
|
|
|
20
|
+
const styleAttr = $derived(
|
|
21
|
+
cssVars
|
|
22
|
+
? Object.entries(cssVars)
|
|
23
|
+
.map(([name, value]) => `${name}: ${value}`)
|
|
24
|
+
.join('; ')
|
|
25
|
+
: null
|
|
26
|
+
);
|
|
27
|
+
|
|
19
28
|
const handleKeydown = (event: KeyboardEvent): void => {
|
|
20
29
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
21
30
|
if (event.key === ' ') {
|
|
@@ -34,6 +43,7 @@
|
|
|
34
43
|
class:card-interactive={isInteractive}
|
|
35
44
|
class:card-stretch={stretch}
|
|
36
45
|
class:card-has-scroll={scrollable}
|
|
46
|
+
style={styleAttr}
|
|
37
47
|
data-pw={typeof testId === 'string' ? testId : null}
|
|
38
48
|
role={isInteractive ? 'button' : null}
|
|
39
49
|
tabindex={isInteractive ? 0 : null}
|
|
@@ -41,4 +41,13 @@ export type OptionalCardProperties = {
|
|
|
41
41
|
* Defaults to false.
|
|
42
42
|
*/
|
|
43
43
|
scrollable?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Per-instance CSS custom properties applied as inline style on the root `.card`.
|
|
46
|
+
* Keys must be CSS variable names (e.g. `--bottom-sections-count`); values are
|
|
47
|
+
* emitted verbatim. This lets a consumer feed a dynamic, per-instance value into a
|
|
48
|
+
* recipe class whose selectors or media queries read that variable — something a
|
|
49
|
+
* static `classes` string cannot express. When omitted, no `style` attribute is
|
|
50
|
+
* rendered, so existing consumers are unchanged.
|
|
51
|
+
*/
|
|
52
|
+
cssVars?: Record<string, string | number>;
|
|
44
53
|
};
|