@neo4j-ndl/react 4.15.2 → 4.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/lib/cjs/_generated/style-rules/color-utils.js +50 -0
  2. package/lib/cjs/_generated/style-rules/color-utils.js.map +1 -0
  3. package/lib/cjs/_generated/style-rules/date-utils.js +145 -0
  4. package/lib/cjs/_generated/style-rules/date-utils.js.map +1 -0
  5. package/lib/cjs/_generated/style-rules/index.js +38 -0
  6. package/lib/cjs/_generated/style-rules/index.js.map +1 -0
  7. package/lib/cjs/_generated/style-rules/literal-schemas.js +64 -0
  8. package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -0
  9. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +286 -0
  10. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -0
  11. package/lib/cjs/data-grid/stories/index.js +5 -1
  12. package/lib/cjs/data-grid/stories/index.js.map +1 -1
  13. package/lib/cjs/data-grid/style-rules/evaluate.js +13 -17
  14. package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
  15. package/lib/cjs/data-grid/style-rules/index.js +3 -1
  16. package/lib/cjs/data-grid/style-rules/index.js.map +1 -1
  17. package/lib/cjs/data-grid/style-rules/types.js +26 -2
  18. package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
  19. package/lib/cjs/time-picker/TimePicker.js +39 -22
  20. package/lib/cjs/time-picker/TimePicker.js.map +1 -1
  21. package/lib/cjs/time-picker/generate-time-options.js +6 -3
  22. package/lib/cjs/time-picker/generate-time-options.js.map +1 -1
  23. package/lib/cjs/time-picker/needle-time.js +23 -9
  24. package/lib/cjs/time-picker/needle-time.js.map +1 -1
  25. package/lib/cjs/time-picker/stories/index.js +5 -1
  26. package/lib/cjs/time-picker/stories/index.js.map +1 -1
  27. package/lib/cjs/time-picker/stories/time-picker-with-seconds.story.js +32 -0
  28. package/lib/cjs/time-picker/stories/time-picker-with-seconds.story.js.map +1 -0
  29. package/lib/esm/_generated/style-rules/color-utils.js +46 -0
  30. package/lib/esm/_generated/style-rules/color-utils.js.map +1 -0
  31. package/lib/esm/_generated/style-rules/date-utils.js +141 -0
  32. package/lib/esm/_generated/style-rules/date-utils.js.map +1 -0
  33. package/lib/esm/_generated/style-rules/index.js +29 -0
  34. package/lib/esm/_generated/style-rules/index.js.map +1 -0
  35. package/lib/esm/_generated/style-rules/literal-schemas.js +61 -0
  36. package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -0
  37. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +284 -0
  38. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -0
  39. package/lib/esm/data-grid/stories/index.js +3 -0
  40. package/lib/esm/data-grid/stories/index.js.map +1 -1
  41. package/lib/esm/data-grid/style-rules/evaluate.js +7 -11
  42. package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
  43. package/lib/esm/data-grid/style-rules/index.js +1 -1
  44. package/lib/esm/data-grid/style-rules/index.js.map +1 -1
  45. package/lib/esm/data-grid/style-rules/types.js +25 -1
  46. package/lib/esm/data-grid/style-rules/types.js.map +1 -1
  47. package/lib/esm/time-picker/TimePicker.js +39 -22
  48. package/lib/esm/time-picker/TimePicker.js.map +1 -1
  49. package/lib/esm/time-picker/generate-time-options.js +6 -3
  50. package/lib/esm/time-picker/generate-time-options.js.map +1 -1
  51. package/lib/esm/time-picker/needle-time.js +23 -9
  52. package/lib/esm/time-picker/needle-time.js.map +1 -1
  53. package/lib/esm/time-picker/stories/index.js +3 -0
  54. package/lib/esm/time-picker/stories/index.js.map +1 -1
  55. package/lib/esm/time-picker/stories/time-picker-with-seconds.story.js +30 -0
  56. package/lib/esm/time-picker/stories/time-picker-with-seconds.story.js.map +1 -0
  57. package/lib/types/_generated/style-rules/color-utils.d.ts +33 -0
  58. package/lib/types/_generated/style-rules/color-utils.d.ts.map +1 -0
  59. package/lib/types/_generated/style-rules/date-utils.d.ts +54 -0
  60. package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -0
  61. package/lib/types/_generated/style-rules/index.d.ts +25 -0
  62. package/lib/types/_generated/style-rules/index.d.ts.map +1 -0
  63. package/lib/types/_generated/style-rules/literal-schemas.d.ts +53 -0
  64. package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -0
  65. package/lib/types/data-grid/stories/datagrid-rule-based-styling-datetime.story.d.ts +24 -0
  66. package/lib/types/data-grid/stories/datagrid-rule-based-styling-datetime.story.d.ts.map +1 -0
  67. package/lib/types/data-grid/stories/index.d.ts +2 -0
  68. package/lib/types/data-grid/stories/index.d.ts.map +1 -1
  69. package/lib/types/data-grid/style-rules/evaluate.d.ts.map +1 -1
  70. package/lib/types/data-grid/style-rules/index.d.ts +2 -2
  71. package/lib/types/data-grid/style-rules/index.d.ts.map +1 -1
  72. package/lib/types/data-grid/style-rules/types.d.ts +33 -2
  73. package/lib/types/data-grid/style-rules/types.d.ts.map +1 -1
  74. package/lib/types/time-picker/TimePicker.d.ts +1 -1
  75. package/lib/types/time-picker/TimePicker.d.ts.map +1 -1
  76. package/lib/types/time-picker/generate-time-options.d.ts +1 -1
  77. package/lib/types/time-picker/generate-time-options.d.ts.map +1 -1
  78. package/lib/types/time-picker/needle-time.d.ts +4 -2
  79. package/lib/types/time-picker/needle-time.d.ts.map +1 -1
  80. package/lib/types/time-picker/stories/index.d.ts +2 -0
  81. package/lib/types/time-picker/stories/index.d.ts.map +1 -1
  82. package/lib/types/time-picker/stories/time-picker-with-seconds.story.d.ts +24 -0
  83. package/lib/types/time-picker/stories/time-picker-with-seconds.story.d.ts.map +1 -0
  84. package/package.json +6 -4
