Skip to content

Commit b984c53

Browse files
committed
Merge branch 'v4-dev' into v4
2 parents b954bc6 + 887ceec commit b984c53

File tree

287 files changed

+3914
-3062
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

287 files changed

+3914
-3062
lines changed

build/api.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,18 @@ const options = {
2020
savePropValueAsString: true,
2121
}
2222

23-
async function createMdx(filename, name, props) {
23+
async function createMdx(file, filename, name, props) {
2424
if (typeof props === 'undefined') return
2525

26-
let content = `| Property | Description | Type | Default |\n`
26+
let content = `
27+
\`\`\`jsx
28+
import { ${name} } from '@coreui/react'
29+
// or
30+
import ${name} from '@coreui/react/${file.replace('.tsx', '')}'
31+
\`\`\`\n
32+
`
33+
34+
content += `| Property | Description | Type | Default |\n`
2735
content += `| --- | --- | --- | --- |\n`
2836

2937
for (const [key, value] of Object.entries(props).sort()) {
@@ -34,13 +42,22 @@ async function createMdx(filename, name, props) {
3442
const name = value.name || ''
3543
const description =
3644
value.description.replaceAll('\n', '<br/>').replaceAll(' [docs]', '') || '-'
37-
const type =
38-
value.type ? value.type.name.includes('ReactElement')
45+
const type = value.type
46+
? value.type.name.includes('ReactElement')
3947
? 'ReactElement'
40-
: value.type.name : ''
41-
const defaultValue = value.defaultValue ? value.defaultValue.value : '-'
48+
: value.type.name
49+
: ''
50+
const defaultValue = value.defaultValue
51+
? value.defaultValue.value.replace('undefined', '-')
52+
: '-'
53+
const types = []
54+
type.split(' | ').map((element) => {
55+
types.push(`\`${element.replace(/"/g, "'")}\``)
56+
})
4257

43-
content += `| **${name}** | ${description} | \`${type}\` | ${defaultValue} |\n`
58+
// content += `| **${name}** | ${description} | \`${type
59+
// .replace(/"/g, "'")\` | ${defaultValue} |\n`
60+
content += `| **${name}** | ${description} | ${types.join(' \\| ')} | ${defaultValue} |\n`
4461
console.log(`${filename} - ${key}`)
4562
}
4663
}
@@ -63,7 +80,7 @@ async function main() {
6380
const props = docgen.parse(file, options)
6481
if (props && typeof props[0] !== 'undefined') {
6582
const filename = path.basename(file, '.tsx')
66-
createMdx(filename, props[0].displayName, props[0].props)
83+
createMdx(file, filename, props[0].displayName, props[0].props)
6784
}
6885
}),
6986
)

docs/4.0/api/CAccordion.api.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
2+
```jsx
3+
import { CAccordion } from '@coreui/react'
4+
// or
5+
import CAccordion from '@coreui/react/src/components/accordion/CAccordion'
6+
```
7+
18
| Property | Description | Type | Default |
29
| --- | --- | --- | --- |
3-
| **activeItemKey** | The active item key. | `string | number` | undefined |
10+
| **activeItemKey** | The active item key. | `string` \| `number` | - |
411
| **alwaysOpen** | Make accordion items stay open when another item is opened | `boolean` | false |
512
| **className** | A string of all className you want applied to the base component. | `string` | - |
613
| **flush** | Removes the default background-color, some borders, and some rounded corners to render accordions edge-to-edge with their parent container. | `boolean` | - |

docs/4.0/api/CAccordionBody.api.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2+
```jsx
3+
import { CAccordionBody } from '@coreui/react'
4+
// or
5+
import CAccordionBody from '@coreui/react/src/components/accordion/CAccordionBody'
6+
```
7+
18
| Property | Description | Type | Default |
29
| --- | --- | --- | --- |
310
| **className** | A string of all className you want applied to the base component. | `string` | - |

