8
8
* @see WAI-ARIA https://www.w3.org/TR/wai-aria-practices-1.2
9
9
*/
10
10
11
- import { h , defineComponent , PropType , ConcreteComponent , Component , computed , cloneVNode , VNode , VNodeProps , mergeProps } from 'vue'
11
+ import { defineComponent , PropType , computed , cloneVNode , VNode , h } from 'vue'
12
12
import {
13
13
chakra ,
14
14
HTMLChakraProps ,
@@ -17,22 +17,23 @@ import {
17
17
StylesProvider ,
18
18
useMultiStyleConfig ,
19
19
useStyles ,
20
- SystemStyleObject
20
+ SystemStyleObject ,
21
+ ChakraProps
21
22
} from '@chakra-ui/vue-system'
22
23
import { filterUndefined } from '@chakra-ui/utils'
23
24
import { getValidChildren , SNA , SNAO } from '@chakra-ui/vue-utils'
25
+ import { DOMElements } from '@chakra-ui/vue-system'
24
26
25
27
/**
26
28
* CBreadcrumb (root)
27
29
*/
28
30
29
-
30
31
export interface BreadcrumbOptions {
31
32
/**
32
33
* The visual separator between each breadcrumb item
33
34
* @type string | ConcreteComponent | Component
34
35
*/
35
- separator ?: string | ConcreteComponent | Component
36
+ separator ?: string | object
36
37
/**
37
38
* The left and right margin applied to the separator
38
39
* @type SystemProps["mx"]
@@ -41,7 +42,7 @@ export interface BreadcrumbOptions {
41
42
}
42
43
43
44
export interface BreadcrumbProps
44
- extends HTMLChakraProps < 'nav' > ,
45
+ extends ChakraProps ,
45
46
BreadcrumbOptions ,
46
47
ThemingProps < 'Breadcrumb' > { }
47
48
@@ -81,11 +82,12 @@ export const CBreadcrumb = defineComponent(
81
82
return (
82
83
< chakra . nav
83
84
as = { props . as }
85
+ __label = "breadcrumb"
84
86
aria-label = "breadcrumb"
85
87
__css = { styles . value . container }
86
88
{ ...attrs }
87
89
>
88
- < chakra . ol __label = "chakra- breadcrumb__list" >
90
+ < chakra . ol __label = "breadcrumb__list" >
89
91
{ ( ) => children }
90
92
</ chakra . ol >
91
93
</ chakra . nav >
@@ -106,7 +108,7 @@ CBreadcrumb.props = {
106
108
default : '0.5rem'
107
109
} ,
108
110
as : {
109
- type : [ String , Object ] as PropType < DOMElements | Component | string > ,
111
+ type : [ String , Object ] as PropType < DOMElements | object | string > ,
110
112
default : 'nav' ,
111
113
} ,
112
114
}
@@ -138,7 +140,7 @@ export const CBreadcrumbSeparator = defineComponent((props: BreadcrumbSeparatorP
138
140
return ( ) => (
139
141
< chakra . span
140
142
role = "presentation"
141
- __label = "chakra- breadcrumb__separator"
143
+ __label = "breadcrumb__separator"
142
144
{ ...attrs }
143
145
__css = { separatorStyles . value }
144
146
>
@@ -167,7 +169,7 @@ interface BreadcrumbItemOptions extends BreadcrumbOptions {
167
169
168
170
export interface BreadcrumbItemProps
169
171
extends BreadcrumbItemOptions ,
170
- HTMLChakraProps < "li" > { }
172
+ ChakraProps { }
171
173
172
174
export const CBreadcrumbItem = defineComponent ( ( props : BreadcrumbItemProps , { attrs, slots } ) => {
173
175
const styles = useStyles ( )
@@ -199,7 +201,7 @@ export const CBreadcrumbItem = defineComponent((props: BreadcrumbItemProps, { at
199
201
} )
200
202
201
203
return (
202
- < chakra . li __label = "chakra- breadcrumb__list-it " __css = { itemStyles . value } >
204
+ < chakra . li __label = "breadcrumb__list-item " __css = { itemStyles . value } >
203
205
{ children }
204
206
{ ! props . isLastChild && (
205
207
// @ts -expect-error
@@ -224,8 +226,9 @@ CBreadcrumbItem.props = {
224
226
* CBreadcrumbLink
225
227
*/
226
228
227
- export interface BreadcrumbLinkProps extends HTMLChakraProps < "a" > {
228
- isCurrentPage ?: boolean
229
+ export interface BreadcrumbLinkProps extends ChakraProps {
230
+ isCurrentPage ?: boolean ,
231
+ href ?: string
229
232
}
230
233
231
234
/**
@@ -240,14 +243,14 @@ export const CBreadcrumbLink = defineComponent((props: BreadcrumbLinkProps, { at
240
243
return ( ) => {
241
244
if ( props . isCurrentPage ) {
242
245
return (
243
- < chakra . span __label = "chakra- breadcrumb__link" aria-current = "page" __css = { styles . value . link } as = { props . as } { ...attrs } >
246
+ < chakra . span __label = "breadcrumb__link" aria-current = "page" __css = { styles . value . link } as = { props . as } { ...attrs } >
244
247
{ slots }
245
248
</ chakra . span >
246
249
)
247
250
}
248
251
249
252
return (
250
- < chakra . a __label = "chakra- breadcrumb__link" as = { props . as } __css = { styles . value . link } { ...attrs } >
253
+ < chakra . a __label = "breadcrumb__link" as = { props . as } __css = { styles . value . link } { ...attrs } >
251
254
{ slots }
252
255
</ chakra . a >
253
256
)
0 commit comments