beesoft-components 0.3.0-1 → 0.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.
Files changed (32) hide show
  1. package/build/index.cjs.js +449 -731
  2. package/build/index.js +449 -731
  3. package/build/index.min.js +6 -6
  4. package/build/index.min.js.gz +0 -0
  5. package/build/types/src/components/form/date-time/date-time-format-creator.d.ts +28 -0
  6. package/build/types/src/components/form/date-time/date-time-functions.d.ts +0 -2
  7. package/build/types/src/components/form/date-time/date-time.reducer.d.ts +1 -4
  8. package/build/types/src/components/form/date-time/hooks/get-date-time-format.hook.d.ts +4 -0
  9. package/build/types/src/components/form/input/formatted-input/formatted-input.component.d.ts +1 -3
  10. package/build/types/src/components/form/input/formatted-input/parser/format-instance-collection.d.ts +1 -1
  11. package/build/types/src/components/form/input/formatted-input/parser/format-navigator.d.ts +1 -1
  12. package/build/types/src/components/form/input/formatted-input/parser/format-parser.d.ts +1 -1
  13. package/build/types/src/components/form/input/formatted-input/parser/format-renderer.d.ts +1 -1
  14. package/build/types/src/components/form/input/formatted-input/parser/input-rule-processor.d.ts +1 -1
  15. package/build/types/src/components/form/input/formatted-input/parser/input-slot-collection.d.ts +1 -1
  16. package/build/types/src/components/form/input/formatted-input/parser/key-processor.d.ts +1 -1
  17. package/build/types/src/components/form/input/formatted-input/parser/parser.interfaces.d.ts +1 -1
  18. package/build/types/src/components/form/input/formatted-input/parser/part-entry-creator.d.ts +1 -1
  19. package/build/types/src/components/form/input/formatted-input/parser/part-entry-iterator.d.ts +1 -1
  20. package/build/types/src/components/overlay/overlay-panel/overlay-panel.component.d.ts +2 -1
  21. package/package.json +1 -1
  22. package/build/types/src/components/form/input/formatted-input/formats/date/day-month-year/format.d.ts +0 -3
  23. package/build/types/src/components/form/input/formatted-input/formats/date/month-day-year/format.d.ts +0 -3
  24. package/build/types/src/components/form/input/formatted-input/formats/date/year-month-day/format.d.ts +0 -3
  25. package/build/types/src/components/form/input/formatted-input/formats/date-range/day-month-year/format.d.ts +0 -3
  26. package/build/types/src/components/form/input/formatted-input/formats/date-range/month-day-year/format.d.ts +0 -3
  27. package/build/types/src/components/form/input/formatted-input/formats/date-range/year-month-day/format.d.ts +0 -3
  28. package/build/types/src/components/form/input/formatted-input/formats/index.d.ts +0 -9
  29. package/build/types/src/components/form/input/formatted-input/formats/input-format.enums.d.ts +0 -11
  30. package/build/types/src/components/form/input/formatted-input/formats/time/12-hour/format.d.ts +0 -3
  31. package/build/types/src/components/form/input/formatted-input/formats/time/24-hour/format.d.ts +0 -3
  32. /package/build/types/src/components/form/input/formatted-input/{formats/input-format.interfaces.d.ts → input-format.interfaces.d.ts} +0 -0
package/build/index.js CHANGED
@@ -64,6 +64,16 @@ function __generator(thisArg, body) {
64
64
  } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
65
65
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
66
66
  }
67
+ }
68
+
69
+ function __spreadArray(to, from, pack) {
70
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
71
+ if (ar || !(i in from)) {
72
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
73
+ ar[i] = from[i];
74
+ }
75
+ }
76
+ return to.concat(ar || Array.prototype.slice.call(from));
67
77
  }
68
78
 
69
79
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -30275,7 +30285,7 @@ var DomHandler = (function () {
30275
30285
  }());
30276
30286
 
30277
30287
  function OverlayPanel(_a) {
30278
- var visible = _a.visible, target = _a.target, _b = _a.targetPosition, targetPosition = _b === void 0 ? DomTargetPosition.BottomLeft : _b, _c = _a.elementAlignment, elementAlignment = _c === void 0 ? DomElementAlignment.TopLeft : _c, _d = _a.shouldTargetCloseOverlay, shouldTargetCloseOverlay = _d === void 0 ? true : _d, _e = _a.shouldMatchTargetWidth, shouldMatchTargetWidth = _e === void 0 ? false : _e, _f = _a.shouldScrollCloseOverlay, shouldScrollCloseOverlay = _f === void 0 ? false : _f, _g = _a.shouldCheckZIndex, shouldCheckZIndex = _g === void 0 ? false : _g, _h = _a.shouldRemainOnScreen, shouldRemainOnScreen = _h === void 0 ? false : _h, _j = _a.unmountWhenHidden, unmountWhenHidden = _j === void 0 ? false : _j, _k = _a.transitionDuration, transitionDuration = _k === void 0 ? 400 : _k, _l = _a.showTransitionOptions, showTransitionOptions = _l === void 0 ? 'cubic-bezier(0, 0, 0.2, 1)' : _l, _m = _a.hideTransitionOptions, hideTransitionOptions = _m === void 0 ? 'linear' : _m, shown = _a.shown, hidden = _a.hidden, markupCreated = _a.markupCreated, children = _a.children;
30288
+ var visible = _a.visible, target = _a.target, _b = _a.targetPosition, targetPosition = _b === void 0 ? DomTargetPosition.BottomLeft : _b, _c = _a.elementAlignment, elementAlignment = _c === void 0 ? DomElementAlignment.TopLeft : _c, _d = _a.shouldTargetCloseOverlay, shouldTargetCloseOverlay = _d === void 0 ? true : _d, _e = _a.shouldMatchTargetWidth, shouldMatchTargetWidth = _e === void 0 ? false : _e, _f = _a.shouldScrollCloseOverlay, shouldScrollCloseOverlay = _f === void 0 ? false : _f, _g = _a.shouldCheckZIndex, shouldCheckZIndex = _g === void 0 ? false : _g, _h = _a.shouldRemainOnScreen, shouldRemainOnScreen = _h === void 0 ? false : _h, _j = _a.unmountWhenHidden, unmountWhenHidden = _j === void 0 ? false : _j, _k = _a.transitionDuration, transitionDuration = _k === void 0 ? 400 : _k, _l = _a.showTransitionOptions, showTransitionOptions = _l === void 0 ? 'cubic-bezier(0, 0, 0.2, 1)' : _l, _m = _a.hideTransitionOptions, hideTransitionOptions = _m === void 0 ? 'linear' : _m, shown = _a.shown, hidden = _a.hidden, isClickedWithin = _a.isClickedWithin, markupCreated = _a.markupCreated, children = _a.children;
30279
30289
  var _o = useState(-1), zIndex = _o[0], setZIndex = _o[1];
30280
30290
  var _p = useState(visible), visibility = _p[0], setVisibility = _p[1];
30281
30291
  var _q = useState(false), dimensionsChangedFlag = _q[0], setDimensionsChangedFlag = _q[1];
@@ -30305,7 +30315,7 @@ function OverlayPanel(_a) {
30305
30315
  (_b = resizeObserver.current) === null || _b === void 0 ? void 0 : _b.disconnect();
30306
30316
  }
30307
30317
  };
30308
- }, []);
30318
+ }, [shouldRemainOnScreen]);
30309
30319
  useEffect(function () {
30310
30320
  if (target && shouldScrollCloseOverlay) {
30311
30321
  finalTarget.current = getTargetElement(target);
@@ -30379,7 +30389,14 @@ function OverlayPanel(_a) {
30379
30389
  if (!shouldTargetCloseOverlay && finalTarget.current) {
30380
30390
  otherElements = [finalTarget.current];
30381
30391
  }
30382
- var clickListener = function (clickedWithin) { return !clickedWithin && setVisibility(false); };
30392
+ var clickListener = function (clickedWithin) {
30393
+ if (clickedWithin) {
30394
+ isClickedWithin === null || isClickedWithin === void 0 ? void 0 : isClickedWithin();
30395
+ }
30396
+ else {
30397
+ setVisibility(false);
30398
+ }
30399
+ };
30383
30400
  listenerRef.current = bindDocumentClickListener(panelRef.current, clickListener, otherElements);
30384
30401
  if (shouldScrollCloseOverlay) {
30385
30402
  scrollListenerRef.current = lodashExports.throttle(function (event) { return panelRef.current && isEventOutsideTarget(event, panelRef.current) && setVisibility(false); }, 100, { leading: true });
@@ -30431,19 +30448,6 @@ function OverlayPanel(_a) {
30431
30448
  } })));
30432
30449
  }
30433
30450
 
