@@ -20,7 +20,6 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
20
20
import { weekdayNames } from "@calcom/lib/weekday" ;
21
21
import useMeQuery from "@calcom/trpc/react/hooks/useMeQuery" ;
22
22
import type { TimeRange } from "@calcom/types/schedule" ;
23
-
24
23
import cn from "@calcom/ui/classNames" ;
25
24
import { Button } from "@calcom/ui/components/button" ;
26
25
import { Dropdown , DropdownMenuContent , DropdownMenuTrigger } from "@calcom/ui/components/dropdown" ;
@@ -37,6 +36,14 @@ export type ScheduleLabelsType = {
37
36
deleteTime : string ;
38
37
} ;
39
38
39
+ export type SelectInnerClassNames = {
40
+ control ?: string ;
41
+ singleValue ?: string ;
42
+ valueContainer ?: string ;
43
+ input ?: string ;
44
+ menu ?: string ;
45
+ } ;
46
+
40
47
export type FieldPathByValue < TFieldValues extends FieldValues , TValue > = {
41
48
[ Key in FieldPath < TFieldValues > ] : FieldPathValue < TFieldValues , Key > extends TValue ? Key : never ;
42
49
} [ FieldPath < TFieldValues > ] ;
@@ -106,6 +113,7 @@ export const ScheduleDay = <TFieldValues extends FieldValues>({
106
113
classNames = { {
107
114
dayRanges : classNames ?. dayRanges ,
108
115
timeRangeField : classNames ?. timeRangeField ,
116
+ timePicker : classNames ?. timePicker ,
109
117
} }
110
118
/>
111
119
{ ! disabled && < div className = "block" > { CopyButton } </ div > }
@@ -238,7 +246,7 @@ export const DayRanges = <TFieldValues extends FieldValues>({
238
246
disabled ?: boolean ;
239
247
labels ?: ScheduleLabelsType ;
240
248
userTimeFormat : number | null ;
241
- classNames ?: Pick < scheduleClassNames , "dayRanges" | "timeRangeField" > ;
249
+ classNames ?: Pick < scheduleClassNames , "dayRanges" | "timeRangeField" | "timePicker" > ;
242
250
} ) => {
243
251
const { t } = useLocale ( ) ;
244
252
const { getValues } = useFormContext ( ) ;
@@ -261,6 +269,7 @@ export const DayRanges = <TFieldValues extends FieldValues>({
261
269
< TimeRangeField
262
270
className = { classNames ?. timeRangeField }
263
271
userTimeFormat = { userTimeFormat }
272
+ timePickerClassNames = { classNames ?. timePicker }
264
273
{ ...field }
265
274
/>
266
275
) }
@@ -336,11 +345,27 @@ const TimeRangeField = ({
336
345
onChange,
337
346
disabled,
338
347
userTimeFormat,
348
+ timePickerClassNames,
339
349
} : {
340
350
className ?: string ;
341
351
disabled ?: boolean ;
342
352
userTimeFormat : number | null ;
353
+ timePickerClassNames ?: {
354
+ container ?: string ;
355
+ value ?: string ;
356
+ valueContainer ?: string ;
357
+ input ?: string ;
358
+ dropdown ?: string ;
359
+ } ;
343
360
} & ControllerRenderProps ) => {
361
+ const innerClassNames : SelectInnerClassNames = {
362
+ control : timePickerClassNames ?. container ,
363
+ singleValue : timePickerClassNames ?. value ,
364
+ valueContainer : timePickerClassNames ?. valueContainer ,
365
+ input : timePickerClassNames ?. input ,
366
+ menu : timePickerClassNames ?. dropdown ,
367
+ } ;
368
+
344
369
// this is a controlled component anyway given it uses LazySelect, so keep it RHF agnostic.
345
370
return (
346
371
< div className = { cn ( "flex flex-row gap-2 sm:gap-3" , className ) } >
@@ -350,6 +375,7 @@ const TimeRangeField = ({
350
375
isDisabled = { disabled }
351
376
value = { value . start }
352
377
menuPlacement = "bottom"
378
+ innerClassNames = { innerClassNames }
353
379
onChange = { ( option ) => {
354
380
const newStart = new Date ( option ?. value as number ) ;
355
381
if ( newStart >= new Date ( value . end ) ) {
@@ -368,6 +394,7 @@ const TimeRangeField = ({
368
394
isDisabled = { disabled }
369
395
value = { value . end }
370
396
min = { value . start }
397
+ innerClassNames = { innerClassNames }
371
398
menuPlacement = "bottom"
372
399
onChange = { ( option ) => {
373
400
onChange ( { ...value , end : new Date ( option ?. value as number ) } ) ;
@@ -389,6 +416,7 @@ const LazySelect = ({
389
416
min ?: ConfigType ;
390
417
max ?: ConfigType ;
391
418
userTimeFormat : number | null ;
419
+ innerClassNames ?: SelectInnerClassNames ;
392
420
} ) => {
393
421
// Lazy-loaded options, otherwise adding a field has a noticeable redraw delay.
394
422
const { options, filter } = useOptions ( userTimeFormat ) ;
0 commit comments