@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,658 +1,594 @@
1
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
- import _createClass from "@babel/runtime/helpers/createClass";
5
- import _callSuper from "@babel/runtime/helpers/callSuper";
6
- import _inherits from "@babel/runtime/helpers/inherits";
7
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
2
  import { sstyled as _sstyled } from "@semcore/core";
9
3
  import { assignProps as _assignProps3 } from "@semcore/core";
10
4
  import { assignProps as _assignProps2 } from "@semcore/core";
11
5
  import { assignProps as _assignProps } from "@semcore/core";
6
+ import { Flex } from '@semcore/base-components';
12
7
  import { LinkTrigger } from '@semcore/base-trigger';
13
8
  import Button from '@semcore/button';
14
9
  import Checkbox from '@semcore/checkbox';
15
10
  import { Component, Root, sstyled } from '@semcore/core';
16
11
  import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
17
12
  import Dropdown from '@semcore/dropdown';
18
- import { Flex } from '@semcore/flex-box';
19
13
  import dayjs from 'dayjs';
20
14
  import React from 'react';
21
15
  /*!__reshadow-styles__:"../style/date-picker.shadow.css"*/
22
- 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_"),
16
+ 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_"),
23
17
  /*__reshadow_css_end__*/
24
18
  {
25
- "__SHeader": "___SHeader_gjj0p_gg_",
26
- "__STitle": "___STitle_gjj0p_gg_",
27
- "__SToday": "___SToday_gjj0p_gg_",
28
- "__SPeriod": "___SPeriod_gjj0p_gg_",
29
- "__SButton": "___SButton_gjj0p_gg_",
30
- "__SInner": "___SInner_gjj0p_gg_",
31
- "__SInputMask": "___SInputMask_gjj0p_gg_",
32
- "_animationsDisabled": "__animationsDisabled_gjj0p_gg_",
33
- "__SIndicator": "___SIndicator_gjj0p_gg_",
34
- "__SRangeIndicator": "___SRangeIndicator_gjj0p_gg_",
35
- "_range_value": "_range_value_gjj0p_gg_",
36
- "_range_compare": "_range_compare_gjj0p_gg_",
37
- "_disabled": "__disabled_gjj0p_gg_",
38
- "__SHumanizedDate": "___SHumanizedDate_gjj0p_gg_",
39
- "__SMask": "___SMask_gjj0p_gg_",
40
- "__SSingleDateInput": "___SSingleDateInput_gjj0p_gg_",
41
- "__SValue": "___SValue_gjj0p_gg_",
42
- "__SDateRange": "___SDateRange_gjj0p_gg_",
43
- "_noHumanizedDate": "__noHumanizedDate_gjj0p_gg_",
44
- "__SRangeSep": "___SRangeSep_gjj0p_gg_",
45
- "_fulfilled": "__fulfilled_gjj0p_gg_",
46
- "__SRangeComparatorHeader": "___SRangeComparatorHeader_gjj0p_gg_",
47
- "__SRangeCalendar": "___SRangeCalendar_gjj0p_gg_",
48
- "__SFooter": "___SFooter_gjj0p_gg_",
49
- "__SPeriodsList": "___SPeriodsList_gjj0p_gg_",
50
- "__STooltip": "___STooltip_gjj0p_gg_",
51
- "__SCompareToggle": "___SCompareToggle_gjj0p_gg_",
52
- "__SPopper": "___SPopper_gjj0p_gg_"
19
+ "__SHeader": "___SHeader_9ubmf_gg_",
20
+ "__STitle": "___STitle_9ubmf_gg_",
21
+ "__SToday": "___SToday_9ubmf_gg_",
22
+ "__SPeriod": "___SPeriod_9ubmf_gg_",
23
+ "__SButton": "___SButton_9ubmf_gg_",
24
+ "__SInner": "___SInner_9ubmf_gg_",
25
+ "__SInputMask": "___SInputMask_9ubmf_gg_",
26
+ "_animationsDisabled": "__animationsDisabled_9ubmf_gg_",
27
+ "__SIndicator": "___SIndicator_9ubmf_gg_",
28
+ "__SRangeIndicator": "___SRangeIndicator_9ubmf_gg_",
29
+ "_range_value": "_range_value_9ubmf_gg_",
30
+ "_range_compare": "_range_compare_9ubmf_gg_",
31
+ "_disabled": "__disabled_9ubmf_gg_",
32
+ "__SHumanizedDate": "___SHumanizedDate_9ubmf_gg_",
33
+ "__SMask": "___SMask_9ubmf_gg_",
34
+ "__SSingleDateInput": "___SSingleDateInput_9ubmf_gg_",
35
+ "__SValue": "___SValue_9ubmf_gg_",
36
+ "__SDateRange": "___SDateRange_9ubmf_gg_",
37
+ "_noHumanizedDate": "__noHumanizedDate_9ubmf_gg_",
38
+ "__SRangeSep": "___SRangeSep_9ubmf_gg_",
39
+ "_fulfilled": "__fulfilled_9ubmf_gg_",
40
+ "__SRangeComparatorHeader": "___SRangeComparatorHeader_9ubmf_gg_",
41
+ "__SRangeCalendar": "___SRangeCalendar_9ubmf_gg_",
42
+ "__SFooter": "___SFooter_9ubmf_gg_",
43
+ "__SPeriodsList": "___SPeriodsList_9ubmf_gg_",
44
+ "__STooltip": "___STooltip_9ubmf_gg_",
45
+ "__SCompareToggle": "___SCompareToggle_9ubmf_gg_",
46
+ "__SPopper": "___SPopper_9ubmf_gg_"
53
47
  });
54
48
  import { localizedMessages } from '../translations/__intergalactic-dynamic-locales';
55
49
  import { formatDDMMYY, formatMMYY } from '../utils/formatDate';
56
50
  import { includesDate } from '../utils/includesDate';
57
51
  import shortDateRangeFormat from '../utils/shortDateRangeFormat';
