@coreui/react-pro 4.1.4 → 4.2.0-rc.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.
Files changed (162) hide show
  1. package/README.md +1 -1
  2. package/dist/components/Types.d.ts +1 -1
  3. package/dist/components/accordion/index.d.ts +7 -0
  4. package/dist/components/alert/index.d.ts +4 -0
  5. package/dist/components/avatar/index.d.ts +2 -0
  6. package/dist/components/backdrop/index.d.ts +2 -0
  7. package/dist/components/badge/index.d.ts +2 -0
  8. package/dist/components/breadcrumb/index.d.ts +3 -0
  9. package/dist/components/button/index.d.ts +2 -0
  10. package/dist/components/button-group/index.d.ts +3 -0
  11. package/dist/components/calendar/CCalendar.d.ts +113 -0
  12. package/dist/components/callout/index.d.ts +2 -0
  13. package/dist/components/card/index.d.ts +12 -0
  14. package/dist/components/carousel/index.d.ts +4 -0
  15. package/dist/components/close-button/index.d.ts +2 -0
  16. package/dist/components/collapse/index.d.ts +2 -0
  17. package/dist/components/datepicker/CDatePicker.d.ts +13 -0
  18. package/dist/components/datepicker/index.d.ts +2 -0
  19. package/dist/components/daterangepicker/CDateRangePicker.d.ts +65 -0
  20. package/dist/components/daterangepicker/index.d.ts +2 -0
  21. package/dist/components/dropdown/CDropdown.d.ts +10 -1
  22. package/dist/components/dropdown/CDropdownToggle.d.ts +4 -0
  23. package/dist/components/dropdown/index.d.ts +8 -0
  24. package/dist/components/footer/index.d.ts +2 -0
  25. package/dist/components/form/CForm.d.ts +2 -2
  26. package/dist/components/form/CFormCheck.d.ts +2 -1
  27. package/dist/components/form/CFormControlValidation.d.ts +46 -0
  28. package/dist/components/form/CFormControlWrapper.d.ts +31 -0
  29. package/dist/components/form/CFormInput.d.ts +2 -9
  30. package/dist/components/form/CFormRange.d.ts +7 -1
  31. package/dist/components/form/CFormSelect.d.ts +3 -10
  32. package/dist/components/form/CFormTextarea.d.ts +2 -9
  33. package/dist/components/form/index.d.ts +14 -0
  34. package/dist/components/grid/index.d.ts +4 -0
  35. package/dist/components/header/index.d.ts +7 -0
  36. package/dist/components/image/index.d.ts +2 -0
  37. package/dist/components/index.d.ts +41 -0
  38. package/dist/components/link/index.d.ts +2 -0
  39. package/dist/components/list-group/index.d.ts +3 -0
  40. package/dist/components/loading-button/index.d.ts +2 -0
  41. package/dist/components/modal/CModal.d.ts +3 -0
  42. package/dist/components/modal/index.d.ts +8 -0
  43. package/dist/components/multi-select/index.d.ts +2 -0
  44. package/dist/components/nav/index.d.ts +7 -0
  45. package/dist/components/navbar/index.d.ts +6 -0
  46. package/dist/components/offcanvas/index.d.ts +5 -0
  47. package/dist/components/pagination/index.d.ts +4 -0
  48. package/dist/components/picker/CPicker.d.ts +78 -0
  49. package/dist/components/placeholder/index.d.ts +2 -0
  50. package/dist/components/popover/CPopover.d.ts +2 -2
  51. package/dist/components/popover/index.d.ts +2 -0
  52. package/dist/components/progress/index.d.ts +3 -0
  53. package/dist/components/sidebar/index.d.ts +7 -0
  54. package/dist/components/smart-table/index.d.ts +2 -0
  55. package/dist/components/spinner/index.d.ts +2 -0
  56. package/dist/components/table/index.d.ts +9 -0
  57. package/dist/components/tabs/index.d.ts +3 -0
  58. package/dist/components/timepicker/CTimePicker.d.ts +45 -0
  59. package/dist/components/timepicker/CTimePickerRollCol.d.ts +11 -0
  60. package/dist/components/timepicker/index.d.ts +2 -0
  61. package/dist/components/toast/index.d.ts +6 -0
  62. package/dist/components/tooltip/CTooltip.d.ts +2 -2
  63. package/dist/components/tooltip/index.d.ts +2 -0
  64. package/dist/index.d.ts +0 -125
  65. package/dist/index.es.js +3268 -1339
  66. package/dist/index.es.js.map +1 -1
  67. package/dist/index.js +3513 -1582
  68. package/dist/index.js.map +1 -1
  69. package/dist/utils/calendar.d.ts +23 -0
  70. package/dist/utils/hooks/useStateWithCallback.d.ts +2 -1
  71. package/dist/utils/time.d.ts +21 -0
  72. package/package.json +12 -11
  73. package/src/components/Types.tsx +2 -2
  74. package/src/components/accordion/CAccordionButton.tsx +2 -1
  75. package/src/components/accordion/__tests__/__snapshots__/CAccordionButton.spec.tsx.snap +2 -0
  76. package/src/components/accordion/__tests__/__snapshots__/CAccordionHeader.spec.tsx.snap +2 -0
  77. package/src/components/accordion/index.ts +15 -0
  78. package/src/components/alert/CAlert.tsx +14 -3
  79. package/src/components/alert/index.ts +5 -0
  80. package/src/components/avatar/index.ts +3 -0
  81. package/src/components/backdrop/CBackdrop.tsx +10 -3
  82. package/src/components/backdrop/index.ts +3 -0
  83. package/src/components/badge/index.ts +3 -0
  84. package/src/components/breadcrumb/index.ts +4 -0
  85. package/src/components/button/index.ts +3 -0
  86. package/src/components/button-group/index.ts +4 -0
  87. package/src/components/calendar/CCalendar.tsx +559 -0
  88. package/src/components/calendar/__tests__/CCalendar.spec.tsx +9 -0
  89. package/src/components/calendar/__tests__/__snapshots__/CCalendar.spec.tsx.snap +573 -0
  90. package/src/components/callout/index.ts +3 -0
  91. package/src/components/card/index.ts +25 -0
  92. package/src/components/carousel/index.ts +5 -0
  93. package/src/components/close-button/index.ts +3 -0
  94. package/src/components/collapse/CCollapse.tsx +1 -0
  95. package/src/components/collapse/index.ts +3 -0
  96. package/src/components/datepicker/CDatePicker.tsx +50 -0
  97. package/src/components/datepicker/__tests__/CDatePicker.spec.tsx +9 -0
  98. package/src/components/datepicker/__tests__/__snapshots__/CDatePicker.spec.tsx.snap +617 -0
  99. package/src/components/datepicker/index.ts +3 -0
  100. package/src/components/daterangepicker/CDateRangePicker.tsx +432 -0
  101. package/src/components/daterangepicker/__tests__/CDateRangePicker.spec.tsx +9 -0
  102. package/src/components/daterangepicker/__tests__/__snapshots__/CDateRangePicker.spec.tsx.snap +1201 -0
  103. package/src/components/daterangepicker/index.ts +3 -0
  104. package/src/components/dropdown/CDropdown.tsx +19 -24
  105. package/src/components/dropdown/CDropdownItem.tsx +1 -1
  106. package/src/components/dropdown/CDropdownMenu.tsx +55 -3
  107. package/src/components/dropdown/CDropdownToggle.tsx +28 -5
  108. package/src/components/dropdown/index.ts +17 -0
  109. package/src/components/footer/index.ts +3 -0
  110. package/src/components/form/CForm.tsx +2 -2
  111. package/src/components/form/CFormCheck.tsx +32 -7
  112. package/src/components/form/CFormControlValidation.tsx +97 -0
  113. package/src/components/form/CFormControlWrapper.tsx +85 -0
  114. package/src/components/form/CFormInput.tsx +47 -18
  115. package/src/components/form/CFormRange.tsx +18 -4
  116. package/src/components/form/CFormSelect.tsx +60 -32
  117. package/src/components/form/CFormTextarea.tsx +45 -17
  118. package/src/components/form/index.ts +29 -0
  119. package/src/components/grid/index.ts +5 -0
  120. package/src/components/header/index.ts +8 -0
  121. package/src/components/image/index.ts +3 -0
  122. package/src/components/index.ts +41 -0
  123. package/src/components/link/index.ts +3 -0
  124. package/src/components/list-group/index.ts +4 -0
  125. package/src/components/loading-button/index.ts +3 -0
  126. package/src/components/modal/CModal.tsx +3 -2
  127. package/src/components/modal/index.ts +9 -0
  128. package/src/components/multi-select/CMultiSelect.tsx +45 -38
  129. package/src/components/multi-select/index.ts +3 -0
  130. package/src/components/nav/CNavGroup.tsx +1 -0
  131. package/src/components/nav/index.ts +8 -0
  132. package/src/components/navbar/index.ts +7 -0
  133. package/src/components/offcanvas/COffcanvas.tsx +1 -0
  134. package/src/components/offcanvas/index.ts +6 -0
  135. package/src/components/pagination/index.ts +5 -0
  136. package/src/components/picker/CPicker.tsx +207 -0
  137. package/src/components/picker/__tests__/CPicker.spec.tsx +9 -0
  138. package/src/components/picker/__tests__/__snapshots__/CPicker.spec.tsx.snap +23 -0
  139. package/src/components/placeholder/index.ts +3 -0
  140. package/src/components/popover/CPopover.tsx +78 -70
  141. package/src/components/popover/index.ts +3 -0
  142. package/src/components/progress/index.ts +4 -0
  143. package/src/components/sidebar/index.ts +8 -0
  144. package/src/components/smart-table/index.ts +3 -0
  145. package/src/components/spinner/index.ts +3 -0
  146. package/src/components/table/index.ts +19 -0
  147. package/src/components/tabs/CTabPane.tsx +7 -3
  148. package/src/components/tabs/index.ts +4 -0
  149. package/src/components/timepicker/CTimePicker.tsx +313 -0
  150. package/src/components/timepicker/CTimePickerRollCol.tsx +63 -0
  151. package/src/components/timepicker/__tests__/CTimePicker.spec.tsx +9 -0
  152. package/src/components/timepicker/index.ts +3 -0
  153. package/src/components/toast/CToast.tsx +6 -1
  154. package/src/components/toast/index.ts +7 -0
  155. package/src/components/tooltip/CTooltip.tsx +68 -60
  156. package/src/components/tooltip/index.ts +3 -0
  157. package/src/index.ts +0 -252
  158. package/src/utils/calendar.ts +270 -0
  159. package/src/utils/hooks/useStateWithCallback.ts +6 -3
  160. package/src/utils/time.ts +84 -0
  161. package/dist/components/dropdown/CDropdownToggleCustom.d.ts +0 -15
  162. package/src/components/dropdown/CDropdownToggleCustom.tsx +0 -81
