@semcore/date-picker 4.58.0-prerelease.0 → 4.58.0-prerelease.4
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 +21 -19
- package/lib/cjs/style/date-picker.shadow.css +8 -7
- 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 +21 -19
- package/lib/es6/style/date-picker.shadow.css +8 -7
- 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 +21 -19
- package/lib/esm/style/date-picker.shadow.css +8 -7
- 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
|
@@ -1,90 +1,93 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
4
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
-
import { sstyled
|
|
7
|
-
import
|
|
8
|
-
import Dropdown from "@semcore/dropdown";
|
|
9
|
-
import dayjs from "dayjs";
|
|
7
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
8
|
+
import { CORE_INSTANCE, sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
|
|
10
9
|
import React from "react";
|
|
10
|
+
import dayjs from "dayjs";
|
|
11
|
+
import Dropdown from "@semcore/dropdown";
|
|
12
|
+
import i18nEnhance from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
11
13
|
import { localizedMessages } from "../translations/__intergalactic-dynamic-locales.mjs";
|
|
12
|
-
import { formatMMYY, formatDDMMYY } from "../utils/formatDate.mjs";
|
|
13
14
|
import { includesDate } from "../utils/includesDate.mjs";
|
|
15
|
+
import { formatMMYY, formatDDMMYY } from "../utils/formatDate.mjs";
|
|
14
16
|
/*!__reshadow-styles__:"../style/date-picker.shadow.css"*/
|
|
15
17
|
var style = (
|
|
16
18
|
/*__reshadow_css_start__*/
|
|
17
19
|
(sstyled.insert(
|
|
18
20
|
/*__inner_css_start__*/
|
|
19
|
-
".
|
|
21
|
+
".___SPopper_ylan0_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_ylan0_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_ylan0_gg_:active,.___SPopper_ylan0_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_ylan0_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SPopper_ylan0_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_ylan0_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 33, 220, 0.469))}@media (color-gamut:p3){.___SPopper_ylan0_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___SHeader_ylan0_gg_,.___STitle_ylan0_gg_{display:flex;align-items:center}.___STitle_ylan0_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_ylan0_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_ylan0_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_ylan0_gg_ .___SInner_ylan0_gg_{justify-content:flex-start}.___SInputMask_ylan0_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_ylan0_gg_.__animationsDisabled_ylan0_gg_{transition:none}.___SInputMask_ylan0_gg_ .___SValue_ylan0_gg_{letter-spacing:0}.___SIndicator_ylan0_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@supports (color:color(display-p3 0 0 0)){.___SIndicator_ylan0_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SIndicator_ylan0_gg_{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SRangeIndicator_ylan0_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_ylan0_gg_._range_value_ylan0_gg_{background-color:var(--intergalactic-date-picker-cell-active, rgb(118, 128, 231))}.___SRangeIndicator_ylan0_gg_._range_compare_ylan0_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, rgb(162, 97, 253))}.___SRangeIndicator_ylan0_gg_.__disabled_ylan0_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4)}.___SHumanizedDate_ylan0_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_ylan0_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_ylan0_gg_ .___SMask_ylan0_gg_,.___SDateRange_ylan0_gg_ .___SValue_ylan0_gg_,.___SSingleDateInput_ylan0_gg_ .___SMask_ylan0_gg_,.___SSingleDateInput_ylan0_gg_ .___SValue_ylan0_gg_{opacity:0}.___SSingleDateInput_ylan0_gg_:focus-within .___SHumanizedDate_ylan0_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_ylan0_gg_:focus-within .___SMask_ylan0_gg_,.___SSingleDateInput_ylan0_gg_:focus-within .___SValue_ylan0_gg_{opacity:1}.___SDateRange_ylan0_gg_:focus-within .___SHumanizedDate_ylan0_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_ylan0_gg_:focus-within .___SMask_ylan0_gg_,.___SDateRange_ylan0_gg_:focus-within .___SValue_ylan0_gg_{opacity:1}.___SInputMask_ylan0_gg_.__noHumanizedDate_ylan0_gg_ .___SMask_ylan0_gg_,.___SInputMask_ylan0_gg_.__noHumanizedDate_ylan0_gg_ .___SValue_ylan0_gg_{opacity:1}.___SDateRange_ylan0_gg_ .___SInputMask_ylan0_gg_:focus-within .___SMask_ylan0_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgb(226, 235, 255))}@supports (color:color(display-p3 0 0 0)){.___SDateRange_ylan0_gg_ .___SInputMask_ylan0_gg_:focus-within .___SMask_ylan0_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgb(226, 235, 255))}@media (color-gamut:p3){.___SDateRange_ylan0_gg_ .___SInputMask_ylan0_gg_:focus-within .___SMask_ylan0_gg_{background-color:var(--intergalactic-bg-highlight-focus, color(display-p3 0.89101 0.91919 1))}}}.___SDateRange_ylan0_gg_:focus-within .___SRangeSep_ylan0_gg_,.___SRangeSep_ylan0_gg_.__fulfilled_ylan0_gg_{color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___SRangeComparatorHeader_ylan0_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_ylan0_gg_{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SRangeComparatorHeader_ylan0_gg_{border-bottom:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SFooter_ylan0_gg_,.___SRangeCalendar_ylan0_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_ylan0_gg_{border-top:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0)){.___SFooter_ylan0_gg_{border-top:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SFooter_ylan0_gg_{border-top:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SPeriodsList_ylan0_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_ylan0_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_ylan0_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_ylan0_gg_{transition:none}}",
|
|
20
22
|
/*__inner_css_end__*/
|
|
21
|
-
"
|
|
23
|
+
"ylan0_gg_"
|
|
22
24
|
), /*__reshadow_css_end__*/
|
|
23
25
|
{
|
|
24
|
-
"__SHeader": "
|
|
25
|
-
"__STitle": "
|
|
26
|
-
"__SToday": "
|
|
27
|
-
"__SPeriod": "
|
|
28
|
-
"__SButton": "
|
|
29
|
-
"__SInner": "
|
|
30
|
-
"__SInputMask": "
|
|
31
|
-
"_animationsDisabled": "
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"__SDateRange": "
|
|
42
|
-
"_noHumanizedDate": "
|
|
43
|
-
"__SRangeSep": "
|
|
44
|
-
"_fulfilled": "
|
|
45
|
-
"__SRangeComparatorHeader": "
|
|
46
|
-
"__SRangeCalendar": "
|
|
47
|
-
"__SFooter": "
|
|
48
|
-
"__SPeriodsList": "
|
|
49
|
-
"__STooltip": "
|
|
50
|
-
"__SCompareToggle": "
|
|
51
|
-
"__SPopper": "
|
|
26
|
+
"__SHeader": "___SHeader_ylan0_gg_",
|
|
27
|
+
"__STitle": "___STitle_ylan0_gg_",
|
|
28
|
+
"__SToday": "___SToday_ylan0_gg_",
|
|
29
|
+
"__SPeriod": "___SPeriod_ylan0_gg_",
|
|
30
|
+
"__SButton": "___SButton_ylan0_gg_",
|
|
31
|
+
"__SInner": "___SInner_ylan0_gg_",
|
|
32
|
+
"__SInputMask": "___SInputMask_ylan0_gg_",
|
|
33
|
+
"_animationsDisabled": "__animationsDisabled_ylan0_gg_",
|
|
34
|
+
"__SValue": "___SValue_ylan0_gg_",
|
|
35
|
+
"__SIndicator": "___SIndicator_ylan0_gg_",
|
|
36
|
+
"__SRangeIndicator": "___SRangeIndicator_ylan0_gg_",
|
|
37
|
+
"_range_value": "_range_value_ylan0_gg_",
|
|
38
|
+
"_range_compare": "_range_compare_ylan0_gg_",
|
|
39
|
+
"_disabled": "__disabled_ylan0_gg_",
|
|
40
|
+
"__SHumanizedDate": "___SHumanizedDate_ylan0_gg_",
|
|
41
|
+
"__SMask": "___SMask_ylan0_gg_",
|
|
42
|
+
"__SSingleDateInput": "___SSingleDateInput_ylan0_gg_",
|
|
43
|
+
"__SDateRange": "___SDateRange_ylan0_gg_",
|
|
44
|
+
"_noHumanizedDate": "__noHumanizedDate_ylan0_gg_",
|
|
45
|
+
"__SRangeSep": "___SRangeSep_ylan0_gg_",
|
|
46
|
+
"_fulfilled": "__fulfilled_ylan0_gg_",
|
|
47
|
+
"__SRangeComparatorHeader": "___SRangeComparatorHeader_ylan0_gg_",
|
|
48
|
+
"__SRangeCalendar": "___SRangeCalendar_ylan0_gg_",
|
|
49
|
+
"__SFooter": "___SFooter_ylan0_gg_",
|
|
50
|
+
"__SPeriodsList": "___SPeriodsList_ylan0_gg_",
|
|
51
|
+
"__STooltip": "___STooltip_ylan0_gg_",
|
|
52
|
+
"__SCompareToggle": "___SCompareToggle_ylan0_gg_",
|
|
53
|
+
"__SPopper": "___SPopper_ylan0_gg_"
|
|
52
54
|
})
|
|
53
55
|
);
|
|
54
56
|
var INTERACTION_TAGS = ["INPUT"];
|
|
55
57
|
var INTERACTION_KEYS = ["ArrowDown", "Enter", " "];
|
|
56
58
|
var defaultDisplayedPeriod = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
|
|
57
|
-
var PickerAbstract = /* @__PURE__ */
|
|
59
|
+
var PickerAbstract = /* @__PURE__ */ function(_Component) {
|
|
60
|
+
_inherits(PickerAbstract2, _Component);
|
|
61
|
+
var _super = _createSuper(PickerAbstract2);
|
|
58
62
|
function PickerAbstract2() {
|
|
59
63
|
var _this;
|
|
60
64
|
_classCallCheck(this, PickerAbstract2);
|
|
61
65
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
62
66
|
args[_key] = arguments[_key];
|
|
63
67
|
}
|
|
64
|
-
_this =
|
|
65
|
-
_defineProperty(_this, "
|
|
66
|
-
_defineProperty(_this, "
|
|
67
|
-
_defineProperty(_this, "
|
|
68
|
-
_defineProperty(_this, "
|
|
69
|
-
_defineProperty(_this, "
|
|
70
|
-
_defineProperty(_this, "
|
|
71
|
-
_defineProperty(_this, "keyStep", void 0);
|
|
72
|
-
_defineProperty(_this, "navigateView", function(direction) {
|
|
68
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
69
|
+
_defineProperty(_assertThisInitialized(_this), "popperRef", /* @__PURE__ */ React.createRef());
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "unitRefs", {});
|
|
71
|
+
_defineProperty(_assertThisInitialized(_this), "navigateStep", void 0);
|
|
72
|
+
_defineProperty(_assertThisInitialized(_this), "keyDiff", void 0);
|
|
73
|
+
_defineProperty(_assertThisInitialized(_this), "keyStep", void 0);
|
|
74
|
+
_defineProperty(_assertThisInitialized(_this), "navigateView", function(direction) {
|
|
73
75
|
var displayedPeriod = _this.asProps.displayedPeriod;
|
|
74
76
|
var action = direction >= 1 ? "add" : "subtract";
|
|
75
77
|
var date = dayjs(displayedPeriod)[action](1, _this.navigateStep).toDate();
|
|
76
78
|
_this.handlers.displayedPeriod(date);
|
|
77
79
|
});
|
|
78
|
-
_defineProperty(_this, "bindHandlerNavigateClick", function(direction) {
|
|
80
|
+
_defineProperty(_assertThisInitialized(_this), "bindHandlerNavigateClick", function(direction) {
|
|
79
81
|
return function() {
|
|
80
82
|
_this.navigateView(direction);
|
|
81
83
|
};
|
|
82
84
|
});
|
|
83
|
-
_defineProperty(_this, "handlerKeyDown", function(place) {
|
|
85
|
+
_defineProperty(_assertThisInitialized(_this), "handlerKeyDown", function(place) {
|
|
84
86
|
return function(e) {
|
|
85
|
-
var _this$asProps = _this.asProps, value = _this$asProps.value, displayedPeriod = _this$asProps.displayedPeriod, highlighted = _this$asProps.highlighted
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
var _this$asProps = _this.asProps, value = _this$asProps.value, displayedPeriod = _this$asProps.displayedPeriod, highlighted = _this$asProps.highlighted;
|
|
88
|
+
_this$asProps.disabled;
|
|
89
|
+
var visible = _this$asProps.visible;
|
|
90
|
+
var key = e.key;
|
|
88
91
|
if (place === "trigger" && INTERACTION_KEYS.includes(key)) {
|
|
89
92
|
e.stopPropagation();
|
|
90
93
|
_this.handlers.visible(!visible);
|
|
@@ -99,7 +102,7 @@ var PickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
99
102
|
var getCurrentHighlightedDay = function getCurrentHighlightedDay2(day2) {
|
|
100
103
|
return day2.toDate();
|
|
101
104
|
};
|
|
102
|
-
if (place === "popper" && (e.key === " " || e.key === "Enter"
|
|
105
|
+
if (place === "popper" && (e.key === " " || e.key === "Enter" && highlighted.length)) {
|
|
103
106
|
if (!_this.isDisabled(highlighted[0])) {
|
|
104
107
|
_this.handlers.value(highlighted[0]);
|
|
105
108
|
}
|
|
@@ -116,15 +119,14 @@ var PickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
116
119
|
e.preventDefault();
|
|
117
120
|
var formatter = _this.keyStep === "month" ? formatMMYY : formatDDMMYY;
|
|
118
121
|
var formattedDate = formatter(current_day, _this.asProps.locale);
|
|
119
|
-
(_this$unitRefs$format = _this.unitRefs[formattedDate]) === null || _this$unitRefs$format === void 0
|
|
122
|
+
(_this$unitRefs$format = _this.unitRefs[formattedDate]) === null || _this$unitRefs$format === void 0 ? void 0 : _this$unitRefs$format.focus();
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
125
|
};
|
|
123
126
|
});
|
|
124
127
|
return _this;
|
|
125
128
|
}
|
|
126
|
-
|
|
127
|
-
return _createClass(PickerAbstract2, [{
|
|
129
|
+
_createClass(PickerAbstract2, [{
|
|
128
130
|
key: "uncontrolledProps",
|
|
129
131
|
value: function uncontrolledProps() {
|
|
130
132
|
var _this2 = this;
|
|
@@ -200,8 +202,7 @@ var PickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
200
202
|
var getI18nText = this.asProps.getI18nText;
|
|
201
203
|
var navigateStep = this.navigateStep;
|
|
202
204
|
return {
|
|
203
|
-
|
|
204
|
-
"onClick": this.bindHandlerNavigateClick(1),
|
|
205
|
+
onClick: this.bindHandlerNavigateClick(1),
|
|
205
206
|
getI18nText,
|
|
206
207
|
"aria-label": navigateStep === "month" ? getI18nText("nextMonth") : getI18nText("nextYear")
|
|
207
208
|
};
|
|
@@ -212,8 +213,7 @@ var PickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
212
213
|
var getI18nText = this.asProps.getI18nText;
|
|
213
214
|
var navigateStep = this.navigateStep;
|
|
214
215
|
return {
|
|
215
|
-
|
|
216
|
-
"onClick": this.bindHandlerNavigateClick(-1),
|
|
216
|
+
onClick: this.bindHandlerNavigateClick(-1),
|
|
217
217
|
getI18nText,
|
|
218
218
|
"aria-label": navigateStep === "month" ? getI18nText("prevMonth") : getI18nText("prevYear")
|
|
219
219
|
};
|
|
@@ -241,7 +241,7 @@ var PickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
241
241
|
value: function render() {
|
|
242
242
|
var _ref = this.asProps, _ref2;
|
|
243
243
|
var _this$asProps4 = this.asProps, styles = _this$asProps4.styles, Children = _this$asProps4.Children, providedAriaLabel = _this$asProps4["aria-label"];
|
|
244
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, (_ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(Dropdown, assignProps({
|
|
244
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (_ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(Dropdown, assignProps({
|
|
245
245
|
"use:aria-label": providedAriaLabel,
|
|
246
246
|
"__excludeProps": ["onChange", "value"]
|
|
247
247
|
}, _ref), /* @__PURE__ */ React.createElement(Children, _ref2.cn("Children", {})))));
|
|
@@ -262,7 +262,8 @@ var PickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
264
|
}]);
|
|
265
|
-
|
|
265
|
+
return PickerAbstract2;
|
|
266
|
+
}(Component);
|
|
266
267
|
_defineProperty(PickerAbstract, "displayName", "DatePicker");
|
|
267
268
|
_defineProperty(PickerAbstract, "style", style);
|
|
268
269
|
_defineProperty(PickerAbstract, "enhance", [i18nEnhance(localizedMessages)]);
|
|
@@ -1,58 +1,60 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
4
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
7
|
-
import { sstyled
|
|
8
|
-
import {
|
|
8
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import { CORE_INSTANCE, sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import dayjs from "dayjs";
|
|
9
12
|
import Button from "@semcore/button";
|
|
10
|
-
import
|
|
13
|
+
import { Flex, Box } from "@semcore/flex-box";
|
|
11
14
|
import Divider from "@semcore/divider";
|
|
12
15
|
import Dropdown from "@semcore/dropdown";
|
|
13
|
-
import
|
|
14
|
-
import React from "react";
|
|
16
|
+
import i18nEnhance from "@semcore/utils/lib/enhances/i18nEnhance";
|
|
15
17
|
import { localizedMessages } from "../translations/__intergalactic-dynamic-locales.mjs";
|
|
16
|
-
import { formatMMYY, formatDDMMYY } from "../utils/formatDate.mjs";
|
|
17
18
|
import { includesDate } from "../utils/includesDate.mjs";
|
|
19
|
+
import { formatMMYY, formatDDMMYY } from "../utils/formatDate.mjs";
|
|
18
20
|
/*!__reshadow-styles__:"../style/date-picker.shadow.css"*/
|
|
19
21
|
var style = (
|
|
20
22
|
/*__reshadow_css_start__*/
|
|
21
23
|
(sstyled.insert(
|
|
22
24
|
/*__inner_css_start__*/
|
|
23
|
-
".
|
|
25
|
+
".___SPopper_ylan0_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_ylan0_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_ylan0_gg_:active,.___SPopper_ylan0_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_ylan0_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SPopper_ylan0_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_ylan0_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 33, 220, 0.469))}@media (color-gamut:p3){.___SPopper_ylan0_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___SHeader_ylan0_gg_,.___STitle_ylan0_gg_{display:flex;align-items:center}.___STitle_ylan0_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_ylan0_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_ylan0_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_ylan0_gg_ .___SInner_ylan0_gg_{justify-content:flex-start}.___SInputMask_ylan0_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_ylan0_gg_.__animationsDisabled_ylan0_gg_{transition:none}.___SInputMask_ylan0_gg_ .___SValue_ylan0_gg_{letter-spacing:0}.___SIndicator_ylan0_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@supports (color:color(display-p3 0 0 0)){.___SIndicator_ylan0_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SIndicator_ylan0_gg_{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SRangeIndicator_ylan0_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_ylan0_gg_._range_value_ylan0_gg_{background-color:var(--intergalactic-date-picker-cell-active, rgb(118, 128, 231))}.___SRangeIndicator_ylan0_gg_._range_compare_ylan0_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, rgb(162, 97, 253))}.___SRangeIndicator_ylan0_gg_.__disabled_ylan0_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4)}.___SHumanizedDate_ylan0_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_ylan0_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_ylan0_gg_ .___SMask_ylan0_gg_,.___SDateRange_ylan0_gg_ .___SValue_ylan0_gg_,.___SSingleDateInput_ylan0_gg_ .___SMask_ylan0_gg_,.___SSingleDateInput_ylan0_gg_ .___SValue_ylan0_gg_{opacity:0}.___SSingleDateInput_ylan0_gg_:focus-within .___SHumanizedDate_ylan0_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_ylan0_gg_:focus-within .___SMask_ylan0_gg_,.___SSingleDateInput_ylan0_gg_:focus-within .___SValue_ylan0_gg_{opacity:1}.___SDateRange_ylan0_gg_:focus-within .___SHumanizedDate_ylan0_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_ylan0_gg_:focus-within .___SMask_ylan0_gg_,.___SDateRange_ylan0_gg_:focus-within .___SValue_ylan0_gg_{opacity:1}.___SInputMask_ylan0_gg_.__noHumanizedDate_ylan0_gg_ .___SMask_ylan0_gg_,.___SInputMask_ylan0_gg_.__noHumanizedDate_ylan0_gg_ .___SValue_ylan0_gg_{opacity:1}.___SDateRange_ylan0_gg_ .___SInputMask_ylan0_gg_:focus-within .___SMask_ylan0_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgb(226, 235, 255))}@supports (color:color(display-p3 0 0 0)){.___SDateRange_ylan0_gg_ .___SInputMask_ylan0_gg_:focus-within .___SMask_ylan0_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgb(226, 235, 255))}@media (color-gamut:p3){.___SDateRange_ylan0_gg_ .___SInputMask_ylan0_gg_:focus-within .___SMask_ylan0_gg_{background-color:var(--intergalactic-bg-highlight-focus, color(display-p3 0.89101 0.91919 1))}}}.___SDateRange_ylan0_gg_:focus-within .___SRangeSep_ylan0_gg_,.___SRangeSep_ylan0_gg_.__fulfilled_ylan0_gg_{color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___SRangeComparatorHeader_ylan0_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_ylan0_gg_{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SRangeComparatorHeader_ylan0_gg_{border-bottom:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SFooter_ylan0_gg_,.___SRangeCalendar_ylan0_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_ylan0_gg_{border-top:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0)){.___SFooter_ylan0_gg_{border-top:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SFooter_ylan0_gg_{border-top:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SPeriodsList_ylan0_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_ylan0_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_ylan0_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_ylan0_gg_{transition:none}}",
|
|
24
26
|
/*__inner_css_end__*/
|
|
25
|
-
"
|
|
27
|
+
"ylan0_gg_"
|
|
26
28
|
), /*__reshadow_css_end__*/
|
|
27
29
|
{
|
|
28
|
-
"__SHeader": "
|
|
29
|
-
"__STitle": "
|
|
30
|
-
"__SToday": "
|
|
31
|
-
"__SPeriod": "
|
|
32
|
-
"__SButton": "
|
|
33
|
-
"__SInner": "
|
|
34
|
-
"__SInputMask": "
|
|
35
|
-
"_animationsDisabled": "
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"__SDateRange": "
|
|
46
|
-
"_noHumanizedDate": "
|
|
47
|
-
"__SRangeSep": "
|
|
48
|
-
"_fulfilled": "
|
|
49
|
-
"__SRangeComparatorHeader": "
|
|
50
|
-
"__SRangeCalendar": "
|
|
51
|
-
"__SFooter": "
|
|
52
|
-
"__SPeriodsList": "
|
|
53
|
-
"__STooltip": "
|
|
54
|
-
"__SCompareToggle": "
|
|
55
|
-
"__SPopper": "
|
|
30
|
+
"__SHeader": "___SHeader_ylan0_gg_",
|
|
31
|
+
"__STitle": "___STitle_ylan0_gg_",
|
|
32
|
+
"__SToday": "___SToday_ylan0_gg_",
|
|
33
|
+
"__SPeriod": "___SPeriod_ylan0_gg_",
|
|
34
|
+
"__SButton": "___SButton_ylan0_gg_",
|
|
35
|
+
"__SInner": "___SInner_ylan0_gg_",
|
|
36
|
+
"__SInputMask": "___SInputMask_ylan0_gg_",
|
|
37
|
+
"_animationsDisabled": "__animationsDisabled_ylan0_gg_",
|
|
38
|
+
"__SValue": "___SValue_ylan0_gg_",
|
|
39
|
+
"__SIndicator": "___SIndicator_ylan0_gg_",
|
|
40
|
+
"__SRangeIndicator": "___SRangeIndicator_ylan0_gg_",
|
|
41
|
+
"_range_value": "_range_value_ylan0_gg_",
|
|
42
|
+
"_range_compare": "_range_compare_ylan0_gg_",
|
|
43
|
+
"_disabled": "__disabled_ylan0_gg_",
|
|
44
|
+
"__SHumanizedDate": "___SHumanizedDate_ylan0_gg_",
|
|
45
|
+
"__SMask": "___SMask_ylan0_gg_",
|
|
46
|
+
"__SSingleDateInput": "___SSingleDateInput_ylan0_gg_",
|
|
47
|
+
"__SDateRange": "___SDateRange_ylan0_gg_",
|
|
48
|
+
"_noHumanizedDate": "__noHumanizedDate_ylan0_gg_",
|
|
49
|
+
"__SRangeSep": "___SRangeSep_ylan0_gg_",
|
|
50
|
+
"_fulfilled": "__fulfilled_ylan0_gg_",
|
|
51
|
+
"__SRangeComparatorHeader": "___SRangeComparatorHeader_ylan0_gg_",
|
|
52
|
+
"__SRangeCalendar": "___SRangeCalendar_ylan0_gg_",
|
|
53
|
+
"__SFooter": "___SFooter_ylan0_gg_",
|
|
54
|
+
"__SPeriodsList": "___SPeriodsList_ylan0_gg_",
|
|
55
|
+
"__STooltip": "___STooltip_ylan0_gg_",
|
|
56
|
+
"__SCompareToggle": "___SCompareToggle_ylan0_gg_",
|
|
57
|
+
"__SPopper": "___SPopper_ylan0_gg_"
|
|
56
58
|
})
|
|
57
59
|
);
|
|
58
60
|
var INTERACTION_TAGS = ["INPUT"];
|
|
@@ -63,40 +65,36 @@ function getEndDate(value) {
|
|
|
63
65
|
var _value = _slicedToArray(value, 2), startDate = _value[0], _value$ = _value[1], endDate = _value$ === void 0 ? startDate : _value$;
|
|
64
66
|
return endDate;
|
|
65
67
|
}
|
|
66
|
-
var RangePickerAbstract = /* @__PURE__ */
|
|
68
|
+
var RangePickerAbstract = /* @__PURE__ */ function(_Component) {
|
|
69
|
+
_inherits(RangePickerAbstract2, _Component);
|
|
70
|
+
var _super = _createSuper(RangePickerAbstract2);
|
|
67
71
|
function RangePickerAbstract2() {
|
|
68
72
|
var _this;
|
|
69
73
|
_classCallCheck(this, RangePickerAbstract2);
|
|
70
74
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
71
75
|
args[_key] = arguments[_key];
|
|
72
76
|
}
|
|
73
|
-
_this =
|
|
74
|
-
_defineProperty(_this, "
|
|
75
|
-
_defineProperty(_this, "
|
|
76
|
-
_defineProperty(_this, "
|
|
77
|
-
_defineProperty(_this, "
|
|
78
|
-
_defineProperty(_this, "
|
|
79
|
-
_defineProperty(_this, "
|
|
80
|
-
_defineProperty(_this, "unitRefs", {});
|
|
81
|
-
_defineProperty(_this, "navigateStep", void 0);
|
|
82
|
-
_defineProperty(_this, "keyDiff", void 0);
|
|
83
|
-
_defineProperty(_this, "keyStep", void 0);
|
|
84
|
-
_defineProperty(_this, "navigateView", function(direction) {
|
|
77
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
78
|
+
_defineProperty(_assertThisInitialized(_this), "popperRef", /* @__PURE__ */ React.createRef());
|
|
79
|
+
_defineProperty(_assertThisInitialized(_this), "unitRefs", {});
|
|
80
|
+
_defineProperty(_assertThisInitialized(_this), "navigateStep", void 0);
|
|
81
|
+
_defineProperty(_assertThisInitialized(_this), "keyDiff", void 0);
|
|
82
|
+
_defineProperty(_assertThisInitialized(_this), "keyStep", void 0);
|
|
83
|
+
_defineProperty(_assertThisInitialized(_this), "navigateView", function(direction) {
|
|
85
84
|
var displayedPeriod = _this.asProps.displayedPeriod;
|
|
86
85
|
var action = direction >= 1 ? "add" : "subtract";
|
|
87
86
|
var date = dayjs(displayedPeriod)[action](1, _this.navigateStep).toDate();
|
|
88
87
|
_this.handlers.displayedPeriod(date);
|
|
89
88
|
});
|
|
90
|
-
_defineProperty(_this, "bindHandlerNavigateClick", function(direction) {
|
|
89
|
+
_defineProperty(_assertThisInitialized(_this), "bindHandlerNavigateClick", function(direction) {
|
|
91
90
|
return function() {
|
|
92
91
|
return _this.navigateView(direction);
|
|
93
92
|
};
|
|
94
93
|
});
|
|
95
|
-
_defineProperty(_this, "handlerKeyDown", function(place) {
|
|
94
|
+
_defineProperty(_assertThisInitialized(_this), "handlerKeyDown", function(place) {
|
|
96
95
|
return function(e) {
|
|
97
96
|
var _this$asProps = _this.asProps, displayedPeriod = _this$asProps.displayedPeriod, highlighted = _this$asProps.highlighted, preselectedValue = _this$asProps.preselectedValue, visible = _this$asProps.visible;
|
|
98
|
-
var key = e.key
|
|
99
|
-
if ([" ", "Enter"].includes(key) && [_this.prevButtonRef.current, _this.nextButtonRef.current].includes(target)) return;
|
|
97
|
+
var key = e.key;
|
|
100
98
|
if (place === "trigger" && INTERACTION_KEYS.includes(key)) {
|
|
101
99
|
e.stopPropagation();
|
|
102
100
|
_this.handlers.visible(!visible);
|
|
@@ -130,13 +128,7 @@ var RangePickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
130
128
|
if (place === "popper" && e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
|
131
129
|
return _this.handleApplyClick();
|
|
132
130
|
}
|
|
133
|
-
|
|
134
|
-
return el === target;
|
|
135
|
-
});
|
|
136
|
-
var isResetButtonTarget = target === _this.resetButtonRef.current;
|
|
137
|
-
var isApplyButtonTarget = target === _this.applyButtonRef.current;
|
|
138
|
-
var areTargetedControls = isPeriodTarget || isResetButtonTarget || isApplyButtonTarget;
|
|
139
|
-
if (place === "popper" && e.key === " " && highlighted.length && !areTargetedControls) {
|
|
131
|
+
if (place === "popper" && e.key === " " && highlighted.length) {
|
|
140
132
|
var highlightedDate = highlighted[1] || highlighted[0];
|
|
141
133
|
if (!_this.isDisabled(highlightedDate)) {
|
|
142
134
|
_this.handleChange(highlightedDate);
|
|
@@ -167,23 +159,18 @@ var RangePickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
167
159
|
var _this$unitRefs$format;
|
|
168
160
|
var formatter = _this.keyStep === "month" ? formatMMYY : formatDDMMYY;
|
|
169
161
|
var formattedDate = formatter(changedDate, _this.asProps.locale);
|
|
170
|
-
(_this$unitRefs$format = _this.unitRefs[formattedDate]) === null || _this$unitRefs$format === void 0
|
|
162
|
+
(_this$unitRefs$format = _this.unitRefs[formattedDate]) === null || _this$unitRefs$format === void 0 ? void 0 : _this$unitRefs$format.focus();
|
|
171
163
|
}
|
|
172
164
|
}
|
|
173
165
|
};
|
|
174
166
|
});
|
|
175
|
-
_defineProperty(_this, "
|
|
176
|
-
_this.handleChange([]);
|
|
177
|
-
_this.handlers.value([]);
|
|
178
|
-
_this.handlers.visible(false);
|
|
179
|
-
});
|
|
180
|
-
_defineProperty(_this, "handleApply", function(value) {
|
|
167
|
+
_defineProperty(_assertThisInitialized(_this), "handleApply", function(value) {
|
|
181
168
|
var _value2 = _slicedToArray(value, 2), startDate = _value2[0], _value2$ = _value2[1], endDate = _value2$ === void 0 ? startDate : _value2$;
|
|
182
169
|
_this.handleChange([]);
|
|
183
170
|
_this.handlers.value([startDate, endDate]);
|
|
184
171
|
_this.handlers.visible(false);
|
|
185
172
|
});
|
|
186
|
-
_defineProperty(_this, "handleChange", function(date) {
|
|
173
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function(date) {
|
|
187
174
|
var preselectedValue = _this.asProps.preselectedValue;
|
|
188
175
|
var highlighted = [];
|
|
189
176
|
if (Array.isArray(date)) {
|
|
@@ -202,14 +189,13 @@ var RangePickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
202
189
|
_this.handlers.preselectedValue(preselectedValue);
|
|
203
190
|
_this.handlers.highlighted(highlighted);
|
|
204
191
|
});
|
|
205
|
-
_defineProperty(_this, "handleApplyClick", function() {
|
|
192
|
+
_defineProperty(_assertThisInitialized(_this), "handleApplyClick", function() {
|
|
206
193
|
var _this$asProps2 = _this.asProps, value = _this$asProps2.value, preselectedValue = _this$asProps2.preselectedValue;
|
|
207
194
|
return _this.handleApply(preselectedValue.length ? preselectedValue : value);
|
|
208
195
|
});
|
|
209
196
|
return _this;
|
|
210
197
|
}
|
|
211
|
-
|
|
212
|
-
return _createClass(RangePickerAbstract2, [{
|
|
198
|
+
_createClass(RangePickerAbstract2, [{
|
|
213
199
|
key: "uncontrolledProps",
|
|
214
200
|
value: function uncontrolledProps() {
|
|
215
201
|
var _this2 = this;
|
|
@@ -308,7 +294,7 @@ var RangePickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
308
294
|
}
|
|
309
295
|
}, {
|
|
310
296
|
key: "getTitleProps",
|
|
311
|
-
value: function getTitleProps(
|
|
297
|
+
value: function getTitleProps(props, index) {
|
|
312
298
|
var _this$asProps5 = this.asProps, locale = _this$asProps5.locale, displayedPeriod = _this$asProps5.displayedPeriod;
|
|
313
299
|
return {
|
|
314
300
|
children: new Intl.DateTimeFormat(locale, {
|
|
@@ -323,8 +309,7 @@ var RangePickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
323
309
|
var getI18nText = this.asProps.getI18nText;
|
|
324
310
|
var navigateStep = this.navigateStep;
|
|
325
311
|
return {
|
|
326
|
-
|
|
327
|
-
"onClick": this.bindHandlerNavigateClick(1),
|
|
312
|
+
onClick: this.bindHandlerNavigateClick(1),
|
|
328
313
|
getI18nText,
|
|
329
314
|
"aria-label": navigateStep === "month" ? getI18nText("nextMonth") : getI18nText("nextYear")
|
|
330
315
|
};
|
|
@@ -335,8 +320,7 @@ var RangePickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
335
320
|
var getI18nText = this.asProps.getI18nText;
|
|
336
321
|
var navigateStep = this.navigateStep;
|
|
337
322
|
return {
|
|
338
|
-
|
|
339
|
-
"onClick": this.bindHandlerNavigateClick(-1),
|
|
323
|
+
onClick: this.bindHandlerNavigateClick(-1),
|
|
340
324
|
getI18nText,
|
|
341
325
|
"aria-label": navigateStep === "month" ? getI18nText("prevMonth") : getI18nText("prevYear")
|
|
342
326
|
};
|
|
@@ -363,22 +347,15 @@ var RangePickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
363
347
|
}, {
|
|
364
348
|
key: "getPeriodProps",
|
|
365
349
|
value: function getPeriodProps() {
|
|
366
|
-
var _this3 = this;
|
|
367
350
|
var _this$asProps7 = this.asProps, _this$asProps7$period = _this$asProps7.periods, periods = _this$asProps7$period === void 0 ? this.getDefaultPeriods() : _this$asProps7$period, value = _this$asProps7.value, onHighlightedChange = _this$asProps7.onHighlightedChange, onDisplayedPeriodChange = _this$asProps7.onDisplayedPeriodChange, preselectedValue = _this$asProps7.preselectedValue, getI18nText = _this$asProps7.getI18nText;
|
|
368
351
|
return {
|
|
369
352
|
periods,
|
|
370
|
-
|
|
371
|
-
|
|
353
|
+
value: preselectedValue.length ? preselectedValue : value,
|
|
354
|
+
onChange: this.handleApply,
|
|
372
355
|
onHighlightedChange,
|
|
373
356
|
onDisplayedPeriodChange,
|
|
374
|
-
|
|
375
|
-
"aria-label": getI18nText("periods")
|
|
376
|
-
"periodRef": function periodRef(index) {
|
|
377
|
-
return function(element) {
|
|
378
|
-
if (!element) return;
|
|
379
|
-
_this3.periodRefs[index] = element;
|
|
380
|
-
};
|
|
381
|
-
}
|
|
357
|
+
role: "listbox",
|
|
358
|
+
"aria-label": getI18nText("periods")
|
|
382
359
|
};
|
|
383
360
|
}
|
|
384
361
|
}, {
|
|
@@ -387,18 +364,19 @@ var RangePickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
387
364
|
var getI18nText = this.asProps.getI18nText;
|
|
388
365
|
return {
|
|
389
366
|
getI18nText,
|
|
390
|
-
onClick: this.handleApplyClick
|
|
391
|
-
ref: this.applyButtonRef
|
|
367
|
+
onClick: this.handleApplyClick
|
|
392
368
|
};
|
|
393
369
|
}
|
|
394
370
|
}, {
|
|
395
371
|
key: "getResetProps",
|
|
396
372
|
value: function getResetProps() {
|
|
373
|
+
var _this3 = this;
|
|
397
374
|
var getI18nText = this.asProps.getI18nText;
|
|
398
375
|
return {
|
|
399
376
|
getI18nText,
|
|
400
|
-
onClick:
|
|
401
|
-
|
|
377
|
+
onClick: function onClick() {
|
|
378
|
+
return _this3.handleApply([]);
|
|
379
|
+
}
|
|
402
380
|
};
|
|
403
381
|
}
|
|
404
382
|
}, {
|
|
@@ -406,7 +384,7 @@ var RangePickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
406
384
|
value: function render() {
|
|
407
385
|
var _ref = this.asProps, _ref4;
|
|
408
386
|
var _this$asProps8 = this.asProps, Children = _this$asProps8.Children, styles = _this$asProps8.styles, providedAriaLabel = _this$asProps8["aria-label"];
|
|
409
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, (_ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(Dropdown, assignProps({
|
|
387
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, (_ref4 = sstyled$1(styles), /* @__PURE__ */ React.createElement(Dropdown, assignProps({
|
|
410
388
|
"use:aria-label": providedAriaLabel,
|
|
411
389
|
"__excludeProps": ["onChange", "value"]
|
|
412
390
|
}, _ref), /* @__PURE__ */ React.createElement(Children, _ref4.cn("Children", {})))));
|
|
@@ -428,7 +406,8 @@ var RangePickerAbstract = /* @__PURE__ */ (function(_Component) {
|
|
|
428
406
|
};
|
|
429
407
|
}
|
|
430
408
|
}]);
|
|
431
|
-
|
|
409
|
+
return RangePickerAbstract2;
|
|
410
|
+
}(Component);
|
|
432
411
|
_defineProperty(RangePickerAbstract, "displayName", "DatePicker");
|
|
433
412
|
_defineProperty(RangePickerAbstract, "style", style);
|
|
434
413
|
_defineProperty(RangePickerAbstract, "enhance", [i18nEnhance(localizedMessages)]);
|