-
Notifications
You must be signed in to change notification settings - Fork 712
/
Copy pathalert.ts
95 lines (94 loc) · 2.22 KB
/
alert.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import type { ModuleOptions } from '../module'
export default (options: Required<ModuleOptions>) => ({
slots: {
root: 'relative overflow-hidden w-full rounded-lg p-4 flex gap-2.5',
wrapper: 'min-w-0 flex-1 flex flex-col',
title: 'text-sm font-medium',
description: 'text-sm opacity-90',
icon: 'shrink-0 size-5',
avatar: 'shrink-0',
avatarSize: '2xl',
actions: 'flex flex-wrap gap-1.5 shrink-0',
close: 'p-0'
},
variants: {
color: {
...Object.fromEntries((options.theme.colors || []).map((color: string) => [color, ''])),
neutral: ''
},
variant: {
solid: '',
outline: '',
soft: '',
subtle: ''
},
orientation: {
horizontal: {
root: 'items-center',
actions: 'items-center'
},
vertical: {
root: 'items-start',
actions: 'items-start mt-2.5'
}
},
title: {
true: {
description: 'mt-1'
}
}
},
compoundVariants: [...(options.theme.colors || []).map((color: string) => ({
color,
variant: 'solid',
class: {
root: `bg-${color} text-inverted`
}
})), ...(options.theme.colors || []).map((color: string) => ({
color,
variant: 'outline',
class: {
root: `text-${color} ring ring-inset ring-${color}/25`
}
})), ...(options.theme.colors || []).map((color: string) => ({
color,
variant: 'soft',
class: {
root: `bg-${color}/10 text-${color}`
}
})), ...(options.theme.colors || []).map((color: string) => ({
color,
variant: 'subtle',
class: {
root: `bg-${color}/10 text-${color} ring ring-inset ring-${color}/25`
}
})), {
color: 'neutral',
variant: 'solid',
class: {
root: 'text-inverted bg-inverted'
}
}, {
color: 'neutral',
variant: 'outline',
class: {
root: 'text-highlighted bg-default ring ring-inset ring-default'
}
}, {
color: 'neutral',
variant: 'soft',
class: {
root: 'text-highlighted bg-elevated/50'
}
}, {
color: 'neutral',
variant: 'subtle',
class: {
root: 'text-highlighted bg-elevated/50 ring ring-inset ring-accented'
}
}],
defaultVariants: {
color: 'primary',
variant: 'solid'
}
})