30434
- var FormattedInputDefaultFormats;
30435
- (function (FormattedInputDefaultFormats) {
30436
- FormattedInputDefaultFormats[FormattedInputDefaultFormats["DateDayMonthYear"] = 0] = "DateDayMonthYear";
30437
- FormattedInputDefaultFormats[FormattedInputDefaultFormats["DateMonthDayYear"] = 1] = "DateMonthDayYear";
30438
- FormattedInputDefaultFormats[FormattedInputDefaultFormats["DateYearMonthDay"] = 2] = "DateYearMonthDay";
30439
- FormattedInputDefaultFormats[FormattedInputDefaultFormats["DateRangeDayMonthYear"] = 3] = "DateRangeDayMonthYear";
30440
- FormattedInputDefaultFormats[FormattedInputDefaultFormats["DateRangeMonthDayYear"] = 4] = "DateRangeMonthDayYear";
30441
- FormattedInputDefaultFormats[FormattedInputDefaultFormats["DateRangeYearMonthDay"] = 5] = "DateRangeYearMonthDay";
30442
- FormattedInputDefaultFormats[FormattedInputDefaultFormats["Time12Hour"] = 6] = "Time12Hour";
30443
- FormattedInputDefaultFormats[FormattedInputDefaultFormats["Time24Hour"] = 7] = "Time24Hour";
30444
- FormattedInputDefaultFormats[FormattedInputDefaultFormats["Custom"] = 8] = "Custom";
30445
- })(FormattedInputDefaultFormats || (FormattedInputDefaultFormats = {}));
30446
-
30447
30451
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
30448
30452
  // require the crypto API and do not support built-in fallback to lower quality random number
30449
30453
  // generators (like Math.random()).
@@ -30752,7 +30756,7 @@ var InputSlotCollection = (function () {
30752
30756
  finalSlotIndex = i;
30753
30757
  }
30754
30758
  }
30755
- return this.inputSlots[finalSlotIndex];
30759
+ return this.inputSlots[finalSlotIndex > -1 ? finalSlotIndex : 0];
30756
30760
  };
