@r2digisolutions/ui 0.26.4 → 0.26.6
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.
|
@@ -14,35 +14,55 @@
|
|
|
14
14
|
}: Props = $props();
|
|
15
15
|
|
|
16
16
|
const baseClasses =
|
|
17
|
-
'inline-flex items-center justify-center font-
|
|
17
|
+
'inline-flex items-center justify-center font-medium rounded-xl select-none transition-all duration-150 outline-none ' +
|
|
18
|
+
'focus-visible:ring-2 focus-visible:ring-indigo-500/70 focus-visible:ring-offset-2 focus-visible:ring-offset-transparent ' +
|
|
19
|
+
'disabled:cursor-not-allowed disabled:opacity-60 disabled:shadow-none';
|
|
18
20
|
|
|
19
21
|
const variantClasses: Record<typeof variant, string> = {
|
|
20
22
|
primary:
|
|
21
|
-
'bg-gradient-to-r from-
|
|
23
|
+
'bg-gradient-to-r from-indigo-500 via-violet-500 to-blue-500 text-white ' +
|
|
24
|
+
'shadow-sm shadow-indigo-500/30 hover:brightness-105 hover:shadow-md hover:shadow-indigo-500/40',
|
|
25
|
+
|
|
22
26
|
secondary:
|
|
23
|
-
'bg-
|
|
27
|
+
'bg-neutral-900 text-neutral-50 shadow-sm hover:bg-neutral-800 ' +
|
|
28
|
+
'dark:bg-neutral-100 dark:text-neutral-900 dark:hover:bg-neutral-200',
|
|
29
|
+
|
|
24
30
|
outline:
|
|
25
|
-
'border
|
|
31
|
+
'border border-neutral-300 bg-white/80 text-neutral-800 hover:bg-neutral-100 ' +
|
|
32
|
+
'dark:border-neutral-700 dark:bg-neutral-900/60 dark:text-neutral-50 dark:hover:bg-neutral-800',
|
|
33
|
+
|
|
26
34
|
ghost:
|
|
27
|
-
'
|
|
35
|
+
'bg-transparent text-neutral-700 hover:bg-neutral-100/70 shadow-none ' +
|
|
36
|
+
'dark:text-neutral-200 dark:hover:bg-neutral-800/70',
|
|
37
|
+
|
|
28
38
|
gradient:
|
|
29
|
-
'bg-gradient-to-r from-
|
|
39
|
+
'bg-gradient-to-r from-fuchsia-500 via-violet-500 to-sky-500 text-white ' +
|
|
40
|
+
'shadow-sm shadow-fuchsia-500/30 hover:brightness-105 hover:shadow-md hover:shadow-fuchsia-500/40',
|
|
41
|
+
|
|
30
42
|
danger:
|
|
31
|
-
'bg-gradient-to-r from-red-500 via-
|
|
43
|
+
'bg-gradient-to-r from-red-500 via-rose-500 to-orange-500 text-white ' +
|
|
44
|
+
'shadow-sm shadow-red-500/30 hover:brightness-105 hover:shadow-md hover:shadow-red-500/40',
|
|
45
|
+
|
|
32
46
|
success:
|
|
33
|
-
'bg-gradient-to-r from-
|
|
47
|
+
'bg-gradient-to-r from-emerald-500 via-teal-500 to-cyan-500 text-white ' +
|
|
48
|
+
'shadow-sm shadow-emerald-500/30 hover:brightness-105 hover:shadow-md hover:shadow-emerald-500/40',
|
|
49
|
+
|
|
34
50
|
warning:
|
|
35
|
-
'bg-gradient-to-r from-
|
|
36
|
-
|
|
51
|
+
'bg-gradient-to-r from-amber-400 via-orange-500 to-rose-500 text-neutral-900 ' +
|
|
52
|
+
'shadow-sm shadow-amber-500/30 hover:brightness-105 hover:shadow-md hover:shadow-amber-500/40',
|
|
53
|
+
|
|
54
|
+
info:
|
|
55
|
+
'bg-gradient-to-r from-sky-500 via-indigo-500 to-violet-500 text-white ' +
|
|
56
|
+
'shadow-sm shadow-sky-500/30 hover:brightness-105 hover:shadow-md hover:shadow-sky-500/40'
|
|
37
57
|
};
|
|
38
58
|
|
|
39
59
|
const sizeClasses: Record<typeof size, string> = {
|
|
40
|
-
xs: 'px-1.5 py-0.5 text-
|
|
41
|
-
sm: 'px-2 py-1 text-xs gap-1
|
|
60
|
+
xs: 'px-1.5 py-0.5 text-[11px] gap-1',
|
|
61
|
+
sm: 'px-2 py-1 text-xs gap-1',
|
|
42
62
|
md: 'px-2.5 py-1.5 text-sm gap-1.5',
|
|
43
63
|
lg: 'px-3 py-2 text-sm gap-2',
|
|
44
64
|
xl: 'px-4 py-2.5 text-base gap-2',
|
|
45
|
-
'2xl': 'px-5 py-3 text-base gap-
|
|
65
|
+
'2xl': 'px-5 py-3 text-base gap-2.5',
|
|
46
66
|
'3xl': 'px-6 py-3 text-base gap-3',
|
|
47
67
|
'4xl': 'px-7 py-3 text-base gap-3',
|
|
48
68
|
'5xl': 'px-8 py-3 text-base gap-3',
|
|
@@ -51,18 +71,27 @@
|
|
|
51
71
|
'8xl': 'px-11 py-3 text-base gap-3'
|
|
52
72
|
};
|
|
53
73
|
|
|
74
|
+
const isDisabled = $derived(Boolean(disabled || isLoading));
|
|
75
|
+
const Tag = $derived(props.href ? 'a' : 'button');
|
|
76
|
+
|
|
54
77
|
const classes: ClassValue = $derived([
|
|
55
78
|
baseClasses,
|
|
56
79
|
variantClasses[variant],
|
|
57
80
|
sizeClasses[size],
|
|
58
|
-
|
|
81
|
+
isDisabled && 'pointer-events-none',
|
|
59
82
|
props.class
|
|
60
83
|
]);
|
|
61
|
-
|
|
62
|
-
const Tag = $derived(props.href ? 'a' : 'button');
|
|
63
84
|
</script>
|
|
64
85
|
|
|
65
|
-
<svelte:element
|
|
86
|
+
<svelte:element
|
|
87
|
+
this={Tag}
|
|
88
|
+
{...props}
|
|
89
|
+
type={Tag === 'button' ? type : undefined}
|
|
90
|
+
class={classes}
|
|
91
|
+
disabled={Tag === 'button' ? isDisabled : undefined}
|
|
92
|
+
aria-disabled={isDisabled ? 'true' : undefined}
|
|
93
|
+
aria-busy={isLoading ? 'true' : undefined}
|
|
94
|
+
>
|
|
66
95
|
{#if isLoading}
|
|
67
96
|
<Loading />
|
|
68
97
|
{:else}
|