@coreui/react 4.1.2 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/accordion/index.d.ts +7 -0
- package/dist/components/alert/index.d.ts +4 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/backdrop/index.d.ts +2 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.d.ts +3 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button-group/index.d.ts +3 -0
- package/dist/components/callout/index.d.ts +2 -0
- package/dist/components/card/CCardImage.d.ts +2 -2
- package/dist/components/card/index.d.ts +12 -0
- package/dist/components/carousel/index.d.ts +4 -0
- package/dist/components/close-button/index.d.ts +2 -0
- package/dist/components/collapse/index.d.ts +2 -0
- package/dist/components/dropdown/CDropdown.d.ts +10 -1
- package/dist/components/dropdown/CDropdownToggle.d.ts +4 -0
- package/dist/components/dropdown/index.d.ts +8 -0
- package/dist/components/footer/index.d.ts +2 -0
- package/dist/components/form/CForm.d.ts +2 -2
- package/dist/components/form/CFormCheck.d.ts +2 -1
- package/dist/components/form/CFormControlValidation.d.ts +46 -0
- package/dist/components/form/CFormControlWrapper.d.ts +31 -0
- package/dist/components/form/CFormInput.d.ts +6 -9
- package/dist/components/form/CFormRange.d.ts +7 -1
- package/dist/components/form/CFormSelect.d.ts +3 -10
- package/dist/components/form/CFormTextarea.d.ts +2 -9
- package/dist/components/form/index.d.ts +14 -0
- package/dist/components/grid/index.d.ts +4 -0
- package/dist/components/header/index.d.ts +7 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/link/index.d.ts +2 -0
- package/dist/components/list-group/index.d.ts +3 -0
- package/dist/components/modal/CModal.d.ts +3 -0
- package/dist/components/modal/index.d.ts +8 -0
- package/dist/components/nav/index.d.ts +7 -0
- package/dist/components/navbar/index.d.ts +6 -0
- package/dist/components/offcanvas/index.d.ts +5 -0
- package/dist/components/pagination/index.d.ts +3 -0
- package/dist/components/placeholder/index.d.ts +2 -0
- package/dist/components/popover/CPopover.d.ts +2 -2
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/progress/index.d.ts +3 -0
- package/dist/components/sidebar/index.d.ts +7 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/table/index.d.ts +9 -0
- package/dist/components/tabs/index.d.ts +3 -0
- package/dist/components/toast/index.d.ts +6 -0
- package/dist/components/tooltip/CTooltip.d.ts +6 -2
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/index.d.ts +0 -120
- package/dist/index.es.js +3039 -2179
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +3034 -2174
- package/dist/index.js.map +1 -1
- package/package.json +17 -16
- package/src/components/accordion/CAccordionButton.tsx +2 -1
- package/src/components/accordion/__tests__/__snapshots__/CAccordionButton.spec.tsx.snap +2 -0
- package/src/components/accordion/__tests__/__snapshots__/CAccordionHeader.spec.tsx.snap +2 -0
- package/src/components/accordion/index.ts +15 -0
- package/src/components/alert/CAlert.tsx +14 -3
- package/src/components/alert/index.ts +5 -0
- package/src/components/avatar/index.ts +3 -0
- package/src/components/backdrop/CBackdrop.tsx +10 -3
- package/src/components/backdrop/index.ts +3 -0
- package/src/components/badge/index.ts +3 -0
- package/src/components/breadcrumb/index.ts +4 -0
- package/src/components/button/index.ts +3 -0
- package/src/components/button-group/index.ts +4 -0
- package/src/components/callout/index.ts +3 -0
- package/src/components/card/CCardImage.tsx +2 -2
- package/src/components/card/index.ts +25 -0
- package/src/components/carousel/index.ts +5 -0
- package/src/components/close-button/CCloseButton.tsx +8 -1
- package/src/components/close-button/index.ts +3 -0
- package/src/components/collapse/CCollapse.tsx +1 -0
- package/src/components/collapse/index.ts +3 -0
- package/src/components/dropdown/CDropdown.tsx +19 -24
- package/src/components/dropdown/CDropdownItem.tsx +1 -1
- package/src/components/dropdown/CDropdownMenu.tsx +55 -3
- package/src/components/dropdown/CDropdownToggle.tsx +28 -5
- package/src/components/dropdown/index.ts +17 -0
- package/src/components/footer/index.ts +3 -0
- package/src/components/form/CForm.tsx +2 -2
- package/src/components/form/CFormCheck.tsx +32 -7
- package/src/components/form/CFormControlValidation.tsx +97 -0
- package/src/components/form/CFormControlWrapper.tsx +85 -0
- package/src/components/form/CFormInput.tsx +75 -19
- package/src/components/form/CFormRange.tsx +18 -4
- package/src/components/form/CFormSelect.tsx +60 -32
- package/src/components/form/CFormTextarea.tsx +45 -17
- package/src/components/form/index.ts +29 -0
- package/src/components/grid/index.ts +5 -0
- package/src/components/header/index.ts +8 -0
- package/src/components/image/index.ts +3 -0
- package/src/components/index.ts +35 -0
- package/src/components/link/index.ts +3 -0
- package/src/components/list-group/index.ts +4 -0
- package/src/components/modal/CModal.tsx +4 -3
- package/src/components/modal/index.ts +9 -0
- package/src/components/nav/CNavGroup.tsx +1 -0
- package/src/components/nav/index.ts +8 -0
- package/src/components/navbar/index.ts +7 -0
- package/src/components/offcanvas/COffcanvas.tsx +2 -1
- package/src/components/offcanvas/index.ts +6 -0
- package/src/components/pagination/index.ts +4 -0
- package/src/components/placeholder/index.ts +3 -0
- package/src/components/popover/CPopover.tsx +59 -57
- package/src/components/popover/__tests__/__snapshots__/CPopover.spec.tsx.snap +1 -1
- package/src/components/popover/index.ts +3 -0
- package/src/components/progress/index.ts +4 -0
- package/src/components/sidebar/index.ts +8 -0
- package/src/components/spinner/index.ts +3 -0
- package/src/components/table/index.ts +19 -0
- package/src/components/tabs/CTabPane.tsx +7 -3
- package/src/components/tabs/index.ts +4 -0
- package/src/components/toast/CToast.tsx +6 -1
- package/src/components/toast/index.ts +7 -0
- package/src/components/tooltip/CTooltip.tsx +63 -45
- package/src/components/tooltip/index.ts +3 -0
- package/src/index.ts +0 -242
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CForm } from './CForm'
|
|
2
|
+
import { CFormCheck } from './CFormCheck'
|
|
3
|
+
import { CFormFeedback } from './CFormFeedback'
|
|
4
|
+
import { CFormFloating } from './CFormFloating'
|
|
5
|
+
import { CFormInput } from './CFormInput'
|
|
6
|
+
import { CFormLabel } from './CFormLabel'
|
|
7
|
+
import { CFormRange } from './CFormRange'
|
|
8
|
+
import { CFormSelect } from './CFormSelect'
|
|
9
|
+
import { CFormSwitch } from './CFormSwitch'
|
|
10
|
+
import { CFormText } from './CFormText'
|
|
11
|
+
import { CFormTextarea } from './CFormTextarea'
|
|
12
|
+
import { CInputGroup } from './CInputGroup'
|
|
13
|
+
import { CInputGroupText } from './CInputGroupText'
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
CForm,
|
|
17
|
+
CFormCheck,
|
|
18
|
+
CFormFeedback,
|
|
19
|
+
CFormFloating,
|
|
20
|
+
CFormInput,
|
|
21
|
+
CFormLabel,
|
|
22
|
+
CFormRange,
|
|
23
|
+
CFormSelect,
|
|
24
|
+
CFormSwitch,
|
|
25
|
+
CFormText,
|
|
26
|
+
CFormTextarea,
|
|
27
|
+
CInputGroup,
|
|
28
|
+
CInputGroupText,
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CHeader } from './CHeader'
|
|
2
|
+
import { CHeaderBrand } from './CHeaderBrand'
|
|
3
|
+
import { CHeaderDivider } from './CHeaderDivider'
|
|
4
|
+
import { CHeaderNav } from './CHeaderNav'
|
|
5
|
+
import { CHeaderText } from './CHeaderText'
|
|
6
|
+
import { CHeaderToggler } from './CHeaderToggler'
|
|
7
|
+
|
|
8
|
+
export { CHeader, CHeaderBrand, CHeaderDivider, CHeaderNav, CHeaderText, CHeaderToggler }
|
package/src/components/index.ts
CHANGED
|
@@ -1 +1,36 @@
|
|
|
1
|
+
export * from './accordion'
|
|
2
|
+
export * from './alert'
|
|
3
|
+
export * from './avatar'
|
|
4
|
+
export * from './backdrop'
|
|
5
|
+
export * from './badge'
|
|
6
|
+
export * from './breadcrumb'
|
|
7
|
+
export * from './button'
|
|
8
|
+
export * from './button-group'
|
|
9
|
+
export * from './callout'
|
|
10
|
+
export * from './card'
|
|
11
|
+
export * from './carousel'
|
|
12
|
+
export * from './close-button'
|
|
13
|
+
export * from './collapse'
|
|
14
|
+
export * from './dropdown'
|
|
15
|
+
export * from './footer'
|
|
16
|
+
export * from './form'
|
|
17
|
+
export * from './grid'
|
|
18
|
+
export * from './header'
|
|
19
|
+
export * from './image'
|
|
20
|
+
export * from './link'
|
|
21
|
+
export * from './list-group'
|
|
22
|
+
export * from './modal'
|
|
23
|
+
export * from './nav'
|
|
24
|
+
export * from './navbar'
|
|
25
|
+
export * from './offcanvas'
|
|
26
|
+
export * from './pagination'
|
|
27
|
+
export * from './placeholder'
|
|
28
|
+
export * from './progress'
|
|
29
|
+
export * from './popover'
|
|
30
|
+
export * from './sidebar'
|
|
31
|
+
export * from './spinner'
|
|
32
|
+
export * from './table'
|
|
33
|
+
export * from './tabs'
|
|
34
|
+
export * from './toast'
|
|
35
|
+
export * from './tooltip'
|
|
1
36
|
export * from './widgets'
|
|
@@ -72,8 +72,8 @@ export interface CModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
72
72
|
* Remove animation to create modal that simply appear rather than fade in to view.
|
|
73
73
|
*/
|
|
74
74
|
transition?: boolean
|
|
75
|
-
|
|
76
|
-
* By default the component is unmounted after close animation, if you want to keep the component mounted set this property to false
|
|
75
|
+
/**
|
|
76
|
+
* By default the component is unmounted after close animation, if you want to keep the component mounted set this property to false.
|
|
77
77
|
*/
|
|
78
78
|
unmountOnClose?: boolean
|
|
79
79
|
/**
|
|
@@ -193,7 +193,7 @@ export const CModal = forwardRef<HTMLDivElement, CModalProps>(
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
const handleKeyDown = useCallback(
|
|
196
|
-
(event) => {
|
|
196
|
+
(event: KeyboardEvent) => {
|
|
197
197
|
if (event.key === 'Escape' && keyboard) {
|
|
198
198
|
return handleDismiss()
|
|
199
199
|
}
|
|
@@ -228,6 +228,7 @@ export const CModal = forwardRef<HTMLDivElement, CModalProps>(
|
|
|
228
228
|
<Transition
|
|
229
229
|
in={_visible}
|
|
230
230
|
mountOnEnter
|
|
231
|
+
nodeRef={modalRef}
|
|
231
232
|
onEnter={onShow}
|
|
232
233
|
onExit={onClose}
|
|
233
234
|
unmountOnExit={unmountOnClose}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CModal } from './CModal'
|
|
2
|
+
import { CModalBody } from './CModalBody'
|
|
3
|
+
import { CModalContent } from './CModalContent'
|
|
4
|
+
import { CModalDialog } from './CModalDialog'
|
|
5
|
+
import { CModalFooter } from './CModalFooter'
|
|
6
|
+
import { CModalHeader } from './CModalHeader'
|
|
7
|
+
import { CModalTitle } from './CModalTitle'
|
|
8
|
+
|
|
9
|
+
export { CModal, CModalBody, CModalContent, CModalDialog, CModalFooter, CModalHeader, CModalTitle }
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CNav } from './CNav'
|
|
2
|
+
import { CNavGroupItems } from './CNavGroupItems'
|
|
3
|
+
import { CNavGroup } from './CNavGroup'
|
|
4
|
+
import { CNavItem } from './CNavItem'
|
|
5
|
+
import { CNavLink } from './CNavLink'
|
|
6
|
+
import { CNavTitle } from './CNavTitle'
|
|
7
|
+
|
|
8
|
+
export { CNav, CNavGroup, CNavGroupItems, CNavItem, CNavLink, CNavTitle }
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CNavbar } from './CNavbar'
|
|
2
|
+
import { CNavbarBrand } from './CNavbarBrand'
|
|
3
|
+
import { CNavbarNav } from './CNavbarNav'
|
|
4
|
+
import { CNavbarText } from './CNavbarText'
|
|
5
|
+
import { CNavbarToggler } from './CNavbarToggler'
|
|
6
|
+
|
|
7
|
+
export { CNavbar, CNavbarBrand, CNavbarNav, CNavbarText, CNavbarToggler }
|
|
@@ -107,7 +107,7 @@ export const COffcanvas = forwardRef<HTMLDivElement, COffcanvasProps>(
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
const handleKeyDown = useCallback(
|
|
110
|
-
(event) => {
|
|
110
|
+
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
111
111
|
if (event.key === 'Escape' && keyboard) {
|
|
112
112
|
return handleDismiss()
|
|
113
113
|
}
|
|
@@ -137,6 +137,7 @@ export const COffcanvas = forwardRef<HTMLDivElement, COffcanvasProps>(
|
|
|
137
137
|
<>
|
|
138
138
|
<Transition
|
|
139
139
|
in={_visible}
|
|
140
|
+
nodeRef={offcanvasRef}
|
|
140
141
|
onEnter={onShow}
|
|
141
142
|
onEntered={() => offcanvasRef.current?.focus()}
|
|
142
143
|
onExit={onHide}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { COffcanvas } from './COffcanvas'
|
|
2
|
+
import { COffcanvasBody } from './COffcanvasBody'
|
|
3
|
+
import { COffcanvasHeader } from './COffcanvasHeader'
|
|
4
|
+
import { COffcanvasTitle } from './COffcanvasTitle'
|
|
5
|
+
|
|
6
|
+
export { COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasTitle }
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import React, { FC,
|
|
1
|
+
import React, { FC, ReactNode, useRef, useState } from 'react'
|
|
2
2
|
import { createPortal } from 'react-dom'
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import classNames from 'classnames'
|
|
5
|
-
import
|
|
5
|
+
import PropTypes from 'prop-types'
|
|
6
|
+
import { usePopper } from 'react-popper'
|
|
6
7
|
import { Transition } from 'react-transition-group'
|
|
7
8
|
|
|
8
|
-
// import { CPopoverContent } from './CPopoverContent'
|
|
9
9
|
import { Triggers, triggerPropType } from '../Types'
|
|
10
10
|
|
|
11
11
|
export interface CPopoverProps {
|
|
12
|
-
|
|
12
|
+
// TODO: find solution to not use any
|
|
13
|
+
children: any
|
|
13
14
|
/**
|
|
14
15
|
* Content node for your component.
|
|
15
16
|
*/
|
|
@@ -49,16 +50,33 @@ export interface CPopoverProps {
|
|
|
49
50
|
export const CPopover: FC<CPopoverProps> = ({
|
|
50
51
|
children,
|
|
51
52
|
content,
|
|
52
|
-
placement = 'top',
|
|
53
53
|
offset = [0, 8],
|
|
54
54
|
onHide,
|
|
55
55
|
onShow,
|
|
56
|
+
placement = 'top',
|
|
56
57
|
title,
|
|
57
58
|
trigger = 'click',
|
|
58
59
|
visible,
|
|
59
60
|
...rest
|
|
60
61
|
}) => {
|
|
61
62
|
const [_visible, setVisible] = useState(visible)
|
|
63
|
+
const popoverRef = useRef()
|
|
64
|
+
|
|
65
|
+
const [referenceElement, setReferenceElement] = useState(null)
|
|
66
|
+
const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null)
|
|
67
|
+
const [arrowElement, setArrowElement] = useState<HTMLDivElement | null>(null)
|
|
68
|
+
const { styles, attributes } = usePopper(referenceElement, popperElement, {
|
|
69
|
+
modifiers: [
|
|
70
|
+
{ name: 'arrow', options: { element: arrowElement } },
|
|
71
|
+
{
|
|
72
|
+
name: 'offset',
|
|
73
|
+
options: {
|
|
74
|
+
offset: offset,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
placement: placement,
|
|
79
|
+
})
|
|
62
80
|
|
|
63
81
|
const getTransitionClass = (state: string) => {
|
|
64
82
|
return state === 'entering'
|
|
@@ -71,32 +89,29 @@ export const CPopover: FC<CPopoverProps> = ({
|
|
|
71
89
|
}
|
|
72
90
|
|
|
73
91
|
return (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}),
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
</Reference>
|
|
92
|
+
<>
|
|
93
|
+
{React.cloneElement(children, {
|
|
94
|
+
ref: setReferenceElement,
|
|
95
|
+
...((trigger === 'click' || trigger.includes('click')) && {
|
|
96
|
+
onClick: () => setVisible(!_visible),
|
|
97
|
+
}),
|
|
98
|
+
...((trigger === 'focus' || trigger.includes('focus')) && {
|
|
99
|
+
onFocus: () => setVisible(true),
|
|
100
|
+
onBlur: () => setVisible(false),
|
|
101
|
+
}),
|
|
102
|
+
...((trigger === 'hover' || trigger.includes('hover')) && {
|
|
103
|
+
onMouseEnter: () => setVisible(true),
|
|
104
|
+
onMouseLeave: () => setVisible(false),
|
|
105
|
+
}),
|
|
106
|
+
})}
|
|
93
107
|
{typeof window !== 'undefined' &&
|
|
94
108
|
createPortal(
|
|
95
109
|
<Transition
|
|
96
110
|
in={_visible}
|
|
111
|
+
mountOnEnter
|
|
112
|
+
nodeRef={popoverRef}
|
|
97
113
|
onEnter={onShow}
|
|
98
114
|
onExit={onHide}
|
|
99
|
-
mountOnEnter
|
|
100
115
|
timeout={{
|
|
101
116
|
enter: 0,
|
|
102
117
|
exit: 200,
|
|
@@ -106,52 +121,39 @@ export const CPopover: FC<CPopoverProps> = ({
|
|
|
106
121
|
{(state) => {
|
|
107
122
|
const transitionClass = getTransitionClass(state)
|
|
108
123
|
return (
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
offset: offset,
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
]}
|
|
119
|
-
>
|
|
120
|
-
{({ arrowProps, style, ref }) => (
|
|
121
|
-
<div
|
|
122
|
-
className={classNames(
|
|
123
|
-
`popover bs-popover-${
|
|
124
|
-
placement === 'left' ? 'start' : placement === 'right' ? 'end' : placement
|
|
125
|
-
}`,
|
|
126
|
-
transitionClass,
|
|
127
|
-
)}
|
|
128
|
-
ref={ref}
|
|
129
|
-
role="tooltip"
|
|
130
|
-
style={style}
|
|
131
|
-
{...rest}
|
|
132
|
-
>
|
|
133
|
-
<div className="popover-arrow" {...arrowProps}></div>
|
|
134
|
-
<div className="popover-header">{title}</div>
|
|
135
|
-
<div className="popover-body">{content}</div>
|
|
136
|
-
</div>
|
|
124
|
+
<div
|
|
125
|
+
className={classNames(
|
|
126
|
+
`popover bs-popover-${
|
|
127
|
+
placement === 'left' ? 'start' : placement === 'right' ? 'end' : placement
|
|
128
|
+
}`,
|
|
129
|
+
transitionClass,
|
|
137
130
|
)}
|
|
138
|
-
|
|
131
|
+
ref={setPopperElement}
|
|
132
|
+
role="tooltip"
|
|
133
|
+
style={styles.popper}
|
|
134
|
+
{...attributes.popper}
|
|
135
|
+
{...rest}
|
|
136
|
+
>
|
|
137
|
+
<div className="popover-arrow" style={styles.arrow} ref={setArrowElement}></div>
|
|
138
|
+
<div className="popover-header">{title}</div>
|
|
139
|
+
<div className="popover-body">{content}</div>
|
|
140
|
+
</div>
|
|
139
141
|
)
|
|
140
142
|
}}
|
|
141
143
|
</Transition>,
|
|
142
144
|
document.body,
|
|
143
145
|
)}
|
|
144
|
-
|
|
146
|
+
</>
|
|
145
147
|
)
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
CPopover.propTypes = {
|
|
149
151
|
children: PropTypes.any,
|
|
150
152
|
content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
151
|
-
placement: PropTypes.oneOf(['auto', 'top', 'right', 'bottom', 'left']),
|
|
152
153
|
offset: PropTypes.any, // TODO: find good proptype
|
|
153
154
|
onHide: PropTypes.func,
|
|
154
155
|
onShow: PropTypes.func,
|
|
156
|
+
placement: PropTypes.oneOf(['auto', 'top', 'right', 'bottom', 'left']),
|
|
155
157
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
156
158
|
trigger: triggerPropType,
|
|
157
159
|
visible: PropTypes.bool,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CSidebar } from './CSidebar'
|
|
2
|
+
import { CSidebarBrand } from './CSidebarBrand'
|
|
3
|
+
import { CSidebarFooter } from './CSidebarFooter'
|
|
4
|
+
import { CSidebarToggler } from './CSidebarToggler'
|
|
5
|
+
import { CSidebarHeader } from './CSidebarHeader'
|
|
6
|
+
import { CSidebarNav } from './CSidebarNav'
|
|
7
|
+
|
|
8
|
+
export { CSidebar, CSidebarBrand, CSidebarFooter, CSidebarToggler, CSidebarHeader, CSidebarNav }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CTable } from './CTable'
|
|
2
|
+
import { CTableBody } from './CTableBody'
|
|
3
|
+
import { CTableCaption } from './CTableCaption'
|
|
4
|
+
import { CTableDataCell } from './CTableDataCell'
|
|
5
|
+
import { CTableFoot } from './CTableFoot'
|
|
6
|
+
import { CTableHead } from './CTableHead'
|
|
7
|
+
import { CTableHeaderCell } from './CTableHeaderCell'
|
|
8
|
+
import { CTableRow } from './CTableRow'
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
CTable,
|
|
12
|
+
CTableBody,
|
|
13
|
+
CTableCaption,
|
|
14
|
+
CTableDataCell,
|
|
15
|
+
CTableFoot,
|
|
16
|
+
CTableHead,
|
|
17
|
+
CTableHeaderCell,
|
|
18
|
+
CTableRow,
|
|
19
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React, { HTMLAttributes, forwardRef } from 'react'
|
|
1
|
+
import React, { HTMLAttributes, forwardRef, useRef } from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import classNames from 'classnames'
|
|
4
4
|
import { Transition } from 'react-transition-group'
|
|
5
5
|
|
|
6
|
+
import { useForkedRef } from '../../utils/hooks'
|
|
6
7
|
export interface CTabPaneProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
8
|
/**
|
|
8
9
|
* A string of all className you want applied to the base component.
|
|
@@ -24,6 +25,9 @@ export interface CTabPaneProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
24
25
|
|
|
25
26
|
export const CTabPane = forwardRef<HTMLDivElement, CTabPaneProps>(
|
|
26
27
|
({ children, className, onHide, onShow, visible, ...rest }, ref) => {
|
|
28
|
+
const tabPaneRef = useRef()
|
|
29
|
+
const forkedRef = useForkedRef(ref, tabPaneRef)
|
|
30
|
+
|
|
27
31
|
const getTransitionClass = (state: string) => {
|
|
28
32
|
return state === 'entered' && 'show'
|
|
29
33
|
}
|
|
@@ -37,11 +41,11 @@ export const CTabPane = forwardRef<HTMLDivElement, CTabPaneProps>(
|
|
|
37
41
|
className,
|
|
38
42
|
)
|
|
39
43
|
return (
|
|
40
|
-
<Transition in={visible} onEnter={onShow} onExit={onHide} timeout={150}>
|
|
44
|
+
<Transition in={visible} nodeRef={tabPaneRef} onEnter={onShow} onExit={onHide} timeout={150}>
|
|
41
45
|
{(state) => {
|
|
42
46
|
const transitionClass = getTransitionClass(state)
|
|
43
47
|
return (
|
|
44
|
-
<div className={classNames(_className, transitionClass)} {...rest} ref={
|
|
48
|
+
<div className={classNames(_className, transitionClass)} {...rest} ref={forkedRef}>
|
|
45
49
|
{children}
|
|
46
50
|
</div>
|
|
47
51
|
)
|
|
@@ -12,6 +12,8 @@ import classNames from 'classnames'
|
|
|
12
12
|
|
|
13
13
|
import { Colors, colorPropType } from '../Types'
|
|
14
14
|
|
|
15
|
+
import { useForkedRef } from '../../utils/hooks'
|
|
16
|
+
|
|
15
17
|
export interface CToastProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
16
18
|
/**
|
|
17
19
|
* Apply a CSS fade transition to the toast.
|
|
@@ -82,6 +84,8 @@ export const CToast = forwardRef<HTMLDivElement, CToastProps>(
|
|
|
82
84
|
},
|
|
83
85
|
ref,
|
|
84
86
|
) => {
|
|
87
|
+
const toastRef = useRef()
|
|
88
|
+
const forkedRef = useForkedRef(ref, toastRef)
|
|
85
89
|
const [_visible, setVisible] = useState(false)
|
|
86
90
|
const timeout = useRef<number>()
|
|
87
91
|
|
|
@@ -133,6 +137,7 @@ export const CToast = forwardRef<HTMLDivElement, CToastProps>(
|
|
|
133
137
|
return (
|
|
134
138
|
<Transition
|
|
135
139
|
in={_visible}
|
|
140
|
+
nodeRef={toastRef}
|
|
136
141
|
onEnter={() => onShow && onShow(index ? index : null)}
|
|
137
142
|
onExited={() => onClose && onClose(index ? index : null)}
|
|
138
143
|
timeout={250}
|
|
@@ -151,7 +156,7 @@ export const CToast = forwardRef<HTMLDivElement, CToastProps>(
|
|
|
151
156
|
onMouseLeave={() => _autohide}
|
|
152
157
|
{...rest}
|
|
153
158
|
key={key}
|
|
154
|
-
ref={
|
|
159
|
+
ref={forkedRef}
|
|
155
160
|
>
|
|
156
161
|
{children}
|
|
157
162
|
</div>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CToast } from './CToast'
|
|
2
|
+
import { CToastBody } from './CToastBody'
|
|
3
|
+
import { CToastClose } from './CToastClose'
|
|
4
|
+
import { CToastHeader } from './CToastHeader'
|
|
5
|
+
import { CToaster } from './CToaster'
|
|
6
|
+
|
|
7
|
+
export { CToast, CToastBody, CToastClose, CToastHeader, CToaster }
|