@r2digisolutions/ui 0.26.2 → 0.26.3
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.
|
@@ -4,18 +4,29 @@
|
|
|
4
4
|
import CardHeader from './CardHeader.svelte';
|
|
5
5
|
|
|
6
6
|
const { children, footer, header, onclick, body_class, ...props }: Props = $props();
|
|
7
|
+
|
|
8
|
+
const isInteractive = $derived(typeof onclick === 'function');
|
|
9
|
+
const Tag = $derived(isInteractive ? 'button' : 'article');
|
|
7
10
|
</script>
|
|
8
11
|
|
|
9
12
|
<svelte:element
|
|
10
|
-
this={
|
|
13
|
+
this={Tag}
|
|
11
14
|
{...props}
|
|
12
|
-
role="button"
|
|
13
|
-
type={onclick ? 'button' : undefined}
|
|
14
|
-
tabindex="0"
|
|
15
|
-
aria-label="Card"
|
|
16
15
|
{onclick}
|
|
16
|
+
type={isInteractive ? 'button' : undefined}
|
|
17
|
+
role={isInteractive ? 'button' : undefined}
|
|
18
|
+
tabindex={isInteractive ? 0 : undefined}
|
|
19
|
+
data-interactive={isInteractive}
|
|
17
20
|
class={[
|
|
18
|
-
'
|
|
21
|
+
'relative flex flex-col overflow-hidden rounded-2xl border text-sm',
|
|
22
|
+
'border-neutral-200/80 bg-white/80 text-neutral-900 shadow-sm shadow-black/5 backdrop-blur-xl',
|
|
23
|
+
'dark:border-neutral-800/80 dark:bg-neutral-950/80 dark:text-neutral-50',
|
|
24
|
+
|
|
25
|
+
isInteractive &&
|
|
26
|
+
'cursor-pointer transition-all duration-150 hover:-translate-y-px hover:border-neutral-300 hover:shadow-md hover:shadow-black/10 dark:hover:border-neutral-600',
|
|
27
|
+
isInteractive &&
|
|
28
|
+
'focus-visible:ring-2 focus-visible:ring-indigo-500/70 focus-visible:ring-offset-2 focus-visible:ring-offset-transparent focus-visible:outline-none',
|
|
29
|
+
|
|
19
30
|
props.class
|
|
20
31
|
]}
|
|
21
32
|
>
|