@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
package/src/index.ts
CHANGED
|
@@ -1,259 +1 @@
|
|
|
1
|
-
import { CAccordion } from './components/accordion/CAccordion'
|
|
2
|
-
import { CAccordionBody } from './components/accordion/CAccordionBody'
|
|
3
|
-
import { CAccordionButton } from './components/accordion/CAccordionButton'
|
|
4
|
-
import { CAccordionCollapse } from './components/accordion/CAccordionCollapse'
|
|
5
|
-
import { CAccordionHeader } from './components/accordion/CAccordionHeader'
|
|
6
|
-
import { CAccordionItem } from './components/accordion/CAccordionItem'
|
|
7
|
-
import { CAlert } from './components/alert/CAlert'
|
|
8
|
-
import { CAlertHeading } from './components/alert/CAlertHeading'
|
|
9
|
-
import { CAlertLink } from './components/alert/CAlertLink'
|
|
10
|
-
import { CAvatar } from './components/avatar/CAvatar'
|
|
11
|
-
import { CBadge } from './components/badge/CBadge'
|
|
12
|
-
import { CBackdrop } from './components/backdrop/CBackdrop'
|
|
13
|
-
import { CBreadcrumb } from './components/breadcrumb/CBreadcrumb'
|
|
14
|
-
import { CBreadcrumbItem } from './components/breadcrumb/CBreadcrumbItem'
|
|
15
|
-
import { CButton } from './components/button/CButton'
|
|
16
|
-
import { CButtonGroup } from './components/button-group/CButtonGroup'
|
|
17
|
-
import { CButtonToolbar } from './components/button-group/CButtonToolbar'
|
|
18
|
-
import { CCalendar } from './components/calendar/CCalendar'
|
|
19
|
-
import { CCallout } from './components/callout/CCallout'
|
|
20
|
-
import { CCard } from './components/card/CCard'
|
|
21
|
-
import { CCardBody } from './components/card/CCardBody'
|
|
22
|
-
import { CCardFooter } from './components/card/CCardFooter'
|
|
23
|
-
import { CCardGroup } from './components/card/CCardGroup'
|
|
24
|
-
import { CCardHeader } from './components/card/CCardHeader'
|
|
25
|
-
import { CCardImage } from './components/card/CCardImage'
|
|
26
|
-
import { CCardImageOverlay } from './components/card/CCardImageOverlay'
|
|
27
|
-
import { CCardLink } from './components/card/CCardLink'
|
|
28
|
-
import { CCardSubtitle } from './components/card/CCardSubtitle'
|
|
29
|
-
import { CCardText } from './components/card/CCardText'
|
|
30
|
-
import { CCardTitle } from './components/card/CCardTitle'
|
|
31
|
-
import { CCarousel } from './components/carousel/CCarousel'
|
|
32
|
-
import { CCarouselCaption } from './components/carousel/CCarouselCaption'
|
|
33
|
-
import { CCarouselItem } from './components/carousel/CCarouselItem'
|
|
34
|
-
import { CCollapse } from './components/collapse/CCollapse'
|
|
35
|
-
import { CCloseButton } from './components/close-button/CCloseButton'
|
|
36
|
-
import { CDatePicker } from './components/datepicker/CDatePicker'
|
|
37
|
-
import { CDateRangePicker } from './components/daterangepicker/CDateRangePicker'
|
|
38
|
-
import { CDropdown } from './components/dropdown/CDropdown'
|
|
39
|
-
import { CDropdownDivider } from './components/dropdown/CDropdownDivider'
|
|
40
|
-
import { CDropdownHeader } from './components/dropdown/CDropdownHeader'
|
|
41
|
-
import { CDropdownItem } from './components/dropdown/CDropdownItem'
|
|
42
|
-
import { CDropdownItemPlain } from './components/dropdown/CDropdownItemPlain'
|
|
43
|
-
import { CDropdownMenu } from './components/dropdown/CDropdownMenu'
|
|
44
|
-
import { CDropdownToggle } from './components/dropdown/CDropdownToggle'
|
|
45
|
-
import { CCol } from './components/grid/CCol'
|
|
46
|
-
import { CContainer } from './components/grid/CContainer'
|
|
47
|
-
import { CRow } from './components/grid/CRow'
|
|
48
|
-
import { CFooter } from './components/footer/CFooter'
|
|
49
|
-
import { CForm } from './components/form/CForm'
|
|
50
|
-
import { CFormCheck } from './components/form/CFormCheck'
|
|
51
|
-
import { CFormFeedback } from './components/form/CFormFeedback'
|
|
52
|
-
import { CFormFloating } from './components/form/CFormFloating'
|
|
53
|
-
import { CFormInput } from './components/form/CFormInput'
|
|
54
|
-
import { CFormLabel } from './components/form/CFormLabel'
|
|
55
|
-
import { CFormRange } from './components/form/CFormRange'
|
|
56
|
-
import { CFormSelect } from './components/form/CFormSelect'
|
|
57
|
-
import { CFormSwitch } from './components/form/CFormSwitch'
|
|
58
|
-
import { CFormText } from './components/form/CFormText'
|
|
59
|
-
import { CFormTextarea } from './components/form/CFormTextarea'
|
|
60
|
-
import { CInputGroup } from './components/form/CInputGroup'
|
|
61
|
-
import { CInputGroupText } from './components/form/CInputGroupText'
|
|
62
|
-
import { CHeader } from './components/header/CHeader'
|
|
63
|
-
import { CHeaderBrand } from './components/header/CHeaderBrand'
|
|
64
|
-
import { CHeaderDivider } from './components/header/CHeaderDivider'
|
|
65
|
-
import { CHeaderNav } from './components/header/CHeaderNav'
|
|
66
|
-
import { CHeaderText } from './components/header/CHeaderText'
|
|
67
|
-
import { CHeaderToggler } from './components/header/CHeaderToggler'
|
|
68
|
-
import { CImage } from './components/image/CImage'
|
|
69
|
-
import { CLink } from './components/link/CLink'
|
|
70
|
-
import { CListGroup } from './components/list-group/CListGroup'
|
|
71
|
-
import { CListGroupItem } from './components/list-group/CListGroupItem'
|
|
72
|
-
import { CLoadingButton } from './components/loading-button/CLoadingButton'
|
|
73
|
-
import { CModal } from './components/modal/CModal'
|
|
74
|
-
import { CModalBody } from './components/modal/CModalBody'
|
|
75
|
-
import { CModalContent } from './components/modal/CModalContent'
|
|
76
|
-
import { CModalDialog } from './components/modal/CModalDialog'
|
|
77
|
-
import { CModalFooter } from './components/modal/CModalFooter'
|
|
78
|
-
import { CModalHeader } from './components/modal/CModalHeader'
|
|
79
|
-
import { CModalTitle } from './components/modal/CModalTitle'
|
|
80
|
-
import { CMultiSelect } from './components/multi-select/CMultiSelect'
|
|
81
|
-
import { CNav } from './components/nav/CNav'
|
|
82
|
-
import { CNavGroupItems } from './components/nav/CNavGroupItems'
|
|
83
|
-
import { CNavGroup } from './components/nav/CNavGroup'
|
|
84
|
-
import { CNavItem } from './components/nav/CNavItem'
|
|
85
|
-
import { CNavLink } from './components/nav/CNavLink'
|
|
86
|
-
import { CNavTitle } from './components/nav/CNavTitle'
|
|
87
|
-
import { CNavbar } from './components/navbar/CNavbar'
|
|
88
|
-
import { CNavbarBrand } from './components/navbar/CNavbarBrand'
|
|
89
|
-
import { CNavbarNav } from './components/navbar/CNavbarNav'
|
|
90
|
-
import { CNavbarText } from './components/navbar/CNavbarText'
|
|
91
|
-
import { CNavbarToggler } from './components/navbar/CNavbarToggler'
|
|
92
|
-
import { CPagination } from './components/pagination/CPagination'
|
|
93
|
-
import { CPaginationItem } from './components/pagination/CPaginationItem'
|
|
94
|
-
import { CSmartPagination } from './components/pagination/CSmartPagination'
|
|
95
|
-
import { CPlaceholder } from './components/placeholder/CPlaceholder'
|
|
96
|
-
import { CPopover } from './components/popover/CPopover'
|
|
97
|
-
import { CProgress } from './components/progress/CProgress'
|
|
98
|
-
import { CProgressBar } from './components/progress/CProgressBar'
|
|
99
|
-
import { CSidebar } from './components/sidebar/CSidebar'
|
|
100
|
-
import { COffcanvas } from './components/offcanvas/COffcanvas'
|
|
101
|
-
import { COffcanvasBody } from './components/offcanvas/COffcanvasBody'
|
|
102
|
-
import { COffcanvasHeader } from './components/offcanvas/COffcanvasHeader'
|
|
103
|
-
import { COffcanvasTitle } from './components/offcanvas/COffcanvasTitle'
|
|
104
|
-
import { CSidebarBrand } from './components/sidebar/CSidebarBrand'
|
|
105
|
-
import { CSidebarFooter } from './components/sidebar/CSidebarFooter'
|
|
106
|
-
import { CSidebarToggler } from './components/sidebar/CSidebarToggler'
|
|
107
|
-
import { CSidebarHeader } from './components/sidebar/CSidebarHeader'
|
|
108
|
-
import { CSidebarNav } from './components/sidebar/CSidebarNav'
|
|
109
|
-
import { CSmartTable } from './components/smart-table/CSmartTable'
|
|
110
|
-
import { CSpinner } from './components/spinner/CSpinner'
|
|
111
|
-
import { CTable } from './components/table/CTable'
|
|
112
|
-
import { CTableBody } from './components/table/CTableBody'
|
|
113
|
-
import { CTableCaption } from './components/table/CTableCaption'
|
|
114
|
-
import { CTableDataCell } from './components/table/CTableDataCell'
|
|
115
|
-
import { CTableFoot } from './components/table/CTableFoot'
|
|
116
|
-
import { CTableHead } from './components/table/CTableHead'
|
|
117
|
-
import { CTableHeaderCell } from './components/table/CTableHeaderCell'
|
|
118
|
-
import { CTableRow } from './components/table/CTableRow'
|
|
119
|
-
import { CTabContent } from './components/tabs/CTabContent'
|
|
120
|
-
import { CTabPane } from './components/tabs/CTabPane'
|
|
121
|
-
import { CTimePicker } from './components/timepicker/CTimePicker'
|
|
122
|
-
import { CToast } from './components/toast/CToast'
|
|
123
|
-
import { CToastBody } from './components/toast/CToastBody'
|
|
124
|
-
import { CToastClose } from './components/toast/CToastClose'
|
|
125
|
-
import { CToastHeader } from './components/toast/CToastHeader'
|
|
126
|
-
import { CToaster } from './components/toast/CToaster'
|
|
127
|
-
import { CTooltip } from './components/tooltip/CTooltip'
|
|
128
|
-
|
|
129
|
-
export {
|
|
130
|
-
CAccordion,
|
|
131
|
-
CAccordionBody,
|
|
132
|
-
CAccordionButton,
|
|
133
|
-
CAccordionCollapse,
|
|
134
|
-
CAccordionHeader,
|
|
135
|
-
CAccordionItem,
|
|
136
|
-
CAlert,
|
|
137
|
-
CAlertHeading,
|
|
138
|
-
CAlertLink,
|
|
139
|
-
CAvatar,
|
|
140
|
-
CBadge,
|
|
141
|
-
CBackdrop,
|
|
142
|
-
CBreadcrumb,
|
|
143
|
-
CBreadcrumbItem,
|
|
144
|
-
CButton,
|
|
145
|
-
CButtonGroup,
|
|
146
|
-
CButtonToolbar,
|
|
147
|
-
CCalendar,
|
|
148
|
-
CCallout,
|
|
149
|
-
CCard,
|
|
150
|
-
CCardBody,
|
|
151
|
-
CCardFooter,
|
|
152
|
-
CCardHeader,
|
|
153
|
-
CCardImage,
|
|
154
|
-
CCardImageOverlay,
|
|
155
|
-
CCardLink,
|
|
156
|
-
CCardSubtitle,
|
|
157
|
-
CCardText,
|
|
158
|
-
CCardTitle,
|
|
159
|
-
CCarousel,
|
|
160
|
-
CCarouselCaption,
|
|
161
|
-
CCarouselItem,
|
|
162
|
-
CCloseButton,
|
|
163
|
-
CCollapse,
|
|
164
|
-
CDatePicker,
|
|
165
|
-
CDateRangePicker,
|
|
166
|
-
CDropdown,
|
|
167
|
-
CDropdownDivider,
|
|
168
|
-
CDropdownHeader,
|
|
169
|
-
CDropdownItem,
|
|
170
|
-
CDropdownItemPlain,
|
|
171
|
-
CDropdownMenu,
|
|
172
|
-
CDropdownToggle,
|
|
173
|
-
CCol,
|
|
174
|
-
CContainer,
|
|
175
|
-
CRow,
|
|
176
|
-
CFooter,
|
|
177
|
-
CCardGroup,
|
|
178
|
-
CForm,
|
|
179
|
-
CFormCheck,
|
|
180
|
-
CFormFeedback,
|
|
181
|
-
CFormFloating,
|
|
182
|
-
CFormInput,
|
|
183
|
-
CFormLabel,
|
|
184
|
-
CFormRange,
|
|
185
|
-
CFormSelect,
|
|
186
|
-
CFormSwitch,
|
|
187
|
-
CFormText,
|
|
188
|
-
CFormTextarea,
|
|
189
|
-
CImage,
|
|
190
|
-
CInputGroup,
|
|
191
|
-
CInputGroupText,
|
|
192
|
-
CHeader,
|
|
193
|
-
CHeaderBrand,
|
|
194
|
-
CHeaderDivider,
|
|
195
|
-
CHeaderNav,
|
|
196
|
-
CHeaderText,
|
|
197
|
-
CHeaderToggler,
|
|
198
|
-
CLink,
|
|
199
|
-
CListGroup,
|
|
200
|
-
CListGroupItem,
|
|
201
|
-
CLoadingButton,
|
|
202
|
-
CModal,
|
|
203
|
-
CModalBody,
|
|
204
|
-
CModalContent,
|
|
205
|
-
CModalDialog,
|
|
206
|
-
CModalFooter,
|
|
207
|
-
CModalHeader,
|
|
208
|
-
CModalTitle,
|
|
209
|
-
CMultiSelect,
|
|
210
|
-
CNav,
|
|
211
|
-
CNavGroup,
|
|
212
|
-
CNavGroupItems,
|
|
213
|
-
CNavItem,
|
|
214
|
-
CNavLink,
|
|
215
|
-
CNavTitle,
|
|
216
|
-
CNavbar,
|
|
217
|
-
CNavbarBrand,
|
|
218
|
-
CNavbarNav,
|
|
219
|
-
CNavbarText,
|
|
220
|
-
CNavbarToggler,
|
|
221
|
-
CPagination,
|
|
222
|
-
CPaginationItem,
|
|
223
|
-
CPlaceholder,
|
|
224
|
-
CPopover,
|
|
225
|
-
CProgress,
|
|
226
|
-
CProgressBar,
|
|
227
|
-
COffcanvas,
|
|
228
|
-
COffcanvasBody,
|
|
229
|
-
COffcanvasHeader,
|
|
230
|
-
COffcanvasTitle,
|
|
231
|
-
CSmartPagination,
|
|
232
|
-
CSidebar,
|
|
233
|
-
CSidebarBrand,
|
|
234
|
-
CSidebarFooter,
|
|
235
|
-
CSidebarToggler,
|
|
236
|
-
CSidebarHeader,
|
|
237
|
-
CSidebarNav,
|
|
238
|
-
CSmartTable,
|
|
239
|
-
CSpinner,
|
|
240
|
-
CTable,
|
|
241
|
-
CTableBody,
|
|
242
|
-
CTableCaption,
|
|
243
|
-
CTableDataCell,
|
|
244
|
-
CTableFoot,
|
|
245
|
-
CTableHead,
|
|
246
|
-
CTableHeaderCell,
|
|
247
|
-
CTableRow,
|
|
248
|
-
CTabContent,
|
|
249
|
-
CTabPane,
|
|
250
|
-
CTimePicker,
|
|
251
|
-
CToast,
|
|
252
|
-
CToastBody,
|
|
253
|
-
CToastClose,
|
|
254
|
-
CToastHeader,
|
|
255
|
-
CToaster,
|
|
256
|
-
CTooltip,
|
|
257
|
-
}
|
|
258
|
-
|
|
259
1
|
export * from './components/'
|
|
@@ -15,6 +15,52 @@ export const getCurrentYear = () => new Date().getFullYear()
|
|
|
15
15
|
|
|
16
16
|
export const getCurrentMonth = () => new Date().getMonth()
|
|
17
17
|
|
|
18
|
+
export const getLocalDateFromString = (string: string, locale: string, time?: boolean) => {
|
|
19
|
+
const date = new Date(2013, 11, 31, 17, 19, 22)
|
|
20
|
+
let regex = time ? date.toLocaleString(locale) : date.toLocaleDateString(locale)
|
|
21
|
+
regex = regex
|
|
22
|
+
.replace('2013', '(?<year>[0-9]{2,4})')
|
|
23
|
+
.replace('12', '(?<month>[0-9]{1,2})')
|
|
24
|
+
.replace('31', '(?<day>[0-9]{1,2})')
|
|
25
|
+
|
|
26
|
+
if (time) {
|
|
27
|
+
regex = regex
|
|
28
|
+
.replace('5', '(?<hour>[0-9]{1,2})')
|
|
29
|
+
.replace('17', '(?<hour>[0-9]{1,2})')
|
|
30
|
+
.replace('19', '(?<minute>[0-9]{1,2})')
|
|
31
|
+
.replace('22', '(?<second>[0-9]{1,2})')
|
|
32
|
+
.replace('PM', '(?<ampm>[A-Z]{2})')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const rgx = RegExp(`${regex}`)
|
|
36
|
+
const partials = string.match(rgx)
|
|
37
|
+
|
|
38
|
+
if (partials === null) return
|
|
39
|
+
|
|
40
|
+
const newDate =
|
|
41
|
+
partials.groups &&
|
|
42
|
+
(time
|
|
43
|
+
? new Date(
|
|
44
|
+
Number(partials.groups['year']),
|
|
45
|
+
Number(partials.groups['month']) - 1,
|
|
46
|
+
Number(partials.groups['day']),
|
|
47
|
+
partials.groups['ampm']
|
|
48
|
+
? partials.groups['ampm'] === 'PM'
|
|
49
|
+
? Number(partials.groups['hour']) + 12
|
|
50
|
+
: Number(partials.groups['hour'])
|
|
51
|
+
: Number(partials.groups['hour']),
|
|
52
|
+
Number(partials.groups['minute']),
|
|
53
|
+
Number(partials.groups['second']),
|
|
54
|
+
)
|
|
55
|
+
: new Date(
|
|
56
|
+
Number(partials.groups['year']),
|
|
57
|
+
Number(partials.groups['month']) - 1,
|
|
58
|
+
Number(partials.groups['day']),
|
|
59
|
+
))
|
|
60
|
+
|
|
61
|
+
return newDate
|
|
62
|
+
}
|
|
63
|
+
|
|
18
64
|
export const getMonthName = (month: number, locale: string) => {
|
|
19
65
|
const d = new Date()
|
|
20
66
|
d.setDate(1)
|
|
@@ -115,7 +161,35 @@ export const getMonthDetails = (year: number, month: number, firstDayOfWeek: num
|
|
|
115
161
|
return weeks
|
|
116
162
|
}
|
|
117
163
|
|
|
118
|
-
export const
|
|
164
|
+
export const isDisableDateInRange = (
|
|
165
|
+
startDate?: Date | null,
|
|
166
|
+
endDate?: Date | null,
|
|
167
|
+
dates?: Date[] | Date[][],
|
|
168
|
+
) => {
|
|
169
|
+
if (startDate && endDate) {
|
|
170
|
+
const date = new Date(startDate)
|
|
171
|
+
let disabled = false
|
|
172
|
+
|
|
173
|
+
while (date < endDate) {
|
|
174
|
+
date.setDate(date.getDate() + 1)
|
|
175
|
+
if (isDateDisabled(date, null, null, dates)) {
|
|
176
|
+
disabled = true
|
|
177
|
+
break
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return disabled
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return false
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export const isDateDisabled = (
|
|
188
|
+
date: Date,
|
|
189
|
+
min?: Date | null,
|
|
190
|
+
max?: Date | null,
|
|
191
|
+
dates?: Date[] | Date[][],
|
|
192
|
+
) => {
|
|
119
193
|
let disabled
|
|
120
194
|
if (dates) {
|
|
121
195
|
dates.forEach((_date: Date | Date[]) => {
|
|
@@ -161,12 +235,20 @@ export const isLastDayOfMonth = (date: Date) => {
|
|
|
161
235
|
return test.getMonth() !== month
|
|
162
236
|
}
|
|
163
237
|
|
|
164
|
-
export const isSameDateAs = (date: Date, date2: Date) => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
238
|
+
export const isSameDateAs = (date: Date | null, date2: Date | null) => {
|
|
239
|
+
if (date instanceof Date && date2 instanceof Date) {
|
|
240
|
+
return (
|
|
241
|
+
date.getDate() === date2.getDate() &&
|
|
242
|
+
date.getMonth() === date2.getMonth() &&
|
|
243
|
+
date.getFullYear() === date2.getFullYear()
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (date === null && date2 === null) {
|
|
248
|
+
return true
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return false
|
|
170
252
|
}
|
|
171
253
|
|
|
172
254
|
export const isStartDate = (date: Date, start: Date | null, end: Date | null) => {
|
|
@@ -176,8 +258,13 @@ export const isStartDate = (date: Date, start: Date | null, end: Date | null) =>
|
|
|
176
258
|
export const isToday = (date: Date) => {
|
|
177
259
|
const today = new Date()
|
|
178
260
|
return (
|
|
179
|
-
date.getDate()
|
|
180
|
-
date.getMonth()
|
|
181
|
-
date.getFullYear()
|
|
261
|
+
date.getDate() === today.getDate() &&
|
|
262
|
+
date.getMonth() === today.getMonth() &&
|
|
263
|
+
date.getFullYear() === today.getFullYear()
|
|
182
264
|
)
|
|
183
265
|
}
|
|
266
|
+
|
|
267
|
+
export const isValidDate = (date: string) => {
|
|
268
|
+
const d = new Date(date)
|
|
269
|
+
return d instanceof Date && d.getTime()
|
|
270
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react'
|
|
1
|
+
import { Dispatch, SetStateAction, useEffect, useState } from 'react'
|
|
2
2
|
|
|
3
|
-
export const useStateWithCallback = (
|
|
3
|
+
export const useStateWithCallback = <S>(
|
|
4
|
+
initialState: S,
|
|
5
|
+
handler?: (prevState: S) => void,
|
|
6
|
+
): [S, Dispatch<SetStateAction<S>>] => {
|
|
4
7
|
const [state, setState] = useState(initialState)
|
|
5
|
-
useEffect(() =>
|
|
8
|
+
handler && useEffect(() => handler(state), [state])
|
|
6
9
|
return [state, setState]
|
|
7
10
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export const convert12hTo24h = (abbr: 'am' | 'pm', hour: number) => {
|
|
2
|
+
if (abbr === 'am' && hour === 12) {
|
|
3
|
+
return 0
|
|
4
|
+
}
|
|
5
|
+
if (abbr === 'am') {
|
|
6
|
+
return hour
|
|
7
|
+
}
|
|
8
|
+
if (abbr === 'pm' && hour === 12) {
|
|
9
|
+
return 12
|
|
10
|
+
}
|
|
11
|
+
return hour + 12
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const convert24hTo12h = (hour: number) => hour % 12 || 12
|
|
15
|
+
|
|
16
|
+
export const convertTimeToDate = (time: Date | string | null | undefined) =>
|
|
17
|
+
time ? (time instanceof Date ? new Date(time) : new Date(`1970-01-01 ${time}`)) : null
|
|
18
|
+
|
|
19
|
+
export const getAmPm = (date: Date, locale: string) => {
|
|
20
|
+
if (date.toLocaleTimeString(locale).includes('AM')) {
|
|
21
|
+
return 'am'
|
|
22
|
+
}
|
|
23
|
+
if (date.toLocaleTimeString(locale).includes('PM')) {
|
|
24
|
+
return 'pm'
|
|
25
|
+
}
|
|
26
|
+
return date.getHours() >= 12 ? 'pm' : 'am'
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const getListOfHours = (locale: string) =>
|
|
30
|
+
Array.from({ length: isAmPm(locale) ? 12 : 24 }, (_, i) => {
|
|
31
|
+
return {
|
|
32
|
+
value: isAmPm(locale) ? i + 1 : i,
|
|
33
|
+
label: (isAmPm(locale) ? i + 1 : i).toLocaleString(locale),
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
export const getListOfMinutes = (locale: string, valueAsString = false) =>
|
|
38
|
+
Array.from({ length: 60 }, (_, i) => {
|
|
39
|
+
const d = new Date()
|
|
40
|
+
d.setMinutes(i)
|
|
41
|
+
return {
|
|
42
|
+
value: valueAsString ? i.toString() : i,
|
|
43
|
+
label: d
|
|
44
|
+
.toLocaleTimeString(locale, {
|
|
45
|
+
hour: '2-digit',
|
|
46
|
+
hour12: false,
|
|
47
|
+
minute: '2-digit',
|
|
48
|
+
second: '2-digit',
|
|
49
|
+
})
|
|
50
|
+
.split(':')[1],
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
export const getListOfSeconds = (locale: string, valueAsString = false) =>
|
|
55
|
+
Array.from({ length: 60 }, (_, i) => {
|
|
56
|
+
const d = new Date()
|
|
57
|
+
d.setSeconds(i)
|
|
58
|
+
return {
|
|
59
|
+
value: valueAsString ? i.toString() : i,
|
|
60
|
+
label: d
|
|
61
|
+
.toLocaleTimeString(locale, {
|
|
62
|
+
hour: '2-digit',
|
|
63
|
+
hour12: false,
|
|
64
|
+
minute: '2-digit',
|
|
65
|
+
second: '2-digit',
|
|
66
|
+
})
|
|
67
|
+
.split(':')[2],
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
export const getSelectedHour = (date: Date | null, locale: string) =>
|
|
72
|
+
date ? (isAmPm(locale) ? convert24hTo12h(date.getHours()) : date.getHours()) : ''
|
|
73
|
+
|
|
74
|
+
export const getSelectedMinutes = (date: Date | null) => (date ? date.getMinutes() : '')
|
|
75
|
+
|
|
76
|
+
export const getSelectedSeconds = (date: Date | null) => (date ? date.getSeconds() : '')
|
|
77
|
+
|
|
78
|
+
export const isAmPm = (locale: string) =>
|
|
79
|
+
['am', 'AM', 'pm', 'PM'].some((el) => new Date().toLocaleString(locale).includes(el))
|
|
80
|
+
|
|
81
|
+
export const isValidTime = (time: string) => {
|
|
82
|
+
const d = new Date(`1970-01-01 ${time}`)
|
|
83
|
+
return d instanceof Date && d.getTime()
|
|
84
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FC, HTMLAttributes } from 'react';
|
|
2
|
-
import { Triggers } from '../Types';
|
|
3
|
-
export interface CDropdownToggleCustomProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/**
|
|
5
|
-
* Toggle the disabled state for the component.
|
|
6
|
-
*/
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Sets which event handlers you’d like provided to your toggle prop. You can specify one trigger or an array of them.
|
|
10
|
-
*
|
|
11
|
-
* @type 'hover' | 'focus' | 'click'
|
|
12
|
-
*/
|
|
13
|
-
trigger?: Triggers | Triggers[];
|
|
14
|
-
}
|
|
15
|
-
export declare const CDropdownToggleCustom: FC<CDropdownToggleCustomProps>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const convert12hTo24h: (abbr: 'am' | 'pm', hour: number) => number;
|
|
2
|
-
export declare const convert24hTo12h: (hour: number) => number;
|
|
3
|
-
export declare const getAmPm: (date: Date, locale: string) => "am" | "pm";
|
|
4
|
-
export declare const isAmPm: (locale: string) => boolean;
|