@neo4j-ndl/react 4.15.2 → 4.15.3

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 +36 -20
  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 +36 -20
  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
@@ -48,12 +48,20 @@ const typography_1 = require("../typography");
48
48
  const generate_time_options_1 = require("./generate-time-options");
49
49
  const needle_time_1 = require("./needle-time");
50
50
  const time_picker_hooks_1 = require("./time-picker-hooks");
51
+ /** Fixed input width per format (only used when the picker is not fluid). */
52
+ const INPUT_WIDTH_BY_FORMAT = {
53
+ 'hh:mm': '6rem',
54
+ 'hh:mm aa': '9rem',
55
+ 'hh:mm:ss': '7.5rem',
56
+ 'hh:mm:ss aa': '11rem',
57
+ };
51
58
  const TimePicker = (_a) => {
52
59
  var _b, _c, _d;
53
60
  var { format = 'hh:mm', isDisabled, isFluid, isReadOnly, isRequired, value, timeInterval = 15, label, onChange, className, onError, style, size = 'medium', errorText, htmlAttributes, floatingStrategy, isPortaled: isPortaledProp, ref } = _a, restProps = __rest(_a, ["format", "isDisabled", "isFluid", "isReadOnly", "isRequired", "value", "timeInterval", "label", "onChange", "className", "onError", "style", "size", "errorText", "htmlAttributes", "floatingStrategy", "isPortaled", "ref"]);
54
61
  const [editedInput, setEditedInput] = (0, react_2.useState)(value);
55
- const is24Hour = format === 'hh:mm';
56
- const [inputValue, setInputValue] = (0, react_2.useState)((_b = value === null || value === void 0 ? void 0 : value.toString(is24Hour)) !== null && _b !== void 0 ? _b : '');
62
+ const is24Hour = !format.includes('aa');
63
+ const hasSeconds = format.includes('ss');
64
+ const [inputValue, setInputValue] = (0, react_2.useState)((_b = value === null || value === void 0 ? void 0 : value.toString(is24Hour, hasSeconds)) !== null && _b !== void 0 ? _b : '');
57
65
  const listRef = (0, react_2.useRef)(null);
58
66
  const inputRef = (0, react_2.useRef)(null);
59
67
  (0, react_2.useImperativeHandle)(ref, () => inputRef.current, []);
@@ -61,7 +69,7 @@ const TimePicker = (_a) => {
61
69
  const [error, setError] = (0, react_2.useState)(undefined);
62
70
  const errorTextId = (0, react_2.useId)();
63
71
  const listboxId = (0, react_2.useId)();
64
- const timeOptions = (0, react_2.useMemo)(() => (0, generate_time_options_1.generateTimeOptions)(is24Hour, timeInterval), [is24Hour, timeInterval]);
72
+ const timeOptions = (0, react_2.useMemo)(() => (0, generate_time_options_1.generateTimeOptions)(is24Hour, timeInterval, hasSeconds), [is24Hour, timeInterval, hasSeconds]);
65
73
  const { themeClassName } = (0, theme_1.useNeedleTheme)();
66
74
  const { isPopoverOpen, setIsPopoverOpen } = (0, time_picker_hooks_1.useTimePickerPopover)(false);
67
75
  const { focusedIndex, setFocusedIndex, handleArrowNavigation } = (0, time_picker_hooks_1.useKeyboardNavigation)(listRef, timeOptions.length);
@@ -75,14 +83,17 @@ const TimePicker = (_a) => {
75
83
  'ndl-read-only': isReadOnly,
76
84
  'ndl-small': size === 'small',
77
85
  };
78
- const inputWidth = isFluid === true ? '100%' : is24Hour === true ? '6rem' : '9rem';
79
- const isValidTime = (0, react_2.useCallback)((hours, minutes) => {
86
+ const inputWidth = isFluid === true ? '100%' : INPUT_WIDTH_BY_FORMAT[format];
87
+ const isValidTime = (0, react_2.useCallback)((hours, minutes, seconds) => {
80
88
  if (hours > 23 || hours < 0) {
81
89
  return false;
82
90
  }
83
91
  if (minutes > 59 || minutes < 0) {
84
92
  return false;
85
93
  }
94
+ if (seconds > 59 || seconds < 0) {
95
+ return false;
96
+ }
86
97
  return true;
87
98
  }, []);
88
99
  (0, react_2.useEffect)(() => {
@@ -93,8 +104,8 @@ const TimePicker = (_a) => {
93
104
  (0, react_2.useEffect)(() => {
94
105
  var _a;
95
106
  setEditedInput(value);
96
- setInputValue((_a = value === null || value === void 0 ? void 0 : value.toString(is24Hour)) !== null && _a !== void 0 ? _a : '');
97
- }, [is24Hour, value]);
107
+ setInputValue((_a = value === null || value === void 0 ? void 0 : value.toString(is24Hour, hasSeconds)) !== null && _a !== void 0 ? _a : '');
108
+ }, [is24Hour, hasSeconds, value]);
98
109
  (0, react_2.useEffect)(() => {
99
110
  if (isPopoverOpen) {
100
111
  setTimeout(() => {
@@ -109,13 +120,14 @@ const TimePicker = (_a) => {
109
120
  setTimeout(() => {
110
121
  var _a, _b, _c;
111
122
  (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
112
- const selectedIndex = (_c = timeOptions.indexOf((_b = value === null || value === void 0 ? void 0 : value.toString(is24Hour)) !== null && _b !== void 0 ? _b : '')) !== null && _c !== void 0 ? _c : 0;
123
+ const selectedIndex = (_c = timeOptions.indexOf((_b = value === null || value === void 0 ? void 0 : value.toString(is24Hour, hasSeconds)) !== null && _b !== void 0 ? _b : '')) !== null && _c !== void 0 ? _c : 0;
113
124
  setFocusedIndex(selectedIndex);
114
125
  }, 0);
115
126
  }
116
127
  }, [
117
128
  focusedIndex,
118
129
  is24Hour,
130
+ hasSeconds,
119
131
  isPopoverOpen,
120
132
  value,
121
133
  setFocusedIndex,
@@ -135,7 +147,7 @@ const TimePicker = (_a) => {
135
147
  setInputValue(e.target.value);
136
148
  setLastAction('type');
137
149
  const time = needle_time_1.NeedleTime.fromString(e.target.value);
138
- if (!isValidTime(time.hour, time.minute)) {
150
+ if (!isValidTime(time.hour, time.minute, time.second)) {
139
151
  setError('Invalid time');
140
152
  }
141
153
  else {
@@ -152,14 +164,15 @@ const TimePicker = (_a) => {
152
164
  }
153
165
  setIsPopoverOpen(true);
154
166
  if (e.key === 'Enter') {
155
- if (lastAction === 'type' && inputValue.length >= (is24Hour ? 5 : 6)) {
167
+ const minTypedLength = (is24Hour ? 5 : 6) + (hasSeconds ? 3 : 0);
168
+ if (lastAction === 'type' && inputValue.length >= minTypedLength) {
156
169
  const time = needle_time_1.NeedleTime.fromString(inputValue);
157
- handleOnClick(time.toString(is24Hour));
170
+ handleOnClick(time.toString(is24Hour, hasSeconds));
158
171
  }
159
172
  else if (lastAction === 'type' && !inputValue.includes(':')) {
160
173
  const time = needle_time_1.NeedleTime.fromString(inputValue);
161
- if (isValidTime(time.hour, time.minute)) {
162
- handleOnClick(time.toString(is24Hour));
174
+ if (isValidTime(time.hour, time.minute, time.second)) {
175
+ handleOnClick(time.toString(is24Hour, hasSeconds));
163
176
  }
164
177
  setIsPopoverOpen(false);
165
178
  }
@@ -183,9 +196,10 @@ const TimePicker = (_a) => {
183
196
  if (timeDigits.length === 1) {
184
197
  // Single digit - assume it's an hour
185
198
  const hour = `0${timeDigits}`;
199
+ const minutes = hasSeconds ? '00:00' : '00';
186
200
  const searchTime = is24Hour
187
- ? `${hour}:00`
188
- : `${hour}:00 ${isPM ? 'PM' : 'AM'}`;
201
+ ? `${hour}:${minutes}`
202
+ : `${hour}:${minutes} ${isPM ? 'PM' : 'AM'}`;
189
203
  index = timeOptions.indexOf(searchTime);
190
204
  }
191
205
  else {
@@ -268,17 +282,19 @@ const TimePicker = (_a) => {
268
282
  setError('Invalid time');
269
283
  return;
270
284
  }
271
- if (!isValidTime(time.hour, time.minute)) {
285
+ if (!isValidTime(time.hour, time.minute, time.second)) {
272
286
  setError('Invalid time');
273
287
  }
274
288
  else {
275
289
  setError(undefined);
276
- setInputValue(time.toString(is24Hour));
290
+ setInputValue(time.toString(is24Hour, hasSeconds));
277
291
  }
278
- }, placeholder: format, maxLength: is24Hour ? 5 : 8 }, restProps, htmlAttributes)), (0, jsx_runtime_1.jsx)(icons_1.ClockIconOutline, { className: "ndl-icon-svg ndl-time-picker-icon" })] })] }), errorToShow !== undefined && ((0, jsx_runtime_1.jsxs)("div", { className: "ndl-time-picker-error-wrapper", role: "status", children: [(0, jsx_runtime_1.jsx)(icons_1.ExclamationCircleIconSolid, { className: "ndl-time-picker-error-icon" }), (0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: size === 'large' ? 'body-medium' : 'body-small', className: "ndl-time-picker-error-text", htmlAttributes: { id: errorTextId }, children: errorToShow })] }))] })), context.open && ((0, jsx_runtime_1.jsx)(conditional_wrap_1.ConditionalWrap, { shouldWrap: isPortaled, wrap: (wrapChildren) => ((0, jsx_runtime_1.jsx)(react_1.FloatingPortal, { children: wrapChildren })), children: (0, jsx_runtime_1.jsx)(react_1.FloatingFocusManager, { context: context, modal: false, initialFocus: -1, children: (0, jsx_runtime_1.jsx)("div", Object.assign({ ref: refs.setFloating, className: (0, classnames_1.default)(themeClassName, 'ndl-time-picker-popover', Object.assign({}, classes)), style: Object.assign(Object.assign(Object.assign({}, transitionStyles), floatingStyles), { width: isFluid === true
292
+ }, placeholder: format,
293
+ // The typed value can never be longer than the format pattern.
294
+ maxLength: format.length }, restProps, htmlAttributes)), (0, jsx_runtime_1.jsx)(icons_1.ClockIconOutline, { className: "ndl-icon-svg ndl-time-picker-icon" })] })] }), errorToShow !== undefined && ((0, jsx_runtime_1.jsxs)("div", { className: "ndl-time-picker-error-wrapper", role: "status", children: [(0, jsx_runtime_1.jsx)(icons_1.ExclamationCircleIconSolid, { className: "ndl-time-picker-error-icon" }), (0, jsx_runtime_1.jsx)(typography_1.Typography, { variant: size === 'large' ? 'body-medium' : 'body-small', className: "ndl-time-picker-error-text", htmlAttributes: { id: errorTextId }, children: errorToShow })] }))] })), context.open && ((0, jsx_runtime_1.jsx)(conditional_wrap_1.ConditionalWrap, { shouldWrap: isPortaled, wrap: (wrapChildren) => ((0, jsx_runtime_1.jsx)(react_1.FloatingPortal, { children: wrapChildren })), children: (0, jsx_runtime_1.jsx)(react_1.FloatingFocusManager, { context: context, modal: false, initialFocus: -1, children: (0, jsx_runtime_1.jsx)("div", Object.assign({ ref: refs.setFloating, className: (0, classnames_1.default)(themeClassName, 'ndl-time-picker-popover', Object.assign({}, classes)), style: Object.assign(Object.assign(Object.assign({}, transitionStyles), floatingStyles), { width: isFluid === true
279
295
  ? (_d = containerRef.current) === null || _d === void 0 ? void 0 : _d.clientWidth
280
- : undefined }) }, getFloatingProps(), { children: (0, jsx_runtime_1.jsx)("ul", { ref: listRef, role: "listbox", id: listboxId, tabIndex: -1, children: timeOptions.map((time, i) => ((0, jsx_runtime_1.jsx)("li", { id: `${listboxId}-option-${i}`, role: "option", "aria-selected": (value === null || value === void 0 ? void 0 : value.toString(is24Hour)) === time ||
281
- (editedInput === null || editedInput === void 0 ? void 0 : editedInput.toString(is24Hour)) === time, value: time, onClick: (e) => {
296
+ : undefined }) }, getFloatingProps(), { children: (0, jsx_runtime_1.jsx)("ul", { ref: listRef, role: "listbox", id: listboxId, tabIndex: -1, children: timeOptions.map((time, i) => ((0, jsx_runtime_1.jsx)("li", { id: `${listboxId}-option-${i}`, role: "option", "aria-selected": (value === null || value === void 0 ? void 0 : value.toString(is24Hour, hasSeconds)) === time ||
297
+ (editedInput === null || editedInput === void 0 ? void 0 : editedInput.toString(is24Hour, hasSeconds)) === time, value: time, onClick: (e) => {
282
298
  e.stopPropagation();
283
299
  e.preventDefault();
284
300
  handleOnClick(time);
@@ -1 +1 @@
1
- {"version":3,"file":"TimePicker.js","sourceRoot":"","sources":["../../../src/time-picker/TimePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8CAY4B;AAC5B,0CAAyC;AACzC,4DAAoC;AAEpC,iCAQe;AAGf,0DAAsD;AACtD,6DAA6D;AAC7D,oCAAwE;AACxE,oCAA0C;AAC1C,8CAA2C;AAC3C,mEAA8D;AAC9D,+CAA2C;AAC3C,2DAG6B;AAuCtB,MAAM,UAAU,GAAG,CAAsC,EAoBnB,EAAE,EAAE;;QApBe,EAC9D,MAAM,GAAG,OAAO,EAChB,UAAU,EACV,OAAO,EACP,UAAU,EACV,UAAU,EACV,KAAK,EACL,YAAY,GAAG,EAAE,EACjB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,OAAO,EACP,KAAK,EACL,IAAI,GAAG,QAAQ,EACf,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,UAAU,EAAE,cAAc,EAC1B,GAAG,OAEwC,EADxC,SAAS,cAnBkD,8NAoB/D,CADa;IAEZ,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAyB,KAAK,CAAC,CAAC;IAE9E,MAAM,QAAQ,GAAG,MAAM,KAAK,OAAO,CAAC;IACpC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAC1C,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CAAC,QAAQ,CAAC,mCAAI,EAAE,CAChC,CAAC;IACF,MAAM,OAAO,GAAG,IAAA,cAAM,E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AAK,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;AA/ZW,QAAA,UAAU,cA+ZrB","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,8CAY4B;AAC5B,0CAAyC;AACzC,4DAAoC;AAEpC,iCAQe;AAGf,0DAAsD;AACtD,6DAA6D;AAC7D,oCAAwE;AACxE,oCAA0C;AAC1C,8CAA2C;AAC3C,mEAA8D;AAC9D,+CAA2C;AAC3C,2DAG6B;AAI7B,6EAA6E;AAC7E,MAAM,qBAAqB,GAA+B;IACxD,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;IAClB,UAAU,EAAE,QAAQ;IACpB,aAAa,EAAE,OAAO;CACvB,CAAC;AAqCK,MAAM,UAAU,GAAG,CAAsC,EAoBnB,EAAE,EAAE;;QApBe,EAC9D,MAAM,GAAG,OAAO,EAChB,UAAU,EACV,OAAO,EACP,UAAU,EACV,UAAU,EACV,KAAK,EACL,YAAY,GAAG,EAAE,EACjB,KAAK,EACL,QAAQ,EACR,SAA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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;AA1aW,QAAA,UAAU,cA0arB","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 inputRef.current?.blur();\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 }\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"]}
@@ -21,19 +21,22 @@ exports.generateTimeOptions = void 0;
21
21
  * You should have received a copy of the GNU General Public License
22
22
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
23
  */
24
- const generateTimeOptions = (is24Hour, interval) => {
24
+ const generateTimeOptions = (is24Hour, interval, showSeconds) => {
25
25
  const times = [];
26
26
  const safeInterval = interval || 30;
27
+ // The dropdown lists times at the minute interval; when seconds are shown the
28
+ // options are anchored at `:00` and the user can type a more precise value.
29
+ const secondsSuffix = showSeconds === true ? ':00' : '';
27
30
  for (let i = 0; i < 1440; i += safeInterval) {
28
31
  const hours = Math.floor(i / 60);
29
32
  const minutes = i % 60;
30
33
  if (is24Hour) {
31
- times.push(`${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`);
34
+ times.push(`${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}${secondsSuffix}`);
32
35
  }
33
36
  else {
34
37
  const period = hours < 12 ? 'AM' : 'PM';
35
38
  const adjustedHours = hours % 12 || 12;
36
- times.push(`${String(adjustedHours).padStart(2, '0')}:${String(minutes).padStart(2, '0')} ${period}`);
39
+ times.push(`${String(adjustedHours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}${secondsSuffix} ${period}`);
37
40
  }
38
41
  }
39
42
  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;AACI,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;AAnBW,QAAA,mBAAmB,uBAmB9B","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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OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AA1BW,QAAA,mBAAmB,uBA0B9B","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"]}
@@ -22,18 +22,22 @@ exports.NeedleTime = void 0;
22
22
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
23
  */
24
24
  class NeedleTime {
25
- constructor(hour, minute) {
25
+ constructor(hour, minute, second) {
26
26
  this.hour = hour || 0;
27
27
  this.minute = minute || 0;
28
+ this.second = second || 0;
28
29
  }
29
- toString(is24Hour) {
30
+ toString(is24Hour, showSeconds) {
31
+ const seconds = showSeconds
32
+ ? `:${String(this.second).padStart(2, '0')}`
33
+ : '';
30
34
  if (is24Hour) {
31
- return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}`;
35
+ return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}${seconds}`;
32
36
  }
33
37
  else {
34
38
  const period = this.hour < 12 ? 'AM' : 'PM';
35
39
  const adjustedHours = this.hour % 12 || 12;
36
- return `${String(adjustedHours).padStart(2, '0')}:${String(this.minute).padStart(2, '0')} ${period}`;
40
+ return `${String(adjustedHours).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}${seconds} ${period}`;
37
41
  }
38
42
  }
39
43
  static fromString(timeString) {
@@ -43,21 +47,28 @@ class NeedleTime {
43
47
  const isPM = cleanTime.includes('pm');
44
48
  const hasAMPM = cleanTime.includes('am') || isPM;
45
49
  const timeWithoutAmPm = cleanTime.replace(/[ap]m/g, '');
46
- // Extract hours and minutes
50
+ // Extract hours, minutes and (optionally) seconds
47
51
  let hours;
48
52
  let minutes;
53
+ let seconds;
49
54
  if (timeWithoutAmPm.includes(':')) {
50
- // Format: hh:mm
51
- const [hoursStr, minutesStr] = timeWithoutAmPm.split(':');
55
+ // Format: hh:mm or hh:mm:ss
56
+ const [hoursStr, minutesStr, secondsStr] = timeWithoutAmPm.split(':');
52
57
  hours = parseInt(hoursStr, 10);
53
58
  minutes = parseInt(minutesStr, 10);
59
+ seconds =
60
+ secondsStr !== undefined && secondsStr !== ''
61
+ ? parseInt(secondsStr, 10)
62
+ : 0;
54
63
  }
55
64
  else {
56
- // Format: hhmm
65
+ // Format: hhmm or hhmmss
57
66
  const hoursStr = timeWithoutAmPm.slice(0, 2);
58
67
  const minutesStr = timeWithoutAmPm.slice(2, 4);
68
+ const secondsStr = timeWithoutAmPm.slice(4, 6);
59
69
  hours = parseInt(hoursStr, 10);
60
70
  minutes = parseInt(minutesStr, 10);
71
+ seconds = secondsStr !== '' ? parseInt(secondsStr, 10) : 0;
61
72
  }
62
73
  // Adjust hours for PM
63
74
  if (isPM && hours < 12) {
@@ -67,7 +78,7 @@ class NeedleTime {
67
78
  if (hasAMPM && !isPM && hours === 12) {
68
79
  hours = 0;
69
80
  }
70
- return new NeedleTime(hours, minutes);
81
+ return new NeedleTime(hours, minutes, seconds);
71
82
  }
72
83
  hourString(is24Hour) {
73
84
  if (is24Hour) {
@@ -80,6 +91,9 @@ class NeedleTime {
80
91
  minuteString() {
81
92
  return String(this.minute).padStart(2, '0');
82
93
  }
94
+ secondString() {
95
+ return String(this.second).padStart(2, '0');
96
+ }
83
97
  periodString() {
84
98
  return this.hour < 12 ? 'AM' : 'PM';
85
99
  }
@@ -1 +1 @@
1
- {"version":3,"file":"needle-time.js","sourceRoot":"","sources":["../../../src/time-picker/needle-time.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,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,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;QACzF,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,IAAI,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC;YAC3C,OAAO,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,C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AI,KAAK,GAAG,EAAE,EAAE,CAAC;YACvB,KAAK,IAAI,EAAE,CAAC;QACd,CAAC;QACD,iEAAiE;QACjE,IAAI,OAAO,IAAI,CAAC,IAAI,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;YACrC,KAAK,GAAG,CAAC,CAAC;QACZ,CAAC;QAED,OAAO,IAAI,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,UAAU,CAAC,QAAkB;QAC3B,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACvD,CAAC;IACH,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;AAxED,gCAwEC","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\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":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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"]}
@@ -23,18 +23,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.TimePickerInDialogSrc = exports.TimePickerErrorSrc = exports.TimePickerDefaultSrc = exports.TimePickerInDialog = exports.TimePickerError = exports.TimePickerDefault = void 0;
26
+ exports.TimePickerWithSecondsSrc = exports.TimePickerInDialogSrc = exports.TimePickerErrorSrc = exports.TimePickerDefaultSrc = exports.TimePickerWithSeconds = exports.TimePickerInDialog = exports.TimePickerError = exports.TimePickerDefault = void 0;
27
27
  var time_picker_default_story_1 = require("./time-picker-default.story");
28
28
  Object.defineProperty(exports, "TimePickerDefault", { enumerable: true, get: function () { return __importDefault(time_picker_default_story_1).default; } });
29
29
  var time_picker_error_story_1 = require("./time-picker-error.story");
30
30
  Object.defineProperty(exports, "TimePickerError", { enumerable: true, get: function () { return __importDefault(time_picker_error_story_1).default; } });
31
31
  var time_picker_in_dialog_story_1 = require("./time-picker-in-dialog.story");
32
32
  Object.defineProperty(exports, "TimePickerInDialog", { enumerable: true, get: function () { return __importDefault(time_picker_in_dialog_story_1).default; } });
33
+ var time_picker_with_seconds_story_1 = require("./time-picker-with-seconds.story");
34
+ Object.defineProperty(exports, "TimePickerWithSeconds", { enumerable: true, get: function () { return __importDefault(time_picker_with_seconds_story_1).default; } });
33
35
  const export_stories_utils_1 = require("../../_common/export-stories-utils");
34
36
  const time_picker_default_story_tsx_raw_1 = __importDefault(require("./time-picker-default.story.tsx?raw"));
35
37
  const time_picker_error_story_tsx_raw_1 = __importDefault(require("./time-picker-error.story.tsx?raw"));
36
38
  const time_picker_in_dialog_story_tsx_raw_1 = __importDefault(require("./time-picker-in-dialog.story.tsx?raw"));
39
+ const time_picker_with_seconds_story_tsx_raw_1 = __importDefault(require("./time-picker-with-seconds.story.tsx?raw"));
37
40
  exports.TimePickerDefaultSrc = (0, export_stories_utils_1.removeLicenseHeader)(time_picker_default_story_tsx_raw_1.default);
38
41
  exports.TimePickerErrorSrc = (0, export_stories_utils_1.removeLicenseHeader)(time_picker_error_story_tsx_raw_1.default);
39
42
  exports.TimePickerInDialogSrc = (0, export_stories_utils_1.removeLicenseHeader)(time_picker_in_dialog_story_tsx_raw_1.default);
43
+ exports.TimePickerWithSecondsSrc = (0, export_stories_utils_1.removeLicenseHeader)(time_picker_with_seconds_story_tsx_raw_1.default);
40
44
  //# 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,yEAA2E;AAAlE,+IAAA,OAAO,OAAqB;AACrC,qEAAuE;AAA9D,2IAAA,OAAO,OAAmB;AACnC,6EAA8E;AAArE,kJAAA,OAAO,OAAsB;AAEtC,6EAAyE;AACzE,4GAA0E;AAC1E,wGAAsE;AACtE,gHAA6E;AAEhE,QAAA,oBAAoB,GAAG,IAAA,0CAAmB,EACrD,2CAAuB,CACxB,CAAC;AACW,QAAA,kBAAkB,GAAG,IAAA,0CAAmB,EAAC,yCAAqB,CAAC,CAAC;AAChE,QAAA,qBAAqB,GAAG,IAAA,0CAAmB,EACtD,6CAAwB,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,yEAA2E;AAAlE,+IAAA,OAAO,OAAqB;AACrC,qEAAuE;AAA9D,2IAAA,OAAO,OAAmB;AACnC,6EAA8E;AAArE,kJAAA,OAAO,OAAsB;AACtC,mFAAoF;AAA3E,wJAAA,OAAO,OAAyB;AAEzC,6EAAyE;AACzE,4GAA0E;AAC1E,wGAAsE;AACtE,gHAA6E;AAC7E,sHAAmF;AAEtE,QAAA,oBAAoB,GAAG,IAAA,0CAAmB,EACrD,2CAAuB,CACxB,CAAC;AACW,QAAA,kBAAkB,GAAG,IAAA,0CAAmB,EAAC,yCAAqB,CAAC,CAAC;AAChE,QAAA,qBAAqB,GAAG,IAAA,0CAAmB,EACtD,6CAAwB,CACzB,CAAC;AACW,QAAA,wBAAwB,GAAG,IAAA,0CAAmB,EACzD,gDAA2B,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,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const react_1 = require("@neo4j-ndl/react");
26
+ const react_2 = require("react");
27
+ const Component = () => {
28
+ const [selectedTime, setSelectedTime] = (0, react_2.useState)();
29
+ return ((0, jsx_runtime_1.jsx)("div", { style: { height: '600px', padding: '20px' }, children: (0, jsx_runtime_1.jsx)(react_1.TimePicker, { label: "Select Time (with seconds)", format: "hh:mm:ss", value: selectedTime, onChange: (time) => setSelectedTime(time), htmlAttributes: { id: 'time-picker-input' } }) }));
30
+ };
31
+ exports.default = Component;
32
+ //# 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,mDAAiD;AAEjD,4CAA+D;AAC/D,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,GAAc,CAAC;IAE/D,OAAO,CACL,gCAAK,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAC9C,uBAAC,kBAAU,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,kBAAe,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,46 @@
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
+ * AUTO-GENERATED FILE — DO NOT EDIT.
24
+ * Source of truth: packages/style-rules/src/
25
+ * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).
26
+ */
27
+ /**
28
+ * Computes a linear interpolation weight in [0, 1] for `value` between
29
+ * `startValue` and `endValue`. Values outside the range produce weights
30
+ * outside [0, 1] — callers are responsible for clamping if needed.
31
+ */
32
+ export function getWeight(startValue, endValue, value) {
33
+ return (value - startValue) / (endValue - startValue);
34
+ }
35
+ /**
36
+ * Linearly interpolates between two RGB colors by `weight` (0 = start, 1 = end).
37
+ * Each channel is rounded to the nearest integer.
38
+ */
39
+ export function lerpColor(startColor, endColor, weight) {
40
+ return {
41
+ b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),
42
+ g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),
43
+ r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),
44
+ };
45
+ }
46
+ //# sourceMappingURL=color-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/color-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyBH;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,UAAkB,EAClB,QAAgB,EAChB,KAAa;IAEb,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,UAAoB,EACpB,QAAkB,EAClB,MAAc;IAEd,OAAO;QACL,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;KACjE,CAAC;AACJ,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\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 type { RgbColor } from '@uiw/react-color';\n\n/**\n * Computes a linear interpolation weight in [0, 1] for `value` between\n * `startValue` and `endValue`. Values outside the range produce weights\n * outside [0, 1] — callers are responsible for clamping if needed.\n */\nexport function getWeight(\n startValue: number,\n endValue: number,\n value: number,\n): number {\n return (value - startValue) / (endValue - startValue);\n}\n\n/**\n * Linearly interpolates between two RGB colors by `weight` (0 = start, 1 = end).\n * Each channel is rounded to the nearest integer.\n */\nexport function lerpColor(\n startColor: RgbColor,\n endColor: RgbColor,\n weight: number,\n): RgbColor {\n return {\n b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),\n g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),\n r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),\n };\n}\n"]}