@bigbinary/neetoui 6.2.6 → 6.3.0

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 = {
@@ -22833,7 +22833,7 @@ var customParseFormat$1 = {exports: {}};
22833
22833
 
22834
22834
  var customParseFormat = customParseFormat$1.exports;
22835
22835
 
22836
- var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
22836
+ var __spreadArray$3 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
22837
22837
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
22838
22838
  if (ar || !(i in from)) {
22839
22839
  if (!ar) ar = Array.prototype.slice.call(from, 0, i);
@@ -22924,7 +22924,7 @@ var animationEvents = [
22924
22924
  var transitionEvents = ['onTransitionEnd'];
22925
22925
  var otherEvents = ['onToggle'];
22926
22926
  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);
22927
+ 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
22928
  /**
22929
22929
  * Returns an object with on-event callback props curried with provided args.
22930
22930
  * @param {Object} props Props passed to a component.
@@ -22950,8 +22950,6 @@ function makeEventProps(props, getArgs) {
22950
22950
  return eventProps;
22951
22951
  }
22952
22952
 
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
22953
  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
22954
 
22957
22955
  /**
@@ -23108,8 +23106,8 @@ function Mark(_a) {
23108
23106
  } }, number)) : null));
23109
23107
  }
23110
23108
 
23111
- var __assign$8 = (undefined && undefined.__assign) || function () {
23112
- __assign$8 = Object.assign || function(t) {
23109
+ var __assign$e = (undefined && undefined.__assign) || function () {
23110
+ __assign$e = Object.assign || function(t) {
23113
23111
  for (var s, i = 1, n = arguments.length; i < n; i++) {
23114
23112
  s = arguments[i];
23115
23113
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -23117,10 +23115,10 @@ var __assign$8 = (undefined && undefined.__assign) || function () {
23117
23115
  }
23118
23116
  return t;
23119
23117
  };
23120
- return __assign$8.apply(this, arguments);
23118
+ return __assign$e.apply(this, arguments);
23121
23119
  };
23122
23120
  var MinuteMark = memo$1(function MinuteMark(props) {
23123
- return React__default.createElement(Mark, __assign$8({}, props));
23121
+ return React__default.createElement(Mark, __assign$e({}, props));
23124
23122
  });
23125
23123
 
23126
23124
  /**
@@ -23868,8 +23866,8 @@ function formatHour(locale, hour) {
23868
23866
  return hour.toLocaleString(locale || getUserLocale() || undefined);
23869
23867
  }
23870
23868
 
23871
- var __assign$7 = (undefined && undefined.__assign) || function () {
23872
- __assign$7 = Object.assign || function(t) {
23869
+ var __assign$d = (undefined && undefined.__assign) || function () {
23870
+ __assign$d = Object.assign || function(t) {
23873
23871
  for (var s, i = 1, n = arguments.length; i < n; i++) {
23874
23872
  s = arguments[i];
23875
23873
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -23877,9 +23875,9 @@ var __assign$7 = (undefined && undefined.__assign) || function () {
23877
23875
  }
23878
23876
  return t;
23879
23877
  };
23880
- return __assign$7.apply(this, arguments);
23878
+ return __assign$d.apply(this, arguments);
23881
23879
  };
23882
- var __rest$6 = (undefined && undefined.__rest) || function (s, e) {
23880
+ var __rest$b = (undefined && undefined.__rest) || function (s, e) {
23883
23881
  var t = {};
23884
23882
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
23885
23883
  t[p] = s[p];
@@ -23891,8 +23889,8 @@ var __rest$6 = (undefined && undefined.__rest) || function (s, e) {
23891
23889
  return t;
23892
23890
  };
23893
23891
  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));
23892
+ var _b = _a.formatHour, formatHour$1 = _b === void 0 ? formatHour : _b, locale = _a.locale, number = _a.number, otherProps = __rest$b(_a, ["formatHour", "locale", "number"]);
23893
+ return React__default.createElement(Mark, __assign$d({ number: number ? formatHour$1(locale, number) : null }, otherProps));
23896
23894
  });
23897
23895
 
23898
23896
  function isNumberBetween(min, max) {
@@ -24072,8 +24070,8 @@ var __extends = (undefined && undefined.__extends) || (function () {
24072
24070
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
24073
24071
  };
24074
24072
  })();
24075
- var __assign$6 = (undefined && undefined.__assign) || function () {
24076
- __assign$6 = Object.assign || function(t) {
24073
+ var __assign$c = (undefined && undefined.__assign) || function () {
24074
+ __assign$c = Object.assign || function(t) {
24077
24075
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24078
24076
  s = arguments[i];
24079
24077
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24081,9 +24079,9 @@ var __assign$6 = (undefined && undefined.__assign) || function () {
24081
24079
  }
24082
24080
  return t;
24083
24081
  };
24084
- return __assign$6.apply(this, arguments);
24082
+ return __assign$c.apply(this, arguments);
24085
24083
  };
24086
- var __rest$5 = (undefined && undefined.__rest) || function (s, e) {
24084
+ var __rest$a = (undefined && undefined.__rest) || function (s, e) {
24087
24085
  var t = {};
24088
24086
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24089
24087
  t[p] = s[p];
@@ -24094,9 +24092,9 @@ var __rest$5 = (undefined && undefined.__rest) || function (s, e) {
24094
24092
  }
24095
24093
  return t;
24096
24094
  };
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;
24095
+ var isBrowser$8 = typeof document !== 'undefined';
24096
+ var isDisplayContentsSupported = isBrowser$8 && 'CSS' in window && 'supports' in window.CSS && CSS.supports('display', 'contents');
24097
+ var isMutationObserverSupported = isBrowser$8 && 'MutationObserver' in window;
24100
24098
  function capitalize(string) {
24101
24099
  return (string.charAt(0).toUpperCase() + string.slice(1));
24102
24100
  }
@@ -24196,12 +24194,12 @@ function alignMainAxis(args) {
24196
24194
  alignAxis(args);
24197
24195
  }
24198
24196
  function alignSecondaryAxis(args) {
24199
- alignAxis(__assign$6(__assign$6({}, args), { axis: args.axis === 'x' ? 'y' : 'x', secondary: true }));
24197
+ alignAxis(__assign$c(__assign$c({}, args), { axis: args.axis === 'x' ? 'y' : 'x', secondary: true }));
24200
24198
  }
24201
24199
  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 }));
24200
+ var invertAxis = args.invertAxis, invertSecondaryAxis = args.invertSecondaryAxis, commonArgs = __rest$a(args, ["invertAxis", "invertSecondaryAxis"]);
24201
+ alignMainAxis(__assign$c(__assign$c({}, commonArgs), { invertAxis: invertAxis }));
24202
+ alignSecondaryAxis(__assign$c(__assign$c({}, commonArgs), { invertAxis: invertSecondaryAxis }));
24205
24203
  }
24206
24204
  var Fit = /** @class */ (function (_super) {
24207
24205
  __extends(Fit, _super);
@@ -24316,7 +24314,7 @@ var Fit = /** @class */ (function (_super) {
24316
24314
  return Fit;
24317
24315
  }(Component));
24318
24316
 
24319
- function Divider(_a) {
24317
+ function Divider$1(_a) {
24320
24318
  var children = _a.children;
24321
24319
  return React__default.createElement("span", { className: "react-time-picker__inputGroup__divider" }, children);
24322
24320
  }
@@ -24378,20 +24376,20 @@ function updateInputWidth(element) {
24378
24376
  return width;
24379
24377
  }
24380
24378
 
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) {
24379
+ var isBrowser$7 = typeof document !== 'undefined';
24380
+ var useIsomorphicLayoutEffect$1 = isBrowser$7 ? useLayoutEffect : useEffect;
24381
+ var isIEOrEdgeLegacy$1 = isBrowser$7 && /(MSIE|Trident\/|Edge\/)/.test(navigator.userAgent);
24382
+ var isFirefox$1 = isBrowser$7 && /Firefox/.test(navigator.userAgent);
24383
+ function onFocus$1(event) {
24386
24384
  var target = event.target;
24387
- if (isIEOrEdgeLegacy) {
24385
+ if (isIEOrEdgeLegacy$1) {
24388
24386
  requestAnimationFrame(function () { return target.select(); });
24389
24387
  }
24390
24388
  else {
24391
24389
  target.select();
24392
24390
  }
24393
24391
  }
24394
- function updateInputWidthOnLoad(element) {
24392
+ function updateInputWidthOnLoad$1(element) {
24395
24393
  if (document.readyState === 'complete') {
24396
24394
  return;
24397
24395
  }
@@ -24400,7 +24398,7 @@ function updateInputWidthOnLoad(element) {
24400
24398
  }
24401
24399
  window.addEventListener('load', onLoad);
24402
24400
  }
24403
- function updateInputWidthOnFontLoad(element) {
24401
+ function updateInputWidthOnFontLoad$1(element) {
24404
24402
  if (!document.fonts) {
24405
24403
  return;
24406
24404
  }
@@ -24417,7 +24415,7 @@ function updateInputWidthOnFontLoad(element) {
24417
24415
  }
24418
24416
  document.fonts.addEventListener('loadingdone', onLoadingDone);
24419
24417
  }
24420
- function getSelectionString(input) {
24418
+ function getSelectionString$1(input) {
24421
24419
  /**
24422
24420
  * window.getSelection().toString() returns empty string in IE11 and Firefox,
24423
24421
  * so alternatives come first.
@@ -24435,7 +24433,7 @@ function getSelectionString(input) {
24435
24433
  }
24436
24434
  return null;
24437
24435
  }
24438
- function makeOnKeyPress(maxLength) {
24436
+ function makeOnKeyPress$1(maxLength) {
24439
24437
  if (maxLength === null) {
24440
24438
  return undefined;
24441
24439
  }
@@ -24444,28 +24442,28 @@ function makeOnKeyPress(maxLength) {
24444
24442
  * exceed maxLength.
24445
24443
  */
24446
24444
  return function onKeyPress(event) {
24447
- if (isFirefox) {
24445
+ if (isFirefox$1) {
24448
24446
  // See https://github.com/wojtekmaj/react-time-picker/issues/92
24449
24447
  return;
24450
24448
  }
24451
24449
  var key = event.key, input = event.target;
24452
24450
  var value = input.value;
24453
24451
  var isNumberKey = key.length === 1 && /\d/.test(key);
24454
- var selection = getSelectionString(input);
24452
+ var selection = getSelectionString$1(input);
24455
24453
  if (!isNumberKey || !(selection || value.length < maxLength)) {
24456
24454
  event.preventDefault();
24457
24455
  }
24458
24456
  };
24459
24457
  }
24460
- function Input$3(_a) {
24458
+ function Input$4(_a) {
24461
24459
  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 () {
24460
+ useIsomorphicLayoutEffect$1(function () {
24463
24461
  if (!inputRef || !inputRef.current) {
24464
24462
  return;
24465
24463
  }
24466
24464
  updateInputWidth(inputRef.current);
24467
- updateInputWidthOnLoad(inputRef.current);
24468
- updateInputWidthOnFontLoad(inputRef.current);
24465
+ updateInputWidthOnLoad$1(inputRef.current);
24466
+ updateInputWidthOnFontLoad$1(inputRef.current);
24469
24467
  }, [inputRef, value]);
24470
24468
  var hasLeadingZero = showLeadingZeros &&
24471
24469
  value &&
@@ -24474,7 +24472,7 @@ function Input$3(_a) {
24474
24472
  var maxLength = max ? max.toString().length : null;
24475
24473
  return (React__default.createElement(React__default.Fragment, null,
24476
24474
  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) {
24475
+ 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
24476
  updateInputWidth(event.target);
24479
24477
  if (onKeyUp) {
24480
24478
  onKeyUp(event);
@@ -24482,7 +24480,7 @@ function Input$3(_a) {
24482
24480
  }, placeholder: placeholder, ref: inputRef, required: required, step: step, type: "number", value: value !== null ? value : '' })));
24483
24481
  }
24484
24482
 
24485
- function convert12to24(hour12, amPm) {
24483
+ function convert12to24$1(hour12, amPm) {
24486
24484
  var hour24 = Number(hour12);
24487
24485
  if (amPm === 'am' && hour24 === 12) {
24488
24486
  hour24 = 0;
@@ -24492,33 +24490,33 @@ function convert12to24(hour12, amPm) {
24492
24490
  }
24493
24491
  return hour24;
24494
24492
  }
24495
- function convert24to12(hour24) {
24493
+ function convert24to12$1(hour24) {
24496
24494
  var hour12 = Number(hour24) % 12 || 12;
24497
24495
  return [hour12, Number(hour24) < 12 ? 'am' : 'pm'];
24498
24496
  }
24499
24497
 
24500
- var formatterCache = new Map();
24501
- function getFormatter(options) {
24498
+ var formatterCache$1 = new Map();
24499
+ function getFormatter$1(options) {
24502
24500
  return function formatter(locale, date) {
24503
24501
  var localeWithDefault = locale || getUserLocale();
24504
- if (!formatterCache.has(localeWithDefault)) {
24505
- formatterCache.set(localeWithDefault, new Map());
24502
+ if (!formatterCache$1.has(localeWithDefault)) {
24503
+ formatterCache$1.set(localeWithDefault, new Map());
24506
24504
  }
24507
- var formatterCacheLocale = formatterCache.get(localeWithDefault);
24505
+ var formatterCacheLocale = formatterCache$1.get(localeWithDefault);
24508
24506
  if (!formatterCacheLocale.has(options)) {
24509
24507
  formatterCacheLocale.set(options, new Intl.DateTimeFormat(localeWithDefault || undefined, options).format);
24510
24508
  }
24511
24509
  return formatterCacheLocale.get(options)(date);
24512
24510
  };
24513
24511
  }
24514
- var numberFormatterCache = new Map();
24515
- function getNumberFormatter(options) {
24512
+ var numberFormatterCache$1 = new Map();
24513
+ function getNumberFormatter$1(options) {
24516
24514
  return function (locale, number) {
24517
24515
  var localeWithDefault = locale || getUserLocale();
24518
- if (!numberFormatterCache.has(localeWithDefault)) {
24519
- numberFormatterCache.set(localeWithDefault, new Map());
24516
+ if (!numberFormatterCache$1.has(localeWithDefault)) {
24517
+ numberFormatterCache$1.set(localeWithDefault, new Map());
24520
24518
  }
24521
- var numberFormatterCacheLocale = numberFormatterCache.get(localeWithDefault);
24519
+ var numberFormatterCacheLocale = numberFormatterCache$1.get(localeWithDefault);
24522
24520
  if (!numberFormatterCacheLocale.has(options)) {
24523
24521
  numberFormatterCacheLocale.set(options, new Intl.NumberFormat(localeWithDefault || undefined, options).format);
24524
24522
  }
@@ -24526,14 +24524,14 @@ function getNumberFormatter(options) {
24526
24524
  };
24527
24525
  }
24528
24526
 
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];
24527
+ var nines$1 = ['9', '٩'];
24528
+ var ninesRegExp$1 = new RegExp("[".concat(nines$1.join(''), "]"));
24529
+ var amPmFormatter$1 = getFormatter$1({ hour: 'numeric' });
24530
+ function getAmPmLabels$1(locale) {
24531
+ var amString = amPmFormatter$1(locale, new Date(2017, 0, 1, 9));
24532
+ var pmString = amPmFormatter$1(locale, new Date(2017, 0, 1, 21));
24533
+ var _a = amString.split(ninesRegExp$1), am1 = _a[0], am2 = _a[1];
24534
+ var _b = pmString.split(ninesRegExp$1), pm1 = _b[0], pm2 = _b[1];
24537
24535
  if (pm2 !== undefined) {
24538
24536
  // If pm2 is undefined, nine was not found in pmString - this locale is not using 12-hour time
24539
24537
  if (am1 !== pm1) {
@@ -24546,26 +24544,26 @@ function getAmPmLabels(locale) {
24546
24544
  // Fallback
24547
24545
  return ['AM', 'PM'];
24548
24546
  }
24549
- function isValidNumber(num) {
24547
+ function isValidNumber$1(num) {
24550
24548
  return num !== null && num !== false && !Number.isNaN(Number(num));
24551
24549
  }
24552
- function safeMin() {
24550
+ function safeMin$1() {
24553
24551
  var args = [];
24554
24552
  for (var _i = 0; _i < arguments.length; _i++) {
24555
24553
  args[_i] = arguments[_i];
24556
24554
  }
24557
- return Math.min.apply(Math, args.filter(isValidNumber));
24555
+ return Math.min.apply(Math, args.filter(isValidNumber$1));
24558
24556
  }
24559
- function safeMax() {
24557
+ function safeMax$1() {
24560
24558
  var args = [];
24561
24559
  for (var _i = 0; _i < arguments.length; _i++) {
24562
24560
  args[_i] = arguments[_i];
24563
24561
  }
24564
- return Math.max.apply(Math, args.filter(isValidNumber));
24562
+ return Math.max.apply(Math, args.filter(isValidNumber$1));
24565
24563
  }
24566
24564
 
24567
- var __assign$5 = (undefined && undefined.__assign) || function () {
24568
- __assign$5 = Object.assign || function(t) {
24565
+ var __assign$b = (undefined && undefined.__assign) || function () {
24566
+ __assign$b = Object.assign || function(t) {
24569
24567
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24570
24568
  s = arguments[i];
24571
24569
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24573,9 +24571,9 @@ var __assign$5 = (undefined && undefined.__assign) || function () {
24573
24571
  }
24574
24572
  return t;
24575
24573
  };
24576
- return __assign$5.apply(this, arguments);
24574
+ return __assign$b.apply(this, arguments);
24577
24575
  };
24578
- var __rest$4 = (undefined && undefined.__rest) || function (s, e) {
24576
+ var __rest$9 = (undefined && undefined.__rest) || function (s, e) {
24579
24577
  var t = {};
24580
24578
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24581
24579
  t[p] = s[p];
@@ -24586,20 +24584,20 @@ var __rest$4 = (undefined && undefined.__rest) || function (s, e) {
24586
24584
  }
24587
24585
  return t;
24588
24586
  };
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 &&
24587
+ function Hour12Input$1(_a) {
24588
+ var amPm = _a.amPm, maxTime = _a.maxTime, minTime = _a.minTime, value = _a.value, otherProps = __rest$9(_a, ["amPm", "maxTime", "minTime", "value"]);
24589
+ var maxHour = safeMin$1(12, maxTime &&
24592
24590
  (function () {
24593
- var _a = convert24to12(getHours(maxTime)), maxHourResult = _a[0], maxAmPm = _a[1];
24591
+ var _a = convert24to12$1(getHours(maxTime)), maxHourResult = _a[0], maxAmPm = _a[1];
24594
24592
  if (maxAmPm !== amPm) {
24595
24593
  // pm is always after am, so we should ignore validation
24596
24594
  return null;
24597
24595
  }
24598
24596
  return maxHourResult;
24599
24597
  })());
24600
- var minHour = safeMax(1, minTime &&
24598
+ var minHour = safeMax$1(1, minTime &&
24601
24599
  (function () {
24602
- var _a = convert24to12(getHours(minTime)), minHourResult = _a[0], minAmPm = _a[1];
24600
+ var _a = convert24to12$1(getHours(minTime)), minHourResult = _a[0], minAmPm = _a[1];
24603
24601
  if (
24604
24602
  // pm is always after am, so we should ignore validation
24605
24603
  minAmPm !== amPm ||
@@ -24609,12 +24607,12 @@ function Hour12Input(_a) {
24609
24607
  }
24610
24608
  return minHourResult;
24611
24609
  })());
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)));
24610
+ var value12 = value ? convert24to12$1(value)[0].toString() : '';
24611
+ return (React__default.createElement(Input$4, __assign$b({ max: maxHour, min: minHour, name: "hour12", nameForClass: "hour", value: value12 }, otherProps)));
24614
24612
  }
24615
24613
 
24616
- var __assign$4 = (undefined && undefined.__assign) || function () {
24617
- __assign$4 = Object.assign || function(t) {
24614
+ var __assign$a = (undefined && undefined.__assign) || function () {
24615
+ __assign$a = Object.assign || function(t) {
24618
24616
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24619
24617
  s = arguments[i];
24620
24618
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24622,9 +24620,9 @@ var __assign$4 = (undefined && undefined.__assign) || function () {
24622
24620
  }
24623
24621
  return t;
24624
24622
  };
24625
- return __assign$4.apply(this, arguments);
24623
+ return __assign$a.apply(this, arguments);
24626
24624
  };
24627
- var __rest$3 = (undefined && undefined.__rest) || function (s, e) {
24625
+ var __rest$8 = (undefined && undefined.__rest) || function (s, e) {
24628
24626
  var t = {};
24629
24627
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24630
24628
  t[p] = s[p];
@@ -24635,15 +24633,15 @@ var __rest$3 = (undefined && undefined.__rest) || function (s, e) {
24635
24633
  }
24636
24634
  return t;
24637
24635
  };
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));
24636
+ function Hour24Input$1(_a) {
24637
+ var maxTime = _a.maxTime, minTime = _a.minTime, otherProps = __rest$8(_a, ["maxTime", "minTime"]);
24638
+ var maxHour = safeMin$1(23, maxTime && getHours(maxTime));
24639
+ var minHour = safeMax$1(0, minTime && getHours(minTime));
24640
+ return React__default.createElement(Input$4, __assign$a({ max: maxHour, min: minHour, name: "hour24", nameForClass: "hour" }, otherProps));
24643
24641
  }
24644
24642
 
24645
- var __assign$3 = (undefined && undefined.__assign) || function () {
24646
- __assign$3 = Object.assign || function(t) {
24643
+ var __assign$9 = (undefined && undefined.__assign) || function () {
24644
+ __assign$9 = Object.assign || function(t) {
24647
24645
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24648
24646
  s = arguments[i];
24649
24647
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24651,9 +24649,9 @@ var __assign$3 = (undefined && undefined.__assign) || function () {
24651
24649
  }
24652
24650
  return t;
24653
24651
  };
24654
- return __assign$3.apply(this, arguments);
24652
+ return __assign$9.apply(this, arguments);
24655
24653
  };
24656
- var __rest$2 = (undefined && undefined.__rest) || function (s, e) {
24654
+ var __rest$7 = (undefined && undefined.__rest) || function (s, e) {
24657
24655
  var t = {};
24658
24656
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24659
24657
  t[p] = s[p];
@@ -24664,18 +24662,18 @@ var __rest$2 = (undefined && undefined.__rest) || function (s, e) {
24664
24662
  }
24665
24663
  return t;
24666
24664
  };
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"]);
24665
+ function MinuteInput$1(_a) {
24666
+ 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
24667
  function isSameHour(date) {
24670
24668
  return hour === getHours(date).toString();
24671
24669
  }
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)));
24670
+ var maxMinute = safeMin$1(59, maxTime && isSameHour(maxTime) && getMinutes(maxTime));
24671
+ var minMinute = safeMax$1(0, minTime && isSameHour(minTime) && getMinutes(minTime));
24672
+ return (React__default.createElement(Input$4, __assign$9({ max: maxMinute, min: minMinute, name: "minute", showLeadingZeros: showLeadingZeros }, otherProps)));
24675
24673
  }
24676
24674
 
24677
- var __assign$2 = (undefined && undefined.__assign) || function () {
24678
- __assign$2 = Object.assign || function(t) {
24675
+ var __assign$8 = (undefined && undefined.__assign) || function () {
24676
+ __assign$8 = Object.assign || function(t) {
24679
24677
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24680
24678
  s = arguments[i];
24681
24679
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24683,9 +24681,9 @@ var __assign$2 = (undefined && undefined.__assign) || function () {
24683
24681
  }
24684
24682
  return t;
24685
24683
  };
24686
- return __assign$2.apply(this, arguments);
24684
+ return __assign$8.apply(this, arguments);
24687
24685
  };
24688
- var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
24686
+ var __rest$6 = (undefined && undefined.__rest) || function (s, e) {
24689
24687
  var t = {};
24690
24688
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24691
24689
  t[p] = s[p];
@@ -24696,17 +24694,17 @@ var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
24696
24694
  }
24697
24695
  return t;
24698
24696
  };
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"]);
24697
+ function SecondInput$1(_a) {
24698
+ 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
24699
  function isSameMinute(date) {
24702
24700
  return hour === getHours(date).toString() && minute === getMinutes(date).toString();
24703
24701
  }
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)));
24702
+ var maxSecond = safeMin$1(59, maxTime && isSameMinute(maxTime) && getSeconds(maxTime));
24703
+ var minSecond = safeMax$1(0, minTime && isSameMinute(minTime) && getSeconds(minTime));
24704
+ return (React__default.createElement(Input$4, __assign$8({ max: maxSecond, min: minSecond, name: "second", showLeadingZeros: showLeadingZeros }, otherProps)));
24707
24705
  }
24708
24706
 
24709
- function NativeInput(_a) {
24707
+ function NativeInput$1(_a) {
24710
24708
  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
24709
  var nativeValueParser = (function () {
24712
24710
  switch (valueType) {
@@ -24742,20 +24740,20 @@ function NativeInput(_a) {
24742
24740
  }, type: "time", value: value ? nativeValueParser(value) : '' }));
24743
24741
  }
24744
24742
 
24745
- function AmPm(_a) {
24743
+ function AmPm$1(_a) {
24746
24744
  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;
24745
+ var amDisabled = minTime ? convert24to12$1(getHours(minTime))[1] === 'pm' : false;
24746
+ var pmDisabled = maxTime ? convert24to12$1(getHours(maxTime))[1] === 'am' : false;
24749
24747
  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 : '' },
24748
+ var _b = getAmPmLabels$1(locale), amLabel = _b[0], pmLabel = _b[1];
24749
+ 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
24750
  !value && React__default.createElement("option", { value: "" }, "--"),
24753
24751
  React__default.createElement("option", { disabled: amDisabled, value: "am" }, amLabel),
24754
24752
  React__default.createElement("option", { disabled: pmDisabled, value: "pm" }, pmLabel)));
24755
24753
  }
24756
24754
 
24757
- var __assign$1 = (undefined && undefined.__assign) || function () {
24758
- __assign$1 = Object.assign || function(t) {
24755
+ var __assign$7 = (undefined && undefined.__assign) || function () {
24756
+ __assign$7 = Object.assign || function(t) {
24759
24757
  for (var s, i = 1, n = arguments.length; i < n; i++) {
24760
24758
  s = arguments[i];
24761
24759
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -24763,9 +24761,9 @@ var __assign$1 = (undefined && undefined.__assign) || function () {
24763
24761
  }
24764
24762
  return t;
24765
24763
  };
24766
- return __assign$1.apply(this, arguments);
24764
+ return __assign$7.apply(this, arguments);
24767
24765
  };
24768
- var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
24766
+ var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
24769
24767
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
24770
24768
  if (ar || !(i in from)) {
24771
24769
  if (!ar) ar = Array.prototype.slice.call(from, 0, i);
@@ -24774,24 +24772,24 @@ var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, fr
24774
24772
  }
24775
24773
  return to.concat(ar || Array.prototype.slice.call(from));
24776
24774
  };
24777
- var getFormatterOptionsCache = {};
24778
- var allViews$2 = ['hour', 'minute', 'second'];
24779
- function isInternalInput(element) {
24775
+ var getFormatterOptionsCache$1 = {};
24776
+ var allViews$4 = ['hour', 'minute', 'second'];
24777
+ function isInternalInput$1(element) {
24780
24778
  return element.dataset.input === 'true';
24781
24779
  }
24782
- function findInput(element, property) {
24780
+ function findInput$1(element, property) {
24783
24781
  var nextElement = element;
24784
24782
  do {
24785
24783
  nextElement = nextElement[property];
24786
- } while (nextElement && !isInternalInput(nextElement));
24784
+ } while (nextElement && !isInternalInput$1(nextElement));
24787
24785
  return nextElement;
24788
24786
  }
24789
- function focus(element) {
24787
+ function focus$1(element) {
24790
24788
  if (element) {
24791
24789
  element.focus();
24792
24790
  }
24793
24791
  }
24794
- function renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances) {
24792
+ function renderCustomInputs$1(placeholder, elementFunctions, allowMultipleInstances) {
24795
24793
  var usedFunctions = [];
24796
24794
  var pattern = new RegExp(Object.keys(elementFunctions)
24797
24795
  .map(function (el) { return "".concat(el, "+"); })
@@ -24800,8 +24798,8 @@ function renderCustomInputs(placeholder, elementFunctions, allowMultipleInstance
24800
24798
  return placeholder.split(pattern).reduce(function (arr, element, index) {
24801
24799
  var divider = element && (
24802
24800
  // 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);
24801
+ React__default.createElement(Divider$1, { key: "separator_".concat(index) }, element));
24802
+ var res = __spreadArray$2(__spreadArray$2([], arr, true), [divider], false);
24805
24803
  var currentMatch = matches && matches[index];
24806
24804
  if (currentMatch) {
24807
24805
  var renderFunction = elementFunctions[currentMatch] ||
@@ -24822,8 +24820,8 @@ function renderCustomInputs(placeholder, elementFunctions, allowMultipleInstance
24822
24820
  return res;
24823
24821
  }, []);
24824
24822
  }
24825
- var formatNumber = getNumberFormatter({ useGrouping: false });
24826
- function TimeInput(_a) {
24823
+ var formatNumber$1 = getNumberFormatter$1({ useGrouping: false });
24824
+ function TimeInput$1(_a) {
24827
24825
  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
24826
  var _e = useState(null), amPm = _e[0], setAmPm = _e[1];
24829
24827
  var _f = useState(null), hour = _f[0], setHour = _f[1];
@@ -24843,7 +24841,7 @@ function TimeInput(_a) {
24843
24841
  useEffect(function () {
24844
24842
  var nextValue = valueProps;
24845
24843
  if (nextValue) {
24846
- setAmPm(convert24to12(getHours(nextValue))[1]);
24844
+ setAmPm(convert24to12$1(getHours(nextValue))[1]);
24847
24845
  setHour(getHours(nextValue).toString());
24848
24846
  setMinute(getMinutes(nextValue).toString());
24849
24847
  setSecond(getSeconds(nextValue).toString());
@@ -24866,8 +24864,8 @@ function TimeInput(_a) {
24866
24864
  ]);
24867
24865
  var valueType = maxDetail;
24868
24866
  var formatTime = (function () {
24869
- var level = allViews$2.indexOf(maxDetail);
24870
- var formatterOptions = getFormatterOptionsCache[level] ||
24867
+ var level = allViews$4.indexOf(maxDetail);
24868
+ var formatterOptions = getFormatterOptionsCache$1[level] ||
24871
24869
  (function () {
24872
24870
  var options = { hour: 'numeric' };
24873
24871
  if (level >= 1) {
@@ -24876,10 +24874,10 @@ function TimeInput(_a) {
24876
24874
  if (level >= 2) {
24877
24875
  options.second = 'numeric';
24878
24876
  }
24879
- getFormatterOptionsCache[level] = options;
24877
+ getFormatterOptionsCache$1[level] = options;
24880
24878
  return options;
24881
24879
  })();
24882
- return getFormatter(formatterOptions);
24880
+ return getFormatter$1(formatterOptions);
24883
24881
  })();
24884
24882
  /**
24885
24883
  * Gets current value in a desired format.
@@ -24906,11 +24904,11 @@ function TimeInput(_a) {
24906
24904
  var second = 14;
24907
24905
  var date = new Date(2017, 0, 1, hour24, minute, second);
24908
24906
  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');
24907
+ .replace(formatNumber$1(locale, hour12), 'h')
24908
+ .replace(formatNumber$1(locale, hour24), 'H')
24909
+ .replace(formatNumber$1(locale, minute), 'mm')
24910
+ .replace(formatNumber$1(locale, second), 'ss')
24911
+ .replace(new RegExp(getAmPmLabels$1(locale).join('|')), 'a');
24914
24912
  })();
24915
24913
  var divider = (function () {
24916
24914
  var dividers = placeholder.match(/[^0-9a-z]/i);
@@ -24920,7 +24918,7 @@ function TimeInput(_a) {
24920
24918
  if (event.target === event.currentTarget) {
24921
24919
  // Wrapper was directly clicked
24922
24920
  var firstInput = event.target.children[1];
24923
- focus(firstInput);
24921
+ focus$1(firstInput);
24924
24922
  }
24925
24923
  }
24926
24924
  function onKeyDown(event) {
@@ -24932,8 +24930,8 @@ function TimeInput(_a) {
24932
24930
  event.preventDefault();
24933
24931
  var input = event.target;
24934
24932
  var property = event.key === 'ArrowLeft' ? 'previousElementSibling' : 'nextElementSibling';
24935
- var nextInput = findInput(input, property);
24936
- focus(nextInput);
24933
+ var nextInput = findInput$1(input, property);
24934
+ focus$1(nextInput);
24937
24935
  break;
24938
24936
  }
24939
24937
  }
@@ -24961,8 +24959,8 @@ function TimeInput(_a) {
24961
24959
  */
24962
24960
  if (Number(value) * 10 > Number(max) || value.length >= max.length) {
24963
24961
  var property = 'nextElementSibling';
24964
- var nextInput = findInput(input, property);
24965
- focus(nextInput);
24962
+ var nextInput = findInput$1(input, property);
24963
+ focus$1(nextInput);
24966
24964
  }
24967
24965
  }
24968
24966
  /**
@@ -25002,7 +25000,7 @@ function TimeInput(_a) {
25002
25000
  var isEveryValueValid = formElements.every(function (formElement) { return formElement.validity.valid; });
25003
25001
  if (isEveryValueFilled && isEveryValueValid) {
25004
25002
  var hour_1 = Number(values.hour24 ||
25005
- (values.hour12 && values.amPm && convert12to24(values.hour12, values.amPm)) ||
25003
+ (values.hour12 && values.amPm && convert12to24$1(values.hour12, values.amPm)) ||
25006
25004
  0);
25007
25005
  var minute_1 = Number(values.minute || 0);
25008
25006
  var second_1 = Number(values.second || 0);
@@ -25027,7 +25025,7 @@ function TimeInput(_a) {
25027
25025
  setAmPm(value);
25028
25026
  break;
25029
25027
  case 'hour12':
25030
- setHour(value ? convert12to24(value, amPm || 'am').toString() : '');
25028
+ setHour(value ? convert12to24$1(value, amPm || 'am').toString() : '');
25031
25029
  break;
25032
25030
  case 'hour24':
25033
25031
  setHour(value);
@@ -25068,7 +25066,7 @@ function TimeInput(_a) {
25068
25066
  throw new Error("Unsupported token: ".concat(currentMatch));
25069
25067
  }
25070
25068
  var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
25071
- return (React__default.createElement(Hour12Input, __assign$1({ key: "hour12" }, commonInputProps, { amPm: amPm, ariaLabel: hourAriaLabel,
25069
+ return (React__default.createElement(Hour12Input$1, __assign$7({ key: "hour12" }, commonInputProps, { amPm: amPm, ariaLabel: hourAriaLabel,
25072
25070
  // eslint-disable-next-line jsx-a11y/no-autofocus
25073
25071
  autoFocus: index === 0 && autoFocus, inputRef: hour12Input, placeholder: hourPlaceholder, showLeadingZeros: showLeadingZeros, value: hour })));
25074
25072
  }
@@ -25077,7 +25075,7 @@ function TimeInput(_a) {
25077
25075
  throw new Error("Unsupported token: ".concat(currentMatch));
25078
25076
  }
25079
25077
  var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
25080
- return (React__default.createElement(Hour24Input, __assign$1({ key: "hour24" }, commonInputProps, { ariaLabel: hourAriaLabel,
25078
+ return (React__default.createElement(Hour24Input$1, __assign$7({ key: "hour24" }, commonInputProps, { ariaLabel: hourAriaLabel,
25081
25079
  // eslint-disable-next-line jsx-a11y/no-autofocus
25082
25080
  autoFocus: index === 0 && autoFocus, inputRef: hour24Input, placeholder: hourPlaceholder, showLeadingZeros: showLeadingZeros, value: hour })));
25083
25081
  }
@@ -25092,7 +25090,7 @@ function TimeInput(_a) {
25092
25090
  throw new Error("Unsupported token: ".concat(currentMatch));
25093
25091
  }
25094
25092
  var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
25095
- return (React__default.createElement(MinuteInput, __assign$1({ key: "minute" }, commonInputProps, { ariaLabel: minuteAriaLabel,
25093
+ return (React__default.createElement(MinuteInput$1, __assign$7({ key: "minute" }, commonInputProps, { ariaLabel: minuteAriaLabel,
25096
25094
  // eslint-disable-next-line jsx-a11y/no-autofocus
25097
25095
  autoFocus: index === 0 && autoFocus, hour: hour, inputRef: minuteInput, placeholder: minutePlaceholder, showLeadingZeros: showLeadingZeros, value: minute })));
25098
25096
  }
@@ -25101,12 +25099,12 @@ function TimeInput(_a) {
25101
25099
  throw new Error("Unsupported token: ".concat(currentMatch));
25102
25100
  }
25103
25101
  var showLeadingZeros = currentMatch ? currentMatch.length === 2 : true;
25104
- return (React__default.createElement(SecondInput, __assign$1({ key: "second" }, commonInputProps, { ariaLabel: secondAriaLabel,
25102
+ return (React__default.createElement(SecondInput$1, __assign$7({ key: "second" }, commonInputProps, { ariaLabel: secondAriaLabel,
25105
25103
  // eslint-disable-next-line jsx-a11y/no-autofocus
25106
25104
  autoFocus: index === 0 && autoFocus, hour: hour, inputRef: secondInput, minute: minute, placeholder: secondPlaceholder, showLeadingZeros: showLeadingZeros, value: second })));
25107
25105
  }
25108
25106
  function renderAmPm(currentMatch, index) {
25109
- return (React__default.createElement(AmPm, __assign$1({ key: "ampm" }, commonInputProps, { ariaLabel: amPmAriaLabel,
25107
+ return (React__default.createElement(AmPm$1, __assign$7({ key: "ampm" }, commonInputProps, { ariaLabel: amPmAriaLabel,
25110
25108
  // eslint-disable-next-line jsx-a11y/no-autofocus
25111
25109
  autoFocus: index === 0 && autoFocus, inputRef: amPmInput, locale: locale, onChange: onChange, value: amPm })));
25112
25110
  }
@@ -25119,10 +25117,10 @@ function TimeInput(_a) {
25119
25117
  a: renderAmPm,
25120
25118
  };
25121
25119
  var allowMultipleInstances = typeof format !== 'undefined';
25122
- return renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances);
25120
+ return renderCustomInputs$1(placeholder, elementFunctions, allowMultipleInstances);
25123
25121
  }
25124
25122
  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 }));
25123
+ 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
25124
  }
25127
25125
  return (
25128
25126
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
@@ -25131,41 +25129,23 @@ function TimeInput(_a) {
25131
25129
  renderCustomInputsInternal()));
25132
25130
  }
25133
25131
 
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) {
25132
+ var hourOptionalSecondsRegExp$1 = /^(([0-1])?[0-9]|2[0-3]):[0-5][0-9](:([0-5][0-9]))?$/;
25133
+ var isTime$1 = function isTime(props, propName, componentName) {
25147
25134
  var _a = props, _b = propName, time = _a[_b];
25148
25135
  if (time) {
25149
- if (typeof time !== 'string' || !hourOptionalSecondsRegExp.test(time)) {
25136
+ if (typeof time !== 'string' || !hourOptionalSecondsRegExp$1.test(time)) {
25150
25137
  return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof time, "` supplied to `").concat(componentName, "`, expected time in HH:mm(:ss) format."));
25151
25138
  }
25152
25139
  }
25153
25140
  // Everything is fine
25154
25141
  return null;
25155
25142
  };
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) {
25143
+ var rangeOf$1 = function (type) {
25164
25144
  return propTypes$1.exports.arrayOf(type);
25165
25145
  };
25166
25146
 
25167
- var __assign = (undefined && undefined.__assign) || function () {
25168
- __assign = Object.assign || function(t) {
25147
+ var __assign$6 = (undefined && undefined.__assign) || function () {
25148
+ __assign$6 = Object.assign || function(t) {
25169
25149
  for (var s, i = 1, n = arguments.length; i < n; i++) {
25170
25150
  s = arguments[i];
25171
25151
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -25173,9 +25153,9 @@ var __assign = (undefined && undefined.__assign) || function () {
25173
25153
  }
25174
25154
  return t;
25175
25155
  };
25176
- return __assign.apply(this, arguments);
25156
+ return __assign$6.apply(this, arguments);
25177
25157
  };
25178
- var __rest = (undefined && undefined.__rest) || function (s, e) {
25158
+ var __rest$5 = (undefined && undefined.__rest) || function (s, e) {
25179
25159
  var t = {};
25180
25160
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25181
25161
  t[p] = s[p];
@@ -25186,11 +25166,11 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
25186
25166
  }
25187
25167
  return t;
25188
25168
  };
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 = {
25169
+ var isBrowser$6 = typeof document !== 'undefined';
25170
+ var baseClassName$1 = 'react-timerange-picker';
25171
+ var outsideActionEvents$1 = ['mousedown', 'focusin', 'touchstart'];
25172
+ var allViews$3 = ['hour', 'minute', 'second'];
25173
+ var iconProps$1 = {
25194
25174
  xmlns: 'http://www.w3.org/2000/svg',
25195
25175
  width: 19,
25196
25176
  height: 19,
@@ -25198,15 +25178,15 @@ var iconProps = {
25198
25178
  stroke: 'black',
25199
25179
  strokeWidth: 2,
25200
25180
  };
25201
- var ClockIcon = (React__default.createElement("svg", __assign({}, iconProps, { className: "".concat(baseClassName, "__clock-button__icon ").concat(baseClassName, "__button__icon"), fill: "none" }),
25181
+ 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
25182
  React__default.createElement("circle", { cx: "9.5", cy: "9.5", r: "7.5" }),
25203
25183
  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") }),
25184
+ var ClearIcon$1 = (React__default.createElement("svg", __assign$6({}, iconProps$1, { className: "".concat(baseClassName$1, "__clear-button__icon ").concat(baseClassName$1, "__button__icon") }),
25205
25185
  React__default.createElement("line", { x1: "4", x2: "15", y1: "4", y2: "15" }),
25206
25186
  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];
25187
+ var TimeRangePicker = function TimeRangePicker(props) {
25188
+ 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"]);
25189
+ var _j = useState(isOpenProps), isOpen = _j[0], setIsOpen = _j[1];
25210
25190
  var wrapper = useRef(null);
25211
25191
  var clockWrapper = useRef(null);
25212
25192
  useEffect(function () {
@@ -25253,6 +25233,14 @@ var TimePicker$1 = function TimePicker(props) {
25253
25233
  onChangeProps(value);
25254
25234
  }
25255
25235
  }
25236
+ function onChangeFrom(valueFrom, closeClock) {
25237
+ var _a = Array.isArray(value) ? value : [value], valueTo = _a[1];
25238
+ onChange([valueFrom, valueTo || null], closeClock);
25239
+ }
25240
+ function onChangeTo(valueTo, closeClock) {
25241
+ var valueFrom = (Array.isArray(value) ? value : [value])[0];
25242
+ onChange([valueFrom || null, valueTo], closeClock);
25243
+ }
25256
25244
  function onFocus(event) {
25257
25245
  if (onFocusProps) {
25258
25246
  onFocusProps(event);
@@ -25292,7 +25280,7 @@ var TimePicker$1 = function TimePicker(props) {
25292
25280
  }, [clockWrapper, closeClock, wrapper]);
25293
25281
  var handleOutsideActionListeners = useCallback(function (shouldListen) {
25294
25282
  if (shouldListen === void 0) { shouldListen = isOpen; }
25295
- outsideActionEvents.forEach(function (event) {
25283
+ outsideActionEvents$1.forEach(function (event) {
25296
25284
  if (shouldListen) {
25297
25285
  document.addEventListener(event, onOutsideAction);
25298
25286
  }
@@ -25312,9 +25300,9 @@ var TimePicker$1 = function TimePicker(props) {
25312
25300
  return function () {
25313
25301
  handleOutsideActionListeners(false);
25314
25302
  };
25315
- }, [handleOutsideActionListeners]);
25303
+ }, [handleOutsideActionListeners, isOpen]);
25316
25304
  function renderInputs() {
25317
- var valueFrom = (Array.isArray(value) ? value : [value])[0];
25305
+ var _a = Array.isArray(value) ? value : [value], valueFrom = _a[0], valueTo = _a[1];
25318
25306
  var ariaLabelProps = {
25319
25307
  amPmAriaLabel: amPmAriaLabel,
25320
25308
  hourAriaLabel: hourAriaLabel,
@@ -25327,12 +25315,15 @@ var TimePicker$1 = function TimePicker(props) {
25327
25315
  minutePlaceholder: minutePlaceholder,
25328
25316
  secondPlaceholder: secondPlaceholder,
25329
25317
  };
25330
- return (React__default.createElement("div", { className: "".concat(baseClassName, "__wrapper") },
25331
- React__default.createElement(TimeInput, __assign({}, ariaLabelProps, placeholderProps, {
25318
+ 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 });
25319
+ return (React__default.createElement("div", { className: "".concat(baseClassName$1, "__wrapper") },
25320
+ React__default.createElement(TimeInput$1, __assign$6({}, commonProps, {
25332
25321
  // 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))));
25322
+ autoFocus: autoFocus, name: "".concat(name, "_from"), onChange: onChangeFrom, value: valueFrom })),
25323
+ React__default.createElement("span", { className: "".concat(baseClassName$1, "__range-divider") }, rangeDivider),
25324
+ React__default.createElement(TimeInput$1, __assign$6({}, commonProps, { name: "".concat(name, "_to"), onChange: onChangeTo, value: valueTo })),
25325
+ 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)),
25326
+ 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
25327
  }
25337
25328
  function renderClock() {
25338
25329
  if (isOpen === null || disableClock) {
@@ -25340,11 +25331,11 @@ var TimePicker$1 = function TimePicker(props) {
25340
25331
  }
25341
25332
  var clockClassName = props.clockClassName; props.className; // Unused, here to exclude it from clockProps
25342
25333
  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'));
25334
+ var portalContainer = props.portalContainer, value = props.value, clockProps = __rest$5(props, ["clockClassName", "className", "onChange", "portalContainer", "value"]);
25335
+ var className = "".concat(baseClassName$1, "__clock");
25336
+ var classNames = clsx$1(className, "".concat(className, "--").concat(isOpen ? 'open' : 'closed'));
25346
25337
  var valueFrom = (Array.isArray(value) ? value : [value])[0];
25347
- var clock = React__default.createElement(Clock, __assign({ className: clockClassName, value: valueFrom }, clockProps));
25338
+ var clock = React__default.createElement(Clock, __assign$6({ className: clockClassName, value: valueFrom }, clockProps));
25348
25339
  return portalContainer ? (createPortal(React__default.createElement("div", { ref: clockWrapper, className: classNames }, clock), portalContainer)) : (React__default.createElement(Fit, null,
25349
25340
  React__default.createElement("div", { ref: function (ref) {
25350
25341
  if (ref && !isOpen) {
@@ -25353,13 +25344,13 @@ var TimePicker$1 = function TimePicker(props) {
25353
25344
  }, className: classNames }, clock)));
25354
25345
  }
25355
25346
  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 }),
25347
+ 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
25348
  renderInputs(),
25358
25349
  renderClock()));
25359
25350
  };
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 = {
25351
+ var isValue$1 = propTypes$1.exports.oneOfType([propTypes$1.exports.string, propTypes$1.exports.instanceOf(Date)]);
25352
+ var isValueOrValueArray$1 = propTypes$1.exports.oneOfType([isValue$1, rangeOf$1(isValue$1)]);
25353
+ TimeRangePicker.propTypes = {
25363
25354
  amPmAriaLabel: propTypes$1.exports.string,
25364
25355
  autoFocus: propTypes$1.exports.bool,
25365
25356
  className: propTypes$1.exports.oneOfType([propTypes$1.exports.string, propTypes$1.exports.arrayOf(propTypes$1.exports.string)]),
@@ -25378,9 +25369,9 @@ TimePicker$1.propTypes = {
25378
25369
  id: propTypes$1.exports.string,
25379
25370
  isOpen: propTypes$1.exports.bool,
25380
25371
  locale: propTypes$1.exports.string,
25381
- maxDetail: propTypes$1.exports.oneOf(allViews),
25382
- maxTime: isTime,
25383
- minTime: isTime,
25372
+ maxDetail: propTypes$1.exports.oneOf(allViews$3),
25373
+ maxTime: isTime$1,
25374
+ minTime: isTime$1,
25384
25375
  minuteAriaLabel: propTypes$1.exports.string,
25385
25376
  minutePlaceholder: propTypes$1.exports.string,
25386
25377
  name: propTypes$1.exports.string,
@@ -25390,82 +25381,1150 @@ TimePicker$1.propTypes = {
25390
25381
  onClockOpen: propTypes$1.exports.func,
25391
25382
  onFocus: propTypes$1.exports.func,
25392
25383
  openClockOnFocus: propTypes$1.exports.bool,
25384
+ rangeDivider: propTypes$1.exports.node,
25393
25385
  required: propTypes$1.exports.bool,
25394
25386
  secondAriaLabel: propTypes$1.exports.string,
25395
25387
  secondPlaceholder: propTypes$1.exports.string,
25396
- value: isValueOrValueArray,
25388
+ value: isValueOrValueArray$1,
25397
25389
  };
25398
- if (isBrowser$4) {
25399
- TimePicker$1.propTypes.portalContainer = propTypes$1.exports.instanceOf(HTMLElement);
25390
+ if (isBrowser$6) {
25391
+ TimeRangePicker.propTypes.portalContainer = propTypes$1.exports.instanceOf(HTMLElement);
25400
25392
  }
25401
25393
 
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);
25415
- }
25416
- }, hovered && time ? /*#__PURE__*/React__default.createElement(Close, {
25417
- size: 16
25418
- }) : /*#__PURE__*/React__default.createElement(Clock$1, {
25419
- size: 16
25420
- }));
25421
- };
25394
+ function Divider(_a) {
25395
+ var children = _a.children;
25396
+ return React__default.createElement("span", { className: "react-time-picker__inputGroup__divider" }, children);
25397
+ }
25422
25398
 
25423
- var _excluded$v = ["className", "label", "labelProps", "size", "nakedInput", "required", "value", "onChange", "error", "onBlur"];
25424
- 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
- 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
- dayjs.extend(customParseFormat);
25427
- var INPUT_SIZES$1 = {
25428
- small: "small",
25429
- medium: "medium",
25430
- large: "large"
25431
- };
25432
- var FORMAT = "HH:mm";
25433
- var TimePickerInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25434
- var _ref$className = _ref.className,
25435
- className = _ref$className === void 0 ? "" : _ref$className,
25436
- label = _ref.label,
25437
- labelProps = _ref.labelProps,
25438
- _ref$size = _ref.size,
25399
+ var isBrowser$5 = typeof document !== 'undefined';
25400
+ var useIsomorphicLayoutEffect = isBrowser$5 ? useLayoutEffect : useEffect;
25401
+ var isIEOrEdgeLegacy = isBrowser$5 && /(MSIE|Trident\/|Edge\/)/.test(navigator.userAgent);
25402
+ var isFirefox = isBrowser$5 && /Firefox/.test(navigator.userAgent);
25403
+ function onFocus(event) {
25404
+ var target = event.target;
25405
+ if (isIEOrEdgeLegacy) {
25406
+ requestAnimationFrame(function () { return target.select(); });
25407
+ }
25408
+ else {
25409
+ target.select();
25410
+ }
25411
+ }
25412
+ function updateInputWidthOnLoad(element) {
25413
+ if (document.readyState === 'complete') {
25414
+ return;
25415
+ }
25416
+ function onLoad() {
25417
+ updateInputWidth(element);
25418
+ }
25419
+ window.addEventListener('load', onLoad);
25420
+ }
25421
+ function updateInputWidthOnFontLoad(element) {
25422
+ if (!document.fonts) {
25423
+ return;
25424
+ }
25425
+ var font = getFontShorthand(element);
25426
+ if (!font) {
25427
+ return;
25428
+ }
25429
+ var isFontLoaded = document.fonts.check(font);
25430
+ if (isFontLoaded) {
25431
+ return;
25432
+ }
25433
+ function onLoadingDone() {
25434
+ updateInputWidth(element);
25435
+ }
25436
+ document.fonts.addEventListener('loadingdone', onLoadingDone);
25437
+ }
25438
+ function getSelectionString(input) {
25439
+ /**
25440
+ * window.getSelection().toString() returns empty string in IE11 and Firefox,
25441
+ * so alternatives come first.
25442
+ */
25443
+ if (input &&
25444
+ 'selectionStart' in input &&
25445
+ input.selectionStart !== null &&
25446
+ 'selectionEnd' in input &&
25447
+ input.selectionEnd !== null) {
25448
+ return input.value.slice(input.selectionStart, input.selectionEnd);
25449
+ }
25450
+ if ('getSelection' in window) {
25451
+ var selection = window.getSelection();
25452
+ return selection && selection.toString();
25453
+ }
25454
+ return null;
25455
+ }
25456
+ function makeOnKeyPress(maxLength) {
25457
+ if (maxLength === null) {
25458
+ return undefined;
25459
+ }
25460
+ /**
25461
+ * Prevents keystrokes that would not produce a number or when value after keystroke would
25462
+ * exceed maxLength.
25463
+ */
25464
+ return function onKeyPress(event) {
25465
+ if (isFirefox) {
25466
+ // See https://github.com/wojtekmaj/react-time-picker/issues/92
25467
+ return;
25468
+ }
25469
+ var key = event.key, input = event.target;
25470
+ var value = input.value;
25471
+ var isNumberKey = key.length === 1 && /\d/.test(key);
25472
+ var selection = getSelectionString(input);
25473
+ if (!isNumberKey || !(selection || value.length < maxLength)) {
25474
+ event.preventDefault();
25475
+ }
25476
+ };
25477
+ }
25478
+ function Input$3(_a) {
25479
+ 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;
25480
+ useIsomorphicLayoutEffect(function () {
25481
+ if (!inputRef || !inputRef.current) {
25482
+ return;
25483
+ }
25484
+ updateInputWidth(inputRef.current);
25485
+ updateInputWidthOnLoad(inputRef.current);
25486
+ updateInputWidthOnFontLoad(inputRef.current);
25487
+ }, [inputRef, value]);
25488
+ var hasLeadingZero = showLeadingZeros &&
25489
+ value &&
25490
+ Number(value) < 10 &&
25491
+ (value === '0' || !value.toString().startsWith('0'));
25492
+ var maxLength = max ? max.toString().length : null;
25493
+ return (React__default.createElement(React__default.Fragment, null,
25494
+ hasLeadingZero ? React__default.createElement("span", { className: "".concat(className, "__leadingZero") }, "0") : null,
25495
+ 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) {
25496
+ updateInputWidth(event.target);
25497
+ if (onKeyUp) {
25498
+ onKeyUp(event);
25499
+ }
25500
+ }, placeholder: placeholder, ref: inputRef, required: required, step: step, type: "number", value: value !== null ? value : '' })));
25501
+ }
25502
+
25503
+ function convert12to24(hour12, amPm) {
25504
+ var hour24 = Number(hour12);
25505
+ if (amPm === 'am' && hour24 === 12) {
25506
+ hour24 = 0;
25507
+ }
25508
+ else if (amPm === 'pm' && hour24 < 12) {
25509
+ hour24 += 12;
25510
+ }
25511
+ return hour24;
25512
+ }
25513
+ function convert24to12(hour24) {
25514
+ var hour12 = Number(hour24) % 12 || 12;
25515
+ return [hour12, Number(hour24) < 12 ? 'am' : 'pm'];
25516
+ }
25517
+
25518
+ var formatterCache = new Map();
25519
+ function getFormatter(options) {
25520
+ return function formatter(locale, date) {
25521
+ var localeWithDefault = locale || getUserLocale();
25522
+ if (!formatterCache.has(localeWithDefault)) {
25523
+ formatterCache.set(localeWithDefault, new Map());
25524
+ }
25525
+ var formatterCacheLocale = formatterCache.get(localeWithDefault);
25526
+ if (!formatterCacheLocale.has(options)) {
25527
+ formatterCacheLocale.set(options, new Intl.DateTimeFormat(localeWithDefault || undefined, options).format);
25528
+ }
25529
+ return formatterCacheLocale.get(options)(date);
25530
+ };
25531
+ }
25532
+ var numberFormatterCache = new Map();
25533
+ function getNumberFormatter(options) {
25534
+ return function (locale, number) {
25535
+ var localeWithDefault = locale || getUserLocale();
25536
+ if (!numberFormatterCache.has(localeWithDefault)) {
25537
+ numberFormatterCache.set(localeWithDefault, new Map());
25538
+ }
25539
+ var numberFormatterCacheLocale = numberFormatterCache.get(localeWithDefault);
25540
+ if (!numberFormatterCacheLocale.has(options)) {
25541
+ numberFormatterCacheLocale.set(options, new Intl.NumberFormat(localeWithDefault || undefined, options).format);
25542
+ }
25543
+ return numberFormatterCacheLocale.get(options)(number);
25544
+ };
25545
+ }
25546
+
25547
+ var nines = ['9', '٩'];
25548
+ var ninesRegExp = new RegExp("[".concat(nines.join(''), "]"));
25549
+ var amPmFormatter = getFormatter({ hour: 'numeric' });
25550
+ function getAmPmLabels(locale) {
25551
+ var amString = amPmFormatter(locale, new Date(2017, 0, 1, 9));
25552
+ var pmString = amPmFormatter(locale, new Date(2017, 0, 1, 21));
25553
+ var _a = amString.split(ninesRegExp), am1 = _a[0], am2 = _a[1];
25554
+ var _b = pmString.split(ninesRegExp), pm1 = _b[0], pm2 = _b[1];
25555
+ if (pm2 !== undefined) {
25556
+ // If pm2 is undefined, nine was not found in pmString - this locale is not using 12-hour time
25557
+ if (am1 !== pm1) {
25558
+ return [am1, pm1].map(function (el) { return el.trim(); });
25559
+ }
25560
+ if (am2 !== pm2) {
25561
+ return [am2, pm2].map(function (el) { return el.trim(); });
25562
+ }
25563
+ }
25564
+ // Fallback
25565
+ return ['AM', 'PM'];
25566
+ }
25567
+ function isValidNumber(num) {
25568
+ return num !== null && num !== false && !Number.isNaN(Number(num));
25569
+ }
25570
+ function safeMin() {
25571
+ var args = [];
25572
+ for (var _i = 0; _i < arguments.length; _i++) {
25573
+ args[_i] = arguments[_i];
25574
+ }
25575
+ return Math.min.apply(Math, args.filter(isValidNumber));
25576
+ }
25577
+ function safeMax() {
25578
+ var args = [];
25579
+ for (var _i = 0; _i < arguments.length; _i++) {
25580
+ args[_i] = arguments[_i];
25581
+ }
25582
+ return Math.max.apply(Math, args.filter(isValidNumber));
25583
+ }
25584
+
25585
+ var __assign$5 = (undefined && undefined.__assign) || function () {
25586
+ __assign$5 = Object.assign || function(t) {
25587
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25588
+ s = arguments[i];
25589
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
25590
+ t[p] = s[p];
25591
+ }
25592
+ return t;
25593
+ };
25594
+ return __assign$5.apply(this, arguments);
25595
+ };
25596
+ var __rest$4 = (undefined && undefined.__rest) || function (s, e) {
25597
+ var t = {};
25598
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25599
+ t[p] = s[p];
25600
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
25601
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25602
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25603
+ t[p[i]] = s[p[i]];
25604
+ }
25605
+ return t;
25606
+ };
25607
+ function Hour12Input(_a) {
25608
+ var amPm = _a.amPm, maxTime = _a.maxTime, minTime = _a.minTime, value = _a.value, otherProps = __rest$4(_a, ["amPm", "maxTime", "minTime", "value"]);
25609
+ var maxHour = safeMin(12, maxTime &&
25610
+ (function () {
25611
+ var _a = convert24to12(getHours(maxTime)), maxHourResult = _a[0], maxAmPm = _a[1];
25612
+ if (maxAmPm !== amPm) {
25613
+ // pm is always after am, so we should ignore validation
25614
+ return null;
25615
+ }
25616
+ return maxHourResult;
25617
+ })());
25618
+ var minHour = safeMax(1, minTime &&
25619
+ (function () {
25620
+ var _a = convert24to12(getHours(minTime)), minHourResult = _a[0], minAmPm = _a[1];
25621
+ if (
25622
+ // pm is always after am, so we should ignore validation
25623
+ minAmPm !== amPm ||
25624
+ // If minHour is 12 am/pm, user should be able to enter 12, 1, ..., 11.
25625
+ minHourResult === 12) {
25626
+ return null;
25627
+ }
25628
+ return minHourResult;
25629
+ })());
25630
+ var value12 = value ? convert24to12(value)[0].toString() : '';
25631
+ return (React__default.createElement(Input$3, __assign$5({ max: maxHour, min: minHour, name: "hour12", nameForClass: "hour", value: value12 }, otherProps)));
25632
+ }
25633
+
25634
+ var __assign$4 = (undefined && undefined.__assign) || function () {
25635
+ __assign$4 = Object.assign || function(t) {
25636
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25637
+ s = arguments[i];
25638
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
25639
+ t[p] = s[p];
25640
+ }
25641
+ return t;
25642
+ };
25643
+ return __assign$4.apply(this, arguments);
25644
+ };
25645
+ var __rest$3 = (undefined && undefined.__rest) || function (s, e) {
25646
+ var t = {};
25647
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25648
+ t[p] = s[p];
25649
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
25650
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25651
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25652
+ t[p[i]] = s[p[i]];
25653
+ }
25654
+ return t;
25655
+ };
25656
+ function Hour24Input(_a) {
25657
+ var maxTime = _a.maxTime, minTime = _a.minTime, otherProps = __rest$3(_a, ["maxTime", "minTime"]);
25658
+ var maxHour = safeMin(23, maxTime && getHours(maxTime));
25659
+ var minHour = safeMax(0, minTime && getHours(minTime));
25660
+ return React__default.createElement(Input$3, __assign$4({ max: maxHour, min: minHour, name: "hour24", nameForClass: "hour" }, otherProps));
25661
+ }
25662
+
25663
+ var __assign$3 = (undefined && undefined.__assign) || function () {
25664
+ __assign$3 = Object.assign || function(t) {
25665
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25666
+ s = arguments[i];
25667
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
25668
+ t[p] = s[p];
25669
+ }
25670
+ return t;
25671
+ };
25672
+ return __assign$3.apply(this, arguments);
25673
+ };
25674
+ var __rest$2 = (undefined && undefined.__rest) || function (s, e) {
25675
+ var t = {};
25676
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25677
+ t[p] = s[p];
25678
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
25679
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25680
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25681
+ t[p[i]] = s[p[i]];
25682
+ }
25683
+ return t;
25684
+ };
25685
+ function MinuteInput(_a) {
25686
+ 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"]);
25687
+ function isSameHour(date) {
25688
+ return hour === getHours(date).toString();
25689
+ }
25690
+ var maxMinute = safeMin(59, maxTime && isSameHour(maxTime) && getMinutes(maxTime));
25691
+ var minMinute = safeMax(0, minTime && isSameHour(minTime) && getMinutes(minTime));
25692
+ return (React__default.createElement(Input$3, __assign$3({ max: maxMinute, min: minMinute, name: "minute", showLeadingZeros: showLeadingZeros }, otherProps)));
25693
+ }
25694
+
25695
+ var __assign$2 = (undefined && undefined.__assign) || function () {
25696
+ __assign$2 = Object.assign || function(t) {
25697
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25698
+ s = arguments[i];
25699
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
25700
+ t[p] = s[p];
25701
+ }
25702
+ return t;
25703
+ };
25704
+ return __assign$2.apply(this, arguments);
25705
+ };
25706
+ var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
25707
+ var t = {};
25708
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
25709
+ t[p] = s[p];
25710
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
25711
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
25712
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
25713
+ t[p[i]] = s[p[i]];
25714
+ }
25715
+ return t;
25716
+ };
25717
+ function SecondInput(_a) {
25718
+ 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"]);
25719
+ function isSameMinute(date) {
25720
+ return hour === getHours(date).toString() && minute === getMinutes(date).toString();
25721
+ }
25722
+ var maxSecond = safeMin(59, maxTime && isSameMinute(maxTime) && getSeconds(maxTime));
25723
+ var minSecond = safeMax(0, minTime && isSameMinute(minTime) && getSeconds(minTime));
25724
+ return (React__default.createElement(Input$3, __assign$2({ max: maxSecond, min: minSecond, name: "second", showLeadingZeros: showLeadingZeros }, otherProps)));
25725
+ }
25726
+
25727
+ function NativeInput(_a) {
25728
+ 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;
25729
+ var nativeValueParser = (function () {
25730
+ switch (valueType) {
25731
+ case 'hour':
25732
+ return function (receivedValue) { return "".concat(getHours(receivedValue), ":00"); };
25733
+ case 'minute':
25734
+ return getHoursMinutes;
25735
+ case 'second':
25736
+ return getHoursMinutesSeconds;
25737
+ default:
25738
+ throw new Error('Invalid valueType');
25739
+ }
25740
+ })();
25741
+ var step = (function () {
25742
+ switch (valueType) {
25743
+ case 'hour':
25744
+ return 3600;
25745
+ case 'minute':
25746
+ return 60;
25747
+ case 'second':
25748
+ return 1;
25749
+ default:
25750
+ throw new Error('Invalid valueType');
25751
+ }
25752
+ })();
25753
+ function stopPropagation(event) {
25754
+ event.stopPropagation();
25755
+ }
25756
+ 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: {
25757
+ visibility: 'hidden',
25758
+ position: 'absolute',
25759
+ zIndex: '-999',
25760
+ }, type: "time", value: value ? nativeValueParser(value) : '' }));
25761
+ }
25762
+
25763
+ function AmPm(_a) {
25764
+ 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;
25765
+ var amDisabled = minTime ? convert24to12(getHours(minTime))[1] === 'pm' : false;
25766
+ var pmDisabled = maxTime ? convert24to12(getHours(maxTime))[1] === 'am' : false;
25767
+ var name = 'amPm';
25768
+ var _b = getAmPmLabels(locale), amLabel = _b[0], pmLabel = _b[1];
25769
+ 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 : '' },
25770
+ !value && React__default.createElement("option", { value: "" }, "--"),
25771
+ React__default.createElement("option", { disabled: amDisabled, value: "am" }, amLabel),
25772
+ React__default.createElement("option", { disabled: pmDisabled, value: "pm" }, pmLabel)));
25773
+ }
25774
+
25775
+ var __assign$1 = (undefined && undefined.__assign) || function () {
25776
+ __assign$1 = Object.assign || function(t) {
25777
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
25778
+ s = arguments[i];
25779
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
25780
+ t[p] = s[p];
25781
+ }
25782
+ return t;
25783
+ };
25784
+ return __assign$1.apply(this, arguments);
25785
+ };
25786
+ var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from, pack) {
25787
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25788
+ if (ar || !(i in from)) {
25789
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
25790
+ ar[i] = from[i];
25791
+ }
25792
+ }
25793
+ return to.concat(ar || Array.prototype.slice.call(from));
25794
+ };
25795
+ var getFormatterOptionsCache = {};
25796
+ var allViews$2 = ['hour', 'minute', 'second'];
25797
+ function isInternalInput(element) {
25798
+ return element.dataset.input === 'true';
25799
+ }
25800
+ function findInput(element, property) {
25801
+ var nextElement = element;
25802
+ do {
25803
+ nextElement = nextElement[property];
25804
+ } while (nextElement && !isInternalInput(nextElement));
25805
+ return nextElement;
25806
+ }
25807
+ function focus(element) {
25808
+ if (element) {
25809
+ element.focus();
25810
+ }
25811
+ }
25812
+ function renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances) {
25813
+ var usedFunctions = [];
25814
+ var pattern = new RegExp(Object.keys(elementFunctions)
25815
+ .map(function (el) { return "".concat(el, "+"); })
25816
+ .join('|'), 'g');
25817
+ var matches = placeholder.match(pattern);
25818
+ return placeholder.split(pattern).reduce(function (arr, element, index) {
25819
+ var divider = element && (
25820
+ // eslint-disable-next-line react/no-array-index-key
25821
+ React__default.createElement(Divider, { key: "separator_".concat(index) }, element));
25822
+ var res = __spreadArray$1(__spreadArray$1([], arr, true), [divider], false);
25823
+ var currentMatch = matches && matches[index];
25824
+ if (currentMatch) {
25825
+ var renderFunction = elementFunctions[currentMatch] ||
25826
+ elementFunctions[Object.keys(elementFunctions).find(function (elementFunction) {
25827
+ return currentMatch.match(elementFunction);
25828
+ })];
25829
+ if (!renderFunction) {
25830
+ return res;
25831
+ }
25832
+ if (!allowMultipleInstances && usedFunctions.includes(renderFunction)) {
25833
+ res.push(currentMatch);
25834
+ }
25835
+ else {
25836
+ res.push(renderFunction(currentMatch, index));
25837
+ usedFunctions.push(renderFunction);
25838
+ }
25839
+ }
25840
+ return res;
25841
+ }, []);
25842
+ }
25843
+ var formatNumber = getNumberFormatter({ useGrouping: false });
25844
+ function TimeInput(_a) {
25845
+ 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;
25846
+ var _e = useState(null), amPm = _e[0], setAmPm = _e[1];
25847
+ var _f = useState(null), hour = _f[0], setHour = _f[1];
25848
+ var _g = useState(null), minute = _g[0], setMinute = _g[1];
25849
+ var _h = useState(null), second = _h[0], setSecond = _h[1];
25850
+ var _j = useState(null), value = _j[0], setValue = _j[1];
25851
+ var amPmInput = useRef(null);
25852
+ var hour12Input = useRef(null);
25853
+ var hour24Input = useRef(null);
25854
+ var minuteInput = useRef(null);
25855
+ var secondInput = useRef(null);
25856
+ var _k = useState(isClockOpenProps), isClockOpen = _k[0], setIsClockOpen = _k[1];
25857
+ var lastPressedKey = useRef();
25858
+ useEffect(function () {
25859
+ setIsClockOpen(isClockOpenProps);
25860
+ }, [isClockOpenProps]);
25861
+ useEffect(function () {
25862
+ var nextValue = valueProps;
25863
+ if (nextValue) {
25864
+ setAmPm(convert24to12(getHours(nextValue))[1]);
25865
+ setHour(getHours(nextValue).toString());
25866
+ setMinute(getMinutes(nextValue).toString());
25867
+ setSecond(getSeconds(nextValue).toString());
25868
+ setValue(nextValue);
25869
+ }
25870
+ else {
25871
+ setAmPm(null);
25872
+ setHour(null);
25873
+ setMinute(null);
25874
+ setSecond(null);
25875
+ setValue(null);
25876
+ }
25877
+ }, [
25878
+ valueProps,
25879
+ minTime,
25880
+ maxTime,
25881
+ maxDetail,
25882
+ // Toggling clock visibility resets values
25883
+ isClockOpen,
25884
+ ]);
25885
+ var valueType = maxDetail;
25886
+ var formatTime = (function () {
25887
+ var level = allViews$2.indexOf(maxDetail);
25888
+ var formatterOptions = getFormatterOptionsCache[level] ||
25889
+ (function () {
25890
+ var options = { hour: 'numeric' };
25891
+ if (level >= 1) {
25892
+ options.minute = 'numeric';
25893
+ }
25894
+ if (level >= 2) {
25895
+ options.second = 'numeric';
25896
+ }
25897
+ getFormatterOptionsCache[level] = options;
25898
+ return options;
25899
+ })();
25900
+ return getFormatter(formatterOptions);
25901
+ })();
25902
+ /**
25903
+ * Gets current value in a desired format.
25904
+ */
25905
+ function getProcessedValue(value) {
25906
+ var processFunction = (function () {
25907
+ switch (valueType) {
25908
+ case 'hour':
25909
+ case 'minute':
25910
+ return getHoursMinutes;
25911
+ case 'second':
25912
+ return getHoursMinutesSeconds;
25913
+ default:
25914
+ throw new Error('Invalid valueType');
25915
+ }
25916
+ })();
25917
+ return processFunction(value);
25918
+ }
25919
+ var placeholder = format ||
25920
+ (function () {
25921
+ var hour24 = 21;
25922
+ var hour12 = 9;
25923
+ var minute = 13;
25924
+ var second = 14;
25925
+ var date = new Date(2017, 0, 1, hour24, minute, second);
25926
+ return formatTime(locale, date)
25927
+ .replace(formatNumber(locale, hour12), 'h')
25928
+ .replace(formatNumber(locale, hour24), 'H')
25929
+ .replace(formatNumber(locale, minute), 'mm')
25930
+ .replace(formatNumber(locale, second), 'ss')
25931
+ .replace(new RegExp(getAmPmLabels(locale).join('|')), 'a');
25932
+ })();
25933
+ var divider = (function () {
25934
+ var dividers = placeholder.match(/[^0-9a-z]/i);
25935
+ return dividers ? dividers[0] : null;
25936
+ })();
25937
+ function onClick(event) {
25938
+ if (event.target === event.currentTarget) {
25939
+ // Wrapper was directly clicked
25940
+ var firstInput = event.target.children[1];
25941
+ focus(firstInput);
25942
+ }
25943
+ }
25944
+ function onKeyDown(event) {
25945
+ lastPressedKey.current = event.key;
25946
+ switch (event.key) {
25947
+ case 'ArrowLeft':
25948
+ case 'ArrowRight':
25949
+ case divider: {
25950
+ event.preventDefault();
25951
+ var input = event.target;
25952
+ var property = event.key === 'ArrowLeft' ? 'previousElementSibling' : 'nextElementSibling';
25953
+ var nextInput = findInput(input, property);
25954
+ focus(nextInput);
25955
+ break;
25956
+ }
25957
+ }
25958
+ }
25959
+ function onKeyUp(event) {
25960
+ var key = event.key, input = event.target;
25961
+ var isLastPressedKey = lastPressedKey.current === key;
25962
+ if (!isLastPressedKey) {
25963
+ return;
25964
+ }
25965
+ var isNumberKey = !isNaN(Number(key));
25966
+ if (!isNumberKey) {
25967
+ return;
25968
+ }
25969
+ var max = input.getAttribute('max');
25970
+ if (!max) {
25971
+ return;
25972
+ }
25973
+ var value = input.value;
25974
+ /**
25975
+ * Given 1, the smallest possible number the user could type by adding another digit is 10.
25976
+ * 10 would be a valid value given max = 12, so we won't jump to the next input.
25977
+ * However, given 2, smallers possible number would be 20, and thus keeping the focus in
25978
+ * this field doesn't make sense.
25979
+ */
25980
+ if (Number(value) * 10 > Number(max) || value.length >= max.length) {
25981
+ var property = 'nextElementSibling';
25982
+ var nextInput = findInput(input, property);
25983
+ focus(nextInput);
25984
+ }
25985
+ }
25986
+ /**
25987
+ * Called after internal onChange. Checks input validity. If all fields are valid,
25988
+ * calls props.onChange.
25989
+ */
25990
+ function onChangeExternal() {
25991
+ if (!onChangeProps) {
25992
+ return;
25993
+ }
25994
+ function filterBoolean(value) {
25995
+ return Boolean(value);
25996
+ }
25997
+ var formElements = [
25998
+ amPmInput.current,
25999
+ hour12Input.current,
26000
+ hour24Input.current,
26001
+ minuteInput.current,
26002
+ secondInput.current,
26003
+ ].filter(filterBoolean);
26004
+ var formElementsWithoutSelect = formElements.slice(1);
26005
+ var values = {};
26006
+ formElements.forEach(function (formElement) {
26007
+ values[formElement.name] =
26008
+ formElement.type === 'number'
26009
+ ? 'valueAsNumber' in formElement
26010
+ ? formElement.valueAsNumber
26011
+ : Number(formElement.value)
26012
+ : formElement.value;
26013
+ });
26014
+ var isEveryValueEmpty = formElementsWithoutSelect.every(function (formElement) { return !formElement.value; });
26015
+ if (isEveryValueEmpty) {
26016
+ onChangeProps(null, false);
26017
+ return;
26018
+ }
26019
+ var isEveryValueFilled = formElements.every(function (formElement) { return formElement.value; });
26020
+ var isEveryValueValid = formElements.every(function (formElement) { return formElement.validity.valid; });
26021
+ if (isEveryValueFilled && isEveryValueValid) {
26022
+ var hour_1 = Number(values.hour24 ||
26023
+ (values.hour12 && values.amPm && convert12to24(values.hour12, values.amPm)) ||
26024
+ 0);
26025
+ var minute_1 = Number(values.minute || 0);
26026
+ var second_1 = Number(values.second || 0);
26027
+ var padStart = function (num) { return "0".concat(num).slice(-2); };
26028
+ var proposedValue = "".concat(padStart(hour_1), ":").concat(padStart(minute_1), ":").concat(padStart(second_1));
26029
+ var processedValue = getProcessedValue(proposedValue);
26030
+ onChangeProps(processedValue, false);
26031
+ return;
26032
+ }
26033
+ if (!onInvalidChange) {
26034
+ return;
26035
+ }
26036
+ onInvalidChange();
26037
+ }
26038
+ /**
26039
+ * Called when non-native date input is changed.
26040
+ */
26041
+ function onChange(event) {
26042
+ var _a = event.target, name = _a.name, value = _a.value;
26043
+ switch (name) {
26044
+ case 'amPm':
26045
+ setAmPm(value);
26046
+ break;
26047
+ case 'hour12':
26048
+ setHour(value ? convert12to24(value, amPm || 'am').toString() : '');
26049
+ break;
26050
+ case 'hour24':
26051
+ setHour(value);
26052
+ break;
26053
+ case 'minute':
26054
+ setMinute(value);
26055
+ break;
26056
+ case 'second':
26057
+ setSecond(value);
26058
+ break;
26059
+ }
26060
+ onChangeExternal();
26061
+ }
26062
+ /**
26063
+ * Called when native date input is changed.
26064
+ */
26065
+ function onChangeNative(event) {
26066
+ var value = event.target.value;
26067
+ if (!onChangeProps) {
26068
+ return;
26069
+ }
26070
+ var processedValue = value || null;
26071
+ onChangeProps(processedValue, false);
26072
+ }
26073
+ var commonInputProps = {
26074
+ className: className,
26075
+ disabled: disabled,
26076
+ maxTime: maxTime,
26077
+ minTime: minTime,
26078
+ onChange: onChange,
26079
+ onKeyDown: onKeyDown,
26080
+ onKeyUp: onKeyUp,
26081
+ // This is only for showing validity when editing
26082
+ required: Boolean(required || isClockOpen),
26083
+ };
26084
+ function renderHour12(currentMatch, index) {
26085
+ if (currentMatch && currentMatch.length > 2) {
26086
+ throw new Error("Unsupported token: ".concat(currentMatch));
26087
+ }
26088
+ var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
26089
+ return (React__default.createElement(Hour12Input, __assign$1({ key: "hour12" }, commonInputProps, { amPm: amPm, ariaLabel: hourAriaLabel,
26090
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26091
+ autoFocus: index === 0 && autoFocus, inputRef: hour12Input, placeholder: hourPlaceholder, showLeadingZeros: showLeadingZeros, value: hour })));
26092
+ }
26093
+ function renderHour24(currentMatch, index) {
26094
+ if (currentMatch && currentMatch.length > 2) {
26095
+ throw new Error("Unsupported token: ".concat(currentMatch));
26096
+ }
26097
+ var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
26098
+ return (React__default.createElement(Hour24Input, __assign$1({ key: "hour24" }, commonInputProps, { ariaLabel: hourAriaLabel,
26099
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26100
+ autoFocus: index === 0 && autoFocus, inputRef: hour24Input, placeholder: hourPlaceholder, showLeadingZeros: showLeadingZeros, value: hour })));
26101
+ }
26102
+ function renderHour(currentMatch, index) {
26103
+ if (/h/.test(currentMatch)) {
26104
+ return renderHour12(currentMatch, index);
26105
+ }
26106
+ return renderHour24(currentMatch, index);
26107
+ }
26108
+ function renderMinute(currentMatch, index) {
26109
+ if (currentMatch && currentMatch.length > 2) {
26110
+ throw new Error("Unsupported token: ".concat(currentMatch));
26111
+ }
26112
+ var showLeadingZeros = currentMatch ? currentMatch.length === 2 : false;
26113
+ return (React__default.createElement(MinuteInput, __assign$1({ key: "minute" }, commonInputProps, { ariaLabel: minuteAriaLabel,
26114
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26115
+ autoFocus: index === 0 && autoFocus, hour: hour, inputRef: minuteInput, placeholder: minutePlaceholder, showLeadingZeros: showLeadingZeros, value: minute })));
26116
+ }
26117
+ function renderSecond(currentMatch, index) {
26118
+ if (currentMatch && currentMatch.length > 2) {
26119
+ throw new Error("Unsupported token: ".concat(currentMatch));
26120
+ }
26121
+ var showLeadingZeros = currentMatch ? currentMatch.length === 2 : true;
26122
+ return (React__default.createElement(SecondInput, __assign$1({ key: "second" }, commonInputProps, { ariaLabel: secondAriaLabel,
26123
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26124
+ autoFocus: index === 0 && autoFocus, hour: hour, inputRef: secondInput, minute: minute, placeholder: secondPlaceholder, showLeadingZeros: showLeadingZeros, value: second })));
26125
+ }
26126
+ function renderAmPm(currentMatch, index) {
26127
+ return (React__default.createElement(AmPm, __assign$1({ key: "ampm" }, commonInputProps, { ariaLabel: amPmAriaLabel,
26128
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26129
+ autoFocus: index === 0 && autoFocus, inputRef: amPmInput, locale: locale, onChange: onChange, value: amPm })));
26130
+ }
26131
+ function renderCustomInputsInternal() {
26132
+ var elementFunctions = {
26133
+ h: renderHour,
26134
+ H: renderHour,
26135
+ m: renderMinute,
26136
+ s: renderSecond,
26137
+ a: renderAmPm,
26138
+ };
26139
+ var allowMultipleInstances = typeof format !== 'undefined';
26140
+ return renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances);
26141
+ }
26142
+ function renderNativeInput() {
26143
+ 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 }));
26144
+ }
26145
+ return (
26146
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
26147
+ React__default.createElement("div", { className: className, onClick: onClick },
26148
+ renderNativeInput(),
26149
+ renderCustomInputsInternal()));
26150
+ }
26151
+
26152
+ var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
26153
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
26154
+ if (ar || !(i in from)) {
26155
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
26156
+ ar[i] = from[i];
26157
+ }
26158
+ }
26159
+ return to.concat(ar || Array.prototype.slice.call(from));
26160
+ };
26161
+ var allViews$1 = ['hour', 'minute', 'second'];
26162
+ var allValueTypes = __spreadArray([], allViews$1, true);
26163
+ var hourOptionalSecondsRegExp = /^(([0-1])?[0-9]|2[0-3]):[0-5][0-9](:([0-5][0-9]))?$/;
26164
+ var isTime = function isTime(props, propName, componentName) {
26165
+ var _a = props, _b = propName, time = _a[_b];
26166
+ if (time) {
26167
+ if (typeof time !== 'string' || !hourOptionalSecondsRegExp.test(time)) {
26168
+ return new Error("Invalid prop `".concat(propName, "` of type `").concat(typeof time, "` supplied to `").concat(componentName, "`, expected time in HH:mm(:ss) format."));
26169
+ }
26170
+ }
26171
+ // Everything is fine
26172
+ return null;
26173
+ };
26174
+ propTypes$1.exports.oneOf(allValueTypes);
26175
+ propTypes$1.exports.oneOfType([
26176
+ propTypes$1.exports.func,
26177
+ propTypes$1.exports.exact({
26178
+ current: propTypes$1.exports.any,
26179
+ }),
26180
+ ]);
26181
+ var rangeOf = function (type) {
26182
+ return propTypes$1.exports.arrayOf(type);
26183
+ };
26184
+
26185
+ var __assign = (undefined && undefined.__assign) || function () {
26186
+ __assign = Object.assign || function(t) {
26187
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
26188
+ s = arguments[i];
26189
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
26190
+ t[p] = s[p];
26191
+ }
26192
+ return t;
26193
+ };
26194
+ return __assign.apply(this, arguments);
26195
+ };
26196
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
26197
+ var t = {};
26198
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
26199
+ t[p] = s[p];
26200
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
26201
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
26202
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
26203
+ t[p[i]] = s[p[i]];
26204
+ }
26205
+ return t;
26206
+ };
26207
+ var isBrowser$4 = typeof document !== 'undefined';
26208
+ var baseClassName = 'react-time-picker';
26209
+ var outsideActionEvents = ['mousedown', 'focusin', 'touchstart'];
26210
+ var allViews = ['hour', 'minute', 'second'];
26211
+ var iconProps = {
26212
+ xmlns: 'http://www.w3.org/2000/svg',
26213
+ width: 19,
26214
+ height: 19,
26215
+ viewBox: '0 0 19 19',
26216
+ stroke: 'black',
26217
+ strokeWidth: 2,
26218
+ };
26219
+ var ClockIcon = (React__default.createElement("svg", __assign({}, iconProps, { className: "".concat(baseClassName, "__clock-button__icon ").concat(baseClassName, "__button__icon"), fill: "none" }),
26220
+ React__default.createElement("circle", { cx: "9.5", cy: "9.5", r: "7.5" }),
26221
+ React__default.createElement("path", { d: "M9.5 4.5 v5 h4" })));
26222
+ var ClearIcon = (React__default.createElement("svg", __assign({}, iconProps, { className: "".concat(baseClassName, "__clear-button__icon ").concat(baseClassName, "__button__icon") }),
26223
+ React__default.createElement("line", { x1: "4", x2: "15", y1: "4", y2: "15" }),
26224
+ React__default.createElement("line", { x1: "15", x2: "4", y1: "4", y2: "15" })));
26225
+ var TimePicker$1 = function TimePicker(props) {
26226
+ 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"]);
26227
+ var _h = useState(isOpenProps), isOpen = _h[0], setIsOpen = _h[1];
26228
+ var wrapper = useRef(null);
26229
+ var clockWrapper = useRef(null);
26230
+ useEffect(function () {
26231
+ setIsOpen(isOpenProps);
26232
+ }, [isOpenProps]);
26233
+ function openClock(_a) {
26234
+ var reason = _a.reason;
26235
+ if (shouldOpenClock) {
26236
+ if (!shouldOpenClock({ reason: reason })) {
26237
+ return;
26238
+ }
26239
+ }
26240
+ setIsOpen(true);
26241
+ if (onClockOpen) {
26242
+ onClockOpen();
26243
+ }
26244
+ }
26245
+ var closeClock = useCallback(function (_a) {
26246
+ var reason = _a.reason;
26247
+ if (shouldCloseClock) {
26248
+ if (!shouldCloseClock({ reason: reason })) {
26249
+ return;
26250
+ }
26251
+ }
26252
+ setIsOpen(false);
26253
+ if (onClockClose) {
26254
+ onClockClose();
26255
+ }
26256
+ }, [onClockClose, shouldCloseClock]);
26257
+ function toggleClock() {
26258
+ if (isOpen) {
26259
+ closeClock({ reason: 'buttonClick' });
26260
+ }
26261
+ else {
26262
+ openClock({ reason: 'buttonClick' });
26263
+ }
26264
+ }
26265
+ function onChange(value, shouldCloseClock) {
26266
+ if (shouldCloseClock === void 0) { shouldCloseClock = shouldCloseClockOnSelect; }
26267
+ if (shouldCloseClock) {
26268
+ closeClock({ reason: 'select' });
26269
+ }
26270
+ if (onChangeProps) {
26271
+ onChangeProps(value);
26272
+ }
26273
+ }
26274
+ function onFocus(event) {
26275
+ if (onFocusProps) {
26276
+ onFocusProps(event);
26277
+ }
26278
+ if (
26279
+ // Internet Explorer still fires onFocus on disabled elements
26280
+ disabled ||
26281
+ isOpen ||
26282
+ !openClockOnFocus ||
26283
+ event.target.dataset.select === 'true') {
26284
+ return;
26285
+ }
26286
+ openClock({ reason: 'focus' });
26287
+ }
26288
+ var onKeyDown = useCallback(function (event) {
26289
+ if (event.key === 'Escape') {
26290
+ closeClock({ reason: 'escape' });
26291
+ }
26292
+ }, [closeClock]);
26293
+ function clear() {
26294
+ onChange(null);
26295
+ }
26296
+ function stopPropagation(event) {
26297
+ event.stopPropagation();
26298
+ }
26299
+ var onOutsideAction = useCallback(function (event) {
26300
+ var wrapperEl = wrapper.current;
26301
+ var clockWrapperEl = clockWrapper.current;
26302
+ // Try event.composedPath first to handle clicks inside a Shadow DOM.
26303
+ var target = ('composedPath' in event ? event.composedPath()[0] : event.target);
26304
+ if (target &&
26305
+ wrapperEl &&
26306
+ !wrapperEl.contains(target) &&
26307
+ (!clockWrapperEl || !clockWrapperEl.contains(target))) {
26308
+ closeClock({ reason: 'outsideAction' });
26309
+ }
26310
+ }, [clockWrapper, closeClock, wrapper]);
26311
+ var handleOutsideActionListeners = useCallback(function (shouldListen) {
26312
+ if (shouldListen === void 0) { shouldListen = isOpen; }
26313
+ outsideActionEvents.forEach(function (event) {
26314
+ if (shouldListen) {
26315
+ document.addEventListener(event, onOutsideAction);
26316
+ }
26317
+ else {
26318
+ document.removeEventListener(event, onOutsideAction);
26319
+ }
26320
+ });
26321
+ if (shouldListen) {
26322
+ document.addEventListener('keydown', onKeyDown);
26323
+ }
26324
+ else {
26325
+ document.removeEventListener('keydown', onKeyDown);
26326
+ }
26327
+ }, [isOpen, onOutsideAction, onKeyDown]);
26328
+ useEffect(function () {
26329
+ handleOutsideActionListeners();
26330
+ return function () {
26331
+ handleOutsideActionListeners(false);
26332
+ };
26333
+ }, [handleOutsideActionListeners]);
26334
+ function renderInputs() {
26335
+ var valueFrom = (Array.isArray(value) ? value : [value])[0];
26336
+ var ariaLabelProps = {
26337
+ amPmAriaLabel: amPmAriaLabel,
26338
+ hourAriaLabel: hourAriaLabel,
26339
+ minuteAriaLabel: minuteAriaLabel,
26340
+ nativeInputAriaLabel: nativeInputAriaLabel,
26341
+ secondAriaLabel: secondAriaLabel,
26342
+ };
26343
+ var placeholderProps = {
26344
+ hourPlaceholder: hourPlaceholder,
26345
+ minutePlaceholder: minutePlaceholder,
26346
+ secondPlaceholder: secondPlaceholder,
26347
+ };
26348
+ return (React__default.createElement("div", { className: "".concat(baseClassName, "__wrapper") },
26349
+ React__default.createElement(TimeInput, __assign({}, ariaLabelProps, placeholderProps, {
26350
+ // eslint-disable-next-line jsx-a11y/no-autofocus
26351
+ 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 })),
26352
+ 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)),
26353
+ 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))));
26354
+ }
26355
+ function renderClock() {
26356
+ if (isOpen === null || disableClock) {
26357
+ return null;
26358
+ }
26359
+ var clockClassName = props.clockClassName; props.className; // Unused, here to exclude it from clockProps
26360
+ props.onChange; // Unused, here to exclude it from clockProps
26361
+ var portalContainer = props.portalContainer, value = props.value, clockProps = __rest(props, ["clockClassName", "className", "onChange", "portalContainer", "value"]);
26362
+ var className = "".concat(baseClassName, "__clock");
26363
+ var classNames = clsx$1(className, "".concat(className, "--").concat(isOpen ? 'open' : 'closed'));
26364
+ var valueFrom = (Array.isArray(value) ? value : [value])[0];
26365
+ var clock = React__default.createElement(Clock, __assign({ className: clockClassName, value: valueFrom }, clockProps));
26366
+ return portalContainer ? (createPortal(React__default.createElement("div", { ref: clockWrapper, className: classNames }, clock), portalContainer)) : (React__default.createElement(Fit, null,
26367
+ React__default.createElement("div", { ref: function (ref) {
26368
+ if (ref && !isOpen) {
26369
+ ref.removeAttribute('style');
26370
+ }
26371
+ }, className: classNames }, clock)));
26372
+ }
26373
+ var eventProps = useMemo(function () { return makeEventProps(otherProps); }, [otherProps]);
26374
+ 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 }),
26375
+ renderInputs(),
26376
+ renderClock()));
26377
+ };
26378
+ var isValue = propTypes$1.exports.oneOfType([isTime, propTypes$1.exports.instanceOf(Date)]);
26379
+ var isValueOrValueArray = propTypes$1.exports.oneOfType([isValue, rangeOf(isValue)]);
26380
+ TimePicker$1.propTypes = {
26381
+ amPmAriaLabel: propTypes$1.exports.string,
26382
+ autoFocus: propTypes$1.exports.bool,
26383
+ className: propTypes$1.exports.oneOfType([propTypes$1.exports.string, propTypes$1.exports.arrayOf(propTypes$1.exports.string)]),
26384
+ clearAriaLabel: propTypes$1.exports.string,
26385
+ clearIcon: propTypes$1.exports.oneOfType([propTypes$1.exports.node, propTypes$1.exports.func]),
26386
+ clockAriaLabel: propTypes$1.exports.string,
26387
+ clockClassName: propTypes$1.exports.oneOfType([propTypes$1.exports.string, propTypes$1.exports.arrayOf(propTypes$1.exports.string)]),
26388
+ clockIcon: propTypes$1.exports.oneOfType([propTypes$1.exports.node, propTypes$1.exports.func]),
26389
+ closeClock: propTypes$1.exports.bool,
26390
+ 'data-testid': propTypes$1.exports.string,
26391
+ disableClock: propTypes$1.exports.bool,
26392
+ disabled: propTypes$1.exports.bool,
26393
+ format: propTypes$1.exports.string,
26394
+ hourAriaLabel: propTypes$1.exports.string,
26395
+ hourPlaceholder: propTypes$1.exports.string,
26396
+ id: propTypes$1.exports.string,
26397
+ isOpen: propTypes$1.exports.bool,
26398
+ locale: propTypes$1.exports.string,
26399
+ maxDetail: propTypes$1.exports.oneOf(allViews),
26400
+ maxTime: isTime,
26401
+ minTime: isTime,
26402
+ minuteAriaLabel: propTypes$1.exports.string,
26403
+ minutePlaceholder: propTypes$1.exports.string,
26404
+ name: propTypes$1.exports.string,
26405
+ nativeInputAriaLabel: propTypes$1.exports.string,
26406
+ onChange: propTypes$1.exports.func,
26407
+ onClockClose: propTypes$1.exports.func,
26408
+ onClockOpen: propTypes$1.exports.func,
26409
+ onFocus: propTypes$1.exports.func,
26410
+ openClockOnFocus: propTypes$1.exports.bool,
26411
+ required: propTypes$1.exports.bool,
26412
+ secondAriaLabel: propTypes$1.exports.string,
26413
+ secondPlaceholder: propTypes$1.exports.string,
26414
+ value: isValueOrValueArray,
26415
+ };
26416
+ if (isBrowser$4) {
26417
+ TimePicker$1.propTypes.portalContainer = propTypes$1.exports.instanceOf(HTMLElement);
26418
+ }
26419
+
26420
+ var HoverIcon = function HoverIcon(_ref) {
26421
+ var _ref$time = _ref.time,
26422
+ time = _ref$time === void 0 ? false : _ref$time;
26423
+ var _useState = useState(false),
26424
+ _useState2 = _slicedToArray$3(_useState, 2),
26425
+ hovered = _useState2[0],
26426
+ setHovered = _useState2[1];
26427
+ return /*#__PURE__*/React__default.createElement("div", {
26428
+ onMouseLeave: function onMouseLeave() {
26429
+ return setHovered(false);
26430
+ },
26431
+ onMouseOver: function onMouseOver() {
26432
+ return setHovered(true);
26433
+ }
26434
+ }, hovered && time ? /*#__PURE__*/React__default.createElement(Close, {
26435
+ size: 16
26436
+ }) : /*#__PURE__*/React__default.createElement(Clock$1, {
26437
+ size: 16
26438
+ }));
26439
+ };
26440
+
26441
+ var FORMAT = "HH:mm";
26442
+ var getFormattedTime = function getFormattedTime(value) {
26443
+ if (dayjs.isDayjs(value)) {
26444
+ return value.toDate();
26445
+ } else if (value instanceof Date || dayjs(value, FORMAT).isValid()) {
26446
+ return value;
26447
+ }
26448
+ return null;
26449
+ };
26450
+ var getFormattedRange = function getFormattedRange(value) {
26451
+ if (!Array.isArray(value)) return null;
26452
+ return value.map(function (item) {
26453
+ return getFormattedTime(item);
26454
+ });
26455
+ };
26456
+ var toDayJs = function toDayJs(value) {
26457
+ if (Array.isArray(value)) return value.map(function (item) {
26458
+ return dayjs(item, FORMAT);
26459
+ });
26460
+ return dayjs(value, FORMAT);
26461
+ };
26462
+
26463
+ var _excluded$v = ["type", "className", "label", "labelProps", "size", "nakedInput", "required", "value", "defaultValue", "onChange", "error", "onBlur"];
26464
+ 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; }
26465
+ 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; }
26466
+ dayjs.extend(customParseFormat);
26467
+ var INPUT_SIZES$1 = {
26468
+ small: "small",
26469
+ medium: "medium",
26470
+ large: "large"
26471
+ };
26472
+ var timeComponents = {
26473
+ range: TimeRangePicker,
26474
+ time: TimePicker$1
26475
+ };
26476
+ var TimePickerInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
26477
+ var _ref$type = _ref.type,
26478
+ type = _ref$type === void 0 ? "time" : _ref$type,
26479
+ _ref$className = _ref.className,
26480
+ className = _ref$className === void 0 ? "" : _ref$className,
26481
+ label = _ref.label,
26482
+ labelProps = _ref.labelProps,
26483
+ _ref$size = _ref.size,
25439
26484
  size = _ref$size === void 0 ? INPUT_SIZES$1.medium : _ref$size,
