{"version":3,"file":"MaskedDateInput.mjs","names":["classes"],"sources":["../../../src/components/MaskedDateInput/MaskedDateInput.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { Fragment, useRef, useState } from 'react';\nimport {\n  __BaseInputProps,\n  __InputStylesNames,\n  BoxProps,\n  ClearSectionMode,\n  CloseButton,\n  CloseButtonProps,\n  DataAttributes,\n  ElementProps,\n  factory,\n  Factory,\n  Input,\n  InputBase,\n  InputVariant,\n  MantineSize,\n  Popover,\n  PopoverProps,\n  StylesApiProps,\n  useProps,\n  useResolvedStylesApi,\n  useStyles,\n} from '@mantine/core';\nimport { useClickOutside, useDidUpdate, useId, useMergedRef } from '@mantine/hooks';\nimport { useUncontrolledDates } from '../../hooks';\nimport { DateStringValue, DateTimeStringValue } from '../../types';\nimport { Calendar, CalendarBaseProps, CalendarStylesNames, pickCalendarProps } from '../Calendar';\nimport { useDatesContext } from '../DatesProvider';\nimport { DecadeLevelSettings } from '../DecadeLevel';\nimport { isSameMonth } from '../Month';\nimport { MonthLevelSettings } from '../MonthLevel';\nimport { SpinInput } from '../SpinInput';\nimport { AmPmInput } from '../TimePicker/AmPmInput/AmPmInput';\nimport { TimePickerProvider } from '../TimePicker/TimePicker.context';\nimport { YearLevelSettings } from '../YearLevel';\nimport { getDaysInMonth } from './get-days-in-month/get-days-in-month';\nimport { useMaskedDateInput } from './use-masked-date-input';\nimport classes from './MaskedDateInput.module.css';\n\nexport type MaskedDateInputStylesNames =\n  | 'fieldsRoot'\n  | 'fieldsGroup'\n  | 'field'\n  | 'dateSeparator'\n  | 'timeSeparator'\n  | 'dropdown'\n  | CalendarStylesNames\n  | __InputStylesNames;\n\nexport interface MaskedDateInputProps\n  extends\n    BoxProps,\n    Omit<__BaseInputProps, 'size'>,\n    CalendarBaseProps,\n    DecadeLevelSettings,\n    YearLevelSettings,\n    MonthLevelSettings,\n    StylesApiProps<MaskedDateInputFactory>,\n    ElementProps<'div', 'onChange' | 'defaultValue' | 'size'> {\n  /** Controlled component value. YYYY-MM-DD format when withTime=false, YYYY-MM-DD HH:mm:ss when withTime=true. */\n  value?: DateStringValue | DateTimeStringValue | null;\n\n  /** Uncontrolled component default value */\n  defaultValue?: DateStringValue | DateTimeStringValue | null;\n\n  /** Called when value changes. Value is null when fields are incomplete. Format depends on withTime prop. */\n  onChange?: (value: DateStringValue | DateTimeStringValue | null) => void;\n\n  /** Order of date fields @default ['day', 'month', 'year'] */\n  fieldsOrder?: ('day' | 'month' | 'year')[];\n\n  /** Separator displayed between date fields @default '/' */\n  dateSeparator?: string;\n\n  /** Separator displayed between time fields @default ':' */\n  timeSeparator?: string;\n\n  /** Determines whether time fields (hours, minutes) are displayed @default false */\n  withTime?: boolean;\n\n  /** Determines whether seconds field is displayed (requires withTime) @default false */\n  withSeconds?: boolean;\n\n  /** Time format, 24h or 12h @default '24h' */\n  format?: '24h' | '12h';\n\n  /** Labels used for am/pm values @default { am: 'AM', pm: 'PM' } */\n  amPmLabels?: { am: string; pm: string };\n\n  /** Number by which hours are incremented/decremented @default 1 */\n  hoursStep?: number;\n\n  /** Number by which minutes are incremented/decremented @default 1 */\n  minutesStep?: number;\n\n  /** Number by which seconds are incremented/decremented @default 1 */\n  secondsStep?: number;\n\n  /** Determines whether the calendar dropdown is displayed when input is focused @default true */\n  withDropdown?: boolean;\n\n  /** Props passed down to Popover component */\n  popoverProps?: PopoverProps;\n\n  /** Determines whether the clear button should be displayed @default false */\n  clearable?: boolean;\n\n  /** Determines how the clear button and rightSection are rendered @default 'both' */\n  clearSectionMode?: ClearSectionMode;\n\n  /** If set, the value can be deselected by clicking the selected date in the calendar dropdown */\n  allowDeselect?: boolean;\n\n  /** If set, the value cannot be updated */\n  readOnly?: boolean;\n\n  /** If set, the component becomes disabled */\n  disabled?: boolean;\n\n  /** `name` prop passed down to the hidden input */\n  name?: string;\n\n  /** `form` prop passed down to the hidden input */\n  form?: string;\n\n  /** `aria-label` of day input @default 'Day' */\n  dayInputLabel?: string;\n\n  /** `aria-label` of month input @default 'Month' */\n  monthInputLabel?: string;\n\n  /** `aria-label` of year input @default 'Year' */\n  yearInputLabel?: string;\n\n  /** `aria-label` of hours input @default 'Hours' */\n  hoursInputLabel?: string;\n\n  /** `aria-label` of minutes input @default 'Minutes' */\n  minutesInputLabel?: string;\n\n  /** `aria-label` of seconds input @default 'Seconds' */\n  secondsInputLabel?: string;\n\n  /** `aria-label` of am/pm input @default 'AM/PM' */\n  amPmInputLabel?: string;\n\n  /** Props passed to day input */\n  dayInputProps?: React.ComponentProps<'input'> & DataAttributes;\n\n  /** Props passed to month input */\n  monthInputProps?: React.ComponentProps<'input'> & DataAttributes;\n\n  /** Props passed to year input */\n  yearInputProps?: React.ComponentProps<'input'> & DataAttributes;\n\n  /** Props passed to hours input */\n  hoursInputProps?: React.ComponentProps<'input'> & DataAttributes;\n\n  /** Props passed to minutes input */\n  minutesInputProps?: React.ComponentProps<'input'> & DataAttributes;\n\n  /** Props passed to seconds input */\n  secondsInputProps?: React.ComponentProps<'input'> & DataAttributes;\n\n  /** Props passed to am/pm select */\n  amPmSelectProps?: React.ComponentProps<'select'> & DataAttributes;\n\n  /** Props passed to clear button */\n  clearButtonProps?: CloseButtonProps & ElementProps<'button'> & DataAttributes;\n\n  /** Props passed to hidden input */\n  hiddenInputProps?: React.ComponentProps<'input'> & DataAttributes;\n\n  /** Day input placeholder @default '--' */\n  dayPlaceholder?: string;\n\n  /** Month input placeholder @default '--' */\n  monthPlaceholder?: string;\n\n  /** Year input placeholder @default '----' */\n  yearPlaceholder?: string;\n\n  /** Hours input placeholder @default '--' */\n  hoursPlaceholder?: string;\n\n  /** Minutes input placeholder @default '--' */\n  minutesPlaceholder?: string;\n\n  /** Seconds input placeholder @default '--' */\n  secondsPlaceholder?: string;\n\n  /** Ref to day input element */\n  dayRef?: React.Ref<HTMLInputElement>;\n\n  /** Ref to month input element */\n  monthRef?: React.Ref<HTMLInputElement>;\n\n  /** Ref to year input element */\n  yearRef?: React.Ref<HTMLInputElement>;\n\n  /** Ref to hours input element */\n  hoursRef?: React.Ref<HTMLInputElement>;\n\n  /** Ref to minutes input element */\n  minutesRef?: React.Ref<HTMLInputElement>;\n\n  /** Ref to seconds input element */\n  secondsRef?: React.Ref<HTMLInputElement>;\n\n  /** Ref to am/pm select element */\n  amPmRef?: React.Ref<HTMLSelectElement>;\n\n  /** Called once when one of the inputs is focused */\n  onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;\n\n  /** Called once when focus leaves all inputs */\n  onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;\n\n  /** A function to transform pasted values */\n  pasteSplit?: (value: string) => {\n    day: number | null;\n    month: number | null;\n    year: number | null;\n    hours?: number | null;\n    minutes?: number | null;\n    seconds?: number | null;\n  };\n}\n\nexport type MaskedDateInputFactory = Factory<{\n  props: MaskedDateInputProps;\n  ref: HTMLDivElement;\n  stylesNames: MaskedDateInputStylesNames;\n  variant: InputVariant;\n}>;\n\nconst defaultProps = {\n  fieldsOrder: ['day', 'month', 'year'] as ('day' | 'month' | 'year')[],\n  dateSeparator: '/',\n  timeSeparator: ':',\n  format: '24h' as const,\n  amPmLabels: { am: 'AM', pm: 'PM' },\n  withDropdown: true,\n  hoursStep: 1,\n  minutesStep: 1,\n  secondsStep: 1,\n  dayPlaceholder: '--',\n  monthPlaceholder: '--',\n  yearPlaceholder: '----',\n  hoursPlaceholder: '--',\n  minutesPlaceholder: '--',\n  secondsPlaceholder: '--',\n  dayInputLabel: 'Day',\n  monthInputLabel: 'Month',\n  yearInputLabel: 'Year',\n  hoursInputLabel: 'Hours',\n  minutesInputLabel: 'Minutes',\n  secondsInputLabel: 'Seconds',\n  amPmInputLabel: 'AM/PM',\n} satisfies Partial<MaskedDateInputProps>;\n\nexport const MaskedDateInput = factory<MaskedDateInputFactory>((_props) => {\n  const props = useProps('MaskedDateInput', defaultProps, _props);\n  const {\n    classNames,\n    className,\n    style,\n    styles,\n    unstyled,\n    vars,\n    onClick,\n    value,\n    defaultValue,\n    onChange,\n    fieldsOrder,\n    dateSeparator,\n    timeSeparator,\n    withTime,\n    withSeconds,\n    format: _format,\n    amPmLabels,\n    hoursStep,\n    minutesStep,\n    secondsStep,\n    withDropdown,\n    popoverProps,\n    clearable,\n    clearSectionMode,\n    allowDeselect,\n    readOnly,\n    disabled,\n    name,\n    form,\n    dayInputLabel,\n    monthInputLabel,\n    yearInputLabel,\n    hoursInputLabel,\n    minutesInputLabel,\n    secondsInputLabel,\n    amPmInputLabel,\n    dayInputProps,\n    monthInputProps,\n    yearInputProps,\n    hoursInputProps,\n    minutesInputProps,\n    secondsInputProps,\n    amPmSelectProps,\n    clearButtonProps,\n    hiddenInputProps,\n    dayPlaceholder,\n    monthPlaceholder,\n    yearPlaceholder,\n    hoursPlaceholder,\n    minutesPlaceholder,\n    secondsPlaceholder,\n    dayRef,\n    monthRef,\n    yearRef,\n    hoursRef,\n    minutesRef,\n    secondsRef,\n    amPmRef,\n    onFocus,\n    onBlur,\n    onMouseDown,\n    onFocusCapture,\n    onBlurCapture,\n    rightSection,\n    size,\n    label,\n    labelProps,\n    pasteSplit,\n    locale,\n    attributes,\n    getDayProps,\n    getMonthControlProps,\n    getYearControlProps,\n    ref,\n    ...others\n  } = props;\n\n  const format = _format!;\n  const _allowDeselect = allowDeselect !== undefined ? allowDeselect : clearable;\n  const ctx = useDatesContext();\n\n  const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<MaskedDateInputFactory>({\n    classNames,\n    styles,\n    props,\n  });\n\n  const getStyles = useStyles<MaskedDateInputFactory>({\n    name: 'MaskedDateInput',\n    classes,\n    props,\n    className,\n    style,\n    classNames,\n    styles,\n    unstyled,\n    attributes,\n    vars,\n  });\n\n  const { calendarProps, others: restProps } = pickCalendarProps(others);\n\n  const controller = useMaskedDateInput({\n    value,\n    defaultValue,\n    onChange,\n    withTime,\n    withSeconds,\n    format,\n    amPmLabels: amPmLabels!,\n    clearable,\n    readOnly,\n    disabled,\n    fieldsOrder: fieldsOrder!,\n    pasteSplit,\n    minDate: calendarProps.minDate ? dayjs(calendarProps.minDate).format('YYYY-MM-DD') : undefined,\n    maxDate: calendarProps.maxDate ? dayjs(calendarProps.maxDate).format('YYYY-MM-DD') : undefined,\n  });\n\n  const _dayRef = useMergedRef(controller.refs.day, dayRef);\n  const _monthRef = useMergedRef(controller.refs.month, monthRef);\n  const _yearRef = useMergedRef(controller.refs.year, yearRef);\n  const _hoursRef = useMergedRef(controller.refs.hours, hoursRef);\n  const _minutesRef = useMergedRef(controller.refs.minutes, minutesRef);\n  const _secondsRef = useMergedRef(controller.refs.seconds, secondsRef);\n  const _amPmRef = useMergedRef(controller.refs.amPm, amPmRef);\n\n  const dayInputId = useId();\n  const labelId = `${dayInputId}-label`;\n  const hasFocusRef = useRef(false);\n  const [dropdownOpened, setDropdownOpened] = useState(false);\n\n  const [wrapperNode, setWrapperNode] = useState<HTMLDivElement | null>(null);\n  const [dropdownNode, setDropdownNode] = useState<HTMLDivElement | null>(null);\n  const _wrapperRef = useMergedRef(setWrapperNode, ref);\n\n  useClickOutside(() => setDropdownOpened(false), undefined, [wrapperNode, dropdownNode]);\n\n  const handleFocus = (event: React.FocusEvent<any>) => {\n    if (!hasFocusRef.current) {\n      hasFocusRef.current = true;\n      onFocus?.(event);\n    }\n  };\n\n  const handleBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n    if (!event.currentTarget.contains(event.relatedTarget)) {\n      hasFocusRef.current = false;\n      controller.clampToRange();\n      onBlur?.(event);\n    }\n  };\n\n  const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n    if (event.key === 'Escape') {\n      setDropdownOpened(false);\n    }\n  };\n\n  const fieldsSequence: string[] = [...fieldsOrder!];\n  if (withTime) {\n    fieldsSequence.push('hours', 'minutes');\n    if (withSeconds) {\n      fieldsSequence.push('seconds');\n    }\n    if (format === '12h') {\n      fieldsSequence.push('amPm');\n    }\n  }\n\n  const getNextField = (field: string) => {\n    const idx = fieldsSequence.indexOf(field);\n    return idx < fieldsSequence.length - 1 ? fieldsSequence[idx + 1] : undefined;\n  };\n\n  const getPrevField = (field: string) => {\n    const idx = fieldsSequence.indexOf(field);\n    return idx > 0 ? fieldsSequence[idx - 1] : undefined;\n  };\n\n  const focusNext = (field: string) => {\n    const next = getNextField(field);\n    if (next) {\n      controller.focus(next as any);\n    }\n  };\n\n  const focusPrev = (field: string) => {\n    const prev = getPrevField(field);\n    if (prev) {\n      controller.focus(prev as any);\n    }\n  };\n\n  const yearComplete = controller.values.year !== null && controller.values.year >= 1000;\n\n  const currentDateValue =\n    controller.values.day !== null && controller.values.month !== null && yearComplete\n      ? `${String(controller.values.year).padStart(4, '0')}-${String(controller.values.month).padStart(2, '0')}-${String(controller.values.day).padStart(2, '0')}`\n      : null;\n\n  const [calendarDate, setCalendarDate] = useUncontrolledDates({\n    type: 'default',\n    value: calendarProps.date,\n    defaultValue: currentDateValue || calendarProps.defaultDate,\n    onChange: calendarProps.onDateChange as any,\n  });\n\n  useDidUpdate(() => {\n    if (currentDateValue !== null) {\n      setCalendarDate(currentDateValue);\n    }\n  }, [currentDateValue]);\n\n  const _getDayProps = (day: DateStringValue) => ({\n    ...getDayProps?.(day),\n    selected: currentDateValue !== null && dayjs(currentDateValue).isSame(day, 'day'),\n    onClick: (event: any) => {\n      getDayProps?.(day)?.onClick?.(event);\n      if (\n        _allowDeselect &&\n        currentDateValue !== null &&\n        dayjs(currentDateValue).isSame(day, 'day')\n      ) {\n        controller.clear();\n      } else {\n        controller.setFromDateString(day);\n      }\n      setDropdownOpened(false);\n    },\n  });\n\n  const dayMax = getDaysInMonth(\n    controller.values.month,\n    yearComplete ? controller.values.year : null\n  );\n\n  const dateFields: Record<string, React.ReactNode> = {\n    day: (\n      <SpinInput\n        key=\"day\"\n        id={fieldsOrder![0] === 'day' ? dayInputId : undefined}\n        {...dayInputProps}\n        {...getStyles('field', {\n          className: dayInputProps?.className,\n          style: dayInputProps?.style,\n        })}\n        value={controller.values.day}\n        onChange={controller.setDay}\n        min={1}\n        max={dayMax}\n        focusable={fieldsOrder![0] === 'day'}\n        step={1}\n        ref={_dayRef}\n        aria-label={dayInputLabel}\n        tabIndex={fieldsOrder![0] === 'day' ? undefined : -1}\n        readOnly={readOnly}\n        disabled={disabled}\n        onPaste={controller.onPaste}\n        placeholder={dayPlaceholder}\n        allowTemporaryZero\n        onNextInput={() => focusNext('day')}\n        onPreviousInput={() => focusPrev('day')}\n        onFocus={(event) => {\n          handleFocus(event);\n          dayInputProps?.onFocus?.(event);\n        }}\n      />\n    ),\n    month: (\n      <SpinInput\n        key=\"month\"\n        id={fieldsOrder![0] === 'month' ? dayInputId : undefined}\n        {...monthInputProps}\n        {...getStyles('field', {\n          className: monthInputProps?.className,\n          style: monthInputProps?.style,\n        })}\n        value={controller.values.month}\n        onChange={controller.setMonth}\n        min={1}\n        max={12}\n        focusable={fieldsOrder![0] === 'month'}\n        step={1}\n        ref={_monthRef}\n        aria-label={monthInputLabel}\n        tabIndex={fieldsOrder![0] === 'month' ? undefined : -1}\n        readOnly={readOnly}\n        disabled={disabled}\n        onPaste={controller.onPaste}\n        placeholder={monthPlaceholder}\n        allowTemporaryZero\n        onNextInput={() => focusNext('month')}\n        onPreviousInput={() => focusPrev('month')}\n        onFocus={(event) => {\n          handleFocus(event);\n          monthInputProps?.onFocus?.(event);\n        }}\n      />\n    ),\n    year: (\n      <SpinInput\n        key=\"year\"\n        id={fieldsOrder![0] === 'year' ? dayInputId : undefined}\n        {...yearInputProps}\n        {...getStyles('field', {\n          className: yearInputProps?.className,\n          style: { width: 'calc(4ch + 0.3em)', ...yearInputProps?.style },\n        })}\n        value={controller.values.year}\n        onChange={controller.setYear}\n        min={1}\n        max={9999}\n        focusable={fieldsOrder![0] === 'year'}\n        step={1}\n        ref={_yearRef}\n        aria-label={yearInputLabel}\n        tabIndex={fieldsOrder![0] === 'year' ? undefined : -1}\n        readOnly={readOnly}\n        disabled={disabled}\n        onPaste={controller.onPaste}\n        placeholder={yearPlaceholder}\n        disableAutoAdvance\n        maxDigits={4}\n        padValue={String}\n        onNextInput={() => focusNext('year')}\n        onPreviousInput={() => focusPrev('year')}\n        onFocus={(event) => {\n          handleFocus(event);\n          yearInputProps?.onFocus?.(event);\n        }}\n      />\n    ),\n  };\n\n  return (\n    <Popover\n      opened={dropdownOpened}\n      trapFocus={false}\n      position=\"bottom-start\"\n      disabled={disabled || readOnly || !withDropdown}\n      withRoles={false}\n      unstyled={unstyled}\n      {...popoverProps}\n    >\n      <Popover.Target>\n        <InputBase\n          component=\"div\"\n          ref={_wrapperRef}\n          size={size}\n          disabled={disabled}\n          onClick={(event) => {\n            onClick?.(event);\n            controller.focus(fieldsOrder![0] as any);\n          }}\n          onMouseDown={(event) => {\n            event.preventDefault();\n            onMouseDown?.(event);\n          }}\n          onFocusCapture={(event) => {\n            setDropdownOpened(true);\n            onFocusCapture?.(event);\n          }}\n          onBlurCapture={(event) => {\n            setDropdownOpened(false);\n            onBlurCapture?.(event);\n          }}\n          rightSection={rightSection}\n          __clearSection={\n            <CloseButton\n              {...clearButtonProps}\n              size={size}\n              onClick={(event) => {\n                controller.clear();\n                clearButtonProps?.onClick?.(event);\n              }}\n              onMouseDown={(event) => {\n                event.preventDefault();\n                clearButtonProps?.onMouseDown?.(event);\n              }}\n            />\n          }\n          __clearable={controller.isClearable}\n          __clearSectionMode={clearSectionMode}\n          label={label}\n          labelProps={{ htmlFor: dayInputId, id: labelId, ...labelProps }}\n          style={style}\n          className={className}\n          classNames={resolvedClassNames}\n          styles={resolvedStyles}\n          attributes={attributes}\n          __staticSelector=\"MaskedDateInput\"\n          {...restProps}\n        >\n          <div {...getStyles('fieldsRoot')} dir=\"ltr\">\n            <TimePickerProvider\n              value={{\n                getStyles: getStyles as any,\n                maxDropdownContentHeight: 0,\n                scrollAreaProps: undefined,\n              }}\n            >\n              <div\n                {...getStyles('fieldsGroup')}\n                role=\"group\"\n                aria-labelledby={label ? labelProps?.id || labelId : undefined}\n                onBlur={handleBlur}\n                onKeyDown={handleKeyDown}\n                onClickCapture={() => setDropdownOpened(true)}\n              >\n                {fieldsOrder!.map((field, index) => (\n                  <Fragment key={field}>\n                    {index > 0 && <span {...getStyles('dateSeparator')}>{dateSeparator}</span>}\n                    {dateFields[field]}\n                  </Fragment>\n                ))}\n\n                {withTime && (\n                  <>\n                    <span {...getStyles('dateSeparator')}>{'\\u00A0'}</span>\n                    <SpinInput\n                      {...hoursInputProps}\n                      {...getStyles('field', {\n                        className: hoursInputProps?.className,\n                        style: hoursInputProps?.style,\n                      })}\n                      value={controller.values.hours}\n                      onChange={controller.setHours}\n                      min={format === '12h' ? 1 : 0}\n                      max={format === '12h' ? 12 : 23}\n                      allowTemporaryZero={format === '12h'}\n                      focusable={false}\n                      step={hoursStep}\n                      ref={_hoursRef}\n                      aria-label={hoursInputLabel}\n                      tabIndex={-1}\n                      readOnly={readOnly}\n                      disabled={disabled}\n                      onPaste={controller.onPaste}\n                      placeholder={hoursPlaceholder}\n                      onNextInput={() => focusNext('hours')}\n                      onPreviousInput={() => focusPrev('hours')}\n                      onFocus={(event) => {\n                        handleFocus(event);\n                        hoursInputProps?.onFocus?.(event);\n                      }}\n                    />\n                    <span {...getStyles('timeSeparator')}>{timeSeparator}</span>\n                    <SpinInput\n                      {...minutesInputProps}\n                      {...getStyles('field', {\n                        className: minutesInputProps?.className,\n                        style: minutesInputProps?.style,\n                      })}\n                      value={controller.values.minutes}\n                      onChange={controller.setMinutes}\n                      min={0}\n                      max={59}\n                      focusable={false}\n                      step={minutesStep}\n                      ref={_minutesRef}\n                      aria-label={minutesInputLabel}\n                      tabIndex={-1}\n                      readOnly={readOnly}\n                      disabled={disabled}\n                      onPaste={controller.onPaste}\n                      placeholder={minutesPlaceholder}\n                      onNextInput={() => focusNext('minutes')}\n                      onPreviousInput={() => focusPrev('minutes')}\n                      onFocus={(event) => {\n                        handleFocus(event);\n                        minutesInputProps?.onFocus?.(event);\n                      }}\n                    />\n\n                    {withSeconds && (\n                      <>\n                        <span {...getStyles('timeSeparator')}>{timeSeparator}</span>\n                        <SpinInput\n                          {...secondsInputProps}\n                          {...getStyles('field', {\n                            className: secondsInputProps?.className,\n                            style: secondsInputProps?.style,\n                          })}\n                          value={controller.values.seconds}\n                          onChange={controller.setSeconds}\n                          min={0}\n                          max={59}\n                          focusable={false}\n                          step={secondsStep}\n                          ref={_secondsRef}\n                          aria-label={secondsInputLabel}\n                          tabIndex={-1}\n                          readOnly={readOnly}\n                          disabled={disabled}\n                          onPaste={controller.onPaste}\n                          placeholder={secondsPlaceholder}\n                          onNextInput={() => focusNext('seconds')}\n                          onPreviousInput={() => focusPrev('seconds')}\n                          onFocus={(event) => {\n                            handleFocus(event);\n                            secondsInputProps?.onFocus?.(event);\n                          }}\n                        />\n                      </>\n                    )}\n\n                    {format === '12h' && (\n                      <AmPmInput\n                        {...amPmSelectProps}\n                        inputType=\"select\"\n                        labels={amPmLabels}\n                        value={controller.values.amPm}\n                        onChange={controller.setAmPm}\n                        ref={_amPmRef}\n                        aria-label={amPmInputLabel}\n                        onPreviousInput={() => focusPrev('amPm')}\n                        readOnly={readOnly}\n                        disabled={disabled}\n                        tabIndex={-1}\n                        onPaste={controller.onPaste}\n                        onFocus={(event) => {\n                          handleFocus(event);\n                          amPmSelectProps?.onFocus?.(event);\n                        }}\n                      />\n                    )}\n                  </>\n                )}\n              </div>\n            </TimePickerProvider>\n          </div>\n\n          <input\n            type=\"hidden\"\n            name={name}\n            form={form}\n            value={controller.hiddenInputValue}\n            {...hiddenInputProps}\n          />\n        </InputBase>\n      </Popover.Target>\n      <Popover.Dropdown\n        {...getStyles('dropdown')}\n        onMouseDown={(event) => event.preventDefault()}\n        ref={setDropdownNode}\n      >\n        <Calendar\n          __staticSelector=\"MaskedDateInput\"\n          __preventFocus\n          {...calendarProps}\n          classNames={classNames as any}\n          styles={styles as any}\n          unstyled={unstyled}\n          minDate={calendarProps.minDate}\n          maxDate={calendarProps.maxDate}\n          locale={calendarProps.locale || ctx.getLocale(locale)}\n          getDayProps={_getDayProps}\n          size={size as MantineSize}\n          date={calendarDate || undefined}\n          onDateChange={setCalendarDate}\n          getMonthControlProps={(date) => ({\n            selected: currentDateValue !== null ? isSameMonth(date, currentDateValue) : false,\n            ...getMonthControlProps?.(date),\n          })}\n          getYearControlProps={(date) => ({\n            selected:\n              currentDateValue !== null ? dayjs(date).isSame(currentDateValue, 'year') : false,\n            ...getYearControlProps?.(date),\n          })}\n          attributes={attributes}\n        />\n      </Popover.Dropdown>\n    </Popover>\n  );\n});\n\nMaskedDateInput.displayName = '@mantine/dates/MaskedDateInput';\nMaskedDateInput.classes = { ...Input.classes, ...Calendar.classes, ...classes };\n\nexport namespace MaskedDateInput {\n  export type Props = MaskedDateInputProps;\n  export type StylesNames = MaskedDateInputStylesNames;\n  export type Factory = MaskedDateInputFactory;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6OA,MAAM,eAAe;CACnB,aAAa;EAAC;EAAO;EAAS;CAAM;CACpC,eAAe;CACf,eAAe;CACf,QAAQ;CACR,YAAY;EAAE,IAAI;EAAM,IAAI;CAAK;CACjC,cAAc;CACd,WAAW;CACX,aAAa;CACb,aAAa;CACb,gBAAgB;CAChB,kBAAkB;CAClB,iBAAiB;CACjB,kBAAkB;CAClB,oBAAoB;CACpB,oBAAoB;CACpB,eAAe;CACf,iBAAiB;CACjB,gBAAgB;CAChB,iBAAiB;CACjB,mBAAmB;CACnB,mBAAmB;CACnB,gBAAgB;AAClB;AAEA,MAAa,kBAAkB,SAAiC,WAAW;CACzE,MAAM,QAAQ,SAAS,mBAAmB,cAAc,MAAM;CAC9D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,SACA,OACA,cACA,UACA,aACA,eACA,eACA,UACA,aACA,QAAQ,SACR,YACA,WACA,aACA,aACA,cACA,cACA,WACA,kBACA,eACA,UACA,UACA,MACA,MACA,eACA,iBACA,gBACA,iBACA,mBACA,mBACA,gBACA,eACA,iBACA,gBACA,iBACA,mBACA,mBACA,iBACA,kBACA,kBACA,gBACA,kBACA,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