{"version":3,"file":"TimePicker.mjs","names":["size","sizeMiddleware"],"sources":["../../../src/time-picker/TimePicker.tsx"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n  autoUpdate,\n  type Boundary,\n  flip,\n  FloatingFocusManager,\n  FloatingPortal,\n  offset,\n  shift,\n  size as sizeMiddleware,\n  useDismiss,\n  useFloating,\n  useInteractions,\n  useMergeRefs,\n  useTransitionStyles,\n} from '@floating-ui/react';\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport {\n  useCallback,\n  useEffect,\n  useId,\n  useImperativeHandle,\n  useMemo,\n  useRef,\n  useState,\n} from 'react';\n\nimport {\n  FormFieldLabel,\n  FormFieldMessage,\n  useFormField,\n} from '../_common/form-control';\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { ClockIconOutline } from '../icons/generated/heroIcons/ClockIconOutline';\nimport { useNeedleTheme } from '../theme';\nimport { generateTimeOptions } from './generate-time-options';\nimport { NeedleTime } from './needle-time';\nimport {\n  useKeyboardNavigation,\n  useTimePickerPopover,\n} from './time-picker-hooks';\n\nexport type TimeFormat = 'hh:mm' | 'hh:mm aa' | 'hh:mm:ss' | 'hh:mm:ss aa';\n\n/** Fixed input width per format (only used when the picker is not fluid). */\nconst INPUT_WIDTH_BY_FORMAT: Record<TimeFormat, string> = {\n  'hh:mm': '6rem',\n  'hh:mm aa': '9rem',\n  'hh:mm:ss': '7.5rem',\n  'hh:mm:ss aa': '11rem',\n};\n\nexport type TimePickerProps = {\n  /** The value of the time picker */\n  value?: NeedleTime;\n  /** The format of the time picker */\n  format?: TimeFormat;\n  /** Whether the time picker is fluid */\n  isFluid?: boolean;\n  /** Whether the time picker is read only */\n  isReadOnly?: boolean;\n  /** Whether the time picker is required */\n  isRequired?: boolean;\n  /** Whether the time picker is disabled */\n  isDisabled?: boolean;\n  /** The time interval of the time picker, in minutes */\n  timeInterval?: number;\n  /** The label of the time picker */\n  label?: string;\n  /** The size of the time picker */\n  size?: 'small' | 'medium' | 'large';\n  /** Assistive text displayed below the input. Replaced by `errorText` or an internal validation error while there is one */\n  helpText?: React.ReactNode;\n  /** Manually set the error text */\n  errorText?: string;\n  /** Callback function triggered when the time picker value changes */\n  onChange?: (time: NeedleTime) => void;\n  /** Callback function triggered when the time picker encounters an error */\n  onError?: (error: string, time: NeedleTime) => void;\n  /**\n   * Strategy for the dropdown floating element.\n   * By default it is absolute, but if the component is inside of a needle Dialog, it is set to fixed.\n   * If this prop is set, no auto-detection of Dialog is done.\n   */\n  floatingStrategy?: 'absolute' | 'fixed';\n  /** Whether the dropdown element is rendered in a portal. */\n  isPortaled?: boolean;\n};\n\nexport const TimePicker = <T extends React.ElementType = 'div'>({\n  format = 'hh:mm',\n  isDisabled,\n  isFluid,\n  isReadOnly,\n  isRequired,\n  value,\n  timeInterval = 15,\n  label,\n  onChange,\n  className,\n  onError,\n  style,\n  size = 'medium',\n  helpText,\n  errorText,\n  htmlAttributes,\n  floatingStrategy,\n  isPortaled: isPortaledProp,\n  ref,\n  ...restProps\n}: PolymorphicCommonProps<T, TimePickerProps>) => {\n  const [editedInput, setEditedInput] = useState<NeedleTime | undefined>(value);\n\n  const is24Hour = !format.includes('aa');\n  const hasSeconds = format.includes('ss');\n  const [inputValue, setInputValue] = useState<string>(\n    value?.toString(is24Hour, hasSeconds) ?? '',\n  );\n  const listRef = useRef<HTMLUListElement>(null);\n  const inputRef = useRef<HTMLInputElement>(null);\n  useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);\n  const [lastAction, setLastAction] = useState<'type' | 'arrow'>('type');\n  const [error, setError] = useState<string | undefined>(undefined);\n  const listboxId = useId();\n\n  const timeOptions = useMemo(\n    () => generateTimeOptions(is24Hour, timeInterval, hasSeconds),\n    [is24Hour, timeInterval, hasSeconds],\n  );\n\n  const { themeClassName } = useNeedleTheme();\n  const { isPopoverOpen, setIsPopoverOpen } = useTimePickerPopover(false);\n  const { focusedIndex, setFocusedIndex, handleArrowNavigation } =\n    useKeyboardNavigation(listRef, timeOptions.length);\n\n  const errorToShow =\n    errorText !== undefined && errorText !== '' ? errorText : error;\n  // The shared form field resolves the ids and which message is displayed -\n  // an error, set manually or by internal validation, replaces the help text.\n  const { field, controlProps } = useFormField({\n    errorText: errorToShow,\n    helpText,\n    isRequired,\n    label,\n  });\n\n  const classes = {\n    'ndl-disabled': isDisabled,\n    'ndl-error': errorToShow !== undefined,\n    'ndl-fluid': isFluid,\n    'ndl-large': size === 'large',\n    'ndl-medium': size === 'medium',\n    'ndl-read-only': isReadOnly,\n    'ndl-small': size === 'small',\n  };\n\n  const inputWidth = isFluid === true ? '100%' : INPUT_WIDTH_BY_FORMAT[format];\n\n  const isValidTime = useCallback(\n    (hours: number, minutes: number, seconds: number) => {\n      if (hours > 23 || hours < 0) {\n        return false;\n      }\n\n      if (minutes > 59 || minutes < 0) {\n        return false;\n      }\n\n      if (seconds > 59 || seconds < 0) {\n        return false;\n      }\n\n      return true;\n    },\n    [],\n  );\n\n  useEffect(() => {\n    if (error !== undefined) {\n      onError?.(error, NeedleTime.fromString(inputValue));\n    }\n  }, [error, inputValue, onError]);\n\n  useEffect(() => {\n    setEditedInput(value);\n    setInputValue(value?.toString(is24Hour, hasSeconds) ?? '');\n  }, [is24Hour, hasSeconds, value]);\n\n  useEffect(() => {\n    if (isPopoverOpen) {\n      setTimeout(() => {\n        listRef.current?.children[focusedIndex]?.scrollIntoView({\n          block: 'center',\n          inline: 'nearest',\n        });\n      }, 0);\n    } else {\n      setTimeout(() => {\n        const selectedIndex =\n          timeOptions.indexOf(value?.toString(is24Hour, hasSeconds) ?? '') ?? 0;\n        setFocusedIndex(selectedIndex);\n      }, 0);\n    }\n  }, [\n    focusedIndex,\n    is24Hour,\n    hasSeconds,\n    isPopoverOpen,\n    value,\n    setFocusedIndex,\n    timeOptions,\n  ]);\n\n  const handleOnClick = (timeText: string) => {\n    if (onChange) {\n      onChange(NeedleTime.fromString(timeText));\n    }\n    setError(undefined);\n    setInputValue(timeText);\n    setEditedInput(NeedleTime.fromString(timeText));\n    setIsPopoverOpen(false);\n  };\n  const newHandleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n    scrollToTime(event.target.value);\n    setInputValue(event.target.value);\n    setLastAction('type');\n\n    const time = NeedleTime.fromString(event.target.value);\n    if (!isValidTime(time.hour, time.minute, time.second)) {\n      setError('Invalid time');\n    } else {\n      setError(undefined);\n    }\n  };\n\n  const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n    if (isReadOnly === true || isDisabled === true) {\n      event.preventDefault();\n      return;\n    }\n\n    if (event.key === 'Escape') {\n      setIsPopoverOpen(false);\n    }\n\n    setIsPopoverOpen(true);\n\n    if (event.key === 'Enter') {\n      const minTypedLength = (is24Hour ? 5 : 6) + (hasSeconds ? 3 : 0);\n      if (lastAction === 'type' && inputValue.length >= minTypedLength) {\n        const time = NeedleTime.fromString(inputValue);\n        handleOnClick(time.toString(is24Hour, hasSeconds));\n      } else if (lastAction === 'type' && !inputValue.includes(':')) {\n        const time = NeedleTime.fromString(inputValue);\n        if (isValidTime(time.hour, time.minute, time.second)) {\n          handleOnClick(time.toString(is24Hour, hasSeconds));\n        }\n        setIsPopoverOpen(false);\n      } else {\n        handleOnClick(timeOptions[focusedIndex]);\n      }\n    } else if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n      event.preventDefault();\n      setLastAction('arrow');\n      handleArrowNavigation(event.key);\n    }\n  };\n\n  const scrollToTime = (startOfTime: string) => {\n    const parsedTime = startOfTime.toLowerCase().replace(/[^0-9amp]/g, '');\n    let index = -1;\n\n    // Handle AM/PM input\n    const isPM = parsedTime.includes('p');\n    const isAM = parsedTime.includes('a');\n    const timeDigits = parsedTime.replace(/[amp]/g, '');\n\n    if (timeDigits.length === 1) {\n      // Single digit - assume it's an hour\n      const hour = `0${timeDigits}`;\n      const minutes = hasSeconds ? '00:00' : '00';\n      const searchTime = is24Hour\n        ? `${hour}:${minutes}`\n        : `${hour}:${minutes} ${isPM ? 'PM' : 'AM'}`;\n      index = timeOptions.indexOf(searchTime);\n    } else {\n      // Find closest matching time\n      const closestTime = timeOptions.find((time) => {\n        const timeWithoutSpecialChars = time\n          .toLowerCase()\n          .replace(/[^0-9amp]/g, '');\n        if (isPM || isAM) {\n          // If AM/PM specified, match that specifically\n          return timeWithoutSpecialChars.startsWith(parsedTime);\n        } else {\n          // Otherwise just match the numbers\n          return timeWithoutSpecialChars\n            .replace(/[amp]/g, '')\n            .startsWith(timeDigits);\n        }\n      });\n      index = closestTime !== undefined ? timeOptions.indexOf(closestTime) : -1;\n    }\n\n    if (index !== -1) {\n      setFocusedIndex(index);\n    }\n\n    return index;\n  };\n\n  /** Custom floating ui solution */\n  const isInsideDialog = useIsInsideDialog();\n  const isPortaled = isPortaledProp ?? !isInsideDialog;\n  // Inside a Dialog the popover is fixed and not portaled. A transformed\n  // ancestor (e.g. Popover) can make Floating UI under-measure available\n  // space, so use the viewport as the boundary instead.\n  const floatingBoundary: Boundary = isInsideDialog ? [] : 'clippingAncestors';\n  const containerRef = useRef<HTMLDivElement>(null);\n  const { refs, floatingStyles, context } = useFloating({\n    elements: {\n      reference: containerRef.current,\n    },\n    middleware: [\n      offset(10),\n      flip({\n        fallbackPlacements: ['top'],\n        fallbackStrategy: 'bestFit',\n      }),\n      shift({ boundary: floatingBoundary, padding: 5 }),\n      sizeMiddleware({\n        apply({ availableHeight, elements }) {\n          Object.assign(elements.floating.style, {\n            maxHeight: `${availableHeight}px`,\n          });\n        },\n        boundary: floatingBoundary,\n        padding: 5,\n      }),\n    ],\n    onOpenChange: (open) => {\n      setIsPopoverOpen(open);\n    },\n    open: isDisabled !== true && isReadOnly !== true && isPopoverOpen,\n    placement: 'bottom',\n    strategy: floatingStrategy ?? (isInsideDialog ? 'fixed' : 'absolute'),\n    whileElementsMounted: autoUpdate,\n  });\n  const dismiss = useDismiss(context);\n  const { getReferenceProps, getFloatingProps } = useInteractions([dismiss]);\n  const { styles: transitionStyles } = useTransitionStyles(context, {\n    duration: Number.parseInt(tokens.motion.duration.quick) ?? 0,\n  });\n\n  const mergedRef = useMergeRefs([refs.setReference, containerRef]);\n\n  return (\n    <>\n      <div\n        className={classNames('ndl-time-picker', className, {\n          ...classes,\n        })}\n        ref={mergedRef}\n        {...getReferenceProps()}\n        style={{\n          width: isFluid === true ? '100%' : 'fit-content',\n        }}\n      >\n        <label className=\"ndl-time-picker-label\">\n          {label !== undefined && (\n            <FormFieldLabel field={field} size={size} association=\"implicit\" />\n          )}\n          <div\n            className=\"ndl-time-picker-input-wrapper\"\n            style={{\n              width: inputWidth,\n              ...style,\n            }}\n          >\n            <input\n              role=\"combobox\"\n              aria-expanded={isPopoverOpen}\n              aria-controls={listboxId}\n              aria-activedescendant={\n                isPopoverOpen && focusedIndex >= 0\n                  ? `${listboxId}-option-${focusedIndex}`\n                  : undefined\n              }\n              aria-label={label} // TODO: handle label natively\n              {...controlProps}\n              className=\"ndl-time-picker-input\"\n              type=\"text\"\n              ref={inputRef}\n              value={inputValue}\n              disabled={isDisabled}\n              readOnly={isReadOnly}\n              required={isRequired}\n              onChange={newHandleInputChange}\n              onKeyDown={handleKeyDown}\n              onClick={() => {\n                if (isReadOnly === true || isDisabled === true) {\n                  return;\n                }\n                setIsPopoverOpen(true);\n              }}\n              onBlur={(event) => {\n                if (isReadOnly === true || isDisabled === true) {\n                  return;\n                }\n\n                if (\n                  event.relatedTarget?.classList.contains(\n                    'ndl-time-picker-popover-item',\n                  ) === true\n                ) {\n                  return;\n                }\n\n                if (inputValue.length < 4) {\n                  setError('Invalid time');\n                  return;\n                }\n\n                const time = NeedleTime.fromString(inputValue);\n\n                if (time === undefined || time === null) {\n                  setError('Invalid time');\n                  return;\n                }\n\n                if (!isValidTime(time.hour, time.minute, time.second)) {\n                  setError('Invalid time');\n                } else {\n                  setError(undefined);\n                  setInputValue(time.toString(is24Hour, hasSeconds));\n                  setEditedInput(time);\n                  onChange?.(time);\n                }\n              }}\n              placeholder={format}\n              // The typed value can never be longer than the format pattern.\n              maxLength={format.length}\n              {...restProps}\n              {...htmlAttributes}\n            />\n            <ClockIconOutline className=\"ndl-icon-svg ndl-time-picker-icon\" />\n          </div>\n        </label>\n        <FormFieldMessage field={field} size={size} />\n      </div>\n\n      {context.open && (\n        <ConditionalWrap\n          shouldWrap={isPortaled}\n          wrap={(wrapChildren) => (\n            <FloatingPortal>{wrapChildren}</FloatingPortal>\n          )}\n        >\n          <FloatingFocusManager\n            context={context}\n            modal={false}\n            initialFocus={-1}\n          >\n            <div\n              ref={refs.setFloating}\n              className={classNames(themeClassName, 'ndl-time-picker-popover', {\n                ...classes,\n              })}\n              style={{\n                ...transitionStyles,\n                ...floatingStyles,\n                width:\n                  isFluid === true\n                    ? containerRef.current?.clientWidth\n                    : undefined,\n              }}\n              {...getFloatingProps()}\n            >\n              <ul ref={listRef} role=\"listbox\" id={listboxId} tabIndex={-1}>\n                {timeOptions.map((time, index) => (\n                  <li\n                    id={`${listboxId}-option-${index}`}\n                    key={index}\n                    role=\"option\"\n                    aria-selected={\n                      value?.toString(is24Hour, hasSeconds) === time ||\n                      editedInput?.toString(is24Hour, hasSeconds) === time\n                    }\n                    value={time}\n                    onClick={(event) => {\n                      event.stopPropagation();\n                      event.preventDefault();\n                      handleOnClick(time);\n                      setIsPopoverOpen(false);\n                    }}\n                    onMouseDown={(event) => {\n                      event.stopPropagation();\n                      event.preventDefault();\n                    }}\n                    tabIndex={-1}\n                    className={classNames(\n                      focusedIndex === index ? 'focused' : '',\n                      'ndl-time-picker-popover-item',\n                    )}\n                    onKeyDown={(event) => {\n                      if (event.key === 'Enter') {\n                        event.stopPropagation();\n                        handleOnClick(time);\n                      }\n                    }}\n                  >\n                    {time}\n                  </li>\n                ))}\n              </ul>\n            </div>\n          </FloatingFocusManager>\n        </ConditionalWrap>\n      )}\n    </>\n  );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiHE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;AA/DF,MAAM,wBAAoD;CACxD,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,eAAe;AACjB;AAuCA,MAAa,cAAmD,SAqBd;;CArBc,IAAA,EAC9D,SAAS,SACT,YACA,SACA,YACA,YACA,OACA,eAAe,IACf,OACA,UACA,WACA,SACA,OACA,MAAA,SAAO,UACP,UACA,WACA,gBACA,kBACA,YAAY,gBACZ,QAAA,MACG,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,CAAC,aAAa,kBAAkB,SAAiC,KAAK;CAE5E,MAAM,WAAW,CAAC,OAAO,SAAS,IAAI;CACtC,MAAM,aAAa,OAAO,SAAS,IAAI;CACvC,MAAM,CAAC,YAAY,iBAAiB,UAAA,kBAAA,UAAA,QAAA,UAAA,KAAA,IAAA,KAAA,IAClC,MAAO,SAAS,UAAU,UAAU,OAAA,QAAA,oBAAA,KAAA,IAAA,kBAAK,EAC3C;CACA,MAAM,UAAU,OAAyB,IAAI;CAC7C,MAAM,WAAW,OAAyB,IAAI;CAC9C,oBAAoB,WAAW,SAAS,SAA6B,CAAC,CAAC;CACvE,MAAM,CAAC,YAAY,iBAAiB,SAA2B,MAAM;CACrE,MAAM,CAAC,OAA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