@bigbinary/neetoui 6.2.6 → 6.3.1

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.
package/index.js CHANGED
@@ -223,9 +223,9 @@ const MotionContext = createContext({});
223
223
  */
224
224
  const PresenceContext = createContext(null);
225
225
 
226
- const isBrowser$9 = typeof document !== "undefined";
226
+ const isBrowser$b = typeof document !== "undefined";
227
227
 
228
- const useIsomorphicLayoutEffect$2 = isBrowser$9 ? useLayoutEffect : useEffect;
228
+ const useIsomorphicLayoutEffect$3 = isBrowser$b ? useLayoutEffect : useEffect;
229
229
 
230
230
  const LazyContext = createContext({ strict: false });
231
231
 
@@ -260,7 +260,7 @@ function useVisualElement(Component, visualState, props, createVisualElement) {
260
260
  * was present on initial render - it will be deleted after this.
261
261
  */
262
262
  const canHandoff = useRef(Boolean(window.HandoffAppearAnimations));
263
- useIsomorphicLayoutEffect$2(() => {
263
+ useIsomorphicLayoutEffect$3(() => {
264
264
  if (!visualElement)
265
265
  return;
266
266
  visualElement.render();
@@ -451,7 +451,7 @@ function createMotionComponent({ preloadedFeatures, createVisualElement, useRend
451
451
  const { isStatic } = configAndProps;
452
452
  const context = useCreateMotionContext(props);
453
453
  const visualState = useVisualState(props, isStatic);
454
- if (!isStatic && isBrowser$9) {
454
+ if (!isStatic && isBrowser$b) {
455
455
  /**
456
456
  * Create a VisualElement for this component. A VisualElement provides a common
457
457
  * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as
@@ -2773,7 +2773,7 @@ function calcGeneratorVelocity(resolveValue, t, current) {
2773
2773
  return velocityPerSecond(current - resolveValue(prevT), t - prevT);
2774
2774
  }
2775
2775
 
2776
- const safeMin$1 = 0.001;
2776
+ const safeMin$2 = 0.001;
2777
2777
  const minDuration = 0.01;
2778
2778
  const maxDuration$1 = 10.0;
2779
2779
  const minDamping = 0.05;
@@ -2798,7 +2798,7 @@ function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, })
2798
2798
  const a = exponentialDecay - velocity;
2799
2799
  const b = calcAngularFreq(undampedFreq, dampingRatio);
2800
2800
  const c = Math.exp(-delta);
2801
- return safeMin$1 - (a / b) * c;
2801
+ return safeMin$2 - (a / b) * c;
2802
2802
  };
2803
2803
  derivative = (undampedFreq) => {
2804
2804
  const exponentialDecay = undampedFreq * dampingRatio;
@@ -2807,7 +2807,7 @@ function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, })
2807
2807
  const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;
2808
2808
  const f = Math.exp(-delta);
2809
2809
  const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);
2810
- const factor = -envelope(undampedFreq) + safeMin$1 > 0 ? -1 : 1;
2810
+ const factor = -envelope(undampedFreq) + safeMin$2 > 0 ? -1 : 1;
2811
2811
  return (factor * ((d - e) * f)) / g;
2812
2812
  };
2813
2813
  }
@@ -2818,7 +2818,7 @@ function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, })
2818
2818
  envelope = (undampedFreq) => {
2819
2819
  const a = Math.exp(-undampedFreq * duration);
2820
2820
  const b = (undampedFreq - velocity) * duration + 1;
2821
- return -safeMin$1 + a * b;
2821
+ return -safeMin$2 + a * b;
2822
2822
  };
2823
2823
  derivative = (undampedFreq) => {
2824
2824
  const a = Math.exp(-undampedFreq * duration);
@@ -8343,7 +8343,7 @@ const checkAndConvertChangedValueTypes = (visualElement, target, origin = {}, tr
8343
8343
  // Reapply original values
8344
8344
  visualElement.render();
8345
8345
  // Restore scroll position
8346
- if (isBrowser$9 && scrollY !== null) {
8346
+ if (isBrowser$b && scrollY !== null) {
8347
8347
  window.scrollTo({ top: scrollY });
8348
8348
  }
8349
8349
  return { target: convertedTarget, transitionEnd };
@@ -8382,7 +8382,7 @@ const hasReducedMotionListener = { current: false };
8382
8382
 
8383
8383
  function initPrefersReducedMotion() {
8384
8384
  hasReducedMotionListener.current = true;
8385
- if (!isBrowser$9)
8385
+ if (!isBrowser$b)
8386
8386
  return;
8387
8387
  if (window.matchMedia) {
8388
8388
  const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)");
@@ -9068,7 +9068,7 @@ const motion = /*@__PURE__*/ createMotionProxy((Component, config) => createDomM
9068
9068
 
9069
9069
  function useIsMounted() {
9070
9070
  const isMounted = useRef(false);
9071
- useIsomorphicLayoutEffect$2(() => {
9071
+ useIsomorphicLayoutEffect$3(() => {
9072
9072
  isMounted.current = true;
9073
9073
  return () => {
9074
9074
  isMounted.current = false;
@@ -9278,7 +9278,7 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, exi
9278
9278
  // If this is the initial component render, just deal with logic surrounding whether
9279
9279
  // we play onMount animations or not.
9280
9280
  const isInitialRender = useRef(true);
9281
- useIsomorphicLayoutEffect$2(() => {
9281
+ useIsomorphicLayoutEffect$3(() => {
9282
9282
  isInitialRender.current = false;
9283
9283
  updateChildLookup(filteredChildren, allChildren);
9284
9284
  presentChildren.current = childrenToRender;
@@ -13876,8 +13876,8 @@ function bindGlobalEventListeners() {
13876
13876
  window.addEventListener('blur', onWindowBlur);
13877
13877
  }
13878
13878
 
13879
- var isBrowser$8 = typeof window !== 'undefined' && typeof document !== 'undefined';
13880
- var isIE11 = isBrowser$8 ? // @ts-ignore
13879
+ var isBrowser$a = typeof window !== 'undefined' && typeof document !== 'undefined';
13880
+ var isIE11 = isBrowser$a ? // @ts-ignore
13881
13881
  !!window.msCrypto : false;
13882
13882
 
13883
13883
  var pluginProps = {
@@ -15327,7 +15327,7 @@ function _objectWithoutPropertiesLoose$4(source, excluded) {
15327
15327
  return target;
15328
15328
  }
15329
15329
 
15330
- var isBrowser$7 = typeof window !== 'undefined' && typeof document !== 'undefined';
15330
+ var isBrowser$9 = typeof window !== 'undefined' && typeof document !== 'undefined';
15331
15331
  function preserveRef(ref, node) {
15332
15332
  if (ref) {
15333
15333
  if (typeof ref === 'function') {
@@ -15340,7 +15340,7 @@ function preserveRef(ref, node) {
15340
15340
  }
15341
15341
  }
15342
15342
  function ssrSafeCreateDiv() {
15343
- return isBrowser$7 && document.createElement('div');
15343
+ return isBrowser$9 && document.createElement('div');
15344
15344
  }
15345
15345
  function toDataAttributes(attrs) {
15346
15346
  var dataAttrs = {
@@ -15403,7 +15403,7 @@ function deepPreserveProps(instanceProps, componentProps) {
15403
15403
  });
15404
15404
  }
15405
15405
 
15406
- var useIsomorphicLayoutEffect$1 = isBrowser$7 ? useLayoutEffect : useEffect;
15406
+ var useIsomorphicLayoutEffect$2 = isBrowser$9 ? useLayoutEffect : useEffect;
15407
15407
  function useMutableBox(initialValue) {
15408
15408
  // Using refs instead of state as it's recommended to not store imperative
15409
15409
  // values in state due to memory problems in React(?)
@@ -15542,7 +15542,7 @@ function TippyGenerator(tippy) {
15542
15542
 
15543
15543
  var deps = [reference].concat(children ? [children.type] : []); // CREATE
15544
15544
 
15545
- useIsomorphicLayoutEffect$1(function () {
15545
+ useIsomorphicLayoutEffect$2(function () {
15546
15546
  var element = reference;
15547
15547
 
15548
15548
  if (reference && reference.hasOwnProperty('current')) {
@@ -15577,7 +15577,7 @@ function TippyGenerator(tippy) {
15577
15577
  };
15578
15578
  }, deps); // UPDATE
15579
15579
 
15580
- useIsomorphicLayoutEffect$1(function () {
15580
+ useIsomorphicLayoutEffect$2(function () {
15581
15581
  var _instance$popperInsta;
15582
15582
 
15583
15583
  // Prevent this effect from running on 1st render
@@ -15613,7 +15613,7 @@ function TippyGenerator(tippy) {
15613
15613
  });
15614
15614
  }
15615
15615
  });
15616
- useIsomorphicLayoutEffect$1(function () {
15616
+ useIsomorphicLayoutEffect$2(function () {
15617
15617
  var _instance$props$poppe;
15618
15618
 
15619
15619
  if (!render) {
@@ -15889,7 +15889,7 @@ var Button = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
15889
15889
  });
15890
15890
  Button.displayName = "Button";
15891
15891
 
15892
- var Divider$1 = function Divider(props) {
15892
+ var Divider$2 = function Divider(props) {
15893
15893
  return /*#__PURE__*/React__default.createElement("li", _extends$4({
15894
15894
  className: "neeto-ui-dropdown__popup-divider"
15895
15895
  }, props));
@@ -16162,7 +16162,7 @@ var Dropdown = function Dropdown(_ref2) {
16162
16162
  };
16163
16163
  Dropdown.Menu = Menu$3;
16164
16164
  Dropdown.MenuItem = MenuItem$1;
16165
- Dropdown.Divider = Divider$1;
16165
+ Dropdown.Divider = Divider$2;
16166
16166
 
16167
16167
  var _excluded$D = ["style", "size"];
16168
16168
  var BTN_STYLES = {
@@ -22650,7 +22650,7 @@ var ColorPicker = function ColorPicker(_ref) {
22650
22650
  }, /*#__PURE__*/React__default.createElement(Palette, colorPaletteProps))));
22651
22651
  };
22652
22652
 
22653
- var _excluded$w = ["className", "label", "size", "dropdownClassName", "popupClassName", "dateFormat", "timeFormat", "onChange", "onOk", "picker", "showTime", "type", "nakedInput", "error", "defaultValue", "value", "labelProps", "required", "allowClear"];
22653
+ var _excluded$w = ["className", "label", "size", "dropdownClassName", "popupClassName", "dateFormat", "timeFormat", "onChange", "onOk", "picker", "mode", "showTime", "type", "nakedInput", "error", "defaultValue", "value", "labelProps", "required", "allowClear"];
22654
22654
  function ownKeys$m(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22655
22655
  function _objectSpread$l(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$m(Object(source), !0).forEach(function (key) { _defineProperty$7(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$m(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
22656
22656
  var INPUT_SIZES$2 = {
@@ -22672,43 +22672,59 @@ var IconOverride = function IconOverride(_ref) {
22672
22672
  size: 20
22673
22673
  }));
22674
22674
  };
22675
- var DatePicker = /*#__PURE__*/forwardRef$1(function (_ref2, ref) {
22676
- var _ref2$className = _ref2.className,
22677
- className = _ref2$className === void 0 ? "" : _ref2$className,
22678
- _ref2$label = _ref2.label,
22679
- label = _ref2$label === void 0 ? "" : _ref2$label,
22680
- _ref2$size = _ref2.size,
22681
- size = _ref2$size === void 0 ? INPUT_SIZES$2.medium : _ref2$size,
22682
- _ref2$dropdownClassNa = _ref2.dropdownClassName,
22683
- dropdownClassName = _ref2$dropdownClassNa === void 0 ? "" : _ref2$dropdownClassNa,
22684
- _ref2$popupClassName = _ref2.popupClassName,
22685
- popupClassName = _ref2$popupClassName === void 0 ? "" : _ref2$popupClassName,
22686
- _ref2$dateFormat = _ref2.dateFormat,
22687
- dateFormat = _ref2$dateFormat === void 0 ? "DD/MM/YYYY" : _ref2$dateFormat,
22688
- _ref2$timeFormat = _ref2.timeFormat,
22689
- timeFormat = _ref2$timeFormat === void 0 ? "HH:mm:ss" : _ref2$timeFormat,
22690
- _ref2$onChange = _ref2.onChange,
22691
- onChange = _ref2$onChange === void 0 ? noop$3 : _ref2$onChange,
22692
- _ref2$onOk = _ref2.onOk,
22693
- onOk = _ref2$onOk === void 0 ? noop$3 : _ref2$onOk,
22694
- _ref2$picker = _ref2.picker,
22695
- picker = _ref2$picker === void 0 ? "date" : _ref2$picker,
22696
- _ref2$showTime = _ref2.showTime,
22697
- showTime = _ref2$showTime === void 0 ? false : _ref2$showTime,
22698
- _ref2$type = _ref2.type,
22699
- type = _ref2$type === void 0 ? "date" : _ref2$type,
22700
- _ref2$nakedInput = _ref2.nakedInput,
22701
- nakedInput = _ref2$nakedInput === void 0 ? false : _ref2$nakedInput,
22702
- _ref2$error = _ref2.error,
22703
- error = _ref2$error === void 0 ? "" : _ref2$error,
22704
- defaultValue = _ref2.defaultValue,
22705
- value = _ref2.value,
22706
- labelProps = _ref2.labelProps,
22707
- _ref2$required = _ref2.required,
22708
- required = _ref2$required === void 0 ? false : _ref2$required,
22709
- _ref2$allowClear = _ref2.allowClear,
22710
- allowClear = _ref2$allowClear === void 0 ? true : _ref2$allowClear,
22711
- otherProps = _objectWithoutProperties$1(_ref2, _excluded$w);
22675
+ var Today = function Today(_ref2) {
22676
+ var onClick = _ref2.onClick;
22677
+ return /*#__PURE__*/React__default.createElement("div", {
22678
+ className: "text-center"
22679
+ }, /*#__PURE__*/React__default.createElement("button", {
22680
+ onClick: onClick,
22681
+ className: "neeto-ui-rounded-md hover:neeto-ui-bg-gray-200 px-2 py-1 text-xs font-medium transition duration-300 ease-in-out",
22682
+ "data-cy": "year-month-mode-today"
22683
+ }, "Today"));
22684
+ };
22685
+ var DatePicker = /*#__PURE__*/forwardRef$1(function (_ref3, ref) {
22686
+ var _ref3$className = _ref3.className,
22687
+ className = _ref3$className === void 0 ? "" : _ref3$className,
22688
+ _ref3$label = _ref3.label,
22689
+ label = _ref3$label === void 0 ? "" : _ref3$label,
22690
+ _ref3$size = _ref3.size,
22691
+ size = _ref3$size === void 0 ? INPUT_SIZES$2.medium : _ref3$size,
22692
+ _ref3$dropdownClassNa = _ref3.dropdownClassName,
22693
+ dropdownClassName = _ref3$dropdownClassNa === void 0 ? "" : _ref3$dropdownClassNa,
22694
+ _ref3$popupClassName = _ref3.popupClassName,
22695
+ popupClassName = _ref3$popupClassName === void 0 ? "" : _ref3$popupClassName,
22696
+ _ref3$dateFormat = _ref3.dateFormat,
22697
+ dateFormat = _ref3$dateFormat === void 0 ? "DD/MM/YYYY" : _ref3$dateFormat,
22698
+ _ref3$timeFormat = _ref3.timeFormat,
22699
+ timeFormat = _ref3$timeFormat === void 0 ? "HH:mm:ss" : _ref3$timeFormat,
22700
+ _ref3$onChange = _ref3.onChange,
22701
+ onChange = _ref3$onChange === void 0 ? noop$3 : _ref3$onChange,
22702
+ _ref3$onOk = _ref3.onOk,
22703
+ onOk = _ref3$onOk === void 0 ? noop$3 : _ref3$onOk,
22704
+ _ref3$picker = _ref3.picker,
22705
+ picker = _ref3$picker === void 0 ? "date" : _ref3$picker,
22706
+ _ref3$mode = _ref3.mode,
22707
+ inputMode = _ref3$mode === void 0 ? "date" : _ref3$mode,
22708
+ _ref3$showTime = _ref3.showTime,
22709
+ showTime = _ref3$showTime === void 0 ? false : _ref3$showTime,
22710
+ _ref3$type = _ref3.type,
22711
+ type = _ref3$type === void 0 ? "date" : _ref3$type,
22712
+ _ref3$nakedInput = _ref3.nakedInput,
22713
+ nakedInput = _ref3$nakedInput === void 0 ? false : _ref3$nakedInput,
22714
+ _ref3$error = _ref3.error,
22715
+ error = _ref3$error === void 0 ? "" : _ref3$error,
22716
+ defaultValue = _ref3.defaultValue,
22717
+ value = _ref3.value,
22718
+ labelProps = _ref3.labelProps,
22719
+ _ref3$required = _ref3.required,
22720
+ required = _ref3$required === void 0 ? false : _ref3$required,
22721
+ _ref3$allowClear = _ref3.allowClear,
22722
+ allowClear = _ref3$allowClear === void 0 ? true : _ref3$allowClear,
22723
+ otherProps = _objectWithoutProperties$1(_ref3, _excluded$w);
22724
+ var _useState = useState(inputMode),
22725
+ _useState2 = _slicedToArray$3(_useState, 2),
22726
+ mode = _useState2[0],
22727
+ setMode = _useState2[1];
22712
22728
  var id = useId(otherProps.id);
22713
22729
  var datePickerRef = useSyncedRef(ref);
22714
22730
  var Component = datePickerTypes[type === null || type === void 0 ? void 0 : type.toLowerCase()];
@@ -22717,6 +22733,17 @@ var DatePicker = /*#__PURE__*/forwardRef$1(function (_ref2, ref) {
22717
22733
  var handleOnChange = function handleOnChange(date, dateString) {
22718
22734
  type === "range" && !date ? onChange([], dateString) : onChange(date, dateString);
22719
22735
  };
22736
+ var renderExtraFooter = function renderExtraFooter() {
22737
+ if (type === "range" || mode === "date") return null;
22738
+ return /*#__PURE__*/React__default.createElement(Today, {
22739
+ onClick: function onClick() {
22740
+ setMode("date");
22741
+ setTimeout(function () {
22742
+ document.querySelector(".ant-picker-today-btn").click();
22743
+ });
22744
+ }
22745
+ });
22746
+ };
22720
22747
  return /*#__PURE__*/React__default.createElement(_ConfigProvider, {
22721
22748
  theme: {
22722
22749
  token: _objectSpread$l({}, ANT_DESIGN_GLOBAL_TOKEN_OVERRIDES),
@@ -22773,9 +22800,6 @@ var DatePicker = /*#__PURE__*/forwardRef$1(function (_ref2, ref) {
22773
22800
  }, label && /*#__PURE__*/React__default.createElement(Label, _objectSpread$l({
22774
22801
  required: required
22775
22802
  }, labelProps), label), /*#__PURE__*/React__default.createElement(Component, _extends$4({
22776
- format: format,
22777
- onOk: onOk,
22778
- picker: picker,
22779
22803
  "data-cy": label ? "".concat(hyphenize(label), "-input") : "picker-input",
22780
22804
  defaultValue: convertToDayjsObjects(defaultValue),
22781
22805
  ref: datePickerRef,
@@ -22795,7 +22819,17 @@ var DatePicker = /*#__PURE__*/forwardRef$1(function (_ref2, ref) {
22795
22819
  // Will be removed in the next major version
22796
22820
  popupClassName]),
22797
22821
  onChange: handleOnChange
22798
- }, otherProps, {
22822
+ }, _objectSpread$l(_objectSpread$l({
22823
+ format: format,
22824
+ onOk: onOk,
22825
+ picker: picker
22826
+ }, otherProps), type === "date" && {
22827
+ mode: mode,
22828
+ renderExtraFooter: renderExtraFooter,
22829
+ onPanelChange: function onPanelChange(_, mode) {
22830
+ return setMode(mode);
22831
+ }
22832
+ }), {
22799
22833
  nextIcon: /*#__PURE__*/React__default.createElement(IconOverride, {
22800
22834
  icon: Right
22801
22835
  }),
@@ -22833,7 +22867,7 @@ var customParseFormat$1 = {exports: {}};
22833
22867
 
22834
22868
  var customParseFormat = customParseFormat$1.exports;
22835
22869
 
22836
- var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
22870
+ var __spreadArray$3 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
22837
22871
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
22838
22872
  if (ar || !(i in from)) {
22839
22873
  if (!ar) ar = Array.prototype.slice.call(from, 0, i);
@@ -22924,7 +22958,7 @@ var animationEvents = [
22924
22958
  var transitionEvents = ['onTransitionEnd'];
22925
22959
  var otherEvents = ['onToggle'];
22926
22960
  var changeEvents = ['onChange'];
22927
- var allEvents = __spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2(__spreadArray$2([], clipboardEvents, true), compositionEvents, true), focusEvents, true), formEvents, true), imageEvents, true), keyboardEvents, true), mediaEvents, true), mouseEvents, true), dragEvents, true), selectionEvents, true), touchEvents, true), pointerEvents, true), uiEvents, true), wheelEvents, true), animationEvents, true), transitionEvents, true), changeEvents, true), otherEvents, true);
22961
+ var allEvents = __spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3(__spreadArray$3([], clipboardEvents, true), compositionEvents, true), focusEvents, true), formEvents, true), imageEvents, true), keyboardEvents, true), mediaEvents, true), mouseEvents, true), dragEvents, true), selectionEvents, true), touchEvents, true), pointerEvents, true), uiEvents, true), wheelEvents, true), animationEvents, true), transitionEvents, true), changeEvents, true), otherEvents, true);
22928
22962
  /**
22929
22963
  * Returns an object with on-event callback props curried with provided args.
22930
22964
  * @param {Object} props Props passed to a component.
@@ -22950,8 +22984,6 @@ function makeEventProps(props, getArgs) {
22950
22984
  return eventProps;
22951
22985
  }
22952
22986
 
22953
- function r$3(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r$3(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx$2(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r$3(e))&&(n&&(n+=" "),n+=t);return n}
22954
-
22955
22987
  function r$2(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r$2(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx$1(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r$2(e))&&(n&&(n+=" "),n+=t);return n}
22956
22988
 
22957
22989
  /**
@@ -23108,8 +23140,8 @@ function Mark(_a) {
23108
23140
  } }, number)) : null));
23109
23141
  }
23110
23142
 
23111
- var __assign$8 = (undefined && undefined.__assign) || function () {
23112
- __assign$8 = Object.assign || function(t) {
23143
+ var __assign$e = (undefined && undefined.__assign) || function () {
23144
+ __assign$e = Object.assign || function(t) {
23113
23145
  for (var s, i = 1, n = arguments.length; i < n; i++) {
23114
23146
  s = arguments[i];
23115
23147
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -23117,10 +23149,10 @@ var __assign$8 = (undefined && undefined.__assign) || function () {
23117
23149
  }
23118
23150
  return t;
23119
23151
  };
23120
- return __assign$8.apply(this, arguments);
23152
+ return __assign$e.apply(this, arguments);
23121
23153
  };
23122
23154
  var MinuteMark = memo$1(function MinuteMark(props) {
23123
- return React__default.createElement(Mark, __assign$8({}, props));
23155
+ return React__default.createElement(Mark, __assign$e({}, props));
23124
23156
  });
23125
23157
 
23126
23158
  /**
@@ -23868,8 +23900,8 @@ function formatHour(locale, hour) {
23868
23900
  return hour.toLocaleString(locale || getUserLocale() || undefined);
23869
23901
  }
23870
23902
 
23871
- var __assign$7 = (undefined && undefined.__assign) || function () {
23872
- __assign$7 = Object.assign || function(t) {
23903
+ var __assign$d = (undefined && undefined.__assign) || function () {
23904
+ __assign$d = Object.assign || function(t) {
23873
23905
  for (var s, i = 1, n = arguments.length; i < n; i++) {
23874
23906
  s = arguments[i];
23875
23907
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -23877,9 +23909,9 @@ var __assign$7 = (undefined && undefined.__assign) || function () {
23877
23909
  }
23878
23910
  return t;
23879
23911
  };
23880
- return __assign$7.apply(this, arguments);
23912
+ return __assign$d.apply(this, arguments);
23881
23913
  };
23882
- var __rest$6 = (undefined && undefined.__rest) || function (s, e) {
23914
+ var __rest$b = (undefined && undefined.__rest) || function (s, e) {
23883
23915
  var t = {};
23884
23916
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
23885
23917
  t[p] = s[p];
@@ -23891,8 +23923,8 @@ var __rest$6 = (undefined && undefined.__rest) || function (s, e) {
23891
23923
  return t;
23892
23924
  };
23893
23925
  var HourMark = memo$1(function HourMark(_a) {
23894
- var _b = _a.formatHour, formatHour$1 = _b === void 0 ? formatHour : _b, locale = _a.locale, number = _a.number, otherProps = __rest$6(_a, ["formatHour", "locale", "number"]);
23895
- return React__default.createElement(Mark, __assign$7({ number: number ? formatHour$1(locale, number) : null }, otherProps));
23926
+ var _b = _a.formatHour, formatHour$1 = _b === void 0 ? formatHour : _b, locale = _a.locale, number = _a.number, otherProps = __rest$b(_a, ["formatHour", "locale", "number"]);
23927
+ return React__default.createElement(Mark, __assign$d({ number: number ? formatHour$1(locale, number) : null }, otherProps));
23896
23928
  });
23897
23929
 
23898
23930
  function isNumberBetween(min, max) {
@@ -24072,8 +24104,8 @@ var __extends = (undefined && undefined.__extends) || (function () {
24072
24104
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
24073
24105
  };
24074
24106
  })();
24075
- var __assign$6 = (undefined && undefined.__assign) || function () {
24076
- __assign$6 = Object.assign || function(t) {
24107
+ var __assign$c = (undefined && undefined.__assign) || function () {
24108
+ __assign$c = Object.assign || function(t) {
24077
24109
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24078
24110
  s = arguments[i];
24079
24111
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24081,9 +24113,9 @@ var __assign$6 = (undefined && undefined.__assign) || function () {
24081
24113
  }
24082
24114
  return t;
24083
24115
  };
24084
- return __assign$6.apply(this, arguments);
24116
+ return __assign$c.apply(this, arguments);
24085
24117
  };
24086
- var __rest$5 = (undefined && undefined.__rest) || function (s, e) {
24118
+ var __rest$a = (undefined && undefined.__rest) || function (s, e) {
24087
24119
  var t = {};
24088
24120
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24089
24121
  t[p] = s[p];
@@ -24094,9 +24126,9 @@ var __rest$5 = (undefined && undefined.__rest) || function (s, e) {
24094
24126
  }
24095
24127
  return t;
24096
24128
  };
24097
- var isBrowser$6 = typeof document !== 'undefined';
24098
- var isDisplayContentsSupported = isBrowser$6 && 'CSS' in window && 'supports' in window.CSS && CSS.supports('display', 'contents');
24099
- var isMutationObserverSupported = isBrowser$6 && 'MutationObserver' in window;
24129
+ var isBrowser$8 = typeof document !== 'undefined';
24130
+ var isDisplayContentsSupported = isBrowser$8 && 'CSS' in window && 'supports' in window.CSS && CSS.supports('display', 'contents');
24131
+ var isMutationObserverSupported = isBrowser$8 && 'MutationObserver' in window;
24100
24132
  function capitalize(string) {
24101
24133
  return (string.charAt(0).toUpperCase() + string.slice(1));
24102
24134
  }
@@ -24196,12 +24228,12 @@ function alignMainAxis(args) {
24196
24228
  alignAxis(args);
24197
24229
  }
24198
24230
  function alignSecondaryAxis(args) {
24199
- alignAxis(__assign$6(__assign$6({}, args), { axis: args.axis === 'x' ? 'y' : 'x', secondary: true }));
24231
+ alignAxis(__assign$c(__assign$c({}, args), { axis: args.axis === 'x' ? 'y' : 'x', secondary: true }));
24200
24232
  }
24201
24233
  function alignBothAxis(args) {
24202
- var invertAxis = args.invertAxis, invertSecondaryAxis = args.invertSecondaryAxis, commonArgs = __rest$5(args, ["invertAxis", "invertSecondaryAxis"]);
24203
- alignMainAxis(__assign$6(__assign$6({}, commonArgs), { invertAxis: invertAxis }));
24204
- alignSecondaryAxis(__assign$6(__assign$6({}, commonArgs), { invertAxis: invertSecondaryAxis }));
24234
+ var invertAxis = args.invertAxis, invertSecondaryAxis = args.invertSecondaryAxis, commonArgs = __rest$a(args, ["invertAxis", "invertSecondaryAxis"]);
24235
+ alignMainAxis(__assign$c(__assign$c({}, commonArgs), { invertAxis: invertAxis }));
24236
+ alignSecondaryAxis(__assign$c(__assign$c({}, commonArgs), { invertAxis: invertSecondaryAxis }));
24205
24237
  }
24206
24238
  var Fit = /** @class */ (function (_super) {
24207
24239
  __extends(Fit, _super);
@@ -24316,7 +24348,7 @@ var Fit = /** @class */ (function (_super) {
24316
24348
  return Fit;
24317
24349
  }(Component));
24318
24350
 
24319
- function Divider(_a) {
24351
+ function Divider$1(_a) {
24320
24352
  var children = _a.children;
24321
24353
  return React__default.createElement("span", { className: "react-time-picker__inputGroup__divider" }, children);
24322
24354
  }
@@ -24378,20 +24410,20 @@ function updateInputWidth(element) {
24378
24410
  return width;
24379
24411
  }
24380
24412
 
24381
- var isBrowser$5 = typeof document !== 'undefined';
24382
- var useIsomorphicLayoutEffect = isBrowser$5 ? useLayoutEffect : useEffect;
24383
- var isIEOrEdgeLegacy = isBrowser$5 && /(MSIE|Trident\/|Edge\/)/.test(navigator.userAgent);
24384
- var isFirefox = isBrowser$5 && /Firefox/.test(navigator.userAgent);
24385
- function onFocus(event) {
24413
+ var isBrowser$7 = typeof document !== 'undefined';
24414
+ var useIsomorphicLayoutEffect$1 = isBrowser$7 ? useLayoutEffect : useEffect;
24415
+ var isIEOrEdgeLegacy$1 = isBrowser$7 && /(MSIE|Trident\/|Edge\/)/.test(navigator.userAgent);
24416
+ var isFirefox$1 = isBrowser$7 && /Firefox/.test(navigator.userAgent);
24417
+ function onFocus$1(event) {
24386
24418
  var target = event.target;
24387
- if (isIEOrEdgeLegacy) {
24419
+ if (isIEOrEdgeLegacy$1) {
24388
24420
  requestAnimationFrame(function () { return target.select(); });
24389
24421
  }
24390
24422
  else {
24391
24423
  target.select();
24392
24424
  }
24393
24425
  }
24394
- function updateInputWidthOnLoad(element) {
24426
+ function updateInputWidthOnLoad$1(element) {
24395
24427
  if (document.readyState === 'complete') {
24396
24428
  return;
24397
24429
  }
@@ -24400,7 +24432,7 @@ function updateInputWidthOnLoad(element) {
24400
24432
  }
24401
24433
  window.addEventListener('load', onLoad);
24402
24434
  }
24403
- function updateInputWidthOnFontLoad(element) {
24435
+ function updateInputWidthOnFontLoad$1(element) {
24404
24436
  if (!document.fonts) {
24405
24437
  return;
24406
24438
  }
@@ -24417,7 +24449,7 @@ function updateInputWidthOnFontLoad(element) {
24417
24449
  }
24418
24450
  document.fonts.addEventListener('loadingdone', onLoadingDone);
24419
24451
  }
24420
- function getSelectionString(input) {
24452
+ function getSelectionString$1(input) {
24421
24453
  /**
24422
24454
  * window.getSelection().toString() returns empty string in IE11 and Firefox,
24423
24455
  * so alternatives come first.
@@ -24435,7 +24467,7 @@ function getSelectionString(input) {
24435
24467
  }
24436
24468
  return null;
24437
24469
  }
24438
- function makeOnKeyPress(maxLength) {
24470
+ function makeOnKeyPress$1(maxLength) {
24439
24471
  if (maxLength === null) {
24440
24472
  return undefined;
24441
24473
  }
@@ -24444,28 +24476,28 @@ function makeOnKeyPress(maxLength) {
24444
24476
  * exceed maxLength.
24445
24477
  */
24446
24478
  return function onKeyPress(event) {
24447
- if (isFirefox) {
24479
+ if (isFirefox$1) {
24448
24480
  // See https://github.com/wojtekmaj/react-time-picker/issues/92
24449
24481
  return;
24450
24482
  }
24451
24483
  var key = event.key, input = event.target;
24452
24484
  var value = input.value;
24453
24485
  var isNumberKey = key.length === 1 && /\d/.test(key);
24454
- var selection = getSelectionString(input);
24486
+ var selection = getSelectionString$1(input);
24455
24487
  if (!isNumberKey || !(selection || value.length < maxLength)) {
24456
24488
  event.preventDefault();
24457
24489
  }
24458
24490
  };
24459
24491
  }
24460
- function Input$3(_a) {
24492
+ function Input$4(_a) {
24461
24493
  var ariaLabel = _a.ariaLabel, autoFocus = _a.autoFocus, className = _a.className, disabled = _a.disabled, inputRef = _a.inputRef, max = _a.max, min = _a.min, name = _a.name, nameForClass = _a.nameForClass, onChange = _a.onChange, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, _b = _a.placeholder, placeholder = _b === void 0 ? '--' : _b, required = _a.required, showLeadingZeros = _a.showLeadingZeros, step = _a.step, value = _a.value;
24462
- useIsomorphicLayoutEffect(function () {
24494
+ useIsomorphicLayoutEffect$1(function () {
24463
24495
  if (!inputRef || !inputRef.current) {
24464
24496
  return;
24465
24497
  }
24466
24498
  updateInputWidth(inputRef.current);
24467
- updateInputWidthOnLoad(inputRef.current);
24468
- updateInputWidthOnFontLoad(inputRef.current);
24499
+ updateInputWidthOnLoad$1(inputRef.current);
24500
+ updateInputWidthOnFontLoad$1(inputRef.current);
24469
24501
  }, [inputRef, value]);
24470
24502
  var hasLeadingZero = showLeadingZeros &&
24471
24503
  value &&
@@ -24474,7 +24506,7 @@ function Input$3(_a) {
24474
24506
  var maxLength = max ? max.toString().length : null;
24475
24507
  return (React__default.createElement(React__default.Fragment, null,
24476
24508
  hasLeadingZero ? React__default.createElement("span", { className: "".concat(className, "__leadingZero") }, "0") : null,
24477
- React__default.createElement("input", { "aria-label": ariaLabel, autoComplete: "off", autoFocus: autoFocus, className: clsx$2("".concat(className, "__input"), "".concat(className, "__").concat(nameForClass || name), hasLeadingZero && "".concat(className, "__input--hasLeadingZero")), "data-input": "true", disabled: disabled, inputMode: "numeric", max: max, min: min, name: name, onChange: onChange, onFocus: onFocus, onKeyDown: onKeyDown, onKeyPress: makeOnKeyPress(maxLength), onKeyUp: function (event) {
24509
+ React__default.createElement("input", { "aria-label": ariaLabel, autoComplete: "off", autoFocus: autoFocus, className: clsx$1("".concat(className, "__input"), "".concat(className, "__").concat(nameForClass || name), hasLeadingZero && "".concat(className, "__input--hasLeadingZero")), "data-input": "true", disabled: disabled, inputMode: "numeric", max: max, min: min, name: name, onChange: onChange, onFocus: onFocus$1, onKeyDown: onKeyDown, onKeyPress: makeOnKeyPress$1(maxLength), onKeyUp: function (event) {
24478
24510
  updateInputWidth(event.target);
24479
24511
  if (onKeyUp) {
24480
24512
  onKeyUp(event);
@@ -24482,7 +24514,7 @@ function Input$3(_a) {
24482
24514
  }, placeholder: placeholder, ref: inputRef, required: required, step: step, type: "number", value: value !== null ? value : '' })));
24483
24515
  }
24484
24516
 
24485
- function convert12to24(hour12, amPm) {
24517
+ function convert12to24$1(hour12, amPm) {
24486
24518
  var hour24 = Number(hour12);
24487
24519
  if (amPm === 'am' && hour24 === 12) {
24488
24520
  hour24 = 0;
@@ -24492,33 +24524,33 @@ function convert12to24(hour12, amPm) {
24492
24524
  }
24493
24525
  return hour24;
24494
24526
  }
24495
- function convert24to12(hour24) {
24527
+ function convert24to12$1(hour24) {
24496
24528
  var hour12 = Number(hour24) % 12 || 12;
24497
24529
  return [hour12, Number(hour24) < 12 ? 'am' : 'pm'];
24498
24530
  }
24499
24531
 
24500
- var formatterCache = new Map();
24501
- function getFormatter(options) {
24532
+ var formatterCache$1 = new Map();
24533
+ function getFormatter$1(options) {
24502
24534
  return function formatter(locale, date) {
24503
24535
  var localeWithDefault = locale || getUserLocale();
24504
- if (!formatterCache.has(localeWithDefault)) {
24505
- formatterCache.set(localeWithDefault, new Map());
24536
+ if (!formatterCache$1.has(localeWithDefault)) {
24537
+ formatterCache$1.set(localeWithDefault, new Map());
24506
24538
  }
24507
- var formatterCacheLocale = formatterCache.get(localeWithDefault);
24539
+ var formatterCacheLocale = formatterCache$1.get(localeWithDefault);
24508
24540
  if (!formatterCacheLocale.has(options)) {
24509
24541
  formatterCacheLocale.set(options, new Intl.DateTimeFormat(localeWithDefault || undefined, options).format);
24510
24542
  }
24511
24543
  return formatterCacheLocale.get(options)(date);
24512
24544
  };
24513
24545
  }
24514
- var numberFormatterCache = new Map();
24515
- function getNumberFormatter(options) {
24546
+ var numberFormatterCache$1 = new Map();
24547
+ function getNumberFormatter$1(options) {
24516
24548
  return function (locale, number) {
24517
24549
  var localeWithDefault = locale || getUserLocale();
24518
- if (!numberFormatterCache.has(localeWithDefault)) {
24519
- numberFormatterCache.set(localeWithDefault, new Map());
24550
+ if (!numberFormatterCache$1.has(localeWithDefault)) {
24551
+ numberFormatterCache$1.set(localeWithDefault, new Map());
24520
24552
  }
24521
- var numberFormatterCacheLocale = numberFormatterCache.get(localeWithDefault);
24553
+ var numberFormatterCacheLocale = numberFormatterCache$1.get(localeWithDefault);
24522
24554
  if (!numberFormatterCacheLocale.has(options)) {
24523
24555
  numberFormatterCacheLocale.set(options, new Intl.NumberFormat(localeWithDefault || undefined, options).format);
24524
24556
  }
@@ -24526,14 +24558,14 @@ function getNumberFormatter(options) {
24526
24558
  };
24527
24559
  }
24528
24560
 
24529
- var nines = ['9', '٩'];
24530
- var ninesRegExp = new RegExp("[".concat(nines.join(''), "]"));
24531
- var amPmFormatter = getFormatter({ hour: 'numeric' });
24532
- function getAmPmLabels(locale) {
24533
- var amString = amPmFormatter(locale, new Date(2017, 0, 1, 9));
24534
- var pmString = amPmFormatter(locale, new Date(2017, 0, 1, 21));
24535
- var _a = amString.split(ninesRegExp), am1 = _a[0], am2 = _a[1];
24536
- var _b = pmString.split(ninesRegExp), pm1 = _b[0], pm2 = _b[1];
24561
+ var nines$1 = ['9', '٩'];
24562
+ var ninesRegExp$1 = new RegExp("[".concat(nines$1.join(''), "]"));
24563
+ var amPmFormatter$1 = getFormatter$1({ hour: 'numeric' });
24564
+ function getAmPmLabels$1(locale) {
24565
+ var amString = amPmFormatter$1(locale, new Date(2017, 0, 1, 9));
24566
+ var pmString = amPmFormatter$1(locale, new Date(2017, 0, 1, 21));
24567
+ var _a = amString.split(ninesRegExp$1), am1 = _a[0], am2 = _a[1];
24568
+ var _b = pmString.split(ninesRegExp$1), pm1 = _b[0], pm2 = _b[1];
24537
24569
  if (pm2 !== undefined) {
24538
24570
  // If pm2 is undefined, nine was not found in pmString - this locale is not using 12-hour time
24539
24571
  if (am1 !== pm1) {
@@ -24546,26 +24578,26 @@ function getAmPmLabels(locale) {
24546
24578
  // Fallback
24547
24579
  return ['AM', 'PM'];
24548
24580
  }
24549
- function isValidNumber(num) {
24581
+ function isValidNumber$1(num) {
24550
24582
  return num !== null && num !== false && !Number.isNaN(Number(num));
24551
24583
  }
24552
- function safeMin() {
24584
+ function safeMin$1() {
24553
24585
  var args = [];
24554
24586
  for (var _i = 0; _i < arguments.length; _i++) {
24555
24587
  args[_i] = arguments[_i];
24556
24588
  }
24557
- return Math.min.apply(Math, args.filter(isValidNumber));
24589
+ return Math.min.apply(Math, args.filter(isValidNumber$1));
24558
24590
  }
24559
- function safeMax() {
24591
+ function safeMax$1() {
24560
24592
  var args = [];
24561
24593
  for (var _i = 0; _i < arguments.length; _i++) {
24562
24594
  args[_i] = arguments[_i];
24563
24595
  }
24564
- return Math.max.apply(Math, args.filter(isValidNumber));
24596
+ return Math.max.apply(Math, args.filter(isValidNumber$1));
24565
24597
  }
24566
24598
 
24567
- var __assign$5 = (undefined && undefined.__assign) || function () {
24568
- __assign$5 = Object.assign || function(t) {
24599
+ var __assign$b = (undefined && undefined.__assign) || function () {
24600
+ __assign$b = Object.assign || function(t) {
24569
24601
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24570
24602
  s = arguments[i];
24571
24603
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24573,9 +24605,9 @@ var __assign$5 = (undefined && undefined.__assign) || function () {
24573
24605
  }
24574
24606
  return t;
24575
24607
  };
24576
- return __assign$5.apply(this, arguments);
24608
+ return __assign$b.apply(this, arguments);
24577
24609
  };
24578
- var __rest$4 = (undefined && undefined.__rest) || function (s, e) {
24610
+ var __rest$9 = (undefined && undefined.__rest) || function (s, e) {
24579
24611
  var t = {};
24580
24612
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24581
24613
  t[p] = s[p];
@@ -24586,20 +24618,20 @@ var __rest$4 = (undefined && undefined.__rest) || function (s, e) {
24586
24618
  }
24587
24619
  return t;
24588
24620
  };
24589
- function Hour12Input(_a) {
24590
- var amPm = _a.amPm, maxTime = _a.maxTime, minTime = _a.minTime, value = _a.value, otherProps = __rest$4(_a, ["amPm", "maxTime", "minTime", "value"]);
24591
- var maxHour = safeMin(12, maxTime &&
24621
+ function Hour12Input$1(_a) {
24622
+ var amPm = _a.amPm, maxTime = _a.maxTime, minTime = _a.minTime, value = _a.value, otherProps = __rest$9(_a, ["amPm", "maxTime", "minTime", "value"]);
24623
+ var maxHour = safeMin$1(12, maxTime &&
24592
24624
  (function () {
24593
- var _a = convert24to12(getHours(maxTime)), maxHourResult = _a[0], maxAmPm = _a[1];
24625
+ var _a = convert24to12$1(getHours(maxTime)), maxHourResult = _a[0], maxAmPm = _a[1];
24594
24626
  if (maxAmPm !== amPm) {
24595
24627
  // pm is always after am, so we should ignore validation
24596
24628
  return null;
24597
24629
  }
24598
24630
  return maxHourResult;
24599
24631
  })());
24600
- var minHour = safeMax(1, minTime &&
24632
+ var minHour = safeMax$1(1, minTime &&
24601
24633
  (function () {
24602
- var _a = convert24to12(getHours(minTime)), minHourResult = _a[0], minAmPm = _a[1];
24634
+ var _a = convert24to12$1(getHours(minTime)), minHourResult = _a[0], minAmPm = _a[1];
24603
24635
  if (
24604
24636
  // pm is always after am, so we should ignore validation
24605
24637
  minAmPm !== amPm ||
@@ -24609,12 +24641,12 @@ function Hour12Input(_a) {
24609
24641
  }
24610
24642
  return minHourResult;
24611
24643
  })());
24612
- var value12 = value ? convert24to12(value)[0].toString() : '';
24613
- return (React__default.createElement(Input$3, __assign$5({ max: maxHour, min: minHour, name: "hour12", nameForClass: "hour", value: value12 }, otherProps)));
24644
+ var value12 = value ? convert24to12$1(value)[0].toString() : '';
24645
+ return (React__default.createElement(Input$4, __assign$b({ max: maxHour, min: minHour, name: "hour12", nameForClass: "hour", value: value12 }, otherProps)));
24614
24646
  }
24615
24647
 
24616
- var __assign$4 = (undefined && undefined.__assign) || function () {
24617
- __assign$4 = Object.assign || function(t) {
24648
+ var __assign$a = (undefined && undefined.__assign) || function () {
24649
+ __assign$a = Object.assign || function(t) {
24618
24650
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24619
24651
  s = arguments[i];
24620
24652
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24622,9 +24654,9 @@ var __assign$4 = (undefined && undefined.__assign) || function () {
24622
24654
  }
24623
24655
  return t;
24624
24656
  };
24625
- return __assign$4.apply(this, arguments);
24657
+ return __assign$a.apply(this, arguments);
24626
24658
  };
24627
- var __rest$3 = (undefined && undefined.__rest) || function (s, e) {
24659
+ var __rest$8 = (undefined && undefined.__rest) || function (s, e) {
24628
24660
  var t = {};
24629
24661
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24630
24662
  t[p] = s[p];
@@ -24635,15 +24667,15 @@ var __rest$3 = (undefined && undefined.__rest) || function (s, e) {
24635
24667
  }
24636
24668
  return t;
24637
24669
  };
24638
- function Hour24Input(_a) {
24639
- var maxTime = _a.maxTime, minTime = _a.minTime, otherProps = __rest$3(_a, ["maxTime", "minTime"]);
24640
- var maxHour = safeMin(23, maxTime && getHours(maxTime));
24641
- var minHour = safeMax(0, minTime && getHours(minTime));
24642
- return React__default.createElement(Input$3, __assign$4({ max: maxHour, min: minHour, name: "hour24", nameForClass: "hour" }, otherProps));
24670
+ function Hour24Input$1(_a) {
24671
+ var maxTime = _a.maxTime, minTime = _a.minTime, otherProps = __rest$8(_a, ["maxTime", "minTime"]);
24672
+ var maxHour = safeMin$1(23, maxTime && getHours(maxTime));
24673
+ var minHour = safeMax$1(0, minTime && getHours(minTime));
24674
+ return React__default.createElement(Input$4, __assign$a({ max: maxHour, min: minHour, name: "hour24", nameForClass: "hour" }, otherProps));
24643
24675
  }
24644
24676
 
24645
- var __assign$3 = (undefined && undefined.__assign) || function () {
24646
- __assign$3 = Object.assign || function(t) {
24677
+ var __assign$9 = (undefined && undefined.__assign) || function () {
24678
+ __assign$9 = Object.assign || function(t) {
24647
24679
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24648
24680
  s = arguments[i];
24649
24681
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24651,9 +24683,9 @@ var __assign$3 = (undefined && undefined.__assign) || function () {
24651
24683
  }
24652
24684
  return t;
24653
24685
  };
24654
- return __assign$3.apply(this, arguments);
24686
+ return __assign$9.apply(this, arguments);
24655
24687
  };
24656
- var __rest$2 = (undefined && undefined.__rest) || function (s, e) {
24688
+ var __rest$7 = (undefined && undefined.__rest) || function (s, e) {
24657
24689
  var t = {};
24658
24690
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24659
24691
  t[p] = s[p];
@@ -24664,18 +24696,18 @@ var __rest$2 = (undefined && undefined.__rest) || function (s, e) {
24664
24696
  }
24665
24697
  return t;
24666
24698
  };
24667
- function MinuteInput(_a) {
24668
- var hour = _a.hour, maxTime = _a.maxTime, minTime = _a.minTime, _b = _a.showLeadingZeros, showLeadingZeros = _b === void 0 ? true : _b, otherProps = __rest$2(_a, ["hour", "maxTime", "minTime", "showLeadingZeros"]);
24699
+ function MinuteInput$1(_a) {
24700
+ var hour = _a.hour, maxTime = _a.maxTime, minTime = _a.minTime, _b = _a.showLeadingZeros, showLeadingZeros = _b === void 0 ? true : _b, otherProps = __rest$7(_a, ["hour", "maxTime", "minTime", "showLeadingZeros"]);
24669
24701
  function isSameHour(date) {
24670
24702
  return hour === getHours(date).toString();
24671
24703
  }
24672
- var maxMinute = safeMin(59, maxTime && isSameHour(maxTime) && getMinutes(maxTime));
24673
- var minMinute = safeMax(0, minTime && isSameHour(minTime) && getMinutes(minTime));
24674
- return (React__default.createElement(Input$3, __assign$3({ max: maxMinute, min: minMinute, name: "minute", showLeadingZeros: showLeadingZeros }, otherProps)));
24704
+ var maxMinute = safeMin$1(59, maxTime && isSameHour(maxTime) && getMinutes(maxTime));
24705
+ var minMinute = safeMax$1(0, minTime && isSameHour(minTime) && getMinutes(minTime));
24706
+ return (React__default.createElement(Input$4, __assign$9({ max: maxMinute, min: minMinute, name: "minute", showLeadingZeros: showLeadingZeros }, otherProps)));
24675
24707
  }
24676
24708
 
24677
- var __assign$2 = (undefined && undefined.__assign) || function () {
24678
- __assign$2 = Object.assign || function(t) {
24709
+ var __assign$8 = (undefined && undefined.__assign) || function () {
24710
+ __assign$8 = Object.assign || function(t) {
24679
24711
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24680
24712
  s = arguments[i];
24681
24713
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24683,9 +24715,9 @@ var __assign$2 = (undefined && undefined.__assign) || function () {
24683
24715
  }
24684
24716
  return t;
24685
24717
  };
24686
- return __assign$2.apply(this, arguments);
24718
+ return __assign$8.apply(this, arguments);
24687
24719
  };
24688
- var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
24720
+ var __rest$6 = (undefined && undefined.__rest) || function (s, e) {
24689
24721
  var t = {};
24690
24722
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24691
24723
  t[p] = s[p];
@@ -24696,17 +24728,17 @@ var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
24696
24728
  }
24697
24729
  return t;
24698
24730
  };
24699
- function SecondInput(_a) {
24700
- var hour = _a.hour, maxTime = _a.maxTime, minTime = _a.minTime, minute = _a.minute, _b = _a.showLeadingZeros, showLeadingZeros = _b === void 0 ? true : _b, otherProps = __rest$1(_a, ["hour", "maxTime", "minTime", "minute", "showLeadingZeros"]);
24731
+ function SecondInput$1(_a) {
24732
+ var hour = _a.hour, maxTime = _a.maxTime, minTime = _a.minTime, minute = _a.minute, _b = _a.showLeadingZeros, showLeadingZeros = _b === void 0 ? true : _b, otherProps = __rest$6(_a, ["hour", "maxTime", "minTime", "minute", "showLeadingZeros"]);
24701
24733
  function isSameMinute(date) {
24702
24734
  return hour === getHours(date).toString() && minute === getMinutes(date).toString();
24703
24735
  }
24704
- var maxSecond = safeMin(59, maxTime && isSameMinute(maxTime) && getSeconds(maxTime));
24705
- var minSecond = safeMax(0, minTime && isSameMinute(minTime) && getSeconds(minTime));
24706
- return (React__default.createElement(Input$3, __assign$2({ max: maxSecond, min: minSecond, name: "second", showLeadingZeros: showLeadingZeros }, otherProps)));
24736
+ var maxSecond = safeMin$1(59, maxTime && isSameMinute(maxTime) && getSeconds(maxTime));
24737
+ var minSecond = safeMax$1(0, minTime && isSameMinute(minTime) && getSeconds(minTime));
24738
+ return (React__default.createElement(Input$4, __assign$8({ max: maxSecond, min: minSecond, name: "second", showLeadingZeros: showLeadingZeros }, otherProps)));
24707
24739
  }
24708
24740
 
24709
- function NativeInput(_a) {
24741
+ function NativeInput$1(_a) {
24710
24742
  var ariaLabel = _a.ariaLabel, disabled = _a.disabled, maxTime = _a.maxTime, minTime = _a.minTime, name = _a.name, onChange = _a.onChange, required = _a.required, value = _a.value, valueType = _a.valueType;
24711
24743
  var nativeValueParser = (function () {
24712
24744
  switch (valueType) {
@@ -24742,20 +24774,20 @@ function NativeInput(_a) {
24742
24774
  }, type: "time", value: value ? nativeValueParser(value) : '' }));
24743
24775
  }
24744
24776
 
24745
- function AmPm(_a) {
24777
+ function AmPm$1(_a) {
24746
24778
  var ariaLabel = _a.ariaLabel, autoFocus = _a.autoFocus, className = _a.className, disabled = _a.disabled, inputRef = _a.inputRef, locale = _a.locale, maxTime = _a.maxTime, minTime = _a.minTime, onChange = _a.onChange, onKeyDown = _a.onKeyDown, required = _a.required, value = _a.value;
24747
- var amDisabled = minTime ? convert24to12(getHours(minTime))[1] === 'pm' : false;
24748
- var pmDisabled = maxTime ? convert24to12(getHours(maxTime))[1] === 'am' : false;
24779
+ var amDisabled = minTime ? convert24to12$1(getHours(minTime))[1] === 'pm' : false;
24780
+ var pmDisabled = maxTime ? convert24to12$1(getHours(maxTime))[1] === 'am' : false;
24749
24781
  var name = 'amPm';
24750
- var _b = getAmPmLabels(locale), amLabel = _b[0], pmLabel = _b[1];
24751
- return (React__default.createElement("select", { "aria-label": ariaLabel, autoFocus: autoFocus, className: clsx$2("".concat(className, "__input"), "".concat(className, "__").concat(name)), "data-input": "true", "data-select": "true", disabled: disabled, name: name, onChange: onChange, onKeyDown: onKeyDown, ref: inputRef, required: required, value: value !== null ? value : '' },
24782
+ var _b = getAmPmLabels$1(locale), amLabel = _b[0], pmLabel = _b[1];
24783
+ return (React__default.createElement("select", { "aria-label": ariaLabel, autoFocus: autoFocus, className: clsx$1("".concat(className, "__input"), "".concat(className, "__").concat(name)), "data-input": "true", "data-select": "true", disabled: disabled, name: name, onChange: onChange, onKeyDown: onKeyDown, ref: inputRef, required: required, value: value !== null ? value : '' },
24752
24784
  !value && React__default.createElement("option", { value: "" }, "--"),
24753
24785
  React__default.createElement("option", { disabled: amDisabled, value: "am" }, amLabel),
24754
24786
  React__default.createElement("option", { disabled: pmDisabled, value: "pm" }, pmLabel)));
24755
24787
  }
24756
24788
 
24757
- var __assign$1 = (undefined && undefined.__assign) || function () {
24758
- __assign$1 = Object.assign || function(t) {
24789
+ var __assign$7 = (undefined && undefined.__assign) || function () {
24790
+ __assign$7 = Object.assign || function(t) {
24759
24791
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24760
24792
  s = arguments[i];
24761
24793
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24763,9 +24795,9 @@ var __assign$1 = (undefined && undefined.__assign) || function () {
24763
24795
  }
24764
24796
  return t;
24765
24797
  };
24766
- return __assign$1.apply(this, arguments);
24798
+ return __assign$7.apply(this, arguments);
24767
24799
  };
24768
- var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
24800
+ var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
24769
24801
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
24770
24802
  if (ar || !(i in from)) {
24771
24803
  if (!ar) ar = Array.prototype.slice.call(from, 0, i);
@@ -24774,24 +24806,24 @@ var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, fr
24774
24806
  }
24775
24807
  return to.concat(ar || Array.prototype.slice.call(from));
24776
24808
  };
24777
- var getFormatterOptionsCache = {};
24778
- var allViews$2 = ['hour', 'minute', 'second'];
24779
- function isInternalInput(element) {
24809
+ var getFormatterOptionsCache$1 = {};
24810
+ var allViews$4 = ['hour', 'minute', 'second'];
24811
+ function isInternalInput$1(element) {
24780
24812
  return element.dataset.input === 'true';
24781
24813
  }
24782
- function findInput(element, property) {
24814
+ function findInput$1(element, property) {
24783
24815
  var nextElement = element;
24784
24816
  do {
24785
24817
  nextElement = nextElement[property];
24786
- } while (nextElement && !isInternalInput(nextElement));
24818
+ } while (nextElement && !isInternalInput$1(nextElement));
24787
24819
  return nextElement;
24788
24820
  }
24789
- function focus(element) {
24821
+ function focus$1(element) {
24790
24822
  if (element) {
24791
24823
  element.focus();
24792
24824
  }
24793
24825
  }
24794
- function renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances) {
24826
+ function renderCustomInputs$1(placeholder, elementFunctions, allowMultipleInstances) {
24795
24827
  var usedFunctions = [];
24796
24828
  var pattern = new RegExp(Object.keys(elementFunctions)
24797
24829
  .map(function (el) { return "".concat(el, "+"); })
@@ -24800,8 +24832,8 @@ function renderCustomInputs(placeholder, elementFunctions, allowMultipleInstance
24800
24832
  return placeholder.split(pattern).reduce(function (arr, element, index) {
24801
24833
  var divider = element && (
24802
24834
  // eslint-disable-next-line react/no-array-index-key
24803
- React__default.createElement(Divider, { key: "separator_".concat(index) }, element));
24804
- var res = __spreadArray$1(__spreadArray$1([], arr, true), [divider], false);
24835
+ React__default.createElement(Divider$1, { key: "separator_".concat(index) }, element));
24836
+ var res = __spreadArray$2(__spreadArray$2([], arr, true), [divider], false);
24805
24837
  var currentMatch = matches && matches[index];
24806
24838
  if (currentMatch) {
24807
24839
  var renderFunction = elementFunctions[currentMatch] ||
@@ -24822,8 +24854,8 @@ function renderCustomInputs(placeholder, elementFunctions, allowMultipleInstance
24822
24854
  return res;
24823
24855
  }, []);
24824
24856
  }
24825
- var formatNumber = getNumberFormatter({ useGrouping: false });
24826
- function TimeInput(_a) {
24857
+ var formatNumber$1 = getNumberFormatter$1({ useGrouping: false });
24858
+ function TimeInput$1(_a) {
24827
24859
  var amPmAriaLabel = _a.amPmAriaLabel, autoFocus = _a.autoFocus, className = _a.className, disabled = _a.disabled, format = _a.format, hourAriaLabel = _a.hourAriaLabel, hourPlaceholder = _a.hourPlaceholder, _b = _a.isClockOpen, isClockOpenProps = _b === void 0 ? null : _b, locale = _a.locale, _c = _a.maxDetail, maxDetail = _c === void 0 ? 'minute' : _c, maxTime = _a.maxTime, minTime = _a.minTime, minuteAriaLabel = _a.minuteAriaLabel, minutePlaceholder = _a.minutePlaceholder, _d = _a.name, name = _d === void 0 ? 'time' : _d, nativeInputAriaLabel = _a.nativeInputAriaLabel, onChangeProps = _a.onChange, onInvalidChange = _a.onInvalidChange, required = _a.required, secondAriaLabel = _a.secondAriaLabel, secondPlaceholder = _a.secondPlaceholder, valueProps = _a.value;
24828
24860
  var _e = useState(null), amPm = _e[0], setAmPm = _e[1];
24829
24861
  var _f = useState(null), hour = _f[0], setHour = _f[1];
@@ -24843,7 +24875,7 @@ function TimeInput(_a) {
24843
24875
  useEffect(function () {
24844
24876
  var nextValue = valueProps;
24845
24877
  if (nextValue) {
24846
- setAmPm(convert24to12(getHours(nextValue))[1]);
24878
+ setAmPm(convert24to12$1(getHours(nextValue))[1]);
24847
24879
  setHour(getHours(nextValue).toString());
24848
24880
  setMinute(getMinutes(nextValue).toString());
24849
24881
  setSecond(getSeconds(nextValue).toString());
@@ -24866,8 +24898,8 @@ function TimeInput(_a) {
24866
24898
  ]);
24867
24899
  var valueType = maxDetail;
24868
24900
  var formatTime = (function () {
24869
- var level = allViews$2.indexOf(maxDetail);
24870
- var formatterOptions = getFormatterOptionsCache[level] ||
24901
+ var level = allViews$4.indexOf(maxDetail);
24902
+ var formatterOptions = getFormatterOptionsCache$1[level] ||
24871
24903
  (function () {
24872
24904
  var options = { hour: 'numeric' };
24873
24905
  if (level >= 1) {
@@ -24876,10 +24908,10 @@ function TimeInput(_a) {
24876
24908
  if (level >= 2) {
24877
24909
  options.second = 'numeric';
24878
24910
  }
24879
- getFormatterOptionsCache[level] = options;
24911
+ getFormatterOptionsCache$1[level] = options;
24880
24912
  return options;
24881
24913
  })();
24882
- return getFormatter(formatterOptions);
24914
+ return getFormatter$1(formatterOptions);
24883
24915
  })();
24884
24916
  /**
24885
24917
  * Gets current value in a desired format.
@@ -24906,11 +24938,11 @@ function TimeInput(_a) {
24906
24938
  var second = 14;
24907
24939
  var date = new Date(2017, 0, 1, hour24, minute, second);
24908
24940
  return formatTime(locale, date)
24909
- .replace(formatNumber(locale, hour12), 'h')
24910
- .replace(formatNumber(locale, hour24), 'H')
24911
- .replace(formatNumber(locale, minute), 'mm')
24912
- .replace(formatNumber(locale, second), 'ss')
24913
- .replace(new RegExp(getAmPmLabels(locale).join('|')), 'a');
24941
+ .replace(formatNumber$1(locale, hour12), 'h')
24942
+ .replace(formatNumber$1(locale, hour24), 'H')
24943
+ .replace(formatNumber$1(locale, minute), 'mm')
24944
+ .replace(formatNumber$1(locale, second), 'ss')
24945
+ .replace(new RegExp(getAmPmLabels$1(locale).join('|')), 'a');
24914
24946
  })();
24915
24947
  var divider = (function () {
24916
24948
  var dividers = placeholder.match(/[^0-9a-z]/i);
@@ -24920,7 +24952,7 @@ function TimeInput(_a) {
24920
24952
  if (event.target === event.currentTarget) {
24921
24953
  // Wrapper was directly clicked
24922
24954
  var firstInput = event.target.children[1];
24923
- focus(firstInput);
24955
+ focus$1(firstInput);
24924
24956
  }
24925
24957
  }
24926
24958
  function onKeyDown(event) {
@@ -24932,8 +24964,8 @@ function TimeInput(_a) {
24932
24964
  event.preventDefault();
24933
24965
  var input = event.target;
24934
24966
  var property = event.key === 'ArrowLeft' ? 'previousElementSibling' : 'nextElementSibling';
24935
- var nextInput = findInput(input, property);
24936
- focus(nextInput);
24967
+ var nextInput = findInput$1(input, property);
24968
+ focus$1(nextInput);
24937
24969
  break;
24938
24970
  }
24939
24971
  }
@@ -24961,8 +24993,8 @@ function TimeInput(_a) {
24961
24993
  */
24962
24994
  if (Number(value) * 10 > Number(max) || value.length >= max.length) {
24963
24995
  var property = 'nextElementSibling';
24964
- var nextInput = findInput(input, property);
24965
- focus(nextInput);
24996
+ var nextInput = findInput$1(input, property);
24997
+ focus$1(nextInput);
24966
24998
  }
24967
24999
  }
24968
25000
  /**
@@ -25002,7 +25034,7 @@ function TimeInput(_a) {
25002
25034
  var isEveryValueValid = formElements.every(function (formElement) { return formElement.validity.valid; });
25003
25035
  if (isEveryValueFilled && isEveryValueValid) {
25004
25036
  var hour_1 = Number(values.hour24 ||
25005
- (values.hour12 && values.amPm && convert12to24(values.hour12, values.amPm)) ||
25037
+ (values.hour12 && values.amPm && convert12to24$1(values.hour12, values.amPm)) ||
25006
25038
  0);
25007
25039
  var minute_1 = Number(values.minute || 0);
25008
25040
  var second_1 = Number(values.second || 0);
@@ -25027,7 +25059,7 @@ function TimeInput(_a) {
25027
25059
  setAmPm(value);
25028
25060
  break;
25029
25061
  case 'hour12':
25030
- setHour(value ? convert12to24(value, amPm || 'am').toString() : '');
25062
+ setHour(value ? convert12to24$1(value, amPm || 'am').toString() : '');
25031
25063
  break;
25032
25064
  case 'hour24':
25033
25065
  setHour(value);
@@ -25068,7 +25100,7 @@ function TimeInput(_a) {
25068
25100
  throw new Error("Unsupported token: ".concat(currentMatch));
25069
25101
  }
25070
25102
  var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
25071
- return (React__default.createElement(Hour12Input, __assign$1({ key: "hour12" }, commonInputProps, { amPm: amPm, ariaLabel: hourAriaLabel,
25103
+ return (React__default.createElement(Hour12Input$1, __assign$7({ key: "hour12" }, commonInputProps, { amPm: amPm, ariaLabel: hourAriaLabel,
25072
25104
  // eslint-disable-next-line jsx-a11y/no-autofocus
25073
25105
  autoFocus: index === 0 && autoFocus, inputRef: hour12Input, placeholder: hourPlaceholder, showLeadingZeros: showLeadingZeros, value: hour })));
25074
25106
  }
@@ -25077,7 +25109,7 @@ function TimeInput(_a) {
25077
25109
  throw new Error("Unsupported token: ".concat(currentMatch));
25078
25110
  }
25079
25111
  var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
25080
- return (React__default.createElement(Hour24Input, __assign$1({ key: "hour24" }, commonInputProps, { ariaLabel: hourAriaLabel,
25112
+ return (React__default.createElement(Hour24Input$1, __assign$7({ key: "hour24" }, commonInputProps, { ariaLabel: hourAriaLabel,
25081
25113
  // eslint-disable-next-line jsx-a11y/no-autofocus
25082
25114
  autoFocus: index === 0 && autoFocus, inputRef: hour24Input, placeholder: hourPlaceholder, showLeadingZeros: showLeadingZeros, value: hour })));
25083
25115
  }
@@ -25092,7 +25124,7 @@ function TimeInput(_a) {
25092
25124
  throw new Error("Unsupported token: ".concat(currentMatch));
25093
25125
  }
25094
25126
  var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
25095
- return (React__default.createElement(MinuteInput, __assign$1({ key: "minute" }, commonInputProps, { ariaLabel: minuteAriaLabel,
25127
+ return (React__default.createElement(MinuteInput$1, __assign$7({ key: "minute" }, commonInputProps, { ariaLabel: minuteAriaLabel,
25096
25128
  // eslint-disable-next-line jsx-a11y/no-autofocus
25097
25129
  autoFocus: index === 0 && autoFocus, hour: hour, inputRef: minuteInput, placeholder: minutePlaceholder, showLeadingZeros: showLeadingZeros, value: minute })));
25098
25130
  }
@@ -25101,12 +25133,12 @@ function TimeInput(_a) {
25101
25133
  throw new Error("Unsupported token: ".concat(currentMatch));
25102
25134
  }
25103
25135
  var showLeadingZeros = currentMatch ? currentMatch.length === 2 : true;
25104
- return (React__default.createElement(SecondInput, __assign$1({ key: "second" }, commonInputProps, { ariaLabel: secondAriaLabel,
25136
+ return (React__default.createElement(SecondInput$1, __assign$7({ key: "second" }, commonInputProps, { ariaLabel: secondAriaLabel,
25105
25137
  // eslint-disable-next-line jsx-a11y/no-autofocus
25106
25138
  autoFocus: index === 0 && autoFocus, hour: hour, inputRef: secondInput, minute: minute, placeholder: secondPlaceholder, showLeadingZeros: showLeadingZeros, value: second })));
25107
25139
  }
25108
25140
  function renderAmPm(currentMatch, index) {
25109
- return (React__default.createElement(AmPm, __assign$1({ key: "ampm" }, commonInputProps, { ariaLabel: amPmAriaLabel,
25141
+ return (React__default.createElement(AmPm$1, __assign$7({ key: "ampm" }, commonInputProps, { ariaLabel: amPmAriaLabel,
25110
25142
  // eslint-disable-next-line jsx-a11y/no-autofocus
25111
25143
  autoFocus: index === 0 && autoFocus, inputRef: amPmInput, locale: locale, onChange: onChange, value: amPm })));
25112
25144
  }
@@ -25119,10 +25151,10 @@ function TimeInput(_a) {
25119
25151
  a: renderAmPm,
25120
25152
  };
25121
25153
  var allowMultipleInstances = typeof format !== 'undefined';
25122
- return renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances);
25154
+ return renderCustomInputs$1(placeholder, elementFunctions, allowMultipleInstances);
25123
25155
  }
25124
25156
  function renderNativeInput() {
25125
- return (React__default.createElement(NativeInput, { key: "time", ariaLabel: nativeInputAriaLabel, disabled: disabled, maxTime: maxTime, minTime: minTime, name: name, onChange: onChangeNative, required: required, value: value, valueType: valueType }));
25157
+ return (React__default.createElement(NativeInput$1, { key: "time", ariaLabel: nativeInputAriaLabel, disabled: disabled, maxTime: maxTime, minTime: minTime, name: name, onChange: onChangeNative, required: required, value: value, valueType: valueType }));
25126
25158
  }
25127
25159
  return (
25128
25160
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
@@ -25131,41 +25163,23 @@ function TimeInput(_a) {
25131
25163
  renderCustomInputsInternal()));
25132
25164
  }
25133
25165
 
25134
- var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
25135
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25136
- if (ar || !(i in from)) {
25137
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
25138
- ar[i] = from[i];
25139
- }
25140
- }
25141
- return to.concat(ar || Array.prototype.slice.call(from));
25142
- };
25143
- var allViews$1 = ['hour', 'minute', 'second'];
25144
- var allValueTypes = __spreadArray([], allViews$1, true);
25145
- var hourOptionalSecondsRegExp = /^(([0-1])?[0-9]|2[0-3]):[0-5][0-9](:([0-5][0-9]))?$/;
25146
- var isTime = function isTime(props, propName, componentName) {
25166
+ var hourOptionalSecondsRegExp$1 = /^(([0-1])?[0-9]|2[0-3]):[0-5][0-9](:([0-5][0-9]))?$/;
25167
+ var isTime$1 = function isTime(props, propName, componentName) {
25147
25168
  var _a = props, _b = propName, time = _a[_b];
25148
25169
  if (time) {
25149
- if (typeof time !== 'string' || !hourOptionalSecondsRegExp.test(time)) {
25170
+ if (typeof time !== 'string' || !hourOptionalSecondsRegExp$1.test(time)) {
25150
25171
  return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof time, "` supplied to `").concat(componentName, "`, expected time in HH:mm(:ss) format."));
25151
25172
  }
25152
25173
  }
25153
25174
  // Everything is fine
25154
25175
  return null;
25155
25176
  };
25156
- propTypes$1.exports.oneOf(allValueTypes);
25157
- propTypes$1.exports.oneOfType([
25158
- propTypes$1.exports.func,
25159
- propTypes$1.exports.exact({
25160
- current: propTypes$1.exports.any,
25161
- }),
25162
- ]);
25163
- var rangeOf = function (type) {
25177
+ var rangeOf$1 = function (type) {
25164
25178
  return propTypes$1.exports.arrayOf(type);
25165
25179
  };
25166
25180
 
25167
- var __assign = (undefined && undefined.__assign) || function () {
25168
- __assign = Object.assign || function(t) {
25181
+ var __assign$6 = (undefined && undefined.__assign) || function () {
25182
+ __assign$6 = Object.assign || function(t) {
25169
25183
  for (var s, i = 1, n = arguments.length; i < n; i++) {
25170
25184
  s = arguments[i];
25171
25185
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -25173,9 +25187,9 @@ var __assign = (undefined && undefined.__assign) || function () {
25173
25187
  }
25174
25188
  return t;
25175
25189
  };
25176
- return __assign.apply(this, arguments);
25190
+ return __assign$6.apply(this, arguments);
25177
25191
  };
25178
- var __rest = (undefined && undefined.__rest) || function (s, e) {
25192
+ var __rest$5 = (undefined && undefined.__rest) || function (s, e) {
25179
25193
  var t = {};
25180
25194
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25181
25195
  t[p] = s[p];
@@ -25186,11 +25200,11 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
25186
25200
  }
25187
25201
  return t;
25188
25202
  };
25189
- var isBrowser$4 = typeof document !== 'undefined';
25190
- var baseClassName = 'react-time-picker';
25191
- var outsideActionEvents = ['mousedown', 'focusin', 'touchstart'];
25192
- var allViews = ['hour', 'minute', 'second'];
25193
- var iconProps = {
25203
+ var isBrowser$6 = typeof document !== 'undefined';
25204
+ var baseClassName$1 = 'react-timerange-picker';
25205
+ var outsideActionEvents$1 = ['mousedown', 'focusin', 'touchstart'];
25206
+ var allViews$3 = ['hour', 'minute', 'second'];
25207
+ var iconProps$1 = {
25194
25208
  xmlns: 'http://www.w3.org/2000/svg',
25195
25209
  width: 19,
25196
25210
  height: 19,
@@ -25198,15 +25212,15 @@ var iconProps = {
25198
25212
  stroke: 'black',
25199
25213
  strokeWidth: 2,
25200
25214
  };
25201
- var ClockIcon = (React__default.createElement("svg", __assign({}, iconProps, { className: "".concat(baseClassName, "__clock-button__icon ").concat(baseClassName, "__button__icon"), fill: "none" }),
25215
+ var ClockIcon$1 = (React__default.createElement("svg", __assign$6({}, iconProps$1, { className: "".concat(baseClassName$1, "__clock-button__icon ").concat(baseClassName$1, "__button__icon"), fill: "none" }),
25202
25216
  React__default.createElement("circle", { cx: "9.5", cy: "9.5", r: "7.5" }),
25203
25217
  React__default.createElement("path", { d: "M9.5 4.5 v5 h4" })));
25204
- var ClearIcon = (React__default.createElement("svg", __assign({}, iconProps, { className: "".concat(baseClassName, "__clear-button__icon ").concat(baseClassName, "__button__icon") }),
25218
+ var ClearIcon$1 = (React__default.createElement("svg", __assign$6({}, iconProps$1, { className: "".concat(baseClassName$1, "__clear-button__icon ").concat(baseClassName$1, "__button__icon") }),
25205
25219
  React__default.createElement("line", { x1: "4", x2: "15", y1: "4", y2: "15" }),
25206
25220
  React__default.createElement("line", { x1: "15", x2: "4", y1: "4", y2: "15" })));
25207
- var TimePicker$1 = function TimePicker(props) {
25208
- var amPmAriaLabel = props.amPmAriaLabel, autoFocus = props.autoFocus, className = props.className, clearAriaLabel = props.clearAriaLabel, _a = props.clearIcon, clearIcon = _a === void 0 ? ClearIcon : _a, clockAriaLabel = props.clockAriaLabel, _b = props.clockIcon, clockIcon = _b === void 0 ? ClockIcon : _b, _c = props.closeClock, shouldCloseClockOnSelect = _c === void 0 ? true : _c, dataTestid = props["data-testid"], hourAriaLabel = props.hourAriaLabel, hourPlaceholder = props.hourPlaceholder, disableClock = props.disableClock, disabled = props.disabled, format = props.format, id = props.id, _d = props.isOpen, isOpenProps = _d === void 0 ? null : _d, locale = props.locale, maxTime = props.maxTime, _e = props.maxDetail, maxDetail = _e === void 0 ? 'minute' : _e, minTime = props.minTime, minuteAriaLabel = props.minuteAriaLabel, minutePlaceholder = props.minutePlaceholder, _f = props.name, name = _f === void 0 ? 'time' : _f, nativeInputAriaLabel = props.nativeInputAriaLabel, onClockClose = props.onClockClose, onClockOpen = props.onClockOpen, onChangeProps = props.onChange, onFocusProps = props.onFocus, onInvalidChange = props.onInvalidChange, _g = props.openClockOnFocus, openClockOnFocus = _g === void 0 ? true : _g, required = props.required, value = props.value, secondAriaLabel = props.secondAriaLabel, secondPlaceholder = props.secondPlaceholder, shouldCloseClock = props.shouldCloseClock, shouldOpenClock = props.shouldOpenClock, otherProps = __rest(props, ["amPmAriaLabel", "autoFocus", "className", "clearAriaLabel", "clearIcon", "clockAriaLabel", "clockIcon", "closeClock", 'data-testid', "hourAriaLabel", "hourPlaceholder", "disableClock", "disabled", "format", "id", "isOpen", "locale", "maxTime", "maxDetail", "minTime", "minuteAriaLabel", "minutePlaceholder", "name", "nativeInputAriaLabel", "onClockClose", "onClockOpen", "onChange", "onFocus", "onInvalidChange", "openClockOnFocus", "required", "value", "secondAriaLabel", "secondPlaceholder", "shouldCloseClock", "shouldOpenClock"]);
25209
- var _h = useState(isOpenProps), isOpen = _h[0], setIsOpen = _h[1];
25221
+ var TimeRangePicker = function TimeRangePicker(props) {
25222
+ var amPmAriaLabel = props.amPmAriaLabel, autoFocus = props.autoFocus, className = props.className, clearAriaLabel = props.clearAriaLabel, _a = props.clearIcon, clearIcon = _a === void 0 ? ClearIcon$1 : _a, clockAriaLabel = props.clockAriaLabel, _b = props.clockIcon, clockIcon = _b === void 0 ? ClockIcon$1 : _b, _c = props.closeClock, shouldCloseClockOnSelect = _c === void 0 ? true : _c, dataTestid = props["data-testid"], disableClock = props.disableClock, disabled = props.disabled, format = props.format, hourAriaLabel = props.hourAriaLabel, hourPlaceholder = props.hourPlaceholder, id = props.id, _d = props.isOpen, isOpenProps = _d === void 0 ? null : _d, locale = props.locale, _e = props.maxDetail, maxDetail = _e === void 0 ? 'minute' : _e, maxTime = props.maxTime, minTime = props.minTime, minuteAriaLabel = props.minuteAriaLabel, minutePlaceholder = props.minutePlaceholder, _f = props.name, name = _f === void 0 ? 'timerange' : _f, nativeInputAriaLabel = props.nativeInputAriaLabel, onChangeProps = props.onChange, onClockClose = props.onClockClose, onClockOpen = props.onClockOpen, onFocusProps = props.onFocus, onInvalidChange = props.onInvalidChange, _g = props.openClockOnFocus, openClockOnFocus = _g === void 0 ? true : _g, _h = props.rangeDivider, rangeDivider = _h === void 0 ? '–' : _h, required = props.required, secondAriaLabel = props.secondAriaLabel, secondPlaceholder = props.secondPlaceholder, shouldCloseClock = props.shouldCloseClock, shouldOpenClock = props.shouldOpenClock, value = props.value, otherProps = __rest$5(props, ["amPmAriaLabel", "autoFocus", "className", "clearAriaLabel", "clearIcon", "clockAriaLabel", "clockIcon", "closeClock", 'data-testid', "disableClock", "disabled", "format", "hourAriaLabel", "hourPlaceholder", "id", "isOpen", "locale", "maxDetail", "maxTime", "minTime", "minuteAriaLabel", "minutePlaceholder", "name", "nativeInputAriaLabel", "onChange", "onClockClose", "onClockOpen", "onFocus", "onInvalidChange", "openClockOnFocus", "rangeDivider", "required", "secondAriaLabel", "secondPlaceholder", "shouldCloseClock", "shouldOpenClock", "value"]);
25223
+ var _j = useState(isOpenProps), isOpen = _j[0], setIsOpen = _j[1];
25210
25224
  var wrapper = useRef(null);
25211
25225
  var clockWrapper = useRef(null);
25212
25226
  useEffect(function () {
@@ -25253,6 +25267,14 @@ var TimePicker$1 = function TimePicker(props) {
25253
25267
  onChangeProps(value);
25254
25268
  }
25255
25269
  }
25270
+ function onChangeFrom(valueFrom, closeClock) {
25271
+ var _a = Array.isArray(value) ? value : [value], valueTo = _a[1];
25272
+ onChange([valueFrom, valueTo || null], closeClock);
25273
+ }
25274
+ function onChangeTo(valueTo, closeClock) {
25275
+ var valueFrom = (Array.isArray(value) ? value : [value])[0];
25276
+ onChange([valueFrom || null, valueTo], closeClock);
25277
+ }
25256
25278
  function onFocus(event) {
25257
25279
  if (onFocusProps) {
25258
25280
  onFocusProps(event);
@@ -25292,7 +25314,7 @@ var TimePicker$1 = function TimePicker(props) {
25292
25314
  }, [clockWrapper, closeClock, wrapper]);
25293
25315
  var handleOutsideActionListeners = useCallback(function (shouldListen) {
25294
25316
  if (shouldListen === void 0) { shouldListen = isOpen; }
25295
- outsideActionEvents.forEach(function (event) {
25317
+ outsideActionEvents$1.forEach(function (event) {
25296
25318
  if (shouldListen) {
25297
25319
  document.addEventListener(event, onOutsideAction);
25298
25320
  }
@@ -25312,9 +25334,9 @@ var TimePicker$1 = function TimePicker(props) {
25312
25334
  return function () {
25313
25335
  handleOutsideActionListeners(false);
25314
25336
  };
25315
- }, [handleOutsideActionListeners]);
25337
+ }, [handleOutsideActionListeners, isOpen]);
25316
25338
  function renderInputs() {
25317
- var valueFrom = (Array.isArray(value) ? value : [value])[0];
25339
+ var _a = Array.isArray(value) ? value : [value], valueFrom = _a[0], valueTo = _a[1];
25318
25340
  var ariaLabelProps = {
25319
25341
  amPmAriaLabel: amPmAriaLabel,
25320
25342
  hourAriaLabel: hourAriaLabel,
@@ -25327,12 +25349,15 @@ var TimePicker$1 = function TimePicker(props) {
25327
25349
  minutePlaceholder: minutePlaceholder,
25328
25350
  secondPlaceholder: secondPlaceholder,
25329
25351
  };
25330
- return (React__default.createElement("div", { className: "".concat(baseClassName, "__wrapper") },
25331
- React__default.createElement(TimeInput, __assign({}, ariaLabelProps, placeholderProps, {
25352
+ var commonProps = __assign$6(__assign$6(__assign$6({}, ariaLabelProps), placeholderProps), { className: "".concat(baseClassName$1, "__inputGroup"), disabled: disabled, format: format, isClockOpen: isOpen, locale: locale, maxDetail: maxDetail, maxTime: maxTime, minTime: minTime, onInvalidChange: onInvalidChange, required: required });
25353
+ return (React__default.createElement("div", { className: "".concat(baseClassName$1, "__wrapper") },
25354
+ React__default.createElement(TimeInput$1, __assign$6({}, commonProps, {
25332
25355
  // eslint-disable-next-line jsx-a11y/no-autofocus
25333
- autoFocus: autoFocus, className: "".concat(baseClassName, "__inputGroup"), disabled: disabled, format: format, isClockOpen: isOpen, locale: locale, maxDetail: maxDetail, maxTime: maxTime, minTime: minTime, name: name, onChange: onChange, onInvalidChange: onInvalidChange, required: required, value: valueFrom })),
25334
- clearIcon !== null && (React__default.createElement("button", { "aria-label": clearAriaLabel, className: "".concat(baseClassName, "__clear-button ").concat(baseClassName, "__button"), disabled: disabled, onClick: clear, onFocus: stopPropagation, type: "button" }, typeof clearIcon === 'function' ? React__default.createElement(clearIcon) : clearIcon)),
25335
- clockIcon !== null && !disableClock && (React__default.createElement("button", { "aria-label": clockAriaLabel, className: "".concat(baseClassName, "__clock-button ").concat(baseClassName, "__button"), disabled: disabled, onClick: toggleClock, onFocus: stopPropagation, type: "button" }, typeof clockIcon === 'function' ? React__default.createElement(clockIcon) : clockIcon))));
25356
+ autoFocus: autoFocus, name: "".concat(name, "_from"), onChange: onChangeFrom, value: valueFrom })),
25357
+ React__default.createElement("span", { className: "".concat(baseClassName$1, "__range-divider") }, rangeDivider),
25358
+ React__default.createElement(TimeInput$1, __assign$6({}, commonProps, { name: "".concat(name, "_to"), onChange: onChangeTo, value: valueTo })),
25359
+ clearIcon !== null && (React__default.createElement("button", { "aria-label": clearAriaLabel, className: "".concat(baseClassName$1, "__clear-button ").concat(baseClassName$1, "__button"), disabled: disabled, onClick: clear, onFocus: stopPropagation, type: "button" }, typeof clearIcon === 'function' ? React__default.createElement(clearIcon) : clearIcon)),
25360
+ clockIcon !== null && !disableClock && (React__default.createElement("button", { "aria-label": clockAriaLabel, className: "".concat(baseClassName$1, "__clock-button ").concat(baseClassName$1, "__button"), disabled: disabled, onClick: toggleClock, onFocus: stopPropagation, type: "button" }, typeof clockIcon === 'function' ? React__default.createElement(clockIcon) : clockIcon))));
25336
25361
  }
25337
25362
  function renderClock() {
25338
25363
  if (isOpen === null || disableClock) {
@@ -25340,11 +25365,11 @@ var TimePicker$1 = function TimePicker(props) {
25340
25365
  }
25341
25366
  var clockClassName = props.clockClassName; props.className; // Unused, here to exclude it from clockProps
25342
25367
  props.onChange; // Unused, here to exclude it from clockProps
25343
- var portalContainer = props.portalContainer, value = props.value, clockProps = __rest(props, ["clockClassName", "className", "onChange", "portalContainer", "value"]);
25344
- var className = "".concat(baseClassName, "__clock");
25345
- var classNames = clsx$2(className, "".concat(className, "--").concat(isOpen ? 'open' : 'closed'));
25368
+ var portalContainer = props.portalContainer, value = props.value, clockProps = __rest$5(props, ["clockClassName", "className", "onChange", "portalContainer", "value"]);
25369
+ var className = "".concat(baseClassName$1, "__clock");
25370
+ var classNames = clsx$1(className, "".concat(className, "--").concat(isOpen ? 'open' : 'closed'));
25346
25371
  var valueFrom = (Array.isArray(value) ? value : [value])[0];
25347
- var clock = React__default.createElement(Clock, __assign({ className: clockClassName, value: valueFrom }, clockProps));
25372
+ var clock = React__default.createElement(Clock, __assign$6({ className: clockClassName, value: valueFrom }, clockProps));
25348
25373
  return portalContainer ? (createPortal(React__default.createElement("div", { ref: clockWrapper, className: classNames }, clock), portalContainer)) : (React__default.createElement(Fit, null,
25349
25374
  React__default.createElement("div", { ref: function (ref) {
25350
25375
  if (ref && !isOpen) {
@@ -25353,13 +25378,13 @@ var TimePicker$1 = function TimePicker(props) {
25353
25378
  }, className: classNames }, clock)));
25354
25379
  }
25355
25380
  var eventProps = useMemo(function () { return makeEventProps(otherProps); }, [otherProps]);
25356
- return (React__default.createElement("div", __assign({ className: clsx$2(baseClassName, "".concat(baseClassName, "--").concat(isOpen ? 'open' : 'closed'), "".concat(baseClassName, "--").concat(disabled ? 'disabled' : 'enabled'), className), "data-testid": dataTestid, id: id }, eventProps, { onFocus: onFocus, ref: wrapper }),
25381
+ return (React__default.createElement("div", __assign$6({ className: clsx$1(baseClassName$1, "".concat(baseClassName$1, "--").concat(isOpen ? 'open' : 'closed'), "".concat(baseClassName$1, "--").concat(disabled ? 'disabled' : 'enabled'), className), "data-testid": dataTestid, id: id }, eventProps, { onFocus: onFocus, ref: wrapper }),
25357
25382
  renderInputs(),
25358
25383
  renderClock()));
25359
25384
  };
25360
- var isValue = propTypes$1.exports.oneOfType([isTime, propTypes$1.exports.instanceOf(Date)]);
25361
- var isValueOrValueArray = propTypes$1.exports.oneOfType([isValue, rangeOf(isValue)]);
25362
- TimePicker$1.propTypes = {
25385
+ var isValue$1 = propTypes$1.exports.oneOfType([propTypes$1.exports.string, propTypes$1.exports.instanceOf(Date)]);
25386
+ var isValueOrValueArray$1 = propTypes$1.exports.oneOfType([isValue$1, rangeOf$1(isValue$1)]);
25387
+ TimeRangePicker.propTypes = {
25363
25388
  amPmAriaLabel: propTypes$1.exports.string,
25364
25389
  autoFocus: propTypes$1.exports.bool,
25365
25390
  className: propTypes$1.exports.oneOfType([propTypes$1.exports.string, propTypes$1.exports.arrayOf(propTypes$1.exports.string)]),
@@ -25378,9 +25403,9 @@ TimePicker$1.propTypes = {
25378
25403
  id: propTypes$1.exports.string,
25379
25404
  isOpen: propTypes$1.exports.bool,
25380
25405
  locale: propTypes$1.exports.string,
25381
- maxDetail: propTypes$1.exports.oneOf(allViews),
25382
- maxTime: isTime,
25383
- minTime: isTime,
25406
+ maxDetail: propTypes$1.exports.oneOf(allViews$3),
25407
+ maxTime: isTime$1,
25408
+ minTime: isTime$1,
25384
25409
  minuteAriaLabel: propTypes$1.exports.string,
25385
25410
  minutePlaceholder: propTypes$1.exports.string,
25386
25411
  name: propTypes$1.exports.string,
@@ -25390,28 +25415,1055 @@ TimePicker$1.propTypes = {
25390
25415
  onClockOpen: propTypes$1.exports.func,
25391
25416
  onFocus: propTypes$1.exports.func,
25392
25417
  openClockOnFocus: propTypes$1.exports.bool,
25418
+ rangeDivider: propTypes$1.exports.node,
25393
25419
  required: propTypes$1.exports.bool,
25394
25420
  secondAriaLabel: propTypes$1.exports.string,
25395
25421
  secondPlaceholder: propTypes$1.exports.string,
25396
- value: isValueOrValueArray,
25422
+ value: isValueOrValueArray$1,
25397
25423
  };
25398
- if (isBrowser$4) {
25399
- TimePicker$1.propTypes.portalContainer = propTypes$1.exports.instanceOf(HTMLElement);
25424
+ if (isBrowser$6) {
25425
+ TimeRangePicker.propTypes.portalContainer = propTypes$1.exports.instanceOf(HTMLElement);
25400
25426
  }
25401
25427
 
25402
- var HoverIcon = function HoverIcon(_ref) {
25403
- var _ref$time = _ref.time,
25404
- time = _ref$time === void 0 ? false : _ref$time;
25405
- var _useState = useState(false),
25406
- _useState2 = _slicedToArray$3(_useState, 2),
25407
- hovered = _useState2[0],
25408
- setHovered = _useState2[1];
25409
- return /*#__PURE__*/React__default.createElement("div", {
25410
- onMouseLeave: function onMouseLeave() {
25411
- return setHovered(false);
25412
- },
25413
- onMouseOver: function onMouseOver() {
25414
- return setHovered(true);
25428
+ function Divider(_a) {
25429
+ var children = _a.children;
25430
+ return React__default.createElement("span", { className: "react-time-picker__inputGroup__divider" }, children);
25431
+ }
25432
+
25433
+ var isBrowser$5 = typeof document !== 'undefined';
25434
+ var useIsomorphicLayoutEffect = isBrowser$5 ? useLayoutEffect : useEffect;
25435
+ var isIEOrEdgeLegacy = isBrowser$5 && /(MSIE|Trident\/|Edge\/)/.test(navigator.userAgent);
25436
+ var isFirefox = isBrowser$5 && /Firefox/.test(navigator.userAgent);
25437
+ function onFocus(event) {
25438
+ var target = event.target;
25439
+ if (isIEOrEdgeLegacy) {
25440
+ requestAnimationFrame(function () { return target.select(); });
25441
+ }
25442
+ else {
25443
+ target.select();
25444
+ }
25445
+ }
25446
+ function updateInputWidthOnLoad(element) {
25447
+ if (document.readyState === 'complete') {
25448
+ return;
25449
+ }
25450
+ function onLoad() {
25451
+ updateInputWidth(element);
25452
+ }
25453
+ window.addEventListener('load', onLoad);
25454
+ }
25455
+ function updateInputWidthOnFontLoad(element) {
25456
+ if (!document.fonts) {
25457
+ return;
25458
+ }
25459
+ var font = getFontShorthand(element);
25460
+ if (!font) {
25461
+ return;
25462
+ }
25463
+ var isFontLoaded = document.fonts.check(font);
25464
+ if (isFontLoaded) {
25465
+ return;
25466
+ }
25467
+ function onLoadingDone() {
25468
+ updateInputWidth(element);
25469
+ }
25470
+ document.fonts.addEventListener('loadingdone', onLoadingDone);
25471
+ }
25472
+ function getSelectionString(input) {
25473
+ /**
25474
+ * window.getSelection().toString() returns empty string in IE11 and Firefox,
25475
+ * so alternatives come first.
25476
+ */
25477
+ if (input &&
25478
+ 'selectionStart' in input &&
25479
+ input.selectionStart !== null &&
25480
+ 'selectionEnd' in input &&
25481
+ input.selectionEnd !== null) {
25482
+ return input.value.slice(input.selectionStart, input.selectionEnd);
25483
+ }
25484
+ if ('getSelection' in window) {
25485
+ var selection = window.getSelection();
25486
+ return selection && selection.toString();
25487
+ }
25488
+ return null;
25489
+ }
25490
+ function makeOnKeyPress(maxLength) {
25491
+ if (maxLength === null) {
25492
+ return undefined;
25493
+ }
25494
+ /**
25495
+ * Prevents keystrokes that would not produce a number or when value after keystroke would
25496
+ * exceed maxLength.
25497
+ */
25498
+ return function onKeyPress(event) {
25499
+ if (isFirefox) {
25500
+ // See https://github.com/wojtekmaj/react-time-picker/issues/92
25501
+ return;
25502
+ }
25503
+ var key = event.key, input = event.target;
25504
+ var value = input.value;
25505
+ var isNumberKey = key.length === 1 && /\d/.test(key);
25506
+ var selection = getSelectionString(input);
25507
+ if (!isNumberKey || !(selection || value.length < maxLength)) {
25508
+ event.preventDefault();
25509
+ }
25510
+ };
25511
+ }
25512
+ function Input$3(_a) {
25513
+ var ariaLabel = _a.ariaLabel, autoFocus = _a.autoFocus, className = _a.className, disabled = _a.disabled, inputRef = _a.inputRef, max = _a.max, min = _a.min, name = _a.name, nameForClass = _a.nameForClass, onChange = _a.onChange, onKeyDown = _a.onKeyDown, onKeyUp = _a.onKeyUp, _b = _a.placeholder, placeholder = _b === void 0 ? '--' : _b, required = _a.required, showLeadingZeros = _a.showLeadingZeros, step = _a.step, value = _a.value;
25514
+ useIsomorphicLayoutEffect(function () {
25515
+ if (!inputRef || !inputRef.current) {
25516
+ return;
25517
+ }
25518
+ updateInputWidth(inputRef.current);
25519
+ updateInputWidthOnLoad(inputRef.current);
25520
+ updateInputWidthOnFontLoad(inputRef.current);
25521
+ }, [inputRef, value]);
25522
+ var hasLeadingZero = showLeadingZeros &&
25523
+ value &&
25524
+ Number(value) < 10 &&
25525
+ (value === '0' || !value.toString().startsWith('0'));
25526
+ var maxLength = max ? max.toString().length : null;
25527
+ return (React__default.createElement(React__default.Fragment, null,
25528
+ hasLeadingZero ? React__default.createElement("span", { className: "".concat(className, "__leadingZero") }, "0") : null,
25529
+ React__default.createElement("input", { "aria-label": ariaLabel, autoComplete: "off", autoFocus: autoFocus, className: clsx$1("".concat(className, "__input"), "".concat(className, "__").concat(nameForClass || name), hasLeadingZero && "".concat(className, "__input--hasLeadingZero")), "data-input": "true", disabled: disabled, inputMode: "numeric", max: max, min: min, name: name, onChange: onChange, onFocus: onFocus, onKeyDown: onKeyDown, onKeyPress: makeOnKeyPress(maxLength), onKeyUp: function (event) {
25530
+ updateInputWidth(event.target);
25531
+ if (onKeyUp) {
25532
+ onKeyUp(event);
25533
+ }
25534
+ }, placeholder: placeholder, ref: inputRef, required: required, step: step, type: "number", value: value !== null ? value : '' })));
25535
+ }
25536
+
25537
+ function convert12to24(hour12, amPm) {
25538
+ var hour24 = Number(hour12);
25539
+ if (amPm === 'am' && hour24 === 12) {
25540
+ hour24 = 0;
25541
+ }
25542
+ else if (amPm === 'pm' && hour24 < 12) {
25543
+ hour24 += 12;
25544
+ }
25545
+ return hour24;
25546
+ }
25547
+ function convert24to12(hour24) {
25548
+ var hour12 = Number(hour24) % 12 || 12;
25549
+ return [hour12, Number(hour24) < 12 ? 'am' : 'pm'];
25550
+ }
25551
+
25552
+ var formatterCache = new Map();
25553
+ function getFormatter(options) {
25554
+ return function formatter(locale, date) {
25555
+ var localeWithDefault = locale || getUserLocale();
25556
+ if (!formatterCache.has(localeWithDefault)) {
25557
+ formatterCache.set(localeWithDefault, new Map());
25558
+ }
25559
+ var formatterCacheLocale = formatterCache.get(localeWithDefault);
25560
+ if (!formatterCacheLocale.has(options)) {
25561
+ formatterCacheLocale.set(options, new Intl.DateTimeFormat(localeWithDefault || undefined, options).format);
25562
+ }
25563
+ return formatterCacheLocale.get(options)(date);
25564
+ };
25565
+ }
25566
+ var numberFormatterCache = new Map();
25567
+ function getNumberFormatter(options) {
25568
+ return function (locale, number) {
25569
+ var localeWithDefault = locale || getUserLocale();
25570
+ if (!numberFormatterCache.has(localeWithDefault)) {
25571
+ numberFormatterCache.set(localeWithDefault, new Map());
25572
+ }
25573
+ var numberFormatterCacheLocale = numberFormatterCache.get(localeWithDefault);
25574
+ if (!numberFormatterCacheLocale.has(options)) {
25575
+ numberFormatterCacheLocale.set(options, new Intl.NumberFormat(localeWithDefault || undefined, options).format);
25576
+ }
25577
+ return numberFormatterCacheLocale.get(options)(number);
25578
+ };
25579
+ }
25580
+
25581
+ var nines = ['9', '٩'];
25582
+ var ninesRegExp = new RegExp("[".concat(nines.join(''), "]"));
25583
+ var amPmFormatter = getFormatter({ hour: 'numeric' });
25584
+ function getAmPmLabels(locale) {
25585
+ var amString = amPmFormatter(locale, new Date(2017, 0, 1, 9));
25586
+ var pmString = amPmFormatter(locale, new Date(2017, 0, 1, 21));
25587
+ var _a = amString.split(ninesRegExp), am1 = _a[0], am2 = _a[1];
25588
+ var _b = pmString.split(ninesRegExp), pm1 = _b[0], pm2 = _b[1];
25589
+ if (pm2 !== undefined) {
25590
+ // If pm2 is undefined, nine was not found in pmString - this locale is not using 12-hour time
25591
+ if (am1 !== pm1) {
25592
+ return [am1, pm1].map(function (el) { return el.trim(); });
25593
+ }
25594
+ if (am2 !== pm2) {
25595
+ return [am2, pm2].map(function (el) { return el.trim(); });
25596
+ }
25597
+ }
25598
+ // Fallback
25599
+ return ['AM', 'PM'];
25600
+ }
25601
+ function isValidNumber(num) {
25602
+ return num !== null && num !== false && !Number.isNaN(Number(num));
25603
+ }
25604
+ function safeMin() {
25605
+ var args = [];
25606
+ for (var _i = 0; _i < arguments.length; _i++) {
25607
+ args[_i] = arguments[_i];
25608
+ }
25609
+ return Math.min.apply(Math, args.filter(isValidNumber));
25610
+ }
25611
+ function safeMax() {
25612
+ var args = [];
25613
+ for (var _i = 0; _i < arguments.length; _i++) {
25614
+ args[_i] = arguments[_i];
25615
+ }
25616
+ return Math.max.apply(Math, args.filter(isValidNumber));
25617
+ }
25618
+
25619
+ var __assign$5 = (undefined && undefined.__assign) || function () {
25620
+ __assign$5 = Object.assign || function(t) {
25621
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25622
+ s = arguments[i];
25623
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
25624
+ t[p] = s[p];
25625
+ }
25626
+ return t;
25627
+ };
25628
+ return __assign$5.apply(this, arguments);
25629
+ };
25630
+ var __rest$4 = (undefined && undefined.__rest) || function (s, e) {
25631
+ var t = {};
25632
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25633
+ t[p] = s[p];
25634
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
25635
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25636
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25637
+ t[p[i]] = s[p[i]];
25638
+ }
25639
+ return t;
25640
+ };
25641
+ function Hour12Input(_a) {
25642
+ var amPm = _a.amPm, maxTime = _a.maxTime, minTime = _a.minTime, value = _a.value, otherProps = __rest$4(_a, ["amPm", "maxTime", "minTime", "value"]);
25643
+ var maxHour = safeMin(12, maxTime &&
25644
+ (function () {
25645
+ var _a = convert24to12(getHours(maxTime)), maxHourResult = _a[0], maxAmPm = _a[1];
25646
+ if (maxAmPm !== amPm) {
25647
+ // pm is always after am, so we should ignore validation
25648
+ return null;
25649
+ }
25650
+ return maxHourResult;
25651
+ })());
25652
+ var minHour = safeMax(1, minTime &&
25653
+ (function () {
25654
+ var _a = convert24to12(getHours(minTime)), minHourResult = _a[0], minAmPm = _a[1];
25655
+ if (
25656
+ // pm is always after am, so we should ignore validation
25657
+ minAmPm !== amPm ||
25658
+ // If minHour is 12 am/pm, user should be able to enter 12, 1, ..., 11.
25659
+ minHourResult === 12) {
25660
+ return null;
25661
+ }
25662
+ return minHourResult;
25663
+ })());
25664
+ var value12 = value ? convert24to12(value)[0].toString() : '';
25665
+ return (React__default.createElement(Input$3, __assign$5({ max: maxHour, min: minHour, name: "hour12", nameForClass: "hour", value: value12 }, otherProps)));
25666
+ }
25667
+
25668
+ var __assign$4 = (undefined && undefined.__assign) || function () {
25669
+ __assign$4 = Object.assign || function(t) {
25670
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25671
+ s = arguments[i];
25672
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
25673
+ t[p] = s[p];
25674
+ }
25675
+ return t;
25676
+ };
25677
+ return __assign$4.apply(this, arguments);
25678
+ };
25679
+ var __rest$3 = (undefined && undefined.__rest) || function (s, e) {
25680
+ var t = {};
25681
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25682
+ t[p] = s[p];
25683
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
25684
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25685
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25686
+ t[p[i]] = s[p[i]];
25687
+ }
25688
+ return t;
25689
+ };
25690
+ function Hour24Input(_a) {
25691
+ var maxTime = _a.maxTime, minTime = _a.minTime, otherProps = __rest$3(_a, ["maxTime", "minTime"]);
25692
+ var maxHour = safeMin(23, maxTime && getHours(maxTime));
25693
+ var minHour = safeMax(0, minTime && getHours(minTime));
25694
+ return React__default.createElement(Input$3, __assign$4({ max: maxHour, min: minHour, name: "hour24", nameForClass: "hour" }, otherProps));
25695
+ }
25696
+
25697
+ var __assign$3 = (undefined && undefined.__assign) || function () {
25698
+ __assign$3 = Object.assign || function(t) {
25699
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25700
+ s = arguments[i];
25701
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
25702
+ t[p] = s[p];
25703
+ }
25704
+ return t;
25705
+ };
25706
+ return __assign$3.apply(this, arguments);
25707
+ };
25708
+ var __rest$2 = (undefined && undefined.__rest) || function (s, e) {
25709
+ var t = {};
25710
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25711
+ t[p] = s[p];
25712
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
25713
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25714
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25715
+ t[p[i]] = s[p[i]];
25716
+ }
25717
+ return t;
25718
+ };
25719
+ function MinuteInput(_a) {
25720
+ var hour = _a.hour, maxTime = _a.maxTime, minTime = _a.minTime, _b = _a.showLeadingZeros, showLeadingZeros = _b === void 0 ? true : _b, otherProps = __rest$2(_a, ["hour", "maxTime", "minTime", "showLeadingZeros"]);
25721
+ function isSameHour(date) {
25722
+ return hour === getHours(date).toString();
25723
+ }
25724
+ var maxMinute = safeMin(59, maxTime && isSameHour(maxTime) && getMinutes(maxTime));
25725
+ var minMinute = safeMax(0, minTime && isSameHour(minTime) && getMinutes(minTime));
25726
+ return (React__default.createElement(Input$3, __assign$3({ max: maxMinute, min: minMinute, name: "minute", showLeadingZeros: showLeadingZeros }, otherProps)));
25727
+ }
25728
+
25729
+ var __assign$2 = (undefined && undefined.__assign) || function () {
25730
+ __assign$2 = Object.assign || function(t) {
25731
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25732
+ s = arguments[i];
25733
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
25734
+ t[p] = s[p];
25735
+ }
25736
+ return t;
25737
+ };
25738
+ return __assign$2.apply(this, arguments);
25739
+ };
25740
+ var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
25741
+ var t = {};
25742
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25743
+ t[p] = s[p];
25744
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
25745
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25746
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25747
+ t[p[i]] = s[p[i]];
25748
+ }
25749
+ return t;
25750
+ };
25751
+ function SecondInput(_a) {
25752
+ var hour = _a.hour, maxTime = _a.maxTime, minTime = _a.minTime, minute = _a.minute, _b = _a.showLeadingZeros, showLeadingZeros = _b === void 0 ? true : _b, otherProps = __rest$1(_a, ["hour", "maxTime", "minTime", "minute", "showLeadingZeros"]);
25753
+ function isSameMinute(date) {
25754
+ return hour === getHours(date).toString() && minute === getMinutes(date).toString();
25755
+ }
25756
+ var maxSecond = safeMin(59, maxTime && isSameMinute(maxTime) && getSeconds(maxTime));
25757
+ var minSecond = safeMax(0, minTime && isSameMinute(minTime) && getSeconds(minTime));
25758
+ return (React__default.createElement(Input$3, __assign$2({ max: maxSecond, min: minSecond, name: "second", showLeadingZeros: showLeadingZeros }, otherProps)));
25759
+ }
25760
+
25761
+ function NativeInput(_a) {
25762
+ var ariaLabel = _a.ariaLabel, disabled = _a.disabled, maxTime = _a.maxTime, minTime = _a.minTime, name = _a.name, onChange = _a.onChange, required = _a.required, value = _a.value, valueType = _a.valueType;
25763
+ var nativeValueParser = (function () {
25764
+ switch (valueType) {
25765
+ case 'hour':
25766
+ return function (receivedValue) { return "".concat(getHours(receivedValue), ":00"); };
25767
+ case 'minute':
25768
+ return getHoursMinutes;
25769
+ case 'second':
25770
+ return getHoursMinutesSeconds;
25771
+ default:
25772
+ throw new Error('Invalid valueType');
25773
+ }
25774
+ })();
25775
+ var step = (function () {
25776
+ switch (valueType) {
25777
+ case 'hour':
25778
+ return 3600;
25779
+ case 'minute':
25780
+ return 60;
25781
+ case 'second':
25782
+ return 1;
25783
+ default:
25784
+ throw new Error('Invalid valueType');
25785
+ }
25786
+ })();
25787
+ function stopPropagation(event) {
25788
+ event.stopPropagation();
25789
+ }
25790
+ return (React__default.createElement("input", { "aria-label": ariaLabel, disabled: disabled, hidden: true, max: maxTime ? nativeValueParser(maxTime) : undefined, min: minTime ? nativeValueParser(minTime) : undefined, name: name, onChange: onChange, onFocus: stopPropagation, required: required, step: step, style: {
25791
+ visibility: 'hidden',
25792
+ position: 'absolute',
25793
+ zIndex: '-999',
25794
+ }, type: "time", value: value ? nativeValueParser(value) : '' }));
25795
+ }
25796
+
25797
+ function AmPm(_a) {
25798
+ var ariaLabel = _a.ariaLabel, autoFocus = _a.autoFocus, className = _a.className, disabled = _a.disabled, inputRef = _a.inputRef, locale = _a.locale, maxTime = _a.maxTime, minTime = _a.minTime, onChange = _a.onChange, onKeyDown = _a.onKeyDown, required = _a.required, value = _a.value;
25799
+ var amDisabled = minTime ? convert24to12(getHours(minTime))[1] === 'pm' : false;
25800
+ var pmDisabled = maxTime ? convert24to12(getHours(maxTime))[1] === 'am' : false;
25801
+ var name = 'amPm';
25802
+ var _b = getAmPmLabels(locale), amLabel = _b[0], pmLabel = _b[1];
25803
+ return (React__default.createElement("select", { "aria-label": ariaLabel, autoFocus: autoFocus, className: clsx$1("".concat(className, "__input"), "".concat(className, "__").concat(name)), "data-input": "true", "data-select": "true", disabled: disabled, name: name, onChange: onChange, onKeyDown: onKeyDown, ref: inputRef, required: required, value: value !== null ? value : '' },
25804
+ !value && React__default.createElement("option", { value: "" }, "--"),
25805
+ React__default.createElement("option", { disabled: amDisabled, value: "am" }, amLabel),
25806
+ React__default.createElement("option", { disabled: pmDisabled, value: "pm" }, pmLabel)));
25807
+ }
25808
+
25809
+ var __assign$1 = (undefined && undefined.__assign) || function () {
25810
+ __assign$1 = Object.assign || function(t) {
25811
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25812
+ s = arguments[i];
25813
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
25814
+ t[p] = s[p];
25815
+ }
25816
+ return t;
25817
+ };
25818
+ return __assign$1.apply(this, arguments);
25819
+ };
25820
+ var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
25821
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25822
+ if (ar || !(i in from)) {
25823
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
25824
+ ar[i] = from[i];
25825
+ }
25826
+ }
25827
+ return to.concat(ar || Array.prototype.slice.call(from));
25828
+ };
25829
+ var getFormatterOptionsCache = {};
25830
+ var allViews$2 = ['hour', 'minute', 'second'];
25831
+ function isInternalInput(element) {
25832
+ return element.dataset.input === 'true';
25833
+ }
25834
+ function findInput(element, property) {
25835
+ var nextElement = element;
25836
+ do {
25837
+ nextElement = nextElement[property];
25838
+ } while (nextElement && !isInternalInput(nextElement));
25839
+ return nextElement;
25840
+ }
25841
+ function focus(element) {
25842
+ if (element) {
25843
+ element.focus();
25844
+ }
25845
+ }
25846
+ function renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances) {
25847
+ var usedFunctions = [];
25848
+ var pattern = new RegExp(Object.keys(elementFunctions)
25849
+ .map(function (el) { return "".concat(el, "+"); })
25850
+ .join('|'), 'g');
25851
+ var matches = placeholder.match(pattern);
25852
+ return placeholder.split(pattern).reduce(function (arr, element, index) {
25853
+ var divider = element && (
25854
+ // eslint-disable-next-line react/no-array-index-key
25855
+ React__default.createElement(Divider, { key: "separator_".concat(index) }, element));
25856
+ var res = __spreadArray$1(__spreadArray$1([], arr, true), [divider], false);
25857
+ var currentMatch = matches && matches[index];
25858
+ if (currentMatch) {
25859
+ var renderFunction = elementFunctions[currentMatch] ||
25860
+ elementFunctions[Object.keys(elementFunctions).find(function (elementFunction) {
25861
+ return currentMatch.match(elementFunction);
25862
+ })];
25863
+ if (!renderFunction) {
25864
+ return res;
25865
+ }
25866
+ if (!allowMultipleInstances && usedFunctions.includes(renderFunction)) {
25867
+ res.push(currentMatch);
25868
+ }
25869
+ else {
25870
+ res.push(renderFunction(currentMatch, index));
25871
+ usedFunctions.push(renderFunction);
25872
+ }
25873
+ }
25874
+ return res;
25875
+ }, []);
25876
+ }
25877
+ var formatNumber = getNumberFormatter({ useGrouping: false });
25878
+ function TimeInput(_a) {
25879
+ var amPmAriaLabel = _a.amPmAriaLabel, autoFocus = _a.autoFocus, className = _a.className, disabled = _a.disabled, format = _a.format, hourAriaLabel = _a.hourAriaLabel, hourPlaceholder = _a.hourPlaceholder, _b = _a.isClockOpen, isClockOpenProps = _b === void 0 ? null : _b, locale = _a.locale, _c = _a.maxDetail, maxDetail = _c === void 0 ? 'minute' : _c, maxTime = _a.maxTime, minTime = _a.minTime, minuteAriaLabel = _a.minuteAriaLabel, minutePlaceholder = _a.minutePlaceholder, _d = _a.name, name = _d === void 0 ? 'time' : _d, nativeInputAriaLabel = _a.nativeInputAriaLabel, onChangeProps = _a.onChange, onInvalidChange = _a.onInvalidChange, required = _a.required, secondAriaLabel = _a.secondAriaLabel, secondPlaceholder = _a.secondPlaceholder, valueProps = _a.value;
25880
+ var _e = useState(null), amPm = _e[0], setAmPm = _e[1];
25881
+ var _f = useState(null), hour = _f[0], setHour = _f[1];
25882
+ var _g = useState(null), minute = _g[0], setMinute = _g[1];
25883
+ var _h = useState(null), second = _h[0], setSecond = _h[1];
25884
+ var _j = useState(null), value = _j[0], setValue = _j[1];
25885
+ var amPmInput = useRef(null);
25886
+ var hour12Input = useRef(null);
25887
+ var hour24Input = useRef(null);
25888
+ var minuteInput = useRef(null);
25889
+ var secondInput = useRef(null);
25890
+ var _k = useState(isClockOpenProps), isClockOpen = _k[0], setIsClockOpen = _k[1];
25891
+ var lastPressedKey = useRef();
25892
+ useEffect(function () {
25893
+ setIsClockOpen(isClockOpenProps);
25894
+ }, [isClockOpenProps]);
25895
+ useEffect(function () {
25896
+ var nextValue = valueProps;
25897
+ if (nextValue) {
25898
+ setAmPm(convert24to12(getHours(nextValue))[1]);
25899
+ setHour(getHours(nextValue).toString());
25900
+ setMinute(getMinutes(nextValue).toString());
25901
+ setSecond(getSeconds(nextValue).toString());
25902
+ setValue(nextValue);
25903
+ }
25904
+ else {
25905
+ setAmPm(null);
25906
+ setHour(null);
25907
+ setMinute(null);
25908
+ setSecond(null);
25909
+ setValue(null);
25910
+ }
25911
+ }, [
25912
+ valueProps,
25913
+ minTime,
25914
+ maxTime,
25915
+ maxDetail,
25916
+ // Toggling clock visibility resets values
25917
+ isClockOpen,
25918
+ ]);
25919
+ var valueType = maxDetail;
25920
+ var formatTime = (function () {
25921
+ var level = allViews$2.indexOf(maxDetail);
25922
+ var formatterOptions = getFormatterOptionsCache[level] ||
25923
+ (function () {
25924
+ var options = { hour: 'numeric' };
25925
+ if (level >= 1) {
25926
+ options.minute = 'numeric';
25927
+ }
25928
+ if (level >= 2) {
25929
+ options.second = 'numeric';
25930
+ }
25931
+ getFormatterOptionsCache[level] = options;
25932
+ return options;
25933
+ })();
25934
+ return getFormatter(formatterOptions);
25935
+ })();
25936
+ /**
25937
+ * Gets current value in a desired format.
25938
+ */
25939
+ function getProcessedValue(value) {
25940
+ var processFunction = (function () {
25941
+ switch (valueType) {
25942
+ case 'hour':
25943
+ case 'minute':
25944
+ return getHoursMinutes;
25945
+ case 'second':
25946
+ return getHoursMinutesSeconds;
25947
+ default:
25948
+ throw new Error('Invalid valueType');
25949
+ }
25950
+ })();
25951
+ return processFunction(value);
25952
+ }
25953
+ var placeholder = format ||
25954
+ (function () {
25955
+ var hour24 = 21;
25956
+ var hour12 = 9;
25957
+ var minute = 13;
25958
+ var second = 14;
25959
+ var date = new Date(2017, 0, 1, hour24, minute, second);
25960
+ return formatTime(locale, date)
25961
+ .replace(formatNumber(locale, hour12), 'h')
25962
+ .replace(formatNumber(locale, hour24), 'H')
25963
+ .replace(formatNumber(locale, minute), 'mm')
25964
+ .replace(formatNumber(locale, second), 'ss')
25965
+ .replace(new RegExp(getAmPmLabels(locale).join('|')), 'a');
25966
+ })();
25967
+ var divider = (function () {
25968
+ var dividers = placeholder.match(/[^0-9a-z]/i);
25969
+ return dividers ? dividers[0] : null;
25970
+ })();
25971
+ function onClick(event) {
25972
+ if (event.target === event.currentTarget) {
25973
+ // Wrapper was directly clicked
25974
+ var firstInput = event.target.children[1];
25975
+ focus(firstInput);
25976
+ }
25977
+ }
25978
+ function onKeyDown(event) {
25979
+ lastPressedKey.current = event.key;
25980
+ switch (event.key) {
25981
+ case 'ArrowLeft':
25982
+ case 'ArrowRight':
25983
+ case divider: {
25984
+ event.preventDefault();
25985
+ var input = event.target;
25986
+ var property = event.key === 'ArrowLeft' ? 'previousElementSibling' : 'nextElementSibling';
25987
+ var nextInput = findInput(input, property);
25988
+ focus(nextInput);
25989
+ break;
25990
+ }
25991
+ }
25992
+ }
25993
+ function onKeyUp(event) {
25994
+ var key = event.key, input = event.target;
25995
+ var isLastPressedKey = lastPressedKey.current === key;
25996
+ if (!isLastPressedKey) {
25997
+ return;
25998
+ }
25999
+ var isNumberKey = !isNaN(Number(key));
26000
+ if (!isNumberKey) {
26001
+ return;
26002
+ }
26003
+ var max = input.getAttribute('max');
26004
+ if (!max) {
26005
+ return;
26006
+ }
26007
+ var value = input.value;
26008
+ /**
26009
+ * Given 1, the smallest possible number the user could type by adding another digit is 10.
26010
+ * 10 would be a valid value given max = 12, so we won't jump to the next input.
26011
+ * However, given 2, smallers possible number would be 20, and thus keeping the focus in
26012
+ * this field doesn't make sense.
26013
+ */
26014
+ if (Number(value) * 10 > Number(max) || value.length >= max.length) {
26015
+ var property = 'nextElementSibling';
26016
+ var nextInput = findInput(input, property);
26017
+ focus(nextInput);
26018
+ }
26019
+ }
26020
+ /**
26021
+ * Called after internal onChange. Checks input validity. If all fields are valid,
26022
+ * calls props.onChange.
26023
+ */
26024
+ function onChangeExternal() {
26025
+ if (!onChangeProps) {
26026
+ return;
26027
+ }
26028
+ function filterBoolean(value) {
26029
+ return Boolean(value);
26030
+ }
26031
+ var formElements = [
26032
+ amPmInput.current,
26033
+ hour12Input.current,
26034
+ hour24Input.current,
26035
+ minuteInput.current,
26036
+ secondInput.current,
26037
+ ].filter(filterBoolean);
26038
+ var formElementsWithoutSelect = formElements.slice(1);
26039
+ var values = {};
26040
+ formElements.forEach(function (formElement) {
26041
+ values[formElement.name] =
26042
+ formElement.type === 'number'
26043
+ ? 'valueAsNumber' in formElement
26044
+ ? formElement.valueAsNumber
26045
+ : Number(formElement.value)
26046
+ : formElement.value;
26047
+ });
26048
+ var isEveryValueEmpty = formElementsWithoutSelect.every(function (formElement) { return !formElement.value; });
26049
+ if (isEveryValueEmpty) {
26050
+ onChangeProps(null, false);
26051
+ return;
26052
+ }
26053
+ var isEveryValueFilled = formElements.every(function (formElement) { return formElement.value; });
26054
+ var isEveryValueValid = formElements.every(function (formElement) { return formElement.validity.valid; });
26055
+ if (isEveryValueFilled && isEveryValueValid) {
26056
+ var hour_1 = Number(values.hour24 ||
26057
+ (values.hour12 && values.amPm && convert12to24(values.hour12, values.amPm)) ||
26058
+ 0);
26059
+ var minute_1 = Number(values.minute || 0);
26060
+ var second_1 = Number(values.second || 0);
26061
+ var padStart = function (num) { return "0".concat(num).slice(-2); };
26062
+ var proposedValue = "".concat(padStart(hour_1), ":").concat(padStart(minute_1), ":").concat(padStart(second_1));
26063
+ var processedValue = getProcessedValue(proposedValue);
26064
+ onChangeProps(processedValue, false);
26065
+ return;
26066
+ }
26067
+ if (!onInvalidChange) {
26068
+ return;
26069
+ }
26070
+ onInvalidChange();
26071
+ }
26072
+ /**
26073
+ * Called when non-native date input is changed.
26074
+ */
26075
+ function onChange(event) {
26076
+ var _a = event.target, name = _a.name, value = _a.value;
26077
+ switch (name) {
26078
+ case 'amPm':
26079
+ setAmPm(value);
26080
+ break;
26081
+ case 'hour12':
26082
+ setHour(value ? convert12to24(value, amPm || 'am').toString() : '');
26083
+ break;
26084
+ case 'hour24':
26085
+ setHour(value);
26086
+ break;
26087
+ case 'minute':
26088
+ setMinute(value);
26089
+ break;
26090
+ case 'second':
26091
+ setSecond(value);
26092
+ break;
26093
+ }
26094
+ onChangeExternal();
26095
+ }
26096
+ /**
26097
+ * Called when native date input is changed.
26098
+ */
26099
+ function onChangeNative(event) {
26100
+ var value = event.target.value;
26101
+ if (!onChangeProps) {
26102
+ return;
26103
+ }
26104
+ var processedValue = value || null;
26105
+ onChangeProps(processedValue, false);
26106
+ }
26107
+ var commonInputProps = {
26108
+ className: className,
26109
+ disabled: disabled,
26110
+ maxTime: maxTime,
26111
+ minTime: minTime,
26112
+ onChange: onChange,
26113
+ onKeyDown: onKeyDown,
26114
+ onKeyUp: onKeyUp,
26115
+ // This is only for showing validity when editing
26116
+ required: Boolean(required || isClockOpen),
26117
+ };
26118
+ function renderHour12(currentMatch, index) {
26119
+ if (currentMatch && currentMatch.length > 2) {
26120
+ throw new Error("Unsupported token: ".concat(currentMatch));
26121
+ }
26122
+ var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
26123
+ return (React__default.createElement(Hour12Input, __assign$1({ key: "hour12" }, commonInputProps, { amPm: amPm, ariaLabel: hourAriaLabel,
26124
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26125
+ autoFocus: index === 0 && autoFocus, inputRef: hour12Input, placeholder: hourPlaceholder, showLeadingZeros: showLeadingZeros, value: hour })));
26126
+ }
26127
+ function renderHour24(currentMatch, index) {
26128
+ if (currentMatch && currentMatch.length > 2) {
26129
+ throw new Error("Unsupported token: ".concat(currentMatch));
26130
+ }
26131
+ var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
26132
+ return (React__default.createElement(Hour24Input, __assign$1({ key: "hour24" }, commonInputProps, { ariaLabel: hourAriaLabel,
26133
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26134
+ autoFocus: index === 0 && autoFocus, inputRef: hour24Input, placeholder: hourPlaceholder, showLeadingZeros: showLeadingZeros, value: hour })));
26135
+ }
26136
+ function renderHour(currentMatch, index) {
26137
+ if (/h/.test(currentMatch)) {
26138
+ return renderHour12(currentMatch, index);
26139
+ }
26140
+ return renderHour24(currentMatch, index);
26141
+ }
26142
+ function renderMinute(currentMatch, index) {
26143
+ if (currentMatch && currentMatch.length > 2) {
26144
+ throw new Error("Unsupported token: ".concat(currentMatch));
26145
+ }
26146
+ var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
26147
+ return (React__default.createElement(MinuteInput, __assign$1({ key: "minute" }, commonInputProps, { ariaLabel: minuteAriaLabel,
26148
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26149
+ autoFocus: index === 0 && autoFocus, hour: hour, inputRef: minuteInput, placeholder: minutePlaceholder, showLeadingZeros: showLeadingZeros, value: minute })));
26150
+ }
26151
+ function renderSecond(currentMatch, index) {
26152
+ if (currentMatch && currentMatch.length > 2) {
26153
+ throw new Error("Unsupported token: ".concat(currentMatch));
26154
+ }
26155
+ var showLeadingZeros = currentMatch ? currentMatch.length === 2 : true;
26156
+ return (React__default.createElement(SecondInput, __assign$1({ key: "second" }, commonInputProps, { ariaLabel: secondAriaLabel,
26157
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26158
+ autoFocus: index === 0 && autoFocus, hour: hour, inputRef: secondInput, minute: minute, placeholder: secondPlaceholder, showLeadingZeros: showLeadingZeros, value: second })));
26159
+ }
26160
+ function renderAmPm(currentMatch, index) {
26161
+ return (React__default.createElement(AmPm, __assign$1({ key: "ampm" }, commonInputProps, { ariaLabel: amPmAriaLabel,
26162
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26163
+ autoFocus: index === 0 && autoFocus, inputRef: amPmInput, locale: locale, onChange: onChange, value: amPm })));
26164
+ }
26165
+ function renderCustomInputsInternal() {
26166
+ var elementFunctions = {
26167
+ h: renderHour,
26168
+ H: renderHour,
26169
+ m: renderMinute,
26170
+ s: renderSecond,
26171
+ a: renderAmPm,
26172
+ };
26173
+ var allowMultipleInstances = typeof format !== 'undefined';
26174
+ return renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances);
26175
+ }
26176
+ function renderNativeInput() {
26177
+ return (React__default.createElement(NativeInput, { key: "time", ariaLabel: nativeInputAriaLabel, disabled: disabled, maxTime: maxTime, minTime: minTime, name: name, onChange: onChangeNative, required: required, value: value, valueType: valueType }));
26178
+ }
26179
+ return (
26180
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
26181
+ React__default.createElement("div", { className: className, onClick: onClick },
26182
+ renderNativeInput(),
26183
+ renderCustomInputsInternal()));
26184
+ }
26185
+
26186
+ var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
26187
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
26188
+ if (ar || !(i in from)) {
26189
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
26190
+ ar[i] = from[i];
26191
+ }
26192
+ }
26193
+ return to.concat(ar || Array.prototype.slice.call(from));
26194
+ };
26195
+ var allViews$1 = ['hour', 'minute', 'second'];
26196
+ var allValueTypes = __spreadArray([], allViews$1, true);
26197
+ var hourOptionalSecondsRegExp = /^(([0-1])?[0-9]|2[0-3]):[0-5][0-9](:([0-5][0-9]))?$/;
26198
+ var isTime = function isTime(props, propName, componentName) {
26199
+ var _a = props, _b = propName, time = _a[_b];
26200
+ if (time) {
26201
+ if (typeof time !== 'string' || !hourOptionalSecondsRegExp.test(time)) {
26202
+ return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof time, "` supplied to `").concat(componentName, "`, expected time in HH:mm(:ss) format."));
26203
+ }
26204
+ }
26205
+ // Everything is fine
26206
+ return null;
26207
+ };
26208
+ propTypes$1.exports.oneOf(allValueTypes);
26209
+ propTypes$1.exports.oneOfType([
26210
+ propTypes$1.exports.func,
26211
+ propTypes$1.exports.exact({
26212
+ current: propTypes$1.exports.any,
26213
+ }),
26214
+ ]);
26215
+ var rangeOf = function (type) {
26216
+ return propTypes$1.exports.arrayOf(type);
26217
+ };
26218
+
26219
+ var __assign = (undefined && undefined.__assign) || function () {
26220
+ __assign = Object.assign || function(t) {
26221
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
26222
+ s = arguments[i];
26223
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
26224
+ t[p] = s[p];
26225
+ }
26226
+ return t;
26227
+ };
26228
+ return __assign.apply(this, arguments);
26229
+ };
26230
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
26231
+ var t = {};
26232
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
26233
+ t[p] = s[p];
26234
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
26235
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
26236
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
26237
+ t[p[i]] = s[p[i]];
26238
+ }
26239
+ return t;
26240
+ };
26241
+ var isBrowser$4 = typeof document !== 'undefined';
26242
+ var baseClassName = 'react-time-picker';
26243
+ var outsideActionEvents = ['mousedown', 'focusin', 'touchstart'];
26244
+ var allViews = ['hour', 'minute', 'second'];
26245
+ var iconProps = {
26246
+ xmlns: 'http://www.w3.org/2000/svg',
26247
+ width: 19,
26248
+ height: 19,
26249
+ viewBox: '0 0 19 19',
26250
+ stroke: 'black',
26251
+ strokeWidth: 2,
26252
+ };
26253
+ var ClockIcon = (React__default.createElement("svg", __assign({}, iconProps, { className: "".concat(baseClassName, "__clock-button__icon ").concat(baseClassName, "__button__icon"), fill: "none" }),
26254
+ React__default.createElement("circle", { cx: "9.5", cy: "9.5", r: "7.5" }),
26255
+ React__default.createElement("path", { d: "M9.5 4.5 v5 h4" })));
26256
+ var ClearIcon = (React__default.createElement("svg", __assign({}, iconProps, { className: "".concat(baseClassName, "__clear-button__icon ").concat(baseClassName, "__button__icon") }),
26257
+ React__default.createElement("line", { x1: "4", x2: "15", y1: "4", y2: "15" }),
26258
+ React__default.createElement("line", { x1: "15", x2: "4", y1: "4", y2: "15" })));
26259
+ var TimePicker$1 = function TimePicker(props) {
26260
+ var amPmAriaLabel = props.amPmAriaLabel, autoFocus = props.autoFocus, className = props.className, clearAriaLabel = props.clearAriaLabel, _a = props.clearIcon, clearIcon = _a === void 0 ? ClearIcon : _a, clockAriaLabel = props.clockAriaLabel, _b = props.clockIcon, clockIcon = _b === void 0 ? ClockIcon : _b, _c = props.closeClock, shouldCloseClockOnSelect = _c === void 0 ? true : _c, dataTestid = props["data-testid"], hourAriaLabel = props.hourAriaLabel, hourPlaceholder = props.hourPlaceholder, disableClock = props.disableClock, disabled = props.disabled, format = props.format, id = props.id, _d = props.isOpen, isOpenProps = _d === void 0 ? null : _d, locale = props.locale, maxTime = props.maxTime, _e = props.maxDetail, maxDetail = _e === void 0 ? 'minute' : _e, minTime = props.minTime, minuteAriaLabel = props.minuteAriaLabel, minutePlaceholder = props.minutePlaceholder, _f = props.name, name = _f === void 0 ? 'time' : _f, nativeInputAriaLabel = props.nativeInputAriaLabel, onClockClose = props.onClockClose, onClockOpen = props.onClockOpen, onChangeProps = props.onChange, onFocusProps = props.onFocus, onInvalidChange = props.onInvalidChange, _g = props.openClockOnFocus, openClockOnFocus = _g === void 0 ? true : _g, required = props.required, value = props.value, secondAriaLabel = props.secondAriaLabel, secondPlaceholder = props.secondPlaceholder, shouldCloseClock = props.shouldCloseClock, shouldOpenClock = props.shouldOpenClock, otherProps = __rest(props, ["amPmAriaLabel", "autoFocus", "className", "clearAriaLabel", "clearIcon", "clockAriaLabel", "clockIcon", "closeClock", 'data-testid', "hourAriaLabel", "hourPlaceholder", "disableClock", "disabled", "format", "id", "isOpen", "locale", "maxTime", "maxDetail", "minTime", "minuteAriaLabel", "minutePlaceholder", "name", "nativeInputAriaLabel", "onClockClose", "onClockOpen", "onChange", "onFocus", "onInvalidChange", "openClockOnFocus", "required", "value", "secondAriaLabel", "secondPlaceholder", "shouldCloseClock", "shouldOpenClock"]);
26261
+ var _h = useState(isOpenProps), isOpen = _h[0], setIsOpen = _h[1];
26262
+ var wrapper = useRef(null);
26263
+ var clockWrapper = useRef(null);
26264
+ useEffect(function () {
26265
+ setIsOpen(isOpenProps);
26266
+ }, [isOpenProps]);
26267
+ function openClock(_a) {
26268
+ var reason = _a.reason;
26269
+ if (shouldOpenClock) {
26270
+ if (!shouldOpenClock({ reason: reason })) {
26271
+ return;
26272
+ }
26273
+ }
26274
+ setIsOpen(true);
26275
+ if (onClockOpen) {
26276
+ onClockOpen();
26277
+ }
26278
+ }
26279
+ var closeClock = useCallback(function (_a) {
26280
+ var reason = _a.reason;
26281
+ if (shouldCloseClock) {
26282
+ if (!shouldCloseClock({ reason: reason })) {
26283
+ return;
26284
+ }
26285
+ }
26286
+ setIsOpen(false);
26287
+ if (onClockClose) {
26288
+ onClockClose();
26289
+ }
26290
+ }, [onClockClose, shouldCloseClock]);
26291
+ function toggleClock() {
26292
+ if (isOpen) {
26293
+ closeClock({ reason: 'buttonClick' });
26294
+ }
26295
+ else {
26296
+ openClock({ reason: 'buttonClick' });
26297
+ }
26298
+ }
26299
+ function onChange(value, shouldCloseClock) {
26300
+ if (shouldCloseClock === void 0) { shouldCloseClock = shouldCloseClockOnSelect; }
26301
+ if (shouldCloseClock) {
26302
+ closeClock({ reason: 'select' });
26303
+ }
26304
+ if (onChangeProps) {
26305
+ onChangeProps(value);
26306
+ }
26307
+ }
26308
+ function onFocus(event) {
26309
+ if (onFocusProps) {
26310
+ onFocusProps(event);
26311
+ }
26312
+ if (
26313
+ // Internet Explorer still fires onFocus on disabled elements
26314
+ disabled ||
26315
+ isOpen ||
26316
+ !openClockOnFocus ||
26317
+ event.target.dataset.select === 'true') {
26318
+ return;
26319
+ }
26320
+ openClock({ reason: 'focus' });
26321
+ }
26322
+ var onKeyDown = useCallback(function (event) {
26323
+ if (event.key === 'Escape') {
26324
+ closeClock({ reason: 'escape' });
26325
+ }
26326
+ }, [closeClock]);
26327
+ function clear() {
26328
+ onChange(null);
26329
+ }
26330
+ function stopPropagation(event) {
26331
+ event.stopPropagation();
26332
+ }
26333
+ var onOutsideAction = useCallback(function (event) {
26334
+ var wrapperEl = wrapper.current;
26335
+ var clockWrapperEl = clockWrapper.current;
26336
+ // Try event.composedPath first to handle clicks inside a Shadow DOM.
26337
+ var target = ('composedPath' in event ? event.composedPath()[0] : event.target);
26338
+ if (target &&
26339
+ wrapperEl &&
26340
+ !wrapperEl.contains(target) &&
26341
+ (!clockWrapperEl || !clockWrapperEl.contains(target))) {
26342
+ closeClock({ reason: 'outsideAction' });
26343
+ }
26344
+ }, [clockWrapper, closeClock, wrapper]);
26345
+ var handleOutsideActionListeners = useCallback(function (shouldListen) {
26346
+ if (shouldListen === void 0) { shouldListen = isOpen; }
26347
+ outsideActionEvents.forEach(function (event) {
26348
+ if (shouldListen) {
26349
+ document.addEventListener(event, onOutsideAction);
26350
+ }
26351
+ else {
26352
+ document.removeEventListener(event, onOutsideAction);
26353
+ }
26354
+ });
26355
+ if (shouldListen) {
26356
+ document.addEventListener('keydown', onKeyDown);
26357
+ }
26358
+ else {
26359
+ document.removeEventListener('keydown', onKeyDown);
26360
+ }
26361
+ }, [isOpen, onOutsideAction, onKeyDown]);
26362
+ useEffect(function () {
26363
+ handleOutsideActionListeners();
26364
+ return function () {
26365
+ handleOutsideActionListeners(false);
26366
+ };
26367
+ }, [handleOutsideActionListeners]);
26368
+ function renderInputs() {
26369
+ var valueFrom = (Array.isArray(value) ? value : [value])[0];
26370
+ var ariaLabelProps = {
26371
+ amPmAriaLabel: amPmAriaLabel,
26372
+ hourAriaLabel: hourAriaLabel,
26373
+ minuteAriaLabel: minuteAriaLabel,
26374
+ nativeInputAriaLabel: nativeInputAriaLabel,
26375
+ secondAriaLabel: secondAriaLabel,
26376
+ };
26377
+ var placeholderProps = {
26378
+ hourPlaceholder: hourPlaceholder,
26379
+ minutePlaceholder: minutePlaceholder,
26380
+ secondPlaceholder: secondPlaceholder,
26381
+ };
26382
+ return (React__default.createElement("div", { className: "".concat(baseClassName, "__wrapper") },
26383
+ React__default.createElement(TimeInput, __assign({}, ariaLabelProps, placeholderProps, {
26384
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26385
+ autoFocus: autoFocus, className: "".concat(baseClassName, "__inputGroup"), disabled: disabled, format: format, isClockOpen: isOpen, locale: locale, maxDetail: maxDetail, maxTime: maxTime, minTime: minTime, name: name, onChange: onChange, onInvalidChange: onInvalidChange, required: required, value: valueFrom })),
26386
+ clearIcon !== null && (React__default.createElement("button", { "aria-label": clearAriaLabel, className: "".concat(baseClassName, "__clear-button ").concat(baseClassName, "__button"), disabled: disabled, onClick: clear, onFocus: stopPropagation, type: "button" }, typeof clearIcon === 'function' ? React__default.createElement(clearIcon) : clearIcon)),
26387
+ clockIcon !== null && !disableClock && (React__default.createElement("button", { "aria-label": clockAriaLabel, className: "".concat(baseClassName, "__clock-button ").concat(baseClassName, "__button"), disabled: disabled, onClick: toggleClock, onFocus: stopPropagation, type: "button" }, typeof clockIcon === 'function' ? React__default.createElement(clockIcon) : clockIcon))));
26388
+ }
26389
+ function renderClock() {
26390
+ if (isOpen === null || disableClock) {
26391
+ return null;
26392
+ }
26393
+ var clockClassName = props.clockClassName; props.className; // Unused, here to exclude it from clockProps
26394
+ props.onChange; // Unused, here to exclude it from clockProps
26395
+ var portalContainer = props.portalContainer, value = props.value, clockProps = __rest(props, ["clockClassName", "className", "onChange", "portalContainer", "value"]);
26396
+ var className = "".concat(baseClassName, "__clock");
26397
+ var classNames = clsx$1(className, "".concat(className, "--").concat(isOpen ? 'open' : 'closed'));
26398
+ var valueFrom = (Array.isArray(value) ? value : [value])[0];
26399
+ var clock = React__default.createElement(Clock, __assign({ className: clockClassName, value: valueFrom }, clockProps));
26400
+ return portalContainer ? (createPortal(React__default.createElement("div", { ref: clockWrapper, className: classNames }, clock), portalContainer)) : (React__default.createElement(Fit, null,
26401
+ React__default.createElement("div", { ref: function (ref) {
26402
+ if (ref && !isOpen) {
26403
+ ref.removeAttribute('style');
26404
+ }
26405
+ }, className: classNames }, clock)));
26406
+ }
26407
+ var eventProps = useMemo(function () { return makeEventProps(otherProps); }, [otherProps]);
26408
+ return (React__default.createElement("div", __assign({ className: clsx$1(baseClassName, "".concat(baseClassName, "--").concat(isOpen ? 'open' : 'closed'), "".concat(baseClassName, "--").concat(disabled ? 'disabled' : 'enabled'), className), "data-testid": dataTestid, id: id }, eventProps, { onFocus: onFocus, ref: wrapper }),
26409
+ renderInputs(),
26410
+ renderClock()));
26411
+ };
26412
+ var isValue = propTypes$1.exports.oneOfType([isTime, propTypes$1.exports.instanceOf(Date)]);
26413
+ var isValueOrValueArray = propTypes$1.exports.oneOfType([isValue, rangeOf(isValue)]);
26414
+ TimePicker$1.propTypes = {
26415
+ amPmAriaLabel: propTypes$1.exports.string,
26416
+ autoFocus: propTypes$1.exports.bool,
26417
+ className: propTypes$1.exports.oneOfType([propTypes$1.exports.string, propTypes$1.exports.arrayOf(propTypes$1.exports.string)]),
26418
+ clearAriaLabel: propTypes$1.exports.string,
26419
+ clearIcon: propTypes$1.exports.oneOfType([propTypes$1.exports.node, propTypes$1.exports.func]),
26420
+ clockAriaLabel: propTypes$1.exports.string,
26421
+ clockClassName: propTypes$1.exports.oneOfType([propTypes$1.exports.string, propTypes$1.exports.arrayOf(propTypes$1.exports.string)]),
26422
+ clockIcon: propTypes$1.exports.oneOfType([propTypes$1.exports.node, propTypes$1.exports.func]),
26423
+ closeClock: propTypes$1.exports.bool,
26424
+ 'data-testid': propTypes$1.exports.string,
26425
+ disableClock: propTypes$1.exports.bool,
26426
+ disabled: propTypes$1.exports.bool,
26427
+ format: propTypes$1.exports.string,
26428
+ hourAriaLabel: propTypes$1.exports.string,
26429
+ hourPlaceholder: propTypes$1.exports.string,
26430
+ id: propTypes$1.exports.string,
26431
+ isOpen: propTypes$1.exports.bool,
26432
+ locale: propTypes$1.exports.string,
26433
+ maxDetail: propTypes$1.exports.oneOf(allViews),
26434
+ maxTime: isTime,
26435
+ minTime: isTime,
26436
+ minuteAriaLabel: propTypes$1.exports.string,
26437
+ minutePlaceholder: propTypes$1.exports.string,
26438
+ name: propTypes$1.exports.string,
26439
+ nativeInputAriaLabel: propTypes$1.exports.string,
26440
+ onChange: propTypes$1.exports.func,
26441
+ onClockClose: propTypes$1.exports.func,
26442
+ onClockOpen: propTypes$1.exports.func,
26443
+ onFocus: propTypes$1.exports.func,
26444
+ openClockOnFocus: propTypes$1.exports.bool,
26445
+ required: propTypes$1.exports.bool,
26446
+ secondAriaLabel: propTypes$1.exports.string,
26447
+ secondPlaceholder: propTypes$1.exports.string,
26448
+ value: isValueOrValueArray,
26449
+ };
26450
+ if (isBrowser$4) {
26451
+ TimePicker$1.propTypes.portalContainer = propTypes$1.exports.instanceOf(HTMLElement);
26452
+ }
26453
+
26454
+ var HoverIcon = function HoverIcon(_ref) {
26455
+ var _ref$time = _ref.time,
26456
+ time = _ref$time === void 0 ? false : _ref$time;
26457
+ var _useState = useState(false),
26458
+ _useState2 = _slicedToArray$3(_useState, 2),
26459
+ hovered = _useState2[0],
26460
+ setHovered = _useState2[1];
26461
+ return /*#__PURE__*/React__default.createElement("div", {
26462
+ onMouseLeave: function onMouseLeave() {
26463
+ return setHovered(false);
26464
+ },
26465
+ onMouseOver: function onMouseOver() {
26466
+ return setHovered(true);
25415
26467
  }
25416
26468
  }, hovered && time ? /*#__PURE__*/React__default.createElement(Close, {
25417
26469
  size: 16
@@ -25420,7 +26472,29 @@ var HoverIcon = function HoverIcon(_ref) {
25420
26472
  }));
25421
26473
  };
25422
26474
 
25423
- var _excluded$v = ["className", "label", "labelProps", "size", "nakedInput", "required", "value", "onChange", "error", "onBlur"];
26475
+ var FORMAT = "HH:mm";
26476
+ var getFormattedTime = function getFormattedTime(value) {
26477
+ if (dayjs.isDayjs(value)) {
26478
+ return value.toDate();
26479
+ } else if (value instanceof Date || dayjs(value, FORMAT).isValid()) {
26480
+ return value;
26481
+ }
26482
+ return null;
26483
+ };
26484
+ var getFormattedRange = function getFormattedRange(value) {
26485
+ if (!Array.isArray(value)) return null;
26486
+ return value.map(function (item) {
26487
+ return getFormattedTime(item);
26488
+ });
26489
+ };
26490
+ var toDayJs = function toDayJs(value) {
26491
+ if (Array.isArray(value)) return value.map(function (item) {
26492
+ return dayjs(item, FORMAT);
26493
+ });
26494
+ return dayjs(value, FORMAT);
26495
+ };
26496
+
26497
+ var _excluded$v = ["type", "className", "label", "labelProps", "size", "nakedInput", "required", "value", "defaultValue", "onChange", "error", "onBlur"];
25424
26498
  function ownKeys$l(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
25425
26499
  function _objectSpread$k(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$l(Object(source), !0).forEach(function (key) { _defineProperty$7(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$l(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25426
26500
  dayjs.extend(customParseFormat);
@@ -25429,9 +26503,14 @@ var INPUT_SIZES$1 = {
25429
26503
  medium: "medium",
25430
26504
  large: "large"
25431
26505
  };
25432
- var FORMAT = "HH:mm";
26506
+ var timeComponents = {
26507
+ range: TimeRangePicker,
26508
+ time: TimePicker$1
26509
+ };
25433
26510
  var TimePickerInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25434
- var _ref$className = _ref.className,
26511
+ var _ref$type = _ref.type,
26512
+ type = _ref$type === void 0 ? "time" : _ref$type,
26513
+ _ref$className = _ref.className,
25435
26514
  className = _ref$className === void 0 ? "" : _ref$className,
25436
26515
  label = _ref.label,
25437
26516
  labelProps = _ref.labelProps,
@@ -25442,30 +26521,44 @@ var TimePickerInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25442
26521
  _ref$required = _ref.required,
25443
26522
  required = _ref$required === void 0 ? false : _ref$required,
25444
26523
  inputValue = _ref.value,
25445
- onChange = _ref.onChange,
26524
+ defaultValue = _ref.defaultValue,
26525
+ _ref$onChange = _ref.onChange,
26526
+ onChange = _ref$onChange === void 0 ? noop$3 : _ref$onChange,
25446
26527
  _ref$error = _ref.error,
25447
26528
  error = _ref$error === void 0 ? "" : _ref$error,
25448
26529
  _ref$onBlur = _ref.onBlur,
25449
26530
  onBlur = _ref$onBlur === void 0 ? noop$3 : _ref$onBlur,
25450
26531
  otherProps = _objectWithoutProperties$1(_ref, _excluded$v);
25451
- var value = useMemo(function () {
25452
- if (isPresent(inputValue) && dayjs(inputValue).isValid()) {
25453
- return inputValue.format(FORMAT);
25454
- }
25455
- return null;
25456
- }, [inputValue]);
26532
+ var _useState = useState(null),
26533
+ _useState2 = _slicedToArray$3(_useState, 2),
26534
+ value = _useState2[0],
26535
+ setValue = _useState2[1];
25457
26536
  var id = useId(otherProps.id);
25458
26537
  var errorId = "error_".concat(id);
26538
+ useEffect(function () {
26539
+ if (isNotPresent(inputValue) && isNotPresent(defaultValue)) return;
26540
+ setValue((type === "range" ? getFormattedRange : getFormattedTime)(inputValue || defaultValue));
26541
+ }, [type, inputValue]);
25459
26542
  var handleChange = function handleChange(newValue) {
25460
- var time = dayjs(newValue, FORMAT);
25461
- onChange(time, newValue);
26543
+ setValue(newValue);
26544
+ onChange(toDayJs(newValue), newValue);
26545
+ };
26546
+ var handleShouldCloseClock = function handleShouldCloseClock() {
26547
+ onBlur(toDayJs(value), value);
26548
+ return true;
25462
26549
  };
26550
+ var handleKeyDown = function handleKeyDown(_ref2) {
26551
+ var code = _ref2.code;
26552
+ if (code !== "Enter") return;
26553
+ onBlur(toDayJs(value), value);
26554
+ };
26555
+ var Component = timeComponents[type];
25463
26556
  return /*#__PURE__*/React__default.createElement("div", {
25464
26557
  ref: ref,
25465
26558
  className: "neeto-ui-input__wrapper"
25466
26559
  }, label && /*#__PURE__*/React__default.createElement(Label, _objectSpread$k({
25467
26560
  required: required
25468
- }, labelProps), label), /*#__PURE__*/React__default.createElement(TimePicker$1, _extends$4({
26561
+ }, labelProps), label), /*#__PURE__*/React__default.createElement(Component, _extends$4({
25469
26562
  id: id,
25470
26563
  value: value,
25471
26564
  disableClock: true,
@@ -25476,6 +26569,7 @@ var TimePickerInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25476
26569
  hourPlaceholder: "HH",
25477
26570
  minutePlaceholder: "mm",
25478
26571
  secondAriaLabel: "ss",
26572
+ shouldCloseClock: handleShouldCloseClock,
25479
26573
  className: classnames$1("neeto-ui-time-picker", [className], {
25480
26574
  "neeto-ui-time-picker--small": size === "small",
25481
26575
  "neeto-ui-time-picker--medium": size === "medium",
@@ -25484,13 +26578,8 @@ var TimePickerInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25484
26578
  "neeto-ui-time-picker--naked": nakedInput,
25485
26579
  "neeto-ui-time-picker--error": !!error
25486
26580
  }),
25487
- shouldCloseClock: function shouldCloseClock(_ref2) {
25488
- var reason = _ref2.reason;
25489
- if (reason !== "outsideAction") return true;
25490
- onBlur();
25491
- return true;
25492
- },
25493
- onChange: handleChange
26581
+ onChange: handleChange,
26582
+ onKeyDown: handleKeyDown
25494
26583
  }, otherProps)), !!error && typeof error === "string" && /*#__PURE__*/React__default.createElement("p", {
25495
26584
  className: "neeto-ui-input__error",
25496
26585
  "data-cy": "".concat(hyphenize(label), "-input-error"),
@@ -25499,11 +26588,18 @@ var TimePickerInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25499
26588
  });
25500
26589
  TimePickerInput.displayName = "TimePicker";
25501
26590
 
26591
+ var DATE_FORMAT = "YYYY-MM-DD";
26592
+ var TIME_FORMAT = "HH:mm";
26593
+ var getDateTime = function getDateTime(date, time) {
26594
+ if (isPresent(date) && isPresent(time)) {
26595
+ return dayjs("".concat(date.format(DATE_FORMAT), " ").concat(time.format(TIME_FORMAT)));
26596
+ }
26597
+ return null;
26598
+ };
26599
+
25502
26600
  function ownKeys$k(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
25503
26601
  function _objectSpread$j(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$k(Object(source), !0).forEach(function (key) { _defineProperty$7(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$k(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25504
26602
  dayjs.extend(customParseFormat);
25505
- var DATE_FORMAT = "YYYY-MM-DD";
25506
- var TIME_FORMAT = "HH:mm";
25507
26603
  var DateTimePicker = function DateTimePicker(_ref) {
25508
26604
  var _ref$className = _ref.className,
25509
26605
  className = _ref$className === void 0 ? "" : _ref$className,
@@ -25525,10 +26621,12 @@ var DateTimePicker = function DateTimePicker(_ref) {
25525
26621
  _ref$required = _ref.required,
25526
26622
  required = _ref$required === void 0 ? false : _ref$required,
25527
26623
  id = _ref.id,
26624
+ datePickerProps = _ref.datePickerProps,
26625
+ timePickerProps = _ref.timePickerProps,
25528
26626
  _ref$onTimeInputBlur = _ref.onTimeInputBlur,
25529
26627
  onTimeInputBlur = _ref$onTimeInputBlur === void 0 ? noop$3 : _ref$onTimeInputBlur,
25530
- datePickerProps = _ref.datePickerProps,
25531
- timePickerProps = _ref.timePickerProps;
26628
+ _ref$onBlur = _ref.onBlur,
26629
+ onBlur = _ref$onBlur === void 0 ? noop$3 : _ref$onBlur;
25532
26630
  var _useState = useState(datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.open),
25533
26631
  _useState2 = _slicedToArray$3(_useState, 2),
25534
26632
  open = _useState2[0],
@@ -25558,11 +26656,7 @@ var DateTimePicker = function DateTimePicker(_ref) {
25558
26656
  }, [value, defaultValue]);
25559
26657
  useEffect(function () {
25560
26658
  if (isNotPresent(changedField)) return;
25561
- if (isPresent(date) && isPresent(time)) {
25562
- onChange(dayjs("".concat(date.format(DATE_FORMAT), " ").concat(time.format(TIME_FORMAT))), changedField);
25563
- } else {
25564
- onChange(null, changedField);
25565
- }
26659
+ onChange(getDateTime(date, time), changedField);
25566
26660
  setChangedField(); // reset to avoid unnecessary trigger on rerender
25567
26661
  }, [date, time, changedField]);
25568
26662
  var handleDateChange = function handleDateChange(newDate) {
@@ -25578,6 +26672,10 @@ var DateTimePicker = function DateTimePicker(_ref) {
25578
26672
  if (newTime.isValid() && !date) setDate(newTime);
25579
26673
  setChangedField("time");
25580
26674
  };
26675
+ var handleTimeBlur = function handleTimeBlur() {
26676
+ onTimeInputBlur(getDateTime(date, time));
26677
+ onBlur(getDateTime(date, time));
26678
+ };
25581
26679
  return /*#__PURE__*/React__default.createElement("div", {
25582
26680
  className: "neeto-ui-input__wrapper"
25583
26681
  }, label && /*#__PURE__*/React__default.createElement(Label, _objectSpread$j({
@@ -25607,7 +26705,7 @@ var DateTimePicker = function DateTimePicker(_ref) {
25607
26705
  error: error,
25608
26706
  nakedInput: nakedInput,
25609
26707
  size: size
25610
- }, "error", !!error), "ref", timeRef), "value", time), "onBlur", onTimeInputBlur), "onChange", handleTimeChange), timePickerProps))), !!error && /*#__PURE__*/React__default.createElement("p", {
26708
+ }, "error", !!error), "ref", timeRef), "value", time), "onBlur", handleTimeBlur), "onChange", handleTimeChange), timePickerProps))), !!error && /*#__PURE__*/React__default.createElement("p", {
25611
26709
  className: "neeto-ui-input__error",
25612
26710
  "data-cy": "".concat(hyphenize(label), "-input-error"),
25613
26711
  id: errorId