@codeleap/web 3.25.0 → 3.25.2
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/package.json +1 -2
- package/src/components/ActionIcon/index.tsx +52 -51
- package/src/components/ActionIcon/styles.ts +5 -1
- package/src/components/ActivityIndicator/index.tsx +55 -34
- package/src/components/ActivityIndicator/styles.ts +6 -0
- package/src/components/Badge/index.tsx +80 -43
- package/src/components/Badge/styles.ts +11 -1
- package/src/components/Button/index.tsx +89 -46
- package/src/components/Button/styles.ts +5 -0
- package/src/components/Checkbox/index.tsx +97 -83
- package/src/components/Checkbox/styles.ts +5 -1
- package/src/components/Collapse/index.tsx +83 -41
- package/src/components/Collapse/styles.ts +6 -3
- package/src/components/ColorPicker/index.tsx +48 -95
- package/src/components/ColorPicker/styles.ts +11 -11
- package/src/components/ColorPicker/types.ts +12 -26
- package/src/components/CropPicker/index.tsx +104 -100
- package/src/components/CropPicker/styles.ts +7 -0
- package/src/components/CropPicker/types.ts +17 -8
- package/src/{lib/hooks/useCropPicker.ts → components/CropPicker/useCropPicker.tsx} +15 -68
- package/src/components/CropPicker/utils.ts +51 -0
- package/src/components/DatePicker/{components → defaultComponents}/Header.tsx +17 -9
- package/src/components/DatePicker/{components → defaultComponents}/OuterInput.tsx +7 -6
- package/src/components/DatePicker/index.tsx +124 -110
- package/src/components/DatePicker/styles.ts +12 -1
- package/src/components/DatePicker/types.ts +33 -16
- package/src/components/Drawer/index.tsx +125 -133
- package/src/components/Drawer/styles.ts +5 -0
- package/src/components/Dropzone/index.tsx +63 -87
- package/src/components/Dropzone/styles.ts +6 -0
- package/src/components/Dropzone/types.ts +37 -29
- package/src/components/EmptyPlaceholder/index.tsx +83 -63
- package/src/components/EmptyPlaceholder/styles.ts +5 -0
- package/src/components/FileInput.tsx +91 -0
- package/src/components/Grid/index.tsx +41 -40
- package/src/components/Grid/styles.ts +9 -2
- package/src/components/Grid/types.ts +12 -10
- package/src/components/Icon/index.tsx +47 -45
- package/src/components/Icon/styles.ts +8 -0
- package/src/components/InputBase/index.tsx +42 -71
- package/src/components/InputBase/styles.ts +47 -37
- package/src/components/InputBase/types.ts +7 -19
- package/src/components/InputBase/utils.ts +23 -3
- package/src/components/List/ListLayout.tsx +37 -20
- package/src/components/List/PaginationIndicator.tsx +102 -0
- package/src/components/List/index.tsx +41 -36
- package/src/components/List/styles.ts +11 -5
- package/src/components/List/types.ts +20 -30
- package/src/components/List/useInfiniteScroll.ts +159 -0
- package/src/components/LoadingOverlay/index.tsx +33 -31
- package/src/components/LoadingOverlay/styles.ts +8 -3
- package/src/components/Modal/index.tsx +160 -98
- package/src/components/Modal/styles.ts +5 -0
- package/src/components/NumberIncrement/index.tsx +98 -67
- package/src/components/NumberIncrement/styles.ts +5 -0
- package/src/components/Overlay/index.tsx +35 -37
- package/src/components/Overlay/styles.ts +5 -3
- package/src/components/Pager/index.tsx +81 -65
- package/src/components/Pager/styles.ts +9 -3
- package/src/components/Progress/Bar/index.tsx +50 -45
- package/src/components/Progress/Bar/styles.tsx +7 -0
- package/src/components/Progress/Bar/types.tsx +30 -0
- package/src/components/Progress/Circle/index.tsx +48 -45
- package/src/components/Progress/Circle/styles.ts +8 -1
- package/src/components/Progress/Circle/types.ts +22 -10
- package/src/components/RadioInput/index.tsx +124 -78
- package/src/components/RadioInput/styles.ts +6 -0
- package/src/components/Scroll/index.tsx +32 -0
- package/src/components/Scroll/styles.ts +8 -0
- package/src/components/SearchInput/index.tsx +10 -10
- package/src/components/SectionFilters/index.tsx +36 -47
- package/src/components/SectionFilters/styles.ts +5 -1
- package/src/components/SectionFilters/types.ts +13 -14
- package/src/components/SegmentedControl/SegmentedControlOption.tsx +84 -0
- package/src/components/SegmentedControl/index.tsx +89 -111
- package/src/components/SegmentedControl/styles.ts +21 -7
- package/src/components/Select/index.tsx +58 -92
- package/src/components/Select/styles.ts +36 -19
- package/src/components/Select/types.ts +13 -17
- package/src/components/Slider/index.tsx +93 -85
- package/src/components/Slider/styles.ts +6 -13
- package/src/components/Switch/index.tsx +74 -63
- package/src/components/Switch/styles.ts +6 -1
- package/src/components/Tag/index.tsx +44 -39
- package/src/components/Tag/styles.ts +9 -1
- package/src/components/Tag/types.ts +10 -10
- package/src/components/Text/index.tsx +48 -37
- package/src/components/Text/styles.ts +8 -0
- package/src/components/Text/types.ts +8 -8
- package/src/components/TextEditor/index.tsx +28 -49
- package/src/components/TextEditor/styles.ts +8 -1
- package/src/components/TextEditor/types.ts +6 -11
- package/src/components/TextInput/index.tsx +96 -58
- package/src/components/TextInput/mask.tsx +50 -2
- package/src/components/TextInput/styles.ts +8 -3
- package/src/components/Tooltip/index.tsx +84 -61
- package/src/components/Tooltip/styles.ts +10 -3
- package/src/components/Touchable/index.tsx +86 -43
- package/src/components/Touchable/styles.ts +6 -0
- package/src/components/View/index.tsx +50 -36
- package/src/components/View/styles.ts +6 -0
- package/src/components/View/types.ts +15 -14
- package/src/components/components.ts +3 -2
- package/src/components/defaultStyles.ts +79 -0
- package/src/index.ts +0 -1
- package/src/lib/hooks/index.ts +0 -5
- package/src/lib/hooks/useBreakpointMatch.ts +7 -8
- package/src/lib/hooks/useMediaQuery.ts +3 -4
- package/src/lib/hooks/usePagination.ts +63 -79
- package/src/lib/index.ts +0 -1
- package/src/lib/utils/index.ts +0 -1
- package/src/lib/utils/test.ts +2 -2
- package/src/components/ActionIcon/types.ts +0 -15
- package/src/components/ActivityIndicator/types.ts +0 -12
- package/src/components/Badge/types.ts +0 -28
- package/src/components/Button/types.ts +0 -25
- package/src/components/Checkbox/types.ts +0 -15
- package/src/components/Collapse/types.ts +0 -11
- package/src/components/Drawer/types.ts +0 -23
- package/src/components/EmptyPlaceholder/types.ts +0 -32
- package/src/components/FileInput/index.tsx +0 -72
- package/src/components/FileInput/types.ts +0 -14
- package/src/components/Icon/types.ts +0 -15
- package/src/components/LoadingOverlay/types.ts +0 -16
- package/src/components/Modal/types.ts +0 -55
- package/src/components/NumberIncrement/types.ts +0 -29
- package/src/components/Overlay/types.ts +0 -13
- package/src/components/Pager/types.ts +0 -35
- package/src/components/PaginationButtons/index.tsx +0 -173
- package/src/components/PaginationButtons/styles.ts +0 -7
- package/src/components/PaginationButtons/types.ts +0 -26
- package/src/components/PaginationIndicator/index.tsx +0 -69
- package/src/components/PaginationIndicator/styles.ts +0 -3
- package/src/components/PaginationIndicator/types.ts +0 -18
- package/src/components/Progress/Bar/styles.ts +0 -10
- package/src/components/Progress/Bar/types.ts +0 -26
- package/src/components/RadioInput/types.ts +0 -29
- package/src/components/SegmentedControl/types.ts +0 -44
- package/src/components/Slider/types.ts +0 -29
- package/src/components/Switch/types.ts +0 -13
- package/src/components/TextInput/types.ts +0 -85
- package/src/components/Tooltip/types.ts +0 -46
- package/src/components/Touchable/types.ts +0 -22
- package/src/lib/WebStyleRegistry.ts +0 -51
- package/src/lib/hooks/useFileInput.ts +0 -15
- package/src/lib/hooks/useInfiniteScroll.ts +0 -77
- package/src/lib/hooks/useRefresh.ts +0 -87
- package/src/lib/hooks/useStylesFor.ts +0 -13
- package/src/lib/utils/cache.ts +0 -9
- /package/src/components/DatePicker/{components → defaultComponents}/index.tsx +0 -0
|
@@ -1,27 +1,45 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TypeGuards,
|
|
3
|
+
getNestedStylesByKey,
|
|
3
4
|
useCallback,
|
|
4
|
-
|
|
5
|
+
useDefaultComponentStyle,
|
|
6
|
+
useState,
|
|
5
7
|
} from '@codeleap/common'
|
|
6
8
|
import { Text, View } from '../components'
|
|
9
|
+
import { DatePickerPresets } from './styles'
|
|
7
10
|
import { DatePickerProps, DayComponentProps } from './types'
|
|
8
|
-
import
|
|
9
|
-
import { Header, OuterInput } from './
|
|
11
|
+
import _DatePicker from 'react-datepicker'
|
|
12
|
+
import { Header, OuterInput } from './defaultComponents'
|
|
10
13
|
import { format, isBefore, isAfter } from 'date-fns'
|
|
11
|
-
import { useStylesFor } from '../../lib/hooks/useStylesFor'
|
|
12
|
-
import { WebStyleRegistry } from '../../lib/WebStyleRegistry'
|
|
13
|
-
import { AnyRecord, IJSX, StyledComponentProps, useCompositionStyles } from '@codeleap/styles'
|
|
14
14
|
|
|
15
15
|
export * from './styles'
|
|
16
16
|
export * from './types'
|
|
17
|
-
export * from './
|
|
17
|
+
export * from './defaultComponents'
|
|
18
|
+
|
|
19
|
+
const defaultProps = {
|
|
20
|
+
variants: [],
|
|
21
|
+
styles: {},
|
|
22
|
+
minDate: new Date(1910, 0, 1),
|
|
23
|
+
maxDate: new Date(),
|
|
24
|
+
startDate: new Date(1923, 0, 1),
|
|
25
|
+
outerInputComponent: OuterInput,
|
|
26
|
+
headerComponent: Header,
|
|
27
|
+
}
|
|
18
28
|
|
|
19
29
|
export function DatePicker(props: DatePickerProps) {
|
|
30
|
+
const allProps = {
|
|
31
|
+
...DatePicker.defaultProps,
|
|
32
|
+
...props,
|
|
33
|
+
}
|
|
34
|
+
|
|
20
35
|
const {
|
|
21
36
|
hideInput,
|
|
22
37
|
value,
|
|
23
38
|
onValueChange,
|
|
39
|
+
variants,
|
|
40
|
+
styles,
|
|
24
41
|
style,
|
|
42
|
+
responsiveVariants,
|
|
25
43
|
defaultValue,
|
|
26
44
|
outerInputComponent: OuterInputComponent,
|
|
27
45
|
headerComponent: HeaderComponent,
|
|
@@ -38,99 +56,120 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
38
56
|
toggle: _toggle,
|
|
39
57
|
yearShow: _yearShow,
|
|
40
58
|
setYearShow: _setYearShow,
|
|
41
|
-
disabled,
|
|
59
|
+
disabled = false,
|
|
42
60
|
...otherProps
|
|
43
|
-
} =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
} = allProps
|
|
62
|
+
|
|
63
|
+
const [visible, toggle] =
|
|
64
|
+
TypeGuards.isBoolean(_visible) && TypeGuards.isFunction(_toggle)
|
|
65
|
+
? [_visible, _toggle]
|
|
66
|
+
: useState(false)
|
|
67
|
+
const [yearShow, setYearShow] =
|
|
68
|
+
TypeGuards.isBoolean(_yearShow) && TypeGuards.isFunction(_setYearShow)
|
|
69
|
+
? [_yearShow, _setYearShow]
|
|
70
|
+
: useState(false)
|
|
71
|
+
|
|
72
|
+
const variantStyles = useDefaultComponentStyle<
|
|
73
|
+
'u:DatePicker',
|
|
74
|
+
typeof DatePickerPresets
|
|
75
|
+
>('u:DatePicker', {
|
|
76
|
+
variants,
|
|
77
|
+
responsiveVariants,
|
|
78
|
+
styles,
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const DayContentComponent = useCallback(
|
|
82
|
+
(_param: DayComponentProps) => {
|
|
83
|
+
const param = {
|
|
84
|
+
..._param,
|
|
85
|
+
...dayProps,
|
|
86
|
+
}
|
|
49
87
|
|
|
50
|
-
|
|
51
|
-
const [yearShow, setYearShow] = useConditionalState(_yearShow, _setYearShow, { initialValue: false })
|
|
88
|
+
const { day, date: _date } = param
|
|
52
89
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
..._param,
|
|
56
|
-
...dayProps,
|
|
57
|
-
}
|
|
90
|
+
const date = format(new Date(_date), 'dd MMM yyyy')
|
|
91
|
+
const dateValue = value ? format(new Date(value), 'dd MMM yyyy') : ''
|
|
58
92
|
|
|
59
|
-
|
|
60
|
-
const dateValue = value ? format(new Date(value), 'dd MMM yyyy') : ''
|
|
93
|
+
const isSelected = date === dateValue
|
|
61
94
|
|
|
62
|
-
|
|
95
|
+
const isDisabled = [
|
|
96
|
+
isBefore(_date, minDate),
|
|
97
|
+
isAfter(_date, maxDate),
|
|
98
|
+
].some(Boolean)
|
|
63
99
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
100
|
+
const getStyles = (key) => {
|
|
101
|
+
return {
|
|
102
|
+
...variantStyles[key],
|
|
103
|
+
...(isSelected && variantStyles[`${key}:selected`]),
|
|
104
|
+
...(!isSelected && isDisabled && variantStyles[`${key}:disabled`]),
|
|
105
|
+
}
|
|
106
|
+
}
|
|
68
107
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
108
|
+
if (TypeGuards.isFunction(DayComponent)) {
|
|
109
|
+
return (
|
|
110
|
+
<DayComponent
|
|
111
|
+
{...param}
|
|
112
|
+
value={value}
|
|
113
|
+
disabled={isDisabled}
|
|
114
|
+
selected={isSelected}
|
|
115
|
+
variantStyles={variantStyles}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
74
118
|
}
|
|
75
|
-
}
|
|
76
119
|
|
|
77
|
-
if (TypeGuards.isFunction(DayComponent)) {
|
|
78
120
|
return (
|
|
79
|
-
<
|
|
80
|
-
{
|
|
81
|
-
|
|
82
|
-
disabled={isDisabled}
|
|
83
|
-
selected={isSelected}
|
|
84
|
-
styles={styles}
|
|
85
|
-
/>
|
|
121
|
+
<View css={getStyles('dayWrapper')}>
|
|
122
|
+
<Text style={getStyles('day')} disabled={isDisabled} text={String(day)} />
|
|
123
|
+
</View>
|
|
86
124
|
)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
125
|
+
},
|
|
126
|
+
[value],
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
const YearContentComponent = useCallback(
|
|
130
|
+
(_param) => {
|
|
131
|
+
const param = {
|
|
132
|
+
..._param,
|
|
133
|
+
...yearProps,
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const { year } = param
|
|
137
|
+
|
|
138
|
+
const isSelected = String(value)?.includes(year)
|
|
139
|
+
|
|
140
|
+
const getStyles = (key) => {
|
|
141
|
+
return {
|
|
142
|
+
...variantStyles[key],
|
|
143
|
+
...(isSelected && variantStyles[`${key}:selected`]),
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (TypeGuards.isFunction(YearComponent)) {
|
|
148
|
+
return (
|
|
149
|
+
<YearComponent
|
|
150
|
+
{...param}
|
|
151
|
+
value={value}
|
|
152
|
+
selected={isSelected}
|
|
153
|
+
variantStyles={variantStyles}
|
|
154
|
+
/>
|
|
155
|
+
)
|
|
108
156
|
}
|
|
109
|
-
}
|
|
110
157
|
|
|
111
|
-
if (TypeGuards.isFunction(YearComponent)) {
|
|
112
158
|
return (
|
|
113
|
-
<
|
|
114
|
-
{
|
|
115
|
-
|
|
116
|
-
selected={isSelected}
|
|
117
|
-
styles={styles}
|
|
118
|
-
/>
|
|
159
|
+
<View css={getStyles('yearWrapper')}>
|
|
160
|
+
<Text style={getStyles('year')} text={year} />
|
|
161
|
+
</View>
|
|
119
162
|
)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
<View style={getStyles('yearWrapper')}>
|
|
124
|
-
<Text style={getStyles('year')} text={param?.year} />
|
|
125
|
-
</View>
|
|
126
|
-
)
|
|
127
|
-
}, [value])
|
|
163
|
+
},
|
|
164
|
+
[value],
|
|
165
|
+
)
|
|
128
166
|
|
|
129
|
-
const
|
|
167
|
+
const inputStyles = getNestedStylesByKey('outerInput', variantStyles)
|
|
168
|
+
const headerStyles = getNestedStylesByKey('header', variantStyles)
|
|
130
169
|
|
|
131
170
|
return (
|
|
132
|
-
<View
|
|
133
|
-
<
|
|
171
|
+
<View css={variantStyles.wrapper}>
|
|
172
|
+
<_DatePicker
|
|
134
173
|
onChange={onValueChange}
|
|
135
174
|
open={visible}
|
|
136
175
|
selected={value}
|
|
@@ -147,7 +186,7 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
147
186
|
)}
|
|
148
187
|
customInput={
|
|
149
188
|
<OuterInputComponent
|
|
150
|
-
|
|
189
|
+
styles={inputStyles}
|
|
151
190
|
focused={visible}
|
|
152
191
|
hideInput={hideInput}
|
|
153
192
|
{...otherProps}
|
|
@@ -155,7 +194,7 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
155
194
|
}
|
|
156
195
|
renderCustomHeader={(headerProps) => (
|
|
157
196
|
<HeaderComponent
|
|
158
|
-
styles={
|
|
197
|
+
styles={headerStyles}
|
|
159
198
|
setYearShow={setYearShow}
|
|
160
199
|
prevYearButtonDisabled={yearShow}
|
|
161
200
|
nextYearButtonDisabled={yearShow}
|
|
@@ -190,29 +229,4 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
190
229
|
)
|
|
191
230
|
}
|
|
192
231
|
|
|
193
|
-
DatePicker.
|
|
194
|
-
|
|
195
|
-
DatePicker.elements = [
|
|
196
|
-
'wrapper',
|
|
197
|
-
'day',
|
|
198
|
-
'year',
|
|
199
|
-
'outerInput',
|
|
200
|
-
'header',
|
|
201
|
-
]
|
|
202
|
-
|
|
203
|
-
DatePicker.rootElement = 'wrapper'
|
|
204
|
-
|
|
205
|
-
DatePicker.withVariantTypes = <S extends AnyRecord>(styles: S) => {
|
|
206
|
-
return DatePicker as (props: StyledComponentProps<DatePickerProps, typeof styles>) => IJSX
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
DatePicker.defaultProps = {
|
|
210
|
-
minDate: new Date(1910, 0, 1),
|
|
211
|
-
maxDate: new Date(),
|
|
212
|
-
startDate: new Date(1923, 0, 1),
|
|
213
|
-
outerInputComponent: OuterInput,
|
|
214
|
-
headerComponent: Header,
|
|
215
|
-
disabled: false,
|
|
216
|
-
} as Partial<DatePickerProps>
|
|
217
|
-
|
|
218
|
-
WebStyleRegistry.registerComponent(DatePicker)
|
|
232
|
+
DatePicker.defaultProps = defaultProps
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
TextInputComposition,
|
|
3
|
+
createDefaultVariantFactory,
|
|
4
|
+
includePresets,
|
|
5
|
+
} from '@codeleap/common'
|
|
2
6
|
import { ActionIconComposition } from '../ActionIcon'
|
|
3
7
|
|
|
4
8
|
export type DatePickerStates = ':selected' | ':disabled' | ''
|
|
@@ -21,3 +25,10 @@ export type DatePickerComposition =
|
|
|
21
25
|
| DatePickerParts
|
|
22
26
|
| `outerInput${Capitalize<TextInputComposition>}`
|
|
23
27
|
| `header${Capitalize<DatePickerHeaderComposition>}`
|
|
28
|
+
|
|
29
|
+
const createDatePickerStyle =
|
|
30
|
+
createDefaultVariantFactory<DatePickerComposition>()
|
|
31
|
+
|
|
32
|
+
export const DatePickerPresets = includePresets(
|
|
33
|
+
(style) => createDatePickerStyle(() => ({ wrapper: style })),
|
|
34
|
+
)
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import { FormTypes, StylesOf } from '@codeleap/common'
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentVariants, FormTypes, StylesOf } from '@codeleap/common'
|
|
2
|
+
import {
|
|
3
|
+
ReactDatePickerCustomHeaderProps,
|
|
4
|
+
ReactDatePickerProps,
|
|
5
|
+
} from 'react-datepicker'
|
|
3
6
|
import { ActionIconProps, TextInputProps } from '../components'
|
|
4
|
-
import {
|
|
5
|
-
|
|
7
|
+
import {
|
|
8
|
+
DatePickerComposition,
|
|
9
|
+
DatePickerHeaderComposition,
|
|
10
|
+
DatePickerPresets,
|
|
11
|
+
} from './styles'
|
|
6
12
|
|
|
7
13
|
export type DatePickerOuterInputProps = TextInputProps & {
|
|
8
14
|
valueLabel: FormTypes.Label
|
|
9
15
|
hideInput?: boolean
|
|
10
16
|
}
|
|
11
17
|
|
|
12
|
-
export type DatePickerHeaderComponent =
|
|
13
|
-
styles?:
|
|
18
|
+
export type DatePickerHeaderComponent = ReactDatePickerCustomHeaderProps & {
|
|
19
|
+
styles?: DatePickerHeaderComposition
|
|
14
20
|
formatHeaderTitle?: (date: Date) => string
|
|
15
21
|
}
|
|
16
22
|
|
|
@@ -18,32 +24,37 @@ export type DatePickerArrowProps = Partial<ActionIconProps> & {
|
|
|
18
24
|
direction: 'left' | 'right'
|
|
19
25
|
}
|
|
20
26
|
|
|
27
|
+
type RootStyles = ComponentVariants<typeof DatePickerPresets>
|
|
28
|
+
|
|
21
29
|
export type DayComponentProps = {
|
|
22
30
|
day: string | number
|
|
23
31
|
value?: Date
|
|
24
32
|
date: Date
|
|
25
33
|
disabled?: boolean
|
|
26
34
|
selected?: boolean
|
|
27
|
-
|
|
35
|
+
variantStyles?: any
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
export type YearComponentProps = {
|
|
31
39
|
year: string | number
|
|
32
40
|
value: Date
|
|
33
41
|
selected: boolean
|
|
34
|
-
|
|
42
|
+
variantStyles: any
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
type RootDatePickerProps = 'startDate' | 'minDate' | 'maxDate'
|
|
38
46
|
|
|
39
|
-
export type DatePickerProps =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
47
|
+
export type DatePickerProps = Partial<
|
|
48
|
+
Pick<Partial<ReactDatePickerProps>, RootDatePickerProps>
|
|
49
|
+
> &
|
|
50
|
+
RootStyles & {
|
|
51
|
+
styles?: StylesOf<DatePickerComposition>
|
|
52
|
+
style?: React.CSSProperties
|
|
44
53
|
hideInput?: boolean
|
|
45
54
|
value: Date
|
|
46
|
-
outerInputComponent?: React.ComponentType<
|
|
55
|
+
outerInputComponent?: React.ComponentType<
|
|
56
|
+
Partial<DatePickerOuterInputProps>
|
|
57
|
+
>
|
|
47
58
|
headerComponent?: React.ComponentType<Partial<DatePickerHeaderComponent>>
|
|
48
59
|
headerProps?: Partial<DatePickerHeaderComponent>
|
|
49
60
|
dayComponent?: React.ComponentType<Partial<DayComponentProps>>
|
|
@@ -51,11 +62,17 @@ export type DatePickerProps =
|
|
|
51
62
|
yearComponent?: React.ComponentType<Partial<YearComponentProps>>
|
|
52
63
|
yearProps?: Partial<YearComponentProps>
|
|
53
64
|
formatDate?: (date: Date | string) => FormTypes.Label
|
|
54
|
-
datePickerProps?: Omit<
|
|
65
|
+
datePickerProps?: Omit<
|
|
66
|
+
Partial<ReactDatePickerProps>,
|
|
67
|
+
'customInput' | 'renderCustomHeader' | RootDatePickerProps
|
|
68
|
+
>
|
|
55
69
|
onValueChange: (date: Date) => void
|
|
56
70
|
defaultValue?: Date
|
|
57
71
|
visible?: boolean
|
|
58
72
|
toggle?: () => void
|
|
59
73
|
yearShow?: boolean
|
|
60
74
|
setYearShow?: () => void
|
|
61
|
-
}
|
|
75
|
+
} & Omit<
|
|
76
|
+
TextInputProps,
|
|
77
|
+
'defaultValue' | 'styles' | 'variants' | 'responsiveVariants'
|
|
78
|
+
>
|