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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/lib/cjs/DatePicker.js +3 -4
  3. package/lib/cjs/DatePicker.js.map +1 -1
  4. package/lib/cjs/DateRangeComparator.js +2 -2
  5. package/lib/cjs/DateRangeComparator.js.map +1 -1
  6. package/lib/cjs/DateRangePicker.js +2 -2
  7. package/lib/cjs/DateRangePicker.js.map +1 -1
  8. package/lib/cjs/MonthDateRangeComparator.js +2 -2
  9. package/lib/cjs/MonthDateRangeComparator.js.map +1 -1
  10. package/lib/cjs/MonthPicker.js +2 -2
  11. package/lib/cjs/MonthPicker.js.map +1 -1
  12. package/lib/cjs/MonthRangePicker.js +2 -2
  13. package/lib/cjs/MonthRangePicker.js.map +1 -1
  14. package/lib/cjs/components/ButtonTrigger.js +3 -4
  15. package/lib/cjs/components/ButtonTrigger.js.map +1 -1
  16. package/lib/cjs/components/Calendar.js +27 -29
  17. package/lib/cjs/components/Calendar.js.map +1 -1
  18. package/lib/cjs/components/DateRangeComparatorAbstract.js +30 -31
  19. package/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
  20. package/lib/cjs/components/InputTrigger.js +35 -37
  21. package/lib/cjs/components/InputTrigger.js.map +1 -1
  22. package/lib/cjs/components/PickerAbstract.js +30 -31
  23. package/lib/cjs/components/PickerAbstract.js.map +1 -1
  24. package/lib/cjs/components/RangePickerAbstract.js +30 -31
  25. package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
  26. package/lib/cjs/components/index.js +1 -1
  27. package/lib/cjs/components/index.js.map +1 -1
  28. package/lib/cjs/index.d.js.map +1 -1
  29. package/lib/cjs/style/calendar.shadow.css +5 -1
  30. package/lib/es6/DatePicker.js +2 -2
  31. package/lib/es6/DatePicker.js.map +1 -1
  32. package/lib/es6/DateRangeComparator.js +1 -1
  33. package/lib/es6/DateRangeComparator.js.map +1 -1
  34. package/lib/es6/DateRangePicker.js +1 -1
  35. package/lib/es6/DateRangePicker.js.map +1 -1
  36. package/lib/es6/MonthDateRangeComparator.js +1 -1
  37. package/lib/es6/MonthDateRangeComparator.js.map +1 -1
  38. package/lib/es6/MonthPicker.js +1 -1
  39. package/lib/es6/MonthPicker.js.map +1 -1
  40. package/lib/es6/MonthRangePicker.js +1 -1
  41. package/lib/es6/MonthRangePicker.js.map +1 -1
  42. package/lib/es6/components/ButtonTrigger.js +2 -2
  43. package/lib/es6/components/ButtonTrigger.js.map +1 -1
  44. package/lib/es6/components/Calendar.js +25 -25
  45. package/lib/es6/components/Calendar.js.map +1 -1
  46. package/lib/es6/components/DateRangeComparatorAbstract.js +31 -31
  47. package/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
  48. package/lib/es6/components/InputTrigger.js +33 -33
  49. package/lib/es6/components/InputTrigger.js.map +1 -1
  50. package/lib/es6/components/PickerAbstract.js +31 -31
  51. package/lib/es6/components/PickerAbstract.js.map +1 -1
  52. package/lib/es6/components/RangePickerAbstract.js +31 -31
  53. package/lib/es6/components/RangePickerAbstract.js.map +1 -1
  54. package/lib/es6/components/index.js +1 -1
  55. package/lib/es6/components/index.js.map +1 -1
  56. package/lib/es6/index.d.js.map +1 -1
  57. package/lib/es6/style/calendar.shadow.css +5 -1
  58. package/lib/esm/DatePicker.mjs +114 -103
  59. package/lib/esm/DateRangeComparator.mjs +166 -149
  60. package/lib/esm/DateRangePicker.mjs +85 -77
  61. package/lib/esm/MonthDateRangeComparator.mjs +187 -169
  62. package/lib/esm/MonthPicker.mjs +78 -71
  63. package/lib/esm/MonthRangePicker.mjs +94 -85
  64. package/lib/esm/components/ButtonTrigger.mjs +16 -15
  65. package/lib/esm/components/Calendar.mjs +404 -286
  66. package/lib/esm/components/DateRangeComparatorAbstract.mjs +453 -329
  67. package/lib/esm/components/InputTrigger.mjs +757 -518
  68. package/lib/esm/components/PickerAbstract.mjs +191 -148
  69. package/lib/esm/components/RangePickerAbstract.mjs +305 -220
  70. package/lib/esm/components/index.mjs +127 -109
  71. package/lib/esm/index.mjs +13 -13
  72. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +32 -32
  73. package/lib/esm/translations/de.json.mjs +83 -56
  74. package/lib/esm/translations/en.json.mjs +95 -64
  75. package/lib/esm/translations/es.json.mjs +83 -56
  76. package/lib/esm/translations/fr.json.mjs +83 -56
  77. package/lib/esm/translations/it.json.mjs +83 -56
  78. package/lib/esm/translations/ja.json.mjs +83 -56
  79. package/lib/esm/translations/ko.json.mjs +83 -56
  80. package/lib/esm/translations/nl.json.mjs +83 -56
  81. package/lib/esm/translations/pl.json.mjs +83 -56
  82. package/lib/esm/translations/pt.json.mjs +83 -56
  83. package/lib/esm/translations/ru.json.mjs +35 -24
  84. package/lib/esm/translations/sv.json.mjs +83 -56
  85. package/lib/esm/translations/tr.json.mjs +83 -56
  86. package/lib/esm/translations/vi.json.mjs +83 -56
  87. package/lib/esm/translations/zh.json.mjs +83 -56
  88. package/lib/esm/utils/cronTabScheduler.mjs +58 -52
  89. package/lib/esm/utils/datesIntersects.mjs +15 -11
  90. package/lib/esm/utils/formatDate.mjs +25 -18
  91. package/lib/esm/utils/includesDate.mjs +13 -9
  92. package/lib/esm/utils/shortDateRangeFormat.mjs +53 -31
  93. package/lib/types/index.d.ts +1 -1
  94. package/package.json +15 -18