@@ -1,9 +1,13 @@
1
1
  import React, { ChangeEventHandler, forwardRef, InputHTMLAttributes } from 'react'
2
- import PropTypes from 'prop-types'
2
+
3
3
  import classNames from 'classnames'
4
- // import { CFormLabel } from './CFormLabel'
4
+ import PropTypes from 'prop-types'
5
5
 
6
- export interface CFormInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
6
+ import { CFormControlWrapper, CFormControlWrapperProps } from './CFormControlWrapper'
7
+
8
+ export interface CFormInputProps
9
+ extends CFormControlWrapperProps,
10
+ Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
7
11
  /**
8
12
  * A string of all className you want applied to the component.
9
13
  */
@@ -12,10 +16,6 @@ export interface CFormInputProps extends Omit<InputHTMLAttributes<HTMLInputEleme
12
16
  * Toggle the disabled state for the component.
13
17
  */
14
18
  disabled?: boolean
15
- /**
16
- * Set component validation state to invalid.
17
- */
18
- invalid?: boolean
19
19
  /**
20
20
  * Method called immediately after the `value` prop changes.
21
21
  */
@@ -36,10 +36,6 @@ export interface CFormInputProps extends Omit<InputHTMLAttributes<HTMLInputEleme
36
36
  * Specifies the type of component.
