@semcore/date-picker 16.2.4 → 17.0.0-prerelease.18

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 (107) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cjs/DatePicker.js +116 -139
  3. package/lib/cjs/DatePicker.js.map +1 -1
  4. package/lib/cjs/DateRangeComparator.js +144 -149
  5. package/lib/cjs/DateRangeComparator.js.map +1 -1
  6. package/lib/cjs/DateRangePicker.js +86 -101
  7. package/lib/cjs/DateRangePicker.js.map +1 -1
  8. package/lib/cjs/MonthDateRangeComparator.js +173 -180
  9. package/lib/cjs/MonthDateRangeComparator.js.map +1 -1
  10. package/lib/cjs/MonthPicker.js +70 -87
  11. package/lib/cjs/MonthPicker.js.map +1 -1
  12. package/lib/cjs/MonthRangePicker.js +96 -111
  13. package/lib/cjs/MonthRangePicker.js.map +1 -1
  14. package/lib/cjs/components/ButtonTrigger.js +12 -11
  15. package/lib/cjs/components/ButtonTrigger.js.map +1 -1
  16. package/lib/cjs/components/Calendar.js +409 -466
  17. package/lib/cjs/components/Calendar.js.map +1 -1
  18. package/lib/cjs/components/DateRangeComparatorAbstract.js +574 -626
  19. package/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
  20. package/lib/cjs/components/InputTrigger.js +585 -677
  21. package/lib/cjs/components/InputTrigger.js.map +1 -1
  22. package/lib/cjs/components/PickerAbstract.js +254 -273
  23. package/lib/cjs/components/PickerAbstract.js.map +1 -1
  24. package/lib/cjs/components/RangePickerAbstract.js +407 -439
  25. package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
  26. package/lib/cjs/components/index.js +92 -102
  27. package/lib/cjs/components/index.js.map +1 -1
  28. package/lib/cjs/index.d.js.map +1 -1
  29. package/lib/cjs/index.js +15 -15
  30. package/lib/cjs/index.js.map +1 -1
  31. package/lib/cjs/translations/__intergalactic-dynamic-locales.js +17 -17
  32. package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
  33. package/lib/cjs/utils/cronTabScheduler.js +13 -22
  34. package/lib/cjs/utils/cronTabScheduler.js.map +1 -1
  35. package/lib/cjs/utils/datesIntersects.js +12 -19
  36. package/lib/cjs/utils/datesIntersects.js.map +1 -1
  37. package/lib/cjs/utils/formatDate.js +11 -9
  38. package/lib/cjs/utils/formatDate.js.map +1 -1
  39. package/lib/cjs/utils/includesDate.js +11 -16
  40. package/lib/cjs/utils/includesDate.js.map +1 -1
  41. package/lib/cjs/utils/isBetweenPlugin.js +6 -6
  42. package/lib/cjs/utils/isBetweenPlugin.js.map +1 -1
  43. package/lib/cjs/utils/shortDateRangeFormat.js +29 -33
  44. package/lib/cjs/utils/shortDateRangeFormat.js.map +1 -1
  45. package/lib/es6/DatePicker.js +117 -141
  46. package/lib/es6/DatePicker.js.map +1 -1
  47. package/lib/es6/DateRangeComparator.js +130 -135
  48. package/lib/es6/DateRangeComparator.js.map +1 -1
  49. package/lib/es6/DateRangePicker.js +87 -102
  50. package/lib/es6/DateRangePicker.js.map +1 -1
  51. package/lib/es6/MonthDateRangeComparator.js +159 -166
  52. package/lib/es6/MonthDateRangeComparator.js.map +1 -1
  53. package/lib/es6/MonthPicker.js +72 -89
  54. package/lib/es6/MonthPicker.js.map +1 -1
  55. package/lib/es6/MonthRangePicker.js +97 -112
  56. package/lib/es6/MonthRangePicker.js.map +1 -1
  57. package/lib/es6/components/ButtonTrigger.js +4 -3
  58. package/lib/es6/components/ButtonTrigger.js.map +1 -1
  59. package/lib/es6/components/Calendar.js +400 -457
  60. package/lib/es6/components/Calendar.js.map +1 -1
  61. package/lib/es6/components/DateRangeComparatorAbstract.js +552 -604
  62. package/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
  63. package/lib/es6/components/InputTrigger.js +568 -660
  64. package/lib/es6/components/InputTrigger.js.map +1 -1
  65. package/lib/es6/components/PickerAbstract.js +246 -265
  66. package/lib/es6/components/PickerAbstract.js.map +1 -1
  67. package/lib/es6/components/RangePickerAbstract.js +397 -429
  68. package/lib/es6/components/RangePickerAbstract.js.map +1 -1
  69. package/lib/es6/components/index.js +74 -85
  70. package/lib/es6/components/index.js.map +1 -1
  71. package/lib/es6/index.d.js.map +1 -1
  72. package/lib/es6/translations/__intergalactic-dynamic-locales.js +16 -16
  73. package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
  74. package/lib/es6/utils/cronTabScheduler.js +13 -21
  75. package/lib/es6/utils/cronTabScheduler.js.map +1 -1
  76. package/lib/es6/utils/datesIntersects.js +10 -18
  77. package/lib/es6/utils/datesIntersects.js.map +1 -1
  78. package/lib/es6/utils/formatDate.js +6 -6
  79. package/lib/es6/utils/formatDate.js.map +1 -1
  80. package/lib/es6/utils/includesDate.js +10 -15
  81. package/lib/es6/utils/includesDate.js.map +1 -1
  82. package/lib/es6/utils/isBetweenPlugin.js +4 -4
  83. package/lib/es6/utils/isBetweenPlugin.js.map +1 -1
  84. package/lib/es6/utils/shortDateRangeFormat.js +27 -31
  85. package/lib/es6/utils/shortDateRangeFormat.js.map +1 -1
  86. package/lib/esm/DatePicker.mjs +109 -114
  87. package/lib/esm/DateRangeComparator.mjs +112 -105
  88. package/lib/esm/DateRangePicker.mjs +76 -80
  89. package/lib/esm/MonthDateRangeComparator.mjs +141 -134
  90. package/lib/esm/MonthPicker.mjs +65 -70
  91. package/lib/esm/MonthRangePicker.mjs +86 -88
  92. package/lib/esm/components/ButtonTrigger.mjs +4 -3
  93. package/lib/esm/components/Calendar.mjs +397 -423
  94. package/lib/esm/components/DateRangeComparatorAbstract.mjs +559 -516
  95. package/lib/esm/components/InputTrigger.mjs +550 -557
  96. package/lib/esm/components/PickerAbstract.mjs +249 -244
  97. package/lib/esm/components/RangePickerAbstract.mjs +400 -384
  98. package/lib/esm/components/index.mjs +73 -69
  99. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
  100. package/lib/esm/utils/cronTabScheduler.mjs +13 -18
  101. package/lib/esm/utils/datesIntersects.mjs +10 -14
  102. package/lib/esm/utils/formatDate.mjs +6 -6
  103. package/lib/esm/utils/includesDate.mjs +10 -13
  104. package/lib/esm/utils/isBetweenPlugin.mjs +4 -4
  105. package/lib/esm/utils/shortDateRangeFormat.mjs +27 -27
  106. package/lib/types/index.d.ts +2 -44
  107. package/package.json +16 -17
@@ -1,12 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIteratorHelper";
3
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
5
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
6
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
7
- import _createClass from "@babel/runtime/helpers/createClass";
8
- import _callSuper from "@babel/runtime/helpers/callSuper";
9
- import _inherits from "@babel/runtime/helpers/inherits";
10
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
3
  import { sstyled as _sstyled } from "@semcore/core";
12
4
  import { assignProps as _assignProps7 } from "@semcore/core";
@@ -16,224 +8,205 @@ import { assignProps as _assignProps4 } from "@semcore/core";
16
8
  import { assignProps as _assignProps3 } from "@semcore/core";
17
9
  import { assignProps as _assignProps2 } from "@semcore/core";
18
10
  import { assignProps as _assignProps } from "@semcore/core";
19
- var _excluded = ["children", "id", "role", "aria-haspopup", "aria-label", "style"],
20
- _excluded2 = ["children", "id", "role", "aria-haspopup", "aria-label", "style"],
21
- _excluded3 = ["value", "onChange", "onDisplayedPeriodChange", "locale", "w", "ariaHasPopup", "showError"],
22
- _excluded4 = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "showError"],
23
- _excluded5 = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "inputId", "showError"],
24
- _excluded6 = ["date", "onDateChange", "onDisplayedPeriodChange", "locale", "styles", "parts", "disabledDates", "forwardRef", "placeholders", "labelPrefix", "onMaskPipeBlock", "containerFocused", "animationsDisabled", "getI18nText", "inputId", "inputRole", "__excludeProps", "Root"];
11
+ import { NeighborLocation, Flex, Box } from '@semcore/base-components';
25
12
  import BaseTrigger from '@semcore/base-trigger';
26
13
  import { createComponent, Root, sstyled, Component } from '@semcore/core';
27
14
  import assignProps from '@semcore/core/lib/utils/assignProps';
28
15
  import useEnhancedEffect from '@semcore/core/lib/utils/use/useEnhancedEffect';
29
- import { Flex, Box } from '@semcore/flex-box';
30
16
  import Calendar from '@semcore/icon/Calendar/m';
31
17
  import InputMask from '@semcore/input-mask';
32
- import NeighborLocation from '@semcore/neighbor-location';
33
18
  import Tooltip from '@semcore/tooltip';
34
19
  import dayjs from 'dayjs';
35
20
  import React from 'react';
36
21
  /*!__reshadow-styles__:"../style/date-picker.shadow.css"*/
