@semcore/date-picker 4.56.0 → 16.0.0-prerelease.11

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 (94) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/lib/cjs/DatePicker.js +3 -4
  3. package/lib/cjs/DatePicker.js.map +1 -1
  4. package/lib/cjs/DateRangeComparator.js +2 -2
  5. package/lib/cjs/DateRangeComparator.js.map +1 -1
  6. package/lib/cjs/DateRangePicker.js +2 -2
  7. package/lib/cjs/DateRangePicker.js.map +1 -1
  8. package/lib/cjs/MonthDateRangeComparator.js +2 -2
  9. package/lib/cjs/MonthDateRangeComparator.js.map +1 -1
  10. package/lib/cjs/MonthPicker.js +2 -2
  11. package/lib/cjs/MonthPicker.js.map +1 -1
  12. package/lib/cjs/MonthRangePicker.js +2 -2
  13. package/lib/cjs/MonthRangePicker.js.map +1 -1
  14. package/lib/cjs/components/ButtonTrigger.js +3 -4
  15. package/lib/cjs/components/ButtonTrigger.js.map +1 -1
  16. package/lib/cjs/components/Calendar.js +27 -29
  17. package/lib/cjs/components/Calendar.js.map +1 -1
  18. package/lib/cjs/components/DateRangeComparatorAbstract.js +30 -31
  19. package/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
  20. package/lib/cjs/components/InputTrigger.js +35 -37
  21. package/lib/cjs/components/InputTrigger.js.map +1 -1
  22. package/lib/cjs/components/PickerAbstract.js +30 -31
  23. package/lib/cjs/components/PickerAbstract.js.map +1 -1
  24. package/lib/cjs/components/RangePickerAbstract.js +30 -31
  25. package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
  26. package/lib/cjs/components/index.js +1 -1
  27. package/lib/cjs/components/index.js.map +1 -1
  28. package/lib/cjs/index.d.js.map +1 -1
  29. package/lib/cjs/style/calendar.shadow.css +5 -1
  30. package/lib/es6/DatePicker.js +2 -2
  31. package/lib/es6/DatePicker.js.map +1 -1
  32. package/lib/es6/DateRangeComparator.js +1 -1
  33. package/lib/es6/DateRangeComparator.js.map +1 -1
  34. package/lib/es6/DateRangePicker.js +1 -1
  35. package/lib/es6/DateRangePicker.js.map +1 -1
  36. package/lib/es6/MonthDateRangeComparator.js +1 -1
  37. package/lib/es6/MonthDateRangeComparator.js.map +1 -1
  38. package/lib/es6/MonthPicker.js +1 -1
  39. package/lib/es6/MonthPicker.js.map +1 -1
  40. package/lib/es6/MonthRangePicker.js +1 -1
  41. package/lib/es6/MonthRangePicker.js.map +1 -1
  42. package/lib/es6/components/ButtonTrigger.js +2 -2
  43. package/lib/es6/components/ButtonTrigger.js.map +1 -1
  44. package/lib/es6/components/Calendar.js +25 -25
  45. package/lib/es6/components/Calendar.js.map +1 -1
  46. package/lib/es6/components/DateRangeComparatorAbstract.js +31 -31
  47. package/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
  48. package/lib/es6/components/InputTrigger.js +33 -33
  49. package/lib/es6/components/InputTrigger.js.map +1 -1
  50. package/lib/es6/components/PickerAbstract.js +31 -31
  51. package/lib/es6/components/PickerAbstract.js.map +1 -1
  52. package/lib/es6/components/RangePickerAbstract.js +31 -31
  53. package/lib/es6/components/RangePickerAbstract.js.map +1 -1
  54. package/lib/es6/components/index.js +1 -1
  55. package/lib/es6/components/index.js.map +1 -1
  56. package/lib/es6/index.d.js.map +1 -1
  57. package/lib/es6/style/calendar.shadow.css +5 -1
  58. package/lib/esm/DatePicker.mjs +114 -103
  59. package/lib/esm/DateRangeComparator.mjs +166 -149
  60. package/lib/esm/DateRangePicker.mjs +85 -77
  61. package/lib/esm/MonthDateRangeComparator.mjs +187 -169
  62. package/lib/esm/MonthPicker.mjs +78 -71
  63. package/lib/esm/MonthRangePicker.mjs +94 -85
  64. package/lib/esm/components/ButtonTrigger.mjs +16 -15
  65. package/lib/esm/components/Calendar.mjs +404 -286
  66. package/lib/esm/components/DateRangeComparatorAbstract.mjs +453 -329
  67. package/lib/esm/components/InputTrigger.mjs +757 -518
  68. package/lib/esm/components/PickerAbstract.mjs +191 -148
  69. package/lib/esm/components/RangePickerAbstract.mjs +305 -220
  70. package/lib/esm/components/index.mjs +127 -109
  71. package/lib/esm/index.mjs +13 -13
  72. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +32 -32
  73. package/lib/esm/translations/de.json.mjs +83 -56
  74. package/lib/esm/translations/en.json.mjs +95 -64
  75. package/lib/esm/translations/es.json.mjs +83 -56
  76. package/lib/esm/translations/fr.json.mjs +83 -56
  77. package/lib/esm/translations/it.json.mjs +83 -56
  78. package/lib/esm/translations/ja.json.mjs +83 -56
  79. package/lib/esm/translations/ko.json.mjs +83 -56
  80. package/lib/esm/translations/nl.json.mjs +83 -56
  81. package/lib/esm/translations/pl.json.mjs +83 -56
  82. package/lib/esm/translations/pt.json.mjs +83 -56
  83. package/lib/esm/translations/ru.json.mjs +35 -24
  84. package/lib/esm/translations/sv.json.mjs +83 -56
  85. package/lib/esm/translations/tr.json.mjs +83 -56
  86. package/lib/esm/translations/vi.json.mjs +83 -56
  87. package/lib/esm/translations/zh.json.mjs +83 -56
  88. package/lib/esm/utils/cronTabScheduler.mjs +58 -52
  89. package/lib/esm/utils/datesIntersects.mjs +15 -11
  90. package/lib/esm/utils/formatDate.mjs +25 -18
  91. package/lib/esm/utils/includesDate.mjs +13 -9
  92. package/lib/esm/utils/shortDateRangeFormat.mjs +53 -31
  93. package/lib/types/index.d.ts +1 -1
  94. package/package.json +15 -18
