File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ interface Props {
47
47
inputClassName ?: string | null ;
48
48
containerClassName ?: string | null ;
49
49
displayFormat ?: string ;
50
+ readonly ?: boolean ;
50
51
}
51
52
52
53
const Datepicker : React . FC < Props > = ( {
@@ -65,7 +66,8 @@ const Datepicker: React.FC<Props> = ({
65
66
disabled = false ,
66
67
inputClassName = null ,
67
68
containerClassName = null ,
68
- displayFormat = "YYYY-MM-DD"
69
+ displayFormat = "YYYY-MM-DD" ,
70
+ readonly = false
69
71
} ) => {
70
72
// Ref
71
73
const containerRef = useRef < HTMLDivElement > ( null ) ;
@@ -261,7 +263,8 @@ const Datepicker: React.FC<Props> = ({
261
263
value,
262
264
disabled,
263
265
inputClassName,
264
- containerClassName
266
+ containerClassName,
267
+ readonly
265
268
} ;
266
269
} , [
267
270
asSingle ,
@@ -280,7 +283,8 @@ const Datepicker: React.FC<Props> = ({
280
283
value ,
281
284
disabled ,
282
285
inputClassName ,
283
- containerClassName
286
+ containerClassName ,
287
+ readonly
284
288
] ) ;
285
289
286
290
return (
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ const Input: React.FC = () => {
24
24
placeholder,
25
25
separator,
26
26
disabled,
27
- inputClassName
27
+ inputClassName,
28
+ readonly
28
29
} = useContext ( DatepickerContext ) ;
29
30
30
31
// UseRefs
@@ -167,6 +168,7 @@ const Input: React.FC = () => {
167
168
type = "text"
168
169
className = { getClassName ( ) }
169
170
disabled = { disabled }
171
+ readOnly = { readonly }
170
172
placeholder = {
171
173
placeholder
172
174
? placeholder
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ interface DatepickerStore {
31
31
disabled ?: boolean ;
32
32
inputClassName ?: string | null ;
33
33
containerClassName ?: string | null ;
34
+ readonly ?: boolean ;
34
35
}
35
36
36
37
const DatepickerContext = createContext < DatepickerStore > ( {
@@ -57,7 +58,8 @@ const DatepickerContext = createContext<DatepickerStore>({
57
58
i18n : "en" ,
58
59
disabled : false ,
59
60
inputClassName : "" ,
60
- containerClassName : ""
61
+ containerClassName : "" ,
62
+ readonly : false
61
63
} ) ;
62
64
63
65
export default DatepickerContext ;
You can’t perform that action at this time.
0 commit comments