37
- var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SPopper_gjj0p_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_gjj0p_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_gjj0p_gg_:active,.___SPopper_gjj0p_gg_:focus{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_gjj0p_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___SHeader_gjj0p_gg_,.___STitle_gjj0p_gg_{display:flex;align-items:center}.___STitle_gjj0p_gg_{font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-primary, #191b23);height:32px;width:100%;justify-content:center}.___SToday_gjj0p_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_gjj0p_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_gjj0p_gg_ .___SInner_gjj0p_gg_{justify-content:flex-start}.___SInputMask_gjj0p_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_gjj0p_gg_.__animationsDisabled_gjj0p_gg_{transition:none}.___SInputMask_gjj0p_gg_ .___SValue_gjj0p_gg_{letter-spacing:0}.___SInputMask_gjj0p_gg_ .___SValue_gjj0p_gg_:focus{outline:0}.___SIndicator_gjj0p_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}.___SRangeIndicator_gjj0p_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_gjj0p_gg_._range_value_gjj0p_gg_{background-color:var(--intergalactic-date-picker-cell-active, #2bb3ff)}.___SRangeIndicator_gjj0p_gg_._range_compare_gjj0p_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, #8649e1)}.___SRangeIndicator_gjj0p_gg_.__disabled_gjj0p_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SHumanizedDate_gjj0p_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_gjj0p_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_gjj0p_gg_ .___SMask_gjj0p_gg_,.___SDateRange_gjj0p_gg_ .___SValue_gjj0p_gg_,.___SSingleDateInput_gjj0p_gg_ .___SMask_gjj0p_gg_,.___SSingleDateInput_gjj0p_gg_ .___SValue_gjj0p_gg_{opacity:0}.___SSingleDateInput_gjj0p_gg_:focus-within .___SHumanizedDate_gjj0p_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_gjj0p_gg_:focus-within .___SMask_gjj0p_gg_,.___SSingleDateInput_gjj0p_gg_:focus-within .___SValue_gjj0p_gg_{opacity:1}.___SDateRange_gjj0p_gg_:focus-within .___SHumanizedDate_gjj0p_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_gjj0p_gg_:focus-within .___SMask_gjj0p_gg_,.___SDateRange_gjj0p_gg_:focus-within .___SValue_gjj0p_gg_{opacity:1}.___SInputMask_gjj0p_gg_.__noHumanizedDate_gjj0p_gg_ .___SMask_gjj0p_gg_,.___SInputMask_gjj0p_gg_.__noHumanizedDate_gjj0p_gg_ .___SValue_gjj0p_gg_{opacity:1}.___SDateRange_gjj0p_gg_ .___SInputMask_gjj0p_gg_:focus-within .___SMask_gjj0p_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgba(0, 143, 248, 0.2))}.___SDateRange_gjj0p_gg_:focus-within .___SRangeSep_gjj0p_gg_,.___SRangeSep_gjj0p_gg_.__fulfilled_gjj0p_gg_{color:var(--intergalactic-text-primary, #191b23)}.___SRangeComparatorHeader_gjj0p_gg_{border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SRangeCalendar_gjj0p_gg_,.___SRangeComparatorHeader_gjj0p_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_gjj0p_gg_{border-top:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SFooter_gjj0p_gg_,.___SPeriodsList_gjj0p_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_gjj0p_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_gjj0p_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_gjj0p_gg_{transition:none}}", /*__inner_css_end__*/"gjj0p_gg_"),
22
+ const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SPopper_9ubmf_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_9ubmf_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_9ubmf_gg_:active,.___SPopper_9ubmf_gg_:focus{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_9ubmf_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___SHeader_9ubmf_gg_,.___STitle_9ubmf_gg_{display:flex;align-items:center}.___STitle_9ubmf_gg_{font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-primary, #191b23);height:32px;width:100%;justify-content:center}.___SToday_9ubmf_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_9ubmf_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_9ubmf_gg_ .___SInner_9ubmf_gg_{justify-content:flex-start}.___SInputMask_9ubmf_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_9ubmf_gg_.__animationsDisabled_9ubmf_gg_{transition:none}.___SInputMask_9ubmf_gg_ .___SValue_9ubmf_gg_{letter-spacing:0}.___SInputMask_9ubmf_gg_ .___SValue_9ubmf_gg_:focus{outline:0}.___SIndicator_9ubmf_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}.___SRangeIndicator_9ubmf_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_9ubmf_gg_._range_value_9ubmf_gg_{background-color:var(--intergalactic-date-picker-cell-active, #2bb3ff)}.___SRangeIndicator_9ubmf_gg_._range_compare_9ubmf_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, #8649e1)}.___SRangeIndicator_9ubmf_gg_.__disabled_9ubmf_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SHumanizedDate_9ubmf_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_9ubmf_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_9ubmf_gg_ .___SMask_9ubmf_gg_,.___SDateRange_9ubmf_gg_ .___SValue_9ubmf_gg_,.___SSingleDateInput_9ubmf_gg_ .___SMask_9ubmf_gg_,.___SSingleDateInput_9ubmf_gg_ .___SValue_9ubmf_gg_{opacity:0}.___SSingleDateInput_9ubmf_gg_:focus-within .___SHumanizedDate_9ubmf_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_9ubmf_gg_:focus-within .___SMask_9ubmf_gg_,.___SSingleDateInput_9ubmf_gg_:focus-within .___SValue_9ubmf_gg_{opacity:1}.___SDateRange_9ubmf_gg_:focus-within .___SHumanizedDate_9ubmf_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_9ubmf_gg_:focus-within .___SMask_9ubmf_gg_,.___SDateRange_9ubmf_gg_:focus-within .___SValue_9ubmf_gg_{opacity:1}.___SInputMask_9ubmf_gg_.__noHumanizedDate_9ubmf_gg_ .___SMask_9ubmf_gg_,.___SInputMask_9ubmf_gg_.__noHumanizedDate_9ubmf_gg_ .___SValue_9ubmf_gg_{opacity:1}.___SDateRange_9ubmf_gg_ .___SInputMask_9ubmf_gg_:focus-within .___SMask_9ubmf_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgba(0, 143, 248, 0.2))}.___SDateRange_9ubmf_gg_:focus-within .___SRangeSep_9ubmf_gg_,.___SRangeSep_9ubmf_gg_.__fulfilled_9ubmf_gg_{color:var(--intergalactic-text-primary, #191b23)}.___SRangeComparatorHeader_9ubmf_gg_{border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SRangeCalendar_9ubmf_gg_,.___SRangeComparatorHeader_9ubmf_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_9ubmf_gg_{border-top:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SFooter_9ubmf_gg_,.___SPeriodsList_9ubmf_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_9ubmf_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_9ubmf_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_9ubmf_gg_{transition:none}}", /*__inner_css_end__*/"9ubmf_gg_"),
38
23
  /*__reshadow_css_end__*/
39
24
  {
40
- "__SHeader": "___SHeader_gjj0p_gg_",
41
- "__STitle": "___STitle_gjj0p_gg_",
42
- "__SToday": "___SToday_gjj0p_gg_",
43
- "__SPeriod": "___SPeriod_gjj0p_gg_",
44
- "__SButton": "___SButton_gjj0p_gg_",
45
- "__SInner": "___SInner_gjj0p_gg_",
46
- "__SInputMask": "___SInputMask_gjj0p_gg_",
47
- "_animationsDisabled": "__animationsDisabled_gjj0p_gg_",
48
- "__SIndicator": "___SIndicator_gjj0p_gg_",
49
- "__SRangeIndicator": "___SRangeIndicator_gjj0p_gg_",
50
- "_range_value": "_range_value_gjj0p_gg_",
51
- "_range_compare": "_range_compare_gjj0p_gg_",
52
- "_disabled": "__disabled_gjj0p_gg_",
53
- "__SHumanizedDate": "___SHumanizedDate_gjj0p_gg_",
54
- "__SMask": "___SMask_gjj0p_gg_",
55
- "__SSingleDateInput": "___SSingleDateInput_gjj0p_gg_",
56
- "__SValue": "___SValue_gjj0p_gg_",
57
- "__SDateRange": "___SDateRange_gjj0p_gg_",
58
- "_noHumanizedDate": "__noHumanizedDate_gjj0p_gg_",
59
- "__SRangeSep": "___SRangeSep_gjj0p_gg_",
60
- "_fulfilled": "__fulfilled_gjj0p_gg_",
61
- "__SRangeComparatorHeader": "___SRangeComparatorHeader_gjj0p_gg_",
62
- "__SRangeCalendar": "___SRangeCalendar_gjj0p_gg_",
63
- "__SFooter": "___SFooter_gjj0p_gg_",
64
- "__SPeriodsList": "___SPeriodsList_gjj0p_gg_",
65
- "__STooltip": "___STooltip_gjj0p_gg_",
66
- "__SCompareToggle": "___SCompareToggle_gjj0p_gg_",
67
- "__SPopper": "___SPopper_gjj0p_gg_"
25
+ "__SHeader": "___SHeader_9ubmf_gg_",
26
+ "__STitle": "___STitle_9ubmf_gg_",
27
+ "__SToday": "___SToday_9ubmf_gg_",
28
+ "__SPeriod": "___SPeriod_9ubmf_gg_",
29
+ "__SButton": "___SButton_9ubmf_gg_",
30
+ "__SInner": "___SInner_9ubmf_gg_",
31
+ "__SInputMask": "___SInputMask_9ubmf_gg_",
32
+ "_animationsDisabled": "__animationsDisabled_9ubmf_gg_",
33
+ "__SIndicator": "___SIndicator_9ubmf_gg_",
34
+ "__SRangeIndicator": "___SRangeIndicator_9ubmf_gg_",
35
+ "_range_value": "_range_value_9ubmf_gg_",
36
+ "_range_compare": "_range_compare_9ubmf_gg_",
37
+ "_disabled": "__disabled_9ubmf_gg_",
38
+ "__SHumanizedDate": "___SHumanizedDate_9ubmf_gg_",
39
+ "__SMask": "___SMask_9ubmf_gg_",
40
+ "__SSingleDateInput": "___SSingleDateInput_9ubmf_gg_",
41
+ "__SValue": "___SValue_9ubmf_gg_",
42
+ "__SDateRange": "___SDateRange_9ubmf_gg_",
43
+ "_noHumanizedDate": "__noHumanizedDate_9ubmf_gg_",
44
+ "__SRangeSep": "___SRangeSep_9ubmf_gg_",
45
+ "_fulfilled": "__fulfilled_9ubmf_gg_",
46
+ "__SRangeComparatorHeader": "___SRangeComparatorHeader_9ubmf_gg_",
47
+ "__SRangeCalendar": "___SRangeCalendar_9ubmf_gg_",
48
+ "__SFooter": "___SFooter_9ubmf_gg_",
49
+ "__SPeriodsList": "___SPeriodsList_9ubmf_gg_",
50
+ "__STooltip": "___STooltip_9ubmf_gg_",
51
+ "__SCompareToggle": "___SCompareToggle_9ubmf_gg_",
52
+ "__SPopper": "___SPopper_9ubmf_gg_"
68
53
  });
69
54
  import { datesIntersects } from '../utils/datesIntersects';
70
55
  import { includesDate } from '../utils/includesDate';
71
- var defaultAllowedParts = {
56
+ const defaultAllowedParts = {
72
57
  year: true,
73
58
  month: true,
74
59
  day: true
75
60
  };
76
- var exampleDate = new Date(2000, 4, 29);
77
- var InputTriggerRoot = /*#__PURE__*/function (_Component) {
78
- function InputTriggerRoot() {
79
- _classCallCheck(this, InputTriggerRoot);
80
- return _callSuper(this, InputTriggerRoot, arguments);
61
+ const exampleDate = new Date(2000, 4, 29);
62
+ class InputTriggerRoot extends Component {
63
+ getSingleDateInputProps() {
64
+ const {
65
+ children: _children,
66
+ id,
67
+ role: _role,
68
+ 'aria-haspopup': ariaHasPopup,
69
+ // 'aria-expanded': ariaExpanded,
70
+ 'aria-label': _ariaLabel,
71
+ style: _style,
72
+ ...otherProps
73
+ } = this.asProps;
74
+ return {
75
+ ...otherProps,
76
+ ariaHasPopup,
77
+ inputId: id
78
+ };
81
79
  }
82
- _inherits(InputTriggerRoot, _Component);
83
- return _createClass(InputTriggerRoot, [{
84
- key: "getSingleDateInputProps",
85
- value: function getSingleDateInputProps() {
86
- var _this$asProps = this.asProps,
87
- _children = _this$asProps.children,
88
- id = _this$asProps.id,
89
- _role = _this$asProps.role,
90
- ariaHasPopup = _this$asProps['aria-haspopup'],
91
- _ariaLabel = _this$asProps['aria-label'],
92
- _style = _this$asProps.style,
93
- otherProps = _objectWithoutProperties(_this$asProps, _excluded);
94
- return _objectSpread(_objectSpread({}, otherProps), {}, {
95
- ariaHasPopup: ariaHasPopup,
96
- inputId: id
97
- });
98
- }
99
- }, {
100
- key: "getDateRangeProps",
101
- value: function getDateRangeProps() {
102
- var _this$asProps2 = this.asProps,
103
- _children = _this$asProps2.children,
104
- id = _this$asProps2.id,
105
- _rolw = _this$asProps2.role,
106
- ariaHasPopup = _this$asProps2['aria-haspopup'],
107
- _ariaLabel = _this$asProps2['aria-label'],
108
- _style = _this$asProps2.style,
109
- otherProps = _objectWithoutProperties(_this$asProps2, _excluded2);
110
- return _objectSpread(_objectSpread({}, otherProps), {}, {
111
- ariaHasPopup: ariaHasPopup,
112
- inputId: id
113
- });
114
- }
115
- }, {
116
- key: "render",
117
- value: function render() {
118
- var _ref = this.asProps,
119
- _ref8;
120
- var SInputTrigger = Box;
121
- var _this$asProps3 = this.asProps,
122
- Children = _this$asProps3.Children,
123
- style = _this$asProps3.style,
124
- getI18nText = _this$asProps3.getI18nText;
125
- return _ref8 = sstyled(style), /*#__PURE__*/React.createElement(SInputTrigger, _ref8.cn("SInputTrigger", _objectSpread({}, _assignProps({
80
+ getDateRangeProps() {
81
+ const {
82
+ children: _children,
83
+ id,
84
+ role: _rolw,
85
+ 'aria-haspopup': ariaHasPopup,
86
+ 'aria-label': _ariaLabel,
87
+ // 'aria-expanded': ariaExpanded,
88
+ style: _style,
89
+ ...otherProps
90
+ } = this.asProps;
91
+ return {
92
+ ...otherProps,
93
+ ariaHasPopup,
94
+ inputId: id
95
+ };
96
+ }
97
+ render() {
98
+ var _ref = this.asProps,
99
+ _ref8;
100
+ const SInputTrigger = Box;
101
+ const {
102
+ Children,
103
+ style,
104
+ getI18nText
105
+ } = this.asProps;
106
+ return _ref8 = sstyled(style), /*#__PURE__*/React.createElement(SInputTrigger, _ref8.cn("SInputTrigger", {
107
+ ..._assignProps({
126
108
  "aria-label": getI18nText('input'),
127
109
  "__excludeProps": ['onChange', 'value', 'role', 'id']
128
- }, _ref))), /*#__PURE__*/React.createElement(Children, _ref8.cn("Children", {})));
129
- }
130
- }]);
131
- }(Component);
110
+ }, _ref)
111
+ }), /*#__PURE__*/React.createElement(Children, _ref8.cn("Children", {})));
112
+ }
113
+ }
132
114
  _defineProperty(InputTriggerRoot, "displayName", 'InputTrigger');
133
115
  _defineProperty(InputTriggerRoot, "style", style);
134
116
  _defineProperty(InputTriggerRoot, "defaultProps", {
135
117
  duration: 300,
136
118
  popoverVisible: true
137
119
  });
138
- var SingleDateInputRoot = /*#__PURE__*/function (_Component2) {
139
- function SingleDateInputRoot() {
140
- var _this;
141
- _classCallCheck(this, SingleDateInputRoot);
142
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
143
- args[_key] = arguments[_key];
144
- }
145
- _this = _callSuper(this, SingleDateInputRoot, [].concat(args));
146
- _defineProperty(_this, "state", {
120
+ class SingleDateInputRoot extends Component {
121
+ constructor(...args) {
122
+ super(...args);
123
+ _defineProperty(this, "state", {
147
124
  errorText: null,
148
125
  showError: false,
149
126
  focused: false
150
127
  });
151
- _defineProperty(_this, "handleFocus", function () {
152
- _this.setState({
128
+ _defineProperty(this, "handleFocus", () => {
129
+ this.setState({
153
130
  focused: true
154
131
  });
155
132
  });
156
- _defineProperty(_this, "handleBlur", function () {
157
- _this.setState({
133
+ _defineProperty(this, "handleBlur", () => {
134
+ this.setState({
158
135
  focused: false
159
136
  });
160
137
  });
161
- _defineProperty(_this, "handleInputMaskPipeBlock", function (value) {
162
- if (value === _this.asProps.disabledDateInputAttempt) return;
163
- _this.handlers.disabledDateInputAttempt(value);
138
+ _defineProperty(this, "handleInputMaskPipeBlock", value => {
139
+ if (value === this.asProps.disabledDateInputAttempt) return;
140
+ this.handlers.disabledDateInputAttempt(value);
164
141
  });
165
- return _this;
166
142
  }
167
- _inherits(SingleDateInputRoot, _Component2);
168
- return _createClass(SingleDateInputRoot, [{
169
- key: "uncontrolledProps",
170
- value: function uncontrolledProps() {
171
- var _this2 = this;
172
- return {
173
- disabledDateInputAttempt: [null, function (date) {
174
- var errorText = _this2.state.errorText;
175
- var showError = false;
176
- if (date !== null) {
177
- errorText = _this2.asProps.disabledErrorText;
178
- if (errorText === undefined) {
179
- var key = 'unavailableDate';
180
- if (_this2.asProps.parts && !_this2.asProps.parts.day) {
181
- key = 'unavailableMonth';
182
- }
183
- errorText = _this2.asProps.getI18nText(key);
184
- }
185
- if (typeof errorText === 'function') {
186
- errorText = errorText(date);
143
+ uncontrolledProps() {
144
+ return {
145
+ disabledDateInputAttempt: [null, date => {
146
+ let errorText = this.state.errorText;
147
+ let showError = false;
148
+ if (date !== null) {
149
+ errorText = this.asProps.disabledErrorText;
150
+ if (errorText === undefined) {
151
+ let key = 'unavailableDate';
152
+ if (this.asProps.parts && !this.asProps.parts.day) {
153
+ key = 'unavailableMonth';
187
154
  }
188
- showError = _this2.asProps.disabledErrorText !== null;
155
+ errorText = this.asProps.getI18nText(key);
189
156
  }
190
- _this2.setState({
191
- errorText: errorText,
192
- showError: showError
193
- });
194
- }]
195
- };
196
- }
197
- }, {
198
- key: "getMaskedInputProps",
199
- value: function getMaskedInputProps() {
200
- var _this$asProps4 = this.asProps,
201
- value = _this$asProps4.value,
202
- onChange = _this$asProps4.onChange,
203
- onDisplayedPeriodChange = _this$asProps4.onDisplayedPeriodChange,
204
- locale = _this$asProps4.locale,
205
- _w = _this$asProps4.w,
206
- _ariaHasPopup = _this$asProps4.ariaHasPopup,
207
- _showError = _this$asProps4.showError,
208
- otherProps = _objectWithoutProperties(_this$asProps4, _excluded3);
209
- return _objectSpread({
210
- 'date': value,
211
- 'onDateChange': onChange,
212
- onDisplayedPeriodChange: onDisplayedPeriodChange,
213
- locale: locale,
214
- 'aria-haspopup': 'true',
215
- 'onMaskPipeBlock': this.handleInputMaskPipeBlock
216
- }, otherProps);
217
- }
218
- }, {
219
- key: "render",
220
- value: function render() {
221
- var _ref2 = this.asProps,
222
- _ref9;
223
- var _this$asProps5 = this.asProps,
224
- Children = _this$asProps5.Children,
225
- forwardRef = _this$asProps5.forwardRef,
226
- styles = _this$asProps5.styles,
227
- state = _this$asProps5.state,
228
- showErrorProps = _this$asProps5.showError,
229
- popoverVisible = _this$asProps5.popoverVisible;
230
- var _this$state = this.state,
231
- errorText = _this$state.errorText,
232
- showErrorState = _this$state.showError,
233
- focused = _this$state.focused;
234
- var showError = showErrorState && showErrorProps;
235
- var SSingleDateInput = InputMask;
236
- return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SSingleDateInput, _ref9.cn("SSingleDateInput", _objectSpread({}, _assignProps2({
157
+ if (typeof errorText === 'function') {
158
+ errorText = errorText(date);
159
+ }
160
+ showError = this.asProps.disabledErrorText !== null;
161
+ }
162
+ this.setState({
163
+ errorText,
164
+ showError
165
+ });
166
+ }]
167
+ };
168
+ }
169
+ getMaskedInputProps() {
170
+ const {
171
+ value,
172
+ onChange,
173
+ onDisplayedPeriodChange,
174
+ locale,
175
+ w: _w,
176
+ ariaHasPopup: _ariaHasPopup,
177
+ showError: _showError,
178
+ ...otherProps
179
+ } = this.asProps;
180
+ return {
181
+ 'date': value,
182
+ 'onDateChange': onChange,
183
+ onDisplayedPeriodChange,
184
+ locale,
185
+ 'aria-haspopup': 'true',
186
+ 'onMaskPipeBlock': this.handleInputMaskPipeBlock,
187
+ ...otherProps
188
+ };
189
+ }
190
+ render() {
191
+ var _ref2 = this.asProps,
192
+ _ref9;
193
+ const {
194
+ Children,
195
+ forwardRef,
196
+ styles,
197
+ state,
198
+ showError: showErrorProps,
199
+ popoverVisible
200
+ } = this.asProps;
201
+ const {
202
+ errorText,
203
+ showError: showErrorState,
204
+ focused
205
+ } = this.state;
206
+ const showError = showErrorState && showErrorProps;
207
+ const SSingleDateInput = InputMask;
208
+ return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SSingleDateInput, _ref9.cn("SSingleDateInput", {
209
+ ..._assignProps2({
237
210
  "tag": Tooltip,
238
211
  "placement": 'top-start',
239
212
  "title": errorText,
@@ -244,246 +217,233 @@ var SingleDateInputRoot = /*#__PURE__*/function (_Component2) {
244
217
  "onFocus": this.handleFocus,
245
218
  "onBlur": this.handleBlur,
246
219
  "__excludeProps": ['onChange', 'style', 'aria-expanded']
247
- }, _ref2))), /*#__PURE__*/React.createElement(NeighborLocation, _ref9.cn("NeighborLocation", {}), /*#__PURE__*/React.createElement(Children, _ref9.cn("Children", {}))));
248
- }
249
- }]);
250
- }(Component);
220
+ }, _ref2)
221
+ }), /*#__PURE__*/React.createElement(NeighborLocation, _ref9.cn("NeighborLocation", {}), /*#__PURE__*/React.createElement(Children, _ref9.cn("Children", {}))));
222
+ }
223
+ }
251
224
  _defineProperty(SingleDateInputRoot, "displayName", 'SingleDateInput');
252
225
  _defineProperty(SingleDateInputRoot, "style", style);
253
226
  _defineProperty(SingleDateInputRoot, "defaultProps", {
254
- children: function children() {
255
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SingleDateInput.Indicator, null), /*#__PURE__*/React.createElement(SingleDateInput.MaskedInput, null));
256
- },
227
+ children: () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SingleDateInput.Indicator, null), /*#__PURE__*/React.createElement(SingleDateInput.MaskedInput, null)),
257
228
  defaultDisabledDateInputAttempt: false,
258
229
  showError: true
259
230
  });
260
- var DateRangeRoot = /*#__PURE__*/function (_Component3) {
261
- function DateRangeRoot() {
262
- var _this3;
263
- _classCallCheck(this, DateRangeRoot);
264
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
265
- args[_key2] = arguments[_key2];
266
- }
267
- _this3 = _callSuper(this, DateRangeRoot, [].concat(args));
268
- _defineProperty(_this3, "state", {
231
+ class DateRangeRoot extends Component {
232
+ constructor(...args) {
233
+ super(...args);
234
+ _defineProperty(this, "state", {
269
235
  containerFocused: false,
270
236
  errorText: null,
271
237
  showError: false,
272
238
  lastChangedInput: 'from'
273
239
  });
274
- _defineProperty(_this3, "fromRef", /*#__PURE__*/React.createRef());
275
- _defineProperty(_this3, "toRef", /*#__PURE__*/React.createRef());
276
- _defineProperty(_this3, "handleFromChange", function (value, event) {
277
- var _this3$asProps$value$, _this3$asProps$value, _this3$asProps$value$2, _this3$asProps$value2;
278
- var onChange = _this3.asProps.onChange;
279
- 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];
240
+ _defineProperty(this, "fromRef", /*#__PURE__*/React.createRef());
241
+ _defineProperty(this, "toRef", /*#__PURE__*/React.createRef());
242
+ _defineProperty(this, "handleFromChange", (value, event) => {
243
+ const {
244
+ onChange
245
+ } = this.asProps;
246
+ const prevValue = [this.asProps.value?.[0] ?? null, this.asProps.value?.[1] ?? null];
280
247
  onChange([value, prevValue[1]], event);
281
248
  if (value) {
282
- if (!_this3.toRef.current) return;
283
- _this3.toRef.current.focus();
284
- setTimeout(function () {
285
- if (!_this3.toRef.current) return;
286
- _this3.toRef.current.setSelectionRange(0, 0);
249
+ if (!this.toRef.current) return;
250
+ this.toRef.current.focus();
251
+ setTimeout(() => {
252
+ if (!this.toRef.current) return;
253
+ this.toRef.current.setSelectionRange(0, 0);
287
254
  }, 0);
288
255
  }
289
256
  });
290
- _defineProperty(_this3, "handleToChange", function (value, event) {
291
- var _this3$asProps$value$3, _this3$asProps$value3, _this3$asProps$value$4, _this3$asProps$value4;
292
- var onChange = _this3.asProps.onChange;
293
- 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];
257
+ _defineProperty(this, "handleToChange", (value, event) => {
258
+ const {
259
+ onChange
260
+ } = this.asProps;
261
+ const prevValue = [this.asProps.value?.[0] ?? null, this.asProps.value?.[1] ?? null];
294
262
  onChange([prevValue[0], value], event);
295
263
  });
296
- _defineProperty(_this3, "handleFromKeydown", function (event) {
297
- if (!_this3.toRef.current) return;
298
- if (!_this3.fromRef.current) return;
299
- _this3.setState({
264
+ _defineProperty(this, "handleFromKeydown", event => {
265
+ if (!this.toRef.current) return;
266
+ if (!this.fromRef.current) return;
267
+ this.setState({
300
268
  lastChangedInput: 'from'
301
269
  });
302
- if (event.key === 'ArrowRight' && _this3.fromRef.current.selectionStart === _this3.fromRef.current.value.length && _this3.fromRef.current.selectionEnd === _this3.fromRef.current.value.length) {
303
- _this3.toRef.current.focus();
304
- setTimeout(function () {
305
- _this3.toRef.current.setSelectionRange(0, 0);
270
+ if (event.key === 'ArrowRight' && this.fromRef.current.selectionStart === this.fromRef.current.value.length && this.fromRef.current.selectionEnd === this.fromRef.current.value.length) {
271
+ this.toRef.current.focus();
272
+ setTimeout(() => {
273
+ this.toRef.current.setSelectionRange(0, 0);
306
274
  }, 0);
307
275
  }
308
276
  });
309
- _defineProperty(_this3, "handleToKeydown", function (event) {
310
- if (!_this3.toRef.current) return;
311
- if (!_this3.fromRef.current) return;
312
- _this3.setState({
277
+ _defineProperty(this, "handleToKeydown", event => {
278
+ if (!this.toRef.current) return;
279
+ if (!this.fromRef.current) return;
280
+ this.setState({
313
281
  lastChangedInput: 'to'
314
282
  });
315
- if (event.key === 'Backspace' && !_this3.toRef.current.value) {
316
- var value = _this3.fromRef.current.value;
317
- _this3.fromRef.current.focus();
318
- setTimeout(function () {
319
- _this3.fromRef.current.setSelectionRange(value.length, value.length);
283
+ if (event.key === 'Backspace' && !this.toRef.current.value) {
284
+ const value = this.fromRef.current.value;
285
+ this.fromRef.current.focus();
286
+ setTimeout(() => {
287
+ this.fromRef.current.setSelectionRange(value.length, value.length);
320
288
  }, 0);
321
289
  }
322
- if (event.key === 'ArrowLeft' && _this3.toRef.current.selectionStart === 0 && _this3.toRef.current.selectionEnd === 0) {
323
- var _value = _this3.fromRef.current.value;
324
- _this3.fromRef.current.focus();
325
- setTimeout(function () {
326
- _this3.fromRef.current.setSelectionRange(_value.length, _value.length);
290
+ if (event.key === 'ArrowLeft' && this.toRef.current.selectionStart === 0 && this.toRef.current.selectionEnd === 0) {
291
+ const value = this.fromRef.current.value;
292
+ this.fromRef.current.focus();
293
+ setTimeout(() => {
294
+ this.fromRef.current.setSelectionRange(value.length, value.length);
327
295
  }, 0);
328
296
  }
329
297
  });
330
- _defineProperty(_this3, "handleInputMaskPipeBlock", function (value) {
331
- if (value === _this3.asProps.disabledDateInputAttempt) return;
332
- _this3.handlers.disabledDateInputAttempt(value);
298
+ _defineProperty(this, "handleInputMaskPipeBlock", value => {
299
+ if (value === this.asProps.disabledDateInputAttempt) return;
300
+ this.handlers.disabledDateInputAttempt(value);
333
301
  });
334
- _defineProperty(_this3, "handleFocus", function () {
335
- _this3.setState({
302
+ _defineProperty(this, "handleFocus", () => {
303
+ this.setState({
336
304
  containerFocused: true
337
305
  });
338
306
  });
339
- _defineProperty(_this3, "handleBlur", function () {
340
- _this3.setState({
307
+ _defineProperty(this, "handleBlur", () => {
308
+ this.setState({
341
309
  containerFocused: false
342
310
  });
343
311
  });
344
- _defineProperty(_this3, "updateDisabledDateInputAttempt", function (value) {
345
- var disabledDates = _this3.asProps.disabledDates;
346
- var invalid = false;
312
+ _defineProperty(this, "updateDisabledDateInputAttempt", value => {
313
+ const {
314
+ disabledDates
315
+ } = this.asProps;
316
+ let invalid = false;
347
317
  if (value) {
348
- if (value[0] && value[1]) invalid = disabledDates.some(datesIntersects([value[0], value[1]], _this3.asProps.unit));else if (value[0]) invalid = disabledDates.some(includesDate(dayjs(value[0]), _this3.asProps.unit));else if (value[1]) invalid = disabledDates.some(includesDate(dayjs(value[1]), _this3.asProps.unit));
318
+ if (value[0] && value[1]) invalid = disabledDates.some(datesIntersects([value[0], value[1]], this.asProps.unit));else if (value[0]) invalid = disabledDates.some(includesDate(dayjs(value[0]), this.asProps.unit));else if (value[1]) invalid = disabledDates.some(includesDate(dayjs(value[1]), this.asProps.unit));
349
319
  }
350
320
  if (invalid) {
351
- var invalidValue = _this3.state.lastChangedInput === 'to' ? value[1] : value[0];
352
- setTimeout(function () {
353
- if (value === _this3.asProps.disabledDateInputAttempt) return;
354
- _this3.handlers.disabledDateInputAttempt(invalidValue);
321
+ const invalidValue = this.state.lastChangedInput === 'to' ? value[1] : value[0];
322
+ setTimeout(() => {
323
+ if (value === this.asProps.disabledDateInputAttempt) return;
324
+ this.handlers.disabledDateInputAttempt(invalidValue);
355
325
  }, 0);
356
326
  }
357
327
  });
358
- return _this3;
359
328
  }
360
- _inherits(DateRangeRoot, _Component3);
361
- return _createClass(DateRangeRoot, [{
362
- key: "uncontrolledProps",
363
- value: function uncontrolledProps() {
364
- var _this4 = this;
365
- return {
366
- disabledDateInputAttempt: [null, function (date) {
367
- var errorText = _this4.state.errorText;
368
- var showError = false;
369
- if (date !== null) {
370
- errorText = _this4.asProps.disabledErrorText;
371
- if (errorText === undefined) {
372
- var key = 'unavailableDate';
373
- if (_this4.asProps.parts && !_this4.asProps.parts.day) {
374
- key = 'unavailableMonth';
375
- }
376
- if (_this4.state.lastChangedInput === 'to') {
377
- key = 'unavailableEndDate';
378
- if (_this4.asProps.parts && !_this4.asProps.parts.day) {
379
- key = 'unavailableEndMonth';
380
- }
381
- }
382
- errorText = _this4.asProps.getI18nText(key);
329
+ uncontrolledProps() {
330
+ return {
331
+ disabledDateInputAttempt: [null, date => {
332
+ let errorText = this.state.errorText;
333
+ let showError = false;
334
+ if (date !== null) {
335
+ errorText = this.asProps.disabledErrorText;
336
+ if (errorText === undefined) {
337
+ let key = 'unavailableDate';
338
+ if (this.asProps.parts && !this.asProps.parts.day) {
339
+ key = 'unavailableMonth';
383
340
  }
384
- if (typeof errorText === 'function') {
385
- errorText = errorText(date);
341
+ if (this.state.lastChangedInput === 'to') {
342
+ key = 'unavailableEndDate';
343
+ if (this.asProps.parts && !this.asProps.parts.day) {
344
+ key = 'unavailableEndMonth';
345
+ }
386
346
  }
387
- showError = _this4.asProps.disabledErrorText !== null;
347
+ errorText = this.asProps.getI18nText(key);
388
348
  }
389
- _this4.setState({
390
- errorText: errorText,
391
- showError: showError
392
- });
393
- }]
394
- };
395
- }
396
- }, {
397
- key: "getFromMaskedInputProps",
398
- value: function getFromMaskedInputProps() {
399
- var _this$asProps6 = this.asProps,
400
- value = _this$asProps6.value,
401
- locale = _this$asProps6.locale,
402
- onDisplayedPeriodChange = _this$asProps6.onDisplayedPeriodChange,
403
- ariaHasPopup = _this$asProps6.ariaHasPopup,
404
- _showError = _this$asProps6.showError,
405
- otherProps = _objectWithoutProperties(_this$asProps6, _excluded4);
406
- return assignProps({
407
- 'ref': this.fromRef,
408
- 'date': value === null || value === void 0 ? void 0 : value[0],
409
- 'onDateChange': this.handleFromChange,
410
- 'onKeyDown': this.handleFromKeydown,
411
- locale: locale,
412
- 'flex': 1,
413
- onDisplayedPeriodChange: onDisplayedPeriodChange,
414
- 'aria-haspopup': ariaHasPopup,
415
- 'onMaskPipeBlock': this.handleInputMaskPipeBlock,
416
- 'containerFocused': this.state.containerFocused
417
- }, otherProps);
418
- }
419
- }, {
420
- key: "getToMaskedInputProps",
421
- value: function getToMaskedInputProps() {
422
- var _this$asProps7 = this.asProps,
423
- value = _this$asProps7.value,
424
- locale = _this$asProps7.locale,
425
- onDisplayedPeriodChange = _this$asProps7.onDisplayedPeriodChange,
426
- ariaHasPopup = _this$asProps7.ariaHasPopup,
427
- _inputId = _this$asProps7.inputId,
428
- _showError = _this$asProps7.showError,
429
- otherProps = _objectWithoutProperties(_this$asProps7, _excluded5);
430
- var ariaLabel = this.asProps.getI18nText('toDate', {
431
- date: this.asProps.getI18nText('input')
432
- });
433
- return assignProps({
434
- 'ref': this.toRef,
435
- 'date': value === null || value === void 0 ? void 0 : value[1],
436
- 'onDateChange': this.handleToChange,
437
- 'onKeyDown': this.handleToKeydown,
438
- locale: locale,
439
- 'flex': 1,
440
- onDisplayedPeriodChange: onDisplayedPeriodChange,
441
- 'aria-label': ariaLabel,
442
- 'aria-haspopup': ariaHasPopup,
443
- 'onMaskPipeBlock': this.handleInputMaskPipeBlock,
444
- 'containerFocused': this.state.containerFocused
445
- }, otherProps);
446
- }
447
- }, {
448
- key: "getRangeSepProps",
449
- value: function getRangeSepProps() {
450
- var value = this.asProps.value;
451
- return {
452
- fulfilled: !!(value && (value[0] || value[1]))
453
- };
454
- }
455
- }, {
456
- key: "componentDidUpdate",
457
- value: function componentDidUpdate(prevProps) {
458
- if (prevProps.value !== this.asProps.value) {
459
- this.updateDisabledDateInputAttempt(this.asProps.value);
460
- }
461
- }
462
- }, {
463
- key: "componentDidMount",
464
- value: function componentDidMount() {
349
+ if (typeof errorText === 'function') {
350
+ errorText = errorText(date);
351
+ }
352
+ showError = this.asProps.disabledErrorText !== null;
353
+ }
354
+ this.setState({
355
+ errorText,
356
+ showError
357
+ });
358
+ }]
359
+ };
360
+ }
361
+ getFromMaskedInputProps() {
362
+ const {
363
+ value,
364
+ locale,
365
+ onDisplayedPeriodChange,
366
+ ariaHasPopup,
367
+ showError: _showError,
368
+ ...otherProps
369
+ } = this.asProps;
370
+ return assignProps({
371
+ 'ref': this.fromRef,
372
+ 'date': value?.[0],
373
+ 'onDateChange': this.handleFromChange,
374
+ 'onKeyDown': this.handleFromKeydown,
375
+ locale,
376
+ 'flex': 1,
377
+ onDisplayedPeriodChange,
378
+ 'aria-haspopup': ariaHasPopup,
379
+ 'onMaskPipeBlock': this.handleInputMaskPipeBlock,
380
+ 'containerFocused': this.state.containerFocused
381
+ }, otherProps);
382
+ }
383
+ getToMaskedInputProps() {
384
+ const {
385
+ value,
386
+ locale,
387
+ onDisplayedPeriodChange,
388
+ ariaHasPopup,
389
+ inputId: _inputId,
390
+ showError: _showError,
391
+ ...otherProps
392
+ } = this.asProps;
393
+ const ariaLabel = this.asProps.getI18nText('toDate', {
394
+ date: this.asProps.getI18nText('input')
395
+ });
396
+ return assignProps({
397
+ 'ref': this.toRef,
398
+ 'date': value?.[1],
399
+ 'onDateChange': this.handleToChange,
400
+ 'onKeyDown': this.handleToKeydown,
401
+ locale,
402
+ 'flex': 1,
403
+ onDisplayedPeriodChange,
404
+ 'aria-label': ariaLabel,
405
+ 'aria-haspopup': ariaHasPopup,
406
+ 'onMaskPipeBlock': this.handleInputMaskPipeBlock,
407
+ 'containerFocused': this.state.containerFocused
408
+ }, otherProps);
409
+ }
410
+ getRangeSepProps() {
411
+ const {
412
+ value
413
+ } = this.asProps;
414
+ return {
415
+ fulfilled: !!(value && (value[0] || value[1]))
416
+ };
417
+ }
418
+ componentDidUpdate(prevProps) {
419
+ if (prevProps.value !== this.asProps.value) {
465
420
  this.updateDisabledDateInputAttempt(this.asProps.value);
466
421
  }
467
- }, {
468
- key: "render",
469
- value: function render() {
470
- var _ref3 = this.asProps,
471
- _ref0;
472
- var SDateRange = InputMask;
473
- var _this$asProps8 = this.asProps,
474
- Children = _this$asProps8.Children,
475
- styles = _this$asProps8.styles,
476
- w = _this$asProps8.w,
477
- state = _this$asProps8.state,
478
- showErrorProps = _this$asProps8.showError,
479
- popoverVisible = _this$asProps8.popoverVisible;
480
- var _this$state2 = this.state,
481
- errorText = _this$state2.errorText,
482
- lastChangedInput = _this$state2.lastChangedInput,
483
- showErrorState = _this$state2.showError,
484
- containerFocused = _this$state2.containerFocused;
485
- var showError = showErrorState && showErrorProps;
486
- return _ref0 = sstyled(styles), /*#__PURE__*/React.createElement(SDateRange, _ref0.cn("SDateRange", _objectSpread({}, _assignProps3({
422
+ }
423
+ componentDidMount() {
424
+ this.updateDisabledDateInputAttempt(this.asProps.value);
425
+ }
426
+ render() {
427
+ var _ref3 = this.asProps,
428
+ _ref0;
429
+ const SDateRange = InputMask;
430
+ const {
431
+ Children,
432
+ styles,
433
+ w,
434
+ state,
435
+ showError: showErrorProps,
436
+ popoverVisible
437
+ } = this.asProps;
438
+ const {
439
+ errorText,
440
+ lastChangedInput,
441
+ showError: showErrorState,
442
+ containerFocused
443
+ } = this.state;
444
+ const showError = showErrorState && showErrorProps;
445
+ return _ref0 = sstyled(styles), /*#__PURE__*/React.createElement(SDateRange, _ref0.cn("SDateRange", {
446
+ ..._assignProps3({
487
447
  "tag": Tooltip,
488
448
  "ignorePortalsStacking": true,
489
449
  "placement": lastChangedInput === 'to' ? 'top-end' : 'top-start',
@@ -495,89 +455,94 @@ var DateRangeRoot = /*#__PURE__*/function (_Component3) {
495
455
  "w": w,
496
456
  "onFocus": this.handleFocus,
497
457
  "onBlur": this.handleBlur
498
- }, _ref3))), /*#__PURE__*/React.createElement(Children, _ref0.cn("Children", {})));
499
- }
500
- }]);
501
- }(Component);
458
+ }, _ref3)
459
+ }), /*#__PURE__*/React.createElement(Children, _ref0.cn("Children", {})));
460
+ }
461
+ }
502
462
  _defineProperty(DateRangeRoot, "displayName", 'DateRange');
503
463
  _defineProperty(DateRangeRoot, "style", style);
504
464
  _defineProperty(DateRangeRoot, "defaultProps", {
505
- children: function children() {
506
- 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));
507
- },
465
+ children: () => /*#__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)),
508
466
  defaultDisabledDateInputAttempt: false,
509
467
  showError: true
510
468
  });
511
469
  function FromMaskedInput(props) {
512
470
  var _ref4 = arguments[0],
513
471
  _ref1;
514
- var SFromMaskedInput = MaskedInput;
515
- var getI18nText = props.getI18nText;
516
- return _ref1 = sstyled(props.styles), /*#__PURE__*/React.createElement(SFromMaskedInput, _ref1.cn("SFromMaskedInput", _objectSpread({}, _assignProps4({
517
- "labelPrefix": getI18nText('fromDatePlaceholder')
518
- }, _ref4))));
472
+ const SFromMaskedInput = MaskedInput;
473
+ const {
474
+ getI18nText
475
+ } = props;
476
+ return _ref1 = sstyled(props.styles), /*#__PURE__*/React.createElement(SFromMaskedInput, _ref1.cn("SFromMaskedInput", {
477
+ ..._assignProps4({
478
+ "labelPrefix": getI18nText('fromDatePlaceholder')
479
+ }, _ref4)
480
+ }));
519
481
  }
520
482
  function ToMaskedInput(props) {
521
483
  var _ref5 = arguments[0],
522
484
  _ref10;
523
- var SToMaskedInput = MaskedInput;
524
- var getI18nText = props.getI18nText;
525
- return _ref10 = sstyled(props.styles), /*#__PURE__*/React.createElement(SToMaskedInput, _ref10.cn("SToMaskedInput", _objectSpread({}, _assignProps5({
526
- "labelPrefix": getI18nText('toDatePlaceholder')
527
- }, _ref5))));
485
+ const SToMaskedInput = MaskedInput;
486
+ const {
487
+ getI18nText
488
+ } = props;
489
+ return _ref10 = sstyled(props.styles), /*#__PURE__*/React.createElement(SToMaskedInput, _ref10.cn("SToMaskedInput", {
490
+ ..._assignProps5({
491
+ "labelPrefix": getI18nText('toDatePlaceholder')
492
+ }, _ref5)
493
+ }));
528
494
  }
529
495
  function Indicator(props) {
530
496
  var _ref6 = arguments[0],
531
497
  _ref11;
532
- var SIndicator = InputMask.Addon;
533
- return _ref11 = sstyled(props.styles), /*#__PURE__*/React.createElement(SIndicator, _ref11.cn("SIndicator", _objectSpread({}, _assignProps6({
534
- "tag": Calendar,
535
- "aria-hidden": 'true',
536
- "tabIndex": -1
537
- }, _ref6))));
498
+ const SIndicator = InputMask.Addon;
499
+ return _ref11 = sstyled(props.styles), /*#__PURE__*/React.createElement(SIndicator, _ref11.cn("SIndicator", {
500
+ ..._assignProps6({
501
+ "tag": Calendar,
502
+ "aria-hidden": 'true',
503
+ "tabIndex": -1
504
+ }, _ref6)
505
+ }));
538
506
  }
539
507
  function RangeSep(props) {
540
508
  var _ref7 = arguments[0],
541
509
  _ref12;
542
- var SRangeSep = InputMask.Addon;
543
- return _ref12 = sstyled(props.styles), /*#__PURE__*/React.createElement(SRangeSep, _ref12.cn("SRangeSep", _objectSpread({}, _assignProps7({
544
- "tag": Flex,
545
- "alignItems": 'center',
546
- "justifyContent": 'center',
547
- "pl": 0,
548
- "flex": '0'
549
- }, _ref7))), "\u2013");
510
+ const SRangeSep = InputMask.Addon;
511
+ return _ref12 = sstyled(props.styles), /*#__PURE__*/React.createElement(SRangeSep, _ref12.cn("SRangeSep", {
512
+ ..._assignProps7({
513
+ "tag": Flex,
514
+ "alignItems": 'center',
515
+ "justifyContent": 'center',
516
+ "pl": 0,
517
+ "flex": '0'
518
+ }, _ref7)
519
+ }), "\u2013");
550
520
  }
551
- function MaskedInput(_ref14) {
521
+ function MaskedInput({
522
+ date: outerValue,
523
+ onDateChange,
524
+ onDisplayedPeriodChange,
525
+ locale,
526
+ styles,
527
+ parts: allowedParts = defaultAllowedParts,
528
+ disabledDates,
529
+ forwardRef,
530
+ placeholders: providedPlaceholders,
531
+ labelPrefix = 'Date',
532
+ onMaskPipeBlock,
533
+ containerFocused,
534
+ animationsDisabled,
535
+ getI18nText,
536
+ inputId,
537
+ inputRole = 'combobox',
538
+ __excludeProps,
539
+ Root: _root,
540
+ ...otherProps
541
+ }) {
552
542
  var _ref13;
553
- var outerValue = _ref14.date,
554
- onDateChange = _ref14.onDateChange,
555
- onDisplayedPeriodChange = _ref14.onDisplayedPeriodChange,
556
- locale = _ref14.locale,
557
- styles = _ref14.styles,
558
- _ref14$parts = _ref14.parts,
559
- allowedParts = _ref14$parts === void 0 ? defaultAllowedParts : _ref14$parts,
560
- disabledDates = _ref14.disabledDates,
561
- forwardRef = _ref14.forwardRef,
562
- providedPlaceholders = _ref14.placeholders,
563
- _ref14$labelPrefix = _ref14.labelPrefix,
564
- labelPrefix = _ref14$labelPrefix === void 0 ? 'Date' : _ref14$labelPrefix,
565
- onMaskPipeBlock = _ref14.onMaskPipeBlock,
566
- containerFocused = _ref14.containerFocused,
567
- animationsDisabled = _ref14.animationsDisabled,
568
- getI18nText = _ref14.getI18nText,
569
- inputId = _ref14.inputId,
570
- _ref14$inputRole = _ref14.inputRole,
571
- inputRole = _ref14$inputRole === void 0 ? 'combobox' : _ref14$inputRole,
572
- __excludeProps = _ref14.__excludeProps,
573
- _root = _ref14.Root,
574
- otherProps = _objectWithoutProperties(_ref14, _excluded6);
575
- var ref = React.useRef();
576
- var _React$useState = React.useState(undefined),
577
- _React$useState2 = _slicedToArray(_React$useState, 2),
578
- width = _React$useState2[0],
579
- setWidth = _React$useState2[1];
580
- var placeholders = React.useMemo(function () {
543
+ const ref = React.useRef();
544
+ const [width, setWidth] = React.useState(undefined);
545
+ const placeholders = React.useMemo(() => {
581
546
  if (providedPlaceholders) return providedPlaceholders;
582
547
  return {
583
548
  year: getI18nText('placeholder-years'),
@@ -588,51 +553,43 @@ function MaskedInput(_ref14) {
588
553
  if (placeholders.year.length !== 1 || placeholders.month.length !== 1 || placeholders.day.length !== 1) {
589
554
  // eslint-disable-next-line no-console
590
555
  console.error({
591
- placeholders: placeholders
556
+ placeholders
592
557
  });
593
- 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);
558
+ 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] (${placeholders})`, placeholders);
594
559
  }
595
- var _React$useMemo = React.useMemo(function () {
596
- var options = {
597
- year: 'numeric',
598
- month: 'numeric',
599
- day: 'numeric'
600
- };
601
- var dateTimeFormat = new Intl.DateTimeFormat(locale, options);
602
- var sep = undefined;
603
- var order = [];
604
- var parts = dateTimeFormat.formatToParts(exampleDate);
605
- var _iterator = _createForOfIteratorHelper(parts),
606
- _step;
607
- try {
608
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
609
- var part = _step.value;
610
- if (!sep && part.type === 'literal') {
611
- sep = part.value;
612
- }
613
- if (order.length < 3 && ['day', 'month', 'year'].includes(part.type) && allowedParts[part.type]) {
614
- order.push(part.type);
615
- }
616
- }
617
- } catch (err) {
618
- _iterator.e(err);
619
- } finally {
620
- _iterator.f();
560
+ const {
561
+ sep,
562
+ order
563
+ } = React.useMemo(() => {
564
+ const options = {
565
+ year: 'numeric',
566
+ month: 'numeric',
567
+ day: 'numeric'
568
+ };
569
+ const dateTimeFormat = new Intl.DateTimeFormat(locale, options);
570
+ let sep = undefined;
571
+ const order = [];
572
+ const parts = dateTimeFormat.formatToParts(exampleDate);
573
+ for (const part of parts) {
574
+ if (!sep && part.type === 'literal') {
575
+ sep = part.value;
621
576
  }
622
- sep = sep !== null && sep !== void 0 ? sep : ' ';
623
- return {
624
- sep: sep,
625
- order: order
626
- };
627
- }, [locale, allowedParts]),
628
- sep = _React$useMemo.sep,
629
- order = _React$useMemo.order;
630
- var outer = React.useMemo(function () {
631
- var outerDate = outerValue;
577
+ if (order.length < 3 && ['day', 'month', 'year'].includes(part.type) && allowedParts[part.type]) {
578
+ order.push(part.type);
579
+ }
580
+ }
581
+ sep = sep ?? ' ';
582
+ return {
583
+ sep,
584
+ order
585
+ };
586
+ }, [locale, allowedParts]);
587
+ const outer = React.useMemo(() => {
588
+ let outerDate = outerValue;
632
589
  if (typeof outerValue === 'number' || typeof outerValue === 'string') {
633
590
  outerDate = new Date(outerValue);
634
591
  }
635
- var validDate = outerDate && outerDate instanceof Date && !Number.isNaN(outerDate.getTime());
592
+ const validDate = outerDate && outerDate instanceof Date && !Number.isNaN(outerDate.getTime());
636
593
  if (!validDate) return null;
637
594
  return {
638
595
  year: outerDate.getFullYear().toString().padStart(4, '0'),
@@ -640,89 +597,67 @@ function MaskedInput(_ref14) {
640
597
  day: outerDate.getDate().toString().padStart(2, '0')
641
598
  };
642
599
  }, [outerValue]);
643
- var stringifyValue = React.useCallback(function (value) {
600
+ const stringifyValue = React.useCallback(value => {
644
601
  if (!value) return null;
645
602
  if (!value.year && !value.month && !value.day) return null;
646
- var result = [];
647
- var _iterator2 = _createForOfIteratorHelper(order),
648
- _step2;
649
- try {
650
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
651
- var part = _step2.value;
652
- if (!allowedParts[part]) continue;
653
- if (part === 'year' && value.year) result.push(value.year);
654
- if (part === 'month' && value.month) result.push(value.month);
655
- if (part === 'day' && value.day) result.push(value.day);
656
- }
657
- } catch (err) {
658
- _iterator2.e(err);
659
- } finally {
660
- _iterator2.f();
603
+ const result = [];
604
+ for (const part of order) {
605
+ if (!allowedParts[part]) continue;
606
+ if (part === 'year' && value.year) result.push(value.year);
607
+ if (part === 'month' && value.month) result.push(value.month);
608
+ if (part === 'day' && value.day) result.push(value.day);
661
609
  }
662
610
  return result.join(sep);
663
611
  }, [order, allowedParts]);
664
- var _React$useState3 = React.useState(outer),
665
- _React$useState4 = _slicedToArray(_React$useState3, 2),
666
- internalValue = _React$useState4[0],
667
- setInternalValue = _React$useState4[1];
668
- var value = React.useMemo(function () {
669
- return stringifyValue(internalValue);
670
- }, [stringifyValue, internalValue]);
671
- var lastKnownOuterValue = React.useRef(outer);
672
- React.useEffect(function () {
673
- var _lastKnownOuterValue$, _lastKnownOuterValue$2, _lastKnownOuterValue$3;
674
- 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)) {
612
+ const [internalValue, setInternalValue] = React.useState(outer);
613
+ const value = React.useMemo(() => stringifyValue(internalValue), [stringifyValue, internalValue]);
614
+ const lastKnownOuterValue = React.useRef(outer);
615
+ React.useEffect(() => {
616
+ if (lastKnownOuterValue.current?.day !== outer?.day || lastKnownOuterValue.current?.month !== outer?.month || lastKnownOuterValue.current?.year !== outer?.year) {
675
617
  setInternalValue(outer);
676
618
  }
677
619
  lastKnownOuterValue.current = outer;
678
620
  }, [outer, setInternalValue]);
679
- var pipeMask = React.useCallback(function (value) {
680
- var placeholdersOnly = true;
681
- for (var i = 0; i < value.length; i++) {
621
+ const pipeMask = React.useCallback(value => {
622
+ let placeholdersOnly = true;
623
+ for (let i = 0; i < value.length; i++) {
682
624
  if (value[i] !== '_' && value[i] !== sep) {
683
625
  placeholdersOnly = false;
684
626
  break;
685
627
  }
686
628
  }
687
629
  if (placeholdersOnly) {
688
- onMaskPipeBlock === null || onMaskPipeBlock === void 0 || onMaskPipeBlock(null);
630
+ onMaskPipeBlock?.(null);
689
631
  return '';
690
632
  }
691
- var getOffsetTo = function getOffsetTo(partName) {
692
- var partsBefore = order.slice(0, order.indexOf(partName));
693
- var offset = 0;
694
- var _iterator3 = _createForOfIteratorHelper(partsBefore),
695
- _step3;
696
- try {
697
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
698
- var part = _step3.value;
699
- if (part === 'year' && allowedParts.year) offset += 4;
700
- if (part === 'month' && allowedParts.month) offset += 2;
701
- if (part === 'day' && allowedParts.day) offset += 2;
702
- }
703
- } catch (err) {
704
- _iterator3.e(err);
705
- } finally {
706
- _iterator3.f();
633
+ const getOffsetTo = partName => {
634
+ const partsBefore = order.slice(0, order.indexOf(partName));
635
+ let offset = 0;
636
+ for (const part of partsBefore) {
637
+ if (part === 'year' && allowedParts.year) offset += 4;
638
+ if (part === 'month' && allowedParts.month) offset += 2;
639
+ if (part === 'day' && allowedParts.day) offset += 2;
707
640
  }
708
641
  offset += partsBefore.length * sep.length;
709
642
  return offset;
710
643
  };
711
- var indexesOfPipedChars = [];
712
- var parsed = {};
713
- var parts = value.split(sep);
714
- for (var partName in placeholders) {
644
+ const indexesOfPipedChars = [];
645
+ const parsed = {};
646
+ const parts = value.split(sep);
647
+ for (const partName in placeholders) {
715
648
  parsed[partName] = placeholders[partName];
716
649
  }
717
- for (var _i = 0; _i < order.length; _i++) {
718
- parsed[order[_i]] = parts[_i];
650
+ for (let i = 0; i < order.length; i++) {
651
+ parsed[order[i]] = parts[i];
719
652
  }
720
- var year = parsed.year,
721
- month = parsed.month,
722
- day = parsed.day;
653
+ let {
654
+ year,
655
+ month,
656
+ day
657
+ } = parsed;
723
658
  if (allowedParts.month) {
724
659
  if (month[0] !== '_' && Number.parseInt(month[0], 10) > 1) {
725
- month = "0".concat(month[0]);
660
+ month = `0${month[0]}`;
726
661
  indexesOfPipedChars.push(getOffsetTo('month'));
727
662
  }
728
663
  if (month === '00') month = '01';
@@ -730,95 +665,82 @@ function MaskedInput(_ref14) {
730
665
  }
731
666
  if (allowedParts.day) {
732
667
  if (day[0] !== '_' && Number.parseInt(day[0], 10) > 3) {
733
- day = "0".concat(day[0]);
668
+ day = `0${day[0]}`;
734
669
  indexesOfPipedChars.push(getOffsetTo('day'));
735
670
  }
736
671
  if (day === '00') day = '01';
737
672
  if (day[0] !== '_' && day[1] !== '_' && Number.parseInt(day, 10) > 31) return false;
738
673
  }
739
- year = year.split('').map(function (_char) {
740
- return _char === '_' ? placeholders.year : _char;
741
- }).join('');
742
- month = month.split('').map(function (_char2) {
743
- return _char2 === '_' ? placeholders.month : _char2;
744
- }).join('');
745
- day = day.split('').map(function (_char3) {
746
- return _char3 === '_' ? placeholders.day : _char3;
747
- }).join('');
748
- var yearFulfilled = !allowedParts.year || year && year.length >= 4 && !year.includes(placeholders.year);
749
- var monthFulfilled = !allowedParts.month || month && month.length === 2 && !month.includes(placeholders.month);
750
- var dayFulfilled = !allowedParts.day || day && day.length === 2 && !day.includes(placeholders.day);
751
- var fulfilled = yearFulfilled && monthFulfilled && dayFulfilled;
674
+ year = year.split('').map(char => char === '_' ? placeholders.year : char).join('');
675
+ month = month.split('').map(char => char === '_' ? placeholders.month : char).join('');
676
+ day = day.split('').map(char => char === '_' ? placeholders.day : char).join('');
677
+ const yearFulfilled = !allowedParts.year || year && year.length >= 4 && !year.includes(placeholders.year);
678
+ const monthFulfilled = !allowedParts.month || month && month.length === 2 && !month.includes(placeholders.month);
679
+ const dayFulfilled = !allowedParts.day || day && day.length === 2 && !day.includes(placeholders.day);
680
+ const fulfilled = yearFulfilled && monthFulfilled && dayFulfilled;
752
681
  if (fulfilled) {
753
- var date = new Date(0, 0, 0, 0, 0, 0, 0);
754
- var yearParsed = allowedParts.year ? Number.parseInt(year, 10) : 0;
755
- var monthParsed = allowedParts.month ? Number.parseInt(month, 10) - 1 : 0;
756
- var dayParsed = allowedParts.day ? Number.parseInt(day, 10) : 1;
682
+ const date = new Date(0, 0, 0, 0, 0, 0, 0);
683
+ const yearParsed = allowedParts.year ? Number.parseInt(year, 10) : 0;
684
+ const monthParsed = allowedParts.month ? Number.parseInt(month, 10) - 1 : 0;
685
+ const dayParsed = allowedParts.day ? Number.parseInt(day, 10) : 1;
757
686
  date.setFullYear(yearParsed, monthParsed, dayParsed);
758
- if (disabledDates !== null && disabledDates !== void 0 && disabledDates.some(includesDate(dayjs(date), 'date'))) {
759
- onMaskPipeBlock === null || onMaskPipeBlock === void 0 || onMaskPipeBlock(date);
687
+ if (disabledDates?.some(includesDate(dayjs(date), 'date'))) {
688
+ onMaskPipeBlock?.(date);
760
689
  return false;
761
690
  }
762
691
  if (allowedParts.day) {
763
692
  if (date.getDate() !== Number.parseInt(day, 10)) {
764
- onMaskPipeBlock === null || onMaskPipeBlock === void 0 || onMaskPipeBlock(date);
693
+ onMaskPipeBlock?.(date);
765
694
  return false;
766
695
  }
767
696
  }
768
697
  }
769
- var result = [];
770
- var _iterator4 = _createForOfIteratorHelper(order),
771
- _step4;
772
- try {
773
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
774
- var part = _step4.value;
775
- if (part === 'year') result.push(year);
776
- if (part === 'month') result.push(month);
777
- if (part === 'day') result.push(day);
778
- }
779
- } catch (err) {
780
- _iterator4.e(err);
781
- } finally {
782
- _iterator4.f();
698
+ const result = [];
699
+ for (const part of order) {
700
+ if (part === 'year') result.push(year);
701
+ if (part === 'month') result.push(month);
702
+ if (part === 'day') result.push(day);
783
703
  }
784
- onMaskPipeBlock === null || onMaskPipeBlock === void 0 || onMaskPipeBlock(null);
704
+ onMaskPipeBlock?.(null);
785
705
  return {
786
706
  value: result.join(sep),
787
- indexesOfPipedChars: indexesOfPipedChars
707
+ indexesOfPipedChars
788
708
  };
789
709
  }, [placeholders, sep, order, allowedParts, disabledDates, onMaskPipeBlock]);
790
- var handleChange = React.useCallback(function (value) {
791
- var parsed = {};
792
- for (var partName in placeholders) {
710
+ const handleChange = React.useCallback(value => {
711
+ const parsed = {};
712
+ for (const partName in placeholders) {
793
713
  parsed[partName] = placeholders[partName];
794
714
  }
795
- var parts = value.split(sep);
796
- for (var i = 0; i < order.length; i++) {
715
+ const parts = value.split(sep);
716
+ for (let i = 0; i < order.length; i++) {
797
717
  parsed[order[i]] = parts[i];
798
718
  }
799
- var year = parsed.year,
800
- month = parsed.month,
801
- day = parsed.day;
719
+ const {
720
+ year,
721
+ month,
722
+ day
723
+ } = parsed;
802
724
  setInternalValue({
803
- year: year,
804
- month: month,
805
- day: day
725
+ year,
726
+ month,
727
+ day
806
728
  });
807
- var yearFulfilled = !allowedParts.year || year && year.length >= 4 && !year.includes(placeholders.year);
808
- var monthFulfilled = !allowedParts.month || month && month.length === 2 && !month.includes(placeholders.month);
809
- var dayFulfilled = !allowedParts.day || day && day.length === 2 && !day.includes(placeholders.day);
810
- var fulfilled = yearFulfilled && monthFulfilled && dayFulfilled;
729
+ const yearFulfilled = !allowedParts.year || year && year.length >= 4 && !year.includes(placeholders.year);
730
+ const monthFulfilled = !allowedParts.month || month && month.length === 2 && !month.includes(placeholders.month);
731
+ const dayFulfilled = !allowedParts.day || day && day.length === 2 && !day.includes(placeholders.day);
732
+ const fulfilled = yearFulfilled && monthFulfilled && dayFulfilled;
811
733
  if (fulfilled) {
812
- var date = new Date(0, 0, 0, 0, 0, 0, 0);
813
- var yearParsed = allowedParts.year ? Number.parseInt(year, 10) : 0;
814
- var monthParsed = allowedParts.month ? Number.parseInt(month, 10) - 1 : 0;
815
- var dayParsed = allowedParts.day ? Number.parseInt(day, 10) : 1;
734
+ const date = new Date(0, 0, 0, 0, 0, 0, 0);
735
+ const yearParsed = allowedParts.year ? Number.parseInt(year, 10) : 0;
736
+ const monthParsed = allowedParts.month ? Number.parseInt(month, 10) - 1 : 0;
737
+ const dayParsed = allowedParts.day ? Number.parseInt(day, 10) : 1;
816
738
  date.setFullYear(yearParsed, monthParsed, dayParsed);
817
739
  onDateChange(date);
818
740
  lastKnownOuterValue.current = {
819
- year: year,
820
- month: month,
821
- day: day
741
+ year,
742
+ month,
743
+ day
822
744
  };
823
745
  return;
824
746
  }
@@ -827,44 +749,40 @@ function MaskedInput(_ref14) {
827
749
  lastKnownOuterValue.current = null;
828
750
  }
829
751
  if (yearFulfilled && allowedParts.year) {
830
- var _date = new Date(0, 0, 0, 0, 0, 0, 0);
831
- _date.setFullYear(Number.parseInt(year, 10));
752
+ const date = new Date(0, 0, 0, 0, 0, 0, 0);
753
+ date.setFullYear(Number.parseInt(year, 10));
832
754
  if (monthFulfilled && allowedParts.month) {
833
- _date.setMonth(Number.parseInt(month, 10) - 1);
755
+ date.setMonth(Number.parseInt(month, 10) - 1);
834
756
  }
835
- onDisplayedPeriodChange(_date);
757
+ onDisplayedPeriodChange(date);
836
758
  }
837
759
  }, [onDateChange, setInternalValue, placeholders, onDisplayedPeriodChange, order, allowedParts]);
838
- var mask = React.useMemo(function () {
839
- var result = [];
840
- var _iterator5 = _createForOfIteratorHelper(order),
841
- _step5;
842
- try {
843
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
844
- var part = _step5.value;
845
- if (part === 'year') result.push(placeholders.year + placeholders.year + placeholders.year + placeholders.year);
846
- if (part === 'month') result.push(placeholders.month + placeholders.month);
847
- if (part === 'day') result.push(placeholders.day + placeholders.day);
848
- }
849
- } catch (err) {
850
- _iterator5.e(err);
851
- } finally {
852
- _iterator5.f();
760
+ const mask = React.useMemo(() => {
761
+ const result = [];
762
+ for (const part of order) {
763
+ if (part === 'year') result.push(placeholders.year + placeholders.year + placeholders.year + placeholders.year);
764
+ if (part === 'month') result.push(placeholders.month + placeholders.month);
765
+ if (part === 'day') result.push(placeholders.day + placeholders.day);
853
766
  }
854
767
  return result.join(sep);
855
768
  }, [sep, order, placeholders]);
856
- var aliases = React.useMemo(function () {
857
- return _defineProperty(_defineProperty(_defineProperty({}, placeholders.year, /\d/), placeholders.month, /\d/), placeholders.day, /\d/);
858
- }, [placeholders]);
859
- var maskOnlySymbols = React.useMemo(function () {
860
- return _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, placeholders.year, true), placeholders.month, true), placeholders.day, true), sep, true);
861
- }, [sep, placeholders]);
862
- var humanizedDate = React.useMemo(function () {
863
- var outerDate = outerValue;
769
+ const aliases = React.useMemo(() => ({
770
+ [placeholders.year]: /\d/,
771
+ [placeholders.month]: /\d/,
772
+ [placeholders.day]: /\d/
773
+ }), [placeholders]);
774
+ const maskOnlySymbols = React.useMemo(() => ({
775
+ [placeholders.year]: true,
776
+ [placeholders.month]: true,
777
+ [placeholders.day]: true,
778
+ [sep]: true
779
+ }), [sep, placeholders]);
780
+ const humanizedDate = React.useMemo(() => {
781
+ let outerDate = outerValue;
864
782
  if (typeof outerValue === 'number' || typeof outerValue === 'string') {
865
783
  outerDate = new Date(outerValue);
866
784
  }
867
- var validDate = outerDate && outerDate instanceof Date && !Number.isNaN(outerDate.getTime());
785
+ const validDate = outerDate && outerDate instanceof Date && !Number.isNaN(outerDate.getTime());
868
786
  if (!validDate) return null;
869
787
  return new Intl.DateTimeFormat(locale, {
870
788
  year: allowedParts.year ? 'numeric' : undefined,
@@ -872,55 +790,45 @@ function MaskedInput(_ref14) {
872
790
  day: allowedParts.day ? 'numeric' : undefined
873
791
  }).format(outerDate);
874
792
  }, [outerValue, locale, allowedParts]);
875
- useEnhancedEffect(function () {
793
+ useEnhancedEffect(() => {
876
794
  if (!ref.current) return;
877
- var stringsToMeasure = humanizedDate ? [humanizedDate, mask] : [mask];
878
- var widths = [];
879
- var measureSpan = document.createElement('span');
880
- var computedStyle = window.getComputedStyle(ref.current);
881
- var typographyRelatedStyles = ['height', 'font-size', 'font-family', 'font-weight', 'font-style', 'line-height', 'letter-spacing', 'text-transform', 'word-spacing'];
882
- for (var _i2 = 0, _typographyRelatedSty = typographyRelatedStyles; _i2 < _typographyRelatedSty.length; _i2++) {
883
- var _style2 = _typographyRelatedSty[_i2];
884
- measureSpan.style[_style2] = computedStyle[_style2];
795
+ const stringsToMeasure = humanizedDate ? [humanizedDate, mask] : [mask];
796
+ const widths = [];
797
+ const measureSpan = document.createElement('span');
798
+ const computedStyle = window.getComputedStyle(ref.current);
799
+ const typographyRelatedStyles = ['height', 'font-size', 'font-family', 'font-weight', 'font-style', 'line-height', 'letter-spacing', 'text-transform', 'word-spacing'];
800
+ for (const style of typographyRelatedStyles) {
801
+ measureSpan.style[style] = computedStyle[style];
885
802
  }
886
803
  measureSpan.style.position = 'absolute';
887
804
  measureSpan.style.visibility = 'hidden';
888
805
  document.body.appendChild(measureSpan);
889
- for (var _i3 = 0, _stringsToMeasure = stringsToMeasure; _i3 < _stringsToMeasure.length; _i3++) {
890
- var string = _stringsToMeasure[_i3];
806
+ for (const string of stringsToMeasure) {
891
807
  measureSpan.innerHTML = string;
892
808
  widths.push(measureSpan.offsetWidth);
893
809
  }
894
810
  measureSpan.remove();
895
- var maxWidth = Math.max.apply(Math, widths);
811
+ const maxWidth = Math.max(...widths);
896
812
  setWidth(maxWidth);
897
813
  }, [locale, humanizedDate, allowedParts, mask]);
898
- var SHumanizedDate = 'div';
899
- var handleInputRef = React.useCallback(function (node) {
814
+ const SHumanizedDate = 'div';
815
+ const handleInputRef = React.useCallback(node => {
900
816
  ref.current = node;
901
817
  if (!node || node.tagName !== 'INPUT') return;
902
818
  if (typeof forwardRef === 'function') forwardRef(node);else forwardRef.current = node;
903
819
  }, [forwardRef]);
904
- var _React$useState5 = React.useState(width),
905
- _React$useState6 = _slicedToArray(_React$useState5, 2),
906
- appliedWidth = _React$useState6[0],
907
- setAppliedWidth = _React$useState6[1];
908
- var _React$useState7 = React.useState(false),
909
- _React$useState8 = _slicedToArray(_React$useState7, 2),
910
- innerFocused = _React$useState8[0],
911
- setInnerFocused = _React$useState8[1];
912
- var focused = containerFocused !== null && containerFocused !== void 0 ? containerFocused : innerFocused;
913
- var handleFocus = React.useCallback(function (event) {
914
- var _otherProps$onFocus;
915
- (_otherProps$onFocus = otherProps.onFocus) === null || _otherProps$onFocus === void 0 || _otherProps$onFocus.call(otherProps, event);
820
+ const [appliedWidth, setAppliedWidth] = React.useState(width);
821
+ const [innerFocused, setInnerFocused] = React.useState(false);
822
+ const focused = containerFocused ?? innerFocused;
823
+ const handleFocus = React.useCallback(event => {
824
+ otherProps.onFocus?.(event);
916
825
  setInnerFocused(true);
917
826
  }, []);
918
- var handleBlur = React.useCallback(function (event) {
919
- var _otherProps$onBlur;
920
- (_otherProps$onBlur = otherProps.onBlur) === null || _otherProps$onBlur === void 0 || _otherProps$onBlur.call(otherProps, event);
827
+ const handleBlur = React.useCallback(event => {
828
+ otherProps.onBlur?.(event);
921
829
  setInnerFocused(false);
922
830
  }, []);
923
- useEnhancedEffect(function () {
831
+ useEnhancedEffect(() => {
924
832
  if (focused) return;
925
833
  setAppliedWidth(width);
926
834
  }, [width, focused]);
@@ -940,7 +848,7 @@ function MaskedInput(_ref14) {
940
848
  focused: focused,
941
849
  ref: handleInputRef,
942
850
  pipe: pipeMask,
943
- value: value !== null && value !== void 0 ? value : '',
851
+ value: value ?? '',
944
852
  onChange: handleChange,
945
853
  noHumanizedDate: !humanizedDate,
946
854
  animationsDisabled: animationsDisabled,
@@ -948,20 +856,20 @@ function MaskedInput(_ref14) {
948
856
  inputMode: "numeric"
949
857
  }), humanizedDate && /*#__PURE__*/React.createElement(SHumanizedDate, _ref13.cn("SHumanizedDate", {}), humanizedDate));
950
858
  }
951
- var SingleDateInput = createComponent(SingleDateInputRoot, {
952
- Indicator: Indicator,
953
- MaskedInput: MaskedInput
859
+ const SingleDateInput = createComponent(SingleDateInputRoot, {
860
+ Indicator,
861
+ MaskedInput
954
862
  });
955
- var DateRange = createComponent(DateRangeRoot, {
956
- Indicator: Indicator,
957
- RangeSep: RangeSep,
958
- FromMaskedInput: FromMaskedInput,
959
- ToMaskedInput: ToMaskedInput
863
+ const DateRange = createComponent(DateRangeRoot, {
864
+ Indicator,
865
+ RangeSep,
866
+ FromMaskedInput,
867
+ ToMaskedInput
960
868
  });
961
- var InputTrigger = createComponent(InputTriggerRoot, {
869
+ const InputTrigger = createComponent(InputTriggerRoot, {
962
870
  Addon: BaseTrigger.Addon,
963
- SingleDateInput: SingleDateInput,
964
- DateRange: DateRange
871
+ SingleDateInput,
872
+ DateRange
965
873
  });
966
874
  export default InputTrigger;
967
875
  //# sourceMappingURL=InputTrigger.js.map