@coreui/react-pro 4.13.1 → 5.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/components/calendar/CCalendar.d.ts +25 -7
- package/dist/components/calendar/utils.d.ts +12 -3
- package/dist/components/close-button/CCloseButton.d.ts +6 -0
- package/dist/components/date-range-picker/CDateRangePicker copy.d.ts +114 -0
- package/dist/components/multi-select/types.d.ts +2 -2
- package/dist/components/multi-select/utils.d.ts +2 -2
- package/dist/components/multi-select-new/CMultiSelect.d.ts +133 -0
- package/dist/components/multi-select-new/CMultiSelectNativeSelect.d.ts +7 -0
- package/dist/components/multi-select-new/CMultiSelectNew.d.ts +121 -0
- package/dist/components/multi-select-new/CMultiSelectOptions.d.ts +16 -0
- package/dist/components/multi-select-new/CMultiSelectSelection.d.ts +11 -0
- package/dist/components/multi-select-new/index.d.ts +2 -0
- package/dist/components/multi-select-new/types.d.ts +15 -0
- package/dist/components/multi-select-new/utils.d.ts +11 -0
- package/dist/components/nav/CNav.d.ts +1 -1
- package/dist/components/navbar/CNavbar.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvas.d.ts +4 -0
- package/dist/components/picker/CPicker copy.d.ts +82 -0
- package/dist/components/picker copy/CPicker.d.ts +82 -0
- package/dist/components/smart-table/CSmartTableBody.d.ts +2 -1
- package/dist/components/smart-table/CSmartTableCleaner.d.ts +7 -0
- package/dist/components/smart-table/CSmartTableInterface.d.ts +1 -3
- package/dist/components/smart-table/types.d.ts +2 -2
- package/dist/components/smart-table/utils.d.ts +3 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/index.es.js +523 -265
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +523 -264
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/components/calendar/CCalendar.tsx +396 -193
- package/src/components/calendar/utils.ts +91 -4
- package/src/components/carousel/CCarousel.tsx +9 -5
- package/src/components/close-button/CCloseButton.tsx +9 -1
- package/src/components/date-range-picker/CDateRangePicker.tsx +65 -81
- package/src/components/dropdown/CDropdownMenu.tsx +1 -1
- package/src/components/multi-select/CMultiSelect.tsx +18 -10
- package/src/components/multi-select/CMultiSelectNativeSelect.tsx +1 -1
- package/src/components/multi-select/CMultiSelectOptions.tsx +1 -1
- package/src/components/multi-select/CMultiSelectSelection.tsx +4 -6
- package/src/components/multi-select/types.ts +2 -2
- package/src/components/multi-select/utils.ts +5 -5
- package/src/components/nav/CNav.tsx +2 -2
- package/src/components/navbar/CNavbar.tsx +2 -2
- package/src/components/offcanvas/COffcanvas.tsx +7 -0
- package/src/components/picker/CPicker.tsx +2 -11
- package/src/components/smart-table/CSmartTable.tsx +2 -1
- package/src/components/smart-table/CSmartTableBody.tsx +11 -5
- package/src/components/smart-table/CSmartTableInterface.tsx +1 -3
- package/src/components/smart-table/types.ts +2 -2
- package/src/components/smart-table/utils.ts +40 -5
- package/src/components/time-picker/CTimePicker.tsx +20 -37
- package/src/components/time-picker/utils.ts +5 -1
- package/src/hooks/index.ts +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Option, OptionsGroup, SelectedOption } from './types'
|
|
2
2
|
|
|
3
|
-
export const createOption = (
|
|
4
|
-
const value =
|
|
3
|
+
export const createOption = (label: string, options: (Option | OptionsGroup)[]) => {
|
|
4
|
+
const value = label.toLowerCase().replace(/\s/g, '-')
|
|
5
5
|
let uniqueValue = value
|
|
6
6
|
let i = 1
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ export const createOption = (text: string, options: (Option | OptionsGroup)[]) =
|
|
|
13
13
|
return [
|
|
14
14
|
{
|
|
15
15
|
value: uniqueValue,
|
|
16
|
-
|
|
16
|
+
label,
|
|
17
17
|
custom: true,
|
|
18
18
|
},
|
|
19
19
|
]
|
|
@@ -28,10 +28,10 @@ export const filterOptionsList = (search: string, _options: (Option | OptionsGro
|
|
|
28
28
|
option.options &&
|
|
29
29
|
option.options.filter(
|
|
30
30
|
(option: Option) =>
|
|
31
|
-
option.
|
|
31
|
+
option.lable && option.label.toLowerCase().includes(search.toLowerCase()),
|
|
32
32
|
)
|
|
33
33
|
if (
|
|
34
|
-
(option.
|
|
34
|
+
(option.lable && option.label.toLowerCase().includes(search.toLowerCase())) ||
|
|
35
35
|
(options && options.length > 0)
|
|
36
36
|
) {
|
|
37
37
|
optionsList.push(Object.assign({}, option, options && options.length > 0 && { options }))
|
|
@@ -19,7 +19,7 @@ export interface CNavProps
|
|
|
19
19
|
/**
|
|
20
20
|
* Set the nav variant to tabs or pills.
|
|
21
21
|
*/
|
|
22
|
-
variant?: '
|
|
22
|
+
variant?: 'pills' | 'tabs' | 'underline'
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export const CNav = forwardRef<HTMLDivElement | HTMLUListElement | HTMLOListElement, CNavProps>(
|
|
@@ -49,7 +49,7 @@ CNav.propTypes = {
|
|
|
49
49
|
className: PropTypes.string,
|
|
50
50
|
component: PropTypes.elementType,
|
|
51
51
|
layout: PropTypes.oneOf(['fill', 'justified']),
|
|
52
|
-
variant: PropTypes.oneOf(['
|
|
52
|
+
variant: PropTypes.oneOf(['pills', 'tabs', 'underline']),
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
CNav.displayName = 'CNav'
|
|
@@ -17,7 +17,7 @@ export interface CNavbarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
17
17
|
*/
|
|
18
18
|
color?: Colors
|
|
19
19
|
/**
|
|
20
|
-
* Sets if the color of text should be colored for a light or dark
|
|
20
|
+
* Sets if the color of text should be colored for a light or dark background.
|
|
21
21
|
*/
|
|
22
22
|
colorScheme?: 'dark' | 'light'
|
|
23
23
|
/**
|
|
@@ -59,12 +59,12 @@ export const CNavbar = forwardRef<HTMLDivElement, CNavbarProps>(
|
|
|
59
59
|
'navbar',
|
|
60
60
|
{
|
|
61
61
|
[`bg-${color}`]: color,
|
|
62
|
-
[`navbar-${colorScheme}`]: colorScheme,
|
|
63
62
|
[typeof expand === 'boolean' ? 'navbar-expand' : `navbar-expand-${expand}`]: expand,
|
|
64
63
|
},
|
|
65
64
|
placement,
|
|
66
65
|
className,
|
|
67
66
|
)}
|
|
67
|
+
{...(colorScheme && { 'data-coreui-theme': colorScheme })}
|
|
68
68
|
{...rest}
|
|
69
69
|
ref={ref}
|
|
70
70
|
>
|
|
@@ -17,6 +17,10 @@ export interface COffcanvasProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
17
17
|
* A string of all className you want applied to the base component.
|
|
18
18
|
*/
|
|
19
19
|
className?: string
|
|
20
|
+
/**
|
|
21
|
+
* Sets a darker color scheme.
|
|
22
|
+
*/
|
|
23
|
+
dark?: boolean
|
|
20
24
|
/**
|
|
21
25
|
* Closes the offcanvas when escape key is pressed.
|
|
22
26
|
*/
|
|
@@ -59,6 +63,7 @@ export const COffcanvas = forwardRef<HTMLDivElement, COffcanvasProps>(
|
|
|
59
63
|
children,
|
|
60
64
|
backdrop = true,
|
|
61
65
|
className,
|
|
66
|
+
dark,
|
|
62
67
|
keyboard = true,
|
|
63
68
|
onHide,
|
|
64
69
|
onShow,
|
|
@@ -135,6 +140,7 @@ export const COffcanvas = forwardRef<HTMLDivElement, COffcanvasProps>(
|
|
|
135
140
|
role="dialog"
|
|
136
141
|
tabIndex={-1}
|
|
137
142
|
onKeyDown={handleKeyDown}
|
|
143
|
+
{...(dark && { 'data-coreui-theme': 'dark' })}
|
|
138
144
|
{...rest}
|
|
139
145
|
ref={forkedRef}
|
|
140
146
|
>
|
|
@@ -161,6 +167,7 @@ COffcanvas.propTypes = {
|
|
|
161
167
|
backdrop: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf<'static'>(['static'])]),
|
|
162
168
|
children: PropTypes.node,
|
|
163
169
|
className: PropTypes.string,
|
|
170
|
+
dark: PropTypes.bool,
|
|
164
171
|
keyboard: PropTypes.bool,
|
|
165
172
|
onHide: PropTypes.func,
|
|
166
173
|
onShow: PropTypes.func,
|
|
@@ -141,7 +141,7 @@ export const CPicker = forwardRef<HTMLDivElement | HTMLLIElement, CPickerProps>(
|
|
|
141
141
|
default: {
|
|
142
142
|
return (
|
|
143
143
|
<div
|
|
144
|
-
className={classNames(
|
|
144
|
+
className={classNames(className, {
|
|
145
145
|
show: _visible,
|
|
146
146
|
})}
|
|
147
147
|
onClick={() => !disabled && setVisible(true)}
|
|
@@ -152,16 +152,7 @@ export const CPicker = forwardRef<HTMLDivElement | HTMLLIElement, CPickerProps>(
|
|
|
152
152
|
React.cloneElement(toggler as React.ReactElement<any>, {
|
|
153
153
|
ref: togglerRef,
|
|
154
154
|
})}
|
|
155
|
-
<div
|
|
156
|
-
className={classNames(
|
|
157
|
-
'dropdown-menu',
|
|
158
|
-
{
|
|
159
|
-
show: _visible,
|
|
160
|
-
},
|
|
161
|
-
dropdownClassNames,
|
|
162
|
-
)}
|
|
163
|
-
ref={dropdownRef}
|
|
164
|
-
>
|
|
155
|
+
<div className={dropdownClassNames} ref={dropdownRef}>
|
|
165
156
|
{children}
|
|
166
157
|
{footer && footerContent}
|
|
167
158
|
</div>
|
|
@@ -409,6 +409,8 @@ export const CSmartTable = forwardRef<HTMLDivElement, CSmartTableProps>(
|
|
|
409
409
|
)}
|
|
410
410
|
<CSmartTableBody
|
|
411
411
|
clickableRows={clickableRows}
|
|
412
|
+
columnNames={columnNames}
|
|
413
|
+
columns={columns ?? columnNames}
|
|
412
414
|
currentItems={currentItems}
|
|
413
415
|
firstItemOnActivePageIndex={firstItemOnActivePageIndex}
|
|
414
416
|
noItemsLabel={noItemsLabel}
|
|
@@ -416,7 +418,6 @@ export const CSmartTable = forwardRef<HTMLDivElement, CSmartTableProps>(
|
|
|
416
418
|
clickableRows && onRowClick && onRowClick(item, index, columnName, event)
|
|
417
419
|
}
|
|
418
420
|
onRowChecked={(item, value) => handleRowChecked(item, value)}
|
|
419
|
-
columnNames={columnNames}
|
|
420
421
|
scopedColumns={scopedColumns}
|
|
421
422
|
selectable={selectable}
|
|
422
423
|
selected={_selected}
|
|
@@ -7,12 +7,13 @@ import { CTableDataCell, CTableRow } from '../table'
|
|
|
7
7
|
|
|
8
8
|
import { isObjectInArray } from '../../utils'
|
|
9
9
|
|
|
10
|
-
import type { Item, ScopedColumns } from './types'
|
|
11
|
-
import { getClickedColumnName, getTableDataCellProps } from './utils'
|
|
10
|
+
import type { Column, Item, ScopedColumns } from './types'
|
|
11
|
+
import { getClickedColumnName, getColumnName, getTableDataCellProps, getTableDataCellStyles } from './utils'
|
|
12
12
|
|
|
13
13
|
export interface CSmartTableBodyProps extends CTableBodyProps {
|
|
14
14
|
clickableRows?: boolean
|
|
15
15
|
columnNames: string[]
|
|
16
|
+
columns: (Column | string)[]
|
|
16
17
|
currentItems: Item[]
|
|
17
18
|
firstItemOnActivePageIndex: number
|
|
18
19
|
noItemsLabel?: string | ReactNode
|
|
@@ -28,6 +29,7 @@ export const CSmartTableBody = forwardRef<HTMLTableSectionElement, CSmartTableBo
|
|
|
28
29
|
{
|
|
29
30
|
clickableRows,
|
|
30
31
|
columnNames,
|
|
32
|
+
columns,
|
|
31
33
|
currentItems,
|
|
32
34
|
firstItemOnActivePageIndex,
|
|
33
35
|
noItemsLabel,
|
|
@@ -40,7 +42,7 @@ export const CSmartTableBody = forwardRef<HTMLTableSectionElement, CSmartTableBo
|
|
|
40
42
|
},
|
|
41
43
|
ref,
|
|
42
44
|
) => {
|
|
43
|
-
const colspan: number = selectable ?
|
|
45
|
+
const colspan: number = selectable ? columns.length + 1 : columns.length
|
|
44
46
|
|
|
45
47
|
return (
|
|
46
48
|
<CTableBody
|
|
@@ -84,7 +86,8 @@ export const CSmartTableBody = forwardRef<HTMLTableSectionElement, CSmartTableBo
|
|
|
84
86
|
/>
|
|
85
87
|
</CTableDataCell>
|
|
86
88
|
)}
|
|
87
|
-
{
|
|
89
|
+
{columns.map((column, index) => {
|
|
90
|
+
const colName = getColumnName(column)
|
|
88
91
|
return (
|
|
89
92
|
(scopedColumns &&
|
|
90
93
|
scopedColumns[colName] &&
|
|
@@ -95,7 +98,10 @@ export const CSmartTableBody = forwardRef<HTMLTableSectionElement, CSmartTableBo
|
|
|
95
98
|
},
|
|
96
99
|
)) ||
|
|
97
100
|
(item[colName] !== undefined && (
|
|
98
|
-
<CTableDataCell
|
|
101
|
+
<CTableDataCell
|
|
102
|
+
{...getTableDataCellProps(column, item, colName)}
|
|
103
|
+
style={getTableDataCellStyles(column, item, colName)}
|
|
104
|
+
key={index}>
|
|
99
105
|
{item[colName]}
|
|
100
106
|
</CTableDataCell>
|
|
101
107
|
))
|
|
@@ -115,9 +115,7 @@ export interface CSmartTableProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
115
115
|
itemsPerPageOptions?: number[]
|
|
116
116
|
/**
|
|
117
117
|
* Adds select element over table, which is used for control items per page in pagination. If you want to customize this element, pass object with optional values:
|
|
118
|
-
* -
|
|
119
|
-
* - values (Array) - custom array of pagination values
|
|
120
|
-
* - external (Boolean) - disables automatic 'itemsPerPage' change (use to change pages externaly by 'pagination-change' event).
|
|
118
|
+
* - external (Boolean) - disables automatic 'itemsPerPage' change.
|
|
121
119
|
*/
|
|
122
120
|
itemsPerPageSelect?: boolean | ItemsPerPageSelect
|
|
123
121
|
/**
|
|
@@ -13,6 +13,8 @@ export type Column = {
|
|
|
13
13
|
sorter?: boolean
|
|
14
14
|
_style?: any
|
|
15
15
|
_props?: CTableHeaderCellProps
|
|
16
|
+
_colStyle?: any
|
|
17
|
+
_colProps?: CTableDataCellProps
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
export type ColumnFilter = {
|
|
@@ -49,8 +51,6 @@ export type Item = {
|
|
|
49
51
|
|
|
50
52
|
export type ItemsPerPageSelect = {
|
|
51
53
|
external?: boolean
|
|
52
|
-
label?: string
|
|
53
|
-
values?: Array<number>
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export type Pagination = {
|
|
@@ -65,7 +65,7 @@ export const getClickedColumnName = (
|
|
|
65
65
|
const closest = target.closest('tr')
|
|
66
66
|
const children = closest ? Array.from(closest.children) : []
|
|
67
67
|
const clickedCell = children.filter((child) => child.contains(target))[0]
|
|
68
|
-
return columnNames[children.indexOf(clickedCell)]
|
|
68
|
+
return columnNames[children.indexOf(clickedCell) - 1]
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export const getColumnKey = (column: Column | string) =>
|
|
@@ -78,6 +78,14 @@ export const getColumnLabel = (column: Column | string) =>
|
|
|
78
78
|
: pretifyName(column.key)
|
|
79
79
|
: pretifyName(column)
|
|
80
80
|
|
|
81
|
+
export const getColumnName = (column: string | Column) => {
|
|
82
|
+
if (typeof column === 'object') {
|
|
83
|
+
return column.key
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return column
|
|
87
|
+
}
|
|
88
|
+
|
|
81
89
|
export const getColumnNames = (
|
|
82
90
|
columns: (string | Column)[] | undefined,
|
|
83
91
|
items: Item[],
|
|
@@ -217,15 +225,42 @@ export const getColumnValues = (items: Item[], key: string) => {
|
|
|
217
225
|
return items.map((item) => item[key])
|
|
218
226
|
}
|
|
219
227
|
|
|
220
|
-
export const getTableDataCellProps = (item: Item, colName: string) => {
|
|
221
|
-
const props =
|
|
222
|
-
|
|
223
|
-
|
|
228
|
+
export const getTableDataCellProps = (column: Column | string, item: Item, colName: string) => {
|
|
229
|
+
const props = {}
|
|
230
|
+
|
|
231
|
+
if (typeof column === 'object' && column._colProps) {
|
|
232
|
+
Object.assign(props, column._colProps)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (item._cellProps && item._cellProps['all']) {
|
|
236
|
+
Object.assign(props, item._cellProps['all'])
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (item._cellProps && item._cellProps[colName]) {
|
|
240
|
+
Object.assign(props, item._cellProps[colName])
|
|
224
241
|
}
|
|
225
242
|
|
|
226
243
|
return props
|
|
227
244
|
}
|
|
228
245
|
|
|
246
|
+
export const getTableDataCellStyles = (column: Column | string, item: Item, colName: string) => {
|
|
247
|
+
const styles = {}
|
|
248
|
+
|
|
249
|
+
if (typeof column === 'object' && column._colStyle) {
|
|
250
|
+
Object.assign(styles, column._colStyle)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (item._cellStyle && item._cellStyle['all']) {
|
|
254
|
+
Object.assign(styles, item._cellStyle['all'])
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (item._cellStyle && item._cellStyle[colName]) {
|
|
258
|
+
Object.assign(styles, item._cellStyle[colName])
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return styles
|
|
262
|
+
}
|
|
263
|
+
|
|
229
264
|
export const getTableHeaderCellProps = (column: Column | string) => {
|
|
230
265
|
if (typeof column === 'object' && column._props) {
|
|
231
266
|
return column._props
|
|
@@ -272,14 +272,11 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
const InputGroup = () => (
|
|
275
|
-
<div
|
|
276
|
-
className={classNames('input-group', 'picker-input-group', {
|
|
277
|
-
[`input-group-${size}`]: size,
|
|
278
|
-
})}
|
|
279
|
-
>
|
|
275
|
+
<div className="time-picker-input-group">
|
|
280
276
|
<input
|
|
281
277
|
autoComplete="off"
|
|
282
|
-
className="
|
|
278
|
+
className="time-picker-input"
|
|
279
|
+
// delay={true}
|
|
283
280
|
disabled={disabled}
|
|
284
281
|
onChange={(event) =>
|
|
285
282
|
isValidTime(event.target.value) && setDate(convertTimeToDate(event.target.value))
|
|
@@ -289,32 +286,18 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
|
|
|
289
286
|
required={required}
|
|
290
287
|
ref={inputRef}
|
|
291
288
|
/>
|
|
292
|
-
{
|
|
293
|
-
<
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
)
|
|
303
|
-
|
|
304
|
-
<span
|
|
305
|
-
className="picker-input-group-cleaner"
|
|
306
|
-
role="button"
|
|
307
|
-
onClick={(event) => handleClear(event)}
|
|
308
|
-
>
|
|
309
|
-
{typeof cleaner === 'boolean' ? (
|
|
310
|
-
<span className="picker-input-group-icon time-picker-cleaner-icon" />
|
|
311
|
-
) : (
|
|
312
|
-
cleaner
|
|
313
|
-
)}
|
|
314
|
-
</span>
|
|
315
|
-
)}
|
|
316
|
-
</span>
|
|
317
|
-
)}
|
|
289
|
+
{indicator &&
|
|
290
|
+
(typeof indicator === 'boolean' ? <div className="time-picker-indicator" /> : indicator)}
|
|
291
|
+
{cleaner &&
|
|
292
|
+
date &&
|
|
293
|
+
(typeof cleaner === 'boolean' ? (
|
|
294
|
+
<div className="time-picker-cleaner" onClick={(event) => handleClear(event)} />
|
|
295
|
+
) : (
|
|
296
|
+
React.isValidElement(cleaner) &&
|
|
297
|
+
React.cloneElement(cleaner as React.ReactElement<any>, {
|
|
298
|
+
onClick: (event: React.MouseEvent<HTMLElement>) => handleClear(event),
|
|
299
|
+
})
|
|
300
|
+
))}
|
|
318
301
|
</div>
|
|
319
302
|
)
|
|
320
303
|
|
|
@@ -323,7 +306,7 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
|
|
|
323
306
|
<>
|
|
324
307
|
<span className="time-picker-inline-icon" />
|
|
325
308
|
<select
|
|
326
|
-
className="
|
|
309
|
+
className="time-picker-inline-select"
|
|
327
310
|
disabled={disabled}
|
|
328
311
|
onChange={(event: React.ChangeEvent<HTMLSelectElement>) =>
|
|
329
312
|
handleTimeChange('hours', event.target.value)
|
|
@@ -339,7 +322,7 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
|
|
|
339
322
|
</select>
|
|
340
323
|
<>:</>
|
|
341
324
|
<select
|
|
342
|
-
className="
|
|
325
|
+
className="time-picker-inline-select"
|
|
343
326
|
disabled={disabled}
|
|
344
327
|
onChange={(event: React.ChangeEvent<HTMLSelectElement>) =>
|
|
345
328
|
handleTimeChange('minutes', event.target.value)
|
|
@@ -357,7 +340,7 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
|
|
|
357
340
|
<>
|
|
358
341
|
<>:</>
|
|
359
342
|
<select
|
|
360
|
-
className="
|
|
343
|
+
className="time-picker-inline-select"
|
|
361
344
|
disabled={disabled}
|
|
362
345
|
onChange={(event: React.ChangeEvent<HTMLSelectElement>) =>
|
|
363
346
|
handleTimeChange('seconds', event.target.value)
|
|
@@ -375,7 +358,7 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
|
|
|
375
358
|
)}
|
|
376
359
|
{localizedTimePartials && localizedTimePartials.hour12 && (
|
|
377
360
|
<select
|
|
378
|
-
className="
|
|
361
|
+
className="time-picker-inline-select"
|
|
379
362
|
disabled={disabled}
|
|
380
363
|
onChange={(event: React.ChangeEvent<HTMLSelectElement>) =>
|
|
381
364
|
handleTimeChange('toggle', event.target.value)
|
|
@@ -451,7 +434,7 @@ export const CTimePicker = forwardRef<HTMLDivElement | HTMLLIElement, CTimePicke
|
|
|
451
434
|
dropdownClassNames="time-picker-dropdown"
|
|
452
435
|
footer={footer}
|
|
453
436
|
footerContent={
|
|
454
|
-
<div className="picker-footer">
|
|
437
|
+
<div className="time-picker-footer">
|
|
455
438
|
{cancelButton && (
|
|
456
439
|
<CButton
|
|
457
440
|
color={cancelButtonColor}
|
|
@@ -16,7 +16,11 @@ export const convert12hTo24h = (abbr: 'am' | 'pm', hour: number) => {
|
|
|
16
16
|
export const convert24hTo12h = (hour: number) => hour % 12 || 12
|
|
17
17
|
|
|
18
18
|
export const convertTimeToDate = (time: Date | string | null | undefined) =>
|
|
19
|
-
time
|
|
19
|
+
time
|
|
20
|
+
? time instanceof Date
|
|
21
|
+
? time
|
|
22
|
+
: new Date(`1970-01-01 ${time}`)
|
|
23
|
+
: null
|
|
20
24
|
|
|
21
25
|
export const getAmPm = (date: Date, locale: string) => {
|
|
22
26
|
if (date.toLocaleTimeString(locale).includes('AM')) {
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { useColorModes } from './useColorModes'
|
|
1
2
|
import { useForkedRef } from './useForkedRef'
|
|
2
3
|
import { usePopper } from './usePopper'
|
|
3
4
|
import { useStateWithCallback } from './useStateWithCallback'
|
|
4
5
|
|
|
5
|
-
export { useForkedRef, usePopper, useStateWithCallback }
|
|
6
|
+
export { useColorModes, useForkedRef, usePopper, useStateWithCallback }
|