@coreui/react 4.0.0 → 4.1.1
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 +157 -0
- package/dist/components/accordion/CAccordionCollapse.d.ts +1 -1
- package/dist/components/collapse/CCollapse.d.ts +4 -0
- package/dist/components/form/CFormCheck.d.ts +4 -0
- package/dist/components/form/CFormLabel.d.ts +2 -2
- package/dist/components/form/CFormSelect.d.ts +13 -0
- package/dist/components/placeholder/CPlaceholder.d.ts +51 -0
- package/dist/components/popover/CPopover.d.ts +2 -2
- package/dist/components/tooltip/CTooltip.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.es.js +291 -181
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +291 -180
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/src/components/accordion/CAccordionCollapse.tsx +1 -1
- package/src/components/collapse/CCollapse.tsx +36 -3
- package/src/components/form/CFormCheck.tsx +30 -3
- package/src/components/form/CFormLabel.tsx +2 -2
- package/src/components/form/CFormSelect.tsx +28 -2
- package/src/components/form/__tests__/CFormLabel.spec.tsx +8 -0
- package/src/components/form/__tests__/__snapshots__/CFormLabel.spec.tsx.snap +11 -0
- package/src/components/grid/CCol.tsx +8 -8
- package/src/components/grid/CContainer.tsx +3 -3
- package/src/components/grid/CRow.tsx +6 -6
- package/src/components/offcanvas/COffcanvas.tsx +15 -2
- package/src/components/offcanvas/__tests__/COffcanvas.spec.tsx +1 -1
- package/src/components/offcanvas/__tests__/__snapshots__/COffcanvas.spec.tsx.snap +2 -2
- package/src/components/placeholder/CPlaceholder.tsx +114 -0
- package/src/components/placeholder/__tests__/CPlaceholder.spec.tsx +21 -0
- package/src/components/placeholder/__tests__/__snapshots__/CPlaceholder.spec.tsx.snap +17 -0
- package/src/components/popover/CPopover.tsx +4 -4
- package/src/components/tooltip/CTooltip.tsx +2 -2
- package/src/index.ts +2 -0
- package/src/utils/hooks/useForkedRef.ts +5 -0
|
@@ -13,7 +13,7 @@ export interface CPopoverProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* Content node for your component.
|
|
15
15
|
*/
|
|
16
|
-
content: ReactNode
|
|
16
|
+
content: ReactNode | string
|
|
17
17
|
/**
|
|
18
18
|
* Offset of the popover relative to its target.
|
|
19
19
|
*/
|
|
@@ -29,7 +29,7 @@ export interface CPopoverProps {
|
|
|
29
29
|
/**
|
|
30
30
|
* Title node for your component.
|
|
31
31
|
*/
|
|
32
|
-
title?: ReactNode
|
|
32
|
+
title?: ReactNode | string
|
|
33
33
|
/**
|
|
34
34
|
* Sets which event handlers you’d like provided to your toggle prop. You can specify one trigger or an array of them.
|
|
35
35
|
*
|
|
@@ -147,12 +147,12 @@ export const CPopover: FC<CPopoverProps> = ({
|
|
|
147
147
|
|
|
148
148
|
CPopover.propTypes = {
|
|
149
149
|
children: PropTypes.any,
|
|
150
|
-
content: PropTypes.node,
|
|
150
|
+
content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
151
151
|
placement: PropTypes.oneOf(['auto', 'top', 'right', 'bottom', 'left']),
|
|
152
152
|
offset: PropTypes.any, // TODO: find good proptype
|
|
153
153
|
onHide: PropTypes.func,
|
|
154
154
|
onShow: PropTypes.func,
|
|
155
|
-
title: PropTypes.string,
|
|
155
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
156
156
|
trigger: triggerPropType,
|
|
157
157
|
visible: PropTypes.bool,
|
|
158
158
|
}
|
|
@@ -13,7 +13,7 @@ export interface CTooltipProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* Content node for your component.
|
|
15
15
|
*/
|
|
16
|
-
content: ReactNode
|
|
16
|
+
content: ReactNode | string
|
|
17
17
|
/**
|
|
18
18
|
* Callback fired when the component requests to be hidden.
|
|
19
19
|
*/
|
|
@@ -126,7 +126,7 @@ export const CTooltip: FC<CTooltipProps> = ({
|
|
|
126
126
|
|
|
127
127
|
CTooltip.propTypes = {
|
|
128
128
|
children: PropTypes.any,
|
|
129
|
-
content: PropTypes.node,
|
|
129
|
+
content: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
130
130
|
placement: PropTypes.oneOf(['auto', 'top', 'right', 'bottom', 'left']),
|
|
131
131
|
onHide: PropTypes.func,
|
|
132
132
|
onShow: PropTypes.func,
|
package/src/index.ts
CHANGED
|
@@ -86,6 +86,7 @@ import { CNavbarText } from './components/navbar/CNavbarText'
|
|
|
86
86
|
import { CNavbarToggler } from './components/navbar/CNavbarToggler'
|
|
87
87
|
import { CPagination } from './components/pagination/CPagination'
|
|
88
88
|
import { CPaginationItem } from './components/pagination/CPaginationItem'
|
|
89
|
+
import { CPlaceholder } from './components/placeholder/CPlaceholder'
|
|
89
90
|
import { CPopover } from './components/popover/CPopover'
|
|
90
91
|
import { CProgress } from './components/progress/CProgress'
|
|
91
92
|
import { CProgressBar } from './components/progress/CProgressBar'
|
|
@@ -206,6 +207,7 @@ export {
|
|
|
206
207
|
CNavbarToggler,
|
|
207
208
|
CPagination,
|
|
208
209
|
CPaginationItem,
|
|
210
|
+
CPlaceholder,
|
|
209
211
|
CPopover,
|
|
210
212
|
CProgress,
|
|
211
213
|
CProgressBar,
|
|
@@ -9,6 +9,7 @@ export type AssignableRef<ValueType> =
|
|
|
9
9
|
}['bivarianceHack']
|
|
10
10
|
| React.MutableRefObject<ValueType | null>
|
|
11
11
|
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
13
|
export function useForkedRef<RefValueType = any>(
|
|
13
14
|
...refs: (AssignableRef<RefValueType> | null | undefined)[]
|
|
14
15
|
) {
|
|
@@ -16,6 +17,7 @@ export function useForkedRef<RefValueType = any>(
|
|
|
16
17
|
if (refs.every((ref) => ref == null)) {
|
|
17
18
|
return null
|
|
18
19
|
}
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
21
|
return (node: any) => {
|
|
20
22
|
refs.forEach((ref) => {
|
|
21
23
|
assignRef(ref, node)
|
|
@@ -24,8 +26,10 @@ export function useForkedRef<RefValueType = any>(
|
|
|
24
26
|
}, refs)
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
30
|
export function assignRef<RefValueType = any>(
|
|
28
31
|
ref: AssignableRef<RefValueType> | null | undefined,
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
33
|
value: any,
|
|
30
34
|
) {
|
|
31
35
|
if (ref == null) return
|
|
@@ -40,6 +44,7 @@ export function assignRef<RefValueType = any>(
|
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
|
43
48
|
export function isFunction(value: any): value is Function {
|
|
44
49
|
return !!(value && {}.toString.call(value) == '[object Function]')
|
|
45
50
|
}
|