@@ -1,213 +1,304 @@
1
- import U from "@babel/runtime/helpers/esm/objectSpread2";
2
- import q from "@babel/runtime/helpers/esm/slicedToArray";
3
- import J from "@babel/runtime/helpers/esm/classCallCheck";
4
- import Q from "@babel/runtime/helpers/esm/createClass";
5
- import D from "@babel/runtime/helpers/esm/assertThisInitialized";
6
- import W from "@babel/runtime/helpers/esm/inherits";
7
- import X from "@babel/runtime/helpers/esm/createSuper";
8
- import y from "@babel/runtime/helpers/esm/defineProperty";
9
- import { sstyled as Z } from "@semcore/utils/lib/core/index";
10
- import { sstyled as R, assignProps as E, Component as ee } from "@semcore/core";
11
- import S from "react";
12
- import x from "dayjs";
13
- import O from "@semcore/button";
14
- import { Flex as A } from "@semcore/flex-box";
15
- import Y from "@semcore/dropdown";
16
- import ae from "@semcore/utils/lib/enhances/i18nEnhance";
17
- import { localizedMessages as B } from "../translations/__intergalactic-dynamic-locales.mjs";
18
- import F from "../utils/shortDateRangeFormat.mjs";
19
- import re from "@semcore/checkbox";
20
- import { LinkTrigger as te } from "@semcore/base-trigger";
21
- import { includesDate as ne } from "../utils/includesDate.mjs";
22
- import { formatMMYY as oe, formatDDMMYY as ie } from "../utils/formatDate.mjs";
23
- var le = (
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
5
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
6
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
7
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
8
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
+ import { sstyled, assignProps, Component } from "@semcore/core";
10
+ import React from "react";
11
+ import dayjs from "dayjs";
12
+ import Button from "@semcore/button";
13
+ import { Flex } from "@semcore/flex-box";
14
+ import Dropdown from "@semcore/dropdown";
15
+ import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
16
+ import { localizedMessages } from "../translations/__intergalactic-dynamic-locales.mjs";
17
+ import shortDateRangeFormat from "../utils/shortDateRangeFormat.mjs";
18
+ import Checkbox from "@semcore/checkbox";
19
+ import { LinkTrigger } from "@semcore/base-trigger";
20
+ import { includesDate } from "../utils/includesDate.mjs";
21
+ import { formatMMYY, formatDDMMYY } from "../utils/formatDate.mjs";
22
+ var style = (
24
23
  /*__reshadow_css_start__*/
25
- (Z.insert(
24
+ (sstyled.insert(
26
25
  /*__inner_css_start__*/
27
- ".___SPopper_1mx7u_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_1mx7u_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_1mx7u_gg_:active,.___SPopper_1mx7u_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_1mx7u_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SPopper_1mx7u_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SHeader_1mx7u_gg_,.___STitle_1mx7u_gg_{display:flex;align-items:center}.___STitle_1mx7u_gg_{font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-primary, #191b23);height:32px;width:100%;justify-content:center}.___SToday_1mx7u_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_1mx7u_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_1mx7u_gg_ .___SInner_1mx7u_gg_{justify-content:flex-start}.___SInputMask_1mx7u_gg_{color:var(--intergalactic-text-primary, #191b23);line-height:normal;padding-right:var(--intergalactic-spacing-2x, 8px);transition:width calc(var(--intergalactic-duration-medium, 300)*1ms) ease,min-width calc(var(--intergalactic-duration-medium, 300)*1ms) ease}.___SInputMask_1mx7u_gg_.__animationsDisabled_1mx7u_gg_{transition:none}.___SInputMask_1mx7u_gg_ .___SValue_1mx7u_gg_{letter-spacing:0}.___SIndicator_1mx7u_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}.___SRangeIndicator_1mx7u_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_1mx7u_gg_._range_value_1mx7u_gg_{background-color:var(--intergalactic-date-picker-cell-active, #2bb3ff)}.___SRangeIndicator_1mx7u_gg_._range_compare_1mx7u_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, #8649e1)}.___SRangeIndicator_1mx7u_gg_.__disabled_1mx7u_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SHumanizedDate_1mx7u_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_1mx7u_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_1mx7u_gg_ .___SMask_1mx7u_gg_,.___SDateRange_1mx7u_gg_ .___SValue_1mx7u_gg_,.___SSingleDateInput_1mx7u_gg_ .___SMask_1mx7u_gg_,.___SSingleDateInput_1mx7u_gg_ .___SValue_1mx7u_gg_{opacity:0}.___SSingleDateInput_1mx7u_gg_:focus-within .___SHumanizedDate_1mx7u_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_1mx7u_gg_:focus-within .___SMask_1mx7u_gg_,.___SSingleDateInput_1mx7u_gg_:focus-within .___SValue_1mx7u_gg_{opacity:1}.___SDateRange_1mx7u_gg_:focus-within .___SHumanizedDate_1mx7u_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_1mx7u_gg_:focus-within .___SMask_1mx7u_gg_,.___SDateRange_1mx7u_gg_:focus-within .___SValue_1mx7u_gg_{opacity:1}.___SInputMask_1mx7u_gg_.__noHumanizedDate_1mx7u_gg_ .___SMask_1mx7u_gg_,.___SInputMask_1mx7u_gg_.__noHumanizedDate_1mx7u_gg_ .___SValue_1mx7u_gg_{opacity:1}.___SDateRange_1mx7u_gg_ .___SInputMask_1mx7u_gg_:focus-within .___SMask_1mx7u_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgba(0, 143, 248, 0.2))}.___SDateRange_1mx7u_gg_:focus-within .___SRangeSep_1mx7u_gg_,.___SRangeSep_1mx7u_gg_.__fulfilled_1mx7u_gg_{color:var(--intergalactic-text-primary, #191b23)}.___SRangeComparatorHeader_1mx7u_gg_{border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SRangeCalendar_1mx7u_gg_,.___SRangeComparatorHeader_1mx7u_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_1mx7u_gg_{border-top:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SFooter_1mx7u_gg_,.___SPeriodsList_1mx7u_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_1mx7u_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_1mx7u_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_1mx7u_gg_{transition:none}}",
28
- "1mx7u_gg_"
26
+ ".___SPopper_1plgq_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_1plgq_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_1plgq_gg_:active,.___SPopper_1plgq_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_1plgq_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SPopper_1plgq_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SHeader_1plgq_gg_,.___STitle_1plgq_gg_{display:flex;align-items:center}.___STitle_1plgq_gg_{font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-primary, #191b23);height:32px;width:100%;justify-content:center}.___SToday_1plgq_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_1plgq_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_1plgq_gg_ .___SInner_1plgq_gg_{justify-content:flex-start}.___SInputMask_1plgq_gg_{color:var(--intergalactic-text-primary, #191b23);line-height:normal;padding-right:var(--intergalactic-spacing-2x, 8px);transition:width calc(var(--intergalactic-duration-medium, 300)*1ms) ease,min-width calc(var(--intergalactic-duration-medium, 300)*1ms) ease}.___SInputMask_1plgq_gg_.__animationsDisabled_1plgq_gg_{transition:none}.___SInputMask_1plgq_gg_ .___SValue_1plgq_gg_{letter-spacing:0}.___SIndicator_1plgq_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}.___SRangeIndicator_1plgq_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_1plgq_gg_._range_value_1plgq_gg_{background-color:var(--intergalactic-date-picker-cell-active, #2bb3ff)}.___SRangeIndicator_1plgq_gg_._range_compare_1plgq_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, #8649e1)}.___SRangeIndicator_1plgq_gg_.__disabled_1plgq_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SHumanizedDate_1plgq_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_1plgq_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_1plgq_gg_ .___SMask_1plgq_gg_,.___SDateRange_1plgq_gg_ .___SValue_1plgq_gg_,.___SSingleDateInput_1plgq_gg_ .___SMask_1plgq_gg_,.___SSingleDateInput_1plgq_gg_ .___SValue_1plgq_gg_{opacity:0}.___SSingleDateInput_1plgq_gg_:focus-within .___SHumanizedDate_1plgq_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_1plgq_gg_:focus-within .___SMask_1plgq_gg_,.___SSingleDateInput_1plgq_gg_:focus-within .___SValue_1plgq_gg_{opacity:1}.___SDateRange_1plgq_gg_:focus-within .___SHumanizedDate_1plgq_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_1plgq_gg_:focus-within .___SMask_1plgq_gg_,.___SDateRange_1plgq_gg_:focus-within .___SValue_1plgq_gg_{opacity:1}.___SInputMask_1plgq_gg_.__noHumanizedDate_1plgq_gg_ .___SMask_1plgq_gg_,.___SInputMask_1plgq_gg_.__noHumanizedDate_1plgq_gg_ .___SValue_1plgq_gg_{opacity:1}.___SDateRange_1plgq_gg_ .___SInputMask_1plgq_gg_:focus-within .___SMask_1plgq_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgba(0, 143, 248, 0.2))}.___SDateRange_1plgq_gg_:focus-within .___SRangeSep_1plgq_gg_,.___SRangeSep_1plgq_gg_.__fulfilled_1plgq_gg_{color:var(--intergalactic-text-primary, #191b23)}.___SRangeComparatorHeader_1plgq_gg_{border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SRangeCalendar_1plgq_gg_,.___SRangeComparatorHeader_1plgq_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_1plgq_gg_{border-top:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SFooter_1plgq_gg_,.___SPeriodsList_1plgq_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_1plgq_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_1plgq_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_1plgq_gg_{transition:none}}",
27
+ "1plgq_gg_"
29
28
  ), {
30
- __SHeader: "___SHeader_1mx7u_gg_",
31
- __STitle: "___STitle_1mx7u_gg_",
32
- __SToday: "___SToday_1mx7u_gg_",
33
- __SPeriod: "___SPeriod_1mx7u_gg_",
34
- __SButton: "___SButton_1mx7u_gg_",
35
- __SInner: "___SInner_1mx7u_gg_",
36
- __SInputMask: "___SInputMask_1mx7u_gg_",
37
- _animationsDisabled: "__animationsDisabled_1mx7u_gg_",
38
- __SValue: "___SValue_1mx7u_gg_",
39
- __SIndicator: "___SIndicator_1mx7u_gg_",
40
- __SRangeIndicator: "___SRangeIndicator_1mx7u_gg_",
41
- _range_value: "_range_value_1mx7u_gg_",
42
- _range_compare: "_range_compare_1mx7u_gg_",
43
- _disabled: "__disabled_1mx7u_gg_",
44
- __SHumanizedDate: "___SHumanizedDate_1mx7u_gg_",
45
- __SMask: "___SMask_1mx7u_gg_",
46
- __SSingleDateInput: "___SSingleDateInput_1mx7u_gg_",
47
- __SDateRange: "___SDateRange_1mx7u_gg_",
48
- _noHumanizedDate: "__noHumanizedDate_1mx7u_gg_",
49
- __SRangeSep: "___SRangeSep_1mx7u_gg_",
50
- _fulfilled: "__fulfilled_1mx7u_gg_",
51
- __SRangeComparatorHeader: "___SRangeComparatorHeader_1mx7u_gg_",
52
- __SRangeCalendar: "___SRangeCalendar_1mx7u_gg_",
53
- __SFooter: "___SFooter_1mx7u_gg_",
54
- __SPeriodsList: "___SPeriodsList_1mx7u_gg_",
55
- __STooltip: "___STooltip_1mx7u_gg_",
56
- __SCompareToggle: "___SCompareToggle_1mx7u_gg_",
57
- __SPopper: "___SPopper_1mx7u_gg_"
29
+ "__SHeader": "___SHeader_1plgq_gg_",
30
+ "__STitle": "___STitle_1plgq_gg_",
31
+ "__SToday": "___SToday_1plgq_gg_",
32
+ "__SPeriod": "___SPeriod_1plgq_gg_",
33
+ "__SButton": "___SButton_1plgq_gg_",
34
+ "__SInner": "___SInner_1plgq_gg_",
35
+ "__SInputMask": "___SInputMask_1plgq_gg_",
36
+ "_animationsDisabled": "__animationsDisabled_1plgq_gg_",
37
+ "__SValue": "___SValue_1plgq_gg_",
38
+ "__SIndicator": "___SIndicator_1plgq_gg_",
39
+ "__SRangeIndicator": "___SRangeIndicator_1plgq_gg_",
40
+ "_range_value": "_range_value_1plgq_gg_",
41
+ "_range_compare": "_range_compare_1plgq_gg_",
42
+ "_disabled": "__disabled_1plgq_gg_",
43
+ "__SHumanizedDate": "___SHumanizedDate_1plgq_gg_",
44
+ "__SMask": "___SMask_1plgq_gg_",
45
+ "__SSingleDateInput": "___SSingleDateInput_1plgq_gg_",
46
+ "__SDateRange": "___SDateRange_1plgq_gg_",
47
+ "_noHumanizedDate": "__noHumanizedDate_1plgq_gg_",
48
+ "__SRangeSep": "___SRangeSep_1plgq_gg_",
49
+ "_fulfilled": "__fulfilled_1plgq_gg_",
50
+ "__SRangeComparatorHeader": "___SRangeComparatorHeader_1plgq_gg_",
51
+ "__SRangeCalendar": "___SRangeCalendar_1plgq_gg_",
52
+ "__SFooter": "___SFooter_1plgq_gg_",
53
+ "__SPeriodsList": "___SPeriodsList_1plgq_gg_",
54
+ "__STooltip": "___STooltip_1plgq_gg_",
55
+ "__SCompareToggle": "___SCompareToggle_1plgq_gg_",
56
+ "__SPopper": "___SPopper_1plgq_gg_"
58
57
  })
59
- ), _e = ["INPUT"], ge = ["ArrowDown", "Enter", " "], se = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)), M = function() {
60
- for (var s = arguments.length, u = new Array(s), e = 0; e < s; e++)
61
- u[e] = arguments[e];
62
- var a = u.flat().filter(Boolean).filter(function(t) {
63
- return !Number.isNaN(new Date(t).getTime());
58
+ );
59
+ var INTERACTION_TAGS = ["INPUT"];
60
+ var INTERACTION_KEYS = ["ArrowDown", "Enter", " "];
61
+ var defaultDisplayedPeriod = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
62
+ var getLatestDate = function getLatestDate2() {
63
+ for (var _len = arguments.length, dateRanges = new Array(_len), _key = 0; _key < _len; _key++) {
64
+ dateRanges[_key] = arguments[_key];
65
+ }
66
+ var allDates = dateRanges.flat().filter(Boolean).filter(function(date) {
67
+ return !Number.isNaN(new Date(date).getTime());
64
68
  });
65
- if (!a.length) return null;
66
- a.sort(function(t, n) {
67
- return new Date(n).getTime() - new Date(t).getTime();
69
+ if (!allDates.length) return null;
70
+ allDates.sort(function(a, b) {
71
+ return new Date(b).getTime() - new Date(a).getTime();
68
72
  });
69
- var r = a[0];
70
- return r;
71
- }, T = /* @__PURE__ */ function(d) {
72
- W(u, d);
73
- var s = X(u);
74
- function u() {
75
- var e;
76
- J(this, u);
77
- for (var a = arguments.length, r = new Array(a), t = 0; t < a; t++)
78
- r[t] = arguments[t];
79
- return e = s.call.apply(s, [this].concat(r)), y(D(e), "popperRef", /* @__PURE__ */ S.createRef()), y(D(e), "unitRefs", {}), y(D(e), "navigateView", function(n) {
80
- var o = e.asProps.displayedPeriod, _ = n >= 1 ? "add" : "subtract", i = x(o)[_](1, e.navigateStep).toDate();
81
- e.handlers.displayedPeriod(i);
82
- }), y(D(e), "bindHandlerNavigateClick", function(n) {
73
+ var latestDate = allDates[0];
74
+ return latestDate;
75
+ };
76
+ var DateRangeComparatorAbstract = /* @__PURE__ */ function(_Component) {
77
+ _inherits(DateRangeComparatorAbstract2, _Component);
78
+ var _super = _createSuper(DateRangeComparatorAbstract2);
79
+ function DateRangeComparatorAbstract2() {
80
+ var _this;
81
+ _classCallCheck(this, DateRangeComparatorAbstract2);
82
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
83
+ args[_key2] = arguments[_key2];
84
+ }
85
+ _this = _super.call.apply(_super, [this].concat(args));
86
+ _defineProperty(_assertThisInitialized(_this), "popperRef", /* @__PURE__ */ React.createRef());
87
+ _defineProperty(_assertThisInitialized(_this), "unitRefs", {});
88
+ _defineProperty(_assertThisInitialized(_this), "navigateView", function(direction) {
89
+ var displayedPeriod = _this.asProps.displayedPeriod;
90
+ var action = direction >= 1 ? "add" : "subtract";
91
+ var date = dayjs(displayedPeriod)[action](1, _this.navigateStep).toDate();
92
+ _this.handlers.displayedPeriod(date);
93
+ });
94
+ _defineProperty(_assertThisInitialized(_this), "bindHandlerNavigateClick", function(direction) {
83
95
  return function() {
84
- return e.navigateView(n);
96
+ return _this.navigateView(direction);
85
97
  };
86
- }), y(D(e), "handleApplyClick", function() {
87
- var n = e.asProps, o = n.value, _ = n.preselectedValue, i = n.preselectedCompare;
88
- return e.handleApply(_ ?? (o == null ? void 0 : o.value), i ?? (o == null ? void 0 : o.compare));
89
- }), y(D(e), "handleApply", function(n, o) {
90
- e.handlers.value({
91
- value: n,
92
- compare: o
93
- }), e.handlers.visible(!1);
94
- }), y(D(e), "handleKeydownDown", function(n) {
95
- return function(o) {
96
- var _ = e.asProps, i = _.displayedPeriod, p = _.preselectedValue, v = _.visible, c = _.focusedRange, m = o.key, g = c === "compare" ? e.asProps.compareHighlighted : e.asProps.highlighted;
97
- n === "trigger" && ge.includes(m) && (o.preventDefault(), o.stopPropagation(), e.handlers.visible(!v), setTimeout(function() {
98
- var w = e.popperRef.current;
99
- w && w.focus();
100
- }, 0));
101
- var l = e.keyDiff[m], h = function($) {
102
- var z = q($, 2), j = z[0], G = z[1], C = G || j, H = i == null ? void 0 : i.getDate(), V = C == null ? void 0 : C.getDate();
103
- e.navigateStep === "month" && (H = i == null ? void 0 : i.getMonth(), V = C == null ? void 0 : C.getMonth()), e.navigateStep === "year" && (H = i == null ? void 0 : i.getYear(), V = C == null ? void 0 : C.getYear());
104
- var N = V - H;
105
- return N < 0 || N > 1 ? C : i;
98
+ });
99
+ _defineProperty(_assertThisInitialized(_this), "handleApplyClick", function() {
100
+ var _this$asProps = _this.asProps, value = _this$asProps.value, preselectedValue = _this$asProps.preselectedValue, preselectedCompare = _this$asProps.preselectedCompare;
101
+ 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);
102
+ });
103
+ _defineProperty(_assertThisInitialized(_this), "handleApply", function(value, compare) {
104
+ _this.handlers.value({
105
+ value,
106
+ compare
107
+ });
108
+ _this.handlers.visible(false);
109
+ });
110
+ _defineProperty(_assertThisInitialized(_this), "handleKeydownDown", function(place) {
111
+ return function(e) {
112
+ var _this$asProps2 = _this.asProps, displayedPeriod = _this$asProps2.displayedPeriod, preselectedValue = _this$asProps2.preselectedValue, visible = _this$asProps2.visible, focusedRange = _this$asProps2.focusedRange;
113
+ var key = e.key;
114
+ var highlighted = focusedRange === "compare" ? _this.asProps.compareHighlighted : _this.asProps.highlighted;
115
+ if (place === "trigger" && INTERACTION_KEYS.includes(key)) {
116
+ e.preventDefault();
117
+ e.stopPropagation();
118
+ _this.handlers.visible(!visible);
119
+ setTimeout(function() {
120
+ var popper = _this.popperRef.current;
121
+ if (popper) {
122
+ popper.focus();
123
+ }
124
+ }, 0);
125
+ }
126
+ var day = _this.keyDiff[key];
127
+ var setNextDisplayedPeriod = function setNextDisplayedPeriod2(next_highlighted2) {
128
+ var _next_highlighted = _slicedToArray(next_highlighted2, 2), startPeriod = _next_highlighted[0], endPeriod = _next_highlighted[1];
129
+ var highlightedPeriod = endPeriod || startPeriod;
130
+ var displayedPeriodNormalized = displayedPeriod === null || displayedPeriod === void 0 ? void 0 : displayedPeriod.getDate();
131
+ var highlightedPeriodNormalized = highlightedPeriod === null || highlightedPeriod === void 0 ? void 0 : highlightedPeriod.getDate();
132
+ if (_this.navigateStep === "month") {
133
+ displayedPeriodNormalized = displayedPeriod === null || displayedPeriod === void 0 ? void 0 : displayedPeriod.getMonth();
134
+ highlightedPeriodNormalized = highlightedPeriod === null || highlightedPeriod === void 0 ? void 0 : highlightedPeriod.getMonth();
135
+ }
136
+ if (_this.navigateStep === "year") {
137
+ displayedPeriodNormalized = displayedPeriod === null || displayedPeriod === void 0 ? void 0 : displayedPeriod.getYear();
138
+ highlightedPeriodNormalized = highlightedPeriod === null || highlightedPeriod === void 0 ? void 0 : highlightedPeriod.getYear();
139
+ }
140
+ var offset = highlightedPeriodNormalized - displayedPeriodNormalized;
141
+ if (offset < 0 || offset > 1) {
142
+ return highlightedPeriod;
143
+ }
144
+ return displayedPeriod;
106
145
  };
107
- if (n === "popper" && o.key === " " && g.length) {
108
- var f = g[1] || g[0];
109
- e.isDisabled(f) || e.handleChange(f), o.preventDefault();
146
+ if (place === "popper" && e.key === " " && highlighted.length) {
147
+ var highlightedDate = highlighted[1] || highlighted[0];
148
+ if (!_this.isDisabled(highlightedDate)) {
149
+ _this.handleChange(highlightedDate);
150
+ }
151
+ e.preventDefault();
110
152
  }
111
- if (n === "popper" && o.key === "Enter" && (o.metaKey || o.ctrlKey))
112
- return e.handleApplyClick();
113
- var P = void 0;
114
- if (l) {
115
- if (_e.includes(o.target.tagName)) return;
116
- if (g.length) {
117
- var b;
118
- (p == null ? void 0 : p.length) === 1 ? (b = [p[0], x(g[1] || g[0]).add(l, e.keyStep).toDate()], P = b[1]) : (b = [x(g[0]).add(l, e.keyStep).toDate()], P = b[0]), c === "compare" ? e.handlers.compareHighlighted(b) : e.handlers.highlighted(b), e.handlers.displayedPeriod(h(b));
153
+ if (place === "popper" && e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
154
+ return _this.handleApplyClick();
155
+ }
156
+ var changedDate = void 0;
157
+ if (day) {
158
+ if (INTERACTION_TAGS.includes(e.target.tagName)) return;
159
+ if (highlighted.length) {
160
+ var next_highlighted;
161
+ if ((preselectedValue === null || preselectedValue === void 0 ? void 0 : preselectedValue.length) === 1) {
162
+ next_highlighted = [preselectedValue[0], dayjs(highlighted[1] || highlighted[0]).add(day, _this.keyStep).toDate()];
163
+ changedDate = next_highlighted[1];
164
+ } else {
165
+ next_highlighted = [dayjs(highlighted[0]).add(day, _this.keyStep).toDate()];
166
+ changedDate = next_highlighted[0];
167
+ }
168
+ if (focusedRange === "compare") {
169
+ _this.handlers.compareHighlighted(next_highlighted);
170
+ } else {
171
+ _this.handlers.highlighted(next_highlighted);
172
+ }
173
+ _this.handlers.displayedPeriod(setNextDisplayedPeriod(next_highlighted));
119
174
  } else {
120
- var I = [i || x().toDate()];
121
- c === "compare" ? e.handlers.compareHighlighted(I) : e.handlers.highlighted(I), P = I[0];
175
+ var _highlighted = [displayedPeriod ? displayedPeriod : dayjs().toDate()];
176
+ if (focusedRange === "compare") {
177
+ _this.handlers.compareHighlighted(_highlighted);
178
+ } else {
179
+ _this.handlers.highlighted(_highlighted);
180
+ }
181
+ changedDate = _highlighted[0];
122
182
  }
123
- if (o.preventDefault(), P) {
124
- var k, K = e.keyStep === "month" ? oe : ie, L = K(P, e.asProps.locale);
125
- (k = e.unitRefs[L]) === null || k === void 0 || k.focus();
183
+ e.preventDefault();
184
+ if (changedDate) {
185
+ var _this$unitRefs$format;
186
+ var formatter = _this.keyStep === "month" ? formatMMYY : formatDDMMYY;
187
+ var formattedDate = formatter(changedDate, _this.asProps.locale);
188
+ (_this$unitRefs$format = _this.unitRefs[formattedDate]) === null || _this$unitRefs$format === void 0 ? void 0 : _this$unitRefs$format.focus();
126
189
  }
127
190
  }
128
191
  };
129
- }), y(D(e), "triggerFormattingProps", {
192
+ });
193
+ _defineProperty(_assertThisInitialized(_this), "triggerFormattingProps", {
130
194
  day: "numeric",
131
195
  month: "short",
132
196
  year: "numeric"
133
- }), y(D(e), "handleChange", function(n) {
134
- var o, _, i, p = e.asProps, v = p.focusedRange, c = p.preselectedCompare, m = p.preselectedValue, g = [], l = v === "compare" ? c : m;
135
- if (Array.isArray(n))
136
- l = n;
137
- else if (!((o = l) !== null && o !== void 0 && o.length))
138
- l = [n], g = [n];
139
- else if (((_ = l) === null || _ === void 0 ? void 0 : _.length) >= 2)
140
- l = [n], g = [n];
141
- else if (((i = l) === null || i === void 0 ? void 0 : i[0]) > n) {
142
- var h;
143
- l = [n, (h = l) === null || h === void 0 ? void 0 : h[0]];
197
+ });
198
+ _defineProperty(_assertThisInitialized(_this), "handleChange", function(date) {
199
+ var _value, _value2, _value3;
200
+ var _this$asProps3 = _this.asProps, focusedRange = _this$asProps3.focusedRange, preselectedCompare = _this$asProps3.preselectedCompare, preselectedValue = _this$asProps3.preselectedValue;
201
+ var highlighted = [];
202
+ var value = focusedRange === "compare" ? preselectedCompare : preselectedValue;
203
+ if (Array.isArray(date)) {
204
+ value = date;
205
+ } else if (!((_value = value) !== null && _value !== void 0 && _value.length)) {
206
+ value = [date];
207
+ highlighted = [date];
208
+ } else if (((_value2 = value) === null || _value2 === void 0 ? void 0 : _value2.length) >= 2) {
209
+ value = [date];
210
+ highlighted = [date];
211
+ } else if (((_value3 = value) === null || _value3 === void 0 ? void 0 : _value3[0]) > date) {
212
+ var _value4;
213
+ value = [date, (_value4 = value) === null || _value4 === void 0 ? void 0 : _value4[0]];
214
+ } else {
215
+ var _value5;
216
+ value = [(_value5 = value) === null || _value5 === void 0 ? void 0 : _value5[0], date];
217
+ }
218
+ if (focusedRange === "compare") {
219
+ _this.handlers.preselectedCompare(value);
220
+ _this.handlers.compareHighlighted(highlighted);
144
221
  } else {
145
- var f;
146
- l = [(f = l) === null || f === void 0 ? void 0 : f[0], n];
222
+ _this.handlers.preselectedValue(value);
223
+ _this.handlers.highlighted(highlighted);
147
224
  }
148
- v === "compare" ? (e.handlers.preselectedCompare(l), e.handlers.compareHighlighted(g)) : (e.handlers.preselectedValue(l), e.handlers.highlighted(g));
149
- }), e;
225
+ });
226
+ return _this;
150
227
  }
151
- return Q(u, [{
228
+ _createClass(DateRangeComparatorAbstract2, [{
152
229
  key: "getPeriodProps",
153
- value: function() {
154
- var a, r = this, t = this.asProps, n = t.periods, o = n === void 0 ? this.getDefaultPeriods() : n, _ = t.onHighlightedChange, i = t.onCompareHighlightedChange, p = t.onDisplayedPeriodChange, v = t.preselectedValue, c = t.preselectedCompare, m = t.focusedRange, g = t.getI18nText, l = v ?? ((a = this.asProps.value) === null || a === void 0 ? void 0 : a.value);
155
- if (m === "compare") {
156
- var h;
157
- l = c ?? ((h = this.asProps.value) === null || h === void 0 ? void 0 : h.compare);
230
+ value: function getPeriodProps() {
231
+ var _this$asProps$value, _this2 = this;
232
+ var _this$asProps4 = this.asProps, _this$asProps4$period = _this$asProps4.periods, periods = _this$asProps4$period === void 0 ? this.getDefaultPeriods() : _this$asProps4$period, onHighlightedChange = _this$asProps4.onHighlightedChange, onCompareHighlightedChange = _this$asProps4.onCompareHighlightedChange, onDisplayedPeriodChange = _this$asProps4.onDisplayedPeriodChange, preselectedValue = _this$asProps4.preselectedValue, preselectedCompare = _this$asProps4.preselectedCompare, focusedRange = _this$asProps4.focusedRange, getI18nText = _this$asProps4.getI18nText;
233
+ 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;
234
+ if (focusedRange === "compare") {
235
+ var _this$asProps$value2;
236
+ 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;
158
237
  }
159
238
  return {
160
- periods: o,
161
- value: l,
162
- onChange: function(P) {
163
- m === "compare" ? r.handlers.preselectedCompare(P) : r.handlers.preselectedValue(P);
239
+ periods,
240
+ value,
241
+ onChange: function onChange(value2) {
242
+ if (focusedRange === "compare") {
243
+ _this2.handlers.preselectedCompare(value2);
244
+ } else {
245
+ _this2.handlers.preselectedValue(value2);
246
+ }
164
247
  },
165
- onHighlightedChange: m === "compare" ? i : _,
166
- onDisplayedPeriodChange: p,
248
+ onHighlightedChange: focusedRange === "compare" ? onCompareHighlightedChange : onHighlightedChange,
249
+ onDisplayedPeriodChange,
167
250
  role: "listbox",
168
- "aria-label": g("periods")
251
+ "aria-label": getI18nText("periods")
169
252
  };
170
253
  }
171
254
  }, {
172
255
  key: "getPrevProps",
173
- value: function() {
174
- var a = this.asProps.getI18nText, r = this.navigateStep;
256
+ value: function getPrevProps() {
257
+ var getI18nText = this.asProps.getI18nText;
258
+ var navigateStep = this.navigateStep;
175
259
  return {
176
- getI18nText: a,
260
+ getI18nText,
177
261
  onClick: this.bindHandlerNavigateClick(-1),
178
- "aria-label": a(r === "month" ? "prevMonth" : "prevYear")
262
+ "aria-label": navigateStep === "month" ? getI18nText("prevMonth") : getI18nText("prevYear")
179
263
  };
180
264
  }
181
265
  }, {
182
266
  key: "getNextProps",
183
- value: function() {
184
- var a = this.asProps.getI18nText, r = this.navigateStep;
267
+ value: function getNextProps() {
268
+ var getI18nText = this.asProps.getI18nText;
269
+ var navigateStep = this.navigateStep;
185
270
  return {
186
- getI18nText: a,
271
+ getI18nText,
187
272
  onClick: this.bindHandlerNavigateClick(1),
188
- "aria-label": a(r === "month" ? "nextMonth" : "nextYear")
273
+ "aria-label": navigateStep === "month" ? getI18nText("nextMonth") : getI18nText("nextYear")
189
274
  };
190
275
  }
191
276
  }, {
192
277
  key: "uncontrolledProps",
193
- value: function() {
194
- var a = this;
278
+ value: function uncontrolledProps() {
279
+ var _this3 = this;
195
280
  return {
196
281
  displayedPeriod: null,
197
- visible: [null, function(r) {
198
- if (!r)
199
- a.handlers.highlighted([]), a.handlers.compareHighlighted([]), a.handlers.preselectedValue(void 0), a.handlers.preselectedCompare(void 0), a.handlers.compareToggle(void 0), a.handlers.focusedRange("value");
200
- else {
201
- var t, n;
202
- a.handlers.compareToggle(!!((t = a.asProps.value) !== null && t !== void 0 && (n = t.compare) !== null && n !== void 0 && n.length));
282
+ visible: [null, function(visible) {
283
+ if (!visible) {
284
+ _this3.handlers.highlighted([]);
285
+ _this3.handlers.compareHighlighted([]);
286
+ _this3.handlers.preselectedValue(void 0);
287
+ _this3.handlers.preselectedCompare(void 0);
288
+ _this3.handlers.compareToggle(void 0);
289
+ _this3.handlers.focusedRange("value");
290
+ } else {
291
+ var _this3$asProps$value, _this3$asProps$value$;
292
+ _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));
203
293
  }
204
- var o = a.asProps, _ = o.value, i = o.displayedPeriod, p = _ ? M(_.value, _.compare) : void 0;
205
- if (r) {
206
- if (p && p !== i)
207
- a.handlers.displayedPeriod(p);
208
- else if (!p) {
209
- var v = a.props, c = v.displayedPeriod, m = v.defaultDisplayedPeriod;
210
- a.handlers.displayedPeriod(c || m);
294
+ var _this3$asProps = _this3.asProps, value = _this3$asProps.value, displayedPeriod = _this3$asProps.displayedPeriod;
295
+ var newDisplayedPeriod = value ? getLatestDate(value.value, value.compare) : void 0;
296
+ if (visible) {
297
+ if (newDisplayedPeriod && newDisplayedPeriod !== displayedPeriod) {
298
+ _this3.handlers.displayedPeriod(newDisplayedPeriod);
299
+ } else if (!newDisplayedPeriod) {
300
+ var _this3$props = _this3.props, _displayedPeriod = _this3$props.displayedPeriod, _defaultDisplayedPeriod = _this3$props.defaultDisplayedPeriod;
301
+ _this3.handlers.displayedPeriod(_displayedPeriod || _defaultDisplayedPeriod);
211
302
  }
212
303
  }
213
304
  }],
@@ -217,183 +308,207 @@ var le = (
217
308
  preselectedCompare: null,
218
309
  compareToggle: null,
219
310
  focusedRange: null,
220
- value: [null, function(r) {
221
- var t = [r == null ? void 0 : r.value, r == null ? void 0 : r.compare].flat(2).filter(function(n) {
222
- var o;
223
- return n == null || (o = n.isValid) === null || o === void 0 ? void 0 : o.call(n);
311
+ value: [null, function(value) {
312
+ 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) {
313
+ var _date$isValid;
314
+ return date === null || date === void 0 ? void 0 : (_date$isValid = date.isValid) === null || _date$isValid === void 0 ? void 0 : _date$isValid.call(date);
224
315
  });
225
- t.length > 0 && a.handlers.displayedPeriod(M(r));
316
+ if (dates.length > 0) _this3.handlers.displayedPeriod(getLatestDate(value));
226
317
  }]
227
318
  };
228
319
  }
229
320
  }, {
230
321
  key: "getApplyProps",
231
- value: function() {
232
- var a = this.asProps.getI18nText;
322
+ value: function getApplyProps() {
323
+ var getI18nText = this.asProps.getI18nText;
233
324
  return {
234
- getI18nText: a,
325
+ getI18nText,
235
326
  onClick: this.handleApplyClick
236
327
  };
237
328
  }
238
329
  }, {
239
330
  key: "getResetProps",
240
- value: function() {
241
- var a = this, r = this.asProps.getI18nText;
331
+ value: function getResetProps() {
332
+ var _this4 = this;
333
+ var getI18nText = this.asProps.getI18nText;
242
334
  return {
243
- getI18nText: r,
244
- onClick: function() {
245
- return a.handleApply(null, null);
335
+ getI18nText,
336
+ onClick: function onClick() {
337
+ return _this4.handleApply(null, null);
246
338
  }
247
339
  };
248
340
  }
249
341
  }, {
250
342
  key: "isDisabled",
251
- value: function(a) {
252
- var r = this.asProps.disabled;
253
- return r.some(ne(x(a), "date"));
343
+ value: function isDisabled(date) {
344
+ var disabled = this.asProps.disabled;
345
+ return disabled.some(includesDate(dayjs(date), "date"));
254
346
  }
255
347
  }, {
256
348
  key: "getDefaultPeriods",
257
- value: function() {
258
- var a = this.asProps.getI18nText, r = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
349
+ value: function getDefaultPeriods() {
350
+ var getI18nText = this.asProps.getI18nText;
351
+ var today = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
259
352
  return [{
260
- children: a("lastMonth"),
261
- value: [x(r).subtract(1, "month").startOf("month").toDate(), x(r).startOf("month").toDate()]
353
+ children: getI18nText("lastMonth"),
354
+ value: [dayjs(today).subtract(1, "month").startOf("month").toDate(), dayjs(today).startOf("month").toDate()]
262
355
  }, {
263
- children: a("last3Months"),
264
- value: [x(r).subtract(2, "month").startOf("month").toDate(), x(r).startOf("month").toDate()]
356
+ children: getI18nText("last3Months"),
357
+ value: [dayjs(today).subtract(2, "month").startOf("month").toDate(), dayjs(today).startOf("month").toDate()]
265
358
  }, {
266
- children: a("last6Months"),
267
- value: [x(r).subtract(5, "month").startOf("month").toDate(), x(r).startOf("month").toDate()]
359
+ children: getI18nText("last6Months"),
360
+ value: [dayjs(today).subtract(5, "month").startOf("month").toDate(), dayjs(today).startOf("month").toDate()]
268
361
  }, {
269
- children: a("last12Months"),
270
- value: [x(r).subtract(11, "month").startOf("month").toDate(), x(r).startOf("month").toDate()]
362
+ children: getI18nText("last12Months"),
363
+ value: [dayjs(today).subtract(11, "month").startOf("month").toDate(), dayjs(today).startOf("month").toDate()]
271
364
  }];
272
365
  }
273
366
  }, {
274
367
  key: "getTitleProps",
275
- value: function(a, r) {
276
- var t = this.asProps, n = t.locale, o = t.displayedPeriod;
368
+ value: function getTitleProps(props, index) {
369
+ var _this$asProps5 = this.asProps, locale = _this$asProps5.locale, displayedPeriod = _this$asProps5.displayedPeriod;
277
370
  return {
278
- children: new Intl.DateTimeFormat(n, {
371
+ children: new Intl.DateTimeFormat(locale, {
279
372
  month: "long",
280
373
  year: "numeric"
281
- }).format(x(o).add(r, this.navigateStep).startOf(this.navigateStep).toDate())
374
+ }).format(dayjs(displayedPeriod).add(index, this.navigateStep).startOf(this.navigateStep).toDate())
282
375
  };
283
376
  }
284
377
  }, {
285
378
  key: "getTriggerProps",
286
- value: function(a) {
287
- var r, t, n = this, o = a.placeholder, _ = o === void 0 ? "Select date ranges" : o, i = a.separator, p = i === void 0 ? "vs." : i, v = this.asProps, c = v.locale, m = v.visible, g = (r = this.asProps.value) === null || r === void 0 ? void 0 : r.value, l = (t = this.asProps.value) === null || t === void 0 ? void 0 : t.compare, h = U({
288
- locale: c
289
- }, this.triggerFormattingProps), f = _;
290
- return g != null && g[0] && g !== null && g !== void 0 && g[1] && (f = F(g, h)), l != null && l[0] && l !== null && l !== void 0 && l[1] && (f = "".concat(f || "", " ").concat(p, " ").concat(F(l, h))), {
291
- children: f,
292
- visible: m,
293
- onClick: function() {
294
- return n.handlers.visible(!m);
379
+ value: function getTriggerProps(_ref10) {
380
+ var _this$asProps$value3, _this$asProps$value4, _this5 = this;
381
+ var _ref10$placeholder = _ref10.placeholder, placeholder = _ref10$placeholder === void 0 ? "Select date ranges" : _ref10$placeholder, _ref10$separator = _ref10.separator, separator = _ref10$separator === void 0 ? "vs." : _ref10$separator;
382
+ var _this$asProps6 = this.asProps, locale = _this$asProps6.locale, visible = _this$asProps6.visible;
383
+ var value = (_this$asProps$value3 = this.asProps.value) === null || _this$asProps$value3 === void 0 ? void 0 : _this$asProps$value3.value;
384
+ var compare = (_this$asProps$value4 = this.asProps.value) === null || _this$asProps$value4 === void 0 ? void 0 : _this$asProps$value4.compare;
385
+ var formattingProps = _objectSpread({
386
+ locale
387
+ }, this.triggerFormattingProps);
388
+ var children = placeholder;
389
+ if (value !== null && value !== void 0 && value[0] && value !== null && value !== void 0 && value[1]) {
390
+ children = shortDateRangeFormat(value, formattingProps);
391
+ }
392
+ if (compare !== null && compare !== void 0 && compare[0] && compare !== null && compare !== void 0 && compare[1]) {
393
+ children = "".concat(children || "", " ").concat(separator, " ").concat(shortDateRangeFormat(compare, formattingProps));
394
+ }
395
+ return {
396
+ children,
397
+ visible,
398
+ onClick: function onClick() {
399
+ return _this5.handlers.visible(!visible);
295
400
  },
296
401
  onKeyDown: this.handleKeydownDown("trigger")
297
402
  };
298
403
  }
299
404
  }, {
300
405
  key: "getRangeInput",
301
- value: function() {
406
+ value: function getRangeInput() {
302
407
  throw new Error("not implemented");
303
408
  }
304
409
  }, {
305
410
  key: "getRangeInputProps",
306
- value: function() {
411
+ value: function getRangeInputProps() {
307
412
  return {
308
413
  inputRole: null
309
414
  };
310
415
  }
311
416
  }, {
312
417
  key: "getValueDateRangeProps",
313
- value: function() {
314
- var a = this, r = this.asProps, t = r.value, n = r.onDisplayedPeriodChange, o = r.locale, _ = r.disabled, i = r.disabledErrorText, p = r.getI18nText, v = r.focusedRange, c = r.preselectedValue, m = r.animationsDisabled, g = r.visible;
418
+ value: function getValueDateRangeProps() {
419
+ var _this6 = this;
420
+ var _this$asProps7 = this.asProps, value = _this$asProps7.value, onDisplayedPeriodChange = _this$asProps7.onDisplayedPeriodChange, locale = _this$asProps7.locale, disabled = _this$asProps7.disabled, disabledErrorText = _this$asProps7.disabledErrorText, getI18nText = _this$asProps7.getI18nText, focusedRange = _this$asProps7.focusedRange, preselectedValue = _this$asProps7.preselectedValue, animationsDisabled = _this$asProps7.animationsDisabled, visible = _this$asProps7.visible;
315
421
  return {
316
- popoverVisible: g,
317
- focused: v === "value" ? !0 : void 0,
318
- value: c ?? (t == null ? void 0 : t.value),
319
- onChange: function(h) {
320
- return a.handlers.preselectedValue(h);
422
+ popoverVisible: visible,
423
+ focused: focusedRange === "value" ? true : void 0,
424
+ value: preselectedValue !== null && preselectedValue !== void 0 ? preselectedValue : value === null || value === void 0 ? void 0 : value.value,
425
+ onChange: function onChange(value2) {
426
+ return _this6.handlers.preselectedValue(value2);
321
427
  },
322
- onDisplayedPeriodChange: n,
323
- locale: o,
324
- disabledDates: _,
325
- disabledErrorText: i,
428
+ onDisplayedPeriodChange,
429
+ locale,
430
+ disabledDates: disabled,
431
+ disabledErrorText,
326
432
  children: this.getRangeInput(),
327
- getI18nText: p,
328
- onFocus: function() {
329
- a.handlers.focusedRange("value");
433
+ getI18nText,
434
+ onFocus: function onFocus() {
435
+ _this6.handlers.focusedRange("value");
330
436
  },
331
- animationsDisabled: m
437
+ animationsDisabled
332
438
  };
333
439
  }
334
440
  }, {
335
441
  key: "getCompareDateRangeProps",
336
- value: function() {
337
- var a, r = this, t = this.asProps, n = t.value, o = t.onDisplayedPeriodChange, _ = t.locale, i = t.disabled, p = t.disabledErrorText, v = t.getI18nText, c = t.focusedRange, m = t.preselectedCompare, g = t.compareToggle, l = t.animationsDisabled, h = t.visible;
442
+ value: function getCompareDateRangeProps() {
443
+ var _value$compare, _this7 = this;
444
+ var _this$asProps8 = this.asProps, value = _this$asProps8.value, onDisplayedPeriodChange = _this$asProps8.onDisplayedPeriodChange, locale = _this$asProps8.locale, disabled = _this$asProps8.disabled, disabledErrorText = _this$asProps8.disabledErrorText, getI18nText = _this$asProps8.getI18nText, focusedRange = _this$asProps8.focusedRange, preselectedCompare = _this$asProps8.preselectedCompare, compareToggle = _this$asProps8.compareToggle, animationsDisabled = _this$asProps8.animationsDisabled, visible = _this$asProps8.visible;
338
445
  return {
339
- popoverVisible: h,
340
- focused: c === "compare" ? !0 : void 0,
341
- disabled: !(g ?? (n == null || (a = n.compare) === null || a === void 0 ? void 0 : a.length)),
342
- value: m ?? (n == null ? void 0 : n.compare),
343
- onChange: function(P) {
344
- return r.handlers.preselectedCompare(P);
446
+ popoverVisible: visible,
447
+ focused: focusedRange === "compare" ? true : void 0,
448
+ disabled: !(compareToggle !== null && compareToggle !== void 0 ? compareToggle : value === null || value === void 0 ? void 0 : (_value$compare = value.compare) === null || _value$compare === void 0 ? void 0 : _value$compare.length),
449
+ value: preselectedCompare !== null && preselectedCompare !== void 0 ? preselectedCompare : value === null || value === void 0 ? void 0 : value.compare,
450
+ onChange: function onChange(value2) {
451
+ return _this7.handlers.preselectedCompare(value2);
345
452
  },
346
- onDisplayedPeriodChange: o,
347
- locale: _,
348
- disabledDates: i,
453
+ onDisplayedPeriodChange,
454
+ locale,
455
+ disabledDates: disabled,
349
456
  children: this.getRangeInput(),
350
- getI18nText: v,
351
- disabledErrorText: p,
352
- onFocus: function() {
353
- r.handlers.focusedRange("compare");
457
+ getI18nText,
458
+ disabledErrorText,
459
+ onFocus: function onFocus() {
460
+ _this7.handlers.focusedRange("compare");
354
461
  },
355
- animationsDisabled: l
462
+ animationsDisabled
356
463
  };
357
464
  }
358
465
  }, {
359
466
  key: "getCompareToggleProps",
360
- value: function() {
361
- var a = this, r = this.asProps, t = r.getI18nText;
362
- r.value;
363
- var n = r.compareToggle;
467
+ value: function getCompareToggleProps() {
468
+ var _this8 = this;
469
+ var _this$asProps9 = this.asProps, getI18nText = _this$asProps9.getI18nText;
470
+ _this$asProps9.value;
471
+ var compareToggle = _this$asProps9.compareToggle;
364
472
  return {
365
- getI18nText: t,
366
- checked: n,
367
- onChange: function(_) {
368
- _ ? (a.handlers.compareToggle(!0), a.handlers.focusedRange("compare")) : (a.handlers.compareToggle(!1), a.handlers.focusedRange("value"), a.handlers.preselectedCompare([]));
473
+ getI18nText,
474
+ checked: compareToggle,
475
+ onChange: function onChange(checked) {
476
+ if (checked) {
477
+ _this8.handlers.compareToggle(true);
478
+ _this8.handlers.focusedRange("compare");
479
+ } else {
480
+ _this8.handlers.compareToggle(false);
481
+ _this8.handlers.focusedRange("value");
482
+ _this8.handlers.preselectedCompare([]);
483
+ }
369
484
  }
370
485
  };
371
486
  }
372
487
  }, {
373
488
  key: "getCalendarProps",
374
- value: function(a, r) {
375
- var t = this.asProps, n = t.locale, o = t.displayedPeriod, _ = t.disabled, i = t.value, p = t.onCompareHighlightedChange, v = t.highlighted, c = t.compareHighlighted, m = t.onHighlightedChange, g = t.preselectedCompare, l = t.preselectedValue, h = t.focusedRange, f = t.getI18nText;
489
+ value: function getCalendarProps(_props, index) {
490
+ var _this$asProps10 = this.asProps, locale = _this$asProps10.locale, displayedPeriod = _this$asProps10.displayedPeriod, disabled = _this$asProps10.disabled, value = _this$asProps10.value, onCompareHighlightedChange = _this$asProps10.onCompareHighlightedChange, highlighted = _this$asProps10.highlighted, compareHighlighted = _this$asProps10.compareHighlighted, onHighlightedChange = _this$asProps10.onHighlightedChange, preselectedCompare = _this$asProps10.preselectedCompare, preselectedValue = _this$asProps10.preselectedValue, focusedRange = _this$asProps10.focusedRange, getI18nText = _this$asProps10.getI18nText;
376
491
  return {
377
- locale: n,
378
- displayedPeriod: x(o).add(r, this.navigateStep).startOf(this.navigateStep).toDate(),
379
- disabled: _,
492
+ locale,
493
+ displayedPeriod: dayjs(displayedPeriod).add(index, this.navigateStep).startOf(this.navigateStep).toDate(),
494
+ disabled,
380
495
  onChange: this.handleChange,
381
- highlighted: v,
382
- compareHighlighted: c,
383
- onCompareHighlightedChange: p,
384
- onHighlightedChange: m,
385
- range: h,
386
- value: l ?? (i == null ? void 0 : i.value),
387
- compare: g ?? (i == null ? void 0 : i.compare),
496
+ highlighted,
497
+ compareHighlighted,
498
+ onCompareHighlightedChange,
499
+ onHighlightedChange,
500
+ range: focusedRange,
501
+ value: preselectedValue !== null && preselectedValue !== void 0 ? preselectedValue : value === null || value === void 0 ? void 0 : value.value,
502
+ compare: preselectedCompare !== null && preselectedCompare !== void 0 ? preselectedCompare : value === null || value === void 0 ? void 0 : value.compare,
388
503
  unitRefs: this.unitRefs,
389
- getI18nText: f,
390
- actionsDescribing: r === 0 ? "range-compare" : null,
391
- tabIndex: r === 0 ? 0 : -1
504
+ getI18nText,
505
+ actionsDescribing: index === 0 ? "range-compare" : null,
506
+ tabIndex: index === 0 ? 0 : -1
392
507
  };
393
508
  }
394
509
  }, {
395
510
  key: "getPopperProps",
396
- value: function() {
511
+ value: function getPopperProps() {
397
512
  return {
398
513
  p: 0,
399
514
  ref: this.popperRef,
@@ -402,25 +517,26 @@ var le = (
402
517
  }
403
518
  }, {
404
519
  key: "render",
405
- value: function() {
406
- var a = this.asProps, r, t = this.asProps, n = t.Children, o = t.styles, _ = t["aria-label"];
407
- return /* @__PURE__ */ S.createElement(S.Fragment, null, (r = R(o), /* @__PURE__ */ S.createElement(Y, E({
408
- "use:aria-label": _,
409
- __excludeProps: ["onChange", "value"]
410
- }, a), /* @__PURE__ */ S.createElement(n, r.cn("Children", {})))));
520
+ value: function render() {
521
+ var _ref = this.asProps, _ref4;
522
+ var _this$asProps11 = this.asProps, Children = _this$asProps11.Children, styles = _this$asProps11.styles, providedAriaLabel = _this$asProps11["aria-label"];
523
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, (_ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(Dropdown, assignProps({
524
+ "use:aria-label": providedAriaLabel,
525
+ "__excludeProps": ["onChange", "value"]
526
+ }, _ref), /* @__PURE__ */ React.createElement(Children, _ref4.cn("Children", {})))));
411
527
  }
412
528
  }], [{
413
529
  key: "defaultProps",
414
- value: function(a) {
415
- var r = a.primaryRange, t = a.defaultPrimaryRange, n = a.secondaryRange, o = a.defaultSecondaryRange;
530
+ value: function defaultProps(_ref11) {
531
+ var primaryRange = _ref11.primaryRange, defaultPrimaryRange = _ref11.defaultPrimaryRange, secondaryRange = _ref11.secondaryRange, defaultSecondaryRange = _ref11.defaultSecondaryRange;
416
532
  return {
417
- i18n: B,
533
+ i18n: localizedMessages,
418
534
  locale: "en",
419
535
  defaultValue: null,
420
536
  defaultHighlighted: [],
421
537
  defaultCompareHighlighted: [],
422
- defaultDisplayedPeriod: M(r, t, n, o) || se,
423
- defaultVisible: !1,
538
+ defaultDisplayedPeriod: getLatestDate(primaryRange, defaultPrimaryRange, secondaryRange, defaultSecondaryRange) || defaultDisplayedPeriod,
539
+ defaultVisible: false,
424
540
  defaultPreselectedValue: null,
425
541
  defaultPreselectedCompare: null,
426
542
  defaultCompareToggle: null,
@@ -429,72 +545,80 @@ var le = (
429
545
  size: "m"
430
546
  };
431
547
  }
432
- }]), u;
433
- }(ee);
434
- y(T, "displayName", "DateRangeComparator");
435
- y(T, "style", le);
436
- y(T, "enhance", [ae(B)]);
437
- y(T, "subtract", function(d, s, u) {
438
- return x(d).subtract(s, u).toDate();
548
+ }]);
549
+ return DateRangeComparatorAbstract2;
550
+ }(Component);
551
+ _defineProperty(DateRangeComparatorAbstract, "displayName", "DateRangeComparator");
552
+ _defineProperty(DateRangeComparatorAbstract, "style", style);
553
+ _defineProperty(DateRangeComparatorAbstract, "enhance", [i18nEnhance(localizedMessages)]);
554
+ _defineProperty(DateRangeComparatorAbstract, "subtract", function(date, amount, unit) {
555
+ return dayjs(date).subtract(amount, unit).toDate();
439
556
  });
440
- function Me(d) {
441
- var s = arguments[0], u = d.getI18nText;
442
- return /* @__PURE__ */ S.createElement(O, E({
443
- use: "primary",
444
- children: u("apply")
445
- }, s));
557
+ function Apply(props) {
558
+ var _ref2 = arguments[0];
559
+ var getI18nText = props.getI18nText;
560
+ return /* @__PURE__ */ React.createElement(Button, assignProps({
561
+ "use": "primary",
562
+ "children": getI18nText("apply")
563
+ }, _ref2));
446
564
  }
447
- function Ee(d) {
448
- var s = arguments[0], u = d.getI18nText;
449
- return /* @__PURE__ */ S.createElement(O, E({
450
- use: "tertiary",
451
- theme: "muted",
452
- children: u("reset")
453
- }, s));
565
+ function Reset(props) {
566
+ var _ref3 = arguments[0];
567
+ var getI18nText = props.getI18nText;
568
+ return /* @__PURE__ */ React.createElement(Button, assignProps({
569
+ "use": "tertiary",
570
+ "theme": "muted",
571
+ "children": getI18nText("reset")
572
+ }, _ref3));
454
573
  }
455
- function Ae(d) {
456
- var s, u = d.Root, e = d.styles;
457
- return s = R(e), /* @__PURE__ */ S.createElement(u, s.cn("STrigger", {
458
- render: Y.Trigger,
459
- tag: te
574
+ function Trigger(props) {
575
+ var _ref5;
576
+ var STrigger = props.Root, styles = props.styles;
577
+ return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(STrigger, _ref5.cn("STrigger", {
578
+ "render": Dropdown.Trigger,
579
+ "tag": LinkTrigger
460
580
  }));
461
581
  }
462
- function ze(d) {
463
- var s, u = d.Root, e = d.styles, a = d.getI18nText;
464
- return s = R(e), /* @__PURE__ */ S.createElement(u, s.cn("SCompareToggle", {
465
- render: re,
466
- label: a("compare")
582
+ function CompareToggle(props) {
583
+ var _ref6;
584
+ var SCompareToggle = props.Root, styles = props.styles, getI18nText = props.getI18nText;
585
+ return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(SCompareToggle, _ref6.cn("SCompareToggle", {
586
+ "render": Checkbox,
587
+ "label": getI18nText("compare")
467
588
  }));
468
589
  }
469
- function Ne(d) {
470
- var s, u = d.Root, e = d.Children, a = d.styles;
471
- return s = R(a), /* @__PURE__ */ S.createElement(u, s.cn("SRangeComparatorHeader", {
472
- render: A,
473
- gap: 4,
474
- alignItems: "center"
475
- }), /* @__PURE__ */ S.createElement(e, s.cn("Children", {})));
590
+ function Header(props) {
591
+ var _ref7;
592
+ var SRangeComparatorHeader = props.Root, Children = props.Children, styles = props.styles;
593
+ return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SRangeComparatorHeader, _ref7.cn("SRangeComparatorHeader", {
594
+ "render": Flex,
595
+ "gap": 4,
596
+ "alignItems": "center"
597
+ }), /* @__PURE__ */ React.createElement(Children, _ref7.cn("Children", {})));
476
598
  }
477
- function Fe(d) {
478
- var s, u = d.Root, e = d.Children, a = d.styles;
479
- return s = R(a), /* @__PURE__ */ S.createElement(u, s.cn("SBody", {
480
- render: A,
481
- gap: 4
482
- }), /* @__PURE__ */ S.createElement(e, s.cn("Children", {})));
599
+ function Body(props) {
600
+ var _ref8;
601
+ var SBody = props.Root, Children = props.Children, styles = props.styles;
602
+ return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SBody, _ref8.cn("SBody", {
603
+ "render": Flex,
604
+ "gap": 4
605
+ }), /* @__PURE__ */ React.createElement(Children, _ref8.cn("Children", {})));
483
606
  }
484
- function Oe(d) {
485
- var s, u = d.Root, e = d.styles, a = d.Children;
486
- return s = R(e), /* @__PURE__ */ S.createElement(u, s.cn("SFooter", {
487
- render: A,
488
- gap: 2
489
- }), /* @__PURE__ */ S.createElement(a, s.cn("Children", {})));
607
+ function Footer(props) {
608
+ var _ref9;
609
+ var SFooter = props.Root, styles = props.styles, Children = props.Children;
610
+ return _ref9 = sstyled(styles), /* @__PURE__ */ React.createElement(SFooter, _ref9.cn("SFooter", {
611
+ "render": Flex,
612
+ "gap": 2
613
+ }), /* @__PURE__ */ React.createElement(Children, _ref9.cn("Children", {})));
490
614
  }
491
615
  export {
492
- Me as Apply,
493
- Fe as Body,
494
- ze as CompareToggle,
495
- Oe as Footer,
496
- Ne as Header,
497
- Ee as Reset,
498
- Ae as Trigger,
499
- T as default
616
+ Apply,
617
+ Body,
618
+ CompareToggle,
619
+ Footer,
620
+ Header,
621
+ Reset,
622
+ Trigger,
623
+ DateRangeComparatorAbstract as default
500
624
  };