From a80bb387660a7d10f2c5656cb49dae8e94732e6d Mon Sep 17 00:00:00 2001 From: Fabrice Francois Date: Tue, 23 Jan 2024 07:49:35 -0500 Subject: [PATCH 1/7] implement input type --- src/components/input/index.ts | 1 + src/components/input/inputTime/index.ts | 1 + src/components/input/inputTime/inputTime.tsx | 45 ++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 src/components/input/inputTime/index.ts create mode 100644 src/components/input/inputTime/inputTime.tsx diff --git a/src/components/input/index.ts b/src/components/input/index.ts index 830183a28..b4e427675 100644 --- a/src/components/input/index.ts +++ b/src/components/input/index.ts @@ -3,3 +3,4 @@ export * from './inputDate'; export * from './inputNumberMax'; export * from './inputSearch'; export * from './inputText'; +export * from './inputTime'; diff --git a/src/components/input/inputTime/index.ts b/src/components/input/inputTime/index.ts new file mode 100644 index 000000000..9ee629767 --- /dev/null +++ b/src/components/input/inputTime/index.ts @@ -0,0 +1 @@ +export { InputTime, type IInputTimeProps } from './inputTime'; diff --git a/src/components/input/inputTime/inputTime.tsx b/src/components/input/inputTime/inputTime.tsx new file mode 100644 index 000000000..11c3244f8 --- /dev/null +++ b/src/components/input/inputTime/inputTime.tsx @@ -0,0 +1,45 @@ +import classNames from 'classnames'; +import { forwardRef, useRef } from 'react'; +import { mergeRefs } from 'react-merge-refs'; +import { Button } from '../../button'; +import { IconType } from '../../icon'; +import { InputContainer, type IInputComponentProps } from '../inputContainer'; +import { useInputProps } from '../useInputProps'; + +export interface IInputTimeProps extends Omit {} + +export const InputTime = forwardRef((props, ref) => { + const { containerProps, inputProps } = useInputProps(props); + + const { className: containerClassName, ...otherContainerProps } = containerProps; + const { className: inputClassName, disabled, ...otherInputProps } = inputProps; + + const inputRef = useRef(null); + + const handleClockClick = () => { + inputRef.current?.showPicker(); + }; + + return ( + + + {!disabled && ( +