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'
44import { CFormLabel } from './CFormLabel'
55import { CFormText } from './CFormText'
66
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+
716const CFormControlWrapper = defineComponent ( {
817 name : 'CFormControlWrapper' ,
918 inheritAttrs : false ,
@@ -32,7 +41,7 @@ const CFormControlWrapper = defineComponent({
3241 */
3342 text : String ,
3443 } ,
35- setup ( props , { slots } ) {
44+ setup ( props : CFormControlWrapperProps & CFormControlValidationProps , { slots } ) {
3645 const formControlValidation = ( ) =>
3746 h (
3847 CFormControlValidation ,
Original file line number Diff line number Diff line change @@ -130,7 +130,9 @@ const CFormInput = defineComponent({
130130 h (
131131 CFormControlWrapper ,
132132 {
133- describedby : attrs [ 'aria-describedby' ] ,
133+ ...( typeof attrs [ 'aria-describedby' ] === 'string' && {
134+ describedby : attrs [ 'aria-describedby' ] ,
135+ } ) ,
134136 feedback : props . feedback ,
135137 feedbackInvalid : props . feedbackInvalid ,
136138 feedbackValid : props . feedbackValid ,
Original file line number Diff line number Diff line change @@ -119,7 +119,9 @@ const CFormSelect = defineComponent({
119119 h (
120120 CFormControlWrapper ,
121121 {
122- describedby : attrs [ 'aria-describedby' ] ,
122+ ...( typeof attrs [ 'aria-describedby' ] === 'string' && {
123+ describedby : attrs [ 'aria-describedby' ] ,
124+ } ) ,
123125 feedback : props . feedback ,
124126 feedbackInvalid : props . feedbackInvalid ,
125127 feedbackValid : props . feedbackValid ,
Original file line number Diff line number Diff line change @@ -106,7 +106,9 @@ const CFormTextarea = defineComponent({
106106 h (
107107 CFormControlWrapper ,
108108 {
109- describedby : attrs [ 'aria-describedby' ] ,
109+ ...( typeof attrs [ 'aria-describedby' ] === 'string' && {
110+ describedby : attrs [ 'aria-describedby' ] ,
111+ } ) ,
110112 feedback : props . feedback ,
111113 feedbackInvalid : props . feedbackInvalid ,
112114 feedbackValid : props . feedbackValid ,
Original file line number Diff line number Diff line change @@ -2,6 +2,12 @@ import { defineComponent, h } from 'vue'
22
33import { CNavLink } from './CNavLink'
44
5+ type CNavLinkProps = Omit < InstanceType < typeof CNavLink > [ '$props' ] , 'as' >
6+
7+ interface CNavItemProps {
8+ as : string
9+ }
10+
511const CNavItem = defineComponent ( {
612 name : 'CNavItem' ,
713 props : {
@@ -14,12 +20,11 @@ const CNavItem = defineComponent({
1420 default : 'li' ,
1521 } ,
1622 } ,
17- setup ( props , { slots } ) {
23+ setup ( props : CNavLinkProps & CNavItemProps , { slots } ) {
1824 return ( ) =>
1925 h (
2026 props . as ,
2127 {
22- as : props . component ,
2328 class : 'nav-item' ,
2429 } ,
2530 props . href
Original file line number Diff line number Diff line change 11import { defineComponent , h , inject } from 'vue'
22import { CCloseButton } from '../close-button/CCloseButton'
33
4+ type CCloseButtonProps = InstanceType < typeof CCloseButton > [ '$props' ]
5+
6+ interface CToastCloseProps {
7+ as : string
8+ }
9+
410const CToastClose = defineComponent ( {
511 name : 'CToastClose' ,
612 props : {
@@ -16,7 +22,7 @@ const CToastClose = defineComponent({
1622 */
1723 'close' ,
1824 ] ,
19- setup ( props , { slots, emit } ) {
25+ setup ( props : CToastCloseProps & CCloseButtonProps , { slots, emit } ) {
2026 // eslint-disable-next-line no-unused-vars
2127 const updateVisible = inject ( 'updateVisible' ) as ( visible : boolean ) => void
2228 const handleClose = ( ) => {
Original file line number Diff line number Diff line change @@ -9,20 +9,11 @@ const CToastHeader = defineComponent({
99 */
1010 closeButton : Boolean ,
1111 } ,
12- emits : [
13- /**
14- * Event called after clicking the close button.
15- */
16- 'close' ,
17- ] ,
18- setup ( props , { slots, emit } ) {
12+ setup ( props , { slots } ) {
1913 return ( ) =>
2014 h ( 'div' , { class : 'toast-header' } , [
2115 slots . default && slots . default ( ) ,
22- props . closeButton &&
23- h ( CToastClose , {
24- onClose : ( ) => emit ( 'close' ) ,
25- } ) ,
16+ props . closeButton && h ( CToastClose ) ,
2617 ] )
2718 } ,
2819} )
You can’t perform that action at this time.
0 commit comments