25440
26485
  _ref$nakedInput = _ref.nakedInput,
25441
26486
  nakedInput = _ref$nakedInput === void 0 ? false : _ref$nakedInput,
25442
26487
  _ref$required = _ref.required,
25443
26488
  required = _ref$required === void 0 ? false : _ref$required,
25444
26489
  inputValue = _ref.value,
25445
- onChange = _ref.onChange,
26490
+ defaultValue = _ref.defaultValue,
26491
+ _ref$onChange = _ref.onChange,
26492
+ onChange = _ref$onChange === void 0 ? noop$3 : _ref$onChange,
25446
26493
  _ref$error = _ref.error,
25447
26494
  error = _ref$error === void 0 ? "" : _ref$error,
25448
26495
  _ref$onBlur = _ref.onBlur,
25449
26496
  onBlur = _ref$onBlur === void 0 ? noop$3 : _ref$onBlur,
25450
26497
  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]);
26498
+ var _useState = useState(null),
26499
+ _useState2 = _slicedToArray$3(_useState, 2),
26500
+ value = _useState2[0],
26501
+ setValue = _useState2[1];
25457
26502
  var id = useId(otherProps.id);
25458
26503
  var errorId = "error_".concat(id);
26504
+ useEffect(function () {
26505
+ if (isNotPresent(inputValue) && isNotPresent(defaultValue)) return;
26506
+ setValue((type === "range" ? getFormattedRange : getFormattedTime)(inputValue || defaultValue));
26507
+ }, [type, inputValue]);
25459
26508
  var handleChange = function handleChange(newValue) {
25460
- var time = dayjs(newValue, FORMAT);
25461
- onChange(time, newValue);
26509
+ setValue(newValue);
26510
+ onChange(toDayJs(newValue), newValue);
26511
+ };
26512
+ var handleShouldCloseClock = function handleShouldCloseClock() {
26513
+ onBlur(toDayJs(value), value);
26514
+ return true;
25462
26515
  };
