@semcore/date-picker 4.58.0-prerelease.5 → 4.58.0-prerelease.7
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.
- package/lib/cjs/DatePicker.js +36 -27
- package/lib/cjs/DatePicker.js.map +1 -1
- package/lib/cjs/DateRangeComparator.js +43 -38
- package/lib/cjs/DateRangeComparator.js.map +1 -1
- package/lib/cjs/DateRangePicker.js +22 -17
- package/lib/cjs/DateRangePicker.js.map +1 -1
- package/lib/cjs/MonthDateRangeComparator.js +47 -42
- package/lib/cjs/MonthDateRangeComparator.js.map +1 -1
- package/lib/cjs/MonthPicker.js +21 -16
- package/lib/cjs/MonthPicker.js.map +1 -1
- package/lib/cjs/MonthRangePicker.js +23 -18
- package/lib/cjs/MonthRangePicker.js.map +1 -1
- package/lib/cjs/components/ButtonTrigger.js +10 -8
- package/lib/cjs/components/ButtonTrigger.js.map +1 -1
- package/lib/cjs/components/Calendar.js +125 -109
- package/lib/cjs/components/Calendar.js.map +1 -1
- package/lib/cjs/components/DateRangeComparatorAbstract.js +104 -121
- package/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
- package/lib/cjs/components/InputTrigger.js +189 -179
- package/lib/cjs/components/InputTrigger.js.map +1 -1
- package/lib/cjs/components/PickerAbstract.js +57 -58
- package/lib/cjs/components/PickerAbstract.js.map +1 -1
- package/lib/cjs/components/RangePickerAbstract.js +76 -97
- package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
- package/lib/cjs/components/index.js +46 -41
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/index.js +2 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/calendar.shadow.css +14 -12
- package/lib/cjs/style/date-picker.shadow.css +6 -5
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +5 -4
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/translations/de.json +2 -6
- package/lib/cjs/translations/es.json +2 -6
- package/lib/cjs/translations/fr.json +2 -6
- package/lib/cjs/translations/it.json +2 -6
- package/lib/cjs/translations/ja.json +2 -6
- package/lib/cjs/translations/ko.json +2 -6
- package/lib/cjs/translations/nl.json +2 -6
- package/lib/cjs/translations/pl.json +2 -6
- package/lib/cjs/translations/pt.json +2 -6
- package/lib/cjs/translations/sv.json +2 -6
- package/lib/cjs/translations/tr.json +2 -6
- package/lib/cjs/translations/vi.json +2 -6
- package/lib/cjs/translations/zh.json +2 -6
- package/lib/cjs/utils/cronTabScheduler.js +5 -8
- package/lib/cjs/utils/cronTabScheduler.js.map +1 -1
- package/lib/cjs/utils/datesIntersects.js +4 -3
- package/lib/cjs/utils/datesIntersects.js.map +1 -1
- package/lib/cjs/utils/formatDate.js +5 -3
- package/lib/cjs/utils/formatDate.js.map +1 -1
- package/lib/cjs/utils/includesDate.js +3 -2
- package/lib/cjs/utils/includesDate.js.map +1 -1
- package/lib/cjs/utils/shortDateRangeFormat.js +2 -2
- package/lib/cjs/utils/shortDateRangeFormat.js.map +1 -1
- package/lib/es6/DatePicker.js +28 -22
- package/lib/es6/DatePicker.js.map +1 -1
- package/lib/es6/DateRangeComparator.js +27 -23
- package/lib/es6/DateRangeComparator.js.map +1 -1
- package/lib/es6/DateRangePicker.js +17 -13
- package/lib/es6/DateRangePicker.js.map +1 -1
- package/lib/es6/MonthDateRangeComparator.js +32 -28
- package/lib/es6/MonthDateRangeComparator.js.map +1 -1
- package/lib/es6/MonthPicker.js +17 -13
- package/lib/es6/MonthPicker.js.map +1 -1
- package/lib/es6/MonthRangePicker.js +18 -14
- package/lib/es6/MonthRangePicker.js.map +1 -1
- package/lib/es6/components/ButtonTrigger.js +5 -5
- package/lib/es6/components/ButtonTrigger.js.map +1 -1
- package/lib/es6/components/Calendar.js +112 -100
- package/lib/es6/components/Calendar.js.map +1 -1
- package/lib/es6/components/DateRangeComparatorAbstract.js +101 -120
- package/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
- package/lib/es6/components/InputTrigger.js +180 -173
- package/lib/es6/components/InputTrigger.js.map +1 -1
- package/lib/es6/components/PickerAbstract.js +55 -58
- package/lib/es6/components/PickerAbstract.js.map +1 -1
- package/lib/es6/components/RangePickerAbstract.js +71 -94
- package/lib/es6/components/RangePickerAbstract.js.map +1 -1
- package/lib/es6/components/index.js +38 -35
- package/lib/es6/components/index.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/calendar.shadow.css +14 -12
- package/lib/es6/style/date-picker.shadow.css +6 -5
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/translations/de.json +2 -6
- package/lib/es6/translations/es.json +2 -6
- package/lib/es6/translations/fr.json +2 -6
- package/lib/es6/translations/it.json +2 -6
- package/lib/es6/translations/ja.json +2 -6
- package/lib/es6/translations/ko.json +2 -6
- package/lib/es6/translations/nl.json +2 -6
- package/lib/es6/translations/pl.json +2 -6
- package/lib/es6/translations/pt.json +2 -6
- package/lib/es6/translations/sv.json +2 -6
- package/lib/es6/translations/tr.json +2 -6
- package/lib/es6/translations/vi.json +2 -6
- package/lib/es6/translations/zh.json +2 -6
- package/lib/es6/utils/cronTabScheduler.js +4 -7
- package/lib/es6/utils/cronTabScheduler.js.map +1 -1
- package/lib/es6/utils/datesIntersects.js +1 -1
- package/lib/es6/utils/datesIntersects.js.map +1 -1
- package/lib/es6/utils/formatDate.js.map +1 -1
- package/lib/es6/utils/includesDate.js.map +1 -1
- package/lib/es6/utils/shortDateRangeFormat.js +1 -1
- package/lib/es6/utils/shortDateRangeFormat.js.map +1 -1
- package/lib/esm/DatePicker.mjs +33 -27
- package/lib/esm/DateRangeComparator.mjs +30 -26
- package/lib/esm/DateRangePicker.mjs +21 -17
- package/lib/esm/MonthDateRangeComparator.mjs +35 -31
- package/lib/esm/MonthPicker.mjs +20 -16
- package/lib/esm/MonthRangePicker.mjs +22 -18
- package/lib/esm/components/ButtonTrigger.mjs +5 -5
- package/lib/esm/components/Calendar.mjs +115 -103
- package/lib/esm/components/DateRangeComparatorAbstract.mjs +89 -105
- package/lib/esm/components/InputTrigger.mjs +181 -143
- package/lib/esm/components/PickerAbstract.mjs +62 -61
- package/lib/esm/components/RangePickerAbstract.mjs +73 -94
- package/lib/esm/components/index.mjs +33 -29
- package/lib/esm/style/calendar.shadow.css +14 -12
- package/lib/esm/style/date-picker.shadow.css +6 -5
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/esm/translations/de.json.mjs +6 -18
- package/lib/esm/translations/es.json.mjs +6 -18
- package/lib/esm/translations/fr.json.mjs +6 -18
- package/lib/esm/translations/it.json.mjs +6 -18
- package/lib/esm/translations/ja.json.mjs +6 -18
- package/lib/esm/translations/ko.json.mjs +6 -18
- package/lib/esm/translations/nl.json.mjs +6 -18
- package/lib/esm/translations/pl.json.mjs +6 -18
- package/lib/esm/translations/pt.json.mjs +6 -18
- package/lib/esm/translations/sv.json.mjs +6 -18
- package/lib/esm/translations/tr.json.mjs +6 -18
- package/lib/esm/translations/vi.json.mjs +6 -18
- package/lib/esm/translations/zh.json.mjs +6 -18
- package/lib/esm/utils/cronTabScheduler.mjs +4 -4
- package/lib/esm/utils/datesIntersects.mjs +1 -1
- package/lib/esm/utils/shortDateRangeFormat.mjs +2 -1
- package/lib/types/index.d.ts +171 -140
- package/package.json +16 -16
- package/lib/cjs/utils/isBetweenPlugin.js +0 -21
- package/lib/cjs/utils/isBetweenPlugin.js.map +0 -1
- package/lib/es6/utils/isBetweenPlugin.js +0 -16
- package/lib/es6/utils/isBetweenPlugin.js.map +0 -1
- package/lib/esm/utils/isBetweenPlugin.mjs +0 -13
|
@@ -2,59 +2,60 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import
|
|
5
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
6
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import { sstyled as _sstyled } from "@semcore/core";
|
|
9
|
+
import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
|
|
9
10
|
import { assignProps as _assignProps3 } from "@semcore/core";
|
|
10
11
|
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
11
12
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import Button from '@semcore/button';
|
|
15
|
-
import Checkbox from '@semcore/checkbox';
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import dayjs from 'dayjs';
|
|
16
15
|
import { Component, Root, sstyled } from '@semcore/core';
|
|
17
|
-
import
|
|
16
|
+
import Button from '@semcore/button';
|
|
17
|
+
import { Flex } from '@semcore/flex-box';
|
|
18
18
|
import Dropdown from '@semcore/dropdown';
|
|
19
|
-
import
|
|
20
|
-
import
|
|
19
|
+
import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
20
|
+
import { localizedMessages } from '../translations/__intergalactic-dynamic-locales';
|
|
21
|
+
import shortDateRangeFormat from '../utils/shortDateRangeFormat';
|
|
22
|
+
import Checkbox from '@semcore/checkbox';
|
|
23
|
+
import { LinkTrigger } from '@semcore/base-trigger';
|
|
24
|
+
import { includesDate } from '../utils/includesDate';
|
|
25
|
+
import { formatDDMMYY, formatMMYY } from '../utils/formatDate';
|
|
21
26
|
/*!__reshadow-styles__:"../style/date-picker.shadow.css"*/
|
|
22
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
27
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SPopper_zrl1b_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_zrl1b_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_zrl1b_gg_:active,.___SPopper_zrl1b_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_zrl1b_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SPopper_zrl1b_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 33, 220, 0.469))}@supports (color:color(display-p3 0 0 0)){.___SPopper_zrl1b_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 33, 220, 0.469))}@media (color-gamut:p3){.___SPopper_zrl1b_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___SHeader_zrl1b_gg_,.___STitle_zrl1b_gg_{display:flex;align-items:center}.___STitle_zrl1b_gg_{font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899));height:32px;width:100%;justify-content:center}.___SToday_zrl1b_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_zrl1b_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_zrl1b_gg_ .___SInner_zrl1b_gg_{justify-content:flex-start}.___SInputMask_zrl1b_gg_{color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899));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_zrl1b_gg_.__animationsDisabled_zrl1b_gg_{transition:none}.___SInputMask_zrl1b_gg_ .___SValue_zrl1b_gg_{letter-spacing:0}.___SIndicator_zrl1b_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@supports (color:color(display-p3 0 0 0)){.___SIndicator_zrl1b_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SIndicator_zrl1b_gg_{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SRangeIndicator_zrl1b_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_zrl1b_gg_._range_value_zrl1b_gg_{background-color:var(--intergalactic-date-picker-cell-active, rgb(118, 128, 231))}.___SRangeIndicator_zrl1b_gg_._range_compare_zrl1b_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, rgb(162, 97, 253))}.___SRangeIndicator_zrl1b_gg_.__disabled_zrl1b_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4)}.___SHumanizedDate_zrl1b_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_zrl1b_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_zrl1b_gg_ .___SMask_zrl1b_gg_,.___SDateRange_zrl1b_gg_ .___SValue_zrl1b_gg_,.___SSingleDateInput_zrl1b_gg_ .___SMask_zrl1b_gg_,.___SSingleDateInput_zrl1b_gg_ .___SValue_zrl1b_gg_{opacity:0}.___SSingleDateInput_zrl1b_gg_:focus-within .___SHumanizedDate_zrl1b_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_zrl1b_gg_:focus-within .___SMask_zrl1b_gg_,.___SSingleDateInput_zrl1b_gg_:focus-within .___SValue_zrl1b_gg_{opacity:1}.___SDateRange_zrl1b_gg_:focus-within .___SHumanizedDate_zrl1b_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_zrl1b_gg_:focus-within .___SMask_zrl1b_gg_,.___SDateRange_zrl1b_gg_:focus-within .___SValue_zrl1b_gg_{opacity:1}.___SInputMask_zrl1b_gg_.__noHumanizedDate_zrl1b_gg_ .___SMask_zrl1b_gg_,.___SInputMask_zrl1b_gg_.__noHumanizedDate_zrl1b_gg_ .___SValue_zrl1b_gg_{opacity:1}.___SDateRange_zrl1b_gg_ .___SInputMask_zrl1b_gg_:focus-within .___SMask_zrl1b_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgba(1, 79, 255, 0.116))}@supports (color:color(display-p3 0 0 0)){.___SDateRange_zrl1b_gg_ .___SInputMask_zrl1b_gg_:focus-within .___SMask_zrl1b_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgba(1, 79, 255, 0.116))}@media (color-gamut:p3){.___SDateRange_zrl1b_gg_ .___SInputMask_zrl1b_gg_:focus-within .___SMask_zrl1b_gg_{background-color:var(--intergalactic-bg-highlight-focus, color(display-p3 0.12361 0.30547 0.96332 / 0.116))}}}.___SDateRange_zrl1b_gg_:focus-within .___SRangeSep_zrl1b_gg_,.___SRangeSep_zrl1b_gg_.__fulfilled_zrl1b_gg_{color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___SRangeComparatorHeader_zrl1b_gg_{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161));padding:var(--intergalactic-spacing-4x, 16px)}@supports (color:color(display-p3 0 0 0)){.___SRangeComparatorHeader_zrl1b_gg_{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SRangeComparatorHeader_zrl1b_gg_{border-bottom:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SFooter_zrl1b_gg_,.___SRangeCalendar_zrl1b_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_zrl1b_gg_{border-top:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0)){.___SFooter_zrl1b_gg_{border-top:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SFooter_zrl1b_gg_{border-top:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SPeriodsList_zrl1b_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_zrl1b_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_zrl1b_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_zrl1b_gg_{transition:none}}", /*__inner_css_end__*/"zrl1b_gg_"),
|
|
23
28
|
/*__reshadow_css_end__*/
|
|
24
29
|
{
|
|
25
|
-
"__SHeader": "
|
|
26
|
-
"__STitle": "
|
|
27
|
-
"__SToday": "
|
|
28
|
-
"__SPeriod": "
|
|
29
|
-
"__SButton": "
|
|
30
|
-
"__SInner": "
|
|
31
|
-
"__SInputMask": "
|
|
32
|
-
"_animationsDisabled": "
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"__SDateRange": "
|
|
43
|
-
"_noHumanizedDate": "
|
|
44
|
-
"__SRangeSep": "
|
|
45
|
-
"_fulfilled": "
|
|
46
|
-
"__SRangeComparatorHeader": "
|
|
47
|
-
"__SRangeCalendar": "
|
|
48
|
-
"__SFooter": "
|
|
49
|
-
"__SPeriodsList": "
|
|
50
|
-
"__STooltip": "
|
|
51
|
-
"__SCompareToggle": "
|
|
52
|
-
"__SPopper": "
|
|
30
|
+
"__SHeader": "___SHeader_zrl1b_gg_",
|
|
31
|
+
"__STitle": "___STitle_zrl1b_gg_",
|
|
32
|
+
"__SToday": "___SToday_zrl1b_gg_",
|
|
33
|
+
"__SPeriod": "___SPeriod_zrl1b_gg_",
|
|
34
|
+
"__SButton": "___SButton_zrl1b_gg_",
|
|
35
|
+
"__SInner": "___SInner_zrl1b_gg_",
|
|
36
|
+
"__SInputMask": "___SInputMask_zrl1b_gg_",
|
|
37
|
+
"_animationsDisabled": "__animationsDisabled_zrl1b_gg_",
|
|
38
|
+
"__SValue": "___SValue_zrl1b_gg_",
|
|
39
|
+
"__SIndicator": "___SIndicator_zrl1b_gg_",
|
|
40
|
+
"__SRangeIndicator": "___SRangeIndicator_zrl1b_gg_",
|
|
41
|
+
"_range_value": "_range_value_zrl1b_gg_",
|
|
42
|
+
"_range_compare": "_range_compare_zrl1b_gg_",
|
|
43
|
+
"_disabled": "__disabled_zrl1b_gg_",
|
|
44
|
+
"__SHumanizedDate": "___SHumanizedDate_zrl1b_gg_",
|
|
45
|
+
"__SMask": "___SMask_zrl1b_gg_",
|
|
46
|
+
"__SSingleDateInput": "___SSingleDateInput_zrl1b_gg_",
|
|
47
|
+
"__SDateRange": "___SDateRange_zrl1b_gg_",
|
|
48
|
+
"_noHumanizedDate": "__noHumanizedDate_zrl1b_gg_",
|
|
49
|
+
"__SRangeSep": "___SRangeSep_zrl1b_gg_",
|
|
50
|
+
"_fulfilled": "__fulfilled_zrl1b_gg_",
|
|
51
|
+
"__SRangeComparatorHeader": "___SRangeComparatorHeader_zrl1b_gg_",
|
|
52
|
+
"__SRangeCalendar": "___SRangeCalendar_zrl1b_gg_",
|
|
53
|
+
"__SFooter": "___SFooter_zrl1b_gg_",
|
|
54
|
+
"__SPeriodsList": "___SPeriodsList_zrl1b_gg_",
|
|
55
|
+
"__STooltip": "___STooltip_zrl1b_gg_",
|
|
56
|
+
"__SCompareToggle": "___SCompareToggle_zrl1b_gg_",
|
|
57
|
+
"__SPopper": "___SPopper_zrl1b_gg_"
|
|
53
58
|
});
|
|
54
|
-
import { localizedMessages } from '../translations/__intergalactic-dynamic-locales';
|
|
55
|
-
import { formatDDMMYY, formatMMYY } from '../utils/formatDate';
|
|
56
|
-
import { includesDate } from '../utils/includesDate';
|
|
57
|
-
import shortDateRangeFormat from '../utils/shortDateRangeFormat';
|
|
58
59
|
var INTERACTION_TAGS = ['INPUT'];
|
|
59
60
|
var INTERACTION_KEYS = ['ArrowDown', 'Enter', ' '];
|
|
60
61
|
var defaultDisplayedPeriod = new Date(new Date().setHours(0, 0, 0, 0));
|
|
@@ -73,56 +74,51 @@ var getLatestDate = function getLatestDate() {
|
|
|
73
74
|
return latestDate;
|
|
74
75
|
};
|
|
75
76
|
var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
77
|
+
_inherits(DateRangeComparatorAbstract, _Component);
|
|
78
|
+
var _super = _createSuper(DateRangeComparatorAbstract);
|
|
76
79
|
function DateRangeComparatorAbstract() {
|
|
77
80
|
var _this;
|
|
78
81
|
_classCallCheck(this, DateRangeComparatorAbstract);
|
|
79
82
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
80
83
|
args[_key2] = arguments[_key2];
|
|
81
84
|
}
|
|
82
|
-
_this =
|
|
83
|
-
_defineProperty(_this, "
|
|
84
|
-
_defineProperty(_this, "
|
|
85
|
-
_defineProperty(_this, "
|
|
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) {
|
|
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) {
|
|
91
89
|
var displayedPeriod = _this.asProps.displayedPeriod;
|
|
92
90
|
var action = direction >= 1 ? 'add' : 'subtract';
|
|
93
91
|
var date = dayjs(displayedPeriod)[action](1, _this.navigateStep).toDate();
|
|
94
92
|
_this.handlers.displayedPeriod(date);
|
|
95
93
|
});
|
|
96
|
-
_defineProperty(_this, "bindHandlerNavigateClick", function (direction) {
|
|
94
|
+
_defineProperty(_assertThisInitialized(_this), "bindHandlerNavigateClick", function (direction) {
|
|
97
95
|
return function () {
|
|
98
96
|
return _this.navigateView(direction);
|
|
99
97
|
};
|
|
100
98
|
});
|
|
101
|
-
_defineProperty(_this, "handleApplyClick", function () {
|
|
99
|
+
_defineProperty(_assertThisInitialized(_this), "handleApplyClick", function () {
|
|
102
100
|
var _this$asProps = _this.asProps,
|
|
103
101
|
value = _this$asProps.value,
|
|
104
102
|
preselectedValue = _this$asProps.preselectedValue,
|
|
105
103
|
preselectedCompare = _this$asProps.preselectedCompare;
|
|
106
104
|
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);
|
|
107
105
|
});
|
|
108
|
-
_defineProperty(_this, "handleApply", function (value, compare) {
|
|
106
|
+
_defineProperty(_assertThisInitialized(_this), "handleApply", function (value, compare) {
|
|
109
107
|
_this.handlers.value({
|
|
110
108
|
value: value,
|
|
111
109
|
compare: compare
|
|
112
110
|
});
|
|
113
111
|
_this.handlers.visible(false);
|
|
114
112
|
});
|
|
115
|
-
_defineProperty(_this, "handleKeydownDown", function (place) {
|
|
113
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeydownDown", function (place) {
|
|
116
114
|
return function (e) {
|
|
117
115
|
var _this$asProps2 = _this.asProps,
|
|
118
116
|
displayedPeriod = _this$asProps2.displayedPeriod,
|
|
119
117
|
preselectedValue = _this$asProps2.preselectedValue,
|
|
120
118
|
visible = _this$asProps2.visible,
|
|
121
119
|
focusedRange = _this$asProps2.focusedRange;
|
|
122
|
-
var key = e.key
|
|
123
|
-
target = e.target;
|
|
120
|
+
var key = e.key;
|
|
124
121
|
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
122
|
if (place === 'trigger' && INTERACTION_KEYS.includes(key)) {
|
|
127
123
|
e.preventDefault();
|
|
128
124
|
e.stopPropagation();
|
|
@@ -156,13 +152,7 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
156
152
|
}
|
|
157
153
|
return displayedPeriod;
|
|
158
154
|
};
|
|
159
|
-
|
|
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) {
|
|
155
|
+
if (place === 'popper' && e.key === ' ' && highlighted.length) {
|
|
166
156
|
var highlightedDate = highlighted[1] || highlighted[0];
|
|
167
157
|
if (!_this.isDisabled(highlightedDate)) {
|
|
168
158
|
_this.handleChange(highlightedDate);
|
|
@@ -204,17 +194,17 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
204
194
|
var _this$unitRefs$format;
|
|
205
195
|
var formatter = _this.keyStep === 'month' ? formatMMYY : formatDDMMYY;
|
|
206
196
|
var formattedDate = formatter(changedDate, _this.asProps.locale);
|
|
207
|
-
(_this$unitRefs$format = _this.unitRefs[formattedDate]) === null || _this$unitRefs$format === void 0
|
|
197
|
+
(_this$unitRefs$format = _this.unitRefs[formattedDate]) === null || _this$unitRefs$format === void 0 ? void 0 : _this$unitRefs$format.focus();
|
|
208
198
|
}
|
|
209
199
|
}
|
|
210
200
|
};
|
|
211
201
|
});
|
|
212
|
-
_defineProperty(_this, "triggerFormattingProps", {
|
|
202
|
+
_defineProperty(_assertThisInitialized(_this), "triggerFormattingProps", {
|
|
213
203
|
day: 'numeric',
|
|
214
204
|
month: 'short',
|
|
215
205
|
year: 'numeric'
|
|
216
206
|
});
|
|
217
|
-
_defineProperty(_this, "handleChange", function (date) {
|
|
207
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (date) {
|
|
218
208
|
var _value, _value2, _value3;
|
|
219
209
|
var _this$asProps3 = _this.asProps,
|
|
220
210
|
focusedRange = _this$asProps3.focusedRange,
|
|
@@ -247,8 +237,7 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
247
237
|
});
|
|
248
238
|
return _this;
|
|
249
239
|
}
|
|
250
|
-
|
|
251
|
-
return _createClass(DateRangeComparatorAbstract, [{
|
|
240
|
+
_createClass(DateRangeComparatorAbstract, [{
|
|
252
241
|
key: "getPeriodProps",
|
|
253
242
|
value: function getPeriodProps() {
|
|
254
243
|
var _this$asProps$value,
|
|
@@ -271,23 +260,17 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
271
260
|
return {
|
|
272
261
|
periods: periods,
|
|
273
262
|
value: value,
|
|
274
|
-
|
|
263
|
+
onChange: function onChange(value) {
|
|
275
264
|
if (focusedRange === 'compare') {
|
|
276
265
|
_this2.handlers.preselectedCompare(value);
|
|
277
266
|
} else {
|
|
278
267
|
_this2.handlers.preselectedValue(value);
|
|
279
268
|
}
|
|
280
269
|
},
|
|
281
|
-
|
|
270
|
+
onHighlightedChange: focusedRange === 'compare' ? onCompareHighlightedChange : onHighlightedChange,
|
|
282
271
|
onDisplayedPeriodChange: onDisplayedPeriodChange,
|
|
283
|
-
|
|
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
|
-
}
|
|
272
|
+
role: 'listbox',
|
|
273
|
+
'aria-label': getI18nText('periods')
|
|
291
274
|
};
|
|
292
275
|
}
|
|
293
276
|
}, {
|
|
@@ -297,8 +280,7 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
297
280
|
var navigateStep = this.navigateStep;
|
|
298
281
|
return {
|
|
299
282
|
getI18nText: getI18nText,
|
|
300
|
-
|
|
301
|
-
'onClick': this.bindHandlerNavigateClick(-1),
|
|
283
|
+
onClick: this.bindHandlerNavigateClick(-1),
|
|
302
284
|
'aria-label': navigateStep === 'month' ? getI18nText('prevMonth') : getI18nText('prevYear')
|
|
303
285
|
};
|
|
304
286
|
}
|
|
@@ -309,8 +291,7 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
309
291
|
var navigateStep = this.navigateStep;
|
|
310
292
|
return {
|
|
311
293
|
getI18nText: getI18nText,
|
|
312
|
-
|
|
313
|
-
'onClick': this.bindHandlerNavigateClick(1),
|
|
294
|
+
onClick: this.bindHandlerNavigateClick(1),
|
|
314
295
|
'aria-label': navigateStep === 'month' ? getI18nText('nextMonth') : getI18nText('nextYear')
|
|
315
296
|
};
|
|
316
297
|
}
|
|
@@ -329,8 +310,8 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
329
310
|
_this3.handlers.compareToggle(undefined);
|
|
330
311
|
_this3.handlers.focusedRange('value');
|
|
331
312
|
} 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
|
|
313
|
+
var _this3$asProps$value, _this3$asProps$value$;
|
|
314
|
+
_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
315
|
}
|
|
335
316
|
var _this3$asProps = _this3.asProps,
|
|
336
317
|
value = _this3$asProps.value,
|
|
@@ -356,7 +337,7 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
356
337
|
value: [null, function (value) {
|
|
357
338
|
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
339
|
var _date$isValid;
|
|
359
|
-
return date === null || date === void 0
|
|
340
|
+
return date === null || date === void 0 ? void 0 : (_date$isValid = date.isValid) === null || _date$isValid === void 0 ? void 0 : _date$isValid.call(date);
|
|
360
341
|
});
|
|
361
342
|
if (dates.length > 0) _this3.handlers.displayedPeriod(getLatestDate(value));
|
|
362
343
|
}]
|
|
@@ -368,8 +349,7 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
368
349
|
var getI18nText = this.asProps.getI18nText;
|
|
369
350
|
return {
|
|
370
351
|
getI18nText: getI18nText,
|
|
371
|
-
onClick: this.handleApplyClick
|
|
372
|
-
ref: this.applyButtonRef
|
|
352
|
+
onClick: this.handleApplyClick
|
|
373
353
|
};
|
|
374
354
|
}
|
|
375
355
|
}, {
|
|
@@ -381,8 +361,7 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
381
361
|
getI18nText: getI18nText,
|
|
382
362
|
onClick: function onClick() {
|
|
383
363
|
return _this4.handleApply(null, null);
|
|
384
|
-
}
|
|
385
|
-
ref: this.resetButtonRef
|
|
364
|
+
}
|
|
386
365
|
};
|
|
387
366
|
}
|
|
388
367
|
}, {
|
|
@@ -412,7 +391,7 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
412
391
|
}
|
|
413
392
|
}, {
|
|
414
393
|
key: "getTitleProps",
|
|
415
|
-
value: function getTitleProps(
|
|
394
|
+
value: function getTitleProps(props, index) {
|
|
416
395
|
var _this$asProps5 = this.asProps,
|
|
417
396
|
locale = _this$asProps5.locale,
|
|
418
397
|
displayedPeriod = _this$asProps5.displayedPeriod;
|
|
@@ -425,14 +404,14 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
425
404
|
}
|
|
426
405
|
}, {
|
|
427
406
|
key: "getTriggerProps",
|
|
428
|
-
value: function getTriggerProps(
|
|
407
|
+
value: function getTriggerProps(_ref10) {
|
|
429
408
|
var _this$asProps$value3,
|
|
430
409
|
_this$asProps$value4,
|
|
431
410
|
_this5 = this;
|
|
432
|
-
var
|
|
433
|
-
placeholder =
|
|
434
|
-
|
|
435
|
-
separator =
|
|
411
|
+
var _ref10$placeholder = _ref10.placeholder,
|
|
412
|
+
placeholder = _ref10$placeholder === void 0 ? 'Select date ranges' : _ref10$placeholder,
|
|
413
|
+
_ref10$separator = _ref10.separator,
|
|
414
|
+
separator = _ref10$separator === void 0 ? 'vs.' : _ref10$separator;
|
|
436
415
|
var _this$asProps6 = this.asProps,
|
|
437
416
|
locale = _this$asProps6.locale,
|
|
438
417
|
visible = _this$asProps6.visible;
|
|
@@ -523,7 +502,7 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
523
502
|
return {
|
|
524
503
|
popoverVisible: visible,
|
|
525
504
|
focused: focusedRange === 'compare' ? true : undefined,
|
|
526
|
-
disabled: !(compareToggle !== null && compareToggle !== void 0 ? compareToggle : value === null || value === void 0
|
|
505
|
+
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),
|
|
527
506
|
value: preselectedCompare !== null && preselectedCompare !== void 0 ? preselectedCompare : value === null || value === void 0 ? void 0 : value.compare,
|
|
528
507
|
onChange: function onChange(value) {
|
|
529
508
|
return _this7.handlers.preselectedCompare(value);
|
|
@@ -546,6 +525,7 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
546
525
|
var _this8 = this;
|
|
547
526
|
var _this$asProps9 = this.asProps,
|
|
548
527
|
getI18nText = _this$asProps9.getI18nText,
|
|
528
|
+
value = _this$asProps9.value,
|
|
549
529
|
compareToggle = _this$asProps9.compareToggle;
|
|
550
530
|
return {
|
|
551
531
|
getI18nText: getI18nText,
|
|
@@ -565,19 +545,19 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
565
545
|
}, {
|
|
566
546
|
key: "getCalendarProps",
|
|
567
547
|
value: function getCalendarProps(_props, index) {
|
|
568
|
-
var _this$
|
|
569
|
-
locale = _this$
|
|
570
|
-
displayedPeriod = _this$
|
|
571
|
-
disabled = _this$
|
|
572
|
-
value = _this$
|
|
573
|
-
onCompareHighlightedChange = _this$
|
|
574
|
-
highlighted = _this$
|
|
575
|
-
compareHighlighted = _this$
|
|
576
|
-
onHighlightedChange = _this$
|
|
577
|
-
preselectedCompare = _this$
|
|
578
|
-
preselectedValue = _this$
|
|
579
|
-
focusedRange = _this$
|
|
580
|
-
getI18nText = _this$
|
|
548
|
+
var _this$asProps10 = this.asProps,
|
|
549
|
+
locale = _this$asProps10.locale,
|
|
550
|
+
displayedPeriod = _this$asProps10.displayedPeriod,
|
|
551
|
+
disabled = _this$asProps10.disabled,
|
|
552
|
+
value = _this$asProps10.value,
|
|
553
|
+
onCompareHighlightedChange = _this$asProps10.onCompareHighlightedChange,
|
|
554
|
+
highlighted = _this$asProps10.highlighted,
|
|
555
|
+
compareHighlighted = _this$asProps10.compareHighlighted,
|
|
556
|
+
onHighlightedChange = _this$asProps10.onHighlightedChange,
|
|
557
|
+
preselectedCompare = _this$asProps10.preselectedCompare,
|
|
558
|
+
preselectedValue = _this$asProps10.preselectedValue,
|
|
559
|
+
focusedRange = _this$asProps10.focusedRange,
|
|
560
|
+
getI18nText = _this$asProps10.getI18nText;
|
|
581
561
|
return {
|
|
582
562
|
locale: locale,
|
|
583
563
|
displayedPeriod: dayjs(displayedPeriod).add(index, this.navigateStep).startOf(this.navigateStep).toDate(),
|
|
@@ -610,10 +590,10 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
610
590
|
value: function render() {
|
|
611
591
|
var _ref = this.asProps,
|
|
612
592
|
_ref4;
|
|
613
|
-
var _this$
|
|
614
|
-
Children = _this$
|
|
615
|
-
styles = _this$
|
|
616
|
-
providedAriaLabel = _this$
|
|
593
|
+
var _this$asProps11 = this.asProps,
|
|
594
|
+
Children = _this$asProps11.Children,
|
|
595
|
+
styles = _this$asProps11.styles,
|
|
596
|
+
providedAriaLabel = _this$asProps11['aria-label'];
|
|
617
597
|
return /*#__PURE__*/React.createElement(React.Fragment, null, (_ref4 = sstyled(styles), /*#__PURE__*/React.createElement(Dropdown, _assignProps({
|
|
618
598
|
"use:aria-label": providedAriaLabel,
|
|
619
599
|
"__excludeProps": ['onChange', 'value']
|
|
@@ -621,11 +601,11 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
621
601
|
}
|
|
622
602
|
}], [{
|
|
623
603
|
key: "defaultProps",
|
|
624
|
-
value: function defaultProps(
|
|
625
|
-
var primaryRange =
|
|
626
|
-
defaultPrimaryRange =
|
|
627
|
-
secondaryRange =
|
|
628
|
-
defaultSecondaryRange =
|
|
604
|
+
value: function defaultProps(_ref11) {
|
|
605
|
+
var primaryRange = _ref11.primaryRange,
|
|
606
|
+
defaultPrimaryRange = _ref11.defaultPrimaryRange,
|
|
607
|
+
secondaryRange = _ref11.secondaryRange,
|
|
608
|
+
defaultSecondaryRange = _ref11.defaultSecondaryRange;
|
|
629
609
|
return {
|
|
630
610
|
i18n: localizedMessages,
|
|
631
611
|
locale: 'en',
|
|
@@ -643,6 +623,7 @@ var DateRangeComparatorAbstract = /*#__PURE__*/function (_Component) {
|
|
|
643
623
|
};
|
|
644
624
|
}
|
|
645
625
|
}]);
|
|
626
|
+
return DateRangeComparatorAbstract;
|
|
646
627
|
}(Component);
|
|
647
628
|
_defineProperty(DateRangeComparatorAbstract, "displayName", 'DateRangeComparator');
|
|
648
629
|
_defineProperty(DateRangeComparatorAbstract, "style", style);
|