From a9f479b4dea26a6139f3cf164c72740a24660040 Mon Sep 17 00:00:00 2001 From: Vanilla Viking Date: Wed, 13 Sep 2023 14:21:55 +1000 Subject: [PATCH 1/2] feat: add default input type for time picker --- docusaurus/docs/time-picker.md | 4 ++++ src/Time/TimePickerModal.tsx | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docusaurus/docs/time-picker.md b/docusaurus/docs/time-picker.md index f7f7468d..37bc8b51 100644 --- a/docusaurus/docs/time-picker.md +++ b/docusaurus/docs/time-picker.md @@ -113,3 +113,7 @@ Flag indicating if the time input should use the 24 hours clock. Defaults to the **inputFontSize** `Type: number | undefined` Font size of the time input. Defaults to 57. Useful when using a custom font. + +**defaultInputType** +`Type: 'picker' | 'keyboard'` +Which input type to use by default. Defaults to the clock-face picker. diff --git a/src/Time/TimePickerModal.tsx b/src/Time/TimePickerModal.tsx index 8eca3702..ee49831d 100644 --- a/src/Time/TimePickerModal.tsx +++ b/src/Time/TimePickerModal.tsx @@ -57,6 +57,7 @@ export function TimePickerModal({ clockIcon = 'clock-outline', use24HourClock, inputFontSize, + defaultInputType, }: { locale?: undefined | string label?: string @@ -73,6 +74,7 @@ export function TimePickerModal({ clockIcon?: string use24HourClock?: boolean inputFontSize?: number + defaultInputType?: PossibleInputTypes }) { const theme = useTheme() @@ -86,7 +88,7 @@ export function TimePickerModal({ } const [inputType, setInputType] = React.useState( - inputTypes.picker + defaultInputType || inputTypes.picker ) const [focused, setFocused] = React.useState( clockTypes.hours From b173506840cfa885d7500103424e3b27b57c9e01 Mon Sep 17 00:00:00 2001 From: Vanilla Viking Date: Wed, 13 Sep 2023 14:25:49 +1000 Subject: [PATCH 2/2] chore: fix indentation --- src/Time/TimePickerModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Time/TimePickerModal.tsx b/src/Time/TimePickerModal.tsx index ee49831d..c4248424 100644 --- a/src/Time/TimePickerModal.tsx +++ b/src/Time/TimePickerModal.tsx @@ -74,7 +74,7 @@ export function TimePickerModal({ clockIcon?: string use24HourClock?: boolean inputFontSize?: number - defaultInputType?: PossibleInputTypes + defaultInputType?: PossibleInputTypes }) { const theme = useTheme()