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