58
- var INTERACTION_TAGS = ['INPUT'];
59
- var INTERACTION_KEYS = ['ArrowDown', 'Enter', ' '];
60
- var defaultDisplayedPeriod = new Date(new Date().setHours(0, 0, 0, 0));
61
- var getLatestDate = function getLatestDate() {
62
- for (var _len = arguments.length, dateRanges = new Array(_len), _key = 0; _key < _len; _key++) {
63
- dateRanges[_key] = arguments[_key];
64
- }
65
- var allDates = dateRanges.flat().filter(Boolean).filter(function (date) {
66
- return !Number.isNaN(new Date(date).getTime());
67
- });
52
+ const INTERACTION_TAGS = ['INPUT'];
53
+ const INTERACTION_KEYS = ['ArrowDown', 'Enter', ' '];
54
+ const defaultDisplayedPeriod = new Date(new Date().setHours(0, 0, 0, 0));
55
+ const getLatestDate = (...dateRanges) => {
56
+ const allDates = dateRanges.flat().filter(Boolean).filter(date => !Number.isNaN(new Date(date).getTime()));
68
57
  if (!allDates.length) return null;
69
- allDates.sort(function (a, b) {
70
- return new Date(b).getTime() - new Date(a).getTime();
71
- });
72
- var latestDate = allDates[0];
58
+ allDates.sort((a, b) => new Date(b).getTime() - new Date(a).getTime());
59
+ const latestDate = allDates[0];
73
60
  return latestDate;
74
61
  };
75
- var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
76
- function DateRangeComparatorAbstract() {
77
- var _this;
78
- _classCallCheck(this, DateRangeComparatorAbstract);
79
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
80
- args[_key2] = arguments[_key2];
81
- }
82
- _this = _callSuper(this, DateRangeComparatorAbstract, [].concat(args));
83
- _defineProperty(_this, "prevButtonRef", /*#__PURE__*/React.createRef());
84
- _defineProperty(_this, "nextButtonRef", /*#__PURE__*/React.createRef());
85
- _defineProperty(_this, "popperRef", /*#__PURE__*/React.createRef());
86
- _defineProperty(_this, "resetButtonRef", /*#__PURE__*/React.createRef());
87
- _defineProperty(_this, "applyButtonRef", /*#__PURE__*/React.createRef());
88
- _defineProperty(_this, "periodRefs", []);
89
- _defineProperty(_this, "unitRefs", {});
90
- _defineProperty(_this, "navigateView", function (direction) {
91
- var displayedPeriod = _this.asProps.displayedPeriod;
92
- var action = direction >= 1 ? 'add' : 'subtract';
93
- var date = dayjs(displayedPeriod)[action](1, _this.navigateStep).toDate();
94
- _this.handlers.displayedPeriod(date);
95
- });
96
- _defineProperty(_this, "bindHandlerNavigateClick", function (direction) {
97
- return function () {
98
- return _this.navigateView(direction);
99
- };
62
+ class DateRangeComparatorAbstract extends Component {
63
+ constructor(...args) {
64
+ super(...args);
65
+ _defineProperty(this, "prevButtonRef", /*#__PURE__*/React.createRef());
66
+ _defineProperty(this, "nextButtonRef", /*#__PURE__*/React.createRef());
67
+ _defineProperty(this, "popperRef", /*#__PURE__*/React.createRef());
68
+ _defineProperty(this, "resetButtonRef", /*#__PURE__*/React.createRef());
69
+ _defineProperty(this, "applyButtonRef", /*#__PURE__*/React.createRef());
70
+ _defineProperty(this, "periodRefs", []);
71
+ _defineProperty(this, "unitRefs", {});
72
+ _defineProperty(this, "navigateView", direction => {
73
+ const {
74
+ displayedPeriod
75
+ } = this.asProps;
76
+ const action = direction >= 1 ? 'add' : 'subtract';
77
+ const date = dayjs(displayedPeriod)[action](1, this.navigateStep).toDate();
78
+ this.handlers.displayedPeriod(date);
100
79
  });
101
- _defineProperty(_this, "handleApplyClick", function () {
102
- var _this$asProps = _this.asProps,
103
- value = _this$asProps.value,
104
- preselectedValue = _this$asProps.preselectedValue,
105
- preselectedCompare = _this$asProps.preselectedCompare;
106
- return _this.handleApply(preselectedValue !== null && preselectedValue !== void 0 ? preselectedValue : value === null || value === void 0 ? void 0 : value.value, preselectedCompare !== null && preselectedCompare !== void 0 ? preselectedCompare : value === null || value === void 0 ? void 0 : value.compare);
80
+ _defineProperty(this, "bindHandlerNavigateClick", direction => () => this.navigateView(direction));
81
+ _defineProperty(this, "handleApplyClick", () => {
82
+ const {
83
+ value,
84
+ preselectedValue,
85
+ preselectedCompare
86
+ } = this.asProps;
87
+ return this.handleApply(preselectedValue ?? value?.value, preselectedCompare ?? value?.compare);
107
88
  });
108
- _defineProperty(_this, "handleApply", function (value, compare) {
109
- _this.handlers.value({
110
- value: value,
111
- compare: compare
89
+ _defineProperty(this, "handleApply", (value, compare) => {
90
+ this.handlers.value({
91
+ value,
92
+ compare
112
93
  });
113
- _this.handlers.visible(false);
94
+ this.handlers.visible(false);
114
95
  });
115
- _defineProperty(_this, "handleKeydownDown", function (place) {
116
- return function (e) {
117
- var _this$asProps2 = _this.asProps,
118
- displayedPeriod = _this$asProps2.displayedPeriod,
119
- preselectedValue = _this$asProps2.preselectedValue,
120
- visible = _this$asProps2.visible,
121
- focusedRange = _this$asProps2.focusedRange;
122
- var key = e.key,
123
- target = e.target;
124
- var highlighted = focusedRange === 'compare' ? _this.asProps.compareHighlighted : _this.asProps.highlighted;
125
- if ([' ', 'Enter'].includes(key) && [_this.prevButtonRef.current, _this.nextButtonRef.current].includes(target)) return;
126
- if (place === 'trigger' && INTERACTION_KEYS.includes(key)) {
127
- e.preventDefault();
128
- e.stopPropagation();
129
- _this.handlers.visible(!visible);
130
- setTimeout(function () {
131
- var popper = _this.popperRef.current;
132
- if (popper) {
133
- popper.focus();
134
- }
135
- }, 0);
136
- }
137
- var day = _this.keyDiff[key];
138
- var setNextDisplayedPeriod = function setNextDisplayedPeriod(next_highlighted) {
139
- var _next_highlighted = _slicedToArray(next_highlighted, 2),
140
- startPeriod = _next_highlighted[0],
141
- endPeriod = _next_highlighted[1];
142
- var highlightedPeriod = endPeriod || startPeriod;
143
- var displayedPeriodNormalized = displayedPeriod === null || displayedPeriod === void 0 ? void 0 : displayedPeriod.getDate();
144
- var highlightedPeriodNormalized = highlightedPeriod === null || highlightedPeriod === void 0 ? void 0 : highlightedPeriod.getDate();
145
- if (_this.navigateStep === 'month') {
146
- displayedPeriodNormalized = displayedPeriod === null || displayedPeriod === void 0 ? void 0 : displayedPeriod.getMonth();
147
- highlightedPeriodNormalized = highlightedPeriod === null || highlightedPeriod === void 0 ? void 0 : highlightedPeriod.getMonth();
148
- }
149
- if (_this.navigateStep === 'year') {
150
- displayedPeriodNormalized = displayedPeriod === null || displayedPeriod === void 0 ? void 0 : displayedPeriod.getYear();
151
- highlightedPeriodNormalized = highlightedPeriod === null || highlightedPeriod === void 0 ? void 0 : highlightedPeriod.getYear();
96
+ _defineProperty(this, "handleKeydownDown", place => e => {
97
+ const {
98
+ displayedPeriod,
99
+ preselectedValue,
100
+ visible,
101
+ focusedRange
102
+ } = this.asProps;
103
+ const {
104
+ key,
105
+ target
106
+ } = e;
107
+ const highlighted = focusedRange === 'compare' ? this.asProps.compareHighlighted : this.asProps.highlighted;
108
+ if ([' ', 'Enter'].includes(key) && [this.prevButtonRef.current, this.nextButtonRef.current].includes(target)) return;
109
+ if (place === 'trigger' && INTERACTION_KEYS.includes(key)) {
110
+ e.preventDefault();
111
+ e.stopPropagation();
112
+ this.handlers.visible(!visible);
113
+ setTimeout(() => {
114
+ const popper = this.popperRef.current;
115
+ if (popper) {
116
+ popper.focus();
152
117
  }
153
- var offset = highlightedPeriodNormalized - displayedPeriodNormalized;
154
- if (offset < 0 || offset > 1) {
155
- return highlightedPeriod;
156
- }
157
- return displayedPeriod;
158
- };
159
- var isPeriodTarget = _this.periodRefs.find(function (el) {
160
- return el === target;
161
- });
162
- var isResetButtonTarget = target === _this.resetButtonRef.current;
163
- var isApplyButtonTarget = target === _this.applyButtonRef.current;
164
- var areTargetedControls = isPeriodTarget || isResetButtonTarget || isApplyButtonTarget;
165
- if (place === 'popper' && e.key === ' ' && highlighted.length && !areTargetedControls) {
166
- var highlightedDate = highlighted[1] || highlighted[0];
167
- if (!_this.isDisabled(highlightedDate)) {
168
- _this.handleChange(highlightedDate);
169
- }
170
- e.preventDefault();
118
+ }, 0);
119
+ }
120
+ const day = this.keyDiff[key];
121
+ const setNextDisplayedPeriod = next_highlighted => {
122
+ const [startPeriod, endPeriod] = next_highlighted;
123
+ const highlightedPeriod = endPeriod || startPeriod;
124
+ let displayedPeriodNormalized = displayedPeriod?.getDate();
125
+ let highlightedPeriodNormalized = highlightedPeriod?.getDate();
126
+ if (this.navigateStep === 'month') {
127
+ displayedPeriodNormalized = displayedPeriod?.getMonth();
128
+ highlightedPeriodNormalized = highlightedPeriod?.getMonth();
129
+ }
130
+ if (this.navigateStep === 'year') {
131
+ displayedPeriodNormalized = displayedPeriod?.getYear();
132
+ highlightedPeriodNormalized = highlightedPeriod?.getYear();
133
+ }
134
+ const offset = highlightedPeriodNormalized - displayedPeriodNormalized;
135
+ if (offset < 0 || offset > 1) {
136
+ return highlightedPeriod;
171
137
  }
172
- if (place === 'popper' && e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
173
- return _this.handleApplyClick();
138
+ return displayedPeriod;
139
+ };
140
+ const isPeriodTarget = this.periodRefs.find(el => el === target);
141
+ const isResetButtonTarget = target === this.resetButtonRef.current;
142
+ const isApplyButtonTarget = target === this.applyButtonRef.current;
143
+ const areTargetedControls = isPeriodTarget || isResetButtonTarget || isApplyButtonTarget;
144
+ if (place === 'popper' && e.key === ' ' && highlighted.length && !areTargetedControls) {
145
+ const highlightedDate = highlighted[1] || highlighted[0];
146
+ if (!this.isDisabled(highlightedDate)) {
147
+ this.handleChange(highlightedDate);
174
148
  }
175
- var changedDate = undefined;
176
- if (day) {
177
- if (INTERACTION_TAGS.includes(e.target.tagName)) return;
178
- if (highlighted.length) {
179
- var next_highlighted;
180
- if ((preselectedValue === null || preselectedValue === void 0 ? void 0 : preselectedValue.length) === 1) {
181
- next_highlighted = [preselectedValue[0], dayjs(highlighted[1] || highlighted[0]).add(day, _this.keyStep).toDate()];
182
- changedDate = next_highlighted[1];
183
- } else {
184
- next_highlighted = [dayjs(highlighted[0]).add(day, _this.keyStep).toDate()];
185
- changedDate = next_highlighted[0];
186
- }
187
- if (focusedRange === 'compare') {
188
- _this.handlers.compareHighlighted(next_highlighted);
189
- } else {
190
- _this.handlers.highlighted(next_highlighted);
191
- }
192
- _this.handlers.displayedPeriod(setNextDisplayedPeriod(next_highlighted));
149
+ e.preventDefault();
150
+ }
151
+ if (place === 'popper' && e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
152
+ return this.handleApplyClick();
153
+ }
154
+ let changedDate = undefined;
155
+ if (day) {
156
+ if (INTERACTION_TAGS.includes(e.target.tagName)) return;
157
+ if (highlighted.length) {
158
+ let next_highlighted;
159
+ if (preselectedValue?.length === 1) {
160
+ next_highlighted = [preselectedValue[0], dayjs(highlighted[1] || highlighted[0]).add(day, this.keyStep).toDate()];
161
+ changedDate = next_highlighted[1];
193
162
  } else {
194
- var _highlighted = [displayedPeriod ? displayedPeriod : dayjs().toDate()];
195
- if (focusedRange === 'compare') {
196
- _this.handlers.compareHighlighted(_highlighted);
197
- } else {
198
- _this.handlers.highlighted(_highlighted);
199
- }
200
- changedDate = _highlighted[0];
163
+ next_highlighted = [dayjs(highlighted[0]).add(day, this.keyStep).toDate()];
164
+ changedDate = next_highlighted[0];
201
165
  }
202
- e.preventDefault();
203
- if (changedDate) {
204
- var _this$unitRefs$format;
205
- var formatter = _this.keyStep === 'month' ? formatMMYY : formatDDMMYY;
206
- var formattedDate = formatter(changedDate, _this.asProps.locale);
207
- (_this$unitRefs$format = _this.unitRefs[formattedDate]) === null || _this$unitRefs$format === void 0 || _this$unitRefs$format.focus();
166
+ if (focusedRange === 'compare') {
167
+ this.handlers.compareHighlighted(next_highlighted);
168
+ } else {
169
+ this.handlers.highlighted(next_highlighted);
208
170
  }
171
+ this.handlers.displayedPeriod(setNextDisplayedPeriod(next_highlighted));
172
+ } else {
173
+ const highlighted = [displayedPeriod ? displayedPeriod : dayjs().toDate()];
174
+ if (focusedRange === 'compare') {
175
+ this.handlers.compareHighlighted(highlighted);
176
+ } else {
177
+ this.handlers.highlighted(highlighted);
178
+ }
179
+ changedDate = highlighted[0];
209
180
  }
210
- };
181
+ e.preventDefault();
182
+ if (changedDate) {
183
+ const formatter = this.keyStep === 'month' ? formatMMYY : formatDDMMYY;
184
+ const formattedDate = formatter(changedDate, this.asProps.locale);
185
+ this.unitRefs[formattedDate]?.focus();
186
+ }
187
+ }
211
188
  });
212
- _defineProperty(_this, "triggerFormattingProps", {
189
+ _defineProperty(this, "triggerFormattingProps", {
213
190
  day: 'numeric',
214
191
  month: 'short',
215
192
  year: 'numeric'
216
193
  });
217
- _defineProperty(_this, "handleChange", function (date) {
218
- var _value, _value2, _value3;
219
- var _this$asProps3 = _this.asProps,
220
- focusedRange = _this$asProps3.focusedRange,
221
- preselectedCompare = _this$asProps3.preselectedCompare,
222
- preselectedValue = _this$asProps3.preselectedValue;
223
- var highlighted = [];
224
- var value = focusedRange === 'compare' ? preselectedCompare : preselectedValue;
194
+ _defineProperty(this, "handleChange", date => {
195
+ const {
196
+ focusedRange,
197
+ preselectedCompare,
198
+ preselectedValue
199
+ } = this.asProps;
200
+ let highlighted = [];
201
+ let value = focusedRange === 'compare' ? preselectedCompare : preselectedValue;
225
202
  if (Array.isArray(date)) {
226
203
  value = date;
227
- } else if (!((_value = value) !== null && _value !== void 0 && _value.length)) {
204
+ } else if (!value?.length) {
228
205
  value = [date];
229
206
  highlighted = [date];
230
- } else if (((_value2 = value) === null || _value2 === void 0 ? void 0 : _value2.length) >= 2) {
207
+ } else if (value?.length >= 2) {
231
208
  value = [date];
232
209
  highlighted = [date];
233
- } else if (((_value3 = value) === null || _value3 === void 0 ? void 0 : _value3[0]) > date) {
234
- var _value4;
235
- value = [date, (_value4 = value) === null || _value4 === void 0 ? void 0 : _value4[0]];
210
+ } else if (value?.[0] > date) {
211
+ value = [date, value?.[0]];
236
212
  } else {
237
- var _value5;
238
- value = [(_value5 = value) === null || _value5 === void 0 ? void 0 : _value5[0], date];
213
+ value = [value?.[0], date];
239
214
  }
240
215
  if (focusedRange === 'compare') {
241
- _this.handlers.preselectedCompare(value);
242
- _this.handlers.compareHighlighted(highlighted);
216
+ this.handlers.preselectedCompare(value);
217
+ this.handlers.compareHighlighted(highlighted);
243
218
  } else {
244
- _this.handlers.preselectedValue(value);
245
- _this.handlers.highlighted(highlighted);
219
+ this.handlers.preselectedValue(value);
220
+ this.handlers.highlighted(highlighted);
246
221
  }
247
222
  });
248
- return _this;
249
223
  }
250
- _inherits(DateRangeComparatorAbstract, _Component);
251
- return _createClass(DateRangeComparatorAbstract, [{
252
- key: "getPeriodProps",
253
- value: function getPeriodProps() {
254
- var _this$asProps$value,
255
- _this2 = this;
256
- var _this$asProps4 = this.asProps,
257
- _this$asProps4$period = _this$asProps4.periods,
258
- periods = _this$asProps4$period === void 0 ? this.getDefaultPeriods() : _this$asProps4$period,
259
- onHighlightedChange = _this$asProps4.onHighlightedChange,
260
- onCompareHighlightedChange = _this$asProps4.onCompareHighlightedChange,
261
- onDisplayedPeriodChange = _this$asProps4.onDisplayedPeriodChange,
262
- preselectedValue = _this$asProps4.preselectedValue,
263
- preselectedCompare = _this$asProps4.preselectedCompare,
264
- focusedRange = _this$asProps4.focusedRange,
265
- getI18nText = _this$asProps4.getI18nText;
266
- var value = preselectedValue !== null && preselectedValue !== void 0 ? preselectedValue : (_this$asProps$value = this.asProps.value) === null || _this$asProps$value === void 0 ? void 0 : _this$asProps$value.value;
267
- if (focusedRange === 'compare') {
268
- var _this$asProps$value2;
269
- value = preselectedCompare !== null && preselectedCompare !== void 0 ? preselectedCompare : (_this$asProps$value2 = this.asProps.value) === null || _this$asProps$value2 === void 0 ? void 0 : _this$asProps$value2.compare;
270
- }
271
- return {
272
- periods: periods,
273
- value: value,
274
- 'onChange': function onChange(value) {
275
- if (focusedRange === 'compare') {
276
- _this2.handlers.preselectedCompare(value);
277
- } else {
278
- _this2.handlers.preselectedValue(value);
279
- }
280
- },
281
- 'onHighlightedChange': focusedRange === 'compare' ? onCompareHighlightedChange : onHighlightedChange,
282
- onDisplayedPeriodChange: onDisplayedPeriodChange,
283
- 'role': 'listbox',
284
- 'aria-label': getI18nText('periods'),
285
- 'periodRef': function periodRef(index) {
286
- return function (element) {
287
- if (!element) return;
288
- _this2.periodRefs[index] = element;
289
- };
290
- }
291
- };
292
- }
293
- }, {
294
- key: "getPrevProps",
295
- value: function getPrevProps() {
296
- var getI18nText = this.asProps.getI18nText;
297
- var navigateStep = this.navigateStep;
298
- return {
299
- getI18nText: getI18nText,
300
- 'ref': this.prevButtonRef,
301
- 'onClick': this.bindHandlerNavigateClick(-1),
302
- 'aria-label': navigateStep === 'month' ? getI18nText('prevMonth') : getI18nText('prevYear')
303
- };
304
- }
305
- }, {
306
- key: "getNextProps",
307
- value: function getNextProps() {
308
- var getI18nText = this.asProps.getI18nText;
309
- var navigateStep = this.navigateStep;
310
- return {
311
- getI18nText: getI18nText,
312
- 'ref': this.nextButtonRef,
313
- 'onClick': this.bindHandlerNavigateClick(1),
314
- 'aria-label': navigateStep === 'month' ? getI18nText('nextMonth') : getI18nText('nextYear')
315
- };
316
- }
317
- }, {
318
- key: "uncontrolledProps",
319
- value: function uncontrolledProps() {
320
- var _this3 = this;
321
- return {
322
- displayedPeriod: null,
323
- visible: [null, function (visible) {
324
- if (!visible) {
325
- _this3.handlers.highlighted([]);
326
- _this3.handlers.compareHighlighted([]);
327
- _this3.handlers.preselectedValue(undefined);
328
- _this3.handlers.preselectedCompare(undefined);
329
- _this3.handlers.compareToggle(undefined);
330
- _this3.handlers.focusedRange('value');
331
- } else {
332
- var _this3$asProps$value;
333
- _this3.handlers.compareToggle(!!((_this3$asProps$value = _this3.asProps.value) !== null && _this3$asProps$value !== void 0 && (_this3$asProps$value = _this3$asProps$value.compare) !== null && _this3$asProps$value !== void 0 && _this3$asProps$value.length));
334
- }
335
- var _this3$asProps = _this3.asProps,
336
- value = _this3$asProps.value,
337
- displayedPeriod = _this3$asProps.displayedPeriod;
338
- var newDisplayedPeriod = value ? getLatestDate(value.value, value.compare) : undefined;
339
- if (visible) {
340
- if (newDisplayedPeriod && newDisplayedPeriod !== displayedPeriod) {
341
- _this3.handlers.displayedPeriod(newDisplayedPeriod);
342
- } else if (!newDisplayedPeriod) {
343
- var _this3$props = _this3.props,
344
- _displayedPeriod = _this3$props.displayedPeriod,
345
- _defaultDisplayedPeriod = _this3$props.defaultDisplayedPeriod;
346
- _this3.handlers.displayedPeriod(_displayedPeriod || _defaultDisplayedPeriod);
347
- }
348
- }
349
- }],
350
- highlighted: null,
351
- compareHighlighted: null,
352
- preselectedValue: null,
353
- preselectedCompare: null,
354
- compareToggle: null,
355
- focusedRange: null,
356
- value: [null, function (value) {
357
- var dates = [value === null || value === void 0 ? void 0 : value.value, value === null || value === void 0 ? void 0 : value.compare].flat(2).filter(function (date) {
358
- var _date$isValid;
359
- return date === null || date === void 0 || (_date$isValid = date.isValid) === null || _date$isValid === void 0 ? void 0 : _date$isValid.call(date);
360
- });
361
- if (dates.length > 0) _this3.handlers.displayedPeriod(getLatestDate(value));
362
- }]
363
- };
364
- }
365
- }, {
366
- key: "getApplyProps",
367
- value: function getApplyProps() {
368
- var getI18nText = this.asProps.getI18nText;
369
- return {
370
- getI18nText: getI18nText,
371
- onClick: this.handleApplyClick,
372
- ref: this.applyButtonRef
373
- };
374
- }
375
- }, {
376
- key: "getResetProps",
377
- value: function getResetProps() {
378
- var _this4 = this;
379
- var getI18nText = this.asProps.getI18nText;
380
- return {
381
- getI18nText: getI18nText,
382
- onClick: function onClick() {
383
- return _this4.handleApply(null, null);
384
- },
385
- ref: this.resetButtonRef
386
- };
387
- }
388
- }, {
389
- key: "isDisabled",
390
- value: function isDisabled(date) {
391
- var disabled = this.asProps.disabled;
392
- return disabled.some(includesDate(dayjs(date), 'date'));
393
- }
394
- }, {
395
- key: "getDefaultPeriods",
396
- value: function getDefaultPeriods() {
397
- var getI18nText = this.asProps.getI18nText;
398
- var today = new Date(new Date().setHours(0, 0, 0, 0));
399
- return [{
400
- children: getI18nText('lastMonth'),
401
- value: [dayjs(today).subtract(1, 'month').startOf('month').toDate(), dayjs(today).startOf('month').toDate()]
402
- }, {
403
- children: getI18nText('last3Months'),
404
- value: [dayjs(today).subtract(2, 'month').startOf('month').toDate(), dayjs(today).startOf('month').toDate()]
405
- }, {
406
- children: getI18nText('last6Months'),
407
- value: [dayjs(today).subtract(5, 'month').startOf('month').toDate(), dayjs(today).startOf('month').toDate()]
408
- }, {
409
- children: getI18nText('last12Months'),
410
- value: [dayjs(today).subtract(11, 'month').startOf('month').toDate(), dayjs(today).startOf('month').toDate()]
411
- }];
412
- }
413
- }, {
414
- key: "getTitleProps",
415
- value: function getTitleProps(_props, index) {
416
- var _this$asProps5 = this.asProps,
417
- locale = _this$asProps5.locale,
418
- displayedPeriod = _this$asProps5.displayedPeriod;
419
- return {
420
- children: new Intl.DateTimeFormat(locale, {
421
- month: 'long',
422
- year: 'numeric'
423
- }).format(dayjs(displayedPeriod).add(index, this.navigateStep).startOf(this.navigateStep).toDate())
424
- };
224
+ static defaultProps({
225
+ primaryRange,
226
+ defaultPrimaryRange,
227
+ secondaryRange,
228
+ defaultSecondaryRange
229
+ }) {
230
+ return {
231
+ i18n: localizedMessages,
232
+ locale: 'en',
233
+ defaultValue: null,
234
+ defaultHighlighted: [],
235
+ defaultCompareHighlighted: [],
236
+ defaultDisplayedPeriod: getLatestDate(primaryRange, defaultPrimaryRange, secondaryRange, defaultSecondaryRange) || defaultDisplayedPeriod,
237
+ defaultVisible: false,
238
+ defaultPreselectedValue: null,
239
+ defaultPreselectedCompare: null,
240
+ defaultCompareToggle: null,
241
+ defaultFocusedRange: 'value',
242
+ disabled: [],
243
+ size: 'm'
244
+ };
245
+ }
246
+ getPeriodProps() {
247
+ const {
248
+ periods = this.getDefaultPeriods(),
249
+ onHighlightedChange,
250
+ onCompareHighlightedChange,
251
+ onDisplayedPeriodChange,
252
+ preselectedValue,
253
+ preselectedCompare,
254
+ focusedRange,
255
+ getI18nText
256
+ } = this.asProps;
257
+ let value = preselectedValue ?? this.asProps.value?.value;
258
+ if (focusedRange === 'compare') {
259
+ value = preselectedCompare ?? this.asProps.value?.compare;
425
260
  }
426
- }, {
427
- key: "getTriggerProps",
428
- value: function getTriggerProps(_ref0) {
429
- var _this$asProps$value3,
430
- _this$asProps$value4,
431
- _this5 = this;
432
- var _ref0$placeholder = _ref0.placeholder,
433
- placeholder = _ref0$placeholder === void 0 ? 'Select date ranges' : _ref0$placeholder,
434
- _ref0$separator = _ref0.separator,
435
- separator = _ref0$separator === void 0 ? 'vs.' : _ref0$separator;
436
- var _this$asProps6 = this.asProps,
437
- locale = _this$asProps6.locale,
438
- visible = _this$asProps6.visible;
439
- var value = (_this$asProps$value3 = this.asProps.value) === null || _this$asProps$value3 === void 0 ? void 0 : _this$asProps$value3.value;
440
- var compare = (_this$asProps$value4 = this.asProps.value) === null || _this$asProps$value4 === void 0 ? void 0 : _this$asProps$value4.compare;
441
- var formattingProps = _objectSpread({
442
- locale: locale
443
- }, this.triggerFormattingProps);
444
- var children = placeholder;
445
- if (value !== null && value !== void 0 && value[0] && value !== null && value !== void 0 && value[1]) {
446
- children = shortDateRangeFormat(value, formattingProps);
447
- }
448
- if (compare !== null && compare !== void 0 && compare[0] && compare !== null && compare !== void 0 && compare[1]) {
449
- children = "".concat(children || '', " ").concat(separator, " ").concat(shortDateRangeFormat(compare, formattingProps));
261
+ return {
262
+ periods,
263
+ value,
264
+ 'onChange': value => {
265
+ if (focusedRange === 'compare') {
266
+ this.handlers.preselectedCompare(value);
267
+ } else {
268
+ this.handlers.preselectedValue(value);
269
+ }
270
+ },
271
+ 'onHighlightedChange': focusedRange === 'compare' ? onCompareHighlightedChange : onHighlightedChange,
272
+ onDisplayedPeriodChange,
273
+ 'role': 'listbox',
274
+ 'aria-label': getI18nText('periods'),
275
+ 'periodRef': index => element => {
276
+ if (!element) return;
277
+ this.periodRefs[index] = element;
450
278
  }
451
- return {
452
- children: children,
453
- visible: visible,
454
- onClick: function onClick() {
455
- return _this5.handlers.visible(!visible);
456
- },
457
- onKeyDown: this.handleKeydownDown('trigger')
458
- };
459
- }
460
- }, {
461
- key: "getRangeInput",
462
- value: function getRangeInput() {
463
- throw new Error('not implemented');
464
- }
465
- }, {
466
- key: "getRangeInputProps",
467
- value: function getRangeInputProps() {
468
- return {
469
- inputRole: null
470
- };
471
- }
472
- }, {
473
- key: "getValueDateRangeProps",
474
- value: function getValueDateRangeProps() {
475
- var _this6 = this;
476
- var _this$asProps7 = this.asProps,
477
- value = _this$asProps7.value,
478
- onDisplayedPeriodChange = _this$asProps7.onDisplayedPeriodChange,
479
- locale = _this$asProps7.locale,
480
- disabled = _this$asProps7.disabled,
481
- disabledErrorText = _this$asProps7.disabledErrorText,
482
- getI18nText = _this$asProps7.getI18nText,
483
- focusedRange = _this$asProps7.focusedRange,
484
- preselectedValue = _this$asProps7.preselectedValue,
485
- animationsDisabled = _this$asProps7.animationsDisabled,
486
- visible = _this$asProps7.visible;
487
- return {
488
- popoverVisible: visible,
489
- focused: focusedRange === 'value' ? true : undefined,
490
- value: preselectedValue !== null && preselectedValue !== void 0 ? preselectedValue : value === null || value === void 0 ? void 0 : value.value,
491
- onChange: function onChange(value) {
492
- return _this6.handlers.preselectedValue(value);
493
- },
494
- onDisplayedPeriodChange: onDisplayedPeriodChange,
495
- locale: locale,
496
- disabledDates: disabled,
497
- disabledErrorText: disabledErrorText,
498
- children: this.getRangeInput(),
499
- getI18nText: getI18nText,
500
- onFocus: function onFocus() {
501
- _this6.handlers.focusedRange('value');
502
- },
503
- animationsDisabled: animationsDisabled
504
- };
505
- }
506
- }, {
507
- key: "getCompareDateRangeProps",
508
- value: function getCompareDateRangeProps() {
509
- var _value$compare,
510
- _this7 = this;
511
- var _this$asProps8 = this.asProps,
512
- value = _this$asProps8.value,
513
- onDisplayedPeriodChange = _this$asProps8.onDisplayedPeriodChange,
514
- locale = _this$asProps8.locale,
515
- disabled = _this$asProps8.disabled,
516
- disabledErrorText = _this$asProps8.disabledErrorText,
517
- getI18nText = _this$asProps8.getI18nText,
518
- focusedRange = _this$asProps8.focusedRange,
519
- preselectedCompare = _this$asProps8.preselectedCompare,
520
- compareToggle = _this$asProps8.compareToggle,
521
- animationsDisabled = _this$asProps8.animationsDisabled,
522
- visible = _this$asProps8.visible;
523
- return {
524
- popoverVisible: visible,
525
- focused: focusedRange === 'compare' ? true : undefined,
526
- disabled: !(compareToggle !== null && compareToggle !== void 0 ? compareToggle : value === null || value === void 0 || (_value$compare = value.compare) === null || _value$compare === void 0 ? void 0 : _value$compare.length),
527
- value: preselectedCompare !== null && preselectedCompare !== void 0 ? preselectedCompare : value === null || value === void 0 ? void 0 : value.compare,
528
- onChange: function onChange(value) {
529
- return _this7.handlers.preselectedCompare(value);
530
- },
531
- onDisplayedPeriodChange: onDisplayedPeriodChange,
532
- locale: locale,
533
- disabledDates: disabled,
534
- children: this.getRangeInput(),
535
- getI18nText: getI18nText,
536
- disabledErrorText: disabledErrorText,
537
- onFocus: function onFocus() {
538
- _this7.handlers.focusedRange('compare');
539
- },
540
- animationsDisabled: animationsDisabled
541
- };
542
- }
543
- }, {
544
- key: "getCompareToggleProps",
545
- value: function getCompareToggleProps() {
546
- var _this8 = this;
547
- var _this$asProps9 = this.asProps,
548
- getI18nText = _this$asProps9.getI18nText,
549
- compareToggle = _this$asProps9.compareToggle;
550
- return {
551
- getI18nText: getI18nText,
552
- checked: compareToggle,
553
- onChange: function onChange(checked) {
554
- if (checked) {
555
- _this8.handlers.compareToggle(true);
556
- _this8.handlers.focusedRange('compare');
557
- } else {
558
- _this8.handlers.compareToggle(false);
559
- _this8.handlers.focusedRange('value');
560
- _this8.handlers.preselectedCompare([]);
279
+ };
280
+ }
281
+ getPrevProps() {
282
+ const {
283
+ getI18nText
284
+ } = this.asProps;
285
+ const {
286
+ navigateStep
287
+ } = this;
288
+ return {
289
+ getI18nText,
290
+ 'ref': this.prevButtonRef,
291
+ 'onClick': this.bindHandlerNavigateClick(-1),
292
+ 'aria-label': navigateStep === 'month' ? getI18nText('prevMonth') : getI18nText('prevYear')
293
+ };
294
+ }
295
+ getNextProps() {
296
+ const {
297
+ getI18nText
298
+ } = this.asProps;
299
+ const {
300
+ navigateStep
301
+ } = this;
302
+ return {
303
+ getI18nText,
304
+ 'ref': this.nextButtonRef,
305
+ 'onClick': this.bindHandlerNavigateClick(1),
306
+ 'aria-label': navigateStep === 'month' ? getI18nText('nextMonth') : getI18nText('nextYear')
307
+ };
308
+ }
309
+ uncontrolledProps() {
310
+ return {
311
+ displayedPeriod: null,
312
+ visible: [null, visible => {
313
+ if (!visible) {
314
+ this.handlers.highlighted([]);
315
+ this.handlers.compareHighlighted([]);
316
+ this.handlers.preselectedValue(undefined);
317
+ this.handlers.preselectedCompare(undefined);
318
+ this.handlers.compareToggle(undefined);
319
+ this.handlers.focusedRange('value');
320
+ } else {
321
+ this.handlers.compareToggle(!!this.asProps.value?.compare?.length);
322
+ }
323
+ const {
324
+ value,
325
+ displayedPeriod
326
+ } = this.asProps;
327
+ const newDisplayedPeriod = value ? getLatestDate(value.value, value.compare) : undefined;
328
+ if (visible) {
329
+ if (newDisplayedPeriod && newDisplayedPeriod !== displayedPeriod) {
330
+ this.handlers.displayedPeriod(newDisplayedPeriod);
331
+ } else if (!newDisplayedPeriod) {
332
+ const {
333
+ displayedPeriod,
334
+ defaultDisplayedPeriod
335
+ } = this.props;
336
+ this.handlers.displayedPeriod(displayedPeriod || defaultDisplayedPeriod);
561
337
  }
562
338
  }
563
- };
564
- }
565
- }, {
566
- key: "getCalendarProps",
567
- value: function getCalendarProps(_props, index) {
568
- var _this$asProps0 = this.asProps,
569
- locale = _this$asProps0.locale,
570
- displayedPeriod = _this$asProps0.displayedPeriod,
571
- disabled = _this$asProps0.disabled,
572
- value = _this$asProps0.value,
573
- onCompareHighlightedChange = _this$asProps0.onCompareHighlightedChange,
574
- highlighted = _this$asProps0.highlighted,
575
- compareHighlighted = _this$asProps0.compareHighlighted,
576
- onHighlightedChange = _this$asProps0.onHighlightedChange,
577
- preselectedCompare = _this$asProps0.preselectedCompare,
578
- preselectedValue = _this$asProps0.preselectedValue,
579
- focusedRange = _this$asProps0.focusedRange,
580
- getI18nText = _this$asProps0.getI18nText;
581
- return {
582
- locale: locale,
583
- displayedPeriod: dayjs(displayedPeriod).add(index, this.navigateStep).startOf(this.navigateStep).toDate(),
584
- disabled: disabled,
585
- onChange: this.handleChange,
586
- highlighted: highlighted,
587
- compareHighlighted: compareHighlighted,
588
- onCompareHighlightedChange: onCompareHighlightedChange,
589
- onHighlightedChange: onHighlightedChange,
590
- range: focusedRange,
591
- value: preselectedValue !== null && preselectedValue !== void 0 ? preselectedValue : value === null || value === void 0 ? void 0 : value.value,
592
- compare: preselectedCompare !== null && preselectedCompare !== void 0 ? preselectedCompare : value === null || value === void 0 ? void 0 : value.compare,
593
- unitRefs: this.unitRefs,
594
- getI18nText: getI18nText,
595
- actionsDescribing: index === 0 ? 'range-compare' : null,
596
- tabIndex: index === 0 ? 0 : -1
597
- };
598
- }
599
- }, {
600
- key: "getPopperProps",
601
- value: function getPopperProps() {
602
- return {
603
- p: 0,
604
- ref: this.popperRef,
605
- onKeyDown: this.handleKeydownDown('popper')
606
- };
607
- }
608
- }, {
609
- key: "render",
610
- value: function render() {
611
- var _ref = this.asProps,
612
- _ref4;
613
- var _this$asProps1 = this.asProps,
614
- Children = _this$asProps1.Children,
615
- styles = _this$asProps1.styles,
616
- providedAriaLabel = _this$asProps1['aria-label'];
617
- return /*#__PURE__*/React.createElement(React.Fragment, null, (_ref4 = sstyled(styles), /*#__PURE__*/React.createElement(Dropdown, _assignProps({
618
- "use:aria-label": providedAriaLabel,
619
- "__excludeProps": ['onChange', 'value']
620
- }, _ref), /*#__PURE__*/React.createElement(Children, _ref4.cn("Children", {})))));
339
+ }],
340
+ highlighted: null,
341
+ compareHighlighted: null,
342
+ preselectedValue: null,
343
+ preselectedCompare: null,
344
+ compareToggle: null,
345
+ focusedRange: null,
346
+ value: [null, value => {
347
+ const dates = [value?.value, value?.compare].flat(2).filter(date => date?.isValid?.());
348
+ if (dates.length > 0) this.handlers.displayedPeriod(getLatestDate(value));
349
+ }]
350
+ };
351
+ }
352
+ getApplyProps() {
353
+ const {
354
+ getI18nText
355
+ } = this.asProps;
356
+ return {
357
+ getI18nText,
358
+ onClick: this.handleApplyClick,
359
+ ref: this.applyButtonRef
360
+ };
361
+ }
362
+ getResetProps() {
363
+ const {
364
+ getI18nText
365
+ } = this.asProps;
366
+ return {
367
+ getI18nText,
368
+ onClick: () => this.handleApply(null, null),
369
+ ref: this.resetButtonRef
370
+ };
371
+ }
372
+ isDisabled(date) {
373
+ const {
374
+ disabled
375
+ } = this.asProps;
376
+ return disabled.some(includesDate(dayjs(date), 'date'));
377
+ }
378
+ getDefaultPeriods() {
379
+ const {
380
+ getI18nText
381
+ } = this.asProps;
382
+ const today = new Date(new Date().setHours(0, 0, 0, 0));
383
+ return [{
384
+ children: getI18nText('lastMonth'),
385
+ value: [dayjs(today).subtract(1, 'month').startOf('month').toDate(), dayjs(today).startOf('month').toDate()]
386
+ }, {
387
+ children: getI18nText('last3Months'),
388
+ value: [dayjs(today).subtract(2, 'month').startOf('month').toDate(), dayjs(today).startOf('month').toDate()]
389
+ }, {
390
+ children: getI18nText('last6Months'),
391
+ value: [dayjs(today).subtract(5, 'month').startOf('month').toDate(), dayjs(today).startOf('month').toDate()]
392
+ }, {
393
+ children: getI18nText('last12Months'),
394
+ value: [dayjs(today).subtract(11, 'month').startOf('month').toDate(), dayjs(today).startOf('month').toDate()]
395
+ }];
396
+ }
397
+ getTitleProps(_props, index) {
398
+ const {
399
+ locale,
400
+ displayedPeriod
401
+ } = this.asProps;
402
+ return {
403
+ children: new Intl.DateTimeFormat(locale, {
404
+ month: 'long',
405
+ year: 'numeric'
406
+ }).format(dayjs(displayedPeriod).add(index, this.navigateStep).startOf(this.navigateStep).toDate())
407
+ };
408
+ }
409
+ getTriggerProps({
410
+ placeholder = 'Select date ranges',
411
+ separator = 'vs.'
412
+ }) {
413
+ const {
414
+ locale,
415
+ visible
416
+ } = this.asProps;
417
+ const value = this.asProps.value?.value;
418
+ const compare = this.asProps.value?.compare;
419
+ const formattingProps = {
420
+ locale,
421
+ ...this.triggerFormattingProps
422
+ };
423
+ let children = placeholder;
424
+ if (value?.[0] && value?.[1]) {
425
+ children = shortDateRangeFormat(value, formattingProps);
621
426
  }
622
- }], [{
623
- key: "defaultProps",
624
- value: function defaultProps(_ref1) {
625
- var primaryRange = _ref1.primaryRange,
626
- defaultPrimaryRange = _ref1.defaultPrimaryRange,
627
- secondaryRange = _ref1.secondaryRange,
628
- defaultSecondaryRange = _ref1.defaultSecondaryRange;
629
- return {
630
- i18n: localizedMessages,
631
- locale: 'en',
632
- defaultValue: null,
633
- defaultHighlighted: [],
634
- defaultCompareHighlighted: [],
635
- defaultDisplayedPeriod: getLatestDate(primaryRange, defaultPrimaryRange, secondaryRange, defaultSecondaryRange) || defaultDisplayedPeriod,
636
- defaultVisible: false,
637
- defaultPreselectedValue: null,
638
- defaultPreselectedCompare: null,
639
- defaultCompareToggle: null,
640
- defaultFocusedRange: 'value',
641
- disabled: [],
642
- size: 'm'
643
- };
427
+ if (compare?.[0] && compare?.[1]) {
428
+ children = `${children || ''} ${separator} ${shortDateRangeFormat(compare, formattingProps)}`;
644
429
  }
645
- }]);
646
- }(Component);
430
+ return {
431
+ children,
432
+ visible,
433
+ onClick: () => this.handlers.visible(!visible),
434
+ onKeyDown: this.handleKeydownDown('trigger')
435
+ };
436
+ }
437
+ getRangeInput() {
438
+ throw new Error('not implemented');
439
+ }
440
+ getRangeInputProps() {
441
+ return {
442
+ inputRole: null
443
+ };
444
+ }
445
+ getValueDateRangeProps() {
446
+ const {
447
+ value,
448
+ onDisplayedPeriodChange,
449
+ locale,
450
+ disabled,
451
+ disabledErrorText,
452
+ getI18nText,
453
+ focusedRange,
454
+ preselectedValue,
455
+ animationsDisabled,
456
+ visible
457
+ } = this.asProps;
458
+ return {
459
+ popoverVisible: visible,
460
+ focused: focusedRange === 'value' ? true : undefined,
461
+ value: preselectedValue ?? value?.value,
462
+ onChange: value => this.handlers.preselectedValue(value),
463
+ onDisplayedPeriodChange,
464
+ locale,
465
+ disabledDates: disabled,
466
+ disabledErrorText,
467
+ children: this.getRangeInput(),
468
+ getI18nText,
469
+ onFocus: () => {
470
+ this.handlers.focusedRange('value');
471
+ },
472
+ animationsDisabled
473
+ };
474
+ }
475
+ getCompareDateRangeProps() {
476
+ const {
477
+ value,
478
+ onDisplayedPeriodChange,
479
+ locale,
480
+ disabled,
481
+ disabledErrorText,
482
+ getI18nText,
483
+ focusedRange,
484
+ preselectedCompare,
485
+ compareToggle,
486
+ animationsDisabled,
487
+ visible
488
+ } = this.asProps;
489
+ return {
490
+ popoverVisible: visible,
491
+ focused: focusedRange === 'compare' ? true : undefined,
492
+ disabled: !(compareToggle ?? value?.compare?.length),
493
+ value: preselectedCompare ?? value?.compare,
494
+ onChange: value => this.handlers.preselectedCompare(value),
495
+ onDisplayedPeriodChange,
496
+ locale,
497
+ disabledDates: disabled,
498
+ children: this.getRangeInput(),
499
+ getI18nText,
500
+ disabledErrorText,
501
+ onFocus: () => {
502
+ this.handlers.focusedRange('compare');
503
+ },
504
+ animationsDisabled
505
+ };
506
+ }
507
+ getCompareToggleProps() {
508
+ const {
509
+ getI18nText,
510
+ compareToggle
511
+ } = this.asProps;
512
+ return {
513
+ getI18nText,
514
+ checked: compareToggle,
515
+ onChange: checked => {
516
+ if (checked) {
517
+ this.handlers.compareToggle(true);
518
+ this.handlers.focusedRange('compare');
519
+ } else {
520
+ this.handlers.compareToggle(false);
521
+ this.handlers.focusedRange('value');
522
+ this.handlers.preselectedCompare([]);
523
+ }
524
+ }
525
+ };
526
+ }
527
+ getCalendarProps(_props, index) {
528
+ const {
529
+ locale,
530
+ displayedPeriod,
531
+ disabled,
532
+ value,
533
+ onCompareHighlightedChange,
534
+ highlighted,
535
+ compareHighlighted,
536
+ onHighlightedChange,
537
+ preselectedCompare,
538
+ preselectedValue,
539
+ focusedRange,
540
+ getI18nText
541
+ } = this.asProps;
542
+ return {
543
+ locale,
544
+ displayedPeriod: dayjs(displayedPeriod).add(index, this.navigateStep).startOf(this.navigateStep).toDate(),
545
+ disabled,
546
+ onChange: this.handleChange,
547
+ highlighted,
548
+ compareHighlighted,
549
+ onCompareHighlightedChange,
550
+ onHighlightedChange,
551
+ range: focusedRange,
552
+ value: preselectedValue ?? value?.value,
553
+ compare: preselectedCompare ?? value?.compare,
554
+ unitRefs: this.unitRefs,
555
+ getI18nText,
556
+ actionsDescribing: index === 0 ? 'range-compare' : null,
557
+ tabIndex: index === 0 ? 0 : -1
558
+ };
559
+ }
560
+ getPopperProps() {
561
+ return {
562
+ p: 0,
563
+ ref: this.popperRef,
564
+ onKeyDown: this.handleKeydownDown('popper')
565
+ };
566
+ }
567
+ render() {
568
+ var _ref = this.asProps,
569
+ _ref4;
570
+ const {
571
+ Children,
572
+ styles,
573
+ 'aria-label': providedAriaLabel
574
+ } = this.asProps;
575
+ return /*#__PURE__*/React.createElement(React.Fragment, null, (_ref4 = sstyled(styles), /*#__PURE__*/React.createElement(Dropdown, _assignProps({
576
+ "use:aria-label": providedAriaLabel,
577
+ "__excludeProps": ['onChange', 'value']
578
+ }, _ref), /*#__PURE__*/React.createElement(Children, _ref4.cn("Children", {})))));
579
+ }
580
+ }
647
581
  _defineProperty(DateRangeComparatorAbstract, "displayName", 'DateRangeComparator');
648
582
  _defineProperty(DateRangeComparatorAbstract, "style", style);
649
583
  _defineProperty(DateRangeComparatorAbstract, "enhance", [i18nEnhance(localizedMessages)]);
650
- _defineProperty(DateRangeComparatorAbstract, "subtract", function (date, amount, unit) {
584
+ _defineProperty(DateRangeComparatorAbstract, "subtract", (date, amount, unit) => {
651
585
  return dayjs(date).subtract(amount, unit).toDate();
652
586
  });
653
587
  function Apply(props) {
654
588
  var _ref2 = arguments[0];
655
- var getI18nText = props.getI18nText;
589
+ const {
590
+ getI18nText
591
+ } = props;
656
592
  return /*#__PURE__*/React.createElement(Button, _assignProps2({
657
593
  "use": 'primary',
658
594
  "children": getI18nText('apply')
@@ -660,7 +596,9 @@ function Apply(props) {
660
596
  }
661
597
  function Reset(props) {
662
598
  var _ref3 = arguments[0];
663
- var getI18nText = props.getI18nText;
599
+ const {
600
+ getI18nText
601
+ } = props;
664
602
  return /*#__PURE__*/React.createElement(Button, _assignProps3({
665
603
  "use": 'tertiary',
666
604
  "theme": 'muted',
@@ -669,8 +607,10 @@ function Reset(props) {
669
607
  }
670
608
  function Trigger(props) {
671
609
  var _ref5;
672
- var STrigger = props.Root,
673
- styles = props.styles;
610
+ const {
611
+ Root: STrigger,
612
+ styles
613
+ } = props;
674
614
  return _ref5 = sstyled(styles), /*#__PURE__*/React.createElement(STrigger, _ref5.cn("STrigger", {
675
615
  "render": Dropdown.Trigger,
676
616
  "tag": LinkTrigger
@@ -678,9 +618,11 @@ function Trigger(props) {
678
618
  }
679
619
  function CompareToggle(props) {
680
620
  var _ref6;
681
- var SCompareToggle = props.Root,
682
- styles = props.styles,
683
- getI18nText = props.getI18nText;
621
+ const {
622
+ Root: SCompareToggle,
623
+ styles,
624
+ getI18nText
625
+ } = props;
684
626
  return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(SCompareToggle, _ref6.cn("SCompareToggle", {
685
627
  "render": Checkbox,
686
628
  "label": getI18nText('compare')
@@ -688,9 +630,11 @@ function CompareToggle(props) {
688
630
  }
689
631
  function Header(props) {
690
632
  var _ref7;
691
- var SRangeComparatorHeader = props.Root,
692
- Children = props.Children,
693
- styles = props.styles;
633
+ const {
634
+ Root: SRangeComparatorHeader,
635
+ Children,
636
+ styles
637
+ } = props;
694
638
  return _ref7 = sstyled(styles), /*#__PURE__*/React.createElement(SRangeComparatorHeader, _ref7.cn("SRangeComparatorHeader", {
695
639
  "render": Flex,
696
640
  "gap": 4,
@@ -699,9 +643,11 @@ function Header(props) {
699
643
  }
700
644
  function Body(props) {
701
645
  var _ref8;
702
- var SBody = props.Root,
703
- Children = props.Children,
704
- styles = props.styles;
646
+ const {
647
+ Root: SBody,
648
+ Children,
649
+ styles
650
+ } = props;
705
651
  return _ref8 = sstyled(styles), /*#__PURE__*/React.createElement(SBody, _ref8.cn("SBody", {
706
652
  "render": Flex,
707
653
  "gap": 4
@@ -709,9 +655,11 @@ function Body(props) {
709
655
  }
710
656
  function Footer(props) {
711
657
  var _ref9;
712
- var SFooter = props.Root,
713
- styles = props.styles,
714
- Children = props.Children;
658
+ const {
659
+ Root: SFooter,
660
+ styles,
661
+ Children
662
+ } = props;
715
663
  return _ref9 = sstyled(styles), /*#__PURE__*/React.createElement(SFooter, _ref9.cn("SFooter", {
716
664
  "render": Flex,
717
665
  "gap": 2