File tree Expand file tree Collapse file tree 7 files changed +35
-18
lines changed
packages/coreui-vue/src/components Expand file tree Collapse file tree 7 files changed +35
-18
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,15 @@ import { CFormFloating } from './CFormFloating'
4
4
import { CFormLabel } from './CFormLabel'
5
5
import { CFormText } from './CFormText'
6
6
7
+ type CFormControlValidationProps = InstanceType < typeof CFormControlValidation > [ '$props' ]
8
+
9
+ interface CFormControlWrapperProps {
10
+ floatingLabel ?: string
11
+ id ?: string
12
+ label ?: string
13
+ text ?: string
14
+ }
15
+
7
16
const CFormControlWrapper = defineComponent ( {
8
17
name : 'CFormControlWrapper' ,
9
18
inheritAttrs : false ,
@@ -32,7 +41,7 @@ const CFormControlWrapper = defineComponent({
32
41
*/
33
42
text : String ,
34
43
} ,
35
- setup ( props , { slots } ) {
44
+ setup ( props : CFormControlWrapperProps & CFormControlValidationProps , { slots } ) {
36
45
const formControlValidation = ( ) =>
37
46
h (
38
47
CFormControlValidation ,
Original file line number Diff line number Diff line change @@ -130,7 +130,9 @@ const CFormInput = defineComponent({
130
130
h (
131
131
CFormControlWrapper ,
132
132
{
133
- describedby : attrs [ 'aria-describedby' ] ,
133
+ ...( typeof attrs [ 'aria-describedby' ] === 'string' && {
134
+ describedby : attrs [ 'aria-describedby' ] ,
135
+ } ) ,
134
136
feedback : props . feedback ,
135
137
feedbackInvalid : props . feedbackInvalid ,
136
138
feedbackValid : props . feedbackValid ,
Original file line number Diff line number Diff line change @@ -119,7 +119,9 @@ const CFormSelect = defineComponent({
119
119
h (
120
120
CFormControlWrapper ,
121
121
{
122
- describedby : attrs [ 'aria-describedby' ] ,
122
+ ...( typeof attrs [ 'aria-describedby' ] === 'string' && {
123
+ describedby : attrs [ 'aria-describedby' ] ,
124
+ } ) ,
123
125
feedback : props . feedback ,
124
126
feedbackInvalid : props . feedbackInvalid ,
125
127
feedbackValid : props . feedbackValid ,
Original file line number Diff line number Diff line change @@ -106,7 +106,9 @@ const CFormTextarea = defineComponent({
106
106
h (
107
107
CFormControlWrapper ,
108
108
{
109
- describedby : attrs [ 'aria-describedby' ] ,
109
+ ...( typeof attrs [ 'aria-describedby' ] === 'string' && {
110
+ describedby : attrs [ 'aria-describedby' ] ,
111
+ } ) ,
110
112
feedback : props . feedback ,
111
113
feedbackInvalid : props . feedbackInvalid ,
112
114
feedbackValid : props . feedbackValid ,
Original file line number Diff line number Diff line change @@ -2,6 +2,12 @@ import { defineComponent, h } from 'vue'
2
2
3
3
import { CNavLink } from './CNavLink'
4
4
5
+ type CNavLinkProps = Omit < InstanceType < typeof CNavLink > [ '$props' ] , 'as' >
6
+
7
+ interface CNavItemProps {
8
+ as : string
9
+ }
10
+
5
11
const CNavItem = defineComponent ( {
6
12
name : 'CNavItem' ,
7
13
props : {
@@ -14,12 +20,11 @@ const CNavItem = defineComponent({
14
20
default : 'li' ,
15
21
} ,
16
22
} ,
17
- setup ( props , { slots } ) {
23
+ setup ( props : CNavLinkProps & CNavItemProps , { slots } ) {
18
24
return ( ) =>
19
25
h (
20
26
props . as ,
21
27
{
22
- as : props . component ,
23
28
class : 'nav-item' ,
24
29
} ,
25
30
props . href
Original file line number Diff line number Diff line change 1
1
import { defineComponent , h , inject } from 'vue'
2
2
import { CCloseButton } from '../close-button/CCloseButton'
3
3
4
+ type CCloseButtonProps = InstanceType < typeof CCloseButton > [ '$props' ]
5
+
6
+ interface CToastCloseProps {
7
+ as : string
8
+ }
9
+
4
10
const CToastClose = defineComponent ( {
5
11
name : 'CToastClose' ,
6
12
props : {
@@ -16,7 +22,7 @@ const CToastClose = defineComponent({
16
22
*/
17
23
'close' ,
18
24
] ,
19
- setup ( props , { slots, emit } ) {
25
+ setup ( props : CToastCloseProps & CCloseButtonProps , { slots, emit } ) {
20
26
// eslint-disable-next-line no-unused-vars
21
27
const updateVisible = inject ( 'updateVisible' ) as ( visible : boolean ) => void
22
28
const handleClose = ( ) => {
Original file line number Diff line number Diff line change @@ -9,20 +9,11 @@ const CToastHeader = defineComponent({
9
9
*/
10
10
closeButton : Boolean ,
11
11
} ,
12
- emits : [
13
- /**
14
- * Event called after clicking the close button.
15
- */
16
- 'close' ,
17
- ] ,
18
- setup ( props , { slots, emit } ) {
12
+ setup ( props , { slots } ) {
19
13
return ( ) =>
20
14
h ( 'div' , { class : 'toast-header' } , [
21
15
slots . default && slots . default ( ) ,
22
- props . closeButton &&
23
- h ( CToastClose , {
24
- onClose : ( ) => emit ( 'close' ) ,
25
- } ) ,
16
+ props . closeButton && h ( CToastClose ) ,
26
17
] )
27
18
} ,
28
19
} )
You can’t perform that action at this time.
0 commit comments