@coreui/react-pro 4.2.0-beta.0 → 4.2.0
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/calendar/CCalendar.d.ts +36 -12
- package/dist/components/callout/index.d.ts +2 -0
- 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/date-picker/CDatePicker.d.ts +13 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +93 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/datepicker/index.d.ts +2 -0
- package/dist/components/daterangepicker/CDateRangePicker.d.ts +26 -11
- package/dist/components/daterangepicker/index.d.ts +2 -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 +41 -0
- package/dist/components/link/index.d.ts +2 -0
- package/dist/components/list-group/index.d.ts +3 -0
- package/dist/components/loading-button/index.d.ts +2 -0
- package/dist/components/modal/CModal.d.ts +3 -0
- package/dist/components/modal/index.d.ts +8 -0
- package/dist/components/multi-select/index.d.ts +2 -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 +4 -0
- package/dist/components/picker/CPicker.d.ts +52 -7
- 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/smart-table/index.d.ts +2 -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/time-picker/CTimePicker.d.ts +45 -0
- package/dist/components/time-picker/CTimePickerRollCol.d.ts +11 -0
- package/dist/components/time-picker/index.d.ts +2 -0
- package/dist/components/timepicker/CTimePicker.d.ts +9 -13
- package/dist/components/timepicker/index.d.ts +2 -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 -128
- package/dist/index.es.js +8368 -5764
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +8367 -5764
- package/dist/index.js.map +1 -1
- package/dist/{components/calendar/CCalendar.utils.d.ts → utils/calendar.d.ts} +5 -2
- package/dist/utils/hooks/useStateWithCallback.d.ts +2 -1
- package/dist/utils/time.d.ts +21 -0
- package/package.json +14 -11
- 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/calendar/CCalendar.tsx +221 -131
- package/src/components/calendar/__tests__/CCalendar.spec.tsx +9 -0
- package/src/components/calendar/__tests__/__snapshots__/CCalendar.spec.tsx.snap +573 -0
- package/src/components/callout/index.ts +3 -0
- package/src/components/card/index.ts +25 -0
- package/src/components/carousel/index.ts +5 -0
- 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/{datepicker → date-picker}/CDatePicker.tsx +3 -2
- package/src/components/date-picker/__tests__/CDatePicker.spec.tsx +9 -0
- package/src/components/date-picker/__tests__/__snapshots__/CDatePicker.spec.tsx.snap +617 -0
- package/src/components/date-picker/index.ts +3 -0
- package/src/components/date-range-picker/CDateRangePicker.tsx +495 -0
- package/src/components/date-range-picker/__tests__/CDateRangePicker.spec.tsx +9 -0
- package/src/components/date-range-picker/__tests__/__snapshots__/CDateRangePicker.spec.tsx.snap +1201 -0
- package/src/components/date-range-picker/index.ts +3 -0
- package/src/components/dropdown/CDropdownItem.tsx +1 -1
- package/src/components/dropdown/CDropdownMenu.tsx +14 -14
- 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 +41 -0
- package/src/components/link/index.ts +3 -0
- package/src/components/list-group/index.ts +4 -0
- package/src/components/loading-button/index.ts +3 -0
- package/src/components/modal/CModal.tsx +3 -2
- package/src/components/modal/index.ts +9 -0
- package/src/components/multi-select/CMultiSelect.tsx +46 -38
- package/src/components/multi-select/index.ts +3 -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 +1 -0
- package/src/components/offcanvas/index.ts +6 -0
- package/src/components/pagination/index.ts +5 -0
- package/src/components/picker/CPicker.tsx +104 -32
- package/src/components/picker/__tests__/CPicker.spec.tsx +9 -0
- package/src/components/picker/__tests__/__snapshots__/CPicker.spec.tsx.snap +23 -0
- package/src/components/placeholder/index.ts +3 -0
- package/src/components/popover/CPopover.tsx +59 -57
- 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/smart-table/CSmartTable.tsx +2 -2
- package/src/components/smart-table/index.ts +3 -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/{timepicker → time-picker}/CTimePicker.tsx +71 -98
- package/src/components/{timepicker → time-picker}/CTimePickerRollCol.tsx +7 -1
- package/src/components/time-picker/__tests__/CTimePicker.spec.tsx +9 -0
- package/src/components/time-picker/index.ts +3 -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 -258
- package/src/{components/calendar/CCalendar.utils.ts → utils/calendar.ts} +97 -10
- package/src/utils/hooks/useStateWithCallback.ts +6 -3
- package/src/utils/time.ts +84 -0
- package/dist/components/dropdown/CDropdownToggleCustom.d.ts +0 -15
- package/dist/components/timepicker/CTimePicker.utils.d.ts +0 -4
- package/src/components/daterangepicker/CDateRangePicker.tsx +0 -366
- package/src/components/timepicker/CTimePicker.utils.ts +0 -27
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import React, { ChangeEventHandler, forwardRef, InputHTMLAttributes } from 'react'
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
+
import PropTypes from 'prop-types'
|
|
5
|
+
|
|
6
|
+
import { CFormControlWrapper, CFormControlWrapperProps } from './CFormControlWrapper'
|
|
4
7
|
|
|
5
8
|
type Option = {
|
|
6
9
|
disabled?: boolean
|
|
7
10
|
label?: string
|
|
8
11
|
value?: string
|
|
9
12
|
}
|
|
10
|
-
export interface CFormSelectProps
|
|
13
|
+
export interface CFormSelectProps
|
|
14
|
+
extends CFormControlWrapperProps,
|
|
15
|
+
Omit<InputHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
11
16
|
/**
|
|
12
17
|
* A string of all className you want applied to the component.
|
|
13
18
|
*/
|
|
@@ -16,10 +21,6 @@ export interface CFormSelectProps extends Omit<InputHTMLAttributes<HTMLSelectEle
|
|
|
16
21
|
* Specifies the number of visible options in a drop-down list.
|
|
17
22
|
*/
|
|
18
23
|
htmlSize?: number
|
|
19
|
-
/**
|
|
20
|
-
* Set component validation state to invalid.
|
|
21
|
-
*/
|
|
22
|
-
invalid?: boolean
|
|
23
24
|
/**
|
|
24
25
|
* Method called immediately after the `value` prop changes.
|
|
25
26
|
*/
|
|
@@ -35,20 +36,36 @@ export interface CFormSelectProps extends Omit<InputHTMLAttributes<HTMLSelectEle
|
|
|
35
36
|
* Size the component small or large.
|
|
36
37
|
*/
|
|
37
38
|
size?: 'sm' | 'lg'
|
|
38
|
-
/**
|
|
39
|
-
* Set component validation state to valid.
|
|
40
|
-
*/
|
|
41
|
-
valid?: boolean
|
|
42
39
|
/**
|
|
43
40
|
* The `value` attribute of component.
|
|
44
41
|
*
|
|
45
42
|
* @controllable onChange
|
|
46
|
-
|
|
43
|
+
*/
|
|
47
44
|
value?: string | string[] | number
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
export const CFormSelect = forwardRef<HTMLSelectElement, CFormSelectProps>(
|
|
51
|
-
(
|
|
48
|
+
(
|
|
49
|
+
{
|
|
50
|
+
children,
|
|
51
|
+
className,
|
|
52
|
+
feedback,
|
|
53
|
+
feedbackInvalid,
|
|
54
|
+
feedbackValid,
|
|
55
|
+
floatingLabel,
|
|
56
|
+
htmlSize,
|
|
57
|
+
id,
|
|
58
|
+
invalid,
|
|
59
|
+
label,
|
|
60
|
+
options,
|
|
61
|
+
size,
|
|
62
|
+
text,
|
|
63
|
+
tooltipFeedback,
|
|
64
|
+
valid,
|
|
65
|
+
...rest
|
|
66
|
+
},
|
|
67
|
+
ref,
|
|
68
|
+
) => {
|
|
52
69
|
const _className = classNames(
|
|
53
70
|
'form-select',
|
|
54
71
|
{
|
|
@@ -59,34 +76,45 @@ export const CFormSelect = forwardRef<HTMLSelectElement, CFormSelectProps>(
|
|
|
59
76
|
className,
|
|
60
77
|
)
|
|
61
78
|
return (
|
|
62
|
-
<
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
<CFormControlWrapper
|
|
80
|
+
describedby={rest['aria-describedby']}
|
|
81
|
+
feedback={feedback}
|
|
82
|
+
feedbackInvalid={feedbackInvalid}
|
|
83
|
+
feedbackValid={feedbackValid}
|
|
84
|
+
floatingLabel={floatingLabel}
|
|
85
|
+
id={id}
|
|
86
|
+
invalid={invalid}
|
|
87
|
+
label={label}
|
|
88
|
+
text={text}
|
|
89
|
+
tooltipFeedback={tooltipFeedback}
|
|
90
|
+
valid={valid}
|
|
91
|
+
>
|
|
92
|
+
<select id={id} className={_className} size={htmlSize} {...rest} ref={ref}>
|
|
93
|
+
{options
|
|
94
|
+
? options.map((option, index) => {
|
|
95
|
+
return (
|
|
96
|
+
<option
|
|
97
|
+
{...(typeof option === 'object' &&
|
|
98
|
+
option.disabled && { disabled: option.disabled })}
|
|
99
|
+
{...(typeof option === 'object' && option.value && { value: option.value })}
|
|
100
|
+
key={index}
|
|
101
|
+
>
|
|
102
|
+
{typeof option === 'string' ? option : option.label}
|
|
103
|
+
</option>
|
|
104
|
+
)
|
|
105
|
+
})
|
|
106
|
+
: children}
|
|
107
|
+
</select>
|
|
108
|
+
</CFormControlWrapper>
|
|
78
109
|
)
|
|
79
110
|
},
|
|
80
111
|
)
|
|
81
112
|
|
|
82
113
|
CFormSelect.propTypes = {
|
|
83
|
-
children: PropTypes.node,
|
|
84
114
|
className: PropTypes.string,
|
|
85
115
|
htmlSize: PropTypes.number,
|
|
86
|
-
invalid: PropTypes.bool,
|
|
87
116
|
options: PropTypes.array,
|
|
88
|
-
|
|
89
|
-
valid: PropTypes.bool,
|
|
117
|
+
...CFormControlWrapper.propTypes,
|
|
90
118
|
}
|
|
91
119
|
|
|
92
120
|
CFormSelect.displayName = 'CFormSelect'
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import React, { ChangeEventHandler, forwardRef, InputHTMLAttributes } from 'react'
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import classNames from 'classnames'
|
|
4
|
+
import PropTypes from 'prop-types'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
import { CFormControlWrapper, CFormControlWrapperProps } from './CFormControlWrapper'
|
|
7
|
+
|
|
8
|
+
export interface CFormTextareaProps
|
|
9
|
+
extends CFormControlWrapperProps,
|
|
10
|
+
InputHTMLAttributes<HTMLTextAreaElement> {
|
|
6
11
|
/**
|
|
7
12
|
* A string of all className you want applied to the component.
|
|
8
13
|
*/
|
|
@@ -11,10 +16,6 @@ export interface CFormTextareaProps extends InputHTMLAttributes<HTMLTextAreaElem
|
|
|
11
16
|
* Toggle the disabled state for the component.
|
|
12
17
|
*/
|
|
13
18
|
disabled?: boolean
|
|
14
|
-
/**
|
|
15
|
-
* Set component validation state to invalid.
|
|
16
|
-
*/
|
|
17
|
-
invalid?: boolean
|
|
18
19
|
/**
|
|
19
20
|
* Method called immediately after the `value` prop changes.
|
|
20
21
|
*/
|
|
@@ -27,10 +28,6 @@ export interface CFormTextareaProps extends InputHTMLAttributes<HTMLTextAreaElem
|
|
|
27
28
|
* Toggle the readonly state for the component.
|
|
28
29
|
*/
|
|
29
30
|
readOnly?: boolean
|
|
30
|
-
/**
|
|
31
|
-
* Set component validation state to valid.
|
|
32
|
-
*/
|
|
33
|
-
valid?: boolean
|
|
34
31
|
/**
|
|
35
32
|
* The `value` attribute of component.
|
|
36
33
|
*
|
|
@@ -40,7 +37,25 @@ export interface CFormTextareaProps extends InputHTMLAttributes<HTMLTextAreaElem
|
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
export const CFormTextarea = forwardRef<HTMLTextAreaElement, CFormTextareaProps>(
|
|
43
|
-
(
|
|
40
|
+
(
|
|
41
|
+
{
|
|
42
|
+
children,
|
|
43
|
+
className,
|
|
44
|
+
feedback,
|
|
45
|
+
feedbackInvalid,
|
|
46
|
+
feedbackValid,
|
|
47
|
+
floatingLabel,
|
|
48
|
+
id,
|
|
49
|
+
invalid,
|
|
50
|
+
label,
|
|
51
|
+
plainText,
|
|
52
|
+
text,
|
|
53
|
+
tooltipFeedback,
|
|
54
|
+
valid,
|
|
55
|
+
...rest
|
|
56
|
+
},
|
|
57
|
+
ref,
|
|
58
|
+
) => {
|
|
44
59
|
const _className = classNames(
|
|
45
60
|
plainText ? 'form-control-plaintext' : 'form-control',
|
|
46
61
|
{
|
|
@@ -50,19 +65,32 @@ export const CFormTextarea = forwardRef<HTMLTextAreaElement, CFormTextareaProps>
|
|
|
50
65
|
className,
|
|
51
66
|
)
|
|
52
67
|
return (
|
|
53
|
-
<
|
|
54
|
-
{
|
|
55
|
-
|
|
68
|
+
<CFormControlWrapper
|
|
69
|
+
describedby={rest['aria-describedby']}
|
|
70
|
+
feedback={feedback}
|
|
71
|
+
feedbackInvalid={feedbackInvalid}
|
|
72
|
+
feedbackValid={feedbackValid}
|
|
73
|
+
floatingLabel={floatingLabel}
|
|
74
|
+
id={id}
|
|
75
|
+
invalid={invalid}
|
|
76
|
+
label={label}
|
|
77
|
+
text={text}
|
|
78
|
+
tooltipFeedback={tooltipFeedback}
|
|
79
|
+
valid={valid}
|
|
80
|
+
>
|
|
81
|
+
<textarea className={_className} {...rest} ref={ref}>
|
|
82
|
+
{children}
|
|
83
|
+
</textarea>
|
|
84
|
+
</CFormControlWrapper>
|
|
56
85
|
)
|
|
57
86
|
},
|
|
58
87
|
)
|
|
59
88
|
|
|
60
89
|
CFormTextarea.propTypes = {
|
|
61
|
-
children: PropTypes.node,
|
|
62
90
|
className: PropTypes.string,
|
|
63
|
-
|
|
91
|
+
id: PropTypes.string,
|
|
64
92
|
plainText: PropTypes.bool,
|
|
65
|
-
|
|
93
|
+
...CFormControlWrapper.propTypes,
|
|
66
94
|
}
|
|
67
95
|
|
|
68
96
|
CFormTextarea.displayName = 'CFormTextarea'
|
|
@@ -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,42 @@
|
|
|
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 './date-picker'
|
|
15
|
+
export * from './date-range-picker'
|
|
16
|
+
export * from './dropdown'
|
|
17
|
+
export * from './footer'
|
|
18
|
+
export * from './form'
|
|
19
|
+
export * from './grid'
|
|
20
|
+
export * from './header'
|
|
21
|
+
export * from './image'
|
|
22
|
+
export * from './link'
|
|
23
|
+
export * from './list-group'
|
|
24
|
+
export * from './loading-button'
|
|
25
|
+
export * from './modal'
|
|
26
|
+
export * from './multi-select'
|
|
27
|
+
export * from './nav'
|
|
28
|
+
export * from './navbar'
|
|
29
|
+
export * from './offcanvas'
|
|
30
|
+
export * from './pagination'
|
|
31
|
+
export * from './placeholder'
|
|
32
|
+
export * from './progress'
|
|
33
|
+
export * from './popover'
|
|
34
|
+
export * from './smart-table'
|
|
35
|
+
export * from './sidebar'
|
|
36
|
+
export * from './spinner'
|
|
37
|
+
export * from './table'
|
|
38
|
+
export * from './tabs'
|
|
39
|
+
export * from './time-picker'
|
|
40
|
+
export * from './toast'
|
|
41
|
+
export * from './tooltip'
|
|
1
42
|
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
|
/**
|
|
@@ -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 }
|
|
@@ -8,10 +8,9 @@ import React, {
|
|
|
8
8
|
useState,
|
|
9
9
|
useRef,
|
|
10
10
|
} from 'react'
|
|
11
|
-
import PropTypes from 'prop-types'
|
|
12
|
-
import classNames from 'classnames'
|
|
13
11
|
|
|
14
|
-
import
|
|
12
|
+
import classNames from 'classnames'
|
|
13
|
+
import PropTypes from 'prop-types'
|
|
15
14
|
|
|
16
15
|
import { CMultiSelectCleaner } from './CMultiSelectCleaner'
|
|
17
16
|
import { CMultiSelectNativeSelect } from './CMultiSelectNativeSelect'
|
|
@@ -20,6 +19,7 @@ import { CMultiSelectSearchInput } from './CMultiSelectSearchInput'
|
|
|
20
19
|
import { CMultiSelectSelectAllButton } from './CMultiSelectSelectAllButton'
|
|
21
20
|
import { CMultiSelectSelection } from './CMultiSelectSelection'
|
|
22
21
|
|
|
22
|
+
import { useForkedRef } from '../../utils/hooks'
|
|
23
23
|
export interface CMultiSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
24
24
|
/**
|
|
25
25
|
* A string of all className you want applied to the base component.
|
|
@@ -89,6 +89,7 @@ export interface Option {
|
|
|
89
89
|
options?: Option[]
|
|
90
90
|
order?: number
|
|
91
91
|
selected?: boolean
|
|
92
|
+
// TODO: change to label
|
|
92
93
|
text: string
|
|
93
94
|
value: number | string
|
|
94
95
|
}
|
|
@@ -279,6 +280,13 @@ export const CMultiSelect = forwardRef<HTMLDivElement, CMultiSelectProps>(
|
|
|
279
280
|
|
|
280
281
|
const handleOptionOnClick = (option: Option) => {
|
|
281
282
|
setOptions(updateOptions(option.value))
|
|
283
|
+
if (!multiple) {
|
|
284
|
+
setVisible(false)
|
|
285
|
+
setSearch('')
|
|
286
|
+
if (searchRef.current) {
|
|
287
|
+
searchRef.current.value = ''
|
|
288
|
+
}
|
|
289
|
+
}
|
|
282
290
|
}
|
|
283
291
|
|
|
284
292
|
const handleSelectAll = () => {
|
|
@@ -302,42 +310,42 @@ export const CMultiSelect = forwardRef<HTMLDivElement, CMultiSelectProps>(
|
|
|
302
310
|
onChange={() => onChange && onChange(selected)}
|
|
303
311
|
ref={nativeSelectRef}
|
|
304
312
|
/>
|
|
305
|
-
<div
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
selectionTypeCounterText={selectionTypeCounterText}
|
|
320
|
-
/>
|
|
321
|
-
{multiple && cleaner && selected.length > 0 && (
|
|
322
|
-
<CMultiSelectCleaner onClick={() => handleDeselectAll()} />
|
|
323
|
-
)}
|
|
324
|
-
{search && (
|
|
325
|
-
<CMultiSelectSearchInput
|
|
326
|
-
{...(selected.length === 0 && { placeholder: placeholder })}
|
|
327
|
-
{...(selected.length &&
|
|
328
|
-
selectionType === 'counter' && {
|
|
329
|
-
placeholder: `${selected.length} ${selectionTypeCounterText}`,
|
|
330
|
-
})}
|
|
331
|
-
{...(selected.length &&
|
|
332
|
-
!multiple && { placeholder: selected.map((option) => option.text)[0] })}
|
|
333
|
-
onChange={(event) => handleSearchChange(event)}
|
|
334
|
-
onKeyDown={(event) => handleSearchKeyDown(event)}
|
|
335
|
-
{...(multiple &&
|
|
336
|
-
selected.length &&
|
|
337
|
-
selectionType !== 'counter' && { size: _search.length + 2 })}
|
|
338
|
-
ref={searchRef}
|
|
313
|
+
<div className={_className} ref={forkedRef}>
|
|
314
|
+
<div
|
|
315
|
+
onClick={() => {
|
|
316
|
+
setVisible(true)
|
|
317
|
+
search && searchRef.current?.focus()
|
|
318
|
+
}}
|
|
319
|
+
>
|
|
320
|
+
<CMultiSelectSelection
|
|
321
|
+
multiple={multiple}
|
|
322
|
+
onRemove={(option) => handleOptionOnClick(option)}
|
|
323
|
+
search={search}
|
|
324
|
+
selected={selected}
|
|
325
|
+
selectionType={selectionType}
|
|
326
|
+
selectionTypeCounterText={selectionTypeCounterText}
|
|
339
327
|
/>
|
|
340
|
-
|
|
328
|
+
{multiple && cleaner && selected.length > 0 && (
|
|
329
|
+
<CMultiSelectCleaner onClick={() => handleDeselectAll()} />
|
|
330
|
+
)}
|
|
331
|
+
{search && (
|
|
332
|
+
<CMultiSelectSearchInput
|
|
333
|
+
{...(selected.length === 0 && { placeholder: placeholder })}
|
|
334
|
+
{...(selected.length &&
|
|
335
|
+
selectionType === 'counter' && {
|
|
336
|
+
placeholder: `${selected.length} ${selectionTypeCounterText}`,
|
|
337
|
+
})}
|
|
338
|
+
{...(selected.length &&
|
|
339
|
+
!multiple && { placeholder: selected.map((option) => option.text)[0] })}
|
|
340
|
+
onChange={(event) => handleSearchChange(event)}
|
|
341
|
+
onKeyDown={(event) => handleSearchKeyDown(event)}
|
|
342
|
+
{...(multiple &&
|
|
343
|
+
selected.length &&
|
|
344
|
+
selectionType !== 'counter' && { size: _search.length + 2 })}
|
|
345
|
+
ref={searchRef}
|
|
346
|
+
/>
|
|
347
|
+
)}
|
|
348
|
+
</div>
|
|
341
349
|
<div className="form-multi-select-dropdown">
|
|
342
350
|
{multiple && selectAll && (
|
|
343
351
|
<CMultiSelectSelectAllButton onClick={() => handleSelectAll()}>
|
|
@@ -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 }
|
|
@@ -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 }
|