30757
30761
  InputSlotCollection.prototype.allSlotsCompleted = function () {
30758
30762
  return this.inputSlots.every(function (slot) { return slot.isComplete; });
@@ -31058,7 +31062,12 @@ var InputRuleProcessor = (function () {
31058
31062
  this.addToInputSlot(key);
31059
31063
  inputSlot.isComplete = true;
31060
31064
  this.formatRenderer.render();
31061
- this.formatNavigator.moveToNextInputPart();
31065
+ if (!this.formatNavigator.isAtLastPart()) {
31066
+ this.formatNavigator.moveToNextInputPart();
31067
+ }
31068
+ else {
31069
+ this.formatNavigator.moveCursorRight();
31070
+ }
31062
31071
  }
31063
31072
  else {
31064
31073
  this.addToInputSlot(key);
@@ -31201,7 +31210,7 @@ var FormatParser = (function () {
31201
31210
  var _this = this;
31202
31211
  this.isInputFocused = true;
31203
31212
  this.formatRenderer.render();
31204
- setTimeout(function () { return _this.formatNavigator.setCursorToCurrentPosition(); });
31213
+ setTimeout(function () { return _this.formatNavigator.findCursorPosition(); });
31205
31214
  };
31206
31215
  FormatParser.prototype.inputBlurred = function () {
31207
31216
  this.isInputFocused = false;
@@ -31255,630 +31264,74 @@ var FormatParser = (function () {
31255
31264
  return FormatParser;
31256
31265
  }());
31257
31266
 
31258
- var format$7 = {
31259
- formatParts: [
31260
- {
31261
- characterCount: 2,
31262
- placeholder: 'D',
31263
- inputText: '_',
31264
- isSeparator: false,
31265
- allCharactersRequired: false,
31266
- valueType: FormatValueType.Numeric,
31267
- minimumValue: 1,
31268
- maximumValue: 31,
31269
- exceedingMaximumValueCausesTab: true,
31270
- padWithZeros: true,
31271
- },
31272
- {
31273
- characterCount: 1,
31274
- placeholder: '/',
31275
- inputText: '/',
31276
- isSeparator: true,
31277
- },
31278
- {
31279
- characterCount: 2,
31280
- placeholder: 'M',
31281
- inputText: '_',
31282
- isSeparator: false,
31283
- allCharactersRequired: false,
31284
- valueType: FormatValueType.Numeric,
31285
- minimumValue: 1,
31286
- maximumValue: 12,
31287
- exceedingMaximumValueCausesTab: true,
31288
- padWithZeros: true,
31289
- },
31290
- {
31291
- characterCount: 1,
31292
- placeholder: '/',
31293
- inputText: '/',
31294
- isSeparator: true,
31295
- },
31296
- {
31297
- characterCount: 4,
31298
- placeholder: 'Y',
31299
- inputText: '_',
31300
- isSeparator: false,
31301
- allCharactersRequired: true,
31302
- valueType: FormatValueType.Numeric,
31303
- },
31304
- ],
31305
- };
31306
-
31307
- var format$6 = {
31308
- formatParts: [
31309
- {
31310
- characterCount: 2,
31311
- placeholder: 'M',
31312
- inputText: '_',
31313
- isSeparator: false,
31314
- allCharactersRequired: false,
31315
- valueType: FormatValueType.Numeric,
31316
- minimumValue: 1,
31317
- maximumValue: 12,
31318
- exceedingMaximumValueCausesTab: true,
31319
- padWithZeros: true,
31320
- },
31321
- {
31322
- characterCount: 1,
31323
- placeholder: '/',
31324
- inputText: '/',
31325
- isSeparator: true,
31326
- },
31327
- {
31328
- characterCount: 2,
31329
- placeholder: 'D',
31330
- inputText: '_',
31331
- isSeparator: false,
31332
- allCharactersRequired: false,
31333
- valueType: FormatValueType.Numeric,
31334
- minimumValue: 1,
31335
- maximumValue: 31,
31336
- exceedingMaximumValueCausesTab: true,
31337
- padWithZeros: true,
31338
- },
31339
- {
31340
- characterCount: 1,
31341
- placeholder: '/',
31342
- inputText: '/',
31343
- isSeparator: true,
31344
- },
31345
- {
31346
- characterCount: 4,
31347
- placeholder: 'Y',
31348
- inputText: '_',
31349
- isSeparator: false,
31350
- allCharactersRequired: true,
31351
- valueType: FormatValueType.Numeric,
31352
- },
31353
- ],
31267
+ var FormattedInput = function (props, ref) {
31268
+ var _a = props.value, value = _a === void 0 ? '' : _a, format = props.format, _b = props.readOnly, readOnly = _b === void 0 ? false : _b, _c = props.debounceTime, debounceTime = _c === void 0 ? 800 : _c, _d = props.fillContainer, fillContainer = _d === void 0 ? true : _d, leftElement = props.leftElement, rightElement = props.rightElement, className = props.className, leftElementClassName = props.leftElementClassName, rightElementClassName = props.rightElementClassName, _e = props.isSingleLine, isSingleLine = _e === void 0 ? false : _e, _f = props.allowSingleLineScroll, allowSingleLineScroll = _f === void 0 ? false : _f, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onElementCreate = props.onElementCreate, onLeftElementClick = props.onLeftElementClick, onRightElementClick = props.onRightElementClick;
31269
+ var inputRef = useRef();
31270
+ var inputElementRef = useRef();
31271
+ var formatParser = useRef();
31272
+ useEffect(function () {
31273
+ return function () {
31274
+ var _a;
31275
+ (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.dispose();
31276
+ };
31277
+ }, []);
31278
+ useEffect(function () {
31279
+ var _a;
31280
+ (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.inputValuePassed(value);
31281
+ }, [value]);
31282
+ useEffect(function () {
31283
+ var _a, _b, _c;
31284
+ (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.dispose();
31285
+ if (format) {
31286
+ formatParser.current = new FormatParser(format, value);
31287
+ if (inputElementRef.current) {
31288
+ (_b = formatParser.current) === null || _b === void 0 ? void 0 : _b.inputElementCreated(inputElementRef.current);
31289
+ }
31290
+ (_c = formatParser.current) === null || _c === void 0 ? void 0 : _c.registerFormatChangeEvent(onFormatChange);
31291
+ }
31292
+ }, [format]);
31293
+ var onFormatChange = useCallback(function (value) {
31294
+ onChange === null || onChange === void 0 ? void 0 : onChange(value);
31295
+ }, [onChange]);
31296
+ var onFocusHandler = useCallback(function (event) {
31297
+ var _a;
31298
+ (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.inputFocused();
31299
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
31300
+ }, [onFocus]);
31301
+ var onBlurHandler = useCallback(function (event) {
31302
+ var _a;
31303
+ (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.inputBlurred();
31304
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
31305
+ }, [onBlur]);
31306
+ var onMouseUpHandler = useCallback(function () {
31307
+ var _a;
31308
+ (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.mouseUpHandler();
31309
+ }, []);
31310
+ var onKeyDownHandler = useCallback(function (event) {
31311
+ var _a;
31312
+ (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.keyDownHandler(event);
31313
+ }, []);
31314
+ var onInputRefCreated = useCallback(function (ref) {
31315
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
31316
+ (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.inputElement) === null || _b === void 0 ? void 0 : _b.removeEventListener('keydown', onKeyDownHandler);
31317
+ (_d = (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.inputElement) === null || _d === void 0 ? void 0 : _d.removeEventListener('mouseup', onMouseUpHandler);
31318
+ inputRef.current = ref;
31319
+ (_f = (_e = inputRef.current) === null || _e === void 0 ? void 0 : _e.inputElement) === null || _f === void 0 ? void 0 : _f.addEventListener('keydown', onKeyDownHandler);
31320
+ (_h = (_g = inputRef.current) === null || _g === void 0 ? void 0 : _g.inputElement) === null || _h === void 0 ? void 0 : _h.addEventListener('mouseup', onMouseUpHandler);
31321
+ inputElementRef.current = (_j = inputRef.current) === null || _j === void 0 ? void 0 : _j.inputElement;
31322
+ }, []);
31323
+ var focus = useCallback(function () {
31324
+ var _a;
31325
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
31326
+ }, []);
31327
+ useImperativeHandle(ref, function () { return ({
31328
+ focus: focus,
31329
+ }); });
31330
+ return (jsx(ContentEditableInput$1, { ref: function (refElement) { return refElement && onInputRefCreated(refElement); }, readOnly: readOnly, debounceTime: debounceTime, fillContainer: fillContainer, leftElement: leftElement, rightElement: rightElement, className: className, leftElementClassName: leftElementClassName, rightElementClassName: rightElementClassName, isSingleLine: isSingleLine, allowSingleLineScroll: allowSingleLineScroll, onFocus: onFocusHandler, onBlur: onBlurHandler, onElementCreate: onElementCreate, onLeftElementClick: onLeftElementClick, onRightElementClick: onRightElementClick }));
31354
31331
  };
31332
+ var FormattedInput$1 = memo(forwardRef(FormattedInput));
31355
31333
 
31356
- var format$5 = {
31357
- formatParts: [
31358
- {
31359
- characterCount: 4,
31360
- placeholder: 'Y',
31361
- inputText: '_',
31362
- isSeparator: false,
31363
- allCharactersRequired: true,
31364
- valueType: FormatValueType.Numeric,
31365
- },
31366
- {
31367
- characterCount: 1,
31368
- placeholder: '-',
31369
- inputText: '-',
31370
- isSeparator: true,
31371
- },
31372
- {
31373
- characterCount: 2,
31374
- placeholder: 'M',
31375
- inputText: '_',
31376
- isSeparator: false,
31377
- allCharactersRequired: false,
31378
- valueType: FormatValueType.Numeric,
31379
- minimumValue: 1,
31380
- maximumValue: 12,
31381
- exceedingMaximumValueCausesTab: true,
31382
- padWithZeros: true,
31383
- },
31384
- {
31385
- characterCount: 1,
31386
- placeholder: '-',
31387
- inputText: '-',
31388
- isSeparator: true,
31389
- },
31390
- {
31391
- characterCount: 2,
31392
- placeholder: 'D',
31393
- inputText: '_',
31394
- isSeparator: false,
31395
- allCharactersRequired: false,
31396
- valueType: FormatValueType.Numeric,
31397
- minimumValue: 1,
31398
- maximumValue: 31,
31399
- exceedingMaximumValueCausesError: true,
31400
- padWithZeros: true,
31401
- },
31402
- ],
31403
- };
31404
-
31405
- var format$4 = {
31406
- formatParts: [
31407
- {
31408
- characterCount: 2,
31409
- placeholder: 'D',
31410
- inputText: '_',
31411
- isSeparator: false,
31412
- allCharactersRequired: false,
31413
- valueType: FormatValueType.Numeric,
31414
- minimumValue: 1,
31415
- maximumValue: 31,
31416
- exceedingMaximumValueCausesTab: true,
31417
- padWithZeros: true,
31418
- },
31419
- {
31420
- characterCount: 1,
31421
- placeholder: '/',
31422
- inputText: '/',
31423
- isSeparator: true,
31424
- },
31425
- {
31426
- characterCount: 2,
31427
- placeholder: 'M',
31428
- inputText: '_',
31429
- isSeparator: false,
31430
- allCharactersRequired: false,
31431
- valueType: FormatValueType.Numeric,
31432
- minimumValue: 1,
31433
- maximumValue: 12,
31434
- exceedingMaximumValueCausesTab: true,
31435
- padWithZeros: true,
31436
- },
31437
- {
31438
- characterCount: 1,
31439
- placeholder: '/',
31440
- inputText: '/',
31441
- isSeparator: true,
31442
- },
31443
- {
31444
- characterCount: 4,
31445
- placeholder: 'Y',
31446
- inputText: '_',
31447
- isSeparator: false,
31448
- allCharactersRequired: true,
31449
- valueType: FormatValueType.Numeric,
31450
- },
31451
- {
31452
- characterCount: 3,
31453
- placeholder: ' - ',
31454
- inputText: ' - ',
31455
- isSeparator: true,
31456
- },
31457
- {
31458
- characterCount: 2,
31459
- placeholder: 'D',
31460
- inputText: '_',
31461
- isSeparator: false,
31462
- allCharactersRequired: false,
31463
- valueType: FormatValueType.Numeric,
31464
- minimumValue: 1,
31465
- maximumValue: 31,
31466
- exceedingMaximumValueCausesTab: true,
31467
- padWithZeros: true,
31468
- },
31469
- {
31470
- characterCount: 1,
31471
- placeholder: '/',
31472
- inputText: '/',
31473
- isSeparator: true,
31474
- },
31475
- {
31476
- characterCount: 2,
31477
- placeholder: 'M',
31478
- inputText: '_',
31479
- isSeparator: false,
31480
- allCharactersRequired: false,
31481
- valueType: FormatValueType.Numeric,
31482
- minimumValue: 1,
31483
- maximumValue: 12,
31484
- exceedingMaximumValueCausesTab: true,
31485
- padWithZeros: true,
31486
- },
31487
- {
31488
- characterCount: 1,
31489
- placeholder: '/',
31490
- inputText: '/',
31491
- isSeparator: true,
31492
- },
31493
- {
31494
- characterCount: 4,
31495
- placeholder: 'Y',
31496
- inputText: '_',
31497
- isSeparator: false,
31498
- allCharactersRequired: true,
31499
- valueType: FormatValueType.Numeric,
31500
- },
31501
- ],
31502
- };
31503
-
31504
- var format$3 = {
31505
- formatParts: [
31506
- {
31507
- characterCount: 2,
31508
- placeholder: 'M',
31509
- inputText: '_',
31510
- isSeparator: false,
31511
- allCharactersRequired: false,
31512
- valueType: FormatValueType.Numeric,
31513
- minimumValue: 1,
31514
- maximumValue: 12,
31515
- exceedingMaximumValueCausesTab: true,
31516
- padWithZeros: true,
31517
- },
31518
- {
31519
- characterCount: 1,
31520
- placeholder: '/',
31521
- inputText: '/',
31522
- isSeparator: true,
31523
- },
31524
- {
31525
- characterCount: 2,
31526
- placeholder: 'D',
31527
- inputText: '_',
31528
- isSeparator: false,
31529
- allCharactersRequired: false,
31530
- valueType: FormatValueType.Numeric,
31531
- minimumValue: 1,
31532
- maximumValue: 31,
31533
- exceedingMaximumValueCausesTab: true,
31534
- padWithZeros: true,
31535
- },
31536
- {
31537
- characterCount: 1,
31538
- placeholder: '/',
31539
- inputText: '/',
31540
- isSeparator: true,
31541
- },
31542
- {
31543
- characterCount: 4,
31544
- placeholder: 'Y',
31545
- inputText: '_',
31546
- isSeparator: false,
31547
- allCharactersRequired: true,
31548
- valueType: FormatValueType.Numeric,
31549
- },
31550
- {
31551
- characterCount: 3,
31552
- placeholder: ' - ',
31553
- inputText: ' - ',
31554
- isSeparator: true,
31555
- },
31556
- {
31557
- characterCount: 2,
31558
- placeholder: 'M',
31559
- inputText: '_',
31560
- isSeparator: false,
31561
- allCharactersRequired: false,
31562
- valueType: FormatValueType.Numeric,
31563
- minimumValue: 1,
31564
- maximumValue: 12,
31565
- exceedingMaximumValueCausesTab: true,
31566
- padWithZeros: true,
31567
- },
31568
- {
31569
- characterCount: 1,
31570
- placeholder: '/',
31571
- inputText: '/',
31572
- isSeparator: true,
31573
- },
31574
- {
31575
- characterCount: 2,
31576
- placeholder: 'D',
31577
- inputText: '_',
31578
- isSeparator: false,
31579
- allCharactersRequired: false,
31580
- valueType: FormatValueType.Numeric,
31581
- minimumValue: 1,
31582
- maximumValue: 31,
31583
- exceedingMaximumValueCausesTab: true,
31584
- padWithZeros: true,
31585
- },
31586
- {
31587
- characterCount: 1,
31588
- placeholder: '/',
31589
- inputText: '/',
31590
- isSeparator: true,
31591
- },
31592
- {
31593
- characterCount: 4,
31594
- placeholder: 'Y',
31595
- inputText: '_',
31596
- isSeparator: false,
31597
- allCharactersRequired: true,
31598
- valueType: FormatValueType.Numeric,
31599
- },
31600
- ],
31601
- };
31602
-
31603
- var format$2 = {
31604
- formatParts: [
31605
- {
31606
- characterCount: 4,
31607
- placeholder: 'Y',
31608
- inputText: '_',
31609
- isSeparator: false,
31610
- allCharactersRequired: true,
31611
- valueType: FormatValueType.Numeric,
31612
- },
31613
- {
31614
- characterCount: 1,
31615
- placeholder: '-',
31616
- inputText: '-',
31617
- isSeparator: true,
31618
- },
31619
- {
31620
- characterCount: 2,
31621
- placeholder: 'M',
31622
- inputText: '_',
31623
- isSeparator: false,
31624
- allCharactersRequired: false,
31625
- valueType: FormatValueType.Numeric,
31626
- minimumValue: 1,
31627
- maximumValue: 12,
31628
- exceedingMaximumValueCausesTab: true,
31629
- padWithZeros: true,
31630
- },
31631
- {
31632
- characterCount: 1,
31633
- placeholder: '-',
31634
- inputText: '-',
31635
- isSeparator: true,
31636
- },
31637
- {
31638
- characterCount: 2,
31639
- placeholder: 'D',
31640
- inputText: '_',
31641
- isSeparator: false,
31642
- allCharactersRequired: false,
31643
- valueType: FormatValueType.Numeric,
31644
- minimumValue: 1,
31645
- maximumValue: 31,
31646
- exceedingMaximumValueCausesTab: true,
31647
- padWithZeros: true,
31648
- },
31649
- {
31650
- characterCount: 3,
31651
- placeholder: ' - ',
31652
- inputText: ' - ',
31653
- isSeparator: true,
31654
- },
31655
- {
31656
- characterCount: 4,
31657
- placeholder: 'Y',
31658
- inputText: '_',
31659
- isSeparator: false,
31660
- allCharactersRequired: true,
31661
- valueType: FormatValueType.Numeric,
31662
- },
31663
- {
31664
- characterCount: 1,
31665
- placeholder: '-',
31666
- inputText: '-',
31667
- isSeparator: true,
31668
- },
31669
- {
31670
- characterCount: 2,
31671
- placeholder: 'M',
31672
- inputText: '_',
31673
- isSeparator: false,
31674
- allCharactersRequired: false,
31675
- valueType: FormatValueType.Numeric,
31676
- minimumValue: 1,
31677
- maximumValue: 12,
31678
- exceedingMaximumValueCausesTab: true,
31679
- padWithZeros: true,
31680
- },
31681
- {
31682
- characterCount: 1,
31683
- placeholder: '/',
31684
- inputText: '/',
31685
- isSeparator: true,
31686
- },
31687
- {
31688
- characterCount: 2,
31689
- placeholder: 'D',
31690
- inputText: '_',
31691
- isSeparator: false,
31692
- allCharactersRequired: false,
31693
- valueType: FormatValueType.Numeric,
31694
- minimumValue: 1,
31695
- maximumValue: 31,
31696
- exceedingMaximumValueCausesError: true,
31697
- padWithZeros: true,
31698
- },
31699
- ],
31700
- };
31701
-
31702
- var format$1 = {
31703
- formatParts: [
31704
- {
31705
- characterCount: 2,
31706
- placeholder: 'H',
31707
- inputText: '_',
31708
- isSeparator: false,
31709
- allCharactersRequired: false,
31710
- valueType: FormatValueType.Numeric,
31711
- minimumValue: 1,
31712
- maximumValue: 12,
31713
- exceedingMaximumValueCausesTab: true,
31714
- padWithZeros: true,
31715
- },
31716
- {
31717
- characterCount: 1,
31718
- placeholder: ':',
31719
- inputText: ':',
31720
- isSeparator: true,
31721
- },
31722
- {
31723
- characterCount: 2,
31724
- placeholder: 'M',
31725
- inputText: '_',
31726
- isSeparator: false,
31727
- allCharactersRequired: false,
31728
- valueType: FormatValueType.Numeric,
31729
- minimumValue: 0,
31730
- maximumValue: 59,
31731
- exceedingMaximumValueCausesError: true,
31732
- padWithZeros: true,
31733
- },
31734
- {
31735
- characterCount: 1,
31736
- placeholder: ' ',
31737
- inputText: ' ',
31738
- isSeparator: true,
31739
- },
31740
- {
31741
- characterCount: 2,
31742
- inputText: '_',
31743
- isSeparator: false,
31744
- possibleValues: ['AM', 'PM'],
31745
- },
31746
- ],
31747
- };
31748
-
31749
- var format = {
31750
- formatParts: [
31751
- {
31752
- characterCount: 2,
31753
- placeholder: 'H',
31754
- inputText: '_',
31755
- isSeparator: false,
31756
- allCharactersRequired: false,
31757
- valueType: FormatValueType.Numeric,
31758
- minimumValue: 0,
31759
- maximumValue: 23,
31760
- exceedingMaximumValueCausesTab: true,
31761
- padWithZeros: true,
31762
- },
31763
- {
31764
- characterCount: 1,
31765
- placeholder: ':',
31766
- inputText: ':',
31767
- isSeparator: true,
31768
- },
31769
- {
31770
- characterCount: 2,
31771
- placeholder: 'M',
31772
- inputText: '_',
31773
- isSeparator: false,
31774
- allCharactersRequired: false,
31775
- valueType: FormatValueType.Numeric,
31776
- minimumValue: 1,
31777
- maximumValue: 59,
31778
- exceedingMaximumValueCausesError: true,
31779
- padWithZeros: true,
31780
- },
31781
- ],
31782
- };
31783
-
31784
- var FormattedInput = function (props, ref) {
31785
- var _a = props.value, value = _a === void 0 ? '' : _a, format$8 = props.format, _b = props.defaultFormat, defaultFormat = _b === void 0 ? FormattedInputDefaultFormats.Custom : _b, _c = props.readOnly, readOnly = _c === void 0 ? false : _c, _d = props.debounceTime, debounceTime = _d === void 0 ? 800 : _d, _e = props.fillContainer, fillContainer = _e === void 0 ? true : _e, leftElement = props.leftElement, rightElement = props.rightElement, className = props.className, leftElementClassName = props.leftElementClassName, rightElementClassName = props.rightElementClassName, _f = props.isSingleLine, isSingleLine = _f === void 0 ? false : _f, _g = props.allowSingleLineScroll, allowSingleLineScroll = _g === void 0 ? false : _g, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onElementCreate = props.onElementCreate, onLeftElementClick = props.onLeftElementClick, onRightElementClick = props.onRightElementClick;
31786
- var inputRef = useRef();
31787
- var inputElementRef = useRef();
31788
- var formatParser = useRef();
31789
- useEffect(function () {
31790
- return function () {
31791
- var _a;
31792
- (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.dispose();
31793
- };
31794
- }, []);
31795
- useEffect(function () {
31796
- var _a;
31797
- (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.inputValuePassed(value);
31798
- }, [value]);
31799
- useEffect(function () {
31800
- var _a, _b, _c;
31801
- (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.dispose();
31802
- if (defaultFormat !== FormattedInputDefaultFormats.Custom) {
31803
- var formatSetting = getPreDefinedFormat(defaultFormat);
31804
- if (!formatSetting) {
31805
- throw new Error('The selected format does not exist');
31806
- }
31807
- formatParser.current = new FormatParser(formatSetting, value);
31808
- }
31809
- else {
31810
- if (!format$8) {
31811
- throw new Error('The format property is required when the default format is custom');
31812
- }
31813
- formatParser.current = new FormatParser(format$8, value);
31814
- }
31815
- if (inputElementRef.current) {
31816
- (_b = formatParser.current) === null || _b === void 0 ? void 0 : _b.inputElementCreated(inputElementRef.current);
31817
- }
31818
- (_c = formatParser.current) === null || _c === void 0 ? void 0 : _c.registerFormatChangeEvent(onFormatChange);
31819
- }, [defaultFormat, format$8]);
31820
- var onFormatChange = useCallback(function (value) {
31821
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
31822
- }, [onChange]);
31823
- var getPreDefinedFormat = useCallback(function (format$8) {
31824
- switch (format$8) {
31825
- case FormattedInputDefaultFormats.DateDayMonthYear:
31826
- return format$7;
31827
- case FormattedInputDefaultFormats.DateMonthDayYear:
31828
- return format$6;
31829
- case FormattedInputDefaultFormats.DateYearMonthDay:
31830
- return format$5;
31831
- case FormattedInputDefaultFormats.DateRangeDayMonthYear:
31832
- return format$4;
31833
- case FormattedInputDefaultFormats.DateRangeMonthDayYear:
31834
- return format$3;
31835
- case FormattedInputDefaultFormats.DateRangeYearMonthDay:
31836
- return format$2;
31837
- case FormattedInputDefaultFormats.Time12Hour:
31838
- return format$1;
31839
- case FormattedInputDefaultFormats.Time24Hour:
31840
- return format;
31841
- }
31842
- }, []);
31843
- var onFocusHandler = useCallback(function (event) {
31844
- var _a;
31845
- (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.inputFocused();
31846
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
31847
- }, [onFocus]);
31848
- var onBlurHandler = useCallback(function (event) {
31849
- var _a;
31850
- (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.inputBlurred();
31851
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
31852
- }, [onBlur]);
31853
- var onMouseUpHandler = useCallback(function () {
31854
- var _a;
31855
- (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.mouseUpHandler();
31856
- }, []);
31857
- var onKeyDownHandler = useCallback(function (event) {
31858
- var _a;
31859
- (_a = formatParser.current) === null || _a === void 0 ? void 0 : _a.keyDownHandler(event);
31860
- }, []);
31861
- var onInputRefCreated = useCallback(function (ref) {
31862
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
31863
- (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.inputElement) === null || _b === void 0 ? void 0 : _b.removeEventListener('keydown', onKeyDownHandler);
31864
- (_d = (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.inputElement) === null || _d === void 0 ? void 0 : _d.removeEventListener('mouseup', onMouseUpHandler);
31865
- inputRef.current = ref;
31866
- (_f = (_e = inputRef.current) === null || _e === void 0 ? void 0 : _e.inputElement) === null || _f === void 0 ? void 0 : _f.addEventListener('keydown', onKeyDownHandler);
31867
- (_h = (_g = inputRef.current) === null || _g === void 0 ? void 0 : _g.inputElement) === null || _h === void 0 ? void 0 : _h.addEventListener('mouseup', onMouseUpHandler);
31868
- inputElementRef.current = (_j = inputRef.current) === null || _j === void 0 ? void 0 : _j.inputElement;
31869
- }, []);
31870
- var focus = useCallback(function () {
31871
- var _a;
31872
- (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
31873
- }, []);
31874
- useImperativeHandle(ref, function () { return ({
31875
- focus: focus,
31876
- }); });
31877
- return (jsx(ContentEditableInput$1, { ref: function (refElement) { return refElement && onInputRefCreated(refElement); }, readOnly: readOnly, debounceTime: debounceTime, fillContainer: fillContainer, leftElement: leftElement, rightElement: rightElement, className: className, leftElementClassName: leftElementClassName, rightElementClassName: rightElementClassName, isSingleLine: isSingleLine, allowSingleLineScroll: allowSingleLineScroll, onFocus: onFocusHandler, onBlur: onBlurHandler, onElementCreate: onElementCreate, onLeftElementClick: onLeftElementClick, onRightElementClick: onRightElementClick }));
31878
- };
31879
- var FormattedInput$1 = memo(forwardRef(FormattedInput));
31880
-
31881
- var DateTimeContext = createContext(undefined);
31334
+ var DateTimeContext = createContext(undefined);
31882
31335
 
31883
31336
  function getMonthMatrix(matrixDate, locale, loadOtherMonths) {
31884
31337
  var _a, _b;
@@ -32044,25 +31497,6 @@ function loadLocale(localeToLoad) {
32044
31497
  });
32045
31498
  });
32046
31499
  }
32047
- function getDateFormatByLocale(locale) {
32048
- var year = 2023;
32049
- var month = 12;
32050
- var day = 20;
32051
- var date = new Date(year, month - 1, day);
32052
- var formattedDate = date.toLocaleDateString(locale, {
32053
- year: 'numeric',
32054
- month: 'numeric',
32055
- day: 'numeric',
32056
- });
32057
- return formattedDate.replace("".concat(year), 'YYYY').replace("".concat(month), 'MM').replace("".concat(day), 'DD');
32058
- }
32059
- function uses24HourTimeByLocale(locale) {
32060
- var date = new Date();
32061
- var hour = 18;
32062
- date.setHours(hour);
32063
- var timeParts = date.toLocaleTimeString(locale).split(':');
32064
- return timeParts[0] === '18';
32065
- }
32066
31500
  function createDefaultColors() {
32067
31501
  return {
32068
31502
  inputBgColor: 'bsc-bg-white',
@@ -32083,16 +31517,19 @@ function parseDate(dateValue, locale) {
32083
31517
  localDate = parse(dateValue, 'P HH:mm', new Date(), { locale: locale });
32084
31518
  if (!isNaN(localDate.valueOf()))
32085
31519
  return localDate;
32086
- localDate = parse(dateValue, 'P HH:mm aaa', new Date(), { locale: locale });
31520
+ localDate = parse(dateValue, 'P hh:mm a..aaa', new Date(), { locale: locale });
32087
31521
  if (!isNaN(localDate.valueOf()))
32088
31522
  return localDate;
32089
31523
  localDate = parse(dateValue, 'P HH:mm:ss', new Date(), { locale: locale });
32090
31524
  if (!isNaN(localDate.valueOf()))
32091
31525
  return localDate;
32092
- localDate = parse(dateValue, 'P HH:mm:ss aaa', new Date(), { locale: locale });
31526
+ localDate = parse(dateValue, 'P hh:mm:ss a..aaa', new Date(), { locale: locale });
32093
31527
  if (!isNaN(localDate.valueOf()))
32094
31528
  return localDate;
32095
31529
  localDate = parse(dateValue, 'P', new Date(), { locale: locale });
31530
+ if (!isNaN(localDate.valueOf()))
31531
+ return localDate;
31532
+ localDate = parse(dateValue, 'P p', new Date(), { locale: locale });
32096
31533
  if (!isNaN(localDate.valueOf()))
32097
31534
  return localDate;
32098
31535
  localDate = parse(dateValue, 'pp', new Date(), { locale: locale });
@@ -32167,7 +31604,7 @@ var DateTimeActionType;
32167
31604
  DateTimeActionType[DateTimeActionType["SetSelectedDateRange"] = 7] = "SetSelectedDateRange";
32168
31605
  DateTimeActionType[DateTimeActionType["SetSelectedStartDate"] = 8] = "SetSelectedStartDate";
32169
31606
  DateTimeActionType[DateTimeActionType["SetSelectedEndDate"] = 9] = "SetSelectedEndDate";
32170
- DateTimeActionType[DateTimeActionType["SetInputFormat"] = 10] = "SetInputFormat";
31607
+ DateTimeActionType[DateTimeActionType["SetTimeFormat"] = 10] = "SetTimeFormat";
32171
31608
  DateTimeActionType[DateTimeActionType["ClearDates"] = 11] = "ClearDates";
32172
31609
  DateTimeActionType[DateTimeActionType["InitializeDates"] = 12] = "InitializeDates";
32173
31610
  })(DateTimeActionType || (DateTimeActionType = {}));
@@ -32193,16 +31630,13 @@ var reducer = function (state, action) {
32193
31630
  return __assign(__assign({}, state), { selectedStartDate: action.selectedStartDate, selectedEndDate: undefined });
32194
31631
  case DateTimeActionType.SetSelectedEndDate:
32195
31632
  return __assign(__assign({}, state), { selectedEndDate: action.selectedEndDate });
32196
- case DateTimeActionType.SetInputFormat:
32197
- return __assign(__assign({}, state), { timeFormat: action.inputFormat === FormattedInputDefaultFormats.Time24Hour
32198
- ? TimeFormatType.TwentyFourHour
32199
- : action.timeFormat || TimeFormatType.TwelveHour, inputFormat: action.inputFormat });
31633
+ case DateTimeActionType.SetTimeFormat:
31634
+ return __assign(__assign({}, state), { timeFormat: action.timeFormat || state.timeFormat });
32200
31635
  case DateTimeActionType.ClearDates:
32201
31636
  return {
32202
31637
  currentSelector: state.currentSelector,
32203
31638
  currentViewDate: state.currentViewDate,
32204
31639
  timeFormat: state.timeFormat,
32205
- inputFormat: state.inputFormat,
32206
31640
  dateInitialized: true,
32207
31641
  };
32208
31642
  case DateTimeActionType.InitializeDates:
@@ -32666,17 +32100,341 @@ function DateTimeYearSelector(_a) {
32666
32100
  }) })) }))] })));
32667
32101
  }
32668
32102
 
32103
+ var DateTimeFormatCreator = (function () {
32104
+ function DateTimeFormatCreator(dateSelection, localeCode) {
32105
+ this.dateSelection = dateSelection;
32106
+ var year = 2023;
32107
+ var month = 12;
32108
+ var day = 20;
32109
+ var date = new Date(year, month - 1, day);
32110
+ var format = date.toLocaleDateString(localeCode, {
32111
+ year: 'numeric',
32112
+ month: 'numeric',
32113
+ day: 'numeric',
32114
+ });
32115
+ this.dateFormat = format.replace("".concat(year), 'YYYY').replace("".concat(month), 'MM').replace("".concat(day), 'DD');
32116
+ var time = new Date();
32117
+ var hour = 18;
32118
+ var minute = 24;
32119
+ var second = 37;
32120
+ var milliseconds = 317;
32121
+ time.setHours(hour, minute, second, milliseconds);
32122
+ var testTimeFormat = time.toLocaleTimeString(localeCode);
32123
+ this.use24HourTime = testTimeFormat.startsWith('18');
32124
+ this.timeFormat = testTimeFormat
32125
+ .replace("".concat(this.use24HourTime ? hour : '6'), 'HH')
32126
+ .replace("".concat(minute), 'MM')
32127
+ .replace("".concat(second), 'SS')
32128
+ .replace("".concat(milliseconds), 'LLL');
32129
+ this.createDateParts();
32130
+ }
32131
+ Object.defineProperty(DateTimeFormatCreator.prototype, "is24HourTime", {
32132
+ get: function () {
32133
+ return this.use24HourTime;
32134
+ },
32135
+ enumerable: false,
32136
+ configurable: true
32137
+ });
32138
+ DateTimeFormatCreator.prototype.createInputFormat = function () {
32139
+ var inputFormat = {
32140
+ deleteShiftsFormatPart: false,
32141
+ formatParts: [],
32142
+ };
32143
+ switch (this.dateSelection) {
32144
+ case DateSelectionType.DateOnly:
32145
+ return this.createDateFormat(inputFormat);
32146
+ case DateSelectionType.TimeOnly:
32147
+ return this.createTimeFormat(inputFormat);
32148
+ case DateSelectionType.DateRange:
32149
+ return this.createDateRangeFormat(inputFormat);
32150
+ case DateSelectionType.DateTime:
32151
+ return this.createDateTimeFormat(inputFormat);
32152
+ }
32153
+ };
32154
+ DateTimeFormatCreator.prototype.createDateFormat = function (inputFormat) {
32155
+ var _a, _b, _c;
32156
+ if (this.dateFormat.startsWith('MM')) {
32157
+ (_a = inputFormat.formatParts).push.apply(_a, this.createMonthDayYearFormatParts());
32158
+ }
32159
+ else if (this.dateFormat.startsWith('DD')) {
32160
+ (_b = inputFormat.formatParts).push.apply(_b, this.createDayMonthYearFormatParts());
32161
+ }
32162
+ else {
32163
+ (_c = inputFormat.formatParts).push.apply(_c, this.createYearMonthDayFormatParts());
32164
+ }
32165
+ return inputFormat;
32166
+ };
32167
+ DateTimeFormatCreator.prototype.createTimeFormat = function (inputFormat) {
32168
+ var _a, _b;
32169
+ if (!this.use24HourTime) {
32170
+ (_a = inputFormat.formatParts).push.apply(_a, this.createTwelveHourFormatParts());
32171
+ }
32172
+ else {
32173
+ (_b = inputFormat.formatParts).push.apply(_b, this.createTwentyFourHourFormatParts());
32174
+ }
32175
+ return inputFormat;
32176
+ };
32177
+ DateTimeFormatCreator.prototype.createDateRangeFormat = function (inputFormat) {
32178
+ var _a;
32179
+ var formatParts = [];
32180
+ if (this.dateFormat.startsWith('MM')) {
32181
+ formatParts.push.apply(formatParts, this.createMonthDayYearFormatParts());
32182
+ }
32183
+ else if (this.dateFormat.startsWith('DD')) {
32184
+ formatParts.push.apply(formatParts, this.createDayMonthYearFormatParts());
32185
+ }
32186
+ else {
32187
+ formatParts.push.apply(formatParts, this.createYearMonthDayFormatParts());
32188
+ }
32189
+ var dividerPart = {
32190
+ characterCount: 3,
32191
+ placeholder: ' - ',
32192
+ inputText: ' - ',
32193
+ isSeparator: true,
32194
+ };
32195
+ (_a = inputFormat.formatParts).push.apply(_a, __spreadArray(__spreadArray(__spreadArray([], formatParts, false), [dividerPart], false), formatParts, false));
32196
+ return inputFormat;
32197
+ };
32198
+ DateTimeFormatCreator.prototype.createDateTimeFormat = function (inputFormat) {
32199
+ var _a, _b, _c, _d, _e;
32200
+ if (this.dateFormat.startsWith('MM')) {
32201
+ (_a = inputFormat.formatParts).push.apply(_a, this.createMonthDayYearFormatParts());
32202
+ }
32203
+ else if (this.dateFormat.startsWith('DD')) {
32204
+ (_b = inputFormat.formatParts).push.apply(_b, this.createDayMonthYearFormatParts());
32205
+ }
32206
+ else {
32207
+ (_c = inputFormat.formatParts).push.apply(_c, this.createYearMonthDayFormatParts());
32208
+ }
32209
+ var dividerPart = {
32210
+ characterCount: 1,
32211
+ placeholder: ' ',
32212
+ inputText: ' ',
32213
+ isSeparator: true,
32214
+ };
32215
+ inputFormat.formatParts.push(dividerPart);
32216
+ if (!this.use24HourTime) {
32217
+ (_d = inputFormat.formatParts).push.apply(_d, this.createTwelveHourFormatParts());
32218
+ }
32219
+ else {
32220
+ (_e = inputFormat.formatParts).push.apply(_e, this.createTwentyFourHourFormatParts());
32221
+ }
32222
+ return inputFormat;
32223
+ };
32224
+ DateTimeFormatCreator.prototype.createMonthDayYearFormatParts = function () {
32225
+ if (this.monthPart && this.dayPart && this.yearPart) {
32226
+ var tempDateFormat = this.dateFormat.replace('MM', '');
32227
+ var placeholderIndex = tempDateFormat.indexOf('DD');
32228
+ var placeholderText = tempDateFormat.substring(0, placeholderIndex);
32229
+ tempDateFormat = tempDateFormat.replace(placeholderText, '').replace('DD', '');
32230
+ var placeholder1 = {
32231
+ characterCount: placeholderText.length,
32232
+ placeholder: placeholderText,
32233
+ inputText: placeholderText,
32234
+ isSeparator: true,
32235
+ };
32236
+ placeholderIndex = tempDateFormat.indexOf('YYYY');
32237
+ placeholderText = tempDateFormat.substring(0, placeholderIndex);
32238
+ var placeholder2 = {
32239
+ characterCount: placeholderText.length,
32240
+ placeholder: placeholderText,
32241
+ inputText: placeholderText,
32242
+ isSeparator: true,
32243
+ };
32244
+ return [this.monthPart, placeholder1, this.dayPart, placeholder2, this.yearPart];
32245
+ }
32246
+ return [];
32247
+ };
32248
+ DateTimeFormatCreator.prototype.createDayMonthYearFormatParts = function () {
32249
+ if (this.monthPart && this.dayPart && this.yearPart) {
32250
+ var tempDateFormat = this.dateFormat.replace('DD', '');
32251
+ var placeholderIndex = tempDateFormat.indexOf('MM');
32252
+ var placeholderText = tempDateFormat.substring(0, placeholderIndex);
32253
+ tempDateFormat = tempDateFormat.replace(placeholderText, '').replace('MM', '');
32254
+ var placeholder1 = {
32255
+ characterCount: placeholderText.length,
32256
+ placeholder: placeholderText,
32257
+ inputText: placeholderText,
32258
+ isSeparator: true,
32259
+ };
32260
+ placeholderIndex = tempDateFormat.indexOf('YYYY');
32261
+ placeholderText = tempDateFormat.substring(0, placeholderIndex);
32262
+ var placeholder2 = {
32263
+ characterCount: placeholderText.length,
32264
+ placeholder: placeholderText,
32265
+ inputText: placeholderText,
32266
+ isSeparator: true,
32267
+ };
32268
+ return [this.dayPart, placeholder1, this.monthPart, placeholder2, this.yearPart];
32269
+ }
32270
+ return [];
32271
+ };
32272
+ DateTimeFormatCreator.prototype.createYearMonthDayFormatParts = function () {
32273
+ if (this.monthPart && this.dayPart && this.yearPart) {
32274
+ var tempDateFormat = this.dateFormat.replace('YYYY', '');
32275
+ var placeholderIndex = tempDateFormat.indexOf('MM');
32276
+ var placeholderText = tempDateFormat.substring(0, placeholderIndex);
32277
+ tempDateFormat = tempDateFormat.replace(placeholderText, '').replace('MM', '');
32278
+ var placeholder1 = {
32279
+ characterCount: placeholderText.length,
32280
+ placeholder: placeholderText,
32281
+ inputText: placeholderText,
32282
+ isSeparator: true,
32283
+ };
32284
+ placeholderIndex = tempDateFormat.indexOf('DD');
32285
+ placeholderText = tempDateFormat.substring(0, placeholderIndex);
32286
+ var placeholder2 = {
32287
+ characterCount: placeholderText.length,
32288
+ placeholder: placeholderText,
32289
+ inputText: placeholderText,
32290
+ isSeparator: true,
32291
+ };
32292
+ return [this.yearPart, placeholder1, this.monthPart, placeholder2, this.dayPart];
32293
+ }
32294
+ return [];
32295
+ };
32296
+ DateTimeFormatCreator.prototype.createTwelveHourFormatParts = function () {
32297
+ if (this.twelveHourPart && this.minutePart && this.meridianPart) {
32298
+ var tempTimeFormat = this.timeFormat.replace('HH', '');
32299
+ var placeholderIndex = tempTimeFormat.indexOf('MM');
32300
+ var placeholderText = tempTimeFormat.substring(0, placeholderIndex);
32301
+ var placeholder1 = {
32302
+ characterCount: placeholderText.length,
32303
+ placeholder: placeholderText,
32304
+ inputText: placeholderText,
32305
+ isSeparator: true,
32306
+ };
32307
+ var placeholder2 = {
32308
+ characterCount: 1,
32309
+ placeholder: ' ',
32310
+ inputText: ' ',
32311
+ isSeparator: true,
32312
+ };
32313
+ return [this.twelveHourPart, placeholder1, this.minutePart, placeholder2, this.meridianPart];
32314
+ }
32315
+ return [];
32316
+ };
32317
+ DateTimeFormatCreator.prototype.createTwentyFourHourFormatParts = function () {
32318
+ if (this.twentyFourHourPart && this.minutePart) {
32319
+ var tempTimeFormat = this.timeFormat.replace('HH', '');
32320
+ var placeholderIndex = tempTimeFormat.indexOf('MM');
32321
+ var placeholderText = tempTimeFormat.substring(0, placeholderIndex);
32322
+ var placeholder1 = {
32323
+ characterCount: placeholderText.length,
32324
+ placeholder: placeholderText,
32325
+ inputText: placeholderText,
32326
+ isSeparator: true,
32327
+ };
32328
+ return [this.twentyFourHourPart, placeholder1, this.minutePart];
32329
+ }
32330
+ return [];
32331
+ };
32332
+ DateTimeFormatCreator.prototype.createDateParts = function () {
32333
+ this.monthPart = {
32334
+ characterCount: 2,
32335
+ placeholder: 'M',
32336
+ inputText: '_',
32337
+ isSeparator: false,
32338
+ allCharactersRequired: false,
32339
+ valueType: FormatValueType.Numeric,
32340
+ minimumValue: 1,
32341
+ maximumValue: 12,
32342
+ exceedingMaximumValueCausesTab: true,
32343
+ padWithZeros: true,
32344
+ };
32345
+ this.dayPart = {
32346
+ characterCount: 2,
32347
+ placeholder: 'D',
32348
+ inputText: '_',
32349
+ isSeparator: false,
32350
+ allCharactersRequired: false,
32351
+ valueType: FormatValueType.Numeric,
32352
+ minimumValue: 1,
32353
+ maximumValue: 31,
32354
+ exceedingMaximumValueCausesTab: true,
32355
+ padWithZeros: true,
32356
+ };
32357
+ this.yearPart = {
32358
+ characterCount: 4,
32359
+ placeholder: 'Y',
32360
+ inputText: '_',
32361
+ isSeparator: false,
32362
+ allCharactersRequired: true,
32363
+ valueType: FormatValueType.Numeric,
32364
+ };
32365
+ this.twelveHourPart = {
32366
+ characterCount: 2,
32367
+ placeholder: 'H',
32368
+ inputText: '_',
32369
+ isSeparator: false,
32370
+ allCharactersRequired: false,
32371
+ valueType: FormatValueType.Numeric,
32372
+ minimumValue: 1,
32373
+ maximumValue: 12,
32374
+ exceedingMaximumValueCausesTab: true,
32375
+ padWithZeros: true,
32376
+ };
32377
+ this.twentyFourHourPart = {
32378
+ characterCount: 2,
32379
+ placeholder: 'H',
32380
+ inputText: '_',
32381
+ isSeparator: false,
32382
+ allCharactersRequired: false,
32383
+ valueType: FormatValueType.Numeric,
32384
+ minimumValue: 0,
32385
+ maximumValue: 23,
32386
+ exceedingMaximumValueCausesTab: true,
32387
+ padWithZeros: true,
32388
+ };
32389
+ this.minutePart = {
32390
+ characterCount: 2,
32391
+ placeholder: 'M',
32392
+ inputText: '_',
32393
+ isSeparator: false,
32394
+ allCharactersRequired: false,
32395
+ valueType: FormatValueType.Numeric,
32396
+ minimumValue: 0,
32397
+ maximumValue: 59,
32398
+ exceedingMaximumValueCausesError: true,
32399
+ padWithZeros: true,
32400
+ };
32401
+ this.meridianPart = {
32402
+ characterCount: 2,
32403
+ inputText: '_',
32404
+ isSeparator: false,
32405
+ valueType: FormatValueType.Text,
32406
+ possibleValues: ['AM', 'PM'],
32407
+ };
32408
+ };
32409
+ return DateTimeFormatCreator;
32410
+ }());
32411
+
32412
+ var useGetDateTimeFormat = function (dateSelection, localeCode) {
32413
+ var _a;
32414
+ var _b = useState(), inputFormat = _b[0], setInputFormat = _b[1];
32415
+ var formatCreator = useRef();
32416
+ useEffect(function () {
32417
+ if (localeCode && !inputFormat) {
32418
+ formatCreator.current = new DateTimeFormatCreator(dateSelection, localeCode);
32419
+ setInputFormat(formatCreator.current.createInputFormat());
32420
+ }
32421
+ }, [localeCode]);
32422
+ return [inputFormat, (_a = formatCreator.current) === null || _a === void 0 ? void 0 : _a.is24HourTime];
32423
+ };
32424
+
32669
32425
  function DateTime(_a) {
32670
32426
  var _b;
32671
32427
  var value = _a.value, _c = _a.readOnly, readOnly = _c === void 0 ? false : _c, label = _a.label, _d = _a.useDefaultDateValue, useDefaultDateValue = _d === void 0 ? false : _d, _e = _a.useFormattedInput, useFormattedInput = _e === void 0 ? false : _e, _f = _a.allowClear, allowClear = _f === void 0 ? false : _f, locale = _a.locale, className = _a.className, _g = _a.dateSelection, dateSelection = _g === void 0 ? DateSelectionType.DateTime : _g, dateFormat = _a.dateFormat, timeConstraints = _a.timeConstraints, icon = _a.icon, _h = _a.iconPosition, iconPosition = _h === void 0 ? CalendarIconPosition.Right : _h, inputElement = _a.inputElement, _j = _a.colors, colors = _j === void 0 ? createDefaultColors() : _j, selectableDate = _a.selectableDate, isValidDate = _a.isValidDate, onChange = _a.onChange, calendarTemplate = _a.calendarTemplate, dateScrollerTemplate = _a.dateScrollerTemplate, inputTemplate = _a.inputTemplate;
32672
32428
  var _k = useState(false), selectorOpen = _k[0], setSelectorOpen = _k[1];
32673
- var _l = useState(), dropDownTarget = _l[0], setDropDownTarget = _l[1];
32429
+ var _l = useState(), localeCode = _l[0], setLocaleCode = _l[1];
32430
+ var _m = useState(), dropDownTarget = _m[0], setDropDownTarget = _m[1];
32674
32431
  var isFormattedInput = useRef();
32675
32432
  var inputElementChanged = useRef(false);
32676
32433
  var language = useRef(locale || getBrowserLanguage());
32677
32434
  var loadedLocale = useRef();
32678
32435
  var inputElementRef = useRef();
32679
32436
  var dropDownTargetRef = useRef();
32437
+ var _o = useGetDateTimeFormat(dateSelection, localeCode), inputFormat = _o[0], use24HourTime = _o[1];
32680
32438
  var contextProps = useRef({
32681
32439
  calendarTemplate: calendarTemplate,
32682
32440
  dateScrollerTemplate: dateScrollerTemplate,
@@ -32702,64 +32460,13 @@ function DateTime(_a) {
32702
32460
  }
32703
32461
  }, [value, loadedLocale.current]);
32704
32462
  useEffect(function () {
32705
- if (dateSelection && loadedLocale.current && loadedLocale.current.code) {
32706
- var dateFormatString = getDateFormatByLocale(loadedLocale.current.code);
32707
- if (dateSelection === DateSelectionType.DateOnly) {
32708
- if (dateFormatString === 'DD/MM/YYYY') {
32709
- dispatcher({
32710
- type: DateTimeActionType.SetInputFormat,
32711
- inputFormat: FormattedInputDefaultFormats.DateDayMonthYear,
32712
- });
32713
- }
32714
- else if (dateFormatString === 'MM/DD/YYYY') {
32715
- dispatcher({
32716
- type: DateTimeActionType.SetInputFormat,
32717
- inputFormat: FormattedInputDefaultFormats.DateMonthDayYear,
32718
- });
32719
- }
32720
- else if (dateFormatString === 'YYYY/MM/DD') {
32721
- dispatcher({
32722
- type: DateTimeActionType.SetInputFormat,
32723
- inputFormat: FormattedInputDefaultFormats.DateYearMonthDay,
32724
- });
32725
- }
32726
- }
32727
- else if (dateSelection === DateSelectionType.TimeOnly) {
32728
- if (uses24HourTimeByLocale(loadedLocale.current.code)) {
32729
- dispatcher({
32730
- type: DateTimeActionType.SetInputFormat,
32731
- inputFormat: FormattedInputDefaultFormats.Time24Hour,
32732
- });
32733
- }
32734
- else {
32735
- dispatcher({
32736
- type: DateTimeActionType.SetInputFormat,
32737
- inputFormat: FormattedInputDefaultFormats.Time12Hour,
32738
- });
32739
- }
32740
- }
32741
- else if (dateSelection === DateSelectionType.DateRange) {
32742
- if (dateFormatString === 'DD/MM/YYYY') {
32743
- dispatcher({
32744
- type: DateTimeActionType.SetInputFormat,
32745
- inputFormat: FormattedInputDefaultFormats.DateRangeDayMonthYear,
32746
- });
32747
- }
32748
- else if (dateFormatString === 'MM/DD/YYYY') {
32749
- dispatcher({
32750
- type: DateTimeActionType.SetInputFormat,
32751
- inputFormat: FormattedInputDefaultFormats.DateRangeMonthDayYear,
32752
- });
32753
- }
32754
- else if (dateFormatString === 'YYYY/MM/DD') {
32755
- dispatcher({
32756
- type: DateTimeActionType.SetInputFormat,
32757
- inputFormat: FormattedInputDefaultFormats.DateRangeYearMonthDay,
32758
- });
32759
- }
32760
- }
32463
+ if (use24HourTime) {
32464
+ dispatcher({
32465
+ type: DateTimeActionType.SetTimeFormat,
32466
+ timeFormat: use24HourTime ? TimeFormatType.TwentyFourHour : TimeFormatType.TwelveHour,
32467
+ });
32761
32468
  }
32762
- }, [dateSelection, loadedLocale.current]);
32469
+ }, [use24HourTime]);
32763
32470
  useEffect(function () {
32764
32471
  if (inputElement) {
32765
32472
  inputElementRef.current = inputElement;
@@ -32768,6 +32475,7 @@ function DateTime(_a) {
32768
32475
  var loadLocaleObject = function (localeToLoad) {
32769
32476
  loadLocale(localeToLoad)
32770
32477
  .then(function (locale) {
32478
+ setLocaleCode(locale.code);
32771
32479
  loadedLocale.current = locale;
32772
32480
  var defaultDate = getDateValue();
32773
32481
  if (value || useDefaultDateValue) {
@@ -32806,11 +32514,21 @@ function DateTime(_a) {
32806
32514
  timeFormat: TimeFormatType.TwelveHour,
32807
32515
  dateInitialized: false,
32808
32516
  };
32809
- var _m = useReducer(reducer, initialState), state = _m[0], dispatcher = _m[1];
32517
+ var _p = useReducer(reducer, initialState), state = _p[0], dispatcher = _p[1];
32810
32518
  var onFocus = function () {
32811
32519
  setDropDownElement();
32812
32520
  setSelectorOpen(true);
32813
32521
  };
32522
+ var onBlur = useMemo(function () {
32523
+ return lodashExports.debounce(function () {
32524
+ setSelectorOpen(false);
32525
+ }, 250);
32526
+ }, []);
32527
+ var onCalendarClick = useMemo(function () {
32528
+ return lodashExports.debounce(function () {
32529
+ onBlur.cancel();
32530
+ }, 5);
32531
+ }, [onBlur]);
32814
32532
  var onInput = function (event) {
32815
32533
  var dateString = event.target.innerText;
32816
32534
  onDateStringChange(dateString);
@@ -32852,7 +32570,7 @@ function DateTime(_a) {
32852
32570
  onChange === null || onChange === void 0 ? void 0 : onChange();
32853
32571
  }
32854
32572
  };
32855
- var onCalendarClick = function () {
32573
+ var onCalendarIconClick = function () {
32856
32574
  setDropDownElement();
32857
32575
  setSelectorOpen(!selectorOpen);
32858
32576
  };
@@ -32960,10 +32678,10 @@ function DateTime(_a) {
32960
32678
  ? {}
32961
32679
  : iconPosition === CalendarIconPosition.Right
32962
32680
  ? {
32963
- rightElement: (jsxs("div", __assign({ className: "bsc-flex" }, { children: [allowClear && !readOnly && (jsx("div", { children: jsx(FontAwesomeIcon, { className: "bsc-cursor-pointer bsc-text-sm", icon: ['fas', 'times'], size: "sm", onClick: onClearClick }) })), jsx("div", __assign({ className: "bsc-ml-2" }, { children: icon || (jsx(FontAwesomeIcon, { className: !readOnly ? 'bsc-cursor-pointer' : undefined, icon: ['far', 'calendar-alt'], onClick: !readOnly ? onCalendarClick : undefined })) }))] }))),
32681
+ rightElement: (jsxs("div", __assign({ className: "bsc-flex" }, { children: [allowClear && !readOnly && (jsx("div", { children: jsx(FontAwesomeIcon, { className: "bsc-cursor-pointer bsc-text-sm", icon: ['fas', 'times'], size: "sm", onClick: onClearClick }) })), jsx("div", __assign({ className: "bsc-ml-2" }, { children: icon || (jsx(FontAwesomeIcon, { className: !readOnly ? 'bsc-cursor-pointer' : undefined, icon: ['far', 'calendar-alt'], onClick: !readOnly ? onCalendarIconClick : undefined })) }))] }))),
32964
32682
  }
32965
32683
  : {
32966
- leftElement: (jsxs("div", __assign({ className: "bsc-flex" }, { children: [jsx("div", __assign({ className: "bsc-mr-2" }, { children: icon || (jsx(FontAwesomeIcon, { className: !readOnly ? 'bsc-cursor-pointer' : undefined, icon: ['far', 'calendar-alt'], onClick: !readOnly ? onCalendarClick : undefined })) })), allowClear && !readOnly && (jsx("div", { children: jsx(FontAwesomeIcon, { className: "bsc-cursor-pointer bsc-text-sm", icon: ['fas', 'times'], size: "sm", onClick: onClearClick }) }))] }))),
32684
+ leftElement: (jsxs("div", __assign({ className: "bsc-flex" }, { children: [jsx("div", __assign({ className: "bsc-mr-2" }, { children: icon || (jsx(FontAwesomeIcon, { className: !readOnly ? 'bsc-cursor-pointer' : undefined, icon: ['far', 'calendar-alt'], onClick: !readOnly ? onCalendarIconClick : undefined })) })), allowClear && !readOnly && (jsx("div", { children: jsx(FontAwesomeIcon, { className: "bsc-cursor-pointer bsc-text-sm", icon: ['fas', 'times'], size: "sm", onClick: onClearClick }) }))] }))),
32967
32685
  };
32968
32686
  var inputTemplateProps = {
32969
32687
  label: label,
@@ -32981,7 +32699,7 @@ function DateTime(_a) {
32981
32699
  _b["".concat((colors === null || colors === void 0 ? void 0 : colors.readOnlyInputBgColor) || 'bsc-bg-gray-200')] = readOnly,
32982
32700
  _b["".concat((colors === null || colors === void 0 ? void 0 : colors.inputBgColor) || 'bsc-bg-white')] = !readOnly,
32983
32701
  _b), "dark:bsc-bg-black ".concat(colors === null || colors === void 0 ? void 0 : colors.inputBorderColor, " bc-dt-input"), className);
32984
- return (jsx(DateTimeContext.Provider, __assign({ value: contextProps.current }, { children: jsxs("div", __assign({ className: "bc-date-time" }, { children: [label && jsx("label", __assign({ className: "dark:bsc-text-white bc-dt-label" }, { children: label })), jsx(TemplateOutlet, __assign({ props: inputTemplateProps, template: template }, { children: useFormattedInput === false || state.inputFormat === undefined ? (jsx(ContentEditableInput$1, __assign({ value: getValue(), readOnly: readOnly, className: inputStyles, onFocus: onFocus, onInput: onInput, onElementCreate: function (element) { return onInputElementCreated(element, false); } }, inputProps))) : (jsx(FormattedInput$1, __assign({ value: getValue(), readOnly: readOnly, className: inputStyles, onFocus: onFocus, onChange: onFormatStringChange, onElementCreate: function (element) { return onInputElementCreated(element, true); }, defaultFormat: state.inputFormat }, inputProps))) })), jsx(OverlayPanel, __assign({ visible: selectorOpen, target: dropDownTarget, shouldTargetCloseOverlay: false, shouldScrollCloseOverlay: true, shouldCheckZIndex: true, shouldRemainOnScreen: true, hidden: onDateTimeHidden, unmountWhenHidden: true }, { children: jsxs(Fragment, { children: [state.currentSelector === DateTimeActionType.DaySelector &&
32702
+ return (jsx(DateTimeContext.Provider, __assign({ value: contextProps.current }, { children: jsxs("div", __assign({ className: "bc-date-time" }, { children: [label && jsx("label", __assign({ className: "dark:bsc-text-white bc-dt-label" }, { children: label })), jsx(TemplateOutlet, __assign({ props: inputTemplateProps, template: template }, { children: useFormattedInput === false ? (jsx(ContentEditableInput$1, __assign({ value: getValue(), readOnly: readOnly, className: inputStyles, onFocus: onFocus, onBlur: onBlur, onInput: onInput, onElementCreate: function (element) { return onInputElementCreated(element, false); } }, inputProps))) : (jsx(FormattedInput$1, __assign({ value: getValue(), readOnly: readOnly, className: inputStyles, format: inputFormat, onFocus: onFocus, onBlur: onBlur, onChange: onFormatStringChange, onElementCreate: function (element) { return onInputElementCreated(element, true); } }, inputProps))) })), jsx(OverlayPanel, __assign({ visible: selectorOpen, target: dropDownTarget, shouldTargetCloseOverlay: false, shouldScrollCloseOverlay: true, shouldCheckZIndex: true, shouldRemainOnScreen: true, hidden: onDateTimeHidden, isClickedWithin: onCalendarClick, unmountWhenHidden: true }, { children: jsxs(Fragment, { children: [state.currentSelector === DateTimeActionType.DaySelector &&
32985
32703
  canShowDateSelectors &&
32986
32704
  state.dateInitialized &&
32987
32705
  loadedLocale.current && (jsx(DateTimeDaySelector, { selectedDate: state.selectedDate, viewDate: state.currentViewDate, locale: loadedLocale.current, showTimeSelector: dateSelection === DateSelectionType.DateTime, selectableDate: selectableDate, isValidDate: isValidDate, dispatcher: dispatcher, onChange: onChange })), state.currentSelector === DateTimeActionType.MonthSelector &&