@@ -1 +1 @@
1
- {"version":3,"file":"TimePicker.js","sourceRoot":"","sources":["../../../src/time-picker/TimePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,E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SAAS,EAAE,UAAU,CACnB,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EACnC,8BAA8B,CAC/B,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;oCACf,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;wCACtB,CAAC,CAAC,eAAe,EAAE,CAAC;wCACpB,aAAa,CAAC,IAAI,CAAC,CAAC;oCACtB,CAAC;gCACH,CAAC,YAEA,IAAI,IA7BA,CAAC,CA8BH,CACN,CAAC,GACC,IACD,GACe,GACP,CACnB,IACA,CACJ,CAAC;AACJ,CAAC,CAAC","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 flip,\n FloatingFocusManager,\n FloatingPortal,\n offset,\n shift,\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 { type PolymorphicCommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { ClockIconOutline, ExclamationCircleIconSolid } from '../icons';\nimport { useNeedleTheme } from '../theme';\nimport { Typography } from '../typography';\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';\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 /** 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 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 === 'hh:mm';\n const [inputValue, setInputValue] = useState<string>(\n value?.toString(is24Hour) ?? '',\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 errorTextId = useId();\n const listboxId = useId();\n\n const timeOptions = useMemo(\n () => generateTimeOptions(is24Hour, timeInterval),\n [is24Hour, timeInterval],\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\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 =\n isFluid === true ? '100%' : is24Hour === true ? '6rem' : '9rem';\n\n const isValidTime = useCallback((hours: number, minutes: number) => {\n if (hours > 23 || hours < 0) {\n return false;\n }\n\n if (minutes > 59 || minutes < 0) {\n return false;\n }\n\n return true;\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) ?? '');\n }, [is24Hour, 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 inputRef.current?.blur();\n const selectedIndex =\n timeOptions.indexOf(value?.toString(is24Hour) ?? '') ?? 0;\n setFocusedIndex(selectedIndex);\n }, 0);\n }\n }, [\n focusedIndex,\n is24Hour,\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 = (e: React.ChangeEvent<HTMLInputElement>) => {\n scrollToTime(e.target.value);\n setInputValue(e.target.value);\n setLastAction('type');\n\n const time = NeedleTime.fromString(e.target.value);\n if (!isValidTime(time.hour, time.minute)) {\n setError('Invalid time');\n } else {\n setError(undefined);\n }\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (isReadOnly === true || isDisabled === true) {\n e.preventDefault();\n return;\n }\n\n if (e.key === 'Escape') {\n setIsPopoverOpen(false);\n }\n\n setIsPopoverOpen(true);\n\n if (e.key === 'Enter') {\n if (lastAction === 'type' && inputValue.length >= (is24Hour ? 5 : 6)) {\n const time = NeedleTime.fromString(inputValue);\n handleOnClick(time.toString(is24Hour));\n } else if (lastAction === 'type' && !inputValue.includes(':')) {\n const time = NeedleTime.fromString(inputValue);\n if (isValidTime(time.hour, time.minute)) {\n handleOnClick(time.toString(is24Hour));\n }\n setIsPopoverOpen(false);\n } else {\n handleOnClick(timeOptions[focusedIndex]);\n }\n } else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n setLastAction('arrow');\n handleArrowNavigation(e.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 searchTime = is24Hour\n ? `${hour}:00`\n : `${hour}:00 ${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 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({ padding: 5 }),\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 <Typography\n variant={size === 'large' ? 'body-large' : 'body-medium'}\n >\n {label}\n </Typography>\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 aria-invalid={Boolean(errorToShow)}\n aria-describedby={errorToShow ? errorTextId : undefined}\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={(e) => {\n if (isReadOnly === true || isDisabled === true) {\n return;\n }\n\n if (\n e.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)) {\n setError('Invalid time');\n } else {\n setError(undefined);\n setInputValue(time.toString(is24Hour));\n }\n }}\n placeholder={format}\n maxLength={is24Hour ? 5 : 8}\n {...restProps}\n {...htmlAttributes}\n />\n <ClockIconOutline className=\"ndl-icon-svg ndl-time-picker-icon\" />\n </div>\n </label>\n {errorToShow !== undefined && (\n <div className=\"ndl-time-picker-error-wrapper\" role=\"status\">\n <ExclamationCircleIconSolid className=\"ndl-time-picker-error-icon\" />\n <Typography\n variant={size === 'large' ? 'body-medium' : 'body-small'}\n className=\"ndl-time-picker-error-text\"\n htmlAttributes={{ id: errorTextId }}\n >\n {errorToShow}\n </Typography>\n </div>\n )}\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, i) => (\n <li\n id={`${listboxId}-option-${i}`}\n key={i}\n role=\"option\"\n aria-selected={\n value?.toString(is24Hour) === time ||\n editedInput?.toString(is24Hour) === time\n }\n value={time}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleOnClick(time);\n setIsPopoverOpen(false);\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n tabIndex={-1}\n className={classNames(\n focusedIndex === i ? 'focused' : '',\n 'ndl-time-picker-popover-item',\n )}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.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"]}
1
+ {"version":3,"file":"TimePicker.js","sourceRoot":"","sources":["../../../src/time-picker/TimePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,oBAAoB,EACpB,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EACL,WAAW,EACX,SAAS,EACT,KAAK,EACL,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,C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,EAAE,CAAC;oCACnB,aAAa,CAAC,IAAI,CAAC,CAAC;oCACpB,gBAAgB,CAAC,KAAK,CAAC,CAAC;gCAC1B,CAAC,EACD,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;oCACjB,CAAC,CAAC,eAAe,EAAE,CAAC;oCACpB,CAAC,CAAC,cAAc,EAAE,CAAC;gCACrB,CAAC,EACD,QAAQ,EAAE,CAAC,CAAC,EACZ,SAAS,EAAE,UAAU,CACnB,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EACnC,8BAA8B,CAC/B,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;oCACf,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;wCACtB,CAAC,CAAC,eAAe,EAAE,CAAC;wCACpB,aAAa,CAAC,IAAI,CAAC,CAAC;oCACtB,CAAC;gCACH,CAAC,YAEA,IAAI,IA7BA,CAAC,CA8BH,CACN,CAAC,GACC,IACD,GACe,GACP,CACnB,IACA,CACJ,CAAC;AACJ,CAAC,CAAC","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 flip,\n FloatingFocusManager,\n FloatingPortal,\n offset,\n shift,\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 { type PolymorphicCommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { ClockIconOutline, ExclamationCircleIconSolid } from '../icons';\nimport { useNeedleTheme } from '../theme';\nimport { Typography } from '../typography';\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 /** 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 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 errorTextId = useId();\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\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 = (e: React.ChangeEvent<HTMLInputElement>) => {\n scrollToTime(e.target.value);\n setInputValue(e.target.value);\n setLastAction('type');\n\n const time = NeedleTime.fromString(e.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 = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (isReadOnly === true || isDisabled === true) {\n e.preventDefault();\n return;\n }\n\n if (e.key === 'Escape') {\n setIsPopoverOpen(false);\n }\n\n setIsPopoverOpen(true);\n\n if (e.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 (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n setLastAction('arrow');\n handleArrowNavigation(e.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 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({ padding: 5 }),\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 <Typography\n variant={size === 'large' ? 'body-large' : 'body-medium'}\n >\n {label}\n </Typography>\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 aria-invalid={Boolean(errorToShow)}\n aria-describedby={errorToShow ? errorTextId : undefined}\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={(e) => {\n if (isReadOnly === true || isDisabled === true) {\n return;\n }\n\n if (\n e.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 {errorToShow !== undefined && (\n <div className=\"ndl-time-picker-error-wrapper\" role=\"status\">\n <ExclamationCircleIconSolid className=\"ndl-time-picker-error-icon\" />\n <Typography\n variant={size === 'large' ? 'body-medium' : 'body-small'}\n className=\"ndl-time-picker-error-text\"\n htmlAttributes={{ id: errorTextId }}\n >\n {errorToShow}\n </Typography>\n </div>\n )}\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, i) => (\n <li\n id={`${listboxId}-option-${i}`}\n key={i}\n role=\"option\"\n aria-selected={\n value?.toString(is24Hour, hasSeconds) === time ||\n editedInput?.toString(is24Hour, hasSeconds) === time\n }\n value={time}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleOnClick(time);\n setIsPopoverOpen(false);\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n tabIndex={-1}\n className={classNames(\n focusedIndex === i ? 'focused' : '',\n 'ndl-time-picker-popover-item',\n )}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.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"]}
@@ -18,19 +18,22 @@
18
18
  * You should have received a copy of the GNU General Public License
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
- export const generateTimeOptions = (is24Hour, interval) => {
21
+ export const generateTimeOptions = (is24Hour, interval, showSeconds) => {
22
22
  const times = [];
23
23
  const safeInterval = interval || 30;
24
+ // The dropdown lists times at the minute interval; when seconds are shown the
25
+ // options are anchored at `:00` and the user can type a more precise value.
26
+ const secondsSuffix = showSeconds === true ? ':00' : '';
24
27
  for (let i = 0; i < 1440; i += safeInterval) {
25
28
  const hours = Math.floor(i / 60);
26
29
  const minutes = i % 60;
27
30
  if (is24Hour) {
28
- times.push(`${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`);
31
+ times.push(`${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}${secondsSuffix}`);
29
32
  }
30
33
  else {
31
34
  const period = hours < 12 ? 'AM' : 'PM';
32
35
  const adjustedHours = hours % 12 || 12;
33
- times.push(`${String(adjustedHours).padStart(2, '0')}:${String(minutes).padStart(2, '0')} ${period}`);
36
+ times.push(`${String(adjustedHours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}${secondsSuffix} ${period}`);
34
37
  }
35
38
  }
36
39
  return times;
@@ -1 +1 @@
1
- {"version":3,"file":"generate-time-options.js","sourceRoot":"","sources":["../../../src/time-picker/generate-time-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAiB,EAAE,QAAgB,EAAE,EAAE;IACzE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,YAAY,GAAG,QAAQ,IAAI,EAAE,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,QAAQ,EAAE,CAAC;YACb,KAAK,CAAC,IAAI,CACR,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CACxE,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YACxC,MAAM,aAAa,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC;YACvC,KAAK,CAAC,IAAI,CACR,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,EAAE,CAC1F,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","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 */\nexport const generateTimeOptions = (is24Hour: boolean, interval: number) => {\n const times: string[] = [];\n const safeInterval = interval || 30;\n for (let i = 0; i < 1440; i += safeInterval) {\n const hours = Math.floor(i / 60);\n const minutes = i % 60;\n if (is24Hour) {\n times.push(\n `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`,\n );\n } else {\n const period = hours < 12 ? 'AM' : 'PM';\n const adjustedHours = hours % 12 || 12;\n times.push(\n `${String(adjustedHours).padStart(2, '0')}:${String(minutes).padStart(2, '0')} ${period}`,\n );\n }\n }\n return times;\n};\n"]}
1
+ {"version":3,"file":"generate-time-options.js","sourceRoot":"","sources":["../../../src/time-picker/generate-time-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,QAAiB,EACjB,QAAgB,EAChB,WAAqB,EACrB,EAAE;IACF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,YAAY,GAAG,QAAQ,IAAI,EAAE,CAAC;IACpC,8EAA8E;IAC9E,4EAA4E;IAC5E,MAAM,aAAa,GAAG,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACxD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,QAAQ,EAAE,CAAC;YACb,KAAK,CAAC,IAAI,CACR,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,aAAa,EAAE,CACxF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YACxC,MAAM,aAAa,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC;YACvC,KAAK,CAAC,IAAI,CACR,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,aAAa,IAAI,MAAM,EAAE,CAC1G,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","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 */\nexport const generateTimeOptions = (\n is24Hour: boolean,\n interval: number,\n showSeconds?: boolean,\n) => {\n const times: string[] = [];\n const safeInterval = interval || 30;\n // The dropdown lists times at the minute interval; when seconds are shown the\n // options are anchored at `:00` and the user can type a more precise value.\n const secondsSuffix = showSeconds === true ? ':00' : '';\n for (let i = 0; i < 1440; i += safeInterval) {\n const hours = Math.floor(i / 60);\n const minutes = i % 60;\n if (is24Hour) {\n times.push(\n `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}${secondsSuffix}`,\n );\n } else {\n const period = hours < 12 ? 'AM' : 'PM';\n const adjustedHours = hours % 12 || 12;\n times.push(\n `${String(adjustedHours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}${secondsSuffix} ${period}`,\n );\n }\n }\n return times;\n};\n"]}
@@ -19,18 +19,22 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
21
  export class NeedleTime {
22
- constructor(hour, minute) {
22
+ constructor(hour, minute, second) {
23
23
  this.hour = hour || 0;
24
24
  this.minute = minute || 0;
25
+ this.second = second || 0;
25
26
  }
26
- toString(is24Hour) {
27
+ toString(is24Hour, showSeconds) {
28
+ const seconds = showSeconds
29
+ ? `:${String(this.second).padStart(2, '0')}`
30
+ : '';
27
31
  if (is24Hour) {
28
- return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}`;
32
+ return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}${seconds}`;
29
33
  }
30
34
  else {
31
35
  const period = this.hour < 12 ? 'AM' : 'PM';
32
36
  const adjustedHours = this.hour % 12 || 12;
33
- return `${String(adjustedHours).padStart(2, '0')}:${String(this.minute).padStart(2, '0')} ${period}`;
37
+ return `${String(adjustedHours).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}${seconds} ${period}`;
34
38
  }
35
39
  }
36
40
  static fromString(timeString) {
@@ -40,21 +44,28 @@ export class NeedleTime {
40
44
  const isPM = cleanTime.includes('pm');
41
45
  const hasAMPM = cleanTime.includes('am') || isPM;
42
46
  const timeWithoutAmPm = cleanTime.replace(/[ap]m/g, '');
43
- // Extract hours and minutes
47
+ // Extract hours, minutes and (optionally) seconds
44
48
  let hours;
45
49
  let minutes;
50
+ let seconds;
46
51
  if (timeWithoutAmPm.includes(':')) {
47
- // Format: hh:mm
48
- const [hoursStr, minutesStr] = timeWithoutAmPm.split(':');
52
+ // Format: hh:mm or hh:mm:ss
53
+ const [hoursStr, minutesStr, secondsStr] = timeWithoutAmPm.split(':');
49
54
  hours = parseInt(hoursStr, 10);
50
55
  minutes = parseInt(minutesStr, 10);
56
+ seconds =
57
+ secondsStr !== undefined && secondsStr !== ''
58
+ ? parseInt(secondsStr, 10)
59
+ : 0;
51
60
  }
52
61
  else {
53
- // Format: hhmm
62
+ // Format: hhmm or hhmmss
54
63
  const hoursStr = timeWithoutAmPm.slice(0, 2);
55
64
  const minutesStr = timeWithoutAmPm.slice(2, 4);
65
+ const secondsStr = timeWithoutAmPm.slice(4, 6);
56
66
  hours = parseInt(hoursStr, 10);
57
67
  minutes = parseInt(minutesStr, 10);
68
+ seconds = secondsStr !== '' ? parseInt(secondsStr, 10) : 0;
58
69
  }
59
70
  // Adjust hours for PM
60
71
  if (isPM && hours < 12) {
@@ -64,7 +75,7 @@ export class NeedleTime {
64
75
  if (hasAMPM && !isPM && hours === 12) {
65
76
  hours = 0;
66
77
  }
67
- return new NeedleTime(hours, minutes);
78
+ return new NeedleTime(hours, minutes, seconds);
68
79
  }
69
80
  hourString(is24Hour) {
70
81
  if (is24Hour) {
@@ -77,6 +88,9 @@ export class NeedleTime {
77
88
  minuteString() {
78
89
  return String(this.minute).padStart(2, '0');
79
90
  }
91
+ secondString() {
92
+ return String(this.second).padStart(2, '0');
93
+ }
80
94
  periodString() {
81
95
  return this.hour < 12 ? 'AM' : 'PM';
82
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"needle-time.js","sourceRoot":"","sources":["../../../src/time-picker/needle-time.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,UAAU;IAIrB,YAAY,IAAa,EAAE,MAAe;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,QAAQ,CAAC,QAAkB;QACzB,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,C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\"\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 */\nexport class NeedleTime {\n hour: number;\n minute: number;\n\n constructor(hour?: number, minute?: number) {\n this.hour = hour || 0;\n this.minute = minute || 0;\n }\n\n toString(is24Hour?: boolean): string {\n if (is24Hour) {\n return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}`;\n } else {\n const period = this.hour < 12 ? 'AM' : 'PM';\n const adjustedHours = this.hour % 12 || 12;\n return `${String(adjustedHours).padStart(2, '0')}:${String(this.minute).padStart(2, '0')} ${period}`;\n }\n }\n\n static fromString(timeString: string): NeedleTime {\n // Remove any whitespace and convert to lowercase\n const cleanTime = timeString.toLowerCase().replace(/\\s/g, '');\n\n // Extract AM/PM if present\n const isPM = cleanTime.includes('pm');\n const hasAMPM = cleanTime.includes('am') || isPM;\n const timeWithoutAmPm = cleanTime.replace(/[ap]m/g, '');\n\n // Extract hours and minutes\n let hours: number;\n let minutes: number;\n\n if (timeWithoutAmPm.includes(':')) {\n // Format: hh:mm\n const [hoursStr, minutesStr] = timeWithoutAmPm.split(':');\n hours = parseInt(hoursStr, 10);\n minutes = parseInt(minutesStr, 10);\n } else {\n // Format: hhmm\n const hoursStr = timeWithoutAmPm.slice(0, 2);\n const minutesStr = timeWithoutAmPm.slice(2, 4);\n hours = parseInt(hoursStr, 10);\n minutes = parseInt(minutesStr, 10);\n }\n\n // Adjust hours for PM\n if (isPM && hours < 12) {\n hours += 12;\n }\n // Adjust hours for AM 12 only if we're dealing with AM/PM format\n if (hasAMPM && !isPM && hours === 12) {\n hours = 0;\n }\n\n return new NeedleTime(hours, minutes);\n }\n\n hourString(is24Hour?: boolean): string {\n if (is24Hour) {\n return String(this.hour).padStart(2, '0');\n } else {\n return String(this.hour % 12 || 12).padStart(2, '0');\n }\n }\n\n minuteString(): string {\n return String(this.minute).padStart(2, '0');\n }\n\n periodString(): string {\n return this.hour < 12 ? 'AM' : 'PM';\n }\n}\n"]}
1
+ {"version":3,"file":"needle-time.js","sourceRoot":"","sources":["../../../src/time-picker/needle-time.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,UAAU;IAKrB,YAAY,IAAa,EAAE,MAAe,EAAE,MAAe;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,QAAQ,CAAC,QAAkB,EAAE,WAAqB;QAChD,MAAM,OAAO,GAAG,WAAW;YACzB,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;YAC5C,CAAC,CAAC,EAAE,CAAC;QACP,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,OAAO,EAAE,CAAC;QACnG,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YAC5C,MAAM,aAAa,GAAG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C,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED,YAAY;QACV,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC9C,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACtC,CAAC;CACF","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 */\nexport class NeedleTime {\n hour: number;\n minute: number;\n second: number;\n\n constructor(hour?: number, minute?: number, second?: number) {\n this.hour = hour || 0;\n this.minute = minute || 0;\n this.second = second || 0;\n }\n\n toString(is24Hour?: boolean, showSeconds?: boolean): string {\n const seconds = showSeconds\n ? `:${String(this.second).padStart(2, '0')}`\n : '';\n if (is24Hour) {\n return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}${seconds}`;\n } else {\n const period = this.hour < 12 ? 'AM' : 'PM';\n const adjustedHours = this.hour % 12 || 12;\n return `${String(adjustedHours).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}${seconds} ${period}`;\n }\n }\n\n static fromString(timeString: string): NeedleTime {\n // Remove any whitespace and convert to lowercase\n const cleanTime = timeString.toLowerCase().replace(/\\s/g, '');\n\n // Extract AM/PM if present\n const isPM = cleanTime.includes('pm');\n const hasAMPM = cleanTime.includes('am') || isPM;\n const timeWithoutAmPm = cleanTime.replace(/[ap]m/g, '');\n\n // Extract hours, minutes and (optionally) seconds\n let hours: number;\n let minutes: number;\n let seconds: number;\n\n if (timeWithoutAmPm.includes(':')) {\n // Format: hh:mm or hh:mm:ss\n const [hoursStr, minutesStr, secondsStr] = timeWithoutAmPm.split(':');\n hours = parseInt(hoursStr, 10);\n minutes = parseInt(minutesStr, 10);\n seconds =\n secondsStr !== undefined && secondsStr !== ''\n ? parseInt(secondsStr, 10)\n : 0;\n } else {\n // Format: hhmm or hhmmss\n const hoursStr = timeWithoutAmPm.slice(0, 2);\n const minutesStr = timeWithoutAmPm.slice(2, 4);\n const secondsStr = timeWithoutAmPm.slice(4, 6);\n hours = parseInt(hoursStr, 10);\n minutes = parseInt(minutesStr, 10);\n seconds = secondsStr !== '' ? parseInt(secondsStr, 10) : 0;\n }\n\n // Adjust hours for PM\n if (isPM && hours < 12) {\n hours += 12;\n }\n // Adjust hours for AM 12 only if we're dealing with AM/PM format\n if (hasAMPM && !isPM && hours === 12) {\n hours = 0;\n }\n\n return new NeedleTime(hours, minutes, seconds);\n }\n\n hourString(is24Hour?: boolean): string {\n if (is24Hour) {\n return String(this.hour).padStart(2, '0');\n } else {\n return String(this.hour % 12 || 12).padStart(2, '0');\n }\n }\n\n minuteString(): string {\n return String(this.minute).padStart(2, '0');\n }\n\n secondString(): string {\n return String(this.second).padStart(2, '0');\n }\n\n periodString(): string {\n return this.hour < 12 ? 'AM' : 'PM';\n }\n}\n"]}
@@ -21,11 +21,14 @@
21
21
  export { default as TimePickerDefault } from './time-picker-default.story';
22
22
  export { default as TimePickerError } from './time-picker-error.story';
23
23
  export { default as TimePickerInDialog } from './time-picker-in-dialog.story';
24
+ export { default as TimePickerWithSeconds } from './time-picker-with-seconds.story';
24
25
  import { removeLicenseHeader } from '../../_common/export-stories-utils';
25
26
  import TimePickerDefaultSrcRaw from './time-picker-default.story.tsx?raw';
26
27
  import TimePickerErrorSrcRaw from './time-picker-error.story.tsx?raw';
27
28
  import TimePickerInDialogSrcRaw from './time-picker-in-dialog.story.tsx?raw';
29
+ import TimePickerWithSecondsSrcRaw from './time-picker-with-seconds.story.tsx?raw';
28
30
  export const TimePickerDefaultSrc = removeLicenseHeader(TimePickerDefaultSrcRaw);
29
31
  export const TimePickerErrorSrc = removeLicenseHeader(TimePickerErrorSrcRaw);
30
32
  export const TimePickerInDialogSrc = removeLicenseHeader(TimePickerInDialogSrcRaw);
33
+ export const TimePickerWithSecondsSrc = removeLicenseHeader(TimePickerWithSecondsSrcRaw);
31
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/time-picker/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAE9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,uBAAuB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,qBAAqB,MAAM,mCAAmC,CAAC;AACtE,OAAO,wBAAwB,MAAM,uCAAuC,CAAC;AAE7E,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,uBAAuB,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,CAAC","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 */\n\nexport { default as TimePickerDefault } from './time-picker-default.story';\nexport { default as TimePickerError } from './time-picker-error.story';\nexport { default as TimePickerInDialog } from './time-picker-in-dialog.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport TimePickerDefaultSrcRaw from './time-picker-default.story.tsx?raw';\nimport TimePickerErrorSrcRaw from './time-picker-error.story.tsx?raw';\nimport TimePickerInDialogSrcRaw from './time-picker-in-dialog.story.tsx?raw';\n\nexport const TimePickerDefaultSrc = removeLicenseHeader(\n TimePickerDefaultSrcRaw,\n);\nexport const TimePickerErrorSrc = removeLicenseHeader(TimePickerErrorSrcRaw);\nexport const TimePickerInDialogSrc = removeLicenseHeader(\n TimePickerInDialogSrcRaw,\n);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/time-picker/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,uBAAuB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,qBAAqB,MAAM,mCAAmC,CAAC;AACtE,OAAO,wBAAwB,MAAM,uCAAuC,CAAC;AAC7E,OAAO,2BAA2B,MAAM,0CAA0C,CAAC;AAEnF,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,uBAAuB,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,CAAC","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 */\n\nexport { default as TimePickerDefault } from './time-picker-default.story';\nexport { default as TimePickerError } from './time-picker-error.story';\nexport { default as TimePickerInDialog } from './time-picker-in-dialog.story';\nexport { default as TimePickerWithSeconds } from './time-picker-with-seconds.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport TimePickerDefaultSrcRaw from './time-picker-default.story.tsx?raw';\nimport TimePickerErrorSrcRaw from './time-picker-error.story.tsx?raw';\nimport TimePickerInDialogSrcRaw from './time-picker-in-dialog.story.tsx?raw';\nimport TimePickerWithSecondsSrcRaw from './time-picker-with-seconds.story.tsx?raw';\n\nexport const TimePickerDefaultSrc = removeLicenseHeader(\n TimePickerDefaultSrcRaw,\n);\nexport const TimePickerErrorSrc = removeLicenseHeader(TimePickerErrorSrcRaw);\nexport const TimePickerInDialogSrc = removeLicenseHeader(\n TimePickerInDialogSrcRaw,\n);\nexport const TimePickerWithSecondsSrc = removeLicenseHeader(\n TimePickerWithSecondsSrcRaw,\n);\n"]}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { TimePicker } from '@neo4j-ndl/react';
24
+ import { useState } from 'react';
25
+ const Component = () => {
26
+ const [selectedTime, setSelectedTime] = useState();
27
+ return (_jsx("div", { style: { height: '600px', padding: '20px' }, children: _jsx(TimePicker, { label: "Select Time (with seconds)", format: "hh:mm:ss", value: selectedTime, onChange: (time) => setSelectedTime(time), htmlAttributes: { id: 'time-picker-input' } }) }));
28
+ };
29
+ export default Component;
30
+ //# sourceMappingURL=time-picker-with-seconds.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-picker-with-seconds.story.js","sourceRoot":"","sources":["../../../../src/time-picker/stories/time-picker-with-seconds.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAmB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,EAAc,CAAC;IAE/D,OAAO,CACL,cAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAC9C,KAAC,UAAU,IACT,KAAK,EAAC,4BAA4B,EAClC,MAAM,EAAC,UAAU,EACjB,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EACzC,cAAc,EAAE,EAAE,EAAE,EAAE,mBAAmB,EAAE,GAC3C,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","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 */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { type NeedleTime, TimePicker } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [selectedTime, setSelectedTime] = useState<NeedleTime>();\n\n return (\n <div style={{ height: '600px', padding: '20px' }}>\n <TimePicker\n label=\"Select Time (with seconds)\"\n format=\"hh:mm:ss\"\n value={selectedTime}\n onChange={(time) => setSelectedTime(time)}\n htmlAttributes={{ id: 'time-picker-input' }}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,33 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import type { RgbColor } from '@uiw/react-color';
22
+ /**
23
+ * Computes a linear interpolation weight in [0, 1] for `value` between
24
+ * `startValue` and `endValue`. Values outside the range produce weights
25
+ * outside [0, 1] — callers are responsible for clamping if needed.
26
+ */
27
+ export declare function getWeight(startValue: number, endValue: number, value: number): number;
28
+ /**
29
+ * Linearly interpolates between two RGB colors by `weight` (0 = start, 1 = end).
30
+ * Each channel is rounded to the nearest integer.
31
+ */
32
+ export declare function lerpColor(startColor: RgbColor, endColor: RgbColor, weight: number): RgbColor;
33
+ //# sourceMappingURL=color-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/color-utils.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,QAAQ,EACpB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,GACb,QAAQ,CAMV"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+
22
+ /**
23
+ * Parses an ISO 8601 time string to UTC milliseconds since midnight
24
+ * (0–86,399,999). Returns `null` if the string cannot be parsed.
25
+ *
26
+ * Three formats are accepted:
27
+ * 1. Local time (no offset): `"14:30:00"`, `"14:30:00.500"` — treated as UTC
28
+ * 2. UTC time with Z suffix: `"14:30:00Z"` — treated identically to the local form
29
+ * 3. Offset time: `"14:30:00+02:00"` — the offset is applied so the result
30
+ * is the equivalent UTC time of day. `"12:00:00+01:00"` resolves to
31
+ * 39,600,000 (11:00 UTC), which is less than `"12:00:00+00:00"` (43,200,000).
32
+ *
33
+ * Values wrap around midnight: `"00:00:00+01:00"` → 82,800,000 (23:00 UTC).
34
+ */
35
+ export declare function parseTimeString(s: string): number | null;
36
+ /**
37
+ * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond
38
+ * timestamp. Returns `null` if the string cannot be parsed.
39
+ *
40
+ * Three formats are tried in order:
41
+ * 1. RFC 9557 ZonedDateTime with IANA bracket notation
42
+ * e.g. `"2024-06-15T14:00:00[Europe/Stockholm]"` (offset inferred from the
43
+ * named timezone, including DST) or `"2024-06-15T14:00:00+02:00[Europe/Stockholm]"`
44
+ * (offset explicit; bracket must agree with the IANA zone)
45
+ * 2. UTC or fixed-offset Instant
46
+ * e.g. `"2024-01-01T00:00:00Z"`, `"2024-01-01T00:00:00+02:00"`
47
+ * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC
48
+ * e.g. `"2024-01-01"`, `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
49
+ *
50
+ * Strings with a time component that lack `Z`, an offset, or an IANA bracket are
51
+ * parsed as UTC wall-clock time (same semantics as Neo4j `LocalDateTime`).
52
+ */
53
+ export declare function parseDateString(s: string): number | null;
54
+ //# sourceMappingURL=date-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":"AAoDA;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyCxD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA0BxD"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export { getWeight, lerpColor } from './color-utils';
22
+ export { parseDateString, parseTimeString } from './date-utils';
23
+ export { DatetimeLiteralSchema, TimeLiteralSchema } from './literal-schemas';
24
+ export type { DatetimeLiteral, TimeLiteral } from './literal-schemas';
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/index.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import { z } from 'zod';
22
+ /**
23
+ * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond
24
+ * timestamp at evaluation time. Supported formats:
25
+ * - RFC 9557 with IANA timezone: `"2024-06-15T14:00:00[Europe/Stockholm]"` (offset
26
+ * inferred from the named zone, DST-aware) or `"2024-06-15T14:00:00+02:00[Europe/Stockholm]"`
27
+ * (offset explicit)
28
+ * - UTC or offset datetime: `"2024-01-01T00:00:00Z"`, `"2024-01-01T00:00:00+02:00"`
29
+ * - Plain datetime (treated as UTC): `"2024-01-01T14:30:00"`, `"2024-01-01T14:30:00.500"`
30
+ * - Date-only (treated as UTC midnight): `"2024-01-01"`
31
+ */
32
+ export declare const DatetimeLiteralSchema: z.ZodObject<{
33
+ datetime: z.ZodString;
34
+ }, z.core.$strip>;
35
+ export type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;
36
+ /**
37
+ * An ISO 8601 time literal that resolves to milliseconds since UTC midnight
38
+ * at evaluation time. Supported formats:
39
+ * - Local time (treated as UTC): `"14:30:00"`, `"14:30:00.500"`
40
+ * - UTC time: `"14:30:00Z"` — identical to local form
41
+ * - Offset time (UTC-normalised): `"14:30:00+02:00"` → 45,000,000 ms (12:30 UTC)
42
+ *
43
+ * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a
44
+ * time-of-day value has no calendar date so DST cannot be resolved. Use
45
+ * `{ datetime }` literals for timezone-aware instants.
46
+ *
47
+ * Full datetime strings (containing `T`) are rejected.
48
+ */
49
+ export declare const TimeLiteralSchema: z.ZodObject<{
50
+ time: z.ZodString;
51
+ }, z.core.$strip>;
52
+ export type TimeLiteral = z.infer<typeof TimeLiteralSchema>;
53
+ //# sourceMappingURL=literal-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"literal-schemas.d.ts","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB;;iBAKhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB;;iBAK5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
22
+ declare const Component: () => import("react/jsx-runtime").JSX.Element;
23
+ export default Component;
24
+ //# sourceMappingURL=datagrid-rule-based-styling-datetime.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datagrid-rule-based-styling-datetime.story.d.ts","sourceRoot":"","sources":["../../../../src/data-grid/stories/datagrid-rule-based-styling-datetime.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AA6NjD,QAAA,MAAM,SAAS,+CAmFd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -38,6 +38,7 @@ export { default as DataGridSingleSelectable } from './datagrid-single-selectabl
38
38
  export { default as DataGridUsingEditableCells } from './datagrid-using-editable-cells.story';
39
39
  export { default as DataGridRuleBasedStyling } from './datagrid-rule-based-styling.story';
40
40
  export { default as DataGridCustomCellWithStyleRules } from './datagrid-custom-cell-with-style-rules.story';
41
+ export { default as DataGridRuleBasedStylingDateTime } from './datagrid-rule-based-styling-datetime.story';
41
42
  export declare const DataGridCustomCellWithStyleRulesSource: string;
42
43
  export declare const DataGridRuleBasedStylingSource: string;
43
44
  export declare const DataGridSimpleSource: string;
@@ -59,4 +60,5 @@ export declare const DataGridPinnedColumnsSource: string;
59
60
  export declare const DataGridNoPaginationTableSource: string;
60
61
  export declare const DataGridSingleSelectableSource: string;
61
62
  export declare const DataGridUsingEditableCellsSource: string;
63
+ export declare const DataGridRuleBasedStylingDateTimeSource: string;
62
64
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/data-grid/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EACL,UAAU,IAAI,kBAAkB,EAChC,eAAe,IAAI,uBAAuB,GAC3C,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAC3F,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAC/F,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,sCAAsC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