37
37
  */
38
38
  type?: 'color' | 'file' | 'text' | string
39
- /**
40
- * Set component validation state to valid.
41
- */
42
- valid?: boolean
43
39
  /**
44
40
  * The `value` attribute of component.
45
41
  *
@@ -49,7 +45,27 @@ export interface CFormInputProps extends Omit<InputHTMLAttributes<HTMLInputEleme
49
45
  }
50
46
 
51
47
  export const CFormInput = forwardRef<HTMLInputElement, CFormInputProps>(
52
- ({ children, className, invalid, plainText, size, type = 'text', valid, ...rest }, ref) => {
48
+ (
49
+ {
50
+ children,
51
+ className,
52
+ feedback,
53
+ feedbackInvalid,
54
+ feedbackValid,
55
+ floatingLabel,
56
+ id,
57
+ invalid,
58
+ label,
59
+ plainText,
60
+ size,
61
+ text,
62
+ tooltipFeedback,
63
+ type = 'text',
64
+ valid,
65
+ ...rest
66
+ },
67
+ ref,
68
+ ) => {
53
69
  const _className = classNames(
54
70
  plainText ? 'form-control-plaintext' : 'form-control',
55
71
  {
@@ -61,21 +77,34 @@ export const CFormInput = forwardRef<HTMLInputElement, CFormInputProps>(
61
77
  className,
62
78
  )
63
79
  return (
64
- <input type={type} className={_className} {...rest} ref={ref}>
65
- {children}
66
- </input>
80
+ <CFormControlWrapper
81
+ describedby={rest['aria-describedby']}
82
+ feedback={feedback}
83
+ feedbackInvalid={feedbackInvalid}
84
+ feedbackValid={feedbackValid}
85
+ floatingLabel={floatingLabel}
86
+ id={id}
87
+ invalid={invalid}
88
+ label={label}
89
+ text={text}
90
+ tooltipFeedback={tooltipFeedback}
91
+ valid={valid}
92
+ >
93
+ <input className={_className} id={id} type={type} {...rest} ref={ref}>
94
+ {children}
95
+ </input>
96
+ </CFormControlWrapper>
67
97
  )
68
98
  },
69
99
  )
70
100
 
71
101
  CFormInput.propTypes = {
72
- children: PropTypes.node,
73
102
  className: PropTypes.string,
74
- invalid: PropTypes.bool,
103
+ id: PropTypes.string,
75
104
  plainText: PropTypes.bool,
76
105
  size: PropTypes.oneOf(['sm', 'lg']),
77
106
  type: PropTypes.oneOfType([PropTypes.oneOf(['color', 'file', 'text']), PropTypes.string]),
78
- valid: PropTypes.bool,
107
+ ...CFormControlWrapper.propTypes,
79
108
  }
80
109
 
81
110
  CFormInput.displayName = 'CFormInput'
@@ -1,7 +1,9 @@
1
- import React, { ChangeEventHandler, forwardRef, InputHTMLAttributes } from 'react'
2
- import PropTypes from 'prop-types'
1
+ import React, { ChangeEventHandler, forwardRef, InputHTMLAttributes, ReactNode } from 'react'
2
+
3
3
  import classNames from 'classnames'
4
+ import PropTypes from 'prop-types'
4
5
 
6
+ import { CFormLabel } from './CFormLabel'
5
7
  export interface CFormRangeProps extends InputHTMLAttributes<HTMLInputElement> {
6
8
  /**
7
9
  * A string of all className you want applied to the component.
@@ -11,6 +13,12 @@ export interface CFormRangeProps extends InputHTMLAttributes<HTMLInputElement> {
11
13
  * Toggle the disabled state for the component.
12
14
  */
