@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.
Files changed (163) hide show
  1. package/README.md +1 -1
  2. package/dist/components/accordion/index.d.ts +7 -0
  3. package/dist/components/alert/index.d.ts +4 -0
  4. package/dist/components/avatar/index.d.ts +2 -0
  5. package/dist/components/backdrop/index.d.ts +2 -0
  6. package/dist/components/badge/index.d.ts +2 -0
  7. package/dist/components/breadcrumb/index.d.ts +3 -0
  8. package/dist/components/button/index.d.ts +2 -0
  9. package/dist/components/button-group/index.d.ts +3 -0
  10. package/dist/components/calendar/CCalendar.d.ts +36 -12
  11. package/dist/components/callout/index.d.ts +2 -0
  12. package/dist/components/card/index.d.ts +12 -0
  13. package/dist/components/carousel/index.d.ts +4 -0
  14. package/dist/components/close-button/index.d.ts +2 -0
  15. package/dist/components/collapse/index.d.ts +2 -0
  16. package/dist/components/date-picker/CDatePicker.d.ts +13 -0
  17. package/dist/components/date-picker/index.d.ts +2 -0
  18. package/dist/components/date-range-picker/CDateRangePicker.d.ts +93 -0
  19. package/dist/components/date-range-picker/index.d.ts +2 -0
  20. package/dist/components/datepicker/index.d.ts +2 -0
  21. package/dist/components/daterangepicker/CDateRangePicker.d.ts +26 -11
  22. package/dist/components/daterangepicker/index.d.ts +2 -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 +6 -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 +52 -7
  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/time-picker/CTimePicker.d.ts +45 -0
  59. package/dist/components/time-picker/CTimePickerRollCol.d.ts +11 -0
  60. package/dist/components/time-picker/index.d.ts +2 -0
  61. package/dist/components/timepicker/CTimePicker.d.ts +9 -13
  62. package/dist/components/timepicker/index.d.ts +2 -0
  63. package/dist/components/toast/index.d.ts +6 -0
  64. package/dist/components/tooltip/CTooltip.d.ts +6 -2
  65. package/dist/components/tooltip/index.d.ts +2 -0
  66. package/dist/index.d.ts +0 -128
  67. package/dist/index.es.js +8368 -5764
  68. package/dist/index.es.js.map +1 -1
  69. package/dist/index.js +8367 -5764
  70. package/dist/index.js.map +1 -1
  71. package/dist/{components/calendar/CCalendar.utils.d.ts → utils/calendar.d.ts} +5 -2
  72. package/dist/utils/hooks/useStateWithCallback.d.ts +2 -1
  73. package/dist/utils/time.d.ts +21 -0
  74. package/package.json +14 -11
  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 +221 -131
  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 → date-picker}/CDatePicker.tsx +3 -2
  97. package/src/components/date-picker/__tests__/CDatePicker.spec.tsx +9 -0
  98. package/src/components/date-picker/__tests__/__snapshots__/CDatePicker.spec.tsx.snap +617 -0
  99. package/src/components/date-picker/index.ts +3 -0
  100. package/src/components/date-range-picker/CDateRangePicker.tsx +495 -0
  101. package/src/components/date-range-picker/__tests__/CDateRangePicker.spec.tsx +9 -0
  102. package/src/components/date-range-picker/__tests__/__snapshots__/CDateRangePicker.spec.tsx.snap +1201 -0
  103. package/src/components/date-range-picker/index.ts +3 -0
  104. package/src/components/dropdown/CDropdownItem.tsx +1 -1
  105. package/src/components/dropdown/CDropdownMenu.tsx +14 -14
  106. package/src/components/dropdown/index.ts +17 -0
  107. package/src/components/footer/index.ts +3 -0
  108. package/src/components/form/CForm.tsx +2 -2
  109. package/src/components/form/CFormCheck.tsx +32 -7
  110. package/src/components/form/CFormControlValidation.tsx +97 -0
  111. package/src/components/form/CFormControlWrapper.tsx +85 -0
  112. package/src/components/form/CFormInput.tsx +75 -19
  113. package/src/components/form/CFormRange.tsx +18 -4
  114. package/src/components/form/CFormSelect.tsx +60 -32
  115. package/src/components/form/CFormTextarea.tsx +45 -17
  116. package/src/components/form/index.ts +29 -0
  117. package/src/components/grid/index.ts +5 -0
  118. package/src/components/header/index.ts +8 -0
  119. package/src/components/image/index.ts +3 -0
  120. package/src/components/index.ts +41 -0
  121. package/src/components/link/index.ts +3 -0
  122. package/src/components/list-group/index.ts +4 -0
  123. package/src/components/loading-button/index.ts +3 -0
  124. package/src/components/modal/CModal.tsx +3 -2
  125. package/src/components/modal/index.ts +9 -0
  126. package/src/components/multi-select/CMultiSelect.tsx +46 -38
  127. package/src/components/multi-select/index.ts +3 -0
  128. package/src/components/nav/CNavGroup.tsx +1 -0
  129. package/src/components/nav/index.ts +8 -0
  130. package/src/components/navbar/index.ts +7 -0
  131. package/src/components/offcanvas/COffcanvas.tsx +1 -0
  132. package/src/components/offcanvas/index.ts +6 -0
  133. package/src/components/pagination/index.ts +5 -0
  134. package/src/components/picker/CPicker.tsx +104 -32
  135. package/src/components/picker/__tests__/CPicker.spec.tsx +9 -0
  136. package/src/components/picker/__tests__/__snapshots__/CPicker.spec.tsx.snap +23 -0
  137. package/src/components/placeholder/index.ts +3 -0
  138. package/src/components/popover/CPopover.tsx +59 -57
  139. package/src/components/popover/index.ts +3 -0
  140. package/src/components/progress/index.ts +4 -0
  141. package/src/components/sidebar/index.ts +8 -0
  142. package/src/components/smart-table/CSmartTable.tsx +2 -2
  143. package/src/components/smart-table/index.ts +3 -0
  144. package/src/components/spinner/index.ts +3 -0
  145. package/src/components/table/index.ts +19 -0
  146. package/src/components/tabs/CTabPane.tsx +7 -3
  147. package/src/components/tabs/index.ts +4 -0
  148. package/src/components/{timepicker → time-picker}/CTimePicker.tsx +71 -98
  149. package/src/components/{timepicker → time-picker}/CTimePickerRollCol.tsx +7 -1
  150. package/src/components/time-picker/__tests__/CTimePicker.spec.tsx +9 -0
  151. package/src/components/time-picker/index.ts +3 -0
  152. package/src/components/toast/CToast.tsx +6 -1
  153. package/src/components/toast/index.ts +7 -0
  154. package/src/components/tooltip/CTooltip.tsx +63 -45
  155. package/src/components/tooltip/index.ts +3 -0
  156. package/src/index.ts +0 -258
  157. package/src/{components/calendar/CCalendar.utils.ts → utils/calendar.ts} +97 -10
  158. package/src/utils/hooks/useStateWithCallback.ts +6 -3
  159. package/src/utils/time.ts +84 -0
  160. package/dist/components/dropdown/CDropdownToggleCustom.d.ts +0 -15
  161. package/dist/components/timepicker/CTimePicker.utils.d.ts +0 -4
  162. package/src/components/daterangepicker/CDateRangePicker.tsx +0 -366
  163. package/src/components/timepicker/CTimePicker.utils.ts +0 -27
@@ -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 './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'
@@ -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.
@@ -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
- 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}
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,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 }
@@ -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 }
@@ -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 }
@@ -0,0 +1,5 @@
1
+ import { CPagination } from './CPagination'
2
+ import { CPaginationItem } from './CPaginationItem'
3
+ import { CSmartPagination } from './CSmartPagination'
4
+
5
+ export { CPagination, CPaginationItem, CSmartPagination }