26516
+ var handleKeyDown = function handleKeyDown(_ref2) {
26517
+ var code = _ref2.code;
26518
+ if (code !== "Enter") return;
26519
+ onBlur(toDayJs(value), value);
26520
+ };
26521
+ var Component = timeComponents[type];
25463
26522
  return /*#__PURE__*/React__default.createElement("div", {
25464
26523
  ref: ref,
25465
26524
  className: "neeto-ui-input__wrapper"
25466
26525
  }, label && /*#__PURE__*/React__default.createElement(Label, _objectSpread$k({
25467
26526
  required: required
25468
- }, labelProps), label), /*#__PURE__*/React__default.createElement(TimePicker$1, _extends$4({
26527
+ }, labelProps), label), /*#__PURE__*/React__default.createElement(Component, _extends$4({
25469
26528
  id: id,
25470
26529
  value: value,
25471
26530
  disableClock: true,
@@ -25476,6 +26535,7 @@ var TimePickerInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25476
26535
  hourPlaceholder: "HH",
25477
26536
  minutePlaceholder: "mm",
25478
26537
  secondAriaLabel: "ss",
26538
+ shouldCloseClock: handleShouldCloseClock,
25479
26539
  className: classnames$1("neeto-ui-time-picker", [className], {
25480
26540
  "neeto-ui-time-picker--small": size === "small",
25481
26541
  "neeto-ui-time-picker--medium": size === "medium",
@@ -25484,13 +26544,8 @@ var TimePickerInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25484
26544
  "neeto-ui-time-picker--naked": nakedInput,
25485
26545
  "neeto-ui-time-picker--error": !!error
25486
26546
  }),
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
26547
+ onChange: handleChange,
26548
+ onKeyDown: handleKeyDown
25494
26549
  }, otherProps)), !!error && typeof error === "string" && /*#__PURE__*/React__default.createElement("p", {
25495
26550
  className: "neeto-ui-input__error",
25496
26551
  "data-cy": "".concat(hyphenize(label), "-input-error"),
@@ -25499,11 +26554,18 @@ var TimePickerInput = /*#__PURE__*/forwardRef$1(function (_ref, ref) {
25499
26554
  });
25500
26555
  TimePickerInput.displayName = "TimePicker";
25501
26556
 
26557
+ var DATE_FORMAT = "YYYY-MM-DD";
26558
+ var TIME_FORMAT = "HH:mm";
26559
+ var getDateTime = function getDateTime(date, time) {
26560
+ if (isPresent(date) && isPresent(time)) {
26561
+ return dayjs("".concat(date.format(DATE_FORMAT), " ").concat(time.format(TIME_FORMAT)));
26562
+ }
26563
+ return null;
26564
+ };
26565
+
25502
26566
  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
26567
  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
26568
  dayjs.extend(customParseFormat);
25505
- var DATE_FORMAT = "YYYY-MM-DD";
25506
- var TIME_FORMAT = "HH:mm";
25507
26569
  var DateTimePicker = function DateTimePicker(_ref) {
25508
26570
  var _ref$className = _ref.className,
25509
26571
  className = _ref$className === void 0 ? "" : _ref$className,
@@ -25525,10 +26587,12 @@ var DateTimePicker = function DateTimePicker(_ref) {
25525
26587
  _ref$required = _ref.required,
25526
26588
  required = _ref$required === void 0 ? false : _ref$required,
25527
26589
  id = _ref.id,
26590
+ datePickerProps = _ref.datePickerProps,
26591
+ timePickerProps = _ref.timePickerProps,
25528
26592
  _ref$onTimeInputBlur = _ref.onTimeInputBlur,
25529
26593
  onTimeInputBlur = _ref$onTimeInputBlur === void 0 ? noop$3 : _ref$onTimeInputBlur,
25530
- datePickerProps = _ref.datePickerProps,
25531
- timePickerProps = _ref.timePickerProps;
26594
+ _ref$onBlur = _ref.onBlur,
26595
+ onBlur = _ref$onBlur === void 0 ? noop$3 : _ref$onBlur;
25532
26596
  var _useState = useState(datePickerProps === null || datePickerProps === void 0 ? void 0 : datePickerProps.open),
25533
26597
  _useState2 = _slicedToArray$3(_useState, 2),
25534
26598
  open = _useState2[0],
@@ -25558,11 +26622,7 @@ var DateTimePicker = function DateTimePicker(_ref) {
25558
26622
  }, [value, defaultValue]);
25559
26623
  useEffect(function () {
25560
26624
  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
- }
26625
+ onChange(getDateTime(date, time), changedField);
25566
26626
  setChangedField(); // reset to avoid unnecessary trigger on rerender
25567
26627
  }, [date, time, changedField]);
25568
26628
  var handleDateChange = function handleDateChange(newDate) {
@@ -25578,6 +26638,10 @@ var DateTimePicker = function DateTimePicker(_ref) {
25578
26638
  if (newTime.isValid() && !date) setDate(newTime);
25579
26639
  setChangedField("time");
25580
26640
  };
26641
+ var handleTimeBlur = function handleTimeBlur() {
26642
+ onTimeInputBlur(getDateTime(date, time));
26643
+ onBlur(getDateTime(date, time));
26644
+ };
25581
26645
  return /*#__PURE__*/React__default.createElement("div", {
25582
26646
  className: "neeto-ui-input__wrapper"
25583
26647
  }, label && /*#__PURE__*/React__default.createElement(Label, _objectSpread$j({
@@ -25607,7 +26671,7 @@ var DateTimePicker = function DateTimePicker(_ref) {
25607
26671
  error: error,
25608
26672
  nakedInput: nakedInput,
25609
26673
  size: size
25610
- }, "error", !!error), "ref", timeRef), "value", time), "onBlur", onTimeInputBlur), "onChange", handleTimeChange), timePickerProps))), !!error && /*#__PURE__*/React__default.createElement("p", {
26674
+ }, "error", !!error), "ref", timeRef), "value", time), "onBlur", handleTimeBlur), "onChange", handleTimeChange), timePickerProps))), !!error && /*#__PURE__*/React__default.createElement("p", {
25611
26675
  className: "neeto-ui-input__error",
25612
26676
  "data-cy": "".concat(hyphenize(label), "-input-error"),
25613
26677
  id: errorId