@@ -1,650 +1,889 @@
1
- import pa from "@babel/runtime/helpers/esm/extends";
2
- import G from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
3
- import ne from "@babel/runtime/helpers/esm/slicedToArray";
4
- import k from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import $ from "@babel/runtime/helpers/esm/objectSpread2";
6
- import Y from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
- import ye from "@babel/runtime/helpers/esm/classCallCheck";
8
- import Se from "@babel/runtime/helpers/esm/createClass";
9
- import Pe from "@babel/runtime/helpers/esm/inherits";
10
- import Ie from "@babel/runtime/helpers/esm/createSuper";
11
- import p from "@babel/runtime/helpers/esm/defineProperty";
12
- import { sstyled as ca } from "@semcore/utils/lib/core/index";
13
- import De, { sstyled as z, assignProps as O, Component as be } from "@semcore/core";
14
- import i from "react";
15
- import ga from "@semcore/base-trigger";
16
- import Q from "@semcore/input-mask";
17
- import Ke from "@semcore/tooltip";
18
- import { Flex as fa, Box as ma } from "@semcore/flex-box";
19
- import ha from "@semcore/icon/Calendar/m";
20
- import va from "@semcore/neighbor-location";
21
- import { datesIntersects as xa } from "../utils/datesIntersects.mjs";
22
- import { includesDate as he } from "../utils/includesDate.mjs";
23
- import ve from "dayjs";
24
- import Ne from "@semcore/utils/lib/use/useEnhancedEffect";
25
- import Oe from "@semcore/utils/lib/assignProps";
26
- var ya = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], Sa = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], Pa = ["value", "onChange", "onDisplayedPeriodChange", "locale", "w", "ariaHasPopup", "showError"], Ia = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "showError"], Da = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "inputId", "showError"], ba = ["date", "onDateChange", "onDisplayedPeriodChange", "locale", "styles", "parts", "disabledDates", "forwardRef", "placeholders", "labelPrefix", "onMaskPipeBlock", "containerFocused", "animationsDisabled", "getI18nText", "inputId", "inputRole", "__excludeProps", "Root"], Re = (
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
8
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
9
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
10
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
11
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
12
+ import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
13
+ import React from "react";
14
+ import BaseTrigger from "@semcore/base-trigger";
15
+ import InputMask from "@semcore/input-mask";
16
+ import Tooltip from "@semcore/tooltip";
17
+ import { Flex, Box } from "@semcore/flex-box";
18
+ import Calendar from "@semcore/icon/Calendar/m";
19
+ import NeighborLocation from "@semcore/neighbor-location";
20
+ import { datesIntersects } from "../utils/datesIntersects.mjs";
21
+ import { includesDate } from "../utils/includesDate.mjs";
22
+ import dayjs from "dayjs";
23
+ import useEnhancedEffect from "@semcore/core/lib/utils/use/useEnhancedEffect";
24
+ import assignProps$1 from "@semcore/core/lib/utils/assignProps";
25
+ var _excluded = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], _excluded2 = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], _excluded3 = ["value", "onChange", "onDisplayedPeriodChange", "locale", "w", "ariaHasPopup", "showError"], _excluded4 = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "showError"], _excluded5 = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "inputId", "showError"], _excluded6 = ["date", "onDateChange", "onDisplayedPeriodChange", "locale", "styles", "parts", "disabledDates", "forwardRef", "placeholders", "labelPrefix", "onMaskPipeBlock", "containerFocused", "animationsDisabled", "getI18nText", "inputId", "inputRole", "__excludeProps", "Root"];
26
+ var style = (
27
27
  /*__reshadow_css_start__*/
28
- (ca.insert(
28
+ (sstyled.insert(
29
29
  /*__inner_css_start__*/
30
- ".___SPopper_1mx7u_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_1mx7u_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_1mx7u_gg_:active,.___SPopper_1mx7u_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_1mx7u_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SPopper_1mx7u_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SHeader_1mx7u_gg_,.___STitle_1mx7u_gg_{display:flex;align-items:center}.___STitle_1mx7u_gg_{font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-primary, #191b23);height:32px;width:100%;justify-content:center}.___SToday_1mx7u_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_1mx7u_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_1mx7u_gg_ .___SInner_1mx7u_gg_{justify-content:flex-start}.___SInputMask_1mx7u_gg_{color:var(--intergalactic-text-primary, #191b23);line-height:normal;padding-right:var(--intergalactic-spacing-2x, 8px);transition:width calc(var(--intergalactic-duration-medium, 300)*1ms) ease,min-width calc(var(--intergalactic-duration-medium, 300)*1ms) ease}.___SInputMask_1mx7u_gg_.__animationsDisabled_1mx7u_gg_{transition:none}.___SInputMask_1mx7u_gg_ .___SValue_1mx7u_gg_{letter-spacing:0}.___SIndicator_1mx7u_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}.___SRangeIndicator_1mx7u_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_1mx7u_gg_._range_value_1mx7u_gg_{background-color:var(--intergalactic-date-picker-cell-active, #2bb3ff)}.___SRangeIndicator_1mx7u_gg_._range_compare_1mx7u_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, #8649e1)}.___SRangeIndicator_1mx7u_gg_.__disabled_1mx7u_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SHumanizedDate_1mx7u_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_1mx7u_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_1mx7u_gg_ .___SMask_1mx7u_gg_,.___SDateRange_1mx7u_gg_ .___SValue_1mx7u_gg_,.___SSingleDateInput_1mx7u_gg_ .___SMask_1mx7u_gg_,.___SSingleDateInput_1mx7u_gg_ .___SValue_1mx7u_gg_{opacity:0}.___SSingleDateInput_1mx7u_gg_:focus-within .___SHumanizedDate_1mx7u_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_1mx7u_gg_:focus-within .___SMask_1mx7u_gg_,.___SSingleDateInput_1mx7u_gg_:focus-within .___SValue_1mx7u_gg_{opacity:1}.___SDateRange_1mx7u_gg_:focus-within .___SHumanizedDate_1mx7u_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_1mx7u_gg_:focus-within .___SMask_1mx7u_gg_,.___SDateRange_1mx7u_gg_:focus-within .___SValue_1mx7u_gg_{opacity:1}.___SInputMask_1mx7u_gg_.__noHumanizedDate_1mx7u_gg_ .___SMask_1mx7u_gg_,.___SInputMask_1mx7u_gg_.__noHumanizedDate_1mx7u_gg_ .___SValue_1mx7u_gg_{opacity:1}.___SDateRange_1mx7u_gg_ .___SInputMask_1mx7u_gg_:focus-within .___SMask_1mx7u_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgba(0, 143, 248, 0.2))}.___SDateRange_1mx7u_gg_:focus-within .___SRangeSep_1mx7u_gg_,.___SRangeSep_1mx7u_gg_.__fulfilled_1mx7u_gg_{color:var(--intergalactic-text-primary, #191b23)}.___SRangeComparatorHeader_1mx7u_gg_{border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SRangeCalendar_1mx7u_gg_,.___SRangeComparatorHeader_1mx7u_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_1mx7u_gg_{border-top:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SFooter_1mx7u_gg_,.___SPeriodsList_1mx7u_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_1mx7u_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_1mx7u_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_1mx7u_gg_{transition:none}}",
31
- "1mx7u_gg_"
30
+ ".___SPopper_1plgq_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_1plgq_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_1plgq_gg_:active,.___SPopper_1plgq_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_1plgq_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SPopper_1plgq_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SHeader_1plgq_gg_,.___STitle_1plgq_gg_{display:flex;align-items:center}.___STitle_1plgq_gg_{font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-primary, #191b23);height:32px;width:100%;justify-content:center}.___SToday_1plgq_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_1plgq_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_1plgq_gg_ .___SInner_1plgq_gg_{justify-content:flex-start}.___SInputMask_1plgq_gg_{color:var(--intergalactic-text-primary, #191b23);line-height:normal;padding-right:var(--intergalactic-spacing-2x, 8px);transition:width calc(var(--intergalactic-duration-medium, 300)*1ms) ease,min-width calc(var(--intergalactic-duration-medium, 300)*1ms) ease}.___SInputMask_1plgq_gg_.__animationsDisabled_1plgq_gg_{transition:none}.___SInputMask_1plgq_gg_ .___SValue_1plgq_gg_{letter-spacing:0}.___SIndicator_1plgq_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}.___SRangeIndicator_1plgq_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_1plgq_gg_._range_value_1plgq_gg_{background-color:var(--intergalactic-date-picker-cell-active, #2bb3ff)}.___SRangeIndicator_1plgq_gg_._range_compare_1plgq_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, #8649e1)}.___SRangeIndicator_1plgq_gg_.__disabled_1plgq_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SHumanizedDate_1plgq_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_1plgq_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_1plgq_gg_ .___SMask_1plgq_gg_,.___SDateRange_1plgq_gg_ .___SValue_1plgq_gg_,.___SSingleDateInput_1plgq_gg_ .___SMask_1plgq_gg_,.___SSingleDateInput_1plgq_gg_ .___SValue_1plgq_gg_{opacity:0}.___SSingleDateInput_1plgq_gg_:focus-within .___SHumanizedDate_1plgq_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_1plgq_gg_:focus-within .___SMask_1plgq_gg_,.___SSingleDateInput_1plgq_gg_:focus-within .___SValue_1plgq_gg_{opacity:1}.___SDateRange_1plgq_gg_:focus-within .___SHumanizedDate_1plgq_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_1plgq_gg_:focus-within .___SMask_1plgq_gg_,.___SDateRange_1plgq_gg_:focus-within .___SValue_1plgq_gg_{opacity:1}.___SInputMask_1plgq_gg_.__noHumanizedDate_1plgq_gg_ .___SMask_1plgq_gg_,.___SInputMask_1plgq_gg_.__noHumanizedDate_1plgq_gg_ .___SValue_1plgq_gg_{opacity:1}.___SDateRange_1plgq_gg_ .___SInputMask_1plgq_gg_:focus-within .___SMask_1plgq_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgba(0, 143, 248, 0.2))}.___SDateRange_1plgq_gg_:focus-within .___SRangeSep_1plgq_gg_,.___SRangeSep_1plgq_gg_.__fulfilled_1plgq_gg_{color:var(--intergalactic-text-primary, #191b23)}.___SRangeComparatorHeader_1plgq_gg_{border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SRangeCalendar_1plgq_gg_,.___SRangeComparatorHeader_1plgq_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_1plgq_gg_{border-top:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SFooter_1plgq_gg_,.___SPeriodsList_1plgq_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_1plgq_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_1plgq_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_1plgq_gg_{transition:none}}",
31
+ "1plgq_gg_"
32
32
  ), {
33
- __SHeader: "___SHeader_1mx7u_gg_",
34
- __STitle: "___STitle_1mx7u_gg_",
35
- __SToday: "___SToday_1mx7u_gg_",
36
- __SPeriod: "___SPeriod_1mx7u_gg_",
37
- __SButton: "___SButton_1mx7u_gg_",
38
- __SInner: "___SInner_1mx7u_gg_",
39
- __SInputMask: "___SInputMask_1mx7u_gg_",
40
- _animationsDisabled: "__animationsDisabled_1mx7u_gg_",
41
- __SValue: "___SValue_1mx7u_gg_",
42
- __SIndicator: "___SIndicator_1mx7u_gg_",
43
- __SRangeIndicator: "___SRangeIndicator_1mx7u_gg_",
44
- _range_value: "_range_value_1mx7u_gg_",
45
- _range_compare: "_range_compare_1mx7u_gg_",
46
- _disabled: "__disabled_1mx7u_gg_",
47
- __SHumanizedDate: "___SHumanizedDate_1mx7u_gg_",
48
- __SMask: "___SMask_1mx7u_gg_",
49
- __SSingleDateInput: "___SSingleDateInput_1mx7u_gg_",
50
- __SDateRange: "___SDateRange_1mx7u_gg_",
51
- _noHumanizedDate: "__noHumanizedDate_1mx7u_gg_",
52
- __SRangeSep: "___SRangeSep_1mx7u_gg_",
53
- _fulfilled: "__fulfilled_1mx7u_gg_",
54
- __SRangeComparatorHeader: "___SRangeComparatorHeader_1mx7u_gg_",
55
- __SRangeCalendar: "___SRangeCalendar_1mx7u_gg_",
56
- __SFooter: "___SFooter_1mx7u_gg_",
57
- __SPeriodsList: "___SPeriodsList_1mx7u_gg_",
58
- __STooltip: "___STooltip_1mx7u_gg_",
59
- __SCompareToggle: "___SCompareToggle_1mx7u_gg_",
60
- __SPopper: "___SPopper_1mx7u_gg_"
33
+ "__SHeader": "___SHeader_1plgq_gg_",
34
+ "__STitle": "___STitle_1plgq_gg_",
35
+ "__SToday": "___SToday_1plgq_gg_",
36
+ "__SPeriod": "___SPeriod_1plgq_gg_",
37
+ "__SButton": "___SButton_1plgq_gg_",
38
+ "__SInner": "___SInner_1plgq_gg_",
39
+ "__SInputMask": "___SInputMask_1plgq_gg_",
40
+ "_animationsDisabled": "__animationsDisabled_1plgq_gg_",
41
+ "__SValue": "___SValue_1plgq_gg_",
42
+ "__SIndicator": "___SIndicator_1plgq_gg_",
43
+ "__SRangeIndicator": "___SRangeIndicator_1plgq_gg_",
44
+ "_range_value": "_range_value_1plgq_gg_",
45
+ "_range_compare": "_range_compare_1plgq_gg_",
46
+ "_disabled": "__disabled_1plgq_gg_",
47
+ "__SHumanizedDate": "___SHumanizedDate_1plgq_gg_",
48
+ "__SMask": "___SMask_1plgq_gg_",
49
+ "__SSingleDateInput": "___SSingleDateInput_1plgq_gg_",
50
+ "__SDateRange": "___SDateRange_1plgq_gg_",
51
+ "_noHumanizedDate": "__noHumanizedDate_1plgq_gg_",
52
+ "__SRangeSep": "___SRangeSep_1plgq_gg_",
53
+ "_fulfilled": "__fulfilled_1plgq_gg_",
54
+ "__SRangeComparatorHeader": "___SRangeComparatorHeader_1plgq_gg_",
55
+ "__SRangeCalendar": "___SRangeCalendar_1plgq_gg_",
56
+ "__SFooter": "___SFooter_1plgq_gg_",
57
+ "__SPeriodsList": "___SPeriodsList_1plgq_gg_",
58
+ "__STooltip": "___STooltip_1plgq_gg_",
59
+ "__SCompareToggle": "___SCompareToggle_1plgq_gg_",
60
+ "__SPopper": "___SPopper_1plgq_gg_"
61
61
  })
62
- ), Ra = {
63
- year: !0,
64
- month: !0,
65
- day: !0
66
- }, wa = new Date(2e3, 4, 29), oe = /* @__PURE__ */ function(M) {
67
- Pe(g, M);
68
- var _ = Ie(g);
69
- function g() {
70
- return ye(this, g), _.apply(this, arguments);
62
+ );
63
+ var defaultAllowedParts = {
64
+ year: true,
65
+ month: true,
66
+ day: true
67
+ };
68
+ var exampleDate = new Date(2e3, 4, 29);
69
+ var InputTriggerRoot = /* @__PURE__ */ function(_Component) {
70
+ _inherits(InputTriggerRoot2, _Component);
71
+ var _super = _createSuper(InputTriggerRoot2);
72
+ function InputTriggerRoot2() {
73
+ _classCallCheck(this, InputTriggerRoot2);
74
+ return _super.apply(this, arguments);
71
75
  }
72
- return Se(g, [{
76
+ _createClass(InputTriggerRoot2, [{
73
77
  key: "getSingleDateInputProps",
74
- value: function() {
75
- var a = this.asProps;
76
- a.children;
77
- var s = a.id;
78
- a.role;
79
- var o = a["aria-haspopup"];
80
- a["aria-label"], a.style;
81
- var r = Y(a, ya);
82
- return $($({}, r), {}, {
83
- ariaHasPopup: o,
84
- inputId: s
78
+ value: function getSingleDateInputProps() {
79
+ var _this$asProps = this.asProps;
80
+ _this$asProps.children;
81
+ var id = _this$asProps.id;
82
+ _this$asProps.role;
83
+ var ariaHasPopup = _this$asProps["aria-haspopup"];
84
+ _this$asProps["aria-label"];
85
+ _this$asProps.style;
86
+ var otherProps = _objectWithoutProperties(_this$asProps, _excluded);
87
+ return _objectSpread(_objectSpread({}, otherProps), {}, {
88
+ ariaHasPopup,
89
+ inputId: id
85
90
  });
86
91
  }
87
92
  }, {
88
93
  key: "getDateRangeProps",
89
- value: function() {
90
- var a = this.asProps;
91
- a.children;
92
- var s = a.id;
93
- a.role;
94
- var o = a["aria-haspopup"];
95
- a["aria-label"], a.style;
96
- var r = Y(a, Sa);
97
- return $($({}, r), {}, {
98
- ariaHasPopup: o,
99
- inputId: s
94
+ value: function getDateRangeProps() {
95
+ var _this$asProps2 = this.asProps;
96
+ _this$asProps2.children;
97
+ var id = _this$asProps2.id;
98
+ _this$asProps2.role;
99
+ var ariaHasPopup = _this$asProps2["aria-haspopup"];
100
+ _this$asProps2["aria-label"];
101
+ _this$asProps2.style;
102
+ var otherProps = _objectWithoutProperties(_this$asProps2, _excluded2);
103
+ return _objectSpread(_objectSpread({}, otherProps), {}, {
104
+ ariaHasPopup,
105
+ inputId: id
100
106
  });
101
107
  }
102
108
  }, {
103
109
  key: "render",
104
- value: function() {
105
- var a = this.asProps, s, o = ma, r = this.asProps, d = r.Children, n = r.style, f = r.getI18nText;
106
- return s = z(n), /* @__PURE__ */ i.createElement(o, s.cn("SInputTrigger", $({}, O({
107
- "aria-label": f("input"),
108
- __excludeProps: ["onChange", "value", "role", "id"]
109
- }, a))), /* @__PURE__ */ i.createElement(d, s.cn("Children", {})));
110
- }
111
- }]), g;
112
- }(be);
113
- p(oe, "displayName", "InputTrigger");
114
- p(oe, "style", Re);
115
- p(oe, "defaultProps", {
110
+ value: function render() {
111
+ var _ref = this.asProps, _ref8;
112
+ var SInputTrigger = Box;
113
+ var _this$asProps3 = this.asProps, Children = _this$asProps3.Children, style2 = _this$asProps3.style, getI18nText = _this$asProps3.getI18nText;
114
+ return _ref8 = sstyled(style2), /* @__PURE__ */ React.createElement(SInputTrigger, _ref8.cn("SInputTrigger", _objectSpread({}, assignProps({
115
+ "aria-label": getI18nText("input"),
116
+ "__excludeProps": ["onChange", "value", "role", "id"]
117
+ }, _ref))), /* @__PURE__ */ React.createElement(Children, _ref8.cn("Children", {})));
118
+ }
119
+ }]);
120
+ return InputTriggerRoot2;
121
+ }(Component);
122
+ _defineProperty(InputTriggerRoot, "displayName", "InputTrigger");
123
+ _defineProperty(InputTriggerRoot, "style", style);
124
+ _defineProperty(InputTriggerRoot, "defaultProps", {
116
125
  duration: 300,
117
- popoverVisible: !0
126
+ popoverVisible: true
118
127
  });
119
- var ie = /* @__PURE__ */ function(M) {
120
- Pe(g, M);
121
- var _ = Ie(g);
122
- function g() {
123
- var e;
124
- ye(this, g);
125
- for (var a = arguments.length, s = new Array(a), o = 0; o < a; o++)
126
- s[o] = arguments[o];
127
- return e = _.call.apply(_, [this].concat(s)), p(k(e), "state", {
128
+ var SingleDateInputRoot = /* @__PURE__ */ function(_Component2) {
129
+ _inherits(SingleDateInputRoot2, _Component2);
130
+ var _super2 = _createSuper(SingleDateInputRoot2);
131
+ function SingleDateInputRoot2() {
132
+ var _this;
133
+ _classCallCheck(this, SingleDateInputRoot2);
134
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
135
+ args[_key] = arguments[_key];
136
+ }
137
+ _this = _super2.call.apply(_super2, [this].concat(args));
138
+ _defineProperty(_assertThisInitialized(_this), "state", {
128
139
  errorText: null,
129
- showError: !1,
130
- focused: !1
131
- }), p(k(e), "handleFocus", function() {
132
- e.setState({
133
- focused: !0
140
+ showError: false,
141
+ focused: false
142
+ });
143
+ _defineProperty(_assertThisInitialized(_this), "handleFocus", function() {
144
+ _this.setState({
145
+ focused: true
134
146
  });
135
- }), p(k(e), "handleBlur", function() {
136
- e.setState({
137
- focused: !1
147
+ });
148
+ _defineProperty(_assertThisInitialized(_this), "handleBlur", function() {
149
+ _this.setState({
150
+ focused: false
138
151
  });
139
- }), p(k(e), "handleInputMaskPipeBlock", function(r) {
140
- r !== e.asProps.disabledDateInputAttempt && e.handlers.disabledDateInputAttempt(r);
141
- }), e;
152
+ });
153
+ _defineProperty(_assertThisInitialized(_this), "handleInputMaskPipeBlock", function(value) {
154
+ if (value === _this.asProps.disabledDateInputAttempt) return;
155
+ _this.handlers.disabledDateInputAttempt(value);
156
+ });
157
+ return _this;
142
158
  }
143
- return Se(g, [{
159
+ _createClass(SingleDateInputRoot2, [{
144
160
  key: "uncontrolledProps",
145
- value: function() {
146
- var a = this;
161
+ value: function uncontrolledProps() {
162
+ var _this2 = this;
147
163
  return {
148
- disabledDateInputAttempt: [null, function(s) {
149
- var o = a.state.errorText, r = !1;
150
- if (s !== null) {
151
- if (o = a.asProps.disabledErrorText, o === void 0) {
152
- var d = "unavailableDate";
153
- a.asProps.parts && !a.asProps.parts.day && (d = "unavailableMonth"), o = a.asProps.getI18nText(d);
164
+ disabledDateInputAttempt: [null, function(date) {
165
+ var errorText = _this2.state.errorText;
166
+ var showError = false;
167
+ if (date !== null) {
168
+ errorText = _this2.asProps.disabledErrorText;
169
+ if (errorText === void 0) {
170
+ var key = "unavailableDate";
171
+ if (_this2.asProps.parts && !_this2.asProps.parts.day) {
172
+ key = "unavailableMonth";
173
+ }
174
+ errorText = _this2.asProps.getI18nText(key);
175
+ }
176
+ if (typeof errorText === "function") {
177
+ errorText = errorText(date);
154
178
  }
155
- typeof o == "function" && (o = o(s)), r = a.asProps.disabledErrorText !== null;
179
+ showError = _this2.asProps.disabledErrorText !== null;
156
180
  }
157
- a.setState({
158
- errorText: o,
159
- showError: r
181
+ _this2.setState({
182
+ errorText,
183
+ showError
160
184
  });
161
185
  }]
162
186
  };
163
187
  }
164
188
  }, {
165
189
  key: "getMaskedInputProps",
166
- value: function() {
167
- var a = this.asProps, s = a.value, o = a.onChange, r = a.onDisplayedPeriodChange, d = a.locale;
168
- a.w, a.ariaHasPopup, a.showError;
169
- var n = Y(a, Pa);
170
- return $({
171
- date: s,
172
- onDateChange: o,
173
- onDisplayedPeriodChange: r,
174
- locale: d,
190
+ value: function getMaskedInputProps() {
191
+ var _this$asProps4 = this.asProps, value = _this$asProps4.value, onChange = _this$asProps4.onChange, onDisplayedPeriodChange = _this$asProps4.onDisplayedPeriodChange, locale = _this$asProps4.locale;
192
+ _this$asProps4.w;
193
+ _this$asProps4.ariaHasPopup;
194
+ _this$asProps4.showError;
195
+ var otherProps = _objectWithoutProperties(_this$asProps4, _excluded3);
196
+ return _objectSpread({
197
+ date: value,
198
+ onDateChange: onChange,
199
+ onDisplayedPeriodChange,
200
+ locale,
175
201
  "aria-haspopup": "true",
176
202
  onMaskPipeBlock: this.handleInputMaskPipeBlock
177
- }, n);
203
+ }, otherProps);
178
204
  }
179
205
  }, {
180
206
  key: "render",
181
- value: function() {
182
- var a = this.asProps, s, o = this.asProps, r = o.Children, d = o.forwardRef, n = o.styles, f = o.state, D = o.showError, b = o.popoverVisible, E = this.state, F = E.errorText, S = E.showError, j = E.focused, K = S && D, V = Q;
183
- return s = z(n), /* @__PURE__ */ i.createElement(V, s.cn("SSingleDateInput", $({}, O({
184
- tag: Ke,
185
- placement: "top-start",
186
- title: F,
187
- theme: "warning",
188
- visible: K && (b || j),
189
- state: K ? "invalid" : f,
190
- ref: d,
191
- onFocus: this.handleFocus,
192
- onBlur: this.handleBlur,
193
- __excludeProps: ["onChange", "style", "aria-expanded"]
194
- }, a))), /* @__PURE__ */ i.createElement(va, s.cn("NeighborLocation", {}), /* @__PURE__ */ i.createElement(r, s.cn("Children", {}))));
195
- }
196
- }]), g;
197
- }(be);
198
- p(ie, "displayName", "SingleDateInput");
199
- p(ie, "style", Re);
200
- p(ie, "defaultProps", {
201
- children: function() {
202
- return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(xe.Indicator, null), /* @__PURE__ */ i.createElement(xe.MaskedInput, null));
207
+ value: function render() {
208
+ var _ref2 = this.asProps, _ref9;
209
+ var _this$asProps5 = this.asProps, Children = _this$asProps5.Children, forwardRef = _this$asProps5.forwardRef, styles = _this$asProps5.styles, state = _this$asProps5.state, showErrorProps = _this$asProps5.showError, popoverVisible = _this$asProps5.popoverVisible;
210
+ var _this$state = this.state, errorText = _this$state.errorText, showErrorState = _this$state.showError, focused = _this$state.focused;
211
+ var showError = showErrorState && showErrorProps;
212
+ var SSingleDateInput = InputMask;
213
+ return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SSingleDateInput, _ref9.cn("SSingleDateInput", _objectSpread({}, assignProps({
214
+ "tag": Tooltip,
215
+ "placement": "top-start",
216
+ "title": errorText,
217
+ "theme": "warning",
218
+ "visible": showError && (popoverVisible || focused),
219
+ "state": showError ? "invalid" : state,
220
+ "ref": forwardRef,
221
+ "onFocus": this.handleFocus,
222
+ "onBlur": this.handleBlur,
223
+ "__excludeProps": ["onChange", "style", "aria-expanded"]
224
+ }, _ref2))), /* @__PURE__ */ React.createElement(NeighborLocation, _ref9.cn("NeighborLocation", {}), /* @__PURE__ */ React.createElement(Children, _ref9.cn("Children", {}))));
225
+ }
226
+ }]);
227
+ return SingleDateInputRoot2;
228
+ }(Component);
229
+ _defineProperty(SingleDateInputRoot, "displayName", "SingleDateInput");
230
+ _defineProperty(SingleDateInputRoot, "style", style);
231
+ _defineProperty(SingleDateInputRoot, "defaultProps", {
232
+ children: function children() {
233
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SingleDateInput.Indicator, null), /* @__PURE__ */ React.createElement(SingleDateInput.MaskedInput, null));
203
234
  },
204
- defaultDisabledDateInputAttempt: !1,
205
- showError: !0
235
+ defaultDisabledDateInputAttempt: false,
236
+ showError: true
206
237
  });
207
- var se = /* @__PURE__ */ function(M) {
208
- Pe(g, M);
209
- var _ = Ie(g);
210
- function g() {
211
- var e;
212
- ye(this, g);
213
- for (var a = arguments.length, s = new Array(a), o = 0; o < a; o++)
214
- s[o] = arguments[o];
215
- return e = _.call.apply(_, [this].concat(s)), p(k(e), "state", {
216
- containerFocused: !1,
238
+ var DateRangeRoot = /* @__PURE__ */ function(_Component3) {
239
+ _inherits(DateRangeRoot2, _Component3);
240
+ var _super3 = _createSuper(DateRangeRoot2);
241
+ function DateRangeRoot2() {
242
+ var _this3;
243
+ _classCallCheck(this, DateRangeRoot2);
244
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
245
+ args[_key2] = arguments[_key2];
246
+ }
247
+ _this3 = _super3.call.apply(_super3, [this].concat(args));
248
+ _defineProperty(_assertThisInitialized(_this3), "state", {
249
+ containerFocused: false,
217
250
  errorText: null,
218
- showError: !1,
251
+ showError: false,
219
252
  lastChangedInput: "from"
220
- }), p(k(e), "fromRef", /* @__PURE__ */ i.createRef()), p(k(e), "toRef", /* @__PURE__ */ i.createRef()), p(k(e), "handleFromChange", function(r, d) {
221
- var n, f, D, b, E = e.asProps.onChange, F = [(n = (f = e.asProps.value) === null || f === void 0 ? void 0 : f[0]) !== null && n !== void 0 ? n : null, (D = (b = e.asProps.value) === null || b === void 0 ? void 0 : b[1]) !== null && D !== void 0 ? D : null];
222
- if (E([r, F[1]], d), r) {
223
- if (!e.toRef.current) return;
224
- e.toRef.current.focus(), setTimeout(function() {
225
- e.toRef.current && e.toRef.current.setSelectionRange(0, 0);
253
+ });
254
+ _defineProperty(_assertThisInitialized(_this3), "fromRef", /* @__PURE__ */ React.createRef());
255
+ _defineProperty(_assertThisInitialized(_this3), "toRef", /* @__PURE__ */ React.createRef());
256
+ _defineProperty(_assertThisInitialized(_this3), "handleFromChange", function(value, event) {
257
+ var _this3$asProps$value$, _this3$asProps$value, _this3$asProps$value$2, _this3$asProps$value2;
258
+ var onChange = _this3.asProps.onChange;
259
+ var prevValue = [(_this3$asProps$value$ = (_this3$asProps$value = _this3.asProps.value) === null || _this3$asProps$value === void 0 ? void 0 : _this3$asProps$value[0]) !== null && _this3$asProps$value$ !== void 0 ? _this3$asProps$value$ : null, (_this3$asProps$value$2 = (_this3$asProps$value2 = _this3.asProps.value) === null || _this3$asProps$value2 === void 0 ? void 0 : _this3$asProps$value2[1]) !== null && _this3$asProps$value$2 !== void 0 ? _this3$asProps$value$2 : null];
260
+ onChange([value, prevValue[1]], event);
261
+ if (value) {
262
+ if (!_this3.toRef.current) return;
263
+ _this3.toRef.current.focus();
264
+ setTimeout(function() {
265
+ if (!_this3.toRef.current) return;
266
+ _this3.toRef.current.setSelectionRange(0, 0);
226
267
  }, 0);
227
268
  }
228
- }), p(k(e), "handleToChange", function(r, d) {
229
- var n, f, D, b, E = e.asProps.onChange, F = [(n = (f = e.asProps.value) === null || f === void 0 ? void 0 : f[0]) !== null && n !== void 0 ? n : null, (D = (b = e.asProps.value) === null || b === void 0 ? void 0 : b[1]) !== null && D !== void 0 ? D : null];
230
- E([F[0], r], d);
231
- }), p(k(e), "handleFromKeydown", function(r) {
232
- e.toRef.current && e.fromRef.current && (e.setState({
269
+ });
270
+ _defineProperty(_assertThisInitialized(_this3), "handleToChange", function(value, event) {
271
+ var _this3$asProps$value$3, _this3$asProps$value3, _this3$asProps$value$4, _this3$asProps$value4;
272
+ var onChange = _this3.asProps.onChange;
273
+ var prevValue = [(_this3$asProps$value$3 = (_this3$asProps$value3 = _this3.asProps.value) === null || _this3$asProps$value3 === void 0 ? void 0 : _this3$asProps$value3[0]) !== null && _this3$asProps$value$3 !== void 0 ? _this3$asProps$value$3 : null, (_this3$asProps$value$4 = (_this3$asProps$value4 = _this3.asProps.value) === null || _this3$asProps$value4 === void 0 ? void 0 : _this3$asProps$value4[1]) !== null && _this3$asProps$value$4 !== void 0 ? _this3$asProps$value$4 : null];
274
+ onChange([prevValue[0], value], event);
275
+ });
276
+ _defineProperty(_assertThisInitialized(_this3), "handleFromKeydown", function(event) {
277
+ if (!_this3.toRef.current) return;
278
+ if (!_this3.fromRef.current) return;
279
+ _this3.setState({
233
280
  lastChangedInput: "from"
234
- }), r.key === "ArrowRight" && e.fromRef.current.selectionStart === e.fromRef.current.value.length && e.fromRef.current.selectionEnd === e.fromRef.current.value.length && (e.toRef.current.focus(), setTimeout(function() {
235
- e.toRef.current.setSelectionRange(0, 0);
236
- }, 0)));
237
- }), p(k(e), "handleToKeydown", function(r) {
238
- if (e.toRef.current && e.fromRef.current) {
239
- if (e.setState({
240
- lastChangedInput: "to"
241
- }), r.key === "Backspace" && !e.toRef.current.value) {
242
- var d = e.fromRef.current.value;
243
- e.fromRef.current.focus(), setTimeout(function() {
244
- e.fromRef.current.setSelectionRange(d.length, d.length);
245
- }, 0);
246
- }
247
- if (r.key === "ArrowLeft" && e.toRef.current.selectionStart === 0 && e.toRef.current.selectionEnd === 0) {
248
- var n = e.fromRef.current.value;
249
- e.fromRef.current.focus(), setTimeout(function() {
250
- e.fromRef.current.setSelectionRange(n.length, n.length);
251
- }, 0);
252
- }
281
+ });
282
+ if (event.key === "ArrowRight" && _this3.fromRef.current.selectionStart === _this3.fromRef.current.value.length && _this3.fromRef.current.selectionEnd === _this3.fromRef.current.value.length) {
283
+ _this3.toRef.current.focus();
284
+ setTimeout(function() {
285
+ _this3.toRef.current.setSelectionRange(0, 0);
286
+ }, 0);
253
287
  }
254
- }), p(k(e), "handleInputMaskPipeBlock", function(r) {
255
- r !== e.asProps.disabledDateInputAttempt && e.handlers.disabledDateInputAttempt(r);
256
- }), p(k(e), "handleFocus", function() {
257
- e.setState({
258
- containerFocused: !0
288
+ });
289
+ _defineProperty(_assertThisInitialized(_this3), "handleToKeydown", function(event) {
290
+ if (!_this3.toRef.current) return;
291
+ if (!_this3.fromRef.current) return;
292
+ _this3.setState({
293
+ lastChangedInput: "to"
259
294
  });
260
- }), p(k(e), "handleBlur", function() {
261
- e.setState({
262
- containerFocused: !1
295
+ if (event.key === "Backspace" && !_this3.toRef.current.value) {
296
+ var value = _this3.fromRef.current.value;
297
+ _this3.fromRef.current.focus();
298
+ setTimeout(function() {
299
+ _this3.fromRef.current.setSelectionRange(value.length, value.length);
300
+ }, 0);
301
+ }
302
+ if (event.key === "ArrowLeft" && _this3.toRef.current.selectionStart === 0 && _this3.toRef.current.selectionEnd === 0) {
303
+ var _value = _this3.fromRef.current.value;
304
+ _this3.fromRef.current.focus();
305
+ setTimeout(function() {
306
+ _this3.fromRef.current.setSelectionRange(_value.length, _value.length);
307
+ }, 0);
308
+ }
309
+ });
310
+ _defineProperty(_assertThisInitialized(_this3), "handleInputMaskPipeBlock", function(value) {
311
+ if (value === _this3.asProps.disabledDateInputAttempt) return;
312
+ _this3.handlers.disabledDateInputAttempt(value);
313
+ });
314
+ _defineProperty(_assertThisInitialized(_this3), "handleFocus", function() {
315
+ _this3.setState({
316
+ containerFocused: true
317
+ });
318
+ });
319
+ _defineProperty(_assertThisInitialized(_this3), "handleBlur", function() {
320
+ _this3.setState({
321
+ containerFocused: false
263
322
  });
264
- }), p(k(e), "updateDisabledDateInputAttempt", function(r) {
265
- var d = e.asProps.disabledDates, n = !1;
266
- if (r && (r[0] && r[1] ? n = d.some(xa([r[0], r[1]], e.asProps.unit)) : r[0] ? n = d.some(he(ve(r[0]), e.asProps.unit)) : r[1] && (n = d.some(he(ve(r[1]), e.asProps.unit)))), n) {
267
- var f = e.state.lastChangedInput === "to" ? r[1] : r[0];
323
+ });
324
+ _defineProperty(_assertThisInitialized(_this3), "updateDisabledDateInputAttempt", function(value) {
325
+ var disabledDates = _this3.asProps.disabledDates;
326
+ var invalid = false;
327
+ if (value) {
328
+ if (value[0] && value[1]) invalid = disabledDates.some(datesIntersects([value[0], value[1]], _this3.asProps.unit));
329
+ else if (value[0]) invalid = disabledDates.some(includesDate(dayjs(value[0]), _this3.asProps.unit));
330
+ else if (value[1]) invalid = disabledDates.some(includesDate(dayjs(value[1]), _this3.asProps.unit));
331
+ }
332
+ if (invalid) {
333
+ var invalidValue = _this3.state.lastChangedInput === "to" ? value[1] : value[0];
268
334
  setTimeout(function() {
269
- r !== e.asProps.disabledDateInputAttempt && e.handlers.disabledDateInputAttempt(f);
335
+ if (value === _this3.asProps.disabledDateInputAttempt) return;
336
+ _this3.handlers.disabledDateInputAttempt(invalidValue);
270
337
  }, 0);
271
338
  }
272
- }), e;
339
+ });
340
+ return _this3;
273
341
  }
274
- return Se(g, [{
342
+ _createClass(DateRangeRoot2, [{
275
343
  key: "uncontrolledProps",
276
- value: function() {
277
- var a = this;
344
+ value: function uncontrolledProps() {
345
+ var _this4 = this;
278
346
  return {
279
- disabledDateInputAttempt: [null, function(s) {
280
- var o = a.state.errorText, r = !1;
281
- if (s !== null) {
282
- if (o = a.asProps.disabledErrorText, o === void 0) {
283
- var d = "unavailableDate";
284
- a.asProps.parts && !a.asProps.parts.day && (d = "unavailableMonth"), a.state.lastChangedInput === "to" && (d = "unavailableEndDate", a.asProps.parts && !a.asProps.parts.day && (d = "unavailableEndMonth")), o = a.asProps.getI18nText(d);
347
+ disabledDateInputAttempt: [null, function(date) {
348
+ var errorText = _this4.state.errorText;
349
+ var showError = false;
350
+ if (date !== null) {
351
+ errorText = _this4.asProps.disabledErrorText;
352
+ if (errorText === void 0) {
353
+ var key = "unavailableDate";
354
+ if (_this4.asProps.parts && !_this4.asProps.parts.day) {
355
+ key = "unavailableMonth";
356
+ }
357
+ if (_this4.state.lastChangedInput === "to") {
358
+ key = "unavailableEndDate";
359
+ if (_this4.asProps.parts && !_this4.asProps.parts.day) {
360
+ key = "unavailableEndMonth";
361
+ }
362
+ }
363
+ errorText = _this4.asProps.getI18nText(key);
285
364
  }
286
- typeof o == "function" && (o = o(s)), r = a.asProps.disabledErrorText !== null;
365
+ if (typeof errorText === "function") {
366
+ errorText = errorText(date);
367
+ }
368
+ showError = _this4.asProps.disabledErrorText !== null;
287
369
  }
288
- a.setState({
289
- errorText: o,
290
- showError: r
370
+ _this4.setState({
371
+ errorText,
372
+ showError
291
373
  });
292
374
  }]
293
375
  };
294
376
  }
295
377
  }, {
296
378
  key: "getFromMaskedInputProps",
297
- value: function() {
298
- var a = this.asProps, s = a.value, o = a.locale, r = a.onDisplayedPeriodChange, d = a.ariaHasPopup;
299
- a.showError;
300
- var n = Y(a, Ia);
301
- return Oe({
379
+ value: function getFromMaskedInputProps() {
380
+ var _this$asProps6 = this.asProps, value = _this$asProps6.value, locale = _this$asProps6.locale, onDisplayedPeriodChange = _this$asProps6.onDisplayedPeriodChange, ariaHasPopup = _this$asProps6.ariaHasPopup;
381
+ _this$asProps6.showError;
382
+ var otherProps = _objectWithoutProperties(_this$asProps6, _excluded4);
383
+ return assignProps$1({
302
384
  ref: this.fromRef,
303
- date: s == null ? void 0 : s[0],
385
+ date: value === null || value === void 0 ? void 0 : value[0],
304
386
  onDateChange: this.handleFromChange,
305
387
  onKeyDown: this.handleFromKeydown,
306
- locale: o,
388
+ locale,
307
389
  flex: 1,
308
- onDisplayedPeriodChange: r,
309
- "aria-haspopup": d,
390
+ onDisplayedPeriodChange,
391
+ "aria-haspopup": ariaHasPopup,
310
392
  onMaskPipeBlock: this.handleInputMaskPipeBlock,
311
393
  containerFocused: this.state.containerFocused
312
- }, n);
394
+ }, otherProps);
313
395
  }
314
396
  }, {
315
397
  key: "getToMaskedInputProps",
316
- value: function() {
317
- var a = this.asProps, s = a.value, o = a.locale, r = a.onDisplayedPeriodChange, d = a.ariaHasPopup;
318
- a.inputId, a.showError;
319
- var n = Y(a, Da), f = this.asProps.getI18nText("toDate", {
398
+ value: function getToMaskedInputProps() {
399
+ var _this$asProps7 = this.asProps, value = _this$asProps7.value, locale = _this$asProps7.locale, onDisplayedPeriodChange = _this$asProps7.onDisplayedPeriodChange, ariaHasPopup = _this$asProps7.ariaHasPopup;
400
+ _this$asProps7.inputId;
401
+ _this$asProps7.showError;
402
+ var otherProps = _objectWithoutProperties(_this$asProps7, _excluded5);
403
+ var ariaLabel = this.asProps.getI18nText("toDate", {
320
404
  date: this.asProps.getI18nText("input")
321
405
  });
322
- return Oe({
406
+ return assignProps$1({
323
407
  ref: this.toRef,
324
- date: s == null ? void 0 : s[1],
408
+ date: value === null || value === void 0 ? void 0 : value[1],
325
409
  onDateChange: this.handleToChange,
326
410
  onKeyDown: this.handleToKeydown,
327
- locale: o,
411
+ locale,
328
412
  flex: 1,
329
- onDisplayedPeriodChange: r,
330
- "aria-label": f,
331
- "aria-haspopup": d,
413
+ onDisplayedPeriodChange,
414
+ "aria-label": ariaLabel,
415
+ "aria-haspopup": ariaHasPopup,
332
416
  onMaskPipeBlock: this.handleInputMaskPipeBlock,
333
417
  containerFocused: this.state.containerFocused
334
- }, n);
418
+ }, otherProps);
335
419
  }
336
420
  }, {
337
421
  key: "getRangeSepProps",
338
- value: function() {
339
- var a = this.asProps.value;
422
+ value: function getRangeSepProps() {
423
+ var value = this.asProps.value;
340
424
  return {
341
- fulfilled: !!(a && (a[0] || a[1]))
425
+ fulfilled: !!(value && (value[0] || value[1]))
342
426
  };
343
427
  }
344
428
  }, {
345
429
  key: "componentDidUpdate",
346
- value: function(a) {
347
- a.value !== this.asProps.value && this.updateDisabledDateInputAttempt(this.asProps.value);
430
+ value: function componentDidUpdate(prevProps) {
431
+ if (prevProps.value !== this.asProps.value) {
432
+ this.updateDisabledDateInputAttempt(this.asProps.value);
433
+ }
348
434
  }
349
435
  }, {
350
436
  key: "componentDidMount",
351
- value: function() {
437
+ value: function componentDidMount() {
352
438
  this.updateDisabledDateInputAttempt(this.asProps.value);
353
439
  }
354
440
  }, {
355
441
  key: "render",
356
- value: function() {
357
- var a = this.asProps, s, o = Q, r = this.asProps, d = r.Children, n = r.styles, f = r.w, D = r.state, b = r.showError, E = r.popoverVisible, F = this.state, S = F.errorText, j = F.lastChangedInput, K = F.showError, V = F.containerFocused, X = K && b;
358
- return s = z(n), /* @__PURE__ */ i.createElement(o, s.cn("SDateRange", $({}, O({
359
- tag: Ke,
360
- ignorePortalsStacking: !0,
361
- placement: j === "to" ? "top-end" : "top-start",
362
- title: S,
363
- theme: "warning",
364
- visible: X && (E || V),
365
- state: X ? "invalid" : D,
366
- __excludeProps: ["onChange", "value", "aria-expanded"],
367
- w: f,
368
- onFocus: this.handleFocus,
369
- onBlur: this.handleBlur
370
- }, a))), /* @__PURE__ */ i.createElement(d, s.cn("Children", {})));
371
- }
372
- }]), g;
373
- }(be);
374
- p(se, "displayName", "DateRange");
375
- p(se, "style", Re);
376
- p(se, "defaultProps", {
377
- children: function() {
378
- return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(J.Indicator, null), /* @__PURE__ */ i.createElement(J.FromMaskedInput, null), /* @__PURE__ */ i.createElement(J.RangeSep, null), /* @__PURE__ */ i.createElement(J.ToMaskedInput, null));
442
+ value: function render() {
443
+ var _ref3 = this.asProps, _ref10;
444
+ var SDateRange = InputMask;
445
+ var _this$asProps8 = this.asProps, Children = _this$asProps8.Children, styles = _this$asProps8.styles, w = _this$asProps8.w, state = _this$asProps8.state, showErrorProps = _this$asProps8.showError, popoverVisible = _this$asProps8.popoverVisible;
446
+ var _this$state2 = this.state, errorText = _this$state2.errorText, lastChangedInput = _this$state2.lastChangedInput, showErrorState = _this$state2.showError, containerFocused = _this$state2.containerFocused;
447
+ var showError = showErrorState && showErrorProps;
448
+ return _ref10 = sstyled(styles), /* @__PURE__ */ React.createElement(SDateRange, _ref10.cn("SDateRange", _objectSpread({}, assignProps({
449
+ "tag": Tooltip,
450
+ "ignorePortalsStacking": true,
451
+ "placement": lastChangedInput === "to" ? "top-end" : "top-start",
452
+ "title": errorText,
453
+ "theme": "warning",
454
+ "visible": showError && (popoverVisible || containerFocused),
455
+ "state": showError ? "invalid" : state,
456
+ "__excludeProps": ["onChange", "value", "aria-expanded"],
457
+ "w": w,
458
+ "onFocus": this.handleFocus,
459
+ "onBlur": this.handleBlur
460
+ }, _ref3))), /* @__PURE__ */ React.createElement(Children, _ref10.cn("Children", {})));
461
+ }
462
+ }]);
463
+ return DateRangeRoot2;
464
+ }(Component);
465
+ _defineProperty(DateRangeRoot, "displayName", "DateRange");
466
+ _defineProperty(DateRangeRoot, "style", style);
467
+ _defineProperty(DateRangeRoot, "defaultProps", {
468
+ children: function children2() {
469
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DateRange.Indicator, null), /* @__PURE__ */ React.createElement(DateRange.FromMaskedInput, null), /* @__PURE__ */ React.createElement(DateRange.RangeSep, null), /* @__PURE__ */ React.createElement(DateRange.ToMaskedInput, null));
379
470
  },
380
- defaultDisabledDateInputAttempt: !1,
381
- showError: !0
471
+ defaultDisabledDateInputAttempt: false,
472
+ showError: true
382
473
  });
383
- var ka = function(_) {
384
- var g = arguments[0], e, a = we, s = _.getI18nText;
385
- return e = z(_.styles), /* @__PURE__ */ i.createElement(a, e.cn("SFromMaskedInput", $({}, O({
386
- labelPrefix: s("fromDatePlaceholder")
387
- }, g))));
388
- }, Ta = function(_) {
389
- var g = arguments[0], e, a = we, s = _.getI18nText;
390
- return e = z(_.styles), /* @__PURE__ */ i.createElement(a, e.cn("SToMaskedInput", $({}, O({
391
- labelPrefix: s("toDatePlaceholder")
392
- }, g))));
393
- }, Le = function(_) {
394
- var g = arguments[0], e, a = Q.Addon;
395
- return e = z(_.styles), /* @__PURE__ */ i.createElement(a, e.cn("SIndicator", $({}, O({
396
- tag: ha,
474
+ var FromMaskedInput = function FromMaskedInput2(props) {
475
+ var _ref4 = arguments[0], _ref11;
476
+ var SFromMaskedInput = MaskedInput;
477
+ var getI18nText = props.getI18nText;
478
+ return _ref11 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SFromMaskedInput, _ref11.cn("SFromMaskedInput", _objectSpread({}, assignProps({
479
+ "labelPrefix": getI18nText("fromDatePlaceholder")
480
+ }, _ref4))));
481
+ };
482
+ var ToMaskedInput = function ToMaskedInput2(props) {
483
+ var _ref5 = arguments[0], _ref12;
484
+ var SToMaskedInput = MaskedInput;
485
+ var getI18nText = props.getI18nText;
486
+ return _ref12 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SToMaskedInput, _ref12.cn("SToMaskedInput", _objectSpread({}, assignProps({
487
+ "labelPrefix": getI18nText("toDatePlaceholder")
488
+ }, _ref5))));
489
+ };
490
+ var Indicator = function Indicator2(props) {
491
+ var _ref6 = arguments[0], _ref13;
492
+ var SIndicator = InputMask.Addon;
493
+ return _ref13 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SIndicator, _ref13.cn("SIndicator", _objectSpread({}, assignProps({
494
+ "tag": Calendar,
397
495
  "aria-hidden": "true",
398
- tabIndex: -1
399
- }, g))));
400
- }, Ca = function(_) {
401
- var g = arguments[0], e, a = Q.Addon;
402
- return e = z(_.styles), /* @__PURE__ */ i.createElement(a, e.cn("SRangeSep", $({}, O({
403
- tag: fa,
404
- alignItems: "center",
405
- justifyContent: "center",
406
- pl: 0,
407
- flex: "0"
408
- }, g))), "–");
409
- }, we = function(_) {
410
- var g, e = _.date, a = _.onDateChange, s = _.onDisplayedPeriodChange, o = _.locale, r = _.styles, d = _.parts, n = d === void 0 ? Ra : d, f = _.disabledDates, D = _.forwardRef, b = _.placeholders, E = _.labelPrefix, F = E === void 0 ? "Date" : E, S = _.onMaskPipeBlock, j = _.containerFocused, K = _.animationsDisabled, V = _.getI18nText, X = _.inputId, ke = _.inputRole, We = ke === void 0 ? "combobox" : ke;
411
- _.__excludeProps, _.Root;
412
- var U = Y(_, ba), le = i.useRef(), Ye = i.useState(void 0), Te = ne(Ye, 2), ue = Te[0], Ue = Te[1], u = i.useMemo(function() {
413
- return b || {
414
- year: V("placeholder-years"),
415
- month: V("placeholder-months"),
416
- day: V("placeholder-days")
496
+ "tabIndex": -1
497
+ }, _ref6))));
498
+ };
499
+ var RangeSep = function RangeSep2(props) {
500
+ var _ref7 = arguments[0], _ref14;
501
+ var SRangeSep = InputMask.Addon;
502
+ return _ref14 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SRangeSep, _ref14.cn("SRangeSep", _objectSpread({}, assignProps({
503
+ "tag": Flex,
504
+ "alignItems": "center",
505
+ "justifyContent": "center",
506
+ "pl": 0,
507
+ "flex": "0"
508
+ }, _ref7))), "");
509
+ };
510
+ var MaskedInput = function MaskedInput2(_ref16) {
511
+ var _ref15;
512
+ var outerValue = _ref16.date, onDateChange = _ref16.onDateChange, onDisplayedPeriodChange = _ref16.onDisplayedPeriodChange, locale = _ref16.locale, styles = _ref16.styles, _ref16$parts = _ref16.parts, allowedParts = _ref16$parts === void 0 ? defaultAllowedParts : _ref16$parts, disabledDates = _ref16.disabledDates, forwardRef = _ref16.forwardRef, providedPlaceholders = _ref16.placeholders, _ref16$labelPrefix = _ref16.labelPrefix, labelPrefix = _ref16$labelPrefix === void 0 ? "Date" : _ref16$labelPrefix, onMaskPipeBlock = _ref16.onMaskPipeBlock, containerFocused = _ref16.containerFocused, animationsDisabled = _ref16.animationsDisabled, getI18nText = _ref16.getI18nText, inputId = _ref16.inputId, _ref16$inputRole = _ref16.inputRole, inputRole = _ref16$inputRole === void 0 ? "combobox" : _ref16$inputRole;
513
+ _ref16.__excludeProps;
514
+ _ref16.Root;
515
+ var otherProps = _objectWithoutProperties(_ref16, _excluded6);
516
+ var ref = React.useRef();
517
+ var _React$useState = React.useState(void 0), _React$useState2 = _slicedToArray(_React$useState, 2), width = _React$useState2[0], setWidth = _React$useState2[1];
518
+ var placeholders = React.useMemo(function() {
519
+ if (providedPlaceholders) return providedPlaceholders;
520
+ return {
521
+ year: getI18nText("placeholder-years"),
522
+ month: getI18nText("placeholder-months"),
523
+ day: getI18nText("placeholder-days")
417
524
  };
418
- }, [b, V]);
419
- if (u.year.length !== 1 || u.month.length !== 1 || u.day.length !== 1)
420
- throw console.error({
421
- placeholders: u
422
- }), new Error("InputTrigger placeholder prop should contain fields year, month and day each one with string value of single character length. [see above what was received] (".concat(u, ")"), u);
423
- var Ce = i.useMemo(function() {
424
- var t, l = {
525
+ }, [providedPlaceholders, getI18nText]);
526
+ if (placeholders.year.length !== 1 || placeholders.month.length !== 1 || placeholders.day.length !== 1) {
527
+ console.error({
528
+ placeholders
529
+ });
530
+ throw new Error("InputTrigger placeholder prop should contain fields year, month and day each one with string value of single character length. [see above what was received] (".concat(placeholders, ")"), placeholders);
531
+ }
532
+ var _React$useMemo = React.useMemo(function() {
533
+ var _sep;
534
+ var options = {
425
535
  year: "numeric",
426
536
  month: "numeric",
427
537
  day: "numeric"
428
- }, c = new Intl.DateTimeFormat(o, l), y = void 0, m = [], h = c.formatToParts(wa), P = G(h), R;
538
+ };
539
+ var dateTimeFormat = new Intl.DateTimeFormat(locale, options);
540
+ var sep2 = void 0;
541
+ var order2 = [];
542
+ var parts = dateTimeFormat.formatToParts(exampleDate);
543
+ var _iterator = _createForOfIteratorHelper(parts), _step;
429
544
  try {
430
- for (P.s(); !(R = P.n()).done; ) {
431
- var I = R.value;
432
- !y && I.type === "literal" && (y = I.value), m.length < 3 && ["day", "month", "year"].includes(I.type) && n[I.type] && m.push(I.type);
545
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
546
+ var part = _step.value;
547
+ if (!sep2 && part.type === "literal") {
548
+ sep2 = part.value;
549
+ }
550
+ if (order2.length < 3 && ["day", "month", "year"].includes(part.type) && allowedParts[part.type]) {
551
+ order2.push(part.type);
552
+ }
433
553
  }
434
- } catch (w) {
435
- P.e(w);
554
+ } catch (err) {
555
+ _iterator.e(err);
436
556
  } finally {
437
- P.f();
557
+ _iterator.f();
558
+ }
559
+ sep2 = (_sep = sep2) !== null && _sep !== void 0 ? _sep : " ";
560
+ return {
561
+ sep: sep2,
562
+ order: order2
563
+ };
564
+ }, [locale, allowedParts]), sep = _React$useMemo.sep, order = _React$useMemo.order;
565
+ var outer = React.useMemo(function() {
566
+ var outerDate = outerValue;
567
+ if (typeof outerValue === "number" || typeof outerValue === "string") {
568
+ outerDate = new Date(outerValue);
438
569
  }
439
- return y = (t = y) !== null && t !== void 0 ? t : " ", {
440
- sep: y,
441
- order: m
570
+ var validDate = outerDate && outerDate instanceof Date && !Number.isNaN(outerDate.getTime());
571
+ if (!validDate) return null;
572
+ return {
573
+ year: outerDate.getFullYear().toString().padStart(4, "0"),
574
+ month: (outerDate.getMonth() + 1).toString().padStart(2, "0"),
575
+ day: outerDate.getDate().toString().padStart(2, "0")
442
576
  };
443
- }, [o, n]), H = Ce.sep, C = Ce.order, T = i.useMemo(function() {
444
- var t = e;
445
- (typeof e == "number" || typeof e == "string") && (t = new Date(e));
446
- var l = t && t instanceof Date && !Number.isNaN(t.getTime());
447
- return l ? {
448
- year: t.getFullYear().toString().padStart(4, "0"),
449
- month: (t.getMonth() + 1).toString().padStart(2, "0"),
450
- day: t.getDate().toString().padStart(2, "0")
451
- } : null;
452
- }, [e]), Me = i.useCallback(function(t) {
453
- if (!t || !t.year && !t.month && !t.day) return null;
454
- var l = [], c = G(C), y;
577
+ }, [outerValue]);
578
+ var stringifyValue = React.useCallback(function(value2) {
579
+ if (!value2) return null;
580
+ if (!value2.year && !value2.month && !value2.day) return null;
581
+ var result = [];
582
+ var _iterator2 = _createForOfIteratorHelper(order), _step2;
455
583
  try {
456
- for (c.s(); !(y = c.n()).done; ) {
457
- var m = y.value;
458
- n[m] && (m === "year" && t.year && l.push(t.year), m === "month" && t.month && l.push(t.month), m === "day" && t.day && l.push(t.day));
584
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
585
+ var part = _step2.value;
586
+ if (!allowedParts[part]) continue;
587
+ if (part === "year" && value2.year) result.push(value2.year);
588
+ if (part === "month" && value2.month) result.push(value2.month);
589
+ if (part === "day" && value2.day) result.push(value2.day);
459
590
  }
460
- } catch (h) {
461
- c.e(h);
591
+ } catch (err) {
592
+ _iterator2.e(err);
462
593
  } finally {
463
- c.f();
464
- }
465
- return l.join(H);
466
- }, [C, n]), qe = i.useState(T), Ee = ne(qe, 2), Fe = Ee[0], Z = Ee[1], _e = i.useMemo(function() {
467
- return Me(Fe);
468
- }, [Me, Fe]), N = i.useRef(T);
469
- i.useEffect(function() {
470
- var t, l, c;
471
- (((t = N.current) === null || t === void 0 ? void 0 : t.day) !== (T == null ? void 0 : T.day) || ((l = N.current) === null || l === void 0 ? void 0 : l.month) !== (T == null ? void 0 : T.month) || ((c = N.current) === null || c === void 0 ? void 0 : c.year) !== (T == null ? void 0 : T.year)) && Z(T), N.current = T;
472
- }, [T, Z]);
473
- var Ge = i.useCallback(function(t) {
474
- for (var l = !0, c = 0; c < t.length; c++)
475
- if (t[c] !== "_" && t[c] !== H) {
476
- l = !1;
594
+ _iterator2.f();
595
+ }
596
+ return result.join(sep);
597
+ }, [order, allowedParts]);
598
+ var _React$useState3 = React.useState(outer), _React$useState4 = _slicedToArray(_React$useState3, 2), internalValue = _React$useState4[0], setInternalValue = _React$useState4[1];
599
+ var value = React.useMemo(function() {
600
+ return stringifyValue(internalValue);
601
+ }, [stringifyValue, internalValue]);
602
+ var lastKnownOuterValue = React.useRef(outer);
603
+ React.useEffect(function() {
604
+ var _lastKnownOuterValue$, _lastKnownOuterValue$2, _lastKnownOuterValue$3;
605
+ if (((_lastKnownOuterValue$ = lastKnownOuterValue.current) === null || _lastKnownOuterValue$ === void 0 ? void 0 : _lastKnownOuterValue$.day) !== (outer === null || outer === void 0 ? void 0 : outer.day) || ((_lastKnownOuterValue$2 = lastKnownOuterValue.current) === null || _lastKnownOuterValue$2 === void 0 ? void 0 : _lastKnownOuterValue$2.month) !== (outer === null || outer === void 0 ? void 0 : outer.month) || ((_lastKnownOuterValue$3 = lastKnownOuterValue.current) === null || _lastKnownOuterValue$3 === void 0 ? void 0 : _lastKnownOuterValue$3.year) !== (outer === null || outer === void 0 ? void 0 : outer.year)) {
606
+ setInternalValue(outer);
607
+ }
608
+ lastKnownOuterValue.current = outer;
609
+ }, [outer, setInternalValue]);
610
+ var pipeMask = React.useCallback(function(value2) {
611
+ var placeholdersOnly = true;
612
+ for (var i = 0; i < value2.length; i++) {
613
+ if (value2[i] !== "_" && value2[i] !== sep) {
614
+ placeholdersOnly = false;
477
615
  break;
478
616
  }
479
- if (l)
480
- return S == null || S(null), "";
481
- var y = function(_a) {
482
- var ze = C.slice(0, C.indexOf(_a)), q = 0, re = G(ze), je;
617
+ }
618
+ if (placeholdersOnly) {
619
+ onMaskPipeBlock === null || onMaskPipeBlock === void 0 ? void 0 : onMaskPipeBlock(null);
620
+ return "";
621
+ }
622
+ var getOffsetTo = function getOffsetTo2(partName2) {
623
+ var partsBefore = order.slice(0, order.indexOf(partName2));
624
+ var offset = 0;
625
+ var _iterator3 = _createForOfIteratorHelper(partsBefore), _step3;
483
626
  try {
484
- for (re.s(); !(je = re.n()).done; ) {
485
- var me = je.value;
486
- me === "year" && n.year && (q += 4), me === "month" && n.month && (q += 2), me === "day" && n.day && (q += 2);
627
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
628
+ var part2 = _step3.value;
629
+ if (part2 === "year" && allowedParts.year) offset += 4;
630
+ if (part2 === "month" && allowedParts.month) offset += 2;
631
+ if (part2 === "day" && allowedParts.day) offset += 2;
487
632
  }
488
- } catch (da) {
489
- re.e(da);
633
+ } catch (err) {
634
+ _iterator3.e(err);
490
635
  } finally {
491
- re.f();
636
+ _iterator3.f();
492
637
  }
493
- return q += ze.length * H.length, q;
494
- }, m = [], h = {}, P = t.split(H);
495
- for (var R in u)
496
- h[R] = u[R];
497
- for (var I = 0; I < C.length; I++)
498
- h[C[I]] = P[I];
499
- var w = h.year, x = h.month, v = h.day;
500
- if (n.month && (x[0] !== "_" && parseInt(x[0], 10) > 1 && (x = "0".concat(x[0]), m.push(y("month"))), x === "00" && (x = "01"), x[0] !== "_" && x[1] !== "_" && parseInt(x, 10) > 12) || n.day && (v[0] !== "_" && parseInt(v[0], 10) > 3 && (v = "0".concat(v[0]), m.push(y("day"))), v === "00" && (v = "01"), v[0] !== "_" && v[1] !== "_" && parseInt(v, 10) > 31))
501
- return !1;
502
- w = w.split("").map(function(B) {
503
- return B === "_" ? u.year : B;
504
- }).join(""), x = x.split("").map(function(B) {
505
- return B === "_" ? u.month : B;
506
- }).join(""), v = v.split("").map(function(B) {
507
- return B === "_" ? u.day : B;
638
+ offset += partsBefore.length * sep.length;
639
+ return offset;
640
+ };
641
+ var indexesOfPipedChars = [];
642
+ var parsed = {};
643
+ var parts = value2.split(sep);
644
+ for (var partName in placeholders) {
645
+ parsed[partName] = placeholders[partName];
646
+ }
647
+ for (var _i = 0; _i < order.length; _i++) {
648
+ parsed[order[_i]] = parts[_i];
649
+ }
650
+ var year = parsed.year, month = parsed.month, day = parsed.day;
651
+ if (allowedParts.month) {
652
+ if (month[0] !== "_" && parseInt(month[0], 10) > 1) {
653
+ month = "0".concat(month[0]);
654
+ indexesOfPipedChars.push(getOffsetTo("month"));
655
+ }
656
+ if (month === "00") month = "01";
657
+ if (month[0] !== "_" && month[1] !== "_" && parseInt(month, 10) > 12) return false;
658
+ }
659
+ if (allowedParts.day) {
660
+ if (day[0] !== "_" && parseInt(day[0], 10) > 3) {
661
+ day = "0".concat(day[0]);
662
+ indexesOfPipedChars.push(getOffsetTo("day"));
663
+ }
664
+ if (day === "00") day = "01";
665
+ if (day[0] !== "_" && day[1] !== "_" && parseInt(day, 10) > 31) return false;
666
+ }
667
+ year = year.split("").map(function(_char) {
668
+ return _char === "_" ? placeholders.year : _char;
508
669
  }).join("");
509
- var ee = !n.year || w && w.length >= 4 && !w.includes(u.year), pe = !n.month || x && x.length === 2 && !x.includes(u.month), ce = !n.day || v && v.length === 2 && !v.includes(u.day), ge = ee && pe && ce;
510
- if (ge) {
511
- var A = new Date(0, 0, 0, 0, 0, 0, 0), sa = n.year ? parseInt(w, 10) : 0, la = n.month ? parseInt(x, 10) - 1 : 0, ua = n.day ? parseInt(v, 10) : 1;
512
- if (A.setFullYear(sa, la, ua), f != null && f.some(he(ve(A), "date")) || n.day && A.getDate() !== parseInt(v, 10))
513
- return S == null || S(A), !1;
670
+ month = month.split("").map(function(_char2) {
671
+ return _char2 === "_" ? placeholders.month : _char2;
672
+ }).join("");
673
+ day = day.split("").map(function(_char3) {
674
+ return _char3 === "_" ? placeholders.day : _char3;
675
+ }).join("");
676
+ var yearFulfilled = !allowedParts.year || year && year.length >= 4 && !year.includes(placeholders.year);
677
+ var monthFulfilled = !allowedParts.month || month && month.length === 2 && !month.includes(placeholders.month);
678
+ var dayFulfilled = !allowedParts.day || day && day.length === 2 && !day.includes(placeholders.day);
679
+ var fulfilled = yearFulfilled && monthFulfilled && dayFulfilled;
680
+ if (fulfilled) {
681
+ var date = new Date(0, 0, 0, 0, 0, 0, 0);
682
+ var yearParsed = allowedParts.year ? parseInt(year, 10) : 0;
683
+ var monthParsed = allowedParts.month ? parseInt(month, 10) - 1 : 0;
684
+ var dayParsed = allowedParts.day ? parseInt(day, 10) : 1;
685
+ date.setFullYear(yearParsed, monthParsed, dayParsed);
686
+ if (disabledDates !== null && disabledDates !== void 0 && disabledDates.some(includesDate(dayjs(date), "date"))) {
687
+ onMaskPipeBlock === null || onMaskPipeBlock === void 0 ? void 0 : onMaskPipeBlock(date);
688
+ return false;
689
+ }
690
+ if (allowedParts.day) {
691
+ if (date.getDate() !== parseInt(day, 10)) {
692
+ onMaskPipeBlock === null || onMaskPipeBlock === void 0 ? void 0 : onMaskPipeBlock(date);
693
+ return false;
694
+ }
695
+ }
514
696
  }
515
- var ae = [], te = G(C), Ve;
697
+ var result = [];
698
+ var _iterator4 = _createForOfIteratorHelper(order), _step4;
516
699
  try {
517
- for (te.s(); !(Ve = te.n()).done; ) {
518
- var fe = Ve.value;
519
- fe === "year" && ae.push(w), fe === "month" && ae.push(x), fe === "day" && ae.push(v);
700
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) {
701
+ var part = _step4.value;
702
+ if (part === "year") result.push(year);
703
+ if (part === "month") result.push(month);
704
+ if (part === "day") result.push(day);
520
705
  }
521
- } catch (B) {
522
- te.e(B);
706
+ } catch (err) {
707
+ _iterator4.e(err);
523
708
  } finally {
524
- te.f();
709
+ _iterator4.f();
525
710
  }
526
- return S == null || S(null), {
527
- value: ae.join(H),
528
- indexesOfPipedChars: m
711
+ onMaskPipeBlock === null || onMaskPipeBlock === void 0 ? void 0 : onMaskPipeBlock(null);
712
+ return {
713
+ value: result.join(sep),
714
+ indexesOfPipedChars
529
715
  };
530
- }, [u, H, C, n, f, S]), Je = i.useCallback(function(t) {
531
- var l = {};
532
- for (var c in u)
533
- l[c] = u[c];
534
- for (var y = t.split(H), m = 0; m < C.length; m++)
535
- l[C[m]] = y[m];
536
- var h = l.year, P = l.month, R = l.day;
537
- Z({
538
- year: h,
539
- month: P,
540
- day: R
716
+ }, [placeholders, sep, order, allowedParts, disabledDates, onMaskPipeBlock]);
717
+ var handleChange = React.useCallback(function(value2) {
718
+ var parsed = {};
719
+ for (var partName in placeholders) {
720
+ parsed[partName] = placeholders[partName];
721
+ }
722
+ var parts = value2.split(sep);
723
+ for (var i = 0; i < order.length; i++) {
724
+ parsed[order[i]] = parts[i];
725
+ }
726
+ var year = parsed.year, month = parsed.month, day = parsed.day;
727
+ setInternalValue({
728
+ year,
729
+ month,
730
+ day
541
731
  });
542
- var I = !n.year || h && h.length >= 4 && !h.includes(u.year), w = !n.month || P && P.length === 2 && !P.includes(u.month), x = !n.day || R && R.length === 2 && !R.includes(u.day), v = I && w && x;
543
- if (v) {
544
- var ee = new Date(0, 0, 0, 0, 0, 0, 0), pe = n.year ? parseInt(h, 10) : 0, ce = n.month ? parseInt(P, 10) - 1 : 0, ge = n.day ? parseInt(R, 10) : 1;
545
- ee.setFullYear(pe, ce, ge), a(ee), N.current = {
546
- year: h,
547
- month: P,
548
- day: R
732
+ var yearFulfilled = !allowedParts.year || year && year.length >= 4 && !year.includes(placeholders.year);
733
+ var monthFulfilled = !allowedParts.month || month && month.length === 2 && !month.includes(placeholders.month);
734
+ var dayFulfilled = !allowedParts.day || day && day.length === 2 && !day.includes(placeholders.day);
735
+ var fulfilled = yearFulfilled && monthFulfilled && dayFulfilled;
736
+ if (fulfilled) {
737
+ var date = new Date(0, 0, 0, 0, 0, 0, 0);
738
+ var yearParsed = allowedParts.year ? parseInt(year, 10) : 0;
739
+ var monthParsed = allowedParts.month ? parseInt(month, 10) - 1 : 0;
740
+ var dayParsed = allowedParts.day ? parseInt(day, 10) : 1;
741
+ date.setFullYear(yearParsed, monthParsed, dayParsed);
742
+ onDateChange(date);
743
+ lastKnownOuterValue.current = {
744
+ year,
745
+ month,
746
+ day
549
747
  };
550
748
  return;
551
749
  }
552
- if (N.current !== null && (a(null), N.current = null), I && n.year) {
553
- var A = new Date(0, 0, 0, 0, 0, 0, 0);
554
- A.setFullYear(parseInt(h, 10)), w && n.month && A.setMonth(parseInt(P, 10) - 1), s(A);
750
+ if (lastKnownOuterValue.current !== null) {
751
+ onDateChange(null);
752
+ lastKnownOuterValue.current = null;
555
753
  }
556
- }, [a, Z, u, s, C, n]), L = i.useMemo(function() {
557
- var t = [], l = G(C), c;
754
+ if (yearFulfilled && allowedParts.year) {
755
+ var _date = new Date(0, 0, 0, 0, 0, 0, 0);
756
+ _date.setFullYear(parseInt(year, 10));
757
+ if (monthFulfilled && allowedParts.month) {
758
+ _date.setMonth(parseInt(month, 10) - 1);
759
+ }
760
+ onDisplayedPeriodChange(_date);
761
+ }
762
+ }, [onDateChange, setInternalValue, placeholders, onDisplayedPeriodChange, order, allowedParts]);
763
+ var mask = React.useMemo(function() {
764
+ var result = [];
765
+ var _iterator5 = _createForOfIteratorHelper(order), _step5;
558
766
  try {
559
- for (l.s(); !(c = l.n()).done; ) {
560
- var y = c.value;
561
- y === "year" && t.push(u.year + u.year + u.year + u.year), y === "month" && t.push(u.month + u.month), y === "day" && t.push(u.day + u.day);
767
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done; ) {
768
+ var part = _step5.value;
769
+ if (part === "year") result.push(placeholders.year + placeholders.year + placeholders.year + placeholders.year);
770
+ if (part === "month") result.push(placeholders.month + placeholders.month);
771
+ if (part === "day") result.push(placeholders.day + placeholders.day);
562
772
  }
563
- } catch (m) {
564
- l.e(m);
773
+ } catch (err) {
774
+ _iterator5.e(err);
565
775
  } finally {
566
- l.f();
567
- }
568
- return t.join(H);
569
- }, [H, C, u]), Qe = i.useMemo(function() {
570
- var t;
571
- return t = {}, p(t, u.year, /\d/), p(t, u.month, /\d/), p(t, u.day, /\d/), t;
572
- }, [u]), Xe = i.useMemo(function() {
573
- var t;
574
- return t = {}, p(t, u.year, !0), p(t, u.month, !0), p(t, u.day, !0), p(t, H, !0), t;
575
- }, [H, u]), W = i.useMemo(function() {
576
- var t = e;
577
- (typeof e == "number" || typeof e == "string") && (t = new Date(e));
578
- var l = t && t instanceof Date && !Number.isNaN(t.getTime());
579
- return l ? new Intl.DateTimeFormat(o, {
580
- year: n.year ? "numeric" : void 0,
581
- month: n.month ? "short" : void 0,
582
- day: n.day ? "numeric" : void 0
583
- }).format(t) : null;
584
- }, [e, o, n]);
585
- Ne(function() {
586
- if (le.current) {
587
- for (var t = W ? [W, L] : [L], l = [], c = document.createElement("span"), y = window.getComputedStyle(le.current), m = ["height", "font-size", "font-family", "font-weight", "font-style", "line-height", "letter-spacing", "text-transform", "word-spacing"], h = 0, P = m; h < P.length; h++) {
588
- var R = P[h];
589
- c.style[R] = y[R];
590
- }
591
- c.style.position = "absolute", c.style.visibility = "hidden", document.body.appendChild(c);
592
- for (var I = 0, w = t; I < w.length; I++) {
593
- var x = w[I];
594
- c.innerHTML = x, l.push(c.offsetWidth);
595
- }
596
- c.remove();
597
- var v = Math.max.apply(Math, l);
598
- Ue(v);
599
- }
600
- }, [o, W, n, L]);
601
- var Ze = "div", ea = i.useCallback(function(t) {
602
- le.current = t, !(!t || t.tagName !== "INPUT") && (typeof D == "function" ? D(t) : D.current = t);
603
- }, [D]), aa = i.useState(ue), $e = ne(aa, 2), He = $e[0], ta = $e[1], ra = i.useState(!1), Be = ne(ra, 2), na = Be[0], Ae = Be[1], de = j ?? na, oa = i.useCallback(function(t) {
604
- var l;
605
- (l = U.onFocus) === null || l === void 0 || l.call(U, t), Ae(!0);
606
- }, []), ia = i.useCallback(function(t) {
607
- var l;
608
- (l = U.onBlur) === null || l === void 0 || l.call(U, t), Ae(!1);
776
+ _iterator5.f();
777
+ }
778
+ return result.join(sep);
779
+ }, [sep, order, placeholders]);
780
+ var aliases = React.useMemo(function() {
781
+ var _ref17;
782
+ return _ref17 = {}, _defineProperty(_ref17, placeholders.year, /\d/), _defineProperty(_ref17, placeholders.month, /\d/), _defineProperty(_ref17, placeholders.day, /\d/), _ref17;
783
+ }, [placeholders]);
784
+ var maskOnlySymbols = React.useMemo(function() {
785
+ var _ref18;
786
+ return _ref18 = {}, _defineProperty(_ref18, placeholders.year, true), _defineProperty(_ref18, placeholders.month, true), _defineProperty(_ref18, placeholders.day, true), _defineProperty(_ref18, sep, true), _ref18;
787
+ }, [sep, placeholders]);
788
+ var humanizedDate = React.useMemo(function() {
789
+ var outerDate = outerValue;
790
+ if (typeof outerValue === "number" || typeof outerValue === "string") {
791
+ outerDate = new Date(outerValue);
792
+ }
793
+ var validDate = outerDate && outerDate instanceof Date && !Number.isNaN(outerDate.getTime());
794
+ if (!validDate) return null;
795
+ return new Intl.DateTimeFormat(locale, {
796
+ year: allowedParts.year ? "numeric" : void 0,
797
+ month: allowedParts.month ? "short" : void 0,
798
+ day: allowedParts.day ? "numeric" : void 0
799
+ }).format(outerDate);
800
+ }, [outerValue, locale, allowedParts]);
801
+ useEnhancedEffect(function() {
802
+ if (!ref.current) return;
803
+ var stringsToMeasure = humanizedDate ? [humanizedDate, mask] : [mask];
804
+ var widths = [];
805
+ var measureSpan = document.createElement("span");
806
+ var computedStyle = window.getComputedStyle(ref.current);
807
+ var typographyRelatedStyles = ["height", "font-size", "font-family", "font-weight", "font-style", "line-height", "letter-spacing", "text-transform", "word-spacing"];
808
+ for (var _i2 = 0, _typographyRelatedSty = typographyRelatedStyles; _i2 < _typographyRelatedSty.length; _i2++) {
809
+ var _style = _typographyRelatedSty[_i2];
810
+ measureSpan.style[_style] = computedStyle[_style];
811
+ }
812
+ measureSpan.style.position = "absolute";
813
+ measureSpan.style.visibility = "hidden";
814
+ document.body.appendChild(measureSpan);
815
+ for (var _i3 = 0, _stringsToMeasure = stringsToMeasure; _i3 < _stringsToMeasure.length; _i3++) {
816
+ var string = _stringsToMeasure[_i3];
817
+ measureSpan.innerHTML = string;
818
+ widths.push(measureSpan.offsetWidth);
819
+ }
820
+ measureSpan.remove();
821
+ var maxWidth = Math.max.apply(Math, widths);
822
+ setWidth(maxWidth);
823
+ }, [locale, humanizedDate, allowedParts, mask]);
824
+ var SHumanizedDate = "div";
825
+ var handleInputRef = React.useCallback(function(node) {
826
+ ref.current = node;
827
+ if (!node || node.tagName !== "INPUT") return;
828
+ if (typeof forwardRef === "function") forwardRef(node);
829
+ else forwardRef.current = node;
830
+ }, [forwardRef]);
831
+ var _React$useState5 = React.useState(width), _React$useState6 = _slicedToArray(_React$useState5, 2), appliedWidth = _React$useState6[0], setAppliedWidth = _React$useState6[1];
832
+ var _React$useState7 = React.useState(false), _React$useState8 = _slicedToArray(_React$useState7, 2), innerFocused = _React$useState8[0], setInnerFocused = _React$useState8[1];
833
+ var focused = containerFocused !== null && containerFocused !== void 0 ? containerFocused : innerFocused;
834
+ var handleFocus = React.useCallback(function(event) {
835
+ var _otherProps$onFocus;
836
+ (_otherProps$onFocus = otherProps.onFocus) === null || _otherProps$onFocus === void 0 ? void 0 : _otherProps$onFocus.call(otherProps, event);
837
+ setInnerFocused(true);
609
838
  }, []);
610
- return Ne(function() {
611
- de || ta(ue);
612
- }, [ue, de]), g = z(r), /* @__PURE__ */ i.createElement(Q.Value, pa({
613
- "aria-label": F,
614
- title: L,
615
- mask: L,
616
- aliases: Qe,
617
- maskOnlySymbols: Xe,
618
- placeholder: L,
619
- inputW: He,
620
- wMin: He,
621
- id: X
622
- }, U, {
623
- onFocus: oa,
624
- onBlur: ia,
625
- focused: de,
626
- ref: ea,
627
- pipe: Ge,
628
- value: _e ?? "",
629
- onChange: Je,
630
- noHumanizedDate: !W,
631
- animationsDisabled: K,
632
- inputRole: We,
839
+ var handleBlur = React.useCallback(function(event) {
840
+ var _otherProps$onBlur;
841
+ (_otherProps$onBlur = otherProps.onBlur) === null || _otherProps$onBlur === void 0 ? void 0 : _otherProps$onBlur.call(otherProps, event);
842
+ setInnerFocused(false);
843
+ }, []);
844
+ useEnhancedEffect(function() {
845
+ if (focused) return;
846
+ setAppliedWidth(width);
847
+ }, [width, focused]);
848
+ return _ref15 = sstyled(styles), /* @__PURE__ */ React.createElement(InputMask.Value, _extends({
849
+ "aria-label": labelPrefix,
850
+ title: mask,
851
+ mask,
852
+ aliases,
853
+ maskOnlySymbols,
854
+ placeholder: mask,
855
+ inputW: appliedWidth,
856
+ wMin: appliedWidth,
857
+ id: inputId
858
+ }, otherProps, {
859
+ onFocus: handleFocus,
860
+ onBlur: handleBlur,
861
+ focused,
862
+ ref: handleInputRef,
863
+ pipe: pipeMask,
864
+ value: value !== null && value !== void 0 ? value : "",
865
+ onChange: handleChange,
866
+ noHumanizedDate: !humanizedDate,
867
+ animationsDisabled,
868
+ inputRole,
633
869
  inputMode: "numeric"
634
- }), W && /* @__PURE__ */ i.createElement(Ze, g.cn("SHumanizedDate", {}), W));
635
- }, xe = De(ie, {
636
- Indicator: Le,
637
- MaskedInput: we
638
- }), J = De(se, {
639
- Indicator: Le,
640
- RangeSep: Ca,
641
- FromMaskedInput: ka,
642
- ToMaskedInput: Ta
643
- }), tt = De(oe, {
644
- Addon: ga.Addon,
645
- SingleDateInput: xe,
646
- DateRange: J
870
+ }), humanizedDate && /* @__PURE__ */ React.createElement(SHumanizedDate, _ref15.cn("SHumanizedDate", {}), humanizedDate));
871
+ };
872
+ var SingleDateInput = createComponent(SingleDateInputRoot, {
873
+ Indicator,
874
+ MaskedInput
875
+ });
876
+ var DateRange = createComponent(DateRangeRoot, {
877
+ Indicator,
878
+ RangeSep,
879
+ FromMaskedInput,
880
+ ToMaskedInput
881
+ });
882
+ var InputTrigger = createComponent(InputTriggerRoot, {
883
+ Addon: BaseTrigger.Addon,
884
+ SingleDateInput,
885
+ DateRange
647
886
  });
648
887
  export {
649
- tt as default
888
+ InputTrigger as default
650
889
  };