File tree Expand file tree Collapse file tree 3 files changed +6
-22
lines changed Expand file tree Collapse file tree 3 files changed +6
-22
lines changed Original file line number Diff line number Diff line change 1
1
<!DOCTYPE html>
2
2
< html lang ="en ">
3
+
3
4
< head >
4
5
< meta charset ="UTF-8 ">
5
6
< title > Smart Time Input</ title >
34
35
</ style >
35
36
36
37
</ head >
38
+
37
39
< body >
38
40
< h1 > Smart Time Input</ h1 >
39
41
< div id ="myApp "> </ div >
40
42
< script src ="demo.js " type ="text/javascript "> </ script >
41
43
</ body >
42
- </ html >
44
+
45
+ </ html >
Original file line number Diff line number Diff line change @@ -3,22 +3,15 @@ import React from 'react'
3
3
import { StrictMode } from 'react' ;
4
4
import { createRoot } from 'react-dom/client' ;
5
5
6
- // import { SmartTimeInput } from './../src/smart-time-input.tsx'
7
6
import { SmartTimeInput } from './../dist/smart-time-input.js'
8
7
9
8
const InputWrapper = ( props ) => {
10
- console . log ( "hello: " + props . helpText ) ;
11
- // const onTimeChangeHandler = (val) => {
12
- // if (val.length === 5) {
13
- // }
14
- // }
15
9
16
10
return (
17
11
< SmartTimeInput
18
12
initTime = { props . init }
19
13
placeholder = { props . helpText }
20
14
className = 'input'
21
- // onTimeChange={onTimeChangeHandler}
22
15
/>
23
16
) ;
24
17
@@ -27,8 +20,8 @@ const InputWrapper = (props) => {
27
20
function App ( ) {
28
21
return (
29
22
< div >
30
- < InputWrapper init = "12:34" />
31
- < InputWrapper helpText = "HH:mm" />
23
+ < InputWrapper init = "12:34" />
24
+ < InputWrapper helpText = "HH:mm" />
32
25
< InputWrapper />
33
26
</ div >
34
27
) ;
Original file line number Diff line number Diff line change @@ -2,26 +2,18 @@ import React, { useState } from 'react'
2
2
import { is24hTime , addColonToTime , completeTime } from './utils' ;
3
3
4
4
interface SmartTimeInputProps extends React . PropsWithChildren {
5
- id ?: string ;
6
5
initTime ?: string ;
7
- disabled ?: boolean ;
8
- placeholder ?: string ;
9
6
className ?: string ;
10
7
divClassName ?: string ;
11
- name ?: string ;
12
8
ref ?: React . Ref < HTMLInputElement > ;
13
9
onFocusHandler ?: ( e : React . FocusEvent < HTMLInputElement > ) => void ;
14
10
onTimeChange ?: ( val : string ) => void ;
15
11
onBlurHandlerSuper ?: ( e : React . FocusEvent < HTMLInputElement > ) => void ;
16
12
}
17
13
const SmartTimeInput : React . FC < SmartTimeInputProps > = ( {
18
- id,
19
14
initTime,
20
- disabled,
21
- placeholder,
22
15
className,
23
16
divClassName,
24
- name,
25
17
ref,
26
18
onFocusHandler,
27
19
onTimeChange,
@@ -57,12 +49,8 @@ const SmartTimeInput: React.FC<SmartTimeInputProps> = ({
57
49
return (
58
50
< div className = { divClassName } >
59
51
< input
60
- id = { id }
61
- name = { name }
62
52
className = { className }
63
53
type = { 'text' }
64
- disabled = { disabled }
65
- placeholder = { placeholder }
66
54
value = { time }
67
55
onChange = { ( e ) => handleTimeChange ( e . target . value ) }
68
56
onBlur = { ( e ) => autoExtendTime ( e ) }
You can’t perform that action at this time.
0 commit comments