Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 69a05dd

Browse filesBrowse files
committed
refactor: update shared props types handling
1 parent e0239fd commit 69a05dd
Copy full SHA for 69a05dd

File tree

6 files changed

+22
-15
lines changed
Filter options

6 files changed

+22
-15
lines changed

‎packages/coreui-vue/package.json

Copy file name to clipboardExpand all lines: packages/coreui-vue/package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@
6262
"vue-types": "^5.1.3"
6363
},
6464
"peerDependencies": {
65-
"vue": "^3.2.21"
65+
"vue": "^3.5.0"
6666
}
6767
}

‎packages/coreui-vue/src/components/form/CFormControlWrapper.ts

Copy file name to clipboardExpand all lines: packages/coreui-vue/src/components/form/CFormControlWrapper.ts
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { CFormFloating } from './CFormFloating'
44
import { CFormLabel } from './CFormLabel'
55
import { CFormText } from './CFormText'
66

7-
type CFormControlValidationProps = InstanceType<typeof CFormControlValidation>['$props']
7+
import type { ComponentProps } from '../../utils/ComponentProps'
88

9-
interface CFormControlWrapperProps {
9+
interface CFormControlWrapperProps extends ComponentProps<typeof CFormControlValidation> {
1010
floatingLabel?: string
1111
id?: string
1212
label?: string
@@ -27,7 +27,9 @@ const CFormControlWrapper = defineComponent({
2727
/**
2828
* @ignore
2929
*/
30-
id: String,
30+
id: {
31+
type: String,
32+
},
3133
/**
3234
* Add a caption for a component.
3335
*
@@ -41,7 +43,7 @@ const CFormControlWrapper = defineComponent({
4143
*/
4244
text: String,
4345
},
44-
setup(props: CFormControlWrapperProps & CFormControlValidationProps, { slots }) {
46+
setup(props: CFormControlWrapperProps, { slots }) {
4547
const formControlValidation = () =>
4648
h(
4749
CFormControlValidation,
@@ -50,7 +52,6 @@ const CFormControlWrapper = defineComponent({
5052
feedback: props.feedback,
5153
feedbackInvalid: props.feedbackInvalid,
5254
feedbackValid: props.feedbackValid,
53-
floatingLabel: props.floatingLabel,
5455
invalid: props.invalid,
5556
tooltipFeedback: props.tooltipFeedback,
5657
valid: props.valid,

‎packages/coreui-vue/src/components/nav/CNavItem.ts

Copy file name to clipboardExpand all lines: packages/coreui-vue/src/components/nav/CNavItem.ts
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { defineComponent, h } from 'vue'
2-
32
import { CNavLink } from './CNavLink'
43

5-
type CNavLinkProps = Omit<InstanceType<typeof CNavLink>['$props'], 'as'>
4+
import type { ComponentProps } from '../../utils/ComponentProps'
65

7-
interface CNavItemProps {
6+
interface CNavItemProps extends ComponentProps<typeof CNavLink> {
87
as: string
98
}
109

@@ -20,7 +19,7 @@ const CNavItem = defineComponent({
2019
default: 'li',
2120
},
2221
},
23-
setup(props: CNavLinkProps & CNavItemProps, { slots }) {
22+
setup(props: CNavItemProps, { slots }) {
2423
return () =>
2524
h(
2625
props.as,

‎packages/coreui-vue/src/components/toast/CToastClose.ts

Copy file name to clipboardExpand all lines: packages/coreui-vue/src/components/toast/CToastClose.ts
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { defineComponent, h, inject, resolveComponent } from 'vue'
22
import { CCloseButton } from '../close-button/CCloseButton'
33

4-
type CCloseButtonProps = InstanceType<typeof CCloseButton>['$props']
4+
import type { ComponentProps } from '../../utils/ComponentProps'
55

6-
interface CToastCloseProps {
7-
as: string
6+
interface CCloseButtonProps extends ComponentProps<typeof CCloseButton> {
7+
as?: string
88
}
99

1010
const CToastClose = defineComponent({
@@ -22,7 +22,7 @@ const CToastClose = defineComponent({
2222
*/
2323
'close',
2424
],
25-
setup(props: CToastCloseProps & CCloseButtonProps, { slots, emit }) {
25+
setup(props: CCloseButtonProps, { slots, emit }) {
2626
// eslint-disable-next-line no-unused-vars
2727
const updateVisible = inject('updateVisible') as (visible: boolean) => void
2828
const handleClose = () => {
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { DefineComponent, ExtractPropTypes, ExtractPublicPropTypes } from 'vue'
2+
3+
export type ComponentProps<T> =
4+
T extends DefineComponent<ExtractPropTypes<infer Props>, any, any>
5+
? ExtractPublicPropTypes<Props>
6+
: never

‎packages/docs/build/docgen.config.js

Copy file name to clipboardExpand all lines: packages/docs/build/docgen.config.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ module.exports = {
88
components: [
99
'**/[A-Z]*.ts',
1010
'!**/[A-Z]*.d.ts',
11-
'!**/[A-Z]*.spec.ts'
11+
'!**/[A-Z]*.spec.ts',
12+
'!**/ComponentProps.ts',
1213
],
1314
outDir: 'api', // folder to save components docs in (relative to the current working directry)
1415
getDocFileName: (componentPath) =>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.