13
15
  disabled?: boolean
16
+ /**
17
+ * Add a caption for a component.
18
+ *
19
+ * @since 4.2.0
20
+ */
21
+ label?: ReactNode | string
14
22
  /**
15
23
  * Specifies the maximum value for the component.
16
24
  */
@@ -40,14 +48,20 @@ export interface CFormRangeProps extends InputHTMLAttributes<HTMLInputElement> {
40
48
  }
41
49
 
42
50
  export const CFormRange = forwardRef<HTMLInputElement, CFormRangeProps>(
43
- ({ className, ...rest }, ref) => {
51
+ ({ className, label, ...rest }, ref) => {
44
52
  const _className = classNames('form-range', className)
45
- return <input type="range" className={_className} {...rest} ref={ref} />
53
+ return (
54
+ <>
55
+ {label && <CFormLabel htmlFor={rest.id}>{label}</CFormLabel>}
56
+ <input type="range" className={_className} {...rest} ref={ref} />
57
+ </>
58
+ )
46
59
  },
47
60
  )
48
61
 
49
62
  CFormRange.propTypes = {
50
63
  className: PropTypes.string,
64
+ label: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
51
65
  }
52
66
 
53
67
  CFormRange.displayName = 'CFormRange'
@@ -1,13 +1,18 @@
1
1
  import React, { ChangeEventHandler, forwardRef, InputHTMLAttributes } from 'react'
2
- import PropTypes from 'prop-types'
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 extends Omit<InputHTMLAttributes<HTMLSelectElement>, 'size'> {
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
- ({ children, className, htmlSize, invalid, options, size, valid, ...rest }, ref) => {
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
- <select className={_className} size={htmlSize} {...rest} ref={ref}>
63
- {options
64
- ? options.map((option, index) => {
65
- return (
66
- <option
67
- {...(typeof option === 'object' &&
68
- option.disabled && { disabled: option.disabled })}
69
- {...(typeof option === 'object' && option.value && { value: option.value })}
70
- key={index}
71
- >
72
- {typeof option === 'string' ? option : option.label}
73
- </option>
74
- )
75
- })
76
- : children}
77
- </select>
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
- size: PropTypes.oneOf(['sm', 'lg']),
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
- import PropTypes from 'prop-types'
2
+
3
3
  import classNames from 'classnames'
4
+ import PropTypes from 'prop-types'
4
5
 
5
- export interface CFormTextareaProps extends InputHTMLAttributes<HTMLTextAreaElement> {
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
- ({ children, className, invalid, plainText, valid, ...rest }, ref) => {
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
- <textarea className={_className} {...rest} ref={ref}>
54
- {children}
55
- </textarea>
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
- invalid: PropTypes.bool,
91
+ id: PropTypes.string,
64
92
  plainText: PropTypes.bool,
65
- valid: PropTypes.bool,
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,5 @@
1
+ import { CCol } from './CCol'
2
+ import { CContainer } from './CContainer'
3
+ import { CRow } from './CRow'
4
+
5
+ export { CCol, CContainer, CRow }
@@ -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 }
@@ -0,0 +1,3 @@
1
+ import { CImage } from './CImage'
2
+
3
+ export { CImage }
@@ -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 './datepicker'
15
+ export * from './daterangepicker'
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 './timepicker'
40
+ export * from './toast'
41
+ export * from './tooltip'
1
42
  export * from './widgets'
@@ -0,0 +1,3 @@
1
+ import { CLink } from './CLink'
2
+
3
+ export { CLink }
@@ -0,0 +1,4 @@
1
+ import { CListGroup } from './CListGroup'
2
+ import { CListGroupItem } from './CListGroupItem'
3
+
4
+ export { CListGroup, CListGroupItem }
@@ -0,0 +1,3 @@
1
+ import { CLoadingButton } from './CLoadingButton'
2
+
3
+ export { CLoadingButton }
@@ -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 { useForkedRef } from '../../utils/hooks'
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.
@@ -279,6 +279,13 @@ export const CMultiSelect = forwardRef<HTMLDivElement, CMultiSelectProps>(
279
279
 
280
280
  const handleOptionOnClick = (option: Option) => {
281
281
  setOptions(updateOptions(option.value))
282
+ if (!multiple) {
283
+ setVisible(false)
284
+ setSearch('')
285
+ if (searchRef.current) {
286
+ searchRef.current.value = ''
287
+ }
288
+ }
282
289
  }
283
290
 
284
291
  const handleSelectAll = () => {
@@ -302,42 +309,42 @@ export const CMultiSelect = forwardRef<HTMLDivElement, CMultiSelectProps>(
302
309
  onChange={() => onChange && onChange(selected)}
303
310
  ref={nativeSelectRef}
304
311
  />
305
- <div
306
- className={_className}
307
- ref={forkedRef}
308
- onClick={() => {
309
- setVisible(true)
310
- search && searchRef.current?.focus()
311
- }}
312
- >
313
- <CMultiSelectSelection
314
- multiple={multiple}
315
- onRemove={(option) => handleOptionOnClick(option)}
316
- search={search}
317
- selected={selected}
318
- selectionType={selectionType}
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}
312
+ <div className={_className} ref={forkedRef}>
313
+ <div
314
+ onClick={() => {
315
+ setVisible(true)
316
+ search && searchRef.current?.focus()
317
+ }}
318
+ >
319
+ <CMultiSelectSelection
320
+ multiple={multiple}
321
+ onRemove={(option) => handleOptionOnClick(option)}
322
+ search={search}
323
+ selected={selected}
324
+ selectionType={selectionType}
325
+ selectionTypeCounterText={selectionTypeCounterText}
339
326
  />
340
- )}
327
+ {multiple && cleaner && selected.length > 0 && (
328
+ <CMultiSelectCleaner onClick={() => handleDeselectAll()} />
329
+ )}
330
+ {search && (
331
+ <CMultiSelectSearchInput
332
+ {...(selected.length === 0 && { placeholder: placeholder })}
333
+ {...(selected.length &&
334
+ selectionType === 'counter' && {
335
+ placeholder: `${selected.length} ${selectionTypeCounterText}`,
336
+ })}
337
+ {...(selected.length &&
338
+ !multiple && { placeholder: selected.map((option) => option.text)[0] })}
339
+ onChange={(event) => handleSearchChange(event)}
340
+ onKeyDown={(event) => handleSearchKeyDown(event)}
341
+ {...(multiple &&
342
+ selected.length &&
343
+ selectionType !== 'counter' && { size: _search.length + 2 })}
344
+ ref={searchRef}
345
+ />
346
+ )}
347
+ </div>
341
348
  <div className="form-multi-select-dropdown">
342
349
  {multiple && selectAll && (
343
350
  <CMultiSelectSelectAllButton onClick={() => handleSelectAll()}>
@@ -0,0 +1,3 @@
1
+ import { CMultiSelect } from './CMultiSelect'
2
+
3
+ export { CMultiSelect }
@@ -106,6 +106,7 @@ export const CNavGroup = forwardRef<HTMLLIElement, CNavGroupProps>(
106
106
  )}
107
107
  <Transition
108
108
  in={_visible}
109
+ nodeRef={navItemsRef}
109
110
  onEntering={onEntering}
110
111
  onEntered={onEntered}
111
112
  onExit={onExit}
@@ -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 }