docs/4.0/api/CAccordionButton.api.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2+
```jsx
3+
import { CAccordionButton } from '@coreui/react'
4+
// or
5+
import CAccordionButton from '@coreui/react/src/components/accordion/CAccordionButton'
6+
```
7+
18
| Property | Description | Type | Default |
29
| --- | --- | --- | --- |
310
| **className** | A string of all className you want applied to the base component. | `string` | - |
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1+
2+
```jsx
3+
import { CAccordionCollapse } from '@coreui/react'
4+
// or
5+
import CAccordionCollapse from '@coreui/react/src/components/accordion/CAccordionCollapse'
6+
```
7+
18
| Property | Description | Type | Default |
29
| --- | --- | --- | --- |
310
| **className** | A string of all className you want applied to the base component. | `string` | - |
11+
| **onHide** | Callback fired when the component requests to be hidden. | `() => void` | - |
12+
| **onShow** | Callback fired when the component requests to be shown. | `() => void` | - |
413
| **visible** | Toggle the visibility of component. | `boolean` | - |

docs/4.0/api/CAccordionHeader.api.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2+
```jsx
3+
import { CAccordionHeader } from '@coreui/react'
4+
// or
5+
import CAccordionHeader from '@coreui/react/src/components/accordion/CAccordionHeader'
6+
```
7+
18
| Property | Description | Type | Default |
29
| --- | --- | --- | --- |
310
| **className** | A string of all className you want applied to the base component. | `string` | - |

docs/4.0/api/CAccordionItem.api.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
2+
```jsx
3+
import { CAccordionItem } from '@coreui/react'
4+
// or
5+
import CAccordionItem from '@coreui/react/src/components/accordion/CAccordionItem'
6+
```
7+
18
| Property | Description | Type | Default |
29
| --- | --- | --- | --- |
310
| **className** | A string of all className you want applied to the base component. | `string` | - |
4-
| **itemKey** | Item key. | `string | number` | - |
11+
| **itemKey** | Item key. | `string` \| `number` | - |

docs/4.0/api/CAlert.api.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
2+
```jsx
3+
import { CAlert } from '@coreui/react'
4+
// or
5+
import CAlert from '@coreui/react/src/components/alert/CAlert'
6+
```
7+
18
| Property | Description | Type | Default |
29
| --- | --- | --- | --- |
310
| **className** | A string of all className you want applied to the component. | `string` | - |
4-
| **color** | Sets the color context of the component to one of CoreUI’s themed colors. | `{'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string }` | primary |
11+
| **color** | Sets the color context of the component to one of CoreUI’s themed colors. | `'primary'` \| `'secondary'` \| `'success'` \| `'danger'` \| `'warning'` \| `'info'` \| `'dark'` \| `'light'` \| `string` | primary |
512
| **dismissible** | Optionally add a close button to alert and allow it to self dismiss. | `boolean` | - |
6-
| **onDismiss** | Method called before the dissmiss animation has started. | `() => void` | - |
7-
| **onDismissed** | Method called after the dissmiss animation has completed and the component is removed from the dom. | `() => void` | - |
13+
| **onClose** | Callback fired when the component requests to be closed. | `() => void` | - |
814
| **variant** | Set the alert variant to a solid. | `string` | - |
915
| **visible** | Toggle the visibility of component. | `boolean` | true |

docs/4.0/api/CAlertHeading.api.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
2+
```jsx
3+
import { CAlertHeading } from '@coreui/react'
4+
// or
5+
import CAlertHeading from '@coreui/react/src/components/alert/CAlertHeading'
6+
```
7+
18
| Property | Description | Type | Default |
29
| --- | --- | --- | --- |
310
| **className** | A string of all className you want applied to the base component. | `string` | - |
4-
| **component** | Component used for the root node. Either a string to use a HTML element or a component. | `string | ComponentClass<any, any> | FunctionComponent<any>` | 'h4' |
11+
| **component** | Component used for the root node. Either a string to use a HTML element or a component. | `string` \| `ComponentClass<any, any>` \| `FunctionComponent<any>` | - |

docs/4.0/api/CAlertLink.api.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2+
```jsx
3+
import { CAlertLink } from '@coreui/react'
4+
// or
5+
import CAlertLink from '@coreui/react/src/components/alert/CAlertLink'
6+
```
7+
18
| Property | Description | Type | Default |
29
| --- | --- | --- | --- |
310
| **className** | A string of all className you want applied to the base component. | `string` | - |

0 commit comments

Comments
 (0)