1
- import { h , defineComponent , PropType , computed , ComputedRef } from ' vue'
1
+ import { h , defineComponent , PropType , computed , ComputedRef } from " vue"
2
2
import {
3
3
chakra ,
4
4
ThemingProps ,
@@ -7,40 +7,40 @@ import {
7
7
StylesProvider ,
8
8
DOMElements ,
9
9
SystemStyleObject ,
10
- } from ' @chakra-ui/vue-system'
11
- import { createContext } from ' @chakra-ui/vue-utils'
12
- import { CIcon } from ' @chakra-ui/c-icon'
10
+ } from " @chakra-ui/vue-system"
11
+ import { createContext } from " @chakra-ui/vue-utils"
12
+ import { CIcon } from " @chakra-ui/c-icon"
13
13
14
14
const STATUSES = {
15
15
info : {
16
- colorScheme : ' blue' ,
17
- icon : ' info' ,
16
+ colorScheme : " blue" ,
17
+ icon : " info" ,
18
18
} ,
19
19
success : {
20
- colorScheme : ' green' ,
21
- icon : ' check-circle' ,
20
+ colorScheme : " green" ,
21
+ icon : " check-circle" ,
22
22
} ,
23
23
warning : {
24
- colorScheme : ' orange' ,
25
- icon : ' warning-alt' ,
24
+ colorScheme : " orange" ,
25
+ icon : " warning-alt" ,
26
26
} ,
27
27
error : {
28
- colorScheme : ' red' ,
29
- icon : ' warning' ,
28
+ colorScheme : " red" ,
29
+ icon : " warning" ,
30
30
} ,
31
31
}
32
32
33
33
type AlertStatus = keyof typeof STATUSES
34
- export type AlertVariant = ' solid' | ' subtle' | ' left-accent' | ' top-accent'
34
+ export type AlertVariant = " solid" | " subtle" | " left-accent" | " top-accent"
35
35
36
36
interface AlertContext {
37
37
status : ComputedRef < AlertStatus >
38
38
}
39
39
40
40
const [ AlertProvider , useAlertContext ] = createContext < AlertContext > ( {
41
- name : ' AlertContext' ,
41
+ name : " AlertContext" ,
42
42
errorMessage :
43
- ' useAlertContext: `context` is undefined. Seems you forgot to wrap alert components in `<c-alert />`' ,
43
+ " useAlertContext: `context` is undefined. Seems you forgot to wrap alert components in `<c-alert />`" ,
44
44
} )
45
45
46
46
/**
@@ -50,15 +50,15 @@ const [AlertProvider, useAlertContext] = createContext<AlertContext>({
50
50
* It also provides state and context to it's compound components
51
51
*/
52
52
export const CAlert = defineComponent ( {
53
- name : ' CAlert' ,
53
+ name : " CAlert" ,
54
54
props : {
55
55
as : {
56
56
type : [ String , Object ] as PropType < DOMElements > ,
57
- default : ' div' ,
57
+ default : " div" ,
58
58
} ,
59
59
status : {
60
60
type : [ String ] as PropType < AlertStatus > ,
61
- default : ' info' ,
61
+ default : " info" ,
62
62
} ,
63
63
colorScheme : {
64
64
type : [ String ] as PropType < string > ,
@@ -68,7 +68,7 @@ export const CAlert = defineComponent({
68
68
} ,
69
69
variant : {
70
70
type : [ String ] as PropType < AlertVariant > ,
71
- default : ' solid' ,
71
+ default : " solid" ,
72
72
} ,
73
73
} ,
74
74
setup ( props , { slots, attrs } ) {
@@ -82,23 +82,23 @@ export const CAlert = defineComponent({
82
82
} ) )
83
83
84
84
AlertProvider ( { status : computed ( ( ) => props . status ) } )
85
- const styles = useMultiStyleConfig ( ' Alert' , themingProps . value )
85
+ const styles = useMultiStyleConfig ( " Alert" , themingProps . value )
86
86
StylesProvider ( styles )
87
87
88
88
const alertStyles = computed < SystemStyleObject > ( ( ) => ( {
89
- width : ' 100%' ,
90
- display : ' flex' ,
91
- alignItems : ' center' ,
92
- position : ' relative' ,
93
- overflow : ' hidden' ,
89
+ width : " 100%" ,
90
+ display : " flex" ,
91
+ alignItems : " center" ,
92
+ position : " relative" ,
93
+ overflow : " hidden" ,
94
94
...styles . value . container ,
95
95
} ) )
96
96
97
97
return ( ) => {
98
98
return h (
99
- chakra ( props . as , { label : ' alert' } ) ,
99
+ chakra ( props . as , { label : " alert" } ) ,
100
100
{
101
- role : ' alert' ,
101
+ role : " alert" ,
102
102
...alertStyles . value ,
103
103
...attrs ,
104
104
} ,
@@ -114,13 +114,13 @@ export const CAlert = defineComponent({
114
114
* The title component for alerts
115
115
*/
116
116
export const CAlertTitle = defineComponent ( {
117
- name : ' CAlertTitle' ,
117
+ name : " CAlertTitle" ,
118
118
setup ( _ , { attrs, slots } ) {
119
119
return ( ) => {
120
120
const styles = useStyles ( )
121
121
122
122
return h (
123
- chakra ( ' div' , { label : ' alert__title' } ) ,
123
+ chakra ( " div" , { label : " alert__title" } ) ,
124
124
{
125
125
...styles . value . title ,
126
126
...attrs ,
@@ -137,12 +137,12 @@ export const CAlertTitle = defineComponent({
137
137
* The description component for alerts
138
138
*/
139
139
export const CAlertDescription = defineComponent ( {
140
- name : ' CAlertDescription' ,
140
+ name : " CAlertDescription" ,
141
141
setup ( _ , { attrs, slots } ) {
142
142
const styles = useStyles ( )
143
143
return ( ) => {
144
144
return h (
145
- chakra ( ' div' , { label : ' alert__description' } ) ,
145
+ chakra ( " div" , { label : " alert__description" } ) ,
146
146
{
147
147
...styles . value . description ,
148
148
...attrs ,
@@ -159,7 +159,7 @@ export const CAlertDescription = defineComponent({
159
159
* The Icon component for alerts
160
160
*/
161
161
export const CAlertIcon = defineComponent ( {
162
- name : ' CAlertIcon' ,
162
+ name : " CAlertIcon" ,
163
163
props : {
164
164
icon : {
165
165
type : [ String ] as PropType < string > ,
@@ -173,7 +173,7 @@ export const CAlertIcon = defineComponent({
173
173
174
174
return ( ) => {
175
175
return h ( CIcon , {
176
- class : ' alert__icon' ,
176
+ class : " alert__icon" ,
177
177
name : alertIcon . value ,
178
178
...styles . value . icon ,
179
179
...